google_domains1/api.rs
1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16 /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17 CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21 fn as_ref(&self) -> &str {
22 match *self {
23 Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24 }
25 }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30 fn default() -> Scope {
31 Scope::CloudPlatform
32 }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all CloudDomains related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_domains1 as domains1;
49/// use domains1::api::Registration;
50/// use domains1::{Result, Error};
51/// # async fn dox() {
52/// use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = CloudDomains::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Registration::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_registrations_patch(req, "name")
99/// .update_mask(FieldMask::new::<&str>(&[]))
100/// .doit().await;
101///
102/// match result {
103/// Err(e) => match e {
104/// // The Error enum provides details about what exactly happened.
105/// // You can also just use its `Debug`, `Display` or `Error` traits
106/// Error::HttpError(_)
107/// |Error::Io(_)
108/// |Error::MissingAPIKey
109/// |Error::MissingToken(_)
110/// |Error::Cancelled
111/// |Error::UploadSizeLimitExceeded(_, _)
112/// |Error::Failure(_)
113/// |Error::BadRequest(_)
114/// |Error::FieldClash(_)
115/// |Error::JsonDecodeError(_, _) => println!("{}", e),
116/// },
117/// Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct CloudDomains<C> {
123 pub client: common::Client<C>,
124 pub auth: Box<dyn common::GetToken>,
125 _user_agent: String,
126 _base_url: String,
127 _root_url: String,
128}
129
130impl<C> common::Hub for CloudDomains<C> {}
131
132impl<'a, C> CloudDomains<C> {
133 pub fn new<A: 'static + common::GetToken>(
134 client: common::Client<C>,
135 auth: A,
136 ) -> CloudDomains<C> {
137 CloudDomains {
138 client,
139 auth: Box::new(auth),
140 _user_agent: "google-api-rust-client/7.0.0".to_string(),
141 _base_url: "https://domains.googleapis.com/".to_string(),
142 _root_url: "https://domains.googleapis.com/".to_string(),
143 }
144 }
145
146 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
147 ProjectMethods { hub: self }
148 }
149
150 /// Set the user-agent header field to use in all requests to the server.
151 /// It defaults to `google-api-rust-client/7.0.0`.
152 ///
153 /// Returns the previously set user-agent.
154 pub fn user_agent(&mut self, agent_name: String) -> String {
155 std::mem::replace(&mut self._user_agent, agent_name)
156 }
157
158 /// Set the base url to use in all requests to the server.
159 /// It defaults to `https://domains.googleapis.com/`.
160 ///
161 /// Returns the previously set base url.
162 pub fn base_url(&mut self, new_base_url: String) -> String {
163 std::mem::replace(&mut self._base_url, new_base_url)
164 }
165
166 /// Set the root url to use in all requests to the server.
167 /// It defaults to `https://domains.googleapis.com/`.
168 ///
169 /// Returns the previously set root url.
170 pub fn root_url(&mut self, new_root_url: String) -> String {
171 std::mem::replace(&mut self._root_url, new_root_url)
172 }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// 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.
179///
180/// This type is not used in any activity, and only used as *part* of another schema.
181///
182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
183#[serde_with::serde_as]
184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
185pub struct AuditConfig {
186 /// The configuration for logging of each type of permission.
187 #[serde(rename = "auditLogConfigs")]
188 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
189 /// 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.
190 pub service: Option<String>,
191}
192
193impl common::Part for AuditConfig {}
194
195/// 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.
196///
197/// This type is not used in any activity, and only used as *part* of another schema.
198///
199#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
200#[serde_with::serde_as]
201#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
202pub struct AuditLogConfig {
203 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
204 #[serde(rename = "exemptedMembers")]
205 pub exempted_members: Option<Vec<String>>,
206 /// The log type that this config enables.
207 #[serde(rename = "logType")]
208 pub log_type: Option<String>,
209}
210
211impl common::Part for AuditLogConfig {}
212
213/// Defines an authorization code.
214///
215/// # Activities
216///
217/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
218/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
219///
220/// * [locations registrations reset authorization code projects](ProjectLocationRegistrationResetAuthorizationCodeCall) (response)
221/// * [locations registrations retrieve authorization code projects](ProjectLocationRegistrationRetrieveAuthorizationCodeCall) (response)
222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
223#[serde_with::serde_as]
224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
225pub struct AuthorizationCode {
226 /// The Authorization Code in ASCII. It can be used to transfer the domain to or from another registrar.
227 pub code: Option<String>,
228}
229
230impl common::ResponseResult for AuthorizationCode {}
231
232/// Associates `members`, or principals, with a `role`.
233///
234/// This type is not used in any activity, and only used as *part* of another schema.
235///
236#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
237#[serde_with::serde_as]
238#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
239pub struct Binding {
240 /// 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).
241 pub condition: Option<Expr>,
242 /// 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`.
243 pub members: Option<Vec<String>>,
244 /// 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).
245 pub role: Option<String>,
246}
247
248impl common::Part for Binding {}
249
250/// Request for the `ConfigureContactSettings` method.
251///
252/// # Activities
253///
254/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
255/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
256///
257/// * [locations registrations configure contact settings projects](ProjectLocationRegistrationConfigureContactSettingCall) (request)
258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
259#[serde_with::serde_as]
260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
261pub struct ConfigureContactSettingsRequest {
262 /// The list of contact notices that the caller acknowledges. The notices needed here depend on the values specified in `contact_settings`.
263 #[serde(rename = "contactNotices")]
264 pub contact_notices: Option<Vec<String>>,
265 /// Fields of the `ContactSettings` to update.
266 #[serde(rename = "contactSettings")]
267 pub contact_settings: Option<ContactSettings>,
268 /// Required. The field mask describing which fields to update as a comma-separated list. For example, if only the registrant contact is being updated, the `update_mask` is `"registrant_contact"`.
269 #[serde(rename = "updateMask")]
270 pub update_mask: Option<common::FieldMask>,
271 /// Validate the request without actually updating the contact settings.
272 #[serde(rename = "validateOnly")]
273 pub validate_only: Option<bool>,
274}
275
276impl common::RequestValue for ConfigureContactSettingsRequest {}
277
278/// Request for the `ConfigureDnsSettings` method.
279///
280/// # Activities
281///
282/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
283/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
284///
285/// * [locations registrations configure dns settings projects](ProjectLocationRegistrationConfigureDnsSettingCall) (request)
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct ConfigureDnsSettingsRequest {
290 /// Fields of the `DnsSettings` to update.
291 #[serde(rename = "dnsSettings")]
292 pub dns_settings: Option<DnsSettings>,
293 /// Required. The field mask describing which fields to update as a comma-separated list. For example, if only the name servers are being updated for an existing Custom DNS configuration, the `update_mask` is `"custom_dns.name_servers"`. When changing the DNS provider from one type to another, pass the new provider's field name as part of the field mask. For example, when changing from a Google Domains DNS configuration to a Custom DNS configuration, the `update_mask` is `"custom_dns"`. //
294 #[serde(rename = "updateMask")]
295 pub update_mask: Option<common::FieldMask>,
296 /// Validate the request without actually updating the DNS settings.
297 #[serde(rename = "validateOnly")]
298 pub validate_only: Option<bool>,
299}
300
301impl common::RequestValue for ConfigureDnsSettingsRequest {}
302
303/// Request for the `ConfigureManagementSettings` method.
304///
305/// # Activities
306///
307/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
308/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
309///
310/// * [locations registrations configure management settings projects](ProjectLocationRegistrationConfigureManagementSettingCall) (request)
311#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
312#[serde_with::serde_as]
313#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
314pub struct ConfigureManagementSettingsRequest {
315 /// Fields of the `ManagementSettings` to update.
316 #[serde(rename = "managementSettings")]
317 pub management_settings: Option<ManagementSettings>,
318 /// Required. The field mask describing which fields to update as a comma-separated list. For example, if only the transfer lock is being updated, the `update_mask` is `"transfer_lock_state"`.
319 #[serde(rename = "updateMask")]
320 pub update_mask: Option<common::FieldMask>,
321}
322
323impl common::RequestValue for ConfigureManagementSettingsRequest {}
324
325/// Details required for a contact associated with a `Registration`.
326///
327/// This type is not used in any activity, and only used as *part* of another schema.
328///
329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
330#[serde_with::serde_as]
331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
332pub struct Contact {
333 /// Required. Email address of the contact.
334 pub email: Option<String>,
335 /// Fax number of the contact in international format. For example, `"+1-800-555-0123"`.
336 #[serde(rename = "faxNumber")]
337 pub fax_number: Option<String>,
338 /// Required. Phone number of the contact in international format. For example, `"+1-800-555-0123"`.
339 #[serde(rename = "phoneNumber")]
340 pub phone_number: Option<String>,
341 /// Required. Postal address of the contact.
342 #[serde(rename = "postalAddress")]
343 pub postal_address: Option<PostalAddress>,
344}
345
346impl common::Part for Contact {}
347
348/// Defines the contact information associated with a `Registration`. [ICANN](https://icann.org/) requires all domain names to have associated contact information. The `registrant_contact` is considered the domain's legal owner, and often the other contacts are identical.
349///
350/// This type is not used in any activity, and only used as *part* of another schema.
351///
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct ContactSettings {
356 /// Required. The administrative contact for the `Registration`.
357 #[serde(rename = "adminContact")]
358 pub admin_contact: Option<Contact>,
359 /// Required. Privacy setting for the contacts associated with the `Registration`.
360 pub privacy: Option<String>,
361 /// Required. The registrant contact for the `Registration`. *Caution: Anyone with access to this email address, phone number, and/or postal address can take control of the domain.* *Warning: For new `Registration`s, the registrant receives an email confirmation that they must complete within 15 days to avoid domain suspension.*
362 #[serde(rename = "registrantContact")]
363 pub registrant_contact: Option<Contact>,
364 /// Required. The technical contact for the `Registration`.
365 #[serde(rename = "technicalContact")]
366 pub technical_contact: Option<Contact>,
367}
368
369impl common::Part for ContactSettings {}
370
371/// Configuration for an arbitrary DNS provider.
372///
373/// This type is not used in any activity, and only used as *part* of another schema.
374///
375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
376#[serde_with::serde_as]
377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
378pub struct CustomDns {
379 /// The list of DS records for this domain, which are used to enable DNSSEC. The domain's DNS provider can provide the values to set here. If this field is empty, DNSSEC is disabled.
380 #[serde(rename = "dsRecords")]
381 pub ds_records: Option<Vec<DsRecord>>,
382 /// Required. A list of name servers that store the DNS zone for this domain. Each name server is a domain name, with Unicode domain names expressed in Punycode format.
383 #[serde(rename = "nameServers")]
384 pub name_servers: Option<Vec<String>>,
385}
386
387impl common::Part for CustomDns {}
388
389/// Defines the DNS configuration of a `Registration`, including name servers, DNSSEC, and glue records.
390///
391/// This type is not used in any activity, and only used as *part* of another schema.
392///
393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
394#[serde_with::serde_as]
395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
396pub struct DnsSettings {
397 /// An arbitrary DNS provider identified by its name servers.
398 #[serde(rename = "customDns")]
399 pub custom_dns: Option<CustomDns>,
400 /// The list of glue records for this `Registration`. Commonly empty.
401 #[serde(rename = "glueRecords")]
402 pub glue_records: Option<Vec<GlueRecord>>,
403 /// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). The free DNS zone provided by [Google Domains](https://domains.google/).
404 #[serde(rename = "googleDomainsDns")]
405 pub google_domains_dns: Option<GoogleDomainsDns>,
406 /// Output only. Indicates if this `Registration` has configured one of the following deprecated Google Domains DNS features: * Domain forwarding (HTTP `301` and `302` response status codes), * Email forwarding. See https://cloud.google.com/domains/docs/deprecations/feature-deprecations for more details. If any of these features is enabled call the `RetrieveGoogleDomainsForwardingConfig` method to get details about the feature's configuration. A forwarding configuration might not work correctly if required DNS records are not present in the domain's authoritative DNS Zone.
407 #[serde(rename = "googleDomainsRedirectsDataAvailable")]
408 pub google_domains_redirects_data_available: Option<bool>,
409}
410
411impl common::Part for DnsSettings {}
412
413/// A domain that the calling user manages in Google Domains.
414///
415/// This type is not used in any activity, and only used as *part* of another schema.
416///
417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
418#[serde_with::serde_as]
419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
420pub struct Domain {
421 /// The domain name. Unicode domain names are expressed in Punycode format.
422 #[serde(rename = "domainName")]
423 pub domain_name: Option<String>,
424 /// The state of this domain as a `Registration` resource.
425 #[serde(rename = "resourceState")]
426 pub resource_state: Option<String>,
427 /// Price to renew the domain for one year. Only set when `resource_state` is `IMPORTABLE`.
428 #[serde(rename = "yearlyPrice")]
429 pub yearly_price: Option<Money>,
430}
431
432impl common::Part for Domain {}
433
434/// Domain forwarding configuration.
435///
436/// This type is not used in any activity, and only used as *part* of another schema.
437///
438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
439#[serde_with::serde_as]
440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
441pub struct DomainForwarding {
442 /// If true, forwards the path after the domain name to the same path at the new address.
443 #[serde(rename = "pathForwarding")]
444 pub path_forwarding: Option<bool>,
445 /// The PEM-encoded certificate chain.
446 #[serde(rename = "pemCertificate")]
447 pub pem_certificate: Option<String>,
448 /// The redirect type.
449 #[serde(rename = "redirectType")]
450 pub redirect_type: Option<String>,
451 /// If true, the forwarding works also over HTTPS.
452 #[serde(rename = "sslEnabled")]
453 pub ssl_enabled: Option<bool>,
454 /// The subdomain of the registered domain that is being forwarded. E.g. `www.example.com`, `example.com` (i.e. the registered domain itself) or `*.example.com` (i.e. all subdomains).
455 pub subdomain: Option<String>,
456 /// The target of the domain forwarding, i.e. the path to redirect the `subdomain` to.
457 #[serde(rename = "targetUri")]
458 pub target_uri: Option<String>,
459}
460
461impl common::Part for DomainForwarding {}
462
463/// Defines a Delegation Signer (DS) record, which is needed to enable DNSSEC for a domain. It contains a digest (hash) of a DNSKEY record that must be present in the domain's DNS zone.
464///
465/// This type is not used in any activity, and only used as *part* of another schema.
466///
467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
468#[serde_with::serde_as]
469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
470pub struct DsRecord {
471 /// The algorithm used to generate the referenced DNSKEY.
472 pub algorithm: Option<String>,
473 /// The digest generated from the referenced DNSKEY.
474 pub digest: Option<String>,
475 /// The hash function used to generate the digest of the referenced DNSKEY.
476 #[serde(rename = "digestType")]
477 pub digest_type: Option<String>,
478 /// The key tag of the record. Must be set in range 0 -- 65535.
479 #[serde(rename = "keyTag")]
480 pub key_tag: Option<i32>,
481}
482
483impl common::Part for DsRecord {}
484
485/// Email forwarding configuration.
486///
487/// This type is not used in any activity, and only used as *part* of another schema.
488///
489#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
490#[serde_with::serde_as]
491#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
492pub struct EmailForwarding {
493 /// An alias recipient email that forwards emails to the `target_email_address`. For example, `admin@example.com` or `*@example.com` (wildcard alias forwards all the emails under the registered domain).
494 pub alias: Option<String>,
495 /// Target email that receives emails sent to the `alias`.
496 #[serde(rename = "targetEmailAddress")]
497 pub target_email_address: Option<String>,
498}
499
500impl common::Part for EmailForwarding {}
501
502/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Request for the `ExportRegistration` method.
503///
504/// # Activities
505///
506/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
507/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
508///
509/// * [locations registrations export projects](ProjectLocationRegistrationExportCall) (request)
510#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
511#[serde_with::serde_as]
512#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
513pub struct ExportRegistrationRequest {
514 _never_set: Option<bool>,
515}
516
517impl common::RequestValue for ExportRegistrationRequest {}
518
519/// 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.
520///
521/// This type is not used in any activity, and only used as *part* of another schema.
522///
523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
524#[serde_with::serde_as]
525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
526pub struct Expr {
527 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
528 pub description: Option<String>,
529 /// Textual representation of an expression in Common Expression Language syntax.
530 pub expression: Option<String>,
531 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
532 pub location: Option<String>,
533 /// 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.
534 pub title: Option<String>,
535}
536
537impl common::Part for Expr {}
538
539/// Configures a `RRSetRoutingPolicy` that routes based on the geo location of the querying user.
540///
541/// This type is not used in any activity, and only used as *part* of another schema.
542///
543#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
544#[serde_with::serde_as]
545#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
546pub struct GeoPolicy {
547 /// 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.
548 #[serde(rename = "enableFencing")]
549 pub enable_fencing: Option<bool>,
550 /// The primary geo routing configuration. If there are multiple items with the same location, an error is returned instead.
551 pub item: Option<Vec<GeoPolicyItem>>,
552}
553
554impl common::Part for GeoPolicy {}
555
556/// ResourceRecordSet data for one geo location.
557///
558/// This type is not used in any activity, and only used as *part* of another schema.
559///
560#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
561#[serde_with::serde_as]
562#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
563pub struct GeoPolicyItem {
564 /// 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.
565 #[serde(rename = "healthCheckedTargets")]
566 pub health_checked_targets: Option<HealthCheckTargets>,
567 /// 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.
568 pub location: Option<String>,
569 /// no description provided
570 pub rrdata: Option<Vec<String>>,
571 /// DNSSEC generated signatures for all the `rrdata` within this item. When using health-checked targets for DNSSEC-enabled zones, you can only use at most one health-checked IP address per item.
572 #[serde(rename = "signatureRrdata")]
573 pub signature_rrdata: Option<Vec<String>>,
574}
575
576impl common::Part for GeoPolicyItem {}
577
578/// Defines a host on your domain that is a DNS name server for your domain and/or other domains. Glue records are a way of making the IP address of a name server known, even when it serves DNS queries for its parent domain. For example, when `ns.example.com` is a name server for `example.com`, the host `ns.example.com` must have a glue record to break the circular DNS reference.
579///
580/// This type is not used in any activity, and only used as *part* of another schema.
581///
582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
583#[serde_with::serde_as]
584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
585pub struct GlueRecord {
586 /// Required. Domain name of the host in Punycode format.
587 #[serde(rename = "hostName")]
588 pub host_name: Option<String>,
589 /// List of IPv4 addresses corresponding to this host in the standard decimal format (e.g. `198.51.100.1`). At least one of `ipv4_address` and `ipv6_address` must be set.
590 #[serde(rename = "ipv4Addresses")]
591 pub ipv4_addresses: Option<Vec<String>>,
592 /// List of IPv6 addresses corresponding to this host in the standard hexadecimal format (e.g. `2001:db8::`). At least one of `ipv4_address` and `ipv6_address` must be set.
593 #[serde(rename = "ipv6Addresses")]
594 pub ipv6_addresses: Option<Vec<String>>,
595}
596
597impl common::Part for GlueRecord {}
598
599/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Configuration for using the free DNS zone provided by Google Domains as a `Registration`'s `dns_provider`. You cannot configure the DNS zone itself using the API. To configure the DNS zone, go to [Google Domains](https://domains.google/).
600///
601/// This type is not used in any activity, and only used as *part* of another schema.
602///
603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
604#[serde_with::serde_as]
605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
606pub struct GoogleDomainsDns {
607 /// Output only. The list of DS records published for this domain. The list is automatically populated when `ds_state` is `DS_RECORDS_PUBLISHED`, otherwise it remains empty.
608 #[serde(rename = "dsRecords")]
609 pub ds_records: Option<Vec<DsRecord>>,
610 /// Required. The state of DS records for this domain. Used to enable or disable automatic DNSSEC.
611 #[serde(rename = "dsState")]
612 pub ds_state: Option<String>,
613 /// Output only. A list of name servers that store the DNS zone for this domain. Each name server is a domain name, with Unicode domain names expressed in Punycode format. This field is automatically populated with the name servers assigned to the Google Domains DNS zone.
614 #[serde(rename = "nameServers")]
615 pub name_servers: Option<Vec<String>>,
616}
617
618impl common::Part for GoogleDomainsDns {}
619
620/// HealthCheckTargets describes endpoints to health-check when responding to Routing Policy queries. Only the healthy endpoints will be included in the response. Set either `internal_load_balancer` or `external_endpoints`. Do not set both.
621///
622/// This type is not used in any activity, and only used as *part* of another schema.
623///
624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
625#[serde_with::serde_as]
626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
627pub struct HealthCheckTargets {
628 /// The Internet IP addresses to be health checked. The format matches the format of ResourceRecordSet.rrdata as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1)
629 #[serde(rename = "externalEndpoints")]
630 pub external_endpoints: Option<Vec<String>>,
631 /// Configuration for internal load balancers to be health checked.
632 #[serde(rename = "internalLoadBalancer")]
633 pub internal_load_balancer: Option<Vec<LoadBalancerTarget>>,
634}
635
636impl common::Part for HealthCheckTargets {}
637
638/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Request for the `ImportDomain` method.
639///
640/// # Activities
641///
642/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
643/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
644///
645/// * [locations registrations import projects](ProjectLocationRegistrationImportCall) (request)
646#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
647#[serde_with::serde_as]
648#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
649pub struct ImportDomainRequest {
650 /// Required. The domain name. Unicode domain names must be expressed in Punycode format.
651 #[serde(rename = "domainName")]
652 pub domain_name: Option<String>,
653 /// Set of labels associated with the `Registration`.
654 pub labels: Option<HashMap<String, String>>,
655}
656
657impl common::RequestValue for ImportDomainRequest {}
658
659/// Request for the `InitiatePushTransfer` method.
660///
661/// # Activities
662///
663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
665///
666/// * [locations registrations initiate push transfer projects](ProjectLocationRegistrationInitiatePushTransferCall) (request)
667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
668#[serde_with::serde_as]
669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
670pub struct InitiatePushTransferRequest {
671 /// Required. The Tag of the new registrar. Can be found at [List of registrars](https://nominet.uk/registrar-list/).
672 pub tag: Option<String>,
673}
674
675impl common::RequestValue for InitiatePushTransferRequest {}
676
677/// The response message for Locations.ListLocations.
678///
679/// # Activities
680///
681/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
682/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
683///
684/// * [locations list projects](ProjectLocationListCall) (response)
685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
686#[serde_with::serde_as]
687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
688pub struct ListLocationsResponse {
689 /// A list of locations that matches the specified filter in the request.
690 pub locations: Option<Vec<Location>>,
691 /// The standard List next-page token.
692 #[serde(rename = "nextPageToken")]
693 pub next_page_token: Option<String>,
694}
695
696impl common::ResponseResult for ListLocationsResponse {}
697
698/// The response message for Operations.ListOperations.
699///
700/// # Activities
701///
702/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
703/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
704///
705/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
706#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
707#[serde_with::serde_as]
708#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
709pub struct ListOperationsResponse {
710 /// The standard List next-page token.
711 #[serde(rename = "nextPageToken")]
712 pub next_page_token: Option<String>,
713 /// A list of operations that matches the specified filter in the request.
714 pub operations: Option<Vec<Operation>>,
715}
716
717impl common::ResponseResult for ListOperationsResponse {}
718
719/// Response for the `ListRegistrations` method.
720///
721/// # Activities
722///
723/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
724/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
725///
726/// * [locations registrations list projects](ProjectLocationRegistrationListCall) (response)
727#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
728#[serde_with::serde_as]
729#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
730pub struct ListRegistrationsResponse {
731 /// When present, there are more results to retrieve. Set `page_token` to this value on a subsequent call to get the next page of results.
732 #[serde(rename = "nextPageToken")]
733 pub next_page_token: Option<String>,
734 /// A list of `Registration`s.
735 pub registrations: Option<Vec<Registration>>,
736}
737
738impl common::ResponseResult for ListRegistrationsResponse {}
739
740/// The configuration for an individual load balancer to health check.
741///
742/// This type is not used in any activity, and only used as *part* of another schema.
743///
744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
745#[serde_with::serde_as]
746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
747pub struct LoadBalancerTarget {
748 /// The frontend IP address of the load balancer to health check.
749 #[serde(rename = "ipAddress")]
750 pub ip_address: Option<String>,
751 /// The protocol of the load balancer to health check.
752 #[serde(rename = "ipProtocol")]
753 pub ip_protocol: Option<String>,
754 /// 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.
755 #[serde(rename = "loadBalancerType")]
756 pub load_balancer_type: Option<String>,
757 /// 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}`.
758 #[serde(rename = "networkUrl")]
759 pub network_url: Option<String>,
760 /// The configured port of the load balancer.
761 pub port: Option<String>,
762 /// The project ID in which the load balancer is located.
763 pub project: Option<String>,
764 /// The region in which the load balancer is located.
765 pub region: Option<String>,
766}
767
768impl common::Part for LoadBalancerTarget {}
769
770/// A resource that represents a Google Cloud location.
771///
772/// # Activities
773///
774/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
775/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
776///
777/// * [locations get projects](ProjectLocationGetCall) (response)
778#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
779#[serde_with::serde_as]
780#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
781pub struct Location {
782 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
783 #[serde(rename = "displayName")]
784 pub display_name: Option<String>,
785 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
786 pub labels: Option<HashMap<String, String>>,
787 /// The canonical id for this location. For example: `"us-east1"`.
788 #[serde(rename = "locationId")]
789 pub location_id: Option<String>,
790 /// Service-specific metadata. For example the available capacity at the given location.
791 pub metadata: Option<HashMap<String, serde_json::Value>>,
792 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
793 pub name: Option<String>,
794}
795
796impl common::ResponseResult for Location {}
797
798/// Defines renewal, billing, and transfer settings for a `Registration`.
799///
800/// This type is not used in any activity, and only used as *part* of another schema.
801///
802#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
803#[serde_with::serde_as]
804#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
805pub struct ManagementSettings {
806 /// Output only. The actual transfer lock state for this `Registration`.
807 #[serde(rename = "effectiveTransferLockState")]
808 pub effective_transfer_lock_state: Option<String>,
809 /// Optional. The desired renewal method for this `Registration`. The actual `renewal_method` is automatically updated to reflect this choice. If unset or equal to `RENEWAL_METHOD_UNSPECIFIED`, the actual `renewalMethod` is treated as if it were set to `AUTOMATIC_RENEWAL`. You cannot use `RENEWAL_DISABLED` during resource creation, and you can update the renewal status only when the `Registration` resource has state `ACTIVE` or `SUSPENDED`. When `preferred_renewal_method` is set to `AUTOMATIC_RENEWAL`, the actual `renewal_method` can be set to `RENEWAL_DISABLED` in case of problems with the billing account or reported domain abuse. In such cases, check the `issues` field on the `Registration`. After the problem is resolved, the `renewal_method` is automatically updated to `preferred_renewal_method` in a few hours.
810 #[serde(rename = "preferredRenewalMethod")]
811 pub preferred_renewal_method: Option<String>,
812 /// Output only. The actual renewal method for this `Registration`. When `preferred_renewal_method` is set to `AUTOMATIC_RENEWAL`, the actual `renewal_method` can be equal to `RENEWAL_DISABLED`—for example, when there are problems with the billing account or reported domain abuse. In such cases, check the `issues` field on the `Registration`. After the problem is resolved, the `renewal_method` is automatically updated to `preferred_renewal_method` in a few hours.
813 #[serde(rename = "renewalMethod")]
814 pub renewal_method: Option<String>,
815 /// This is the desired transfer lock state for this `Registration`. A transfer lock controls whether the domain can be transferred to another registrar. The transfer lock state of the domain is returned in the `effective_transfer_lock_state` property. The transfer lock state values might be different for the following reasons: * `transfer_lock_state` was updated only a short time ago. * Domains with the `TRANSFER_LOCK_UNSUPPORTED_BY_REGISTRY` state are in the list of `domain_properties`. These domains are always in the `UNLOCKED` state.
816 #[serde(rename = "transferLockState")]
817 pub transfer_lock_state: Option<String>,
818}
819
820impl common::Part for ManagementSettings {}
821
822/// Represents an amount of money with its currency type.
823///
824/// This type is not used in any activity, and only used as *part* of another schema.
825///
826#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
827#[serde_with::serde_as]
828#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
829pub struct Money {
830 /// The three-letter currency code defined in ISO 4217.
831 #[serde(rename = "currencyCode")]
832 pub currency_code: Option<String>,
833 /// Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
834 pub nanos: Option<i32>,
835 /// The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
836 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
837 pub units: Option<i64>,
838}
839
840impl common::Part for Money {}
841
842/// This resource represents a long-running operation that is the result of a network API call.
843///
844/// # Activities
845///
846/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
847/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
848///
849/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
850/// * [locations registrations configure contact settings projects](ProjectLocationRegistrationConfigureContactSettingCall) (response)
851/// * [locations registrations configure dns settings projects](ProjectLocationRegistrationConfigureDnsSettingCall) (response)
852/// * [locations registrations configure management settings projects](ProjectLocationRegistrationConfigureManagementSettingCall) (response)
853/// * [locations registrations delete projects](ProjectLocationRegistrationDeleteCall) (response)
854/// * [locations registrations export projects](ProjectLocationRegistrationExportCall) (response)
855/// * [locations registrations import projects](ProjectLocationRegistrationImportCall) (response)
856/// * [locations registrations initiate push transfer projects](ProjectLocationRegistrationInitiatePushTransferCall) (response)
857/// * [locations registrations patch projects](ProjectLocationRegistrationPatchCall) (response)
858/// * [locations registrations register projects](ProjectLocationRegistrationRegisterCall) (response)
859/// * [locations registrations renew domain projects](ProjectLocationRegistrationRenewDomainCall) (response)
860/// * [locations registrations transfer projects](ProjectLocationRegistrationTransferCall) (response)
861#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
862#[serde_with::serde_as]
863#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
864pub struct Operation {
865 /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
866 pub done: Option<bool>,
867 /// The error result of the operation in case of failure or cancellation.
868 pub error: Option<Status>,
869 /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
870 pub metadata: Option<HashMap<String, serde_json::Value>>,
871 /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
872 pub name: Option<String>,
873 /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
874 pub response: Option<HashMap<String, serde_json::Value>>,
875}
876
877impl common::ResponseResult for Operation {}
878
879/// 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/).
880///
881/// # Activities
882///
883/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
884/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
885///
886/// * [locations registrations get iam policy projects](ProjectLocationRegistrationGetIamPolicyCall) (response)
887/// * [locations registrations set iam policy projects](ProjectLocationRegistrationSetIamPolicyCall) (response)
888#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
889#[serde_with::serde_as]
890#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
891pub struct Policy {
892 /// Specifies cloud audit logging configuration for this policy.
893 #[serde(rename = "auditConfigs")]
894 pub audit_configs: Option<Vec<AuditConfig>>,
895 /// 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`.
896 pub bindings: Option<Vec<Binding>>,
897 /// `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.
898 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
899 pub etag: Option<Vec<u8>>,
900 /// 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).
901 pub version: Option<i32>,
902}
903
904impl common::ResponseResult for Policy {}
905
906/// Represents a postal address, such as for postal delivery or payments addresses. With a postal address, a postal service can deliver items to a premise, P.O. box, or similar. A postal address is not intended to model geographical locations like roads, towns, or mountains. In typical usage, an address would be created by user input or from importing existing data, depending on the type of process. Advice on address input or editing: - Use an internationalization-ready address widget such as https://github.com/google/libaddressinput. - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. For more guidance on how to use this schema, see: https://support.google.com/business/answer/6397478.
907///
908/// This type is not used in any activity, and only used as *part* of another schema.
909///
910#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
911#[serde_with::serde_as]
912#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
913pub struct PostalAddress {
914 /// Unstructured address lines describing the lower levels of an address. Because values in `address_lines` do not have type information and may sometimes contain multiple values in a single field (for example, "Austin, TX"), it is important that the line order is clear. The order of address lines should be "envelope order" for the country or region of the address. In places where this can vary (for example, Japan), `address_language` is used to make it explicit (for example, "ja" for large-to-small ordering and "ja-Latn" or "en" for small-to-large). In this way, the most specific line of an address can be selected based on the language. The minimum permitted structural representation of an address consists of a `region_code` with all remaining information placed in the `address_lines`. It would be possible to format such an address very approximately without geocoding, but no semantic reasoning could be made about any of the address components until it was at least partially resolved. Creating an address only containing a `region_code` and `address_lines` and then geocoding is the recommended way to handle completely unstructured addresses (as opposed to guessing which parts of the address should be localities or administrative areas).
915 #[serde(rename = "addressLines")]
916 pub address_lines: Option<Vec<String>>,
917 /// Optional. Highest administrative subdivision which is used for postal addresses of a country or region. For example, this can be a state, a province, an oblast, or a prefecture. For Spain, this is the province and not the autonomous community (for example, "Barcelona" and not "Catalonia"). Many countries don't use an administrative area in postal addresses. For example, in Switzerland, this should be left unpopulated.
918 #[serde(rename = "administrativeArea")]
919 pub administrative_area: Option<String>,
920 /// Optional. BCP-47 language code of the contents of this address (if known). This is often the UI language of the input form or is expected to match one of the languages used in the address' country/region, or their transliterated equivalents. This can affect formatting in certain countries, but is not critical to the correctness of the data and will never affect any validation or other non-formatting related operations. If this value is not known, it should be omitted (rather than specifying a possibly incorrect default). Examples: "zh-Hant", "ja", "ja-Latn", "en".
921 #[serde(rename = "languageCode")]
922 pub language_code: Option<String>,
923 /// Optional. Generally refers to the city or town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave `locality` empty and use `address_lines`.
924 pub locality: Option<String>,
925 /// Optional. The name of the organization at the address.
926 pub organization: Option<String>,
927 /// Optional. Postal code of the address. Not all countries use or require postal codes to be present, but where they are used, they may trigger additional validation with other parts of the address (for example, state or zip code validation in the United States).
928 #[serde(rename = "postalCode")]
929 pub postal_code: Option<String>,
930 /// Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information.
931 pub recipients: Option<Vec<String>>,
932 /// Required. CLDR region code of the country/region of the address. This is never inferred and it is up to the user to ensure the value is correct. See https://cldr.unicode.org/ and https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland.
933 #[serde(rename = "regionCode")]
934 pub region_code: Option<String>,
935 /// The schema revision of the `PostalAddress`. This must be set to 0, which is the latest revision. All new revisions **must** be backward compatible with old revisions.
936 pub revision: Option<i32>,
937 /// Optional. Additional, country-specific, sorting code. This is not used in most regions. Where it is used, the value is either a string like "CEDEX", optionally followed by a number (for example, "CEDEX 7"), or just a number alone, representing the "sector code" (Jamaica), "delivery area indicator" (Malawi) or "post office indicator" (Côte d'Ivoire).
938 #[serde(rename = "sortingCode")]
939 pub sorting_code: Option<String>,
940 /// Optional. Sublocality of the address. For example, this can be a neighborhood, borough, or district.
941 pub sublocality: Option<String>,
942}
943
944impl common::Part for PostalAddress {}
945
946/// 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.
947///
948/// This type is not used in any activity, and only used as *part* of another schema.
949///
950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
951#[serde_with::serde_as]
952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
953pub struct PrimaryBackupPolicy {
954 /// 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.
955 #[serde(rename = "backupGeoTargets")]
956 pub backup_geo_targets: Option<GeoPolicy>,
957 /// 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`.
958 #[serde(rename = "primaryTargets")]
959 pub primary_targets: Option<HealthCheckTargets>,
960 /// When serving state is `PRIMARY`, this field provides the option of sending a small percentage of the traffic to the backup targets.
961 #[serde(rename = "trickleTraffic")]
962 pub trickle_traffic: Option<f64>,
963}
964
965impl common::Part for PrimaryBackupPolicy {}
966
967/// 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.
968///
969/// This type is not used in any activity, and only used as *part* of another schema.
970///
971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
972#[serde_with::serde_as]
973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
974pub struct RRSetRoutingPolicy {
975 /// no description provided
976 pub geo: Option<GeoPolicy>,
977 /// no description provided
978 #[serde(rename = "geoPolicy")]
979 pub geo_policy: Option<GeoPolicy>,
980 /// The fully qualified URL of the HealthCheck to use for this RRSetRoutingPolicy. Format this URL like `https://www.googleapis.com/compute/v1/projects/{project}/global/healthChecks/{healthCheck}`. https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks
981 #[serde(rename = "healthCheck")]
982 pub health_check: Option<String>,
983 /// no description provided
984 #[serde(rename = "primaryBackup")]
985 pub primary_backup: Option<PrimaryBackupPolicy>,
986 /// no description provided
987 pub wrr: Option<WrrPolicy>,
988 /// no description provided
989 #[serde(rename = "wrrPolicy")]
990 pub wrr_policy: Option<WrrPolicy>,
991}
992
993impl common::Part for RRSetRoutingPolicy {}
994
995/// Request for the `RegisterDomain` method.
996///
997/// # Activities
998///
999/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1000/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1001///
1002/// * [locations registrations register projects](ProjectLocationRegistrationRegisterCall) (request)
1003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1004#[serde_with::serde_as]
1005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1006pub struct RegisterDomainRequest {
1007 /// The list of contact notices that the caller acknowledges. The notices needed here depend on the values specified in `registration.contact_settings`.
1008 #[serde(rename = "contactNotices")]
1009 pub contact_notices: Option<Vec<String>>,
1010 /// The list of domain notices that you acknowledge. Call `RetrieveRegisterParameters` to see the notices that need acknowledgement.
1011 #[serde(rename = "domainNotices")]
1012 pub domain_notices: Option<Vec<String>>,
1013 /// Required. The complete `Registration` resource to be created.
1014 pub registration: Option<Registration>,
1015 /// When true, only validation is performed, without actually registering the domain. Follows: https://cloud.google.com/apis/design/design_patterns#request_validation
1016 #[serde(rename = "validateOnly")]
1017 pub validate_only: Option<bool>,
1018 /// Required. Yearly price to register or renew the domain. The value that should be put here can be obtained from RetrieveRegisterParameters or SearchDomains calls.
1019 #[serde(rename = "yearlyPrice")]
1020 pub yearly_price: Option<Money>,
1021}
1022
1023impl common::RequestValue for RegisterDomainRequest {}
1024
1025/// Parameters required to register a new domain.
1026///
1027/// This type is not used in any activity, and only used as *part* of another schema.
1028///
1029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1030#[serde_with::serde_as]
1031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1032pub struct RegisterParameters {
1033 /// Indicates whether the domain is available for registration. This value is accurate when obtained by calling `RetrieveRegisterParameters`, but is approximate when obtained by calling `SearchDomains`.
1034 pub availability: Option<String>,
1035 /// The domain name. Unicode domain names are expressed in Punycode format.
1036 #[serde(rename = "domainName")]
1037 pub domain_name: Option<String>,
1038 /// Notices about special properties of the domain.
1039 #[serde(rename = "domainNotices")]
1040 pub domain_notices: Option<Vec<String>>,
1041 /// Contact privacy options that the domain supports.
1042 #[serde(rename = "supportedPrivacy")]
1043 pub supported_privacy: Option<Vec<String>>,
1044 /// Price to register or renew the domain for one year.
1045 #[serde(rename = "yearlyPrice")]
1046 pub yearly_price: Option<Money>,
1047}
1048
1049impl common::Part for RegisterParameters {}
1050
1051/// The `Registration` resource facilitates managing and configuring domain name registrations. There are several ways to create a new `Registration` resource: To create a new `Registration` resource, find a suitable domain name by calling the `SearchDomains` method with a query to see available domain name options. After choosing a name, call `RetrieveRegisterParameters` to ensure availability and obtain information like pricing, which is needed to build a call to `RegisterDomain`. Another way to create a new `Registration` is to transfer an existing domain from another registrar (Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations)). First, go to the current registrar to unlock the domain for transfer and retrieve the domain’s transfer authorization code. Then call `RetrieveTransferParameters` to confirm that the domain is unlocked and to get values needed to build a call to `TransferDomain`. Finally, you can create a new `Registration` by importing an existing domain managed with [Google Domains](https://domains.google/) (Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations)). First, call `RetrieveImportableDomains` to list domains to which the calling user has sufficient access. Then call `ImportDomain` on any domain names you want to use with Cloud Domains.
1052///
1053/// # Activities
1054///
1055/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1056/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1057///
1058/// * [locations registrations get projects](ProjectLocationRegistrationGetCall) (response)
1059/// * [locations registrations patch projects](ProjectLocationRegistrationPatchCall) (request)
1060#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1061#[serde_with::serde_as]
1062#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1063pub struct Registration {
1064 /// Required. Settings for contact information linked to the `Registration`. You cannot update these with the `UpdateRegistration` method. To update these settings, use the `ConfigureContactSettings` method.
1065 #[serde(rename = "contactSettings")]
1066 pub contact_settings: Option<ContactSettings>,
1067 /// Output only. The creation timestamp of the `Registration` resource.
1068 #[serde(rename = "createTime")]
1069 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1070 /// Settings controlling the DNS configuration of the `Registration`. You cannot update these with the `UpdateRegistration` method. To update these settings, use the `ConfigureDnsSettings` method.
1071 #[serde(rename = "dnsSettings")]
1072 pub dns_settings: Option<DnsSettings>,
1073 /// Required. Immutable. The domain name. Unicode domain names must be expressed in Punycode format.
1074 #[serde(rename = "domainName")]
1075 pub domain_name: Option<String>,
1076 /// Output only. Special properties of the domain.
1077 #[serde(rename = "domainProperties")]
1078 pub domain_properties: Option<Vec<String>>,
1079 /// Output only. The expiration timestamp of the `Registration`.
1080 #[serde(rename = "expireTime")]
1081 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1082 /// Output only. The set of issues with the `Registration` that require attention.
1083 pub issues: Option<Vec<String>>,
1084 /// Set of labels associated with the `Registration`.
1085 pub labels: Option<HashMap<String, String>>,
1086 /// Settings for management of the `Registration`, including renewal, billing, and transfer. You cannot update these with the `UpdateRegistration` method. To update these settings, use the `ConfigureManagementSettings` method.
1087 #[serde(rename = "managementSettings")]
1088 pub management_settings: Option<ManagementSettings>,
1089 /// Output only. Name of the `Registration` resource, in the format `projects/*/locations/*/registrations/`.
1090 pub name: Option<String>,
1091 /// Output only. Pending contact settings for the `Registration`. Updates to the `contact_settings` field that change its `registrant_contact` or `privacy` fields require email confirmation by the `registrant_contact` before taking effect. This field is set only if there are pending updates to the `contact_settings` that have not been confirmed. To confirm the changes, the `registrant_contact` must follow the instructions in the email they receive.
1092 #[serde(rename = "pendingContactSettings")]
1093 pub pending_contact_settings: Option<ContactSettings>,
1094 /// Output only. The reason the domain registration failed. Only set for domains in REGISTRATION_FAILED state.
1095 #[serde(rename = "registerFailureReason")]
1096 pub register_failure_reason: Option<String>,
1097 /// Output only. The state of the `Registration`
1098 pub state: Option<String>,
1099 /// Output only. Set of options for the `contact_settings.privacy` field that this `Registration` supports.
1100 #[serde(rename = "supportedPrivacy")]
1101 pub supported_privacy: Option<Vec<String>>,
1102 /// Output only. Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). The reason the domain transfer failed. Only set for domains in TRANSFER_FAILED state.
1103 #[serde(rename = "transferFailureReason")]
1104 pub transfer_failure_reason: Option<String>,
1105}
1106
1107impl common::RequestValue for Registration {}
1108impl common::ResponseResult for Registration {}
1109
1110/// Request for the `RenewDomain` method.
1111///
1112/// # Activities
1113///
1114/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1115/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1116///
1117/// * [locations registrations renew domain projects](ProjectLocationRegistrationRenewDomainCall) (request)
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct RenewDomainRequest {
1122 /// Optional. When true, only validation is performed, without actually renewing the domain. For more information, see [Request validation](https://cloud.google.com/apis/design/design_patterns#request_validation)
1123 #[serde(rename = "validateOnly")]
1124 pub validate_only: Option<bool>,
1125 /// Required. Acknowledgement of the price to renew the domain for one year. To get the price, see [Cloud Domains pricing](https://cloud.google.com/domains/pricing). If not provided, the expected price is returned in the error message.
1126 #[serde(rename = "yearlyPrice")]
1127 pub yearly_price: Option<Money>,
1128}
1129
1130impl common::RequestValue for RenewDomainRequest {}
1131
1132/// Request for the `ResetAuthorizationCode` method.
1133///
1134/// # Activities
1135///
1136/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1137/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1138///
1139/// * [locations registrations reset authorization code projects](ProjectLocationRegistrationResetAuthorizationCodeCall) (request)
1140#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1141#[serde_with::serde_as]
1142#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1143pub struct ResetAuthorizationCodeRequest {
1144 _never_set: Option<bool>,
1145}
1146
1147impl common::RequestValue for ResetAuthorizationCodeRequest {}
1148
1149/// A unit of data that is returned by the DNS servers.
1150///
1151/// This type is not used in any activity, and only used as *part* of another schema.
1152///
1153#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1154#[serde_with::serde_as]
1155#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1156pub struct ResourceRecordSet {
1157 /// For example, www.example.com.
1158 pub name: Option<String>,
1159 /// 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).
1160 #[serde(rename = "routingPolicy")]
1161 pub routing_policy: Option<RRSetRoutingPolicy>,
1162 /// As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) -- see examples.
1163 pub rrdata: Option<Vec<String>>,
1164 /// As defined in RFC 4034 (section 3.2).
1165 #[serde(rename = "signatureRrdata")]
1166 pub signature_rrdata: Option<Vec<String>>,
1167 /// Number of seconds that this `ResourceRecordSet` can be cached by resolvers.
1168 pub ttl: Option<i32>,
1169 /// The identifier of a supported record type. See the list of Supported DNS record types.
1170 #[serde(rename = "type")]
1171 pub type_: Option<String>,
1172}
1173
1174impl common::Part for ResourceRecordSet {}
1175
1176/// Response for the `RetrieveGoogleDomainsDnsRecords` method.
1177///
1178/// # Activities
1179///
1180/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1181/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1182///
1183/// * [locations registrations retrieve google domains dns records projects](ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall) (response)
1184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1185#[serde_with::serde_as]
1186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1187pub struct RetrieveGoogleDomainsDnsRecordsResponse {
1188 /// When present, there are more results to retrieve. Set `page_token` to this value on a subsequent call to get the next page of results.
1189 #[serde(rename = "nextPageToken")]
1190 pub next_page_token: Option<String>,
1191 /// The resource record set resources (DNS Zone records).
1192 pub rrset: Option<Vec<ResourceRecordSet>>,
1193}
1194
1195impl common::ResponseResult for RetrieveGoogleDomainsDnsRecordsResponse {}
1196
1197/// Response for the `RetrieveGoogleDomainsForwardingConfig` method.
1198///
1199/// # Activities
1200///
1201/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1202/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1203///
1204/// * [locations registrations retrieve google domains forwarding config projects](ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall) (response)
1205#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1206#[serde_with::serde_as]
1207#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1208pub struct RetrieveGoogleDomainsForwardingConfigResponse {
1209 /// The list of domain forwarding configurations. A forwarding configuration might not work correctly if the required DNS records are not present in the domain's authoritative DNS zone.
1210 #[serde(rename = "domainForwardings")]
1211 pub domain_forwardings: Option<Vec<DomainForwarding>>,
1212 /// The list of email forwarding configurations. A forwarding configuration might not work correctly if the required DNS records are not present in the domain's authoritative DNS zone.
1213 #[serde(rename = "emailForwardings")]
1214 pub email_forwardings: Option<Vec<EmailForwarding>>,
1215}
1216
1217impl common::ResponseResult for RetrieveGoogleDomainsForwardingConfigResponse {}
1218
1219/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Response for the `RetrieveImportableDomains` method.
1220///
1221/// # Activities
1222///
1223/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1224/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1225///
1226/// * [locations registrations retrieve importable domains projects](ProjectLocationRegistrationRetrieveImportableDomainCall) (response)
1227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1228#[serde_with::serde_as]
1229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1230pub struct RetrieveImportableDomainsResponse {
1231 /// A list of domains that the calling user manages in Google Domains.
1232 pub domains: Option<Vec<Domain>>,
1233 /// When present, there are more results to retrieve. Set `page_token` to this value on a subsequent call to get the next page of results.
1234 #[serde(rename = "nextPageToken")]
1235 pub next_page_token: Option<String>,
1236}
1237
1238impl common::ResponseResult for RetrieveImportableDomainsResponse {}
1239
1240/// Response for the `RetrieveRegisterParameters` method.
1241///
1242/// # Activities
1243///
1244/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1245/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1246///
1247/// * [locations registrations retrieve register parameters projects](ProjectLocationRegistrationRetrieveRegisterParameterCall) (response)
1248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1249#[serde_with::serde_as]
1250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1251pub struct RetrieveRegisterParametersResponse {
1252 /// Parameters to use when calling the `RegisterDomain` method.
1253 #[serde(rename = "registerParameters")]
1254 pub register_parameters: Option<RegisterParameters>,
1255}
1256
1257impl common::ResponseResult for RetrieveRegisterParametersResponse {}
1258
1259/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Response for the `RetrieveTransferParameters` method.
1260///
1261/// # Activities
1262///
1263/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1264/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1265///
1266/// * [locations registrations retrieve transfer parameters projects](ProjectLocationRegistrationRetrieveTransferParameterCall) (response)
1267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1268#[serde_with::serde_as]
1269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1270pub struct RetrieveTransferParametersResponse {
1271 /// Parameters to use when calling the `TransferDomain` method.
1272 #[serde(rename = "transferParameters")]
1273 pub transfer_parameters: Option<TransferParameters>,
1274}
1275
1276impl common::ResponseResult for RetrieveTransferParametersResponse {}
1277
1278/// Response for the `SearchDomains` method.
1279///
1280/// # Activities
1281///
1282/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1283/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1284///
1285/// * [locations registrations search domains projects](ProjectLocationRegistrationSearchDomainCall) (response)
1286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1287#[serde_with::serde_as]
1288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1289pub struct SearchDomainsResponse {
1290 /// Results of the domain name search.
1291 #[serde(rename = "registerParameters")]
1292 pub register_parameters: Option<Vec<RegisterParameters>>,
1293}
1294
1295impl common::ResponseResult for SearchDomainsResponse {}
1296
1297/// Request message for `SetIamPolicy` method.
1298///
1299/// # Activities
1300///
1301/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1302/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1303///
1304/// * [locations registrations set iam policy projects](ProjectLocationRegistrationSetIamPolicyCall) (request)
1305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1306#[serde_with::serde_as]
1307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1308pub struct SetIamPolicyRequest {
1309 /// 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.
1310 pub policy: Option<Policy>,
1311 /// 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"`
1312 #[serde(rename = "updateMask")]
1313 pub update_mask: Option<common::FieldMask>,
1314}
1315
1316impl common::RequestValue for SetIamPolicyRequest {}
1317
1318/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
1319///
1320/// This type is not used in any activity, and only used as *part* of another schema.
1321///
1322#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1323#[serde_with::serde_as]
1324#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1325pub struct Status {
1326 /// The status code, which should be an enum value of google.rpc.Code.
1327 pub code: Option<i32>,
1328 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1329 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1330 /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1331 pub message: Option<String>,
1332}
1333
1334impl common::Part for Status {}
1335
1336/// Request message for `TestIamPermissions` method.
1337///
1338/// # Activities
1339///
1340/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1341/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1342///
1343/// * [locations registrations test iam permissions projects](ProjectLocationRegistrationTestIamPermissionCall) (request)
1344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1345#[serde_with::serde_as]
1346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1347pub struct TestIamPermissionsRequest {
1348 /// 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).
1349 pub permissions: Option<Vec<String>>,
1350}
1351
1352impl common::RequestValue for TestIamPermissionsRequest {}
1353
1354/// Response message for `TestIamPermissions` method.
1355///
1356/// # Activities
1357///
1358/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1359/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1360///
1361/// * [locations registrations test iam permissions projects](ProjectLocationRegistrationTestIamPermissionCall) (response)
1362#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1363#[serde_with::serde_as]
1364#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1365pub struct TestIamPermissionsResponse {
1366 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1367 pub permissions: Option<Vec<String>>,
1368}
1369
1370impl common::ResponseResult for TestIamPermissionsResponse {}
1371
1372/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Request for the `TransferDomain` method.
1373///
1374/// # Activities
1375///
1376/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1377/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1378///
1379/// * [locations registrations transfer projects](ProjectLocationRegistrationTransferCall) (request)
1380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1381#[serde_with::serde_as]
1382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1383pub struct TransferDomainRequest {
1384 /// The domain's transfer authorization code. You can obtain this from the domain's current registrar.
1385 #[serde(rename = "authorizationCode")]
1386 pub authorization_code: Option<AuthorizationCode>,
1387 /// The list of contact notices that you acknowledge. The notices needed here depend on the values specified in `registration.contact_settings`.
1388 #[serde(rename = "contactNotices")]
1389 pub contact_notices: Option<Vec<String>>,
1390 /// Required. The complete `Registration` resource to be created. You can leave `registration.dns_settings` unset to import the domain's current DNS configuration from its current registrar. Use this option only if you are sure that the domain's current DNS service does not cease upon transfer, as is often the case for DNS services provided for free by the registrar.
1391 pub registration: Option<Registration>,
1392 /// Validate the request without actually transferring the domain.
1393 #[serde(rename = "validateOnly")]
1394 pub validate_only: Option<bool>,
1395 /// Required. Acknowledgement of the price to transfer or renew the domain for one year. Call `RetrieveTransferParameters` to obtain the price, which you must acknowledge.
1396 #[serde(rename = "yearlyPrice")]
1397 pub yearly_price: Option<Money>,
1398}
1399
1400impl common::RequestValue for TransferDomainRequest {}
1401
1402/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations). Parameters required to transfer a domain from another registrar.
1403///
1404/// This type is not used in any activity, and only used as *part* of another schema.
1405///
1406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1407#[serde_with::serde_as]
1408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1409pub struct TransferParameters {
1410 /// The registrar that currently manages the domain.
1411 #[serde(rename = "currentRegistrar")]
1412 pub current_registrar: Option<String>,
1413 /// The URL of the registrar that currently manages the domain.
1414 #[serde(rename = "currentRegistrarUri")]
1415 pub current_registrar_uri: Option<String>,
1416 /// The domain name. Unicode domain names are expressed in Punycode format.
1417 #[serde(rename = "domainName")]
1418 pub domain_name: Option<String>,
1419 /// The name servers that currently store the configuration of the domain.
1420 #[serde(rename = "nameServers")]
1421 pub name_servers: Option<Vec<String>>,
1422 /// Contact privacy options that the domain supports.
1423 #[serde(rename = "supportedPrivacy")]
1424 pub supported_privacy: Option<Vec<String>>,
1425 /// Indicates whether the domain is protected by a transfer lock. For a transfer to succeed, this must show `UNLOCKED`. To unlock a domain, go to its current registrar.
1426 #[serde(rename = "transferLockState")]
1427 pub transfer_lock_state: Option<String>,
1428 /// Price to transfer or renew the domain for one year.
1429 #[serde(rename = "yearlyPrice")]
1430 pub yearly_price: Option<Money>,
1431}
1432
1433impl common::Part for TransferParameters {}
1434
1435/// Configures a RRSetRoutingPolicy that routes in a weighted round robin fashion.
1436///
1437/// This type is not used in any activity, and only used as *part* of another schema.
1438///
1439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1440#[serde_with::serde_as]
1441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1442pub struct WrrPolicy {
1443 /// no description provided
1444 pub item: Option<Vec<WrrPolicyItem>>,
1445}
1446
1447impl common::Part for WrrPolicy {}
1448
1449/// A routing block which contains the routing information for one WRR item.
1450///
1451/// This type is not used in any activity, and only used as *part* of another schema.
1452///
1453#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1454#[serde_with::serde_as]
1455#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1456pub struct WrrPolicyItem {
1457 /// 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.
1458 #[serde(rename = "healthCheckedTargets")]
1459 pub health_checked_targets: Option<HealthCheckTargets>,
1460 /// no description provided
1461 pub rrdata: Option<Vec<String>>,
1462 /// DNSSEC generated signatures for all the `rrdata` within this item. When using health-checked targets for DNSSEC-enabled zones, you can only use at most one health-checked IP address per item.
1463 #[serde(rename = "signatureRrdata")]
1464 pub signature_rrdata: Option<Vec<String>>,
1465 /// 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.
1466 pub weight: Option<f64>,
1467}
1468
1469impl common::Part for WrrPolicyItem {}
1470
1471// ###################
1472// MethodBuilders ###
1473// #################
1474
1475/// A builder providing access to all methods supported on *project* resources.
1476/// It is not used directly, but through the [`CloudDomains`] hub.
1477///
1478/// # Example
1479///
1480/// Instantiate a resource builder
1481///
1482/// ```test_harness,no_run
1483/// extern crate hyper;
1484/// extern crate hyper_rustls;
1485/// extern crate google_domains1 as domains1;
1486///
1487/// # async fn dox() {
1488/// use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1489///
1490/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1491/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1492/// .with_native_roots()
1493/// .unwrap()
1494/// .https_only()
1495/// .enable_http2()
1496/// .build();
1497///
1498/// let executor = hyper_util::rt::TokioExecutor::new();
1499/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1500/// secret,
1501/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1502/// yup_oauth2::client::CustomHyperClientBuilder::from(
1503/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1504/// ),
1505/// ).build().await.unwrap();
1506///
1507/// let client = hyper_util::client::legacy::Client::builder(
1508/// hyper_util::rt::TokioExecutor::new()
1509/// )
1510/// .build(
1511/// hyper_rustls::HttpsConnectorBuilder::new()
1512/// .with_native_roots()
1513/// .unwrap()
1514/// .https_or_http()
1515/// .enable_http2()
1516/// .build()
1517/// );
1518/// let mut hub = CloudDomains::new(client, auth);
1519/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1520/// // like `locations_get(...)`, `locations_list(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_registrations_configure_contact_settings(...)`, `locations_registrations_configure_dns_settings(...)`, `locations_registrations_configure_management_settings(...)`, `locations_registrations_delete(...)`, `locations_registrations_export(...)`, `locations_registrations_get(...)`, `locations_registrations_get_iam_policy(...)`, `locations_registrations_import(...)`, `locations_registrations_initiate_push_transfer(...)`, `locations_registrations_list(...)`, `locations_registrations_patch(...)`, `locations_registrations_register(...)`, `locations_registrations_renew_domain(...)`, `locations_registrations_reset_authorization_code(...)`, `locations_registrations_retrieve_authorization_code(...)`, `locations_registrations_retrieve_google_domains_dns_records(...)`, `locations_registrations_retrieve_google_domains_forwarding_config(...)`, `locations_registrations_retrieve_importable_domains(...)`, `locations_registrations_retrieve_register_parameters(...)`, `locations_registrations_retrieve_transfer_parameters(...)`, `locations_registrations_search_domains(...)`, `locations_registrations_set_iam_policy(...)`, `locations_registrations_test_iam_permissions(...)` and `locations_registrations_transfer(...)`
1521/// // to build up your call.
1522/// let rb = hub.projects();
1523/// # }
1524/// ```
1525pub struct ProjectMethods<'a, C>
1526where
1527 C: 'a,
1528{
1529 hub: &'a CloudDomains<C>,
1530}
1531
1532impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1533
1534impl<'a, C> ProjectMethods<'a, C> {
1535 /// Create a builder to help you perform the following task:
1536 ///
1537 /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1538 ///
1539 /// # Arguments
1540 ///
1541 /// * `name` - The name of the operation resource.
1542 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
1543 ProjectLocationOperationGetCall {
1544 hub: self.hub,
1545 _name: name.to_string(),
1546 _delegate: Default::default(),
1547 _additional_params: Default::default(),
1548 _scopes: Default::default(),
1549 }
1550 }
1551
1552 /// Create a builder to help you perform the following task:
1553 ///
1554 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
1555 ///
1556 /// # Arguments
1557 ///
1558 /// * `name` - The name of the operation's parent resource.
1559 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
1560 ProjectLocationOperationListCall {
1561 hub: self.hub,
1562 _name: name.to_string(),
1563 _page_token: Default::default(),
1564 _page_size: Default::default(),
1565 _filter: Default::default(),
1566 _delegate: Default::default(),
1567 _additional_params: Default::default(),
1568 _scopes: Default::default(),
1569 }
1570 }
1571
1572 /// Create a builder to help you perform the following task:
1573 ///
1574 /// Updates a `Registration`'s contact settings. Some changes require confirmation by the domain's registrant contact . Caution: Please consider carefully any changes to contact privacy settings when changing from `REDACTED_CONTACT_DATA` to `PUBLIC_CONTACT_DATA.` There may be a delay in reflecting updates you make to registrant contact information such that any changes you make to contact privacy (including from `REDACTED_CONTACT_DATA` to `PUBLIC_CONTACT_DATA`) will be applied without delay but changes to registrant contact information may take a limited time to be publicized. This means that changes to contact privacy from `REDACTED_CONTACT_DATA` to `PUBLIC_CONTACT_DATA` may make the previous registrant contact data public until the modified registrant contact details are published.
1575 ///
1576 /// # Arguments
1577 ///
1578 /// * `request` - No description provided.
1579 /// * `registration` - Required. The name of the `Registration` whose contact settings are being updated, in the format `projects/*/locations/*/registrations/*`.
1580 pub fn locations_registrations_configure_contact_settings(
1581 &self,
1582 request: ConfigureContactSettingsRequest,
1583 registration: &str,
1584 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C> {
1585 ProjectLocationRegistrationConfigureContactSettingCall {
1586 hub: self.hub,
1587 _request: request,
1588 _registration: registration.to_string(),
1589 _delegate: Default::default(),
1590 _additional_params: Default::default(),
1591 _scopes: Default::default(),
1592 }
1593 }
1594
1595 /// Create a builder to help you perform the following task:
1596 ///
1597 /// Updates a `Registration`'s DNS settings.
1598 ///
1599 /// # Arguments
1600 ///
1601 /// * `request` - No description provided.
1602 /// * `registration` - Required. The name of the `Registration` whose DNS settings are being updated, in the format `projects/*/locations/*/registrations/*`.
1603 pub fn locations_registrations_configure_dns_settings(
1604 &self,
1605 request: ConfigureDnsSettingsRequest,
1606 registration: &str,
1607 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C> {
1608 ProjectLocationRegistrationConfigureDnsSettingCall {
1609 hub: self.hub,
1610 _request: request,
1611 _registration: registration.to_string(),
1612 _delegate: Default::default(),
1613 _additional_params: Default::default(),
1614 _scopes: Default::default(),
1615 }
1616 }
1617
1618 /// Create a builder to help you perform the following task:
1619 ///
1620 /// Updates a `Registration`'s management settings.
1621 ///
1622 /// # Arguments
1623 ///
1624 /// * `request` - No description provided.
1625 /// * `registration` - Required. The name of the `Registration` whose management settings are being updated, in the format `projects/*/locations/*/registrations/*`.
1626 pub fn locations_registrations_configure_management_settings(
1627 &self,
1628 request: ConfigureManagementSettingsRequest,
1629 registration: &str,
1630 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C> {
1631 ProjectLocationRegistrationConfigureManagementSettingCall {
1632 hub: self.hub,
1633 _request: request,
1634 _registration: registration.to_string(),
1635 _delegate: Default::default(),
1636 _additional_params: Default::default(),
1637 _scopes: Default::default(),
1638 }
1639 }
1640
1641 /// Create a builder to help you perform the following task:
1642 ///
1643 /// Deletes a `Registration` resource. This method works on any `Registration` resource using [Subscription or Commitment billing](https://cloud.google.com/domains/pricing#billing-models), provided that the resource was created at least 1 day in the past. When an active registration is successfully deleted, you can continue to use the domain in [Google Domains](https://domains.google/) until it expires. The calling user becomes the domain’s sole owner in Google Domains, and permissions for the domain are subsequently managed there. The domain does not renew automatically unless the new owner sets up billing in Google Domains. After January 2024 you will only be able to delete `Registration` resources when `state` is one of: `EXPORTED`, `EXPIRED`,`REGISTRATION_FAILED` or `TRANSFER_FAILED`. See [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) for more details.
1644 ///
1645 /// # Arguments
1646 ///
1647 /// * `name` - Required. The name of the `Registration` to delete, in the format `projects/*/locations/*/registrations/*`.
1648 pub fn locations_registrations_delete(
1649 &self,
1650 name: &str,
1651 ) -> ProjectLocationRegistrationDeleteCall<'a, C> {
1652 ProjectLocationRegistrationDeleteCall {
1653 hub: self.hub,
1654 _name: name.to_string(),
1655 _delegate: Default::default(),
1656 _additional_params: Default::default(),
1657 _scopes: Default::default(),
1658 }
1659 }
1660
1661 /// Create a builder to help you perform the following task:
1662 ///
1663 /// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Exports a `Registration` resource, such that it is no longer managed by Cloud Domains. When an active domain is successfully exported, you can continue to use the domain in [Google Domains](https://domains.google/) until it expires. The calling user becomes the domain's sole owner in Google Domains, and permissions for the domain are subsequently managed there. The domain does not renew automatically unless the new owner sets up billing in Google Domains.
1664 ///
1665 /// # Arguments
1666 ///
1667 /// * `request` - No description provided.
1668 /// * `name` - Required. The name of the `Registration` to export, in the format `projects/*/locations/*/registrations/*`.
1669 pub fn locations_registrations_export(
1670 &self,
1671 request: ExportRegistrationRequest,
1672 name: &str,
1673 ) -> ProjectLocationRegistrationExportCall<'a, C> {
1674 ProjectLocationRegistrationExportCall {
1675 hub: self.hub,
1676 _request: request,
1677 _name: name.to_string(),
1678 _delegate: Default::default(),
1679 _additional_params: Default::default(),
1680 _scopes: Default::default(),
1681 }
1682 }
1683
1684 /// Create a builder to help you perform the following task:
1685 ///
1686 /// Gets the details of a `Registration` resource.
1687 ///
1688 /// # Arguments
1689 ///
1690 /// * `name` - Required. The name of the `Registration` to get, in the format `projects/*/locations/*/registrations/*`.
1691 pub fn locations_registrations_get(
1692 &self,
1693 name: &str,
1694 ) -> ProjectLocationRegistrationGetCall<'a, C> {
1695 ProjectLocationRegistrationGetCall {
1696 hub: self.hub,
1697 _name: name.to_string(),
1698 _delegate: Default::default(),
1699 _additional_params: Default::default(),
1700 _scopes: Default::default(),
1701 }
1702 }
1703
1704 /// Create a builder to help you perform the following task:
1705 ///
1706 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
1707 ///
1708 /// # Arguments
1709 ///
1710 /// * `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.
1711 pub fn locations_registrations_get_iam_policy(
1712 &self,
1713 resource: &str,
1714 ) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C> {
1715 ProjectLocationRegistrationGetIamPolicyCall {
1716 hub: self.hub,
1717 _resource: resource.to_string(),
1718 _options_requested_policy_version: Default::default(),
1719 _delegate: Default::default(),
1720 _additional_params: Default::default(),
1721 _scopes: Default::default(),
1722 }
1723 }
1724
1725 /// Create a builder to help you perform the following task:
1726 ///
1727 /// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Imports a domain name from [Google Domains](https://domains.google/) for use in Cloud Domains. To transfer a domain from another registrar, use the `TransferDomain` method instead. Since individual users can own domains in Google Domains, the calling user must have ownership permission on the domain.
1728 ///
1729 /// # Arguments
1730 ///
1731 /// * `request` - No description provided.
1732 /// * `parent` - Required. The parent resource of the Registration. Must be in the format `projects/*/locations/*`.
1733 pub fn locations_registrations_import(
1734 &self,
1735 request: ImportDomainRequest,
1736 parent: &str,
1737 ) -> ProjectLocationRegistrationImportCall<'a, C> {
1738 ProjectLocationRegistrationImportCall {
1739 hub: self.hub,
1740 _request: request,
1741 _parent: parent.to_string(),
1742 _delegate: Default::default(),
1743 _additional_params: Default::default(),
1744 _scopes: Default::default(),
1745 }
1746 }
1747
1748 /// Create a builder to help you perform the following task:
1749 ///
1750 /// Initiates the `Push Transfer` process to transfer the domain to another registrar. The process might complete instantly or might require confirmation or additional work. Check the emails sent to the email address of the registrant. The process is aborted after a timeout if it's not completed. This method is only supported for domains that have the `REQUIRE_PUSH_TRANSFER` property in the list of `domain_properties`. The domain must also be unlocked before it can be transferred to a different registrar. For more information, see [Transfer a registered domain to another registrar](https://cloud.google.com/domains/docs/transfer-domain-to-another-registrar).
1751 ///
1752 /// # Arguments
1753 ///
1754 /// * `request` - No description provided.
1755 /// * `registration` - Required. The name of the `Registration` for which the push transfer is initiated, in the format `projects/*/locations/*/registrations/*`.
1756 pub fn locations_registrations_initiate_push_transfer(
1757 &self,
1758 request: InitiatePushTransferRequest,
1759 registration: &str,
1760 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C> {
1761 ProjectLocationRegistrationInitiatePushTransferCall {
1762 hub: self.hub,
1763 _request: request,
1764 _registration: registration.to_string(),
1765 _delegate: Default::default(),
1766 _additional_params: Default::default(),
1767 _scopes: Default::default(),
1768 }
1769 }
1770
1771 /// Create a builder to help you perform the following task:
1772 ///
1773 /// Lists the `Registration` resources in a project.
1774 ///
1775 /// # Arguments
1776 ///
1777 /// * `parent` - Required. The project and location from which to list `Registration`s, specified in the format `projects/*/locations/*`.
1778 pub fn locations_registrations_list(
1779 &self,
1780 parent: &str,
1781 ) -> ProjectLocationRegistrationListCall<'a, C> {
1782 ProjectLocationRegistrationListCall {
1783 hub: self.hub,
1784 _parent: parent.to_string(),
1785 _page_token: Default::default(),
1786 _page_size: Default::default(),
1787 _filter: Default::default(),
1788 _delegate: Default::default(),
1789 _additional_params: Default::default(),
1790 _scopes: Default::default(),
1791 }
1792 }
1793
1794 /// Create a builder to help you perform the following task:
1795 ///
1796 /// Updates select fields of a `Registration` resource, notably `labels`. To update other fields, use the appropriate custom update method: * To update management settings, see `ConfigureManagementSettings` * To update DNS configuration, see `ConfigureDnsSettings` * To update contact information, see `ConfigureContactSettings`
1797 ///
1798 /// # Arguments
1799 ///
1800 /// * `request` - No description provided.
1801 /// * `name` - Output only. Name of the `Registration` resource, in the format `projects/*/locations/*/registrations/`.
1802 pub fn locations_registrations_patch(
1803 &self,
1804 request: Registration,
1805 name: &str,
1806 ) -> ProjectLocationRegistrationPatchCall<'a, C> {
1807 ProjectLocationRegistrationPatchCall {
1808 hub: self.hub,
1809 _request: request,
1810 _name: name.to_string(),
1811 _update_mask: Default::default(),
1812 _delegate: Default::default(),
1813 _additional_params: Default::default(),
1814 _scopes: Default::default(),
1815 }
1816 }
1817
1818 /// Create a builder to help you perform the following task:
1819 ///
1820 /// Registers a new domain name and creates a corresponding `Registration` resource. Call `RetrieveRegisterParameters` first to check availability of the domain name and determine parameters like price that are needed to build a call to this method. A successful call creates a `Registration` resource in state `REGISTRATION_PENDING`, which resolves to `ACTIVE` within 1-2 minutes, indicating that the domain was successfully registered. If the resource ends up in state `REGISTRATION_FAILED`, it indicates that the domain was not registered successfully, and you can safely delete the resource and retry registration.
1821 ///
1822 /// # Arguments
1823 ///
1824 /// * `request` - No description provided.
1825 /// * `parent` - Required. The parent resource of the `Registration`. Must be in the format `projects/*/locations/*`.
1826 pub fn locations_registrations_register(
1827 &self,
1828 request: RegisterDomainRequest,
1829 parent: &str,
1830 ) -> ProjectLocationRegistrationRegisterCall<'a, C> {
1831 ProjectLocationRegistrationRegisterCall {
1832 hub: self.hub,
1833 _request: request,
1834 _parent: parent.to_string(),
1835 _delegate: Default::default(),
1836 _additional_params: Default::default(),
1837 _scopes: Default::default(),
1838 }
1839 }
1840
1841 /// Create a builder to help you perform the following task:
1842 ///
1843 /// Renews a recently expired domain. This method can only be called on domains that expired in the previous 30 days. After the renewal, the new expiration time of the domain is one year after the old expiration time and you are charged a `yearly_price` for the renewal.
1844 ///
1845 /// # Arguments
1846 ///
1847 /// * `request` - No description provided.
1848 /// * `registration` - Required. The name of the `Registration` whish is being renewed, in the format `projects/*/locations/*/registrations/*`.
1849 pub fn locations_registrations_renew_domain(
1850 &self,
1851 request: RenewDomainRequest,
1852 registration: &str,
1853 ) -> ProjectLocationRegistrationRenewDomainCall<'a, C> {
1854 ProjectLocationRegistrationRenewDomainCall {
1855 hub: self.hub,
1856 _request: request,
1857 _registration: registration.to_string(),
1858 _delegate: Default::default(),
1859 _additional_params: Default::default(),
1860 _scopes: Default::default(),
1861 }
1862 }
1863
1864 /// Create a builder to help you perform the following task:
1865 ///
1866 /// Resets the authorization code of the `Registration` to a new random string. You can call this method only after 60 days have elapsed since the initial domain registration. Domains that have the `REQUIRE_PUSH_TRANSFER` property in the list of `domain_properties` don't support authorization codes and must use the `InitiatePushTransfer` method to initiate the process to transfer the domain to a different registrar.
1867 ///
1868 /// # Arguments
1869 ///
1870 /// * `request` - No description provided.
1871 /// * `registration` - Required. The name of the `Registration` whose authorization code is being reset, in the format `projects/*/locations/*/registrations/*`.
1872 pub fn locations_registrations_reset_authorization_code(
1873 &self,
1874 request: ResetAuthorizationCodeRequest,
1875 registration: &str,
1876 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C> {
1877 ProjectLocationRegistrationResetAuthorizationCodeCall {
1878 hub: self.hub,
1879 _request: request,
1880 _registration: registration.to_string(),
1881 _delegate: Default::default(),
1882 _additional_params: Default::default(),
1883 _scopes: Default::default(),
1884 }
1885 }
1886
1887 /// Create a builder to help you perform the following task:
1888 ///
1889 /// Gets the authorization code of the `Registration` for the purpose of transferring the domain to another registrar. You can call this method only after 60 days have elapsed since the initial domain registration. Domains that have the `REQUIRE_PUSH_TRANSFER` property in the list of `domain_properties` don't support authorization codes and must use the `InitiatePushTransfer` method to initiate the process to transfer the domain to a different registrar.
1890 ///
1891 /// # Arguments
1892 ///
1893 /// * `registration` - Required. The name of the `Registration` whose authorization code is being retrieved, in the format `projects/*/locations/*/registrations/*`.
1894 pub fn locations_registrations_retrieve_authorization_code(
1895 &self,
1896 registration: &str,
1897 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C> {
1898 ProjectLocationRegistrationRetrieveAuthorizationCodeCall {
1899 hub: self.hub,
1900 _registration: registration.to_string(),
1901 _delegate: Default::default(),
1902 _additional_params: Default::default(),
1903 _scopes: Default::default(),
1904 }
1905 }
1906
1907 /// Create a builder to help you perform the following task:
1908 ///
1909 /// Lists the DNS records from the Google Domains DNS zone for domains that use the deprecated `google_domains_dns` in the `Registration`'s `dns_settings`.
1910 ///
1911 /// # Arguments
1912 ///
1913 /// * `registration` - Required. The name of the `Registration` whose Google Domains DNS records details you are retrieving, in the format `projects/*/locations/*/registrations/*`.
1914 pub fn locations_registrations_retrieve_google_domains_dns_records(
1915 &self,
1916 registration: &str,
1917 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C> {
1918 ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall {
1919 hub: self.hub,
1920 _registration: registration.to_string(),
1921 _page_token: Default::default(),
1922 _page_size: Default::default(),
1923 _delegate: Default::default(),
1924 _additional_params: Default::default(),
1925 _scopes: Default::default(),
1926 }
1927 }
1928
1929 /// Create a builder to help you perform the following task:
1930 ///
1931 /// Lists the deprecated domain and email forwarding configurations you set up in the deprecated Google Domains UI. The configuration is present only for domains with the `google_domains_redirects_data_available` set to `true` in the `Registration`'s `dns_settings`. A forwarding configuration might not work correctly if required DNS records are not present in the domain's authoritative DNS Zone.
1932 ///
1933 /// # Arguments
1934 ///
1935 /// * `registration` - Required. The name of the `Registration` whose Google Domains forwarding configuration details are being retrieved, in the format `projects/*/locations/*/registrations/*`.
1936 pub fn locations_registrations_retrieve_google_domains_forwarding_config(
1937 &self,
1938 registration: &str,
1939 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C> {
1940 ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall {
1941 hub: self.hub,
1942 _registration: registration.to_string(),
1943 _delegate: Default::default(),
1944 _additional_params: Default::default(),
1945 _scopes: Default::default(),
1946 }
1947 }
1948
1949 /// Create a builder to help you perform the following task:
1950 ///
1951 /// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Lists domain names from [Google Domains](https://domains.google/) that can be imported to Cloud Domains using the `ImportDomain` method. Since individual users can own domains in Google Domains, the list of domains returned depends on the individual user making the call. Domains already managed by Cloud Domains are not returned.
1952 ///
1953 /// # Arguments
1954 ///
1955 /// * `location` - Required. The location. Must be in the format `projects/*/locations/*`.
1956 pub fn locations_registrations_retrieve_importable_domains(
1957 &self,
1958 location: &str,
1959 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {
1960 ProjectLocationRegistrationRetrieveImportableDomainCall {
1961 hub: self.hub,
1962 _location: location.to_string(),
1963 _page_token: Default::default(),
1964 _page_size: Default::default(),
1965 _delegate: Default::default(),
1966 _additional_params: Default::default(),
1967 _scopes: Default::default(),
1968 }
1969 }
1970
1971 /// Create a builder to help you perform the following task:
1972 ///
1973 /// Gets parameters needed to register a new domain name, including price and up-to-date availability. Use the returned values to call `RegisterDomain`.
1974 ///
1975 /// # Arguments
1976 ///
1977 /// * `location` - Required. The location. Must be in the format `projects/*/locations/*`.
1978 pub fn locations_registrations_retrieve_register_parameters(
1979 &self,
1980 location: &str,
1981 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C> {
1982 ProjectLocationRegistrationRetrieveRegisterParameterCall {
1983 hub: self.hub,
1984 _location: location.to_string(),
1985 _domain_name: Default::default(),
1986 _delegate: Default::default(),
1987 _additional_params: Default::default(),
1988 _scopes: Default::default(),
1989 }
1990 }
1991
1992 /// Create a builder to help you perform the following task:
1993 ///
1994 /// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Gets parameters needed to transfer a domain name from another registrar to Cloud Domains. For domains already managed by [Google Domains](https://domains.google/), use `ImportDomain` instead. Use the returned values to call `TransferDomain`.
1995 ///
1996 /// # Arguments
1997 ///
1998 /// * `location` - Required. The location. Must be in the format `projects/*/locations/*`.
1999 pub fn locations_registrations_retrieve_transfer_parameters(
2000 &self,
2001 location: &str,
2002 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C> {
2003 ProjectLocationRegistrationRetrieveTransferParameterCall {
2004 hub: self.hub,
2005 _location: location.to_string(),
2006 _domain_name: Default::default(),
2007 _delegate: Default::default(),
2008 _additional_params: Default::default(),
2009 _scopes: Default::default(),
2010 }
2011 }
2012
2013 /// Create a builder to help you perform the following task:
2014 ///
2015 /// Searches for available domain names similar to the provided query. Availability results from this method are approximate; call `RetrieveRegisterParameters` on a domain before registering to confirm availability.
2016 ///
2017 /// # Arguments
2018 ///
2019 /// * `location` - Required. The location. Must be in the format `projects/*/locations/*`.
2020 pub fn locations_registrations_search_domains(
2021 &self,
2022 location: &str,
2023 ) -> ProjectLocationRegistrationSearchDomainCall<'a, C> {
2024 ProjectLocationRegistrationSearchDomainCall {
2025 hub: self.hub,
2026 _location: location.to_string(),
2027 _query: Default::default(),
2028 _delegate: Default::default(),
2029 _additional_params: Default::default(),
2030 _scopes: Default::default(),
2031 }
2032 }
2033
2034 /// Create a builder to help you perform the following task:
2035 ///
2036 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
2037 ///
2038 /// # Arguments
2039 ///
2040 /// * `request` - No description provided.
2041 /// * `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.
2042 pub fn locations_registrations_set_iam_policy(
2043 &self,
2044 request: SetIamPolicyRequest,
2045 resource: &str,
2046 ) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C> {
2047 ProjectLocationRegistrationSetIamPolicyCall {
2048 hub: self.hub,
2049 _request: request,
2050 _resource: resource.to_string(),
2051 _delegate: Default::default(),
2052 _additional_params: Default::default(),
2053 _scopes: Default::default(),
2054 }
2055 }
2056
2057 /// Create a builder to help you perform the following task:
2058 ///
2059 /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return 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.
2060 ///
2061 /// # Arguments
2062 ///
2063 /// * `request` - No description provided.
2064 /// * `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.
2065 pub fn locations_registrations_test_iam_permissions(
2066 &self,
2067 request: TestIamPermissionsRequest,
2068 resource: &str,
2069 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C> {
2070 ProjectLocationRegistrationTestIamPermissionCall {
2071 hub: self.hub,
2072 _request: request,
2073 _resource: resource.to_string(),
2074 _delegate: Default::default(),
2075 _additional_params: Default::default(),
2076 _scopes: Default::default(),
2077 }
2078 }
2079
2080 /// Create a builder to help you perform the following task:
2081 ///
2082 /// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Transfers a domain name from another registrar to Cloud Domains. For domains already managed by [Google Domains](https://domains.google/), use `ImportDomain` instead. Before calling this method, go to the domain's current registrar to unlock the domain for transfer and retrieve the domain's transfer authorization code. Then call `RetrieveTransferParameters` to confirm that the domain is unlocked and to get values needed to build a call to this method. A successful call creates a `Registration` resource in state `TRANSFER_PENDING`. It can take several days to complete the transfer process. The registrant can often speed up this process by approving the transfer through the current registrar, either by clicking a link in an email from the registrar or by visiting the registrar's website. A few minutes after transfer approval, the resource transitions to state `ACTIVE`, indicating that the transfer was successful. If the transfer is rejected or the request expires without being approved, the resource can end up in state `TRANSFER_FAILED`. If transfer fails, you can safely delete the resource and retry the transfer.
2083 ///
2084 /// # Arguments
2085 ///
2086 /// * `request` - No description provided.
2087 /// * `parent` - Required. The parent resource of the `Registration`. Must be in the format `projects/*/locations/*`.
2088 pub fn locations_registrations_transfer(
2089 &self,
2090 request: TransferDomainRequest,
2091 parent: &str,
2092 ) -> ProjectLocationRegistrationTransferCall<'a, C> {
2093 ProjectLocationRegistrationTransferCall {
2094 hub: self.hub,
2095 _request: request,
2096 _parent: parent.to_string(),
2097 _delegate: Default::default(),
2098 _additional_params: Default::default(),
2099 _scopes: Default::default(),
2100 }
2101 }
2102
2103 /// Create a builder to help you perform the following task:
2104 ///
2105 /// Gets information about a location.
2106 ///
2107 /// # Arguments
2108 ///
2109 /// * `name` - Resource name for the location.
2110 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
2111 ProjectLocationGetCall {
2112 hub: self.hub,
2113 _name: name.to_string(),
2114 _delegate: Default::default(),
2115 _additional_params: Default::default(),
2116 _scopes: Default::default(),
2117 }
2118 }
2119
2120 /// Create a builder to help you perform the following task:
2121 ///
2122 /// Lists information about the supported locations for this service.
2123 ///
2124 /// # Arguments
2125 ///
2126 /// * `name` - The resource that owns the locations collection, if applicable.
2127 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
2128 ProjectLocationListCall {
2129 hub: self.hub,
2130 _name: name.to_string(),
2131 _page_token: Default::default(),
2132 _page_size: Default::default(),
2133 _filter: Default::default(),
2134 _extra_location_types: Default::default(),
2135 _delegate: Default::default(),
2136 _additional_params: Default::default(),
2137 _scopes: Default::default(),
2138 }
2139 }
2140}
2141
2142// ###################
2143// CallBuilders ###
2144// #################
2145
2146/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
2147///
2148/// A builder for the *locations.operations.get* method supported by a *project* resource.
2149/// It is not used directly, but through a [`ProjectMethods`] instance.
2150///
2151/// # Example
2152///
2153/// Instantiate a resource method builder
2154///
2155/// ```test_harness,no_run
2156/// # extern crate hyper;
2157/// # extern crate hyper_rustls;
2158/// # extern crate google_domains1 as domains1;
2159/// # async fn dox() {
2160/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2161///
2162/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2163/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2164/// # .with_native_roots()
2165/// # .unwrap()
2166/// # .https_only()
2167/// # .enable_http2()
2168/// # .build();
2169///
2170/// # let executor = hyper_util::rt::TokioExecutor::new();
2171/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2172/// # secret,
2173/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2174/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2175/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2176/// # ),
2177/// # ).build().await.unwrap();
2178///
2179/// # let client = hyper_util::client::legacy::Client::builder(
2180/// # hyper_util::rt::TokioExecutor::new()
2181/// # )
2182/// # .build(
2183/// # hyper_rustls::HttpsConnectorBuilder::new()
2184/// # .with_native_roots()
2185/// # .unwrap()
2186/// # .https_or_http()
2187/// # .enable_http2()
2188/// # .build()
2189/// # );
2190/// # let mut hub = CloudDomains::new(client, auth);
2191/// // You can configure optional parameters by calling the respective setters at will, and
2192/// // execute the final call using `doit()`.
2193/// // Values shown here are possibly random and not representative !
2194/// let result = hub.projects().locations_operations_get("name")
2195/// .doit().await;
2196/// # }
2197/// ```
2198pub struct ProjectLocationOperationGetCall<'a, C>
2199where
2200 C: 'a,
2201{
2202 hub: &'a CloudDomains<C>,
2203 _name: String,
2204 _delegate: Option<&'a mut dyn common::Delegate>,
2205 _additional_params: HashMap<String, String>,
2206 _scopes: BTreeSet<String>,
2207}
2208
2209impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
2210
2211impl<'a, C> ProjectLocationOperationGetCall<'a, C>
2212where
2213 C: common::Connector,
2214{
2215 /// Perform the operation you have build so far.
2216 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2217 use std::borrow::Cow;
2218 use std::io::{Read, Seek};
2219
2220 use common::{url::Params, ToParts};
2221 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2222
2223 let mut dd = common::DefaultDelegate;
2224 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2225 dlg.begin(common::MethodInfo {
2226 id: "domains.projects.locations.operations.get",
2227 http_method: hyper::Method::GET,
2228 });
2229
2230 for &field in ["alt", "name"].iter() {
2231 if self._additional_params.contains_key(field) {
2232 dlg.finished(false);
2233 return Err(common::Error::FieldClash(field));
2234 }
2235 }
2236
2237 let mut params = Params::with_capacity(3 + self._additional_params.len());
2238 params.push("name", self._name);
2239
2240 params.extend(self._additional_params.iter());
2241
2242 params.push("alt", "json");
2243 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2244 if self._scopes.is_empty() {
2245 self._scopes
2246 .insert(Scope::CloudPlatform.as_ref().to_string());
2247 }
2248
2249 #[allow(clippy::single_element_loop)]
2250 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2251 url = params.uri_replacement(url, param_name, find_this, true);
2252 }
2253 {
2254 let to_remove = ["name"];
2255 params.remove_params(&to_remove);
2256 }
2257
2258 let url = params.parse_with_url(&url);
2259
2260 loop {
2261 let token = match self
2262 .hub
2263 .auth
2264 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2265 .await
2266 {
2267 Ok(token) => token,
2268 Err(e) => match dlg.token(e) {
2269 Ok(token) => token,
2270 Err(e) => {
2271 dlg.finished(false);
2272 return Err(common::Error::MissingToken(e));
2273 }
2274 },
2275 };
2276 let mut req_result = {
2277 let client = &self.hub.client;
2278 dlg.pre_request();
2279 let mut req_builder = hyper::Request::builder()
2280 .method(hyper::Method::GET)
2281 .uri(url.as_str())
2282 .header(USER_AGENT, self.hub._user_agent.clone());
2283
2284 if let Some(token) = token.as_ref() {
2285 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2286 }
2287
2288 let request = req_builder
2289 .header(CONTENT_LENGTH, 0_u64)
2290 .body(common::to_body::<String>(None));
2291
2292 client.request(request.unwrap()).await
2293 };
2294
2295 match req_result {
2296 Err(err) => {
2297 if let common::Retry::After(d) = dlg.http_error(&err) {
2298 sleep(d).await;
2299 continue;
2300 }
2301 dlg.finished(false);
2302 return Err(common::Error::HttpError(err));
2303 }
2304 Ok(res) => {
2305 let (mut parts, body) = res.into_parts();
2306 let mut body = common::Body::new(body);
2307 if !parts.status.is_success() {
2308 let bytes = common::to_bytes(body).await.unwrap_or_default();
2309 let error = serde_json::from_str(&common::to_string(&bytes));
2310 let response = common::to_response(parts, bytes.into());
2311
2312 if let common::Retry::After(d) =
2313 dlg.http_failure(&response, error.as_ref().ok())
2314 {
2315 sleep(d).await;
2316 continue;
2317 }
2318
2319 dlg.finished(false);
2320
2321 return Err(match error {
2322 Ok(value) => common::Error::BadRequest(value),
2323 _ => common::Error::Failure(response),
2324 });
2325 }
2326 let response = {
2327 let bytes = common::to_bytes(body).await.unwrap_or_default();
2328 let encoded = common::to_string(&bytes);
2329 match serde_json::from_str(&encoded) {
2330 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2331 Err(error) => {
2332 dlg.response_json_decode_error(&encoded, &error);
2333 return Err(common::Error::JsonDecodeError(
2334 encoded.to_string(),
2335 error,
2336 ));
2337 }
2338 }
2339 };
2340
2341 dlg.finished(true);
2342 return Ok(response);
2343 }
2344 }
2345 }
2346 }
2347
2348 /// The name of the operation resource.
2349 ///
2350 /// Sets the *name* path property to the given value.
2351 ///
2352 /// Even though the property as already been set when instantiating this call,
2353 /// we provide this method for API completeness.
2354 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
2355 self._name = new_value.to_string();
2356 self
2357 }
2358 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2359 /// while executing the actual API request.
2360 ///
2361 /// ````text
2362 /// It should be used to handle progress information, and to implement a certain level of resilience.
2363 /// ````
2364 ///
2365 /// Sets the *delegate* property to the given value.
2366 pub fn delegate(
2367 mut self,
2368 new_value: &'a mut dyn common::Delegate,
2369 ) -> ProjectLocationOperationGetCall<'a, C> {
2370 self._delegate = Some(new_value);
2371 self
2372 }
2373
2374 /// Set any additional parameter of the query string used in the request.
2375 /// It should be used to set parameters which are not yet available through their own
2376 /// setters.
2377 ///
2378 /// Please note that this method must not be used to set any of the known parameters
2379 /// which have their own setter method. If done anyway, the request will fail.
2380 ///
2381 /// # Additional Parameters
2382 ///
2383 /// * *$.xgafv* (query-string) - V1 error format.
2384 /// * *access_token* (query-string) - OAuth access token.
2385 /// * *alt* (query-string) - Data format for response.
2386 /// * *callback* (query-string) - JSONP
2387 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2388 /// * *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.
2389 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2390 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2391 /// * *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.
2392 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2393 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2394 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
2395 where
2396 T: AsRef<str>,
2397 {
2398 self._additional_params
2399 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2400 self
2401 }
2402
2403 /// Identifies the authorization scope for the method you are building.
2404 ///
2405 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2406 /// [`Scope::CloudPlatform`].
2407 ///
2408 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2409 /// tokens for more than one scope.
2410 ///
2411 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2412 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2413 /// sufficient, a read-write scope will do as well.
2414 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
2415 where
2416 St: AsRef<str>,
2417 {
2418 self._scopes.insert(String::from(scope.as_ref()));
2419 self
2420 }
2421 /// Identifies the authorization scope(s) for the method you are building.
2422 ///
2423 /// See [`Self::add_scope()`] for details.
2424 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
2425 where
2426 I: IntoIterator<Item = St>,
2427 St: AsRef<str>,
2428 {
2429 self._scopes
2430 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2431 self
2432 }
2433
2434 /// Removes all scopes, and no default scope will be used either.
2435 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2436 /// for details).
2437 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
2438 self._scopes.clear();
2439 self
2440 }
2441}
2442
2443/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2444///
2445/// A builder for the *locations.operations.list* method supported by a *project* resource.
2446/// It is not used directly, but through a [`ProjectMethods`] instance.
2447///
2448/// # Example
2449///
2450/// Instantiate a resource method builder
2451///
2452/// ```test_harness,no_run
2453/// # extern crate hyper;
2454/// # extern crate hyper_rustls;
2455/// # extern crate google_domains1 as domains1;
2456/// # async fn dox() {
2457/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2458///
2459/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2460/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2461/// # .with_native_roots()
2462/// # .unwrap()
2463/// # .https_only()
2464/// # .enable_http2()
2465/// # .build();
2466///
2467/// # let executor = hyper_util::rt::TokioExecutor::new();
2468/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2469/// # secret,
2470/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2471/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2472/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2473/// # ),
2474/// # ).build().await.unwrap();
2475///
2476/// # let client = hyper_util::client::legacy::Client::builder(
2477/// # hyper_util::rt::TokioExecutor::new()
2478/// # )
2479/// # .build(
2480/// # hyper_rustls::HttpsConnectorBuilder::new()
2481/// # .with_native_roots()
2482/// # .unwrap()
2483/// # .https_or_http()
2484/// # .enable_http2()
2485/// # .build()
2486/// # );
2487/// # let mut hub = CloudDomains::new(client, auth);
2488/// // You can configure optional parameters by calling the respective setters at will, and
2489/// // execute the final call using `doit()`.
2490/// // Values shown here are possibly random and not representative !
2491/// let result = hub.projects().locations_operations_list("name")
2492/// .page_token("At")
2493/// .page_size(-8)
2494/// .filter("sed")
2495/// .doit().await;
2496/// # }
2497/// ```
2498pub struct ProjectLocationOperationListCall<'a, C>
2499where
2500 C: 'a,
2501{
2502 hub: &'a CloudDomains<C>,
2503 _name: String,
2504 _page_token: Option<String>,
2505 _page_size: Option<i32>,
2506 _filter: Option<String>,
2507 _delegate: Option<&'a mut dyn common::Delegate>,
2508 _additional_params: HashMap<String, String>,
2509 _scopes: BTreeSet<String>,
2510}
2511
2512impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
2513
2514impl<'a, C> ProjectLocationOperationListCall<'a, C>
2515where
2516 C: common::Connector,
2517{
2518 /// Perform the operation you have build so far.
2519 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
2520 use std::borrow::Cow;
2521 use std::io::{Read, Seek};
2522
2523 use common::{url::Params, ToParts};
2524 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2525
2526 let mut dd = common::DefaultDelegate;
2527 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2528 dlg.begin(common::MethodInfo {
2529 id: "domains.projects.locations.operations.list",
2530 http_method: hyper::Method::GET,
2531 });
2532
2533 for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
2534 if self._additional_params.contains_key(field) {
2535 dlg.finished(false);
2536 return Err(common::Error::FieldClash(field));
2537 }
2538 }
2539
2540 let mut params = Params::with_capacity(6 + self._additional_params.len());
2541 params.push("name", self._name);
2542 if let Some(value) = self._page_token.as_ref() {
2543 params.push("pageToken", value);
2544 }
2545 if let Some(value) = self._page_size.as_ref() {
2546 params.push("pageSize", value.to_string());
2547 }
2548 if let Some(value) = self._filter.as_ref() {
2549 params.push("filter", value);
2550 }
2551
2552 params.extend(self._additional_params.iter());
2553
2554 params.push("alt", "json");
2555 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
2556 if self._scopes.is_empty() {
2557 self._scopes
2558 .insert(Scope::CloudPlatform.as_ref().to_string());
2559 }
2560
2561 #[allow(clippy::single_element_loop)]
2562 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2563 url = params.uri_replacement(url, param_name, find_this, true);
2564 }
2565 {
2566 let to_remove = ["name"];
2567 params.remove_params(&to_remove);
2568 }
2569
2570 let url = params.parse_with_url(&url);
2571
2572 loop {
2573 let token = match self
2574 .hub
2575 .auth
2576 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2577 .await
2578 {
2579 Ok(token) => token,
2580 Err(e) => match dlg.token(e) {
2581 Ok(token) => token,
2582 Err(e) => {
2583 dlg.finished(false);
2584 return Err(common::Error::MissingToken(e));
2585 }
2586 },
2587 };
2588 let mut req_result = {
2589 let client = &self.hub.client;
2590 dlg.pre_request();
2591 let mut req_builder = hyper::Request::builder()
2592 .method(hyper::Method::GET)
2593 .uri(url.as_str())
2594 .header(USER_AGENT, self.hub._user_agent.clone());
2595
2596 if let Some(token) = token.as_ref() {
2597 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2598 }
2599
2600 let request = req_builder
2601 .header(CONTENT_LENGTH, 0_u64)
2602 .body(common::to_body::<String>(None));
2603
2604 client.request(request.unwrap()).await
2605 };
2606
2607 match req_result {
2608 Err(err) => {
2609 if let common::Retry::After(d) = dlg.http_error(&err) {
2610 sleep(d).await;
2611 continue;
2612 }
2613 dlg.finished(false);
2614 return Err(common::Error::HttpError(err));
2615 }
2616 Ok(res) => {
2617 let (mut parts, body) = res.into_parts();
2618 let mut body = common::Body::new(body);
2619 if !parts.status.is_success() {
2620 let bytes = common::to_bytes(body).await.unwrap_or_default();
2621 let error = serde_json::from_str(&common::to_string(&bytes));
2622 let response = common::to_response(parts, bytes.into());
2623
2624 if let common::Retry::After(d) =
2625 dlg.http_failure(&response, error.as_ref().ok())
2626 {
2627 sleep(d).await;
2628 continue;
2629 }
2630
2631 dlg.finished(false);
2632
2633 return Err(match error {
2634 Ok(value) => common::Error::BadRequest(value),
2635 _ => common::Error::Failure(response),
2636 });
2637 }
2638 let response = {
2639 let bytes = common::to_bytes(body).await.unwrap_or_default();
2640 let encoded = common::to_string(&bytes);
2641 match serde_json::from_str(&encoded) {
2642 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2643 Err(error) => {
2644 dlg.response_json_decode_error(&encoded, &error);
2645 return Err(common::Error::JsonDecodeError(
2646 encoded.to_string(),
2647 error,
2648 ));
2649 }
2650 }
2651 };
2652
2653 dlg.finished(true);
2654 return Ok(response);
2655 }
2656 }
2657 }
2658 }
2659
2660 /// The name of the operation's parent resource.
2661 ///
2662 /// Sets the *name* path property to the given value.
2663 ///
2664 /// Even though the property as already been set when instantiating this call,
2665 /// we provide this method for API completeness.
2666 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
2667 self._name = new_value.to_string();
2668 self
2669 }
2670 /// The standard list page token.
2671 ///
2672 /// Sets the *page token* query property to the given value.
2673 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
2674 self._page_token = Some(new_value.to_string());
2675 self
2676 }
2677 /// The standard list page size.
2678 ///
2679 /// Sets the *page size* query property to the given value.
2680 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
2681 self._page_size = Some(new_value);
2682 self
2683 }
2684 /// The standard list filter.
2685 ///
2686 /// Sets the *filter* query property to the given value.
2687 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
2688 self._filter = Some(new_value.to_string());
2689 self
2690 }
2691 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2692 /// while executing the actual API request.
2693 ///
2694 /// ````text
2695 /// It should be used to handle progress information, and to implement a certain level of resilience.
2696 /// ````
2697 ///
2698 /// Sets the *delegate* property to the given value.
2699 pub fn delegate(
2700 mut self,
2701 new_value: &'a mut dyn common::Delegate,
2702 ) -> ProjectLocationOperationListCall<'a, C> {
2703 self._delegate = Some(new_value);
2704 self
2705 }
2706
2707 /// Set any additional parameter of the query string used in the request.
2708 /// It should be used to set parameters which are not yet available through their own
2709 /// setters.
2710 ///
2711 /// Please note that this method must not be used to set any of the known parameters
2712 /// which have their own setter method. If done anyway, the request will fail.
2713 ///
2714 /// # Additional Parameters
2715 ///
2716 /// * *$.xgafv* (query-string) - V1 error format.
2717 /// * *access_token* (query-string) - OAuth access token.
2718 /// * *alt* (query-string) - Data format for response.
2719 /// * *callback* (query-string) - JSONP
2720 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2721 /// * *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.
2722 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2723 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2724 /// * *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.
2725 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2726 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2727 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
2728 where
2729 T: AsRef<str>,
2730 {
2731 self._additional_params
2732 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2733 self
2734 }
2735
2736 /// Identifies the authorization scope for the method you are building.
2737 ///
2738 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2739 /// [`Scope::CloudPlatform`].
2740 ///
2741 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2742 /// tokens for more than one scope.
2743 ///
2744 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2745 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2746 /// sufficient, a read-write scope will do as well.
2747 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
2748 where
2749 St: AsRef<str>,
2750 {
2751 self._scopes.insert(String::from(scope.as_ref()));
2752 self
2753 }
2754 /// Identifies the authorization scope(s) for the method you are building.
2755 ///
2756 /// See [`Self::add_scope()`] for details.
2757 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
2758 where
2759 I: IntoIterator<Item = St>,
2760 St: AsRef<str>,
2761 {
2762 self._scopes
2763 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2764 self
2765 }
2766
2767 /// Removes all scopes, and no default scope will be used either.
2768 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2769 /// for details).
2770 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
2771 self._scopes.clear();
2772 self
2773 }
2774}
2775
2776/// Updates a `Registration`'s contact settings. Some changes require confirmation by the domain's registrant contact . Caution: Please consider carefully any changes to contact privacy settings when changing from `REDACTED_CONTACT_DATA` to `PUBLIC_CONTACT_DATA.` There may be a delay in reflecting updates you make to registrant contact information such that any changes you make to contact privacy (including from `REDACTED_CONTACT_DATA` to `PUBLIC_CONTACT_DATA`) will be applied without delay but changes to registrant contact information may take a limited time to be publicized. This means that changes to contact privacy from `REDACTED_CONTACT_DATA` to `PUBLIC_CONTACT_DATA` may make the previous registrant contact data public until the modified registrant contact details are published.
2777///
2778/// A builder for the *locations.registrations.configureContactSettings* method supported by a *project* resource.
2779/// It is not used directly, but through a [`ProjectMethods`] instance.
2780///
2781/// # Example
2782///
2783/// Instantiate a resource method builder
2784///
2785/// ```test_harness,no_run
2786/// # extern crate hyper;
2787/// # extern crate hyper_rustls;
2788/// # extern crate google_domains1 as domains1;
2789/// use domains1::api::ConfigureContactSettingsRequest;
2790/// # async fn dox() {
2791/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2792///
2793/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2794/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2795/// # .with_native_roots()
2796/// # .unwrap()
2797/// # .https_only()
2798/// # .enable_http2()
2799/// # .build();
2800///
2801/// # let executor = hyper_util::rt::TokioExecutor::new();
2802/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2803/// # secret,
2804/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2805/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2806/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2807/// # ),
2808/// # ).build().await.unwrap();
2809///
2810/// # let client = hyper_util::client::legacy::Client::builder(
2811/// # hyper_util::rt::TokioExecutor::new()
2812/// # )
2813/// # .build(
2814/// # hyper_rustls::HttpsConnectorBuilder::new()
2815/// # .with_native_roots()
2816/// # .unwrap()
2817/// # .https_or_http()
2818/// # .enable_http2()
2819/// # .build()
2820/// # );
2821/// # let mut hub = CloudDomains::new(client, auth);
2822/// // As the method needs a request, you would usually fill it with the desired information
2823/// // into the respective structure. Some of the parts shown here might not be applicable !
2824/// // Values shown here are possibly random and not representative !
2825/// let mut req = ConfigureContactSettingsRequest::default();
2826///
2827/// // You can configure optional parameters by calling the respective setters at will, and
2828/// // execute the final call using `doit()`.
2829/// // Values shown here are possibly random and not representative !
2830/// let result = hub.projects().locations_registrations_configure_contact_settings(req, "registration")
2831/// .doit().await;
2832/// # }
2833/// ```
2834pub struct ProjectLocationRegistrationConfigureContactSettingCall<'a, C>
2835where
2836 C: 'a,
2837{
2838 hub: &'a CloudDomains<C>,
2839 _request: ConfigureContactSettingsRequest,
2840 _registration: String,
2841 _delegate: Option<&'a mut dyn common::Delegate>,
2842 _additional_params: HashMap<String, String>,
2843 _scopes: BTreeSet<String>,
2844}
2845
2846impl<'a, C> common::CallBuilder for ProjectLocationRegistrationConfigureContactSettingCall<'a, C> {}
2847
2848impl<'a, C> ProjectLocationRegistrationConfigureContactSettingCall<'a, C>
2849where
2850 C: common::Connector,
2851{
2852 /// Perform the operation you have build so far.
2853 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2854 use std::borrow::Cow;
2855 use std::io::{Read, Seek};
2856
2857 use common::{url::Params, ToParts};
2858 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2859
2860 let mut dd = common::DefaultDelegate;
2861 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2862 dlg.begin(common::MethodInfo {
2863 id: "domains.projects.locations.registrations.configureContactSettings",
2864 http_method: hyper::Method::POST,
2865 });
2866
2867 for &field in ["alt", "registration"].iter() {
2868 if self._additional_params.contains_key(field) {
2869 dlg.finished(false);
2870 return Err(common::Error::FieldClash(field));
2871 }
2872 }
2873
2874 let mut params = Params::with_capacity(4 + self._additional_params.len());
2875 params.push("registration", self._registration);
2876
2877 params.extend(self._additional_params.iter());
2878
2879 params.push("alt", "json");
2880 let mut url = self.hub._base_url.clone() + "v1/{+registration}:configureContactSettings";
2881 if self._scopes.is_empty() {
2882 self._scopes
2883 .insert(Scope::CloudPlatform.as_ref().to_string());
2884 }
2885
2886 #[allow(clippy::single_element_loop)]
2887 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
2888 url = params.uri_replacement(url, param_name, find_this, true);
2889 }
2890 {
2891 let to_remove = ["registration"];
2892 params.remove_params(&to_remove);
2893 }
2894
2895 let url = params.parse_with_url(&url);
2896
2897 let mut json_mime_type = mime::APPLICATION_JSON;
2898 let mut request_value_reader = {
2899 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2900 common::remove_json_null_values(&mut value);
2901 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2902 serde_json::to_writer(&mut dst, &value).unwrap();
2903 dst
2904 };
2905 let request_size = request_value_reader
2906 .seek(std::io::SeekFrom::End(0))
2907 .unwrap();
2908 request_value_reader
2909 .seek(std::io::SeekFrom::Start(0))
2910 .unwrap();
2911
2912 loop {
2913 let token = match self
2914 .hub
2915 .auth
2916 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2917 .await
2918 {
2919 Ok(token) => token,
2920 Err(e) => match dlg.token(e) {
2921 Ok(token) => token,
2922 Err(e) => {
2923 dlg.finished(false);
2924 return Err(common::Error::MissingToken(e));
2925 }
2926 },
2927 };
2928 request_value_reader
2929 .seek(std::io::SeekFrom::Start(0))
2930 .unwrap();
2931 let mut req_result = {
2932 let client = &self.hub.client;
2933 dlg.pre_request();
2934 let mut req_builder = hyper::Request::builder()
2935 .method(hyper::Method::POST)
2936 .uri(url.as_str())
2937 .header(USER_AGENT, self.hub._user_agent.clone());
2938
2939 if let Some(token) = token.as_ref() {
2940 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2941 }
2942
2943 let request = req_builder
2944 .header(CONTENT_TYPE, json_mime_type.to_string())
2945 .header(CONTENT_LENGTH, request_size as u64)
2946 .body(common::to_body(
2947 request_value_reader.get_ref().clone().into(),
2948 ));
2949
2950 client.request(request.unwrap()).await
2951 };
2952
2953 match req_result {
2954 Err(err) => {
2955 if let common::Retry::After(d) = dlg.http_error(&err) {
2956 sleep(d).await;
2957 continue;
2958 }
2959 dlg.finished(false);
2960 return Err(common::Error::HttpError(err));
2961 }
2962 Ok(res) => {
2963 let (mut parts, body) = res.into_parts();
2964 let mut body = common::Body::new(body);
2965 if !parts.status.is_success() {
2966 let bytes = common::to_bytes(body).await.unwrap_or_default();
2967 let error = serde_json::from_str(&common::to_string(&bytes));
2968 let response = common::to_response(parts, bytes.into());
2969
2970 if let common::Retry::After(d) =
2971 dlg.http_failure(&response, error.as_ref().ok())
2972 {
2973 sleep(d).await;
2974 continue;
2975 }
2976
2977 dlg.finished(false);
2978
2979 return Err(match error {
2980 Ok(value) => common::Error::BadRequest(value),
2981 _ => common::Error::Failure(response),
2982 });
2983 }
2984 let response = {
2985 let bytes = common::to_bytes(body).await.unwrap_or_default();
2986 let encoded = common::to_string(&bytes);
2987 match serde_json::from_str(&encoded) {
2988 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2989 Err(error) => {
2990 dlg.response_json_decode_error(&encoded, &error);
2991 return Err(common::Error::JsonDecodeError(
2992 encoded.to_string(),
2993 error,
2994 ));
2995 }
2996 }
2997 };
2998
2999 dlg.finished(true);
3000 return Ok(response);
3001 }
3002 }
3003 }
3004 }
3005
3006 ///
3007 /// Sets the *request* property to the given value.
3008 ///
3009 /// Even though the property as already been set when instantiating this call,
3010 /// we provide this method for API completeness.
3011 pub fn request(
3012 mut self,
3013 new_value: ConfigureContactSettingsRequest,
3014 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C> {
3015 self._request = new_value;
3016 self
3017 }
3018 /// Required. The name of the `Registration` whose contact settings are being updated, in the format `projects/*/locations/*/registrations/*`.
3019 ///
3020 /// Sets the *registration* path property to the given value.
3021 ///
3022 /// Even though the property as already been set when instantiating this call,
3023 /// we provide this method for API completeness.
3024 pub fn registration(
3025 mut self,
3026 new_value: &str,
3027 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C> {
3028 self._registration = new_value.to_string();
3029 self
3030 }
3031 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3032 /// while executing the actual API request.
3033 ///
3034 /// ````text
3035 /// It should be used to handle progress information, and to implement a certain level of resilience.
3036 /// ````
3037 ///
3038 /// Sets the *delegate* property to the given value.
3039 pub fn delegate(
3040 mut self,
3041 new_value: &'a mut dyn common::Delegate,
3042 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C> {
3043 self._delegate = Some(new_value);
3044 self
3045 }
3046
3047 /// Set any additional parameter of the query string used in the request.
3048 /// It should be used to set parameters which are not yet available through their own
3049 /// setters.
3050 ///
3051 /// Please note that this method must not be used to set any of the known parameters
3052 /// which have their own setter method. If done anyway, the request will fail.
3053 ///
3054 /// # Additional Parameters
3055 ///
3056 /// * *$.xgafv* (query-string) - V1 error format.
3057 /// * *access_token* (query-string) - OAuth access token.
3058 /// * *alt* (query-string) - Data format for response.
3059 /// * *callback* (query-string) - JSONP
3060 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3061 /// * *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.
3062 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3063 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3064 /// * *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.
3065 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3066 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3067 pub fn param<T>(
3068 mut self,
3069 name: T,
3070 value: T,
3071 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C>
3072 where
3073 T: AsRef<str>,
3074 {
3075 self._additional_params
3076 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3077 self
3078 }
3079
3080 /// Identifies the authorization scope for the method you are building.
3081 ///
3082 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3083 /// [`Scope::CloudPlatform`].
3084 ///
3085 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3086 /// tokens for more than one scope.
3087 ///
3088 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3089 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3090 /// sufficient, a read-write scope will do as well.
3091 pub fn add_scope<St>(
3092 mut self,
3093 scope: St,
3094 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C>
3095 where
3096 St: AsRef<str>,
3097 {
3098 self._scopes.insert(String::from(scope.as_ref()));
3099 self
3100 }
3101 /// Identifies the authorization scope(s) for the method you are building.
3102 ///
3103 /// See [`Self::add_scope()`] for details.
3104 pub fn add_scopes<I, St>(
3105 mut self,
3106 scopes: I,
3107 ) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C>
3108 where
3109 I: IntoIterator<Item = St>,
3110 St: AsRef<str>,
3111 {
3112 self._scopes
3113 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3114 self
3115 }
3116
3117 /// Removes all scopes, and no default scope will be used either.
3118 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3119 /// for details).
3120 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationConfigureContactSettingCall<'a, C> {
3121 self._scopes.clear();
3122 self
3123 }
3124}
3125
3126/// Updates a `Registration`'s DNS settings.
3127///
3128/// A builder for the *locations.registrations.configureDnsSettings* method supported by a *project* resource.
3129/// It is not used directly, but through a [`ProjectMethods`] instance.
3130///
3131/// # Example
3132///
3133/// Instantiate a resource method builder
3134///
3135/// ```test_harness,no_run
3136/// # extern crate hyper;
3137/// # extern crate hyper_rustls;
3138/// # extern crate google_domains1 as domains1;
3139/// use domains1::api::ConfigureDnsSettingsRequest;
3140/// # async fn dox() {
3141/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3142///
3143/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3144/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3145/// # .with_native_roots()
3146/// # .unwrap()
3147/// # .https_only()
3148/// # .enable_http2()
3149/// # .build();
3150///
3151/// # let executor = hyper_util::rt::TokioExecutor::new();
3152/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3153/// # secret,
3154/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3155/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3156/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3157/// # ),
3158/// # ).build().await.unwrap();
3159///
3160/// # let client = hyper_util::client::legacy::Client::builder(
3161/// # hyper_util::rt::TokioExecutor::new()
3162/// # )
3163/// # .build(
3164/// # hyper_rustls::HttpsConnectorBuilder::new()
3165/// # .with_native_roots()
3166/// # .unwrap()
3167/// # .https_or_http()
3168/// # .enable_http2()
3169/// # .build()
3170/// # );
3171/// # let mut hub = CloudDomains::new(client, auth);
3172/// // As the method needs a request, you would usually fill it with the desired information
3173/// // into the respective structure. Some of the parts shown here might not be applicable !
3174/// // Values shown here are possibly random and not representative !
3175/// let mut req = ConfigureDnsSettingsRequest::default();
3176///
3177/// // You can configure optional parameters by calling the respective setters at will, and
3178/// // execute the final call using `doit()`.
3179/// // Values shown here are possibly random and not representative !
3180/// let result = hub.projects().locations_registrations_configure_dns_settings(req, "registration")
3181/// .doit().await;
3182/// # }
3183/// ```
3184pub struct ProjectLocationRegistrationConfigureDnsSettingCall<'a, C>
3185where
3186 C: 'a,
3187{
3188 hub: &'a CloudDomains<C>,
3189 _request: ConfigureDnsSettingsRequest,
3190 _registration: String,
3191 _delegate: Option<&'a mut dyn common::Delegate>,
3192 _additional_params: HashMap<String, String>,
3193 _scopes: BTreeSet<String>,
3194}
3195
3196impl<'a, C> common::CallBuilder for ProjectLocationRegistrationConfigureDnsSettingCall<'a, C> {}
3197
3198impl<'a, C> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C>
3199where
3200 C: common::Connector,
3201{
3202 /// Perform the operation you have build so far.
3203 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3204 use std::borrow::Cow;
3205 use std::io::{Read, Seek};
3206
3207 use common::{url::Params, ToParts};
3208 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3209
3210 let mut dd = common::DefaultDelegate;
3211 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3212 dlg.begin(common::MethodInfo {
3213 id: "domains.projects.locations.registrations.configureDnsSettings",
3214 http_method: hyper::Method::POST,
3215 });
3216
3217 for &field in ["alt", "registration"].iter() {
3218 if self._additional_params.contains_key(field) {
3219 dlg.finished(false);
3220 return Err(common::Error::FieldClash(field));
3221 }
3222 }
3223
3224 let mut params = Params::with_capacity(4 + self._additional_params.len());
3225 params.push("registration", self._registration);
3226
3227 params.extend(self._additional_params.iter());
3228
3229 params.push("alt", "json");
3230 let mut url = self.hub._base_url.clone() + "v1/{+registration}:configureDnsSettings";
3231 if self._scopes.is_empty() {
3232 self._scopes
3233 .insert(Scope::CloudPlatform.as_ref().to_string());
3234 }
3235
3236 #[allow(clippy::single_element_loop)]
3237 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
3238 url = params.uri_replacement(url, param_name, find_this, true);
3239 }
3240 {
3241 let to_remove = ["registration"];
3242 params.remove_params(&to_remove);
3243 }
3244
3245 let url = params.parse_with_url(&url);
3246
3247 let mut json_mime_type = mime::APPLICATION_JSON;
3248 let mut request_value_reader = {
3249 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3250 common::remove_json_null_values(&mut value);
3251 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3252 serde_json::to_writer(&mut dst, &value).unwrap();
3253 dst
3254 };
3255 let request_size = request_value_reader
3256 .seek(std::io::SeekFrom::End(0))
3257 .unwrap();
3258 request_value_reader
3259 .seek(std::io::SeekFrom::Start(0))
3260 .unwrap();
3261
3262 loop {
3263 let token = match self
3264 .hub
3265 .auth
3266 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3267 .await
3268 {
3269 Ok(token) => token,
3270 Err(e) => match dlg.token(e) {
3271 Ok(token) => token,
3272 Err(e) => {
3273 dlg.finished(false);
3274 return Err(common::Error::MissingToken(e));
3275 }
3276 },
3277 };
3278 request_value_reader
3279 .seek(std::io::SeekFrom::Start(0))
3280 .unwrap();
3281 let mut req_result = {
3282 let client = &self.hub.client;
3283 dlg.pre_request();
3284 let mut req_builder = hyper::Request::builder()
3285 .method(hyper::Method::POST)
3286 .uri(url.as_str())
3287 .header(USER_AGENT, self.hub._user_agent.clone());
3288
3289 if let Some(token) = token.as_ref() {
3290 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3291 }
3292
3293 let request = req_builder
3294 .header(CONTENT_TYPE, json_mime_type.to_string())
3295 .header(CONTENT_LENGTH, request_size as u64)
3296 .body(common::to_body(
3297 request_value_reader.get_ref().clone().into(),
3298 ));
3299
3300 client.request(request.unwrap()).await
3301 };
3302
3303 match req_result {
3304 Err(err) => {
3305 if let common::Retry::After(d) = dlg.http_error(&err) {
3306 sleep(d).await;
3307 continue;
3308 }
3309 dlg.finished(false);
3310 return Err(common::Error::HttpError(err));
3311 }
3312 Ok(res) => {
3313 let (mut parts, body) = res.into_parts();
3314 let mut body = common::Body::new(body);
3315 if !parts.status.is_success() {
3316 let bytes = common::to_bytes(body).await.unwrap_or_default();
3317 let error = serde_json::from_str(&common::to_string(&bytes));
3318 let response = common::to_response(parts, bytes.into());
3319
3320 if let common::Retry::After(d) =
3321 dlg.http_failure(&response, error.as_ref().ok())
3322 {
3323 sleep(d).await;
3324 continue;
3325 }
3326
3327 dlg.finished(false);
3328
3329 return Err(match error {
3330 Ok(value) => common::Error::BadRequest(value),
3331 _ => common::Error::Failure(response),
3332 });
3333 }
3334 let response = {
3335 let bytes = common::to_bytes(body).await.unwrap_or_default();
3336 let encoded = common::to_string(&bytes);
3337 match serde_json::from_str(&encoded) {
3338 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3339 Err(error) => {
3340 dlg.response_json_decode_error(&encoded, &error);
3341 return Err(common::Error::JsonDecodeError(
3342 encoded.to_string(),
3343 error,
3344 ));
3345 }
3346 }
3347 };
3348
3349 dlg.finished(true);
3350 return Ok(response);
3351 }
3352 }
3353 }
3354 }
3355
3356 ///
3357 /// Sets the *request* property to the given value.
3358 ///
3359 /// Even though the property as already been set when instantiating this call,
3360 /// we provide this method for API completeness.
3361 pub fn request(
3362 mut self,
3363 new_value: ConfigureDnsSettingsRequest,
3364 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C> {
3365 self._request = new_value;
3366 self
3367 }
3368 /// Required. The name of the `Registration` whose DNS settings are being updated, in the format `projects/*/locations/*/registrations/*`.
3369 ///
3370 /// Sets the *registration* path property to the given value.
3371 ///
3372 /// Even though the property as already been set when instantiating this call,
3373 /// we provide this method for API completeness.
3374 pub fn registration(
3375 mut self,
3376 new_value: &str,
3377 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C> {
3378 self._registration = new_value.to_string();
3379 self
3380 }
3381 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3382 /// while executing the actual API request.
3383 ///
3384 /// ````text
3385 /// It should be used to handle progress information, and to implement a certain level of resilience.
3386 /// ````
3387 ///
3388 /// Sets the *delegate* property to the given value.
3389 pub fn delegate(
3390 mut self,
3391 new_value: &'a mut dyn common::Delegate,
3392 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C> {
3393 self._delegate = Some(new_value);
3394 self
3395 }
3396
3397 /// Set any additional parameter of the query string used in the request.
3398 /// It should be used to set parameters which are not yet available through their own
3399 /// setters.
3400 ///
3401 /// Please note that this method must not be used to set any of the known parameters
3402 /// which have their own setter method. If done anyway, the request will fail.
3403 ///
3404 /// # Additional Parameters
3405 ///
3406 /// * *$.xgafv* (query-string) - V1 error format.
3407 /// * *access_token* (query-string) - OAuth access token.
3408 /// * *alt* (query-string) - Data format for response.
3409 /// * *callback* (query-string) - JSONP
3410 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3411 /// * *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.
3412 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3413 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3414 /// * *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.
3415 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3416 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3417 pub fn param<T>(
3418 mut self,
3419 name: T,
3420 value: T,
3421 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C>
3422 where
3423 T: AsRef<str>,
3424 {
3425 self._additional_params
3426 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3427 self
3428 }
3429
3430 /// Identifies the authorization scope for the method you are building.
3431 ///
3432 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3433 /// [`Scope::CloudPlatform`].
3434 ///
3435 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3436 /// tokens for more than one scope.
3437 ///
3438 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3439 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3440 /// sufficient, a read-write scope will do as well.
3441 pub fn add_scope<St>(
3442 mut self,
3443 scope: St,
3444 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C>
3445 where
3446 St: AsRef<str>,
3447 {
3448 self._scopes.insert(String::from(scope.as_ref()));
3449 self
3450 }
3451 /// Identifies the authorization scope(s) for the method you are building.
3452 ///
3453 /// See [`Self::add_scope()`] for details.
3454 pub fn add_scopes<I, St>(
3455 mut self,
3456 scopes: I,
3457 ) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C>
3458 where
3459 I: IntoIterator<Item = St>,
3460 St: AsRef<str>,
3461 {
3462 self._scopes
3463 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3464 self
3465 }
3466
3467 /// Removes all scopes, and no default scope will be used either.
3468 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3469 /// for details).
3470 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationConfigureDnsSettingCall<'a, C> {
3471 self._scopes.clear();
3472 self
3473 }
3474}
3475
3476/// Updates a `Registration`'s management settings.
3477///
3478/// A builder for the *locations.registrations.configureManagementSettings* method supported by a *project* resource.
3479/// It is not used directly, but through a [`ProjectMethods`] instance.
3480///
3481/// # Example
3482///
3483/// Instantiate a resource method builder
3484///
3485/// ```test_harness,no_run
3486/// # extern crate hyper;
3487/// # extern crate hyper_rustls;
3488/// # extern crate google_domains1 as domains1;
3489/// use domains1::api::ConfigureManagementSettingsRequest;
3490/// # async fn dox() {
3491/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3492///
3493/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3494/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3495/// # .with_native_roots()
3496/// # .unwrap()
3497/// # .https_only()
3498/// # .enable_http2()
3499/// # .build();
3500///
3501/// # let executor = hyper_util::rt::TokioExecutor::new();
3502/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3503/// # secret,
3504/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3505/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3506/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3507/// # ),
3508/// # ).build().await.unwrap();
3509///
3510/// # let client = hyper_util::client::legacy::Client::builder(
3511/// # hyper_util::rt::TokioExecutor::new()
3512/// # )
3513/// # .build(
3514/// # hyper_rustls::HttpsConnectorBuilder::new()
3515/// # .with_native_roots()
3516/// # .unwrap()
3517/// # .https_or_http()
3518/// # .enable_http2()
3519/// # .build()
3520/// # );
3521/// # let mut hub = CloudDomains::new(client, auth);
3522/// // As the method needs a request, you would usually fill it with the desired information
3523/// // into the respective structure. Some of the parts shown here might not be applicable !
3524/// // Values shown here are possibly random and not representative !
3525/// let mut req = ConfigureManagementSettingsRequest::default();
3526///
3527/// // You can configure optional parameters by calling the respective setters at will, and
3528/// // execute the final call using `doit()`.
3529/// // Values shown here are possibly random and not representative !
3530/// let result = hub.projects().locations_registrations_configure_management_settings(req, "registration")
3531/// .doit().await;
3532/// # }
3533/// ```
3534pub struct ProjectLocationRegistrationConfigureManagementSettingCall<'a, C>
3535where
3536 C: 'a,
3537{
3538 hub: &'a CloudDomains<C>,
3539 _request: ConfigureManagementSettingsRequest,
3540 _registration: String,
3541 _delegate: Option<&'a mut dyn common::Delegate>,
3542 _additional_params: HashMap<String, String>,
3543 _scopes: BTreeSet<String>,
3544}
3545
3546impl<'a, C> common::CallBuilder
3547 for ProjectLocationRegistrationConfigureManagementSettingCall<'a, C>
3548{
3549}
3550
3551impl<'a, C> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C>
3552where
3553 C: common::Connector,
3554{
3555 /// Perform the operation you have build so far.
3556 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3557 use std::borrow::Cow;
3558 use std::io::{Read, Seek};
3559
3560 use common::{url::Params, ToParts};
3561 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3562
3563 let mut dd = common::DefaultDelegate;
3564 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3565 dlg.begin(common::MethodInfo {
3566 id: "domains.projects.locations.registrations.configureManagementSettings",
3567 http_method: hyper::Method::POST,
3568 });
3569
3570 for &field in ["alt", "registration"].iter() {
3571 if self._additional_params.contains_key(field) {
3572 dlg.finished(false);
3573 return Err(common::Error::FieldClash(field));
3574 }
3575 }
3576
3577 let mut params = Params::with_capacity(4 + self._additional_params.len());
3578 params.push("registration", self._registration);
3579
3580 params.extend(self._additional_params.iter());
3581
3582 params.push("alt", "json");
3583 let mut url = self.hub._base_url.clone() + "v1/{+registration}:configureManagementSettings";
3584 if self._scopes.is_empty() {
3585 self._scopes
3586 .insert(Scope::CloudPlatform.as_ref().to_string());
3587 }
3588
3589 #[allow(clippy::single_element_loop)]
3590 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
3591 url = params.uri_replacement(url, param_name, find_this, true);
3592 }
3593 {
3594 let to_remove = ["registration"];
3595 params.remove_params(&to_remove);
3596 }
3597
3598 let url = params.parse_with_url(&url);
3599
3600 let mut json_mime_type = mime::APPLICATION_JSON;
3601 let mut request_value_reader = {
3602 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3603 common::remove_json_null_values(&mut value);
3604 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3605 serde_json::to_writer(&mut dst, &value).unwrap();
3606 dst
3607 };
3608 let request_size = request_value_reader
3609 .seek(std::io::SeekFrom::End(0))
3610 .unwrap();
3611 request_value_reader
3612 .seek(std::io::SeekFrom::Start(0))
3613 .unwrap();
3614
3615 loop {
3616 let token = match self
3617 .hub
3618 .auth
3619 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3620 .await
3621 {
3622 Ok(token) => token,
3623 Err(e) => match dlg.token(e) {
3624 Ok(token) => token,
3625 Err(e) => {
3626 dlg.finished(false);
3627 return Err(common::Error::MissingToken(e));
3628 }
3629 },
3630 };
3631 request_value_reader
3632 .seek(std::io::SeekFrom::Start(0))
3633 .unwrap();
3634 let mut req_result = {
3635 let client = &self.hub.client;
3636 dlg.pre_request();
3637 let mut req_builder = hyper::Request::builder()
3638 .method(hyper::Method::POST)
3639 .uri(url.as_str())
3640 .header(USER_AGENT, self.hub._user_agent.clone());
3641
3642 if let Some(token) = token.as_ref() {
3643 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3644 }
3645
3646 let request = req_builder
3647 .header(CONTENT_TYPE, json_mime_type.to_string())
3648 .header(CONTENT_LENGTH, request_size as u64)
3649 .body(common::to_body(
3650 request_value_reader.get_ref().clone().into(),
3651 ));
3652
3653 client.request(request.unwrap()).await
3654 };
3655
3656 match req_result {
3657 Err(err) => {
3658 if let common::Retry::After(d) = dlg.http_error(&err) {
3659 sleep(d).await;
3660 continue;
3661 }
3662 dlg.finished(false);
3663 return Err(common::Error::HttpError(err));
3664 }
3665 Ok(res) => {
3666 let (mut parts, body) = res.into_parts();
3667 let mut body = common::Body::new(body);
3668 if !parts.status.is_success() {
3669 let bytes = common::to_bytes(body).await.unwrap_or_default();
3670 let error = serde_json::from_str(&common::to_string(&bytes));
3671 let response = common::to_response(parts, bytes.into());
3672
3673 if let common::Retry::After(d) =
3674 dlg.http_failure(&response, error.as_ref().ok())
3675 {
3676 sleep(d).await;
3677 continue;
3678 }
3679
3680 dlg.finished(false);
3681
3682 return Err(match error {
3683 Ok(value) => common::Error::BadRequest(value),
3684 _ => common::Error::Failure(response),
3685 });
3686 }
3687 let response = {
3688 let bytes = common::to_bytes(body).await.unwrap_or_default();
3689 let encoded = common::to_string(&bytes);
3690 match serde_json::from_str(&encoded) {
3691 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3692 Err(error) => {
3693 dlg.response_json_decode_error(&encoded, &error);
3694 return Err(common::Error::JsonDecodeError(
3695 encoded.to_string(),
3696 error,
3697 ));
3698 }
3699 }
3700 };
3701
3702 dlg.finished(true);
3703 return Ok(response);
3704 }
3705 }
3706 }
3707 }
3708
3709 ///
3710 /// Sets the *request* property to the given value.
3711 ///
3712 /// Even though the property as already been set when instantiating this call,
3713 /// we provide this method for API completeness.
3714 pub fn request(
3715 mut self,
3716 new_value: ConfigureManagementSettingsRequest,
3717 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C> {
3718 self._request = new_value;
3719 self
3720 }
3721 /// Required. The name of the `Registration` whose management settings are being updated, in the format `projects/*/locations/*/registrations/*`.
3722 ///
3723 /// Sets the *registration* path property to the given value.
3724 ///
3725 /// Even though the property as already been set when instantiating this call,
3726 /// we provide this method for API completeness.
3727 pub fn registration(
3728 mut self,
3729 new_value: &str,
3730 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C> {
3731 self._registration = new_value.to_string();
3732 self
3733 }
3734 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3735 /// while executing the actual API request.
3736 ///
3737 /// ````text
3738 /// It should be used to handle progress information, and to implement a certain level of resilience.
3739 /// ````
3740 ///
3741 /// Sets the *delegate* property to the given value.
3742 pub fn delegate(
3743 mut self,
3744 new_value: &'a mut dyn common::Delegate,
3745 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C> {
3746 self._delegate = Some(new_value);
3747 self
3748 }
3749
3750 /// Set any additional parameter of the query string used in the request.
3751 /// It should be used to set parameters which are not yet available through their own
3752 /// setters.
3753 ///
3754 /// Please note that this method must not be used to set any of the known parameters
3755 /// which have their own setter method. If done anyway, the request will fail.
3756 ///
3757 /// # Additional Parameters
3758 ///
3759 /// * *$.xgafv* (query-string) - V1 error format.
3760 /// * *access_token* (query-string) - OAuth access token.
3761 /// * *alt* (query-string) - Data format for response.
3762 /// * *callback* (query-string) - JSONP
3763 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3764 /// * *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.
3765 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3766 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3767 /// * *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.
3768 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3769 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3770 pub fn param<T>(
3771 mut self,
3772 name: T,
3773 value: T,
3774 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C>
3775 where
3776 T: AsRef<str>,
3777 {
3778 self._additional_params
3779 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3780 self
3781 }
3782
3783 /// Identifies the authorization scope for the method you are building.
3784 ///
3785 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3786 /// [`Scope::CloudPlatform`].
3787 ///
3788 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3789 /// tokens for more than one scope.
3790 ///
3791 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3792 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3793 /// sufficient, a read-write scope will do as well.
3794 pub fn add_scope<St>(
3795 mut self,
3796 scope: St,
3797 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C>
3798 where
3799 St: AsRef<str>,
3800 {
3801 self._scopes.insert(String::from(scope.as_ref()));
3802 self
3803 }
3804 /// Identifies the authorization scope(s) for the method you are building.
3805 ///
3806 /// See [`Self::add_scope()`] for details.
3807 pub fn add_scopes<I, St>(
3808 mut self,
3809 scopes: I,
3810 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C>
3811 where
3812 I: IntoIterator<Item = St>,
3813 St: AsRef<str>,
3814 {
3815 self._scopes
3816 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3817 self
3818 }
3819
3820 /// Removes all scopes, and no default scope will be used either.
3821 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3822 /// for details).
3823 pub fn clear_scopes(
3824 mut self,
3825 ) -> ProjectLocationRegistrationConfigureManagementSettingCall<'a, C> {
3826 self._scopes.clear();
3827 self
3828 }
3829}
3830
3831/// Deletes a `Registration` resource. This method works on any `Registration` resource using [Subscription or Commitment billing](https://cloud.google.com/domains/pricing#billing-models), provided that the resource was created at least 1 day in the past. When an active registration is successfully deleted, you can continue to use the domain in [Google Domains](https://domains.google/) until it expires. The calling user becomes the domain’s sole owner in Google Domains, and permissions for the domain are subsequently managed there. The domain does not renew automatically unless the new owner sets up billing in Google Domains. After January 2024 you will only be able to delete `Registration` resources when `state` is one of: `EXPORTED`, `EXPIRED`,`REGISTRATION_FAILED` or `TRANSFER_FAILED`. See [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) for more details.
3832///
3833/// A builder for the *locations.registrations.delete* method supported by a *project* resource.
3834/// It is not used directly, but through a [`ProjectMethods`] instance.
3835///
3836/// # Example
3837///
3838/// Instantiate a resource method builder
3839///
3840/// ```test_harness,no_run
3841/// # extern crate hyper;
3842/// # extern crate hyper_rustls;
3843/// # extern crate google_domains1 as domains1;
3844/// # async fn dox() {
3845/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3846///
3847/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3848/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3849/// # .with_native_roots()
3850/// # .unwrap()
3851/// # .https_only()
3852/// # .enable_http2()
3853/// # .build();
3854///
3855/// # let executor = hyper_util::rt::TokioExecutor::new();
3856/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3857/// # secret,
3858/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3859/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3860/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3861/// # ),
3862/// # ).build().await.unwrap();
3863///
3864/// # let client = hyper_util::client::legacy::Client::builder(
3865/// # hyper_util::rt::TokioExecutor::new()
3866/// # )
3867/// # .build(
3868/// # hyper_rustls::HttpsConnectorBuilder::new()
3869/// # .with_native_roots()
3870/// # .unwrap()
3871/// # .https_or_http()
3872/// # .enable_http2()
3873/// # .build()
3874/// # );
3875/// # let mut hub = CloudDomains::new(client, auth);
3876/// // You can configure optional parameters by calling the respective setters at will, and
3877/// // execute the final call using `doit()`.
3878/// // Values shown here are possibly random and not representative !
3879/// let result = hub.projects().locations_registrations_delete("name")
3880/// .doit().await;
3881/// # }
3882/// ```
3883pub struct ProjectLocationRegistrationDeleteCall<'a, C>
3884where
3885 C: 'a,
3886{
3887 hub: &'a CloudDomains<C>,
3888 _name: String,
3889 _delegate: Option<&'a mut dyn common::Delegate>,
3890 _additional_params: HashMap<String, String>,
3891 _scopes: BTreeSet<String>,
3892}
3893
3894impl<'a, C> common::CallBuilder for ProjectLocationRegistrationDeleteCall<'a, C> {}
3895
3896impl<'a, C> ProjectLocationRegistrationDeleteCall<'a, C>
3897where
3898 C: common::Connector,
3899{
3900 /// Perform the operation you have build so far.
3901 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3902 use std::borrow::Cow;
3903 use std::io::{Read, Seek};
3904
3905 use common::{url::Params, ToParts};
3906 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3907
3908 let mut dd = common::DefaultDelegate;
3909 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3910 dlg.begin(common::MethodInfo {
3911 id: "domains.projects.locations.registrations.delete",
3912 http_method: hyper::Method::DELETE,
3913 });
3914
3915 for &field in ["alt", "name"].iter() {
3916 if self._additional_params.contains_key(field) {
3917 dlg.finished(false);
3918 return Err(common::Error::FieldClash(field));
3919 }
3920 }
3921
3922 let mut params = Params::with_capacity(3 + self._additional_params.len());
3923 params.push("name", self._name);
3924
3925 params.extend(self._additional_params.iter());
3926
3927 params.push("alt", "json");
3928 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3929 if self._scopes.is_empty() {
3930 self._scopes
3931 .insert(Scope::CloudPlatform.as_ref().to_string());
3932 }
3933
3934 #[allow(clippy::single_element_loop)]
3935 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3936 url = params.uri_replacement(url, param_name, find_this, true);
3937 }
3938 {
3939 let to_remove = ["name"];
3940 params.remove_params(&to_remove);
3941 }
3942
3943 let url = params.parse_with_url(&url);
3944
3945 loop {
3946 let token = match self
3947 .hub
3948 .auth
3949 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3950 .await
3951 {
3952 Ok(token) => token,
3953 Err(e) => match dlg.token(e) {
3954 Ok(token) => token,
3955 Err(e) => {
3956 dlg.finished(false);
3957 return Err(common::Error::MissingToken(e));
3958 }
3959 },
3960 };
3961 let mut req_result = {
3962 let client = &self.hub.client;
3963 dlg.pre_request();
3964 let mut req_builder = hyper::Request::builder()
3965 .method(hyper::Method::DELETE)
3966 .uri(url.as_str())
3967 .header(USER_AGENT, self.hub._user_agent.clone());
3968
3969 if let Some(token) = token.as_ref() {
3970 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3971 }
3972
3973 let request = req_builder
3974 .header(CONTENT_LENGTH, 0_u64)
3975 .body(common::to_body::<String>(None));
3976
3977 client.request(request.unwrap()).await
3978 };
3979
3980 match req_result {
3981 Err(err) => {
3982 if let common::Retry::After(d) = dlg.http_error(&err) {
3983 sleep(d).await;
3984 continue;
3985 }
3986 dlg.finished(false);
3987 return Err(common::Error::HttpError(err));
3988 }
3989 Ok(res) => {
3990 let (mut parts, body) = res.into_parts();
3991 let mut body = common::Body::new(body);
3992 if !parts.status.is_success() {
3993 let bytes = common::to_bytes(body).await.unwrap_or_default();
3994 let error = serde_json::from_str(&common::to_string(&bytes));
3995 let response = common::to_response(parts, bytes.into());
3996
3997 if let common::Retry::After(d) =
3998 dlg.http_failure(&response, error.as_ref().ok())
3999 {
4000 sleep(d).await;
4001 continue;
4002 }
4003
4004 dlg.finished(false);
4005
4006 return Err(match error {
4007 Ok(value) => common::Error::BadRequest(value),
4008 _ => common::Error::Failure(response),
4009 });
4010 }
4011 let response = {
4012 let bytes = common::to_bytes(body).await.unwrap_or_default();
4013 let encoded = common::to_string(&bytes);
4014 match serde_json::from_str(&encoded) {
4015 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4016 Err(error) => {
4017 dlg.response_json_decode_error(&encoded, &error);
4018 return Err(common::Error::JsonDecodeError(
4019 encoded.to_string(),
4020 error,
4021 ));
4022 }
4023 }
4024 };
4025
4026 dlg.finished(true);
4027 return Ok(response);
4028 }
4029 }
4030 }
4031 }
4032
4033 /// Required. The name of the `Registration` to delete, in the format `projects/*/locations/*/registrations/*`.
4034 ///
4035 /// Sets the *name* path property to the given value.
4036 ///
4037 /// Even though the property as already been set when instantiating this call,
4038 /// we provide this method for API completeness.
4039 pub fn name(mut self, new_value: &str) -> ProjectLocationRegistrationDeleteCall<'a, C> {
4040 self._name = new_value.to_string();
4041 self
4042 }
4043 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4044 /// while executing the actual API request.
4045 ///
4046 /// ````text
4047 /// It should be used to handle progress information, and to implement a certain level of resilience.
4048 /// ````
4049 ///
4050 /// Sets the *delegate* property to the given value.
4051 pub fn delegate(
4052 mut self,
4053 new_value: &'a mut dyn common::Delegate,
4054 ) -> ProjectLocationRegistrationDeleteCall<'a, C> {
4055 self._delegate = Some(new_value);
4056 self
4057 }
4058
4059 /// Set any additional parameter of the query string used in the request.
4060 /// It should be used to set parameters which are not yet available through their own
4061 /// setters.
4062 ///
4063 /// Please note that this method must not be used to set any of the known parameters
4064 /// which have their own setter method. If done anyway, the request will fail.
4065 ///
4066 /// # Additional Parameters
4067 ///
4068 /// * *$.xgafv* (query-string) - V1 error format.
4069 /// * *access_token* (query-string) - OAuth access token.
4070 /// * *alt* (query-string) - Data format for response.
4071 /// * *callback* (query-string) - JSONP
4072 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4073 /// * *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.
4074 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4075 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4076 /// * *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.
4077 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4078 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4079 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationDeleteCall<'a, C>
4080 where
4081 T: AsRef<str>,
4082 {
4083 self._additional_params
4084 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4085 self
4086 }
4087
4088 /// Identifies the authorization scope for the method you are building.
4089 ///
4090 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4091 /// [`Scope::CloudPlatform`].
4092 ///
4093 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4094 /// tokens for more than one scope.
4095 ///
4096 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4097 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4098 /// sufficient, a read-write scope will do as well.
4099 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationDeleteCall<'a, C>
4100 where
4101 St: AsRef<str>,
4102 {
4103 self._scopes.insert(String::from(scope.as_ref()));
4104 self
4105 }
4106 /// Identifies the authorization scope(s) for the method you are building.
4107 ///
4108 /// See [`Self::add_scope()`] for details.
4109 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationDeleteCall<'a, C>
4110 where
4111 I: IntoIterator<Item = St>,
4112 St: AsRef<str>,
4113 {
4114 self._scopes
4115 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4116 self
4117 }
4118
4119 /// Removes all scopes, and no default scope will be used either.
4120 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4121 /// for details).
4122 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationDeleteCall<'a, C> {
4123 self._scopes.clear();
4124 self
4125 }
4126}
4127
4128/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Exports a `Registration` resource, such that it is no longer managed by Cloud Domains. When an active domain is successfully exported, you can continue to use the domain in [Google Domains](https://domains.google/) until it expires. The calling user becomes the domain's sole owner in Google Domains, and permissions for the domain are subsequently managed there. The domain does not renew automatically unless the new owner sets up billing in Google Domains.
4129///
4130/// A builder for the *locations.registrations.export* method supported by a *project* resource.
4131/// It is not used directly, but through a [`ProjectMethods`] instance.
4132///
4133/// # Example
4134///
4135/// Instantiate a resource method builder
4136///
4137/// ```test_harness,no_run
4138/// # extern crate hyper;
4139/// # extern crate hyper_rustls;
4140/// # extern crate google_domains1 as domains1;
4141/// use domains1::api::ExportRegistrationRequest;
4142/// # async fn dox() {
4143/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4144///
4145/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4146/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4147/// # .with_native_roots()
4148/// # .unwrap()
4149/// # .https_only()
4150/// # .enable_http2()
4151/// # .build();
4152///
4153/// # let executor = hyper_util::rt::TokioExecutor::new();
4154/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4155/// # secret,
4156/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4157/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4158/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4159/// # ),
4160/// # ).build().await.unwrap();
4161///
4162/// # let client = hyper_util::client::legacy::Client::builder(
4163/// # hyper_util::rt::TokioExecutor::new()
4164/// # )
4165/// # .build(
4166/// # hyper_rustls::HttpsConnectorBuilder::new()
4167/// # .with_native_roots()
4168/// # .unwrap()
4169/// # .https_or_http()
4170/// # .enable_http2()
4171/// # .build()
4172/// # );
4173/// # let mut hub = CloudDomains::new(client, auth);
4174/// // As the method needs a request, you would usually fill it with the desired information
4175/// // into the respective structure. Some of the parts shown here might not be applicable !
4176/// // Values shown here are possibly random and not representative !
4177/// let mut req = ExportRegistrationRequest::default();
4178///
4179/// // You can configure optional parameters by calling the respective setters at will, and
4180/// // execute the final call using `doit()`.
4181/// // Values shown here are possibly random and not representative !
4182/// let result = hub.projects().locations_registrations_export(req, "name")
4183/// .doit().await;
4184/// # }
4185/// ```
4186pub struct ProjectLocationRegistrationExportCall<'a, C>
4187where
4188 C: 'a,
4189{
4190 hub: &'a CloudDomains<C>,
4191 _request: ExportRegistrationRequest,
4192 _name: String,
4193 _delegate: Option<&'a mut dyn common::Delegate>,
4194 _additional_params: HashMap<String, String>,
4195 _scopes: BTreeSet<String>,
4196}
4197
4198impl<'a, C> common::CallBuilder for ProjectLocationRegistrationExportCall<'a, C> {}
4199
4200impl<'a, C> ProjectLocationRegistrationExportCall<'a, C>
4201where
4202 C: common::Connector,
4203{
4204 /// Perform the operation you have build so far.
4205 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4206 use std::borrow::Cow;
4207 use std::io::{Read, Seek};
4208
4209 use common::{url::Params, ToParts};
4210 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4211
4212 let mut dd = common::DefaultDelegate;
4213 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4214 dlg.begin(common::MethodInfo {
4215 id: "domains.projects.locations.registrations.export",
4216 http_method: hyper::Method::POST,
4217 });
4218
4219 for &field in ["alt", "name"].iter() {
4220 if self._additional_params.contains_key(field) {
4221 dlg.finished(false);
4222 return Err(common::Error::FieldClash(field));
4223 }
4224 }
4225
4226 let mut params = Params::with_capacity(4 + self._additional_params.len());
4227 params.push("name", self._name);
4228
4229 params.extend(self._additional_params.iter());
4230
4231 params.push("alt", "json");
4232 let mut url = self.hub._base_url.clone() + "v1/{+name}:export";
4233 if self._scopes.is_empty() {
4234 self._scopes
4235 .insert(Scope::CloudPlatform.as_ref().to_string());
4236 }
4237
4238 #[allow(clippy::single_element_loop)]
4239 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4240 url = params.uri_replacement(url, param_name, find_this, true);
4241 }
4242 {
4243 let to_remove = ["name"];
4244 params.remove_params(&to_remove);
4245 }
4246
4247 let url = params.parse_with_url(&url);
4248
4249 let mut json_mime_type = mime::APPLICATION_JSON;
4250 let mut request_value_reader = {
4251 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4252 common::remove_json_null_values(&mut value);
4253 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4254 serde_json::to_writer(&mut dst, &value).unwrap();
4255 dst
4256 };
4257 let request_size = request_value_reader
4258 .seek(std::io::SeekFrom::End(0))
4259 .unwrap();
4260 request_value_reader
4261 .seek(std::io::SeekFrom::Start(0))
4262 .unwrap();
4263
4264 loop {
4265 let token = match self
4266 .hub
4267 .auth
4268 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4269 .await
4270 {
4271 Ok(token) => token,
4272 Err(e) => match dlg.token(e) {
4273 Ok(token) => token,
4274 Err(e) => {
4275 dlg.finished(false);
4276 return Err(common::Error::MissingToken(e));
4277 }
4278 },
4279 };
4280 request_value_reader
4281 .seek(std::io::SeekFrom::Start(0))
4282 .unwrap();
4283 let mut req_result = {
4284 let client = &self.hub.client;
4285 dlg.pre_request();
4286 let mut req_builder = hyper::Request::builder()
4287 .method(hyper::Method::POST)
4288 .uri(url.as_str())
4289 .header(USER_AGENT, self.hub._user_agent.clone());
4290
4291 if let Some(token) = token.as_ref() {
4292 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4293 }
4294
4295 let request = req_builder
4296 .header(CONTENT_TYPE, json_mime_type.to_string())
4297 .header(CONTENT_LENGTH, request_size as u64)
4298 .body(common::to_body(
4299 request_value_reader.get_ref().clone().into(),
4300 ));
4301
4302 client.request(request.unwrap()).await
4303 };
4304
4305 match req_result {
4306 Err(err) => {
4307 if let common::Retry::After(d) = dlg.http_error(&err) {
4308 sleep(d).await;
4309 continue;
4310 }
4311 dlg.finished(false);
4312 return Err(common::Error::HttpError(err));
4313 }
4314 Ok(res) => {
4315 let (mut parts, body) = res.into_parts();
4316 let mut body = common::Body::new(body);
4317 if !parts.status.is_success() {
4318 let bytes = common::to_bytes(body).await.unwrap_or_default();
4319 let error = serde_json::from_str(&common::to_string(&bytes));
4320 let response = common::to_response(parts, bytes.into());
4321
4322 if let common::Retry::After(d) =
4323 dlg.http_failure(&response, error.as_ref().ok())
4324 {
4325 sleep(d).await;
4326 continue;
4327 }
4328
4329 dlg.finished(false);
4330
4331 return Err(match error {
4332 Ok(value) => common::Error::BadRequest(value),
4333 _ => common::Error::Failure(response),
4334 });
4335 }
4336 let response = {
4337 let bytes = common::to_bytes(body).await.unwrap_or_default();
4338 let encoded = common::to_string(&bytes);
4339 match serde_json::from_str(&encoded) {
4340 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4341 Err(error) => {
4342 dlg.response_json_decode_error(&encoded, &error);
4343 return Err(common::Error::JsonDecodeError(
4344 encoded.to_string(),
4345 error,
4346 ));
4347 }
4348 }
4349 };
4350
4351 dlg.finished(true);
4352 return Ok(response);
4353 }
4354 }
4355 }
4356 }
4357
4358 ///
4359 /// Sets the *request* property to the given value.
4360 ///
4361 /// Even though the property as already been set when instantiating this call,
4362 /// we provide this method for API completeness.
4363 pub fn request(
4364 mut self,
4365 new_value: ExportRegistrationRequest,
4366 ) -> ProjectLocationRegistrationExportCall<'a, C> {
4367 self._request = new_value;
4368 self
4369 }
4370 /// Required. The name of the `Registration` to export, in the format `projects/*/locations/*/registrations/*`.
4371 ///
4372 /// Sets the *name* path property to the given value.
4373 ///
4374 /// Even though the property as already been set when instantiating this call,
4375 /// we provide this method for API completeness.
4376 pub fn name(mut self, new_value: &str) -> ProjectLocationRegistrationExportCall<'a, C> {
4377 self._name = new_value.to_string();
4378 self
4379 }
4380 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4381 /// while executing the actual API request.
4382 ///
4383 /// ````text
4384 /// It should be used to handle progress information, and to implement a certain level of resilience.
4385 /// ````
4386 ///
4387 /// Sets the *delegate* property to the given value.
4388 pub fn delegate(
4389 mut self,
4390 new_value: &'a mut dyn common::Delegate,
4391 ) -> ProjectLocationRegistrationExportCall<'a, C> {
4392 self._delegate = Some(new_value);
4393 self
4394 }
4395
4396 /// Set any additional parameter of the query string used in the request.
4397 /// It should be used to set parameters which are not yet available through their own
4398 /// setters.
4399 ///
4400 /// Please note that this method must not be used to set any of the known parameters
4401 /// which have their own setter method. If done anyway, the request will fail.
4402 ///
4403 /// # Additional Parameters
4404 ///
4405 /// * *$.xgafv* (query-string) - V1 error format.
4406 /// * *access_token* (query-string) - OAuth access token.
4407 /// * *alt* (query-string) - Data format for response.
4408 /// * *callback* (query-string) - JSONP
4409 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4410 /// * *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.
4411 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4412 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4413 /// * *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.
4414 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4415 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4416 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationExportCall<'a, C>
4417 where
4418 T: AsRef<str>,
4419 {
4420 self._additional_params
4421 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4422 self
4423 }
4424
4425 /// Identifies the authorization scope for the method you are building.
4426 ///
4427 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4428 /// [`Scope::CloudPlatform`].
4429 ///
4430 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4431 /// tokens for more than one scope.
4432 ///
4433 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4434 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4435 /// sufficient, a read-write scope will do as well.
4436 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationExportCall<'a, C>
4437 where
4438 St: AsRef<str>,
4439 {
4440 self._scopes.insert(String::from(scope.as_ref()));
4441 self
4442 }
4443 /// Identifies the authorization scope(s) for the method you are building.
4444 ///
4445 /// See [`Self::add_scope()`] for details.
4446 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationExportCall<'a, C>
4447 where
4448 I: IntoIterator<Item = St>,
4449 St: AsRef<str>,
4450 {
4451 self._scopes
4452 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4453 self
4454 }
4455
4456 /// Removes all scopes, and no default scope will be used either.
4457 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4458 /// for details).
4459 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationExportCall<'a, C> {
4460 self._scopes.clear();
4461 self
4462 }
4463}
4464
4465/// Gets the details of a `Registration` resource.
4466///
4467/// A builder for the *locations.registrations.get* method supported by a *project* resource.
4468/// It is not used directly, but through a [`ProjectMethods`] instance.
4469///
4470/// # Example
4471///
4472/// Instantiate a resource method builder
4473///
4474/// ```test_harness,no_run
4475/// # extern crate hyper;
4476/// # extern crate hyper_rustls;
4477/// # extern crate google_domains1 as domains1;
4478/// # async fn dox() {
4479/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4480///
4481/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4482/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4483/// # .with_native_roots()
4484/// # .unwrap()
4485/// # .https_only()
4486/// # .enable_http2()
4487/// # .build();
4488///
4489/// # let executor = hyper_util::rt::TokioExecutor::new();
4490/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4491/// # secret,
4492/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4493/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4494/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4495/// # ),
4496/// # ).build().await.unwrap();
4497///
4498/// # let client = hyper_util::client::legacy::Client::builder(
4499/// # hyper_util::rt::TokioExecutor::new()
4500/// # )
4501/// # .build(
4502/// # hyper_rustls::HttpsConnectorBuilder::new()
4503/// # .with_native_roots()
4504/// # .unwrap()
4505/// # .https_or_http()
4506/// # .enable_http2()
4507/// # .build()
4508/// # );
4509/// # let mut hub = CloudDomains::new(client, auth);
4510/// // You can configure optional parameters by calling the respective setters at will, and
4511/// // execute the final call using `doit()`.
4512/// // Values shown here are possibly random and not representative !
4513/// let result = hub.projects().locations_registrations_get("name")
4514/// .doit().await;
4515/// # }
4516/// ```
4517pub struct ProjectLocationRegistrationGetCall<'a, C>
4518where
4519 C: 'a,
4520{
4521 hub: &'a CloudDomains<C>,
4522 _name: String,
4523 _delegate: Option<&'a mut dyn common::Delegate>,
4524 _additional_params: HashMap<String, String>,
4525 _scopes: BTreeSet<String>,
4526}
4527
4528impl<'a, C> common::CallBuilder for ProjectLocationRegistrationGetCall<'a, C> {}
4529
4530impl<'a, C> ProjectLocationRegistrationGetCall<'a, C>
4531where
4532 C: common::Connector,
4533{
4534 /// Perform the operation you have build so far.
4535 pub async fn doit(mut self) -> common::Result<(common::Response, Registration)> {
4536 use std::borrow::Cow;
4537 use std::io::{Read, Seek};
4538
4539 use common::{url::Params, ToParts};
4540 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4541
4542 let mut dd = common::DefaultDelegate;
4543 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4544 dlg.begin(common::MethodInfo {
4545 id: "domains.projects.locations.registrations.get",
4546 http_method: hyper::Method::GET,
4547 });
4548
4549 for &field in ["alt", "name"].iter() {
4550 if self._additional_params.contains_key(field) {
4551 dlg.finished(false);
4552 return Err(common::Error::FieldClash(field));
4553 }
4554 }
4555
4556 let mut params = Params::with_capacity(3 + self._additional_params.len());
4557 params.push("name", self._name);
4558
4559 params.extend(self._additional_params.iter());
4560
4561 params.push("alt", "json");
4562 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4563 if self._scopes.is_empty() {
4564 self._scopes
4565 .insert(Scope::CloudPlatform.as_ref().to_string());
4566 }
4567
4568 #[allow(clippy::single_element_loop)]
4569 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4570 url = params.uri_replacement(url, param_name, find_this, true);
4571 }
4572 {
4573 let to_remove = ["name"];
4574 params.remove_params(&to_remove);
4575 }
4576
4577 let url = params.parse_with_url(&url);
4578
4579 loop {
4580 let token = match self
4581 .hub
4582 .auth
4583 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4584 .await
4585 {
4586 Ok(token) => token,
4587 Err(e) => match dlg.token(e) {
4588 Ok(token) => token,
4589 Err(e) => {
4590 dlg.finished(false);
4591 return Err(common::Error::MissingToken(e));
4592 }
4593 },
4594 };
4595 let mut req_result = {
4596 let client = &self.hub.client;
4597 dlg.pre_request();
4598 let mut req_builder = hyper::Request::builder()
4599 .method(hyper::Method::GET)
4600 .uri(url.as_str())
4601 .header(USER_AGENT, self.hub._user_agent.clone());
4602
4603 if let Some(token) = token.as_ref() {
4604 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4605 }
4606
4607 let request = req_builder
4608 .header(CONTENT_LENGTH, 0_u64)
4609 .body(common::to_body::<String>(None));
4610
4611 client.request(request.unwrap()).await
4612 };
4613
4614 match req_result {
4615 Err(err) => {
4616 if let common::Retry::After(d) = dlg.http_error(&err) {
4617 sleep(d).await;
4618 continue;
4619 }
4620 dlg.finished(false);
4621 return Err(common::Error::HttpError(err));
4622 }
4623 Ok(res) => {
4624 let (mut parts, body) = res.into_parts();
4625 let mut body = common::Body::new(body);
4626 if !parts.status.is_success() {
4627 let bytes = common::to_bytes(body).await.unwrap_or_default();
4628 let error = serde_json::from_str(&common::to_string(&bytes));
4629 let response = common::to_response(parts, bytes.into());
4630
4631 if let common::Retry::After(d) =
4632 dlg.http_failure(&response, error.as_ref().ok())
4633 {
4634 sleep(d).await;
4635 continue;
4636 }
4637
4638 dlg.finished(false);
4639
4640 return Err(match error {
4641 Ok(value) => common::Error::BadRequest(value),
4642 _ => common::Error::Failure(response),
4643 });
4644 }
4645 let response = {
4646 let bytes = common::to_bytes(body).await.unwrap_or_default();
4647 let encoded = common::to_string(&bytes);
4648 match serde_json::from_str(&encoded) {
4649 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4650 Err(error) => {
4651 dlg.response_json_decode_error(&encoded, &error);
4652 return Err(common::Error::JsonDecodeError(
4653 encoded.to_string(),
4654 error,
4655 ));
4656 }
4657 }
4658 };
4659
4660 dlg.finished(true);
4661 return Ok(response);
4662 }
4663 }
4664 }
4665 }
4666
4667 /// Required. The name of the `Registration` to get, in the format `projects/*/locations/*/registrations/*`.
4668 ///
4669 /// Sets the *name* path property to the given value.
4670 ///
4671 /// Even though the property as already been set when instantiating this call,
4672 /// we provide this method for API completeness.
4673 pub fn name(mut self, new_value: &str) -> ProjectLocationRegistrationGetCall<'a, C> {
4674 self._name = new_value.to_string();
4675 self
4676 }
4677 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4678 /// while executing the actual API request.
4679 ///
4680 /// ````text
4681 /// It should be used to handle progress information, and to implement a certain level of resilience.
4682 /// ````
4683 ///
4684 /// Sets the *delegate* property to the given value.
4685 pub fn delegate(
4686 mut self,
4687 new_value: &'a mut dyn common::Delegate,
4688 ) -> ProjectLocationRegistrationGetCall<'a, C> {
4689 self._delegate = Some(new_value);
4690 self
4691 }
4692
4693 /// Set any additional parameter of the query string used in the request.
4694 /// It should be used to set parameters which are not yet available through their own
4695 /// setters.
4696 ///
4697 /// Please note that this method must not be used to set any of the known parameters
4698 /// which have their own setter method. If done anyway, the request will fail.
4699 ///
4700 /// # Additional Parameters
4701 ///
4702 /// * *$.xgafv* (query-string) - V1 error format.
4703 /// * *access_token* (query-string) - OAuth access token.
4704 /// * *alt* (query-string) - Data format for response.
4705 /// * *callback* (query-string) - JSONP
4706 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4707 /// * *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.
4708 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4709 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4710 /// * *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.
4711 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4712 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4713 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationGetCall<'a, C>
4714 where
4715 T: AsRef<str>,
4716 {
4717 self._additional_params
4718 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4719 self
4720 }
4721
4722 /// Identifies the authorization scope for the method you are building.
4723 ///
4724 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4725 /// [`Scope::CloudPlatform`].
4726 ///
4727 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4728 /// tokens for more than one scope.
4729 ///
4730 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4731 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4732 /// sufficient, a read-write scope will do as well.
4733 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationGetCall<'a, C>
4734 where
4735 St: AsRef<str>,
4736 {
4737 self._scopes.insert(String::from(scope.as_ref()));
4738 self
4739 }
4740 /// Identifies the authorization scope(s) for the method you are building.
4741 ///
4742 /// See [`Self::add_scope()`] for details.
4743 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationGetCall<'a, C>
4744 where
4745 I: IntoIterator<Item = St>,
4746 St: AsRef<str>,
4747 {
4748 self._scopes
4749 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4750 self
4751 }
4752
4753 /// Removes all scopes, and no default scope will be used either.
4754 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4755 /// for details).
4756 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationGetCall<'a, C> {
4757 self._scopes.clear();
4758 self
4759 }
4760}
4761
4762/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4763///
4764/// A builder for the *locations.registrations.getIamPolicy* method supported by a *project* resource.
4765/// It is not used directly, but through a [`ProjectMethods`] instance.
4766///
4767/// # Example
4768///
4769/// Instantiate a resource method builder
4770///
4771/// ```test_harness,no_run
4772/// # extern crate hyper;
4773/// # extern crate hyper_rustls;
4774/// # extern crate google_domains1 as domains1;
4775/// # async fn dox() {
4776/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4777///
4778/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4779/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4780/// # .with_native_roots()
4781/// # .unwrap()
4782/// # .https_only()
4783/// # .enable_http2()
4784/// # .build();
4785///
4786/// # let executor = hyper_util::rt::TokioExecutor::new();
4787/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4788/// # secret,
4789/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4790/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4791/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4792/// # ),
4793/// # ).build().await.unwrap();
4794///
4795/// # let client = hyper_util::client::legacy::Client::builder(
4796/// # hyper_util::rt::TokioExecutor::new()
4797/// # )
4798/// # .build(
4799/// # hyper_rustls::HttpsConnectorBuilder::new()
4800/// # .with_native_roots()
4801/// # .unwrap()
4802/// # .https_or_http()
4803/// # .enable_http2()
4804/// # .build()
4805/// # );
4806/// # let mut hub = CloudDomains::new(client, auth);
4807/// // You can configure optional parameters by calling the respective setters at will, and
4808/// // execute the final call using `doit()`.
4809/// // Values shown here are possibly random and not representative !
4810/// let result = hub.projects().locations_registrations_get_iam_policy("resource")
4811/// .options_requested_policy_version(-12)
4812/// .doit().await;
4813/// # }
4814/// ```
4815pub struct ProjectLocationRegistrationGetIamPolicyCall<'a, C>
4816where
4817 C: 'a,
4818{
4819 hub: &'a CloudDomains<C>,
4820 _resource: String,
4821 _options_requested_policy_version: Option<i32>,
4822 _delegate: Option<&'a mut dyn common::Delegate>,
4823 _additional_params: HashMap<String, String>,
4824 _scopes: BTreeSet<String>,
4825}
4826
4827impl<'a, C> common::CallBuilder for ProjectLocationRegistrationGetIamPolicyCall<'a, C> {}
4828
4829impl<'a, C> ProjectLocationRegistrationGetIamPolicyCall<'a, C>
4830where
4831 C: common::Connector,
4832{
4833 /// Perform the operation you have build so far.
4834 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4835 use std::borrow::Cow;
4836 use std::io::{Read, Seek};
4837
4838 use common::{url::Params, ToParts};
4839 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4840
4841 let mut dd = common::DefaultDelegate;
4842 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4843 dlg.begin(common::MethodInfo {
4844 id: "domains.projects.locations.registrations.getIamPolicy",
4845 http_method: hyper::Method::GET,
4846 });
4847
4848 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
4849 if self._additional_params.contains_key(field) {
4850 dlg.finished(false);
4851 return Err(common::Error::FieldClash(field));
4852 }
4853 }
4854
4855 let mut params = Params::with_capacity(4 + self._additional_params.len());
4856 params.push("resource", self._resource);
4857 if let Some(value) = self._options_requested_policy_version.as_ref() {
4858 params.push("options.requestedPolicyVersion", value.to_string());
4859 }
4860
4861 params.extend(self._additional_params.iter());
4862
4863 params.push("alt", "json");
4864 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
4865 if self._scopes.is_empty() {
4866 self._scopes
4867 .insert(Scope::CloudPlatform.as_ref().to_string());
4868 }
4869
4870 #[allow(clippy::single_element_loop)]
4871 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
4872 url = params.uri_replacement(url, param_name, find_this, true);
4873 }
4874 {
4875 let to_remove = ["resource"];
4876 params.remove_params(&to_remove);
4877 }
4878
4879 let url = params.parse_with_url(&url);
4880
4881 loop {
4882 let token = match self
4883 .hub
4884 .auth
4885 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4886 .await
4887 {
4888 Ok(token) => token,
4889 Err(e) => match dlg.token(e) {
4890 Ok(token) => token,
4891 Err(e) => {
4892 dlg.finished(false);
4893 return Err(common::Error::MissingToken(e));
4894 }
4895 },
4896 };
4897 let mut req_result = {
4898 let client = &self.hub.client;
4899 dlg.pre_request();
4900 let mut req_builder = hyper::Request::builder()
4901 .method(hyper::Method::GET)
4902 .uri(url.as_str())
4903 .header(USER_AGENT, self.hub._user_agent.clone());
4904
4905 if let Some(token) = token.as_ref() {
4906 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4907 }
4908
4909 let request = req_builder
4910 .header(CONTENT_LENGTH, 0_u64)
4911 .body(common::to_body::<String>(None));
4912
4913 client.request(request.unwrap()).await
4914 };
4915
4916 match req_result {
4917 Err(err) => {
4918 if let common::Retry::After(d) = dlg.http_error(&err) {
4919 sleep(d).await;
4920 continue;
4921 }
4922 dlg.finished(false);
4923 return Err(common::Error::HttpError(err));
4924 }
4925 Ok(res) => {
4926 let (mut parts, body) = res.into_parts();
4927 let mut body = common::Body::new(body);
4928 if !parts.status.is_success() {
4929 let bytes = common::to_bytes(body).await.unwrap_or_default();
4930 let error = serde_json::from_str(&common::to_string(&bytes));
4931 let response = common::to_response(parts, bytes.into());
4932
4933 if let common::Retry::After(d) =
4934 dlg.http_failure(&response, error.as_ref().ok())
4935 {
4936 sleep(d).await;
4937 continue;
4938 }
4939
4940 dlg.finished(false);
4941
4942 return Err(match error {
4943 Ok(value) => common::Error::BadRequest(value),
4944 _ => common::Error::Failure(response),
4945 });
4946 }
4947 let response = {
4948 let bytes = common::to_bytes(body).await.unwrap_or_default();
4949 let encoded = common::to_string(&bytes);
4950 match serde_json::from_str(&encoded) {
4951 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4952 Err(error) => {
4953 dlg.response_json_decode_error(&encoded, &error);
4954 return Err(common::Error::JsonDecodeError(
4955 encoded.to_string(),
4956 error,
4957 ));
4958 }
4959 }
4960 };
4961
4962 dlg.finished(true);
4963 return Ok(response);
4964 }
4965 }
4966 }
4967 }
4968
4969 /// 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.
4970 ///
4971 /// Sets the *resource* path property to the given value.
4972 ///
4973 /// Even though the property as already been set when instantiating this call,
4974 /// we provide this method for API completeness.
4975 pub fn resource(
4976 mut self,
4977 new_value: &str,
4978 ) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C> {
4979 self._resource = new_value.to_string();
4980 self
4981 }
4982 /// 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).
4983 ///
4984 /// Sets the *options.requested policy version* query property to the given value.
4985 pub fn options_requested_policy_version(
4986 mut self,
4987 new_value: i32,
4988 ) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C> {
4989 self._options_requested_policy_version = Some(new_value);
4990 self
4991 }
4992 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4993 /// while executing the actual API request.
4994 ///
4995 /// ````text
4996 /// It should be used to handle progress information, and to implement a certain level of resilience.
4997 /// ````
4998 ///
4999 /// Sets the *delegate* property to the given value.
5000 pub fn delegate(
5001 mut self,
5002 new_value: &'a mut dyn common::Delegate,
5003 ) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C> {
5004 self._delegate = Some(new_value);
5005 self
5006 }
5007
5008 /// Set any additional parameter of the query string used in the request.
5009 /// It should be used to set parameters which are not yet available through their own
5010 /// setters.
5011 ///
5012 /// Please note that this method must not be used to set any of the known parameters
5013 /// which have their own setter method. If done anyway, the request will fail.
5014 ///
5015 /// # Additional Parameters
5016 ///
5017 /// * *$.xgafv* (query-string) - V1 error format.
5018 /// * *access_token* (query-string) - OAuth access token.
5019 /// * *alt* (query-string) - Data format for response.
5020 /// * *callback* (query-string) - JSONP
5021 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5022 /// * *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.
5023 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5024 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5025 /// * *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.
5026 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5027 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5028 pub fn param<T>(
5029 mut self,
5030 name: T,
5031 value: T,
5032 ) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C>
5033 where
5034 T: AsRef<str>,
5035 {
5036 self._additional_params
5037 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5038 self
5039 }
5040
5041 /// Identifies the authorization scope for the method you are building.
5042 ///
5043 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5044 /// [`Scope::CloudPlatform`].
5045 ///
5046 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5047 /// tokens for more than one scope.
5048 ///
5049 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5050 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5051 /// sufficient, a read-write scope will do as well.
5052 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C>
5053 where
5054 St: AsRef<str>,
5055 {
5056 self._scopes.insert(String::from(scope.as_ref()));
5057 self
5058 }
5059 /// Identifies the authorization scope(s) for the method you are building.
5060 ///
5061 /// See [`Self::add_scope()`] for details.
5062 pub fn add_scopes<I, St>(
5063 mut self,
5064 scopes: I,
5065 ) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C>
5066 where
5067 I: IntoIterator<Item = St>,
5068 St: AsRef<str>,
5069 {
5070 self._scopes
5071 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5072 self
5073 }
5074
5075 /// Removes all scopes, and no default scope will be used either.
5076 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5077 /// for details).
5078 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationGetIamPolicyCall<'a, C> {
5079 self._scopes.clear();
5080 self
5081 }
5082}
5083
5084/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Imports a domain name from [Google Domains](https://domains.google/) for use in Cloud Domains. To transfer a domain from another registrar, use the `TransferDomain` method instead. Since individual users can own domains in Google Domains, the calling user must have ownership permission on the domain.
5085///
5086/// A builder for the *locations.registrations.import* method supported by a *project* resource.
5087/// It is not used directly, but through a [`ProjectMethods`] instance.
5088///
5089/// # Example
5090///
5091/// Instantiate a resource method builder
5092///
5093/// ```test_harness,no_run
5094/// # extern crate hyper;
5095/// # extern crate hyper_rustls;
5096/// # extern crate google_domains1 as domains1;
5097/// use domains1::api::ImportDomainRequest;
5098/// # async fn dox() {
5099/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5100///
5101/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5102/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5103/// # .with_native_roots()
5104/// # .unwrap()
5105/// # .https_only()
5106/// # .enable_http2()
5107/// # .build();
5108///
5109/// # let executor = hyper_util::rt::TokioExecutor::new();
5110/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5111/// # secret,
5112/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5113/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5114/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5115/// # ),
5116/// # ).build().await.unwrap();
5117///
5118/// # let client = hyper_util::client::legacy::Client::builder(
5119/// # hyper_util::rt::TokioExecutor::new()
5120/// # )
5121/// # .build(
5122/// # hyper_rustls::HttpsConnectorBuilder::new()
5123/// # .with_native_roots()
5124/// # .unwrap()
5125/// # .https_or_http()
5126/// # .enable_http2()
5127/// # .build()
5128/// # );
5129/// # let mut hub = CloudDomains::new(client, auth);
5130/// // As the method needs a request, you would usually fill it with the desired information
5131/// // into the respective structure. Some of the parts shown here might not be applicable !
5132/// // Values shown here are possibly random and not representative !
5133/// let mut req = ImportDomainRequest::default();
5134///
5135/// // You can configure optional parameters by calling the respective setters at will, and
5136/// // execute the final call using `doit()`.
5137/// // Values shown here are possibly random and not representative !
5138/// let result = hub.projects().locations_registrations_import(req, "parent")
5139/// .doit().await;
5140/// # }
5141/// ```
5142pub struct ProjectLocationRegistrationImportCall<'a, C>
5143where
5144 C: 'a,
5145{
5146 hub: &'a CloudDomains<C>,
5147 _request: ImportDomainRequest,
5148 _parent: String,
5149 _delegate: Option<&'a mut dyn common::Delegate>,
5150 _additional_params: HashMap<String, String>,
5151 _scopes: BTreeSet<String>,
5152}
5153
5154impl<'a, C> common::CallBuilder for ProjectLocationRegistrationImportCall<'a, C> {}
5155
5156impl<'a, C> ProjectLocationRegistrationImportCall<'a, C>
5157where
5158 C: common::Connector,
5159{
5160 /// Perform the operation you have build so far.
5161 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5162 use std::borrow::Cow;
5163 use std::io::{Read, Seek};
5164
5165 use common::{url::Params, ToParts};
5166 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5167
5168 let mut dd = common::DefaultDelegate;
5169 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5170 dlg.begin(common::MethodInfo {
5171 id: "domains.projects.locations.registrations.import",
5172 http_method: hyper::Method::POST,
5173 });
5174
5175 for &field in ["alt", "parent"].iter() {
5176 if self._additional_params.contains_key(field) {
5177 dlg.finished(false);
5178 return Err(common::Error::FieldClash(field));
5179 }
5180 }
5181
5182 let mut params = Params::with_capacity(4 + self._additional_params.len());
5183 params.push("parent", self._parent);
5184
5185 params.extend(self._additional_params.iter());
5186
5187 params.push("alt", "json");
5188 let mut url = self.hub._base_url.clone() + "v1/{+parent}/registrations:import";
5189 if self._scopes.is_empty() {
5190 self._scopes
5191 .insert(Scope::CloudPlatform.as_ref().to_string());
5192 }
5193
5194 #[allow(clippy::single_element_loop)]
5195 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5196 url = params.uri_replacement(url, param_name, find_this, true);
5197 }
5198 {
5199 let to_remove = ["parent"];
5200 params.remove_params(&to_remove);
5201 }
5202
5203 let url = params.parse_with_url(&url);
5204
5205 let mut json_mime_type = mime::APPLICATION_JSON;
5206 let mut request_value_reader = {
5207 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5208 common::remove_json_null_values(&mut value);
5209 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5210 serde_json::to_writer(&mut dst, &value).unwrap();
5211 dst
5212 };
5213 let request_size = request_value_reader
5214 .seek(std::io::SeekFrom::End(0))
5215 .unwrap();
5216 request_value_reader
5217 .seek(std::io::SeekFrom::Start(0))
5218 .unwrap();
5219
5220 loop {
5221 let token = match self
5222 .hub
5223 .auth
5224 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5225 .await
5226 {
5227 Ok(token) => token,
5228 Err(e) => match dlg.token(e) {
5229 Ok(token) => token,
5230 Err(e) => {
5231 dlg.finished(false);
5232 return Err(common::Error::MissingToken(e));
5233 }
5234 },
5235 };
5236 request_value_reader
5237 .seek(std::io::SeekFrom::Start(0))
5238 .unwrap();
5239 let mut req_result = {
5240 let client = &self.hub.client;
5241 dlg.pre_request();
5242 let mut req_builder = hyper::Request::builder()
5243 .method(hyper::Method::POST)
5244 .uri(url.as_str())
5245 .header(USER_AGENT, self.hub._user_agent.clone());
5246
5247 if let Some(token) = token.as_ref() {
5248 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5249 }
5250
5251 let request = req_builder
5252 .header(CONTENT_TYPE, json_mime_type.to_string())
5253 .header(CONTENT_LENGTH, request_size as u64)
5254 .body(common::to_body(
5255 request_value_reader.get_ref().clone().into(),
5256 ));
5257
5258 client.request(request.unwrap()).await
5259 };
5260
5261 match req_result {
5262 Err(err) => {
5263 if let common::Retry::After(d) = dlg.http_error(&err) {
5264 sleep(d).await;
5265 continue;
5266 }
5267 dlg.finished(false);
5268 return Err(common::Error::HttpError(err));
5269 }
5270 Ok(res) => {
5271 let (mut parts, body) = res.into_parts();
5272 let mut body = common::Body::new(body);
5273 if !parts.status.is_success() {
5274 let bytes = common::to_bytes(body).await.unwrap_or_default();
5275 let error = serde_json::from_str(&common::to_string(&bytes));
5276 let response = common::to_response(parts, bytes.into());
5277
5278 if let common::Retry::After(d) =
5279 dlg.http_failure(&response, error.as_ref().ok())
5280 {
5281 sleep(d).await;
5282 continue;
5283 }
5284
5285 dlg.finished(false);
5286
5287 return Err(match error {
5288 Ok(value) => common::Error::BadRequest(value),
5289 _ => common::Error::Failure(response),
5290 });
5291 }
5292 let response = {
5293 let bytes = common::to_bytes(body).await.unwrap_or_default();
5294 let encoded = common::to_string(&bytes);
5295 match serde_json::from_str(&encoded) {
5296 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5297 Err(error) => {
5298 dlg.response_json_decode_error(&encoded, &error);
5299 return Err(common::Error::JsonDecodeError(
5300 encoded.to_string(),
5301 error,
5302 ));
5303 }
5304 }
5305 };
5306
5307 dlg.finished(true);
5308 return Ok(response);
5309 }
5310 }
5311 }
5312 }
5313
5314 ///
5315 /// Sets the *request* property to the given value.
5316 ///
5317 /// Even though the property as already been set when instantiating this call,
5318 /// we provide this method for API completeness.
5319 pub fn request(
5320 mut self,
5321 new_value: ImportDomainRequest,
5322 ) -> ProjectLocationRegistrationImportCall<'a, C> {
5323 self._request = new_value;
5324 self
5325 }
5326 /// Required. The parent resource of the Registration. Must be in the format `projects/*/locations/*`.
5327 ///
5328 /// Sets the *parent* path property to the given value.
5329 ///
5330 /// Even though the property as already been set when instantiating this call,
5331 /// we provide this method for API completeness.
5332 pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistrationImportCall<'a, C> {
5333 self._parent = new_value.to_string();
5334 self
5335 }
5336 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5337 /// while executing the actual API request.
5338 ///
5339 /// ````text
5340 /// It should be used to handle progress information, and to implement a certain level of resilience.
5341 /// ````
5342 ///
5343 /// Sets the *delegate* property to the given value.
5344 pub fn delegate(
5345 mut self,
5346 new_value: &'a mut dyn common::Delegate,
5347 ) -> ProjectLocationRegistrationImportCall<'a, C> {
5348 self._delegate = Some(new_value);
5349 self
5350 }
5351
5352 /// Set any additional parameter of the query string used in the request.
5353 /// It should be used to set parameters which are not yet available through their own
5354 /// setters.
5355 ///
5356 /// Please note that this method must not be used to set any of the known parameters
5357 /// which have their own setter method. If done anyway, the request will fail.
5358 ///
5359 /// # Additional Parameters
5360 ///
5361 /// * *$.xgafv* (query-string) - V1 error format.
5362 /// * *access_token* (query-string) - OAuth access token.
5363 /// * *alt* (query-string) - Data format for response.
5364 /// * *callback* (query-string) - JSONP
5365 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5366 /// * *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.
5367 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5368 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5369 /// * *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.
5370 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5371 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5372 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationImportCall<'a, C>
5373 where
5374 T: AsRef<str>,
5375 {
5376 self._additional_params
5377 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5378 self
5379 }
5380
5381 /// Identifies the authorization scope for the method you are building.
5382 ///
5383 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5384 /// [`Scope::CloudPlatform`].
5385 ///
5386 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5387 /// tokens for more than one scope.
5388 ///
5389 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5390 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5391 /// sufficient, a read-write scope will do as well.
5392 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationImportCall<'a, C>
5393 where
5394 St: AsRef<str>,
5395 {
5396 self._scopes.insert(String::from(scope.as_ref()));
5397 self
5398 }
5399 /// Identifies the authorization scope(s) for the method you are building.
5400 ///
5401 /// See [`Self::add_scope()`] for details.
5402 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationImportCall<'a, C>
5403 where
5404 I: IntoIterator<Item = St>,
5405 St: AsRef<str>,
5406 {
5407 self._scopes
5408 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5409 self
5410 }
5411
5412 /// Removes all scopes, and no default scope will be used either.
5413 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5414 /// for details).
5415 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationImportCall<'a, C> {
5416 self._scopes.clear();
5417 self
5418 }
5419}
5420
5421/// Initiates the `Push Transfer` process to transfer the domain to another registrar. The process might complete instantly or might require confirmation or additional work. Check the emails sent to the email address of the registrant. The process is aborted after a timeout if it's not completed. This method is only supported for domains that have the `REQUIRE_PUSH_TRANSFER` property in the list of `domain_properties`. The domain must also be unlocked before it can be transferred to a different registrar. For more information, see [Transfer a registered domain to another registrar](https://cloud.google.com/domains/docs/transfer-domain-to-another-registrar).
5422///
5423/// A builder for the *locations.registrations.initiatePushTransfer* method supported by a *project* resource.
5424/// It is not used directly, but through a [`ProjectMethods`] instance.
5425///
5426/// # Example
5427///
5428/// Instantiate a resource method builder
5429///
5430/// ```test_harness,no_run
5431/// # extern crate hyper;
5432/// # extern crate hyper_rustls;
5433/// # extern crate google_domains1 as domains1;
5434/// use domains1::api::InitiatePushTransferRequest;
5435/// # async fn dox() {
5436/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5437///
5438/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5439/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5440/// # .with_native_roots()
5441/// # .unwrap()
5442/// # .https_only()
5443/// # .enable_http2()
5444/// # .build();
5445///
5446/// # let executor = hyper_util::rt::TokioExecutor::new();
5447/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5448/// # secret,
5449/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5450/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5451/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5452/// # ),
5453/// # ).build().await.unwrap();
5454///
5455/// # let client = hyper_util::client::legacy::Client::builder(
5456/// # hyper_util::rt::TokioExecutor::new()
5457/// # )
5458/// # .build(
5459/// # hyper_rustls::HttpsConnectorBuilder::new()
5460/// # .with_native_roots()
5461/// # .unwrap()
5462/// # .https_or_http()
5463/// # .enable_http2()
5464/// # .build()
5465/// # );
5466/// # let mut hub = CloudDomains::new(client, auth);
5467/// // As the method needs a request, you would usually fill it with the desired information
5468/// // into the respective structure. Some of the parts shown here might not be applicable !
5469/// // Values shown here are possibly random and not representative !
5470/// let mut req = InitiatePushTransferRequest::default();
5471///
5472/// // You can configure optional parameters by calling the respective setters at will, and
5473/// // execute the final call using `doit()`.
5474/// // Values shown here are possibly random and not representative !
5475/// let result = hub.projects().locations_registrations_initiate_push_transfer(req, "registration")
5476/// .doit().await;
5477/// # }
5478/// ```
5479pub struct ProjectLocationRegistrationInitiatePushTransferCall<'a, C>
5480where
5481 C: 'a,
5482{
5483 hub: &'a CloudDomains<C>,
5484 _request: InitiatePushTransferRequest,
5485 _registration: String,
5486 _delegate: Option<&'a mut dyn common::Delegate>,
5487 _additional_params: HashMap<String, String>,
5488 _scopes: BTreeSet<String>,
5489}
5490
5491impl<'a, C> common::CallBuilder for ProjectLocationRegistrationInitiatePushTransferCall<'a, C> {}
5492
5493impl<'a, C> ProjectLocationRegistrationInitiatePushTransferCall<'a, C>
5494where
5495 C: common::Connector,
5496{
5497 /// Perform the operation you have build so far.
5498 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5499 use std::borrow::Cow;
5500 use std::io::{Read, Seek};
5501
5502 use common::{url::Params, ToParts};
5503 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5504
5505 let mut dd = common::DefaultDelegate;
5506 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5507 dlg.begin(common::MethodInfo {
5508 id: "domains.projects.locations.registrations.initiatePushTransfer",
5509 http_method: hyper::Method::POST,
5510 });
5511
5512 for &field in ["alt", "registration"].iter() {
5513 if self._additional_params.contains_key(field) {
5514 dlg.finished(false);
5515 return Err(common::Error::FieldClash(field));
5516 }
5517 }
5518
5519 let mut params = Params::with_capacity(4 + self._additional_params.len());
5520 params.push("registration", self._registration);
5521
5522 params.extend(self._additional_params.iter());
5523
5524 params.push("alt", "json");
5525 let mut url = self.hub._base_url.clone() + "v1/{+registration}:initiatePushTransfer";
5526 if self._scopes.is_empty() {
5527 self._scopes
5528 .insert(Scope::CloudPlatform.as_ref().to_string());
5529 }
5530
5531 #[allow(clippy::single_element_loop)]
5532 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
5533 url = params.uri_replacement(url, param_name, find_this, true);
5534 }
5535 {
5536 let to_remove = ["registration"];
5537 params.remove_params(&to_remove);
5538 }
5539
5540 let url = params.parse_with_url(&url);
5541
5542 let mut json_mime_type = mime::APPLICATION_JSON;
5543 let mut request_value_reader = {
5544 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5545 common::remove_json_null_values(&mut value);
5546 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5547 serde_json::to_writer(&mut dst, &value).unwrap();
5548 dst
5549 };
5550 let request_size = request_value_reader
5551 .seek(std::io::SeekFrom::End(0))
5552 .unwrap();
5553 request_value_reader
5554 .seek(std::io::SeekFrom::Start(0))
5555 .unwrap();
5556
5557 loop {
5558 let token = match self
5559 .hub
5560 .auth
5561 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5562 .await
5563 {
5564 Ok(token) => token,
5565 Err(e) => match dlg.token(e) {
5566 Ok(token) => token,
5567 Err(e) => {
5568 dlg.finished(false);
5569 return Err(common::Error::MissingToken(e));
5570 }
5571 },
5572 };
5573 request_value_reader
5574 .seek(std::io::SeekFrom::Start(0))
5575 .unwrap();
5576 let mut req_result = {
5577 let client = &self.hub.client;
5578 dlg.pre_request();
5579 let mut req_builder = hyper::Request::builder()
5580 .method(hyper::Method::POST)
5581 .uri(url.as_str())
5582 .header(USER_AGENT, self.hub._user_agent.clone());
5583
5584 if let Some(token) = token.as_ref() {
5585 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5586 }
5587
5588 let request = req_builder
5589 .header(CONTENT_TYPE, json_mime_type.to_string())
5590 .header(CONTENT_LENGTH, request_size as u64)
5591 .body(common::to_body(
5592 request_value_reader.get_ref().clone().into(),
5593 ));
5594
5595 client.request(request.unwrap()).await
5596 };
5597
5598 match req_result {
5599 Err(err) => {
5600 if let common::Retry::After(d) = dlg.http_error(&err) {
5601 sleep(d).await;
5602 continue;
5603 }
5604 dlg.finished(false);
5605 return Err(common::Error::HttpError(err));
5606 }
5607 Ok(res) => {
5608 let (mut parts, body) = res.into_parts();
5609 let mut body = common::Body::new(body);
5610 if !parts.status.is_success() {
5611 let bytes = common::to_bytes(body).await.unwrap_or_default();
5612 let error = serde_json::from_str(&common::to_string(&bytes));
5613 let response = common::to_response(parts, bytes.into());
5614
5615 if let common::Retry::After(d) =
5616 dlg.http_failure(&response, error.as_ref().ok())
5617 {
5618 sleep(d).await;
5619 continue;
5620 }
5621
5622 dlg.finished(false);
5623
5624 return Err(match error {
5625 Ok(value) => common::Error::BadRequest(value),
5626 _ => common::Error::Failure(response),
5627 });
5628 }
5629 let response = {
5630 let bytes = common::to_bytes(body).await.unwrap_or_default();
5631 let encoded = common::to_string(&bytes);
5632 match serde_json::from_str(&encoded) {
5633 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5634 Err(error) => {
5635 dlg.response_json_decode_error(&encoded, &error);
5636 return Err(common::Error::JsonDecodeError(
5637 encoded.to_string(),
5638 error,
5639 ));
5640 }
5641 }
5642 };
5643
5644 dlg.finished(true);
5645 return Ok(response);
5646 }
5647 }
5648 }
5649 }
5650
5651 ///
5652 /// Sets the *request* property to the given value.
5653 ///
5654 /// Even though the property as already been set when instantiating this call,
5655 /// we provide this method for API completeness.
5656 pub fn request(
5657 mut self,
5658 new_value: InitiatePushTransferRequest,
5659 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C> {
5660 self._request = new_value;
5661 self
5662 }
5663 /// Required. The name of the `Registration` for which the push transfer is initiated, in the format `projects/*/locations/*/registrations/*`.
5664 ///
5665 /// Sets the *registration* path property to the given value.
5666 ///
5667 /// Even though the property as already been set when instantiating this call,
5668 /// we provide this method for API completeness.
5669 pub fn registration(
5670 mut self,
5671 new_value: &str,
5672 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C> {
5673 self._registration = new_value.to_string();
5674 self
5675 }
5676 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5677 /// while executing the actual API request.
5678 ///
5679 /// ````text
5680 /// It should be used to handle progress information, and to implement a certain level of resilience.
5681 /// ````
5682 ///
5683 /// Sets the *delegate* property to the given value.
5684 pub fn delegate(
5685 mut self,
5686 new_value: &'a mut dyn common::Delegate,
5687 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C> {
5688 self._delegate = Some(new_value);
5689 self
5690 }
5691
5692 /// Set any additional parameter of the query string used in the request.
5693 /// It should be used to set parameters which are not yet available through their own
5694 /// setters.
5695 ///
5696 /// Please note that this method must not be used to set any of the known parameters
5697 /// which have their own setter method. If done anyway, the request will fail.
5698 ///
5699 /// # Additional Parameters
5700 ///
5701 /// * *$.xgafv* (query-string) - V1 error format.
5702 /// * *access_token* (query-string) - OAuth access token.
5703 /// * *alt* (query-string) - Data format for response.
5704 /// * *callback* (query-string) - JSONP
5705 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5706 /// * *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.
5707 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5708 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5709 /// * *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.
5710 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5711 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5712 pub fn param<T>(
5713 mut self,
5714 name: T,
5715 value: T,
5716 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C>
5717 where
5718 T: AsRef<str>,
5719 {
5720 self._additional_params
5721 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5722 self
5723 }
5724
5725 /// Identifies the authorization scope for the method you are building.
5726 ///
5727 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5728 /// [`Scope::CloudPlatform`].
5729 ///
5730 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5731 /// tokens for more than one scope.
5732 ///
5733 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5734 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5735 /// sufficient, a read-write scope will do as well.
5736 pub fn add_scope<St>(
5737 mut self,
5738 scope: St,
5739 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C>
5740 where
5741 St: AsRef<str>,
5742 {
5743 self._scopes.insert(String::from(scope.as_ref()));
5744 self
5745 }
5746 /// Identifies the authorization scope(s) for the method you are building.
5747 ///
5748 /// See [`Self::add_scope()`] for details.
5749 pub fn add_scopes<I, St>(
5750 mut self,
5751 scopes: I,
5752 ) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C>
5753 where
5754 I: IntoIterator<Item = St>,
5755 St: AsRef<str>,
5756 {
5757 self._scopes
5758 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5759 self
5760 }
5761
5762 /// Removes all scopes, and no default scope will be used either.
5763 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5764 /// for details).
5765 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationInitiatePushTransferCall<'a, C> {
5766 self._scopes.clear();
5767 self
5768 }
5769}
5770
5771/// Lists the `Registration` resources in a project.
5772///
5773/// A builder for the *locations.registrations.list* method supported by a *project* resource.
5774/// It is not used directly, but through a [`ProjectMethods`] instance.
5775///
5776/// # Example
5777///
5778/// Instantiate a resource method builder
5779///
5780/// ```test_harness,no_run
5781/// # extern crate hyper;
5782/// # extern crate hyper_rustls;
5783/// # extern crate google_domains1 as domains1;
5784/// # async fn dox() {
5785/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5786///
5787/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5788/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5789/// # .with_native_roots()
5790/// # .unwrap()
5791/// # .https_only()
5792/// # .enable_http2()
5793/// # .build();
5794///
5795/// # let executor = hyper_util::rt::TokioExecutor::new();
5796/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5797/// # secret,
5798/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5799/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5800/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5801/// # ),
5802/// # ).build().await.unwrap();
5803///
5804/// # let client = hyper_util::client::legacy::Client::builder(
5805/// # hyper_util::rt::TokioExecutor::new()
5806/// # )
5807/// # .build(
5808/// # hyper_rustls::HttpsConnectorBuilder::new()
5809/// # .with_native_roots()
5810/// # .unwrap()
5811/// # .https_or_http()
5812/// # .enable_http2()
5813/// # .build()
5814/// # );
5815/// # let mut hub = CloudDomains::new(client, auth);
5816/// // You can configure optional parameters by calling the respective setters at will, and
5817/// // execute the final call using `doit()`.
5818/// // Values shown here are possibly random and not representative !
5819/// let result = hub.projects().locations_registrations_list("parent")
5820/// .page_token("ipsum")
5821/// .page_size(-88)
5822/// .filter("amet")
5823/// .doit().await;
5824/// # }
5825/// ```
5826pub struct ProjectLocationRegistrationListCall<'a, C>
5827where
5828 C: 'a,
5829{
5830 hub: &'a CloudDomains<C>,
5831 _parent: String,
5832 _page_token: Option<String>,
5833 _page_size: Option<i32>,
5834 _filter: Option<String>,
5835 _delegate: Option<&'a mut dyn common::Delegate>,
5836 _additional_params: HashMap<String, String>,
5837 _scopes: BTreeSet<String>,
5838}
5839
5840impl<'a, C> common::CallBuilder for ProjectLocationRegistrationListCall<'a, C> {}
5841
5842impl<'a, C> ProjectLocationRegistrationListCall<'a, C>
5843where
5844 C: common::Connector,
5845{
5846 /// Perform the operation you have build so far.
5847 pub async fn doit(mut self) -> common::Result<(common::Response, ListRegistrationsResponse)> {
5848 use std::borrow::Cow;
5849 use std::io::{Read, Seek};
5850
5851 use common::{url::Params, ToParts};
5852 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5853
5854 let mut dd = common::DefaultDelegate;
5855 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5856 dlg.begin(common::MethodInfo {
5857 id: "domains.projects.locations.registrations.list",
5858 http_method: hyper::Method::GET,
5859 });
5860
5861 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
5862 if self._additional_params.contains_key(field) {
5863 dlg.finished(false);
5864 return Err(common::Error::FieldClash(field));
5865 }
5866 }
5867
5868 let mut params = Params::with_capacity(6 + self._additional_params.len());
5869 params.push("parent", self._parent);
5870 if let Some(value) = self._page_token.as_ref() {
5871 params.push("pageToken", value);
5872 }
5873 if let Some(value) = self._page_size.as_ref() {
5874 params.push("pageSize", value.to_string());
5875 }
5876 if let Some(value) = self._filter.as_ref() {
5877 params.push("filter", value);
5878 }
5879
5880 params.extend(self._additional_params.iter());
5881
5882 params.push("alt", "json");
5883 let mut url = self.hub._base_url.clone() + "v1/{+parent}/registrations";
5884 if self._scopes.is_empty() {
5885 self._scopes
5886 .insert(Scope::CloudPlatform.as_ref().to_string());
5887 }
5888
5889 #[allow(clippy::single_element_loop)]
5890 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5891 url = params.uri_replacement(url, param_name, find_this, true);
5892 }
5893 {
5894 let to_remove = ["parent"];
5895 params.remove_params(&to_remove);
5896 }
5897
5898 let url = params.parse_with_url(&url);
5899
5900 loop {
5901 let token = match self
5902 .hub
5903 .auth
5904 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5905 .await
5906 {
5907 Ok(token) => token,
5908 Err(e) => match dlg.token(e) {
5909 Ok(token) => token,
5910 Err(e) => {
5911 dlg.finished(false);
5912 return Err(common::Error::MissingToken(e));
5913 }
5914 },
5915 };
5916 let mut req_result = {
5917 let client = &self.hub.client;
5918 dlg.pre_request();
5919 let mut req_builder = hyper::Request::builder()
5920 .method(hyper::Method::GET)
5921 .uri(url.as_str())
5922 .header(USER_AGENT, self.hub._user_agent.clone());
5923
5924 if let Some(token) = token.as_ref() {
5925 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5926 }
5927
5928 let request = req_builder
5929 .header(CONTENT_LENGTH, 0_u64)
5930 .body(common::to_body::<String>(None));
5931
5932 client.request(request.unwrap()).await
5933 };
5934
5935 match req_result {
5936 Err(err) => {
5937 if let common::Retry::After(d) = dlg.http_error(&err) {
5938 sleep(d).await;
5939 continue;
5940 }
5941 dlg.finished(false);
5942 return Err(common::Error::HttpError(err));
5943 }
5944 Ok(res) => {
5945 let (mut parts, body) = res.into_parts();
5946 let mut body = common::Body::new(body);
5947 if !parts.status.is_success() {
5948 let bytes = common::to_bytes(body).await.unwrap_or_default();
5949 let error = serde_json::from_str(&common::to_string(&bytes));
5950 let response = common::to_response(parts, bytes.into());
5951
5952 if let common::Retry::After(d) =
5953 dlg.http_failure(&response, error.as_ref().ok())
5954 {
5955 sleep(d).await;
5956 continue;
5957 }
5958
5959 dlg.finished(false);
5960
5961 return Err(match error {
5962 Ok(value) => common::Error::BadRequest(value),
5963 _ => common::Error::Failure(response),
5964 });
5965 }
5966 let response = {
5967 let bytes = common::to_bytes(body).await.unwrap_or_default();
5968 let encoded = common::to_string(&bytes);
5969 match serde_json::from_str(&encoded) {
5970 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5971 Err(error) => {
5972 dlg.response_json_decode_error(&encoded, &error);
5973 return Err(common::Error::JsonDecodeError(
5974 encoded.to_string(),
5975 error,
5976 ));
5977 }
5978 }
5979 };
5980
5981 dlg.finished(true);
5982 return Ok(response);
5983 }
5984 }
5985 }
5986 }
5987
5988 /// Required. The project and location from which to list `Registration`s, specified in the format `projects/*/locations/*`.
5989 ///
5990 /// Sets the *parent* path property to the given value.
5991 ///
5992 /// Even though the property as already been set when instantiating this call,
5993 /// we provide this method for API completeness.
5994 pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistrationListCall<'a, C> {
5995 self._parent = new_value.to_string();
5996 self
5997 }
5998 /// When set to the `next_page_token` from a prior response, provides the next page of results.
5999 ///
6000 /// Sets the *page token* query property to the given value.
6001 pub fn page_token(mut self, new_value: &str) -> ProjectLocationRegistrationListCall<'a, C> {
6002 self._page_token = Some(new_value.to_string());
6003 self
6004 }
6005 /// Maximum number of results to return.
6006 ///
6007 /// Sets the *page size* query property to the given value.
6008 pub fn page_size(mut self, new_value: i32) -> ProjectLocationRegistrationListCall<'a, C> {
6009 self._page_size = Some(new_value);
6010 self
6011 }
6012 /// Filter expression to restrict the `Registration`s returned. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, a boolean, or an enum value. The comparison operator should be one of =, !=, >, <, >=, <=, or : for prefix or wildcard matches. For example, to filter to a specific domain name, use an expression like `domainName="example.com"`. You can also check for the existence of a field; for example, to find domains using custom DNS settings, use an expression like `dnsSettings.customDns:*`. You can also create compound filters by combining expressions with the `AND` and `OR` operators. For example, to find domains that are suspended or have specific issues flagged, use an expression like `(state=SUSPENDED) OR (issue:*)`.
6013 ///
6014 /// Sets the *filter* query property to the given value.
6015 pub fn filter(mut self, new_value: &str) -> ProjectLocationRegistrationListCall<'a, C> {
6016 self._filter = Some(new_value.to_string());
6017 self
6018 }
6019 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6020 /// while executing the actual API request.
6021 ///
6022 /// ````text
6023 /// It should be used to handle progress information, and to implement a certain level of resilience.
6024 /// ````
6025 ///
6026 /// Sets the *delegate* property to the given value.
6027 pub fn delegate(
6028 mut self,
6029 new_value: &'a mut dyn common::Delegate,
6030 ) -> ProjectLocationRegistrationListCall<'a, C> {
6031 self._delegate = Some(new_value);
6032 self
6033 }
6034
6035 /// Set any additional parameter of the query string used in the request.
6036 /// It should be used to set parameters which are not yet available through their own
6037 /// setters.
6038 ///
6039 /// Please note that this method must not be used to set any of the known parameters
6040 /// which have their own setter method. If done anyway, the request will fail.
6041 ///
6042 /// # Additional Parameters
6043 ///
6044 /// * *$.xgafv* (query-string) - V1 error format.
6045 /// * *access_token* (query-string) - OAuth access token.
6046 /// * *alt* (query-string) - Data format for response.
6047 /// * *callback* (query-string) - JSONP
6048 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6049 /// * *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.
6050 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6051 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6052 /// * *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.
6053 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6054 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6055 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationListCall<'a, C>
6056 where
6057 T: AsRef<str>,
6058 {
6059 self._additional_params
6060 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6061 self
6062 }
6063
6064 /// Identifies the authorization scope for the method you are building.
6065 ///
6066 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6067 /// [`Scope::CloudPlatform`].
6068 ///
6069 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6070 /// tokens for more than one scope.
6071 ///
6072 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6073 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6074 /// sufficient, a read-write scope will do as well.
6075 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationListCall<'a, C>
6076 where
6077 St: AsRef<str>,
6078 {
6079 self._scopes.insert(String::from(scope.as_ref()));
6080 self
6081 }
6082 /// Identifies the authorization scope(s) for the method you are building.
6083 ///
6084 /// See [`Self::add_scope()`] for details.
6085 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationListCall<'a, C>
6086 where
6087 I: IntoIterator<Item = St>,
6088 St: AsRef<str>,
6089 {
6090 self._scopes
6091 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6092 self
6093 }
6094
6095 /// Removes all scopes, and no default scope will be used either.
6096 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6097 /// for details).
6098 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationListCall<'a, C> {
6099 self._scopes.clear();
6100 self
6101 }
6102}
6103
6104/// Updates select fields of a `Registration` resource, notably `labels`. To update other fields, use the appropriate custom update method: * To update management settings, see `ConfigureManagementSettings` * To update DNS configuration, see `ConfigureDnsSettings` * To update contact information, see `ConfigureContactSettings`
6105///
6106/// A builder for the *locations.registrations.patch* method supported by a *project* resource.
6107/// It is not used directly, but through a [`ProjectMethods`] instance.
6108///
6109/// # Example
6110///
6111/// Instantiate a resource method builder
6112///
6113/// ```test_harness,no_run
6114/// # extern crate hyper;
6115/// # extern crate hyper_rustls;
6116/// # extern crate google_domains1 as domains1;
6117/// use domains1::api::Registration;
6118/// # async fn dox() {
6119/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6120///
6121/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6122/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6123/// # .with_native_roots()
6124/// # .unwrap()
6125/// # .https_only()
6126/// # .enable_http2()
6127/// # .build();
6128///
6129/// # let executor = hyper_util::rt::TokioExecutor::new();
6130/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6131/// # secret,
6132/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6133/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6134/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6135/// # ),
6136/// # ).build().await.unwrap();
6137///
6138/// # let client = hyper_util::client::legacy::Client::builder(
6139/// # hyper_util::rt::TokioExecutor::new()
6140/// # )
6141/// # .build(
6142/// # hyper_rustls::HttpsConnectorBuilder::new()
6143/// # .with_native_roots()
6144/// # .unwrap()
6145/// # .https_or_http()
6146/// # .enable_http2()
6147/// # .build()
6148/// # );
6149/// # let mut hub = CloudDomains::new(client, auth);
6150/// // As the method needs a request, you would usually fill it with the desired information
6151/// // into the respective structure. Some of the parts shown here might not be applicable !
6152/// // Values shown here are possibly random and not representative !
6153/// let mut req = Registration::default();
6154///
6155/// // You can configure optional parameters by calling the respective setters at will, and
6156/// // execute the final call using `doit()`.
6157/// // Values shown here are possibly random and not representative !
6158/// let result = hub.projects().locations_registrations_patch(req, "name")
6159/// .update_mask(FieldMask::new::<&str>(&[]))
6160/// .doit().await;
6161/// # }
6162/// ```
6163pub struct ProjectLocationRegistrationPatchCall<'a, C>
6164where
6165 C: 'a,
6166{
6167 hub: &'a CloudDomains<C>,
6168 _request: Registration,
6169 _name: String,
6170 _update_mask: Option<common::FieldMask>,
6171 _delegate: Option<&'a mut dyn common::Delegate>,
6172 _additional_params: HashMap<String, String>,
6173 _scopes: BTreeSet<String>,
6174}
6175
6176impl<'a, C> common::CallBuilder for ProjectLocationRegistrationPatchCall<'a, C> {}
6177
6178impl<'a, C> ProjectLocationRegistrationPatchCall<'a, C>
6179where
6180 C: common::Connector,
6181{
6182 /// Perform the operation you have build so far.
6183 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6184 use std::borrow::Cow;
6185 use std::io::{Read, Seek};
6186
6187 use common::{url::Params, ToParts};
6188 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6189
6190 let mut dd = common::DefaultDelegate;
6191 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6192 dlg.begin(common::MethodInfo {
6193 id: "domains.projects.locations.registrations.patch",
6194 http_method: hyper::Method::PATCH,
6195 });
6196
6197 for &field in ["alt", "name", "updateMask"].iter() {
6198 if self._additional_params.contains_key(field) {
6199 dlg.finished(false);
6200 return Err(common::Error::FieldClash(field));
6201 }
6202 }
6203
6204 let mut params = Params::with_capacity(5 + self._additional_params.len());
6205 params.push("name", self._name);
6206 if let Some(value) = self._update_mask.as_ref() {
6207 params.push("updateMask", value.to_string());
6208 }
6209
6210 params.extend(self._additional_params.iter());
6211
6212 params.push("alt", "json");
6213 let mut url = self.hub._base_url.clone() + "v1/{+name}";
6214 if self._scopes.is_empty() {
6215 self._scopes
6216 .insert(Scope::CloudPlatform.as_ref().to_string());
6217 }
6218
6219 #[allow(clippy::single_element_loop)]
6220 for &(find_this, param_name) in [("{+name}", "name")].iter() {
6221 url = params.uri_replacement(url, param_name, find_this, true);
6222 }
6223 {
6224 let to_remove = ["name"];
6225 params.remove_params(&to_remove);
6226 }
6227
6228 let url = params.parse_with_url(&url);
6229
6230 let mut json_mime_type = mime::APPLICATION_JSON;
6231 let mut request_value_reader = {
6232 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6233 common::remove_json_null_values(&mut value);
6234 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6235 serde_json::to_writer(&mut dst, &value).unwrap();
6236 dst
6237 };
6238 let request_size = request_value_reader
6239 .seek(std::io::SeekFrom::End(0))
6240 .unwrap();
6241 request_value_reader
6242 .seek(std::io::SeekFrom::Start(0))
6243 .unwrap();
6244
6245 loop {
6246 let token = match self
6247 .hub
6248 .auth
6249 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6250 .await
6251 {
6252 Ok(token) => token,
6253 Err(e) => match dlg.token(e) {
6254 Ok(token) => token,
6255 Err(e) => {
6256 dlg.finished(false);
6257 return Err(common::Error::MissingToken(e));
6258 }
6259 },
6260 };
6261 request_value_reader
6262 .seek(std::io::SeekFrom::Start(0))
6263 .unwrap();
6264 let mut req_result = {
6265 let client = &self.hub.client;
6266 dlg.pre_request();
6267 let mut req_builder = hyper::Request::builder()
6268 .method(hyper::Method::PATCH)
6269 .uri(url.as_str())
6270 .header(USER_AGENT, self.hub._user_agent.clone());
6271
6272 if let Some(token) = token.as_ref() {
6273 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6274 }
6275
6276 let request = req_builder
6277 .header(CONTENT_TYPE, json_mime_type.to_string())
6278 .header(CONTENT_LENGTH, request_size as u64)
6279 .body(common::to_body(
6280 request_value_reader.get_ref().clone().into(),
6281 ));
6282
6283 client.request(request.unwrap()).await
6284 };
6285
6286 match req_result {
6287 Err(err) => {
6288 if let common::Retry::After(d) = dlg.http_error(&err) {
6289 sleep(d).await;
6290 continue;
6291 }
6292 dlg.finished(false);
6293 return Err(common::Error::HttpError(err));
6294 }
6295 Ok(res) => {
6296 let (mut parts, body) = res.into_parts();
6297 let mut body = common::Body::new(body);
6298 if !parts.status.is_success() {
6299 let bytes = common::to_bytes(body).await.unwrap_or_default();
6300 let error = serde_json::from_str(&common::to_string(&bytes));
6301 let response = common::to_response(parts, bytes.into());
6302
6303 if let common::Retry::After(d) =
6304 dlg.http_failure(&response, error.as_ref().ok())
6305 {
6306 sleep(d).await;
6307 continue;
6308 }
6309
6310 dlg.finished(false);
6311
6312 return Err(match error {
6313 Ok(value) => common::Error::BadRequest(value),
6314 _ => common::Error::Failure(response),
6315 });
6316 }
6317 let response = {
6318 let bytes = common::to_bytes(body).await.unwrap_or_default();
6319 let encoded = common::to_string(&bytes);
6320 match serde_json::from_str(&encoded) {
6321 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6322 Err(error) => {
6323 dlg.response_json_decode_error(&encoded, &error);
6324 return Err(common::Error::JsonDecodeError(
6325 encoded.to_string(),
6326 error,
6327 ));
6328 }
6329 }
6330 };
6331
6332 dlg.finished(true);
6333 return Ok(response);
6334 }
6335 }
6336 }
6337 }
6338
6339 ///
6340 /// Sets the *request* property to the given value.
6341 ///
6342 /// Even though the property as already been set when instantiating this call,
6343 /// we provide this method for API completeness.
6344 pub fn request(
6345 mut self,
6346 new_value: Registration,
6347 ) -> ProjectLocationRegistrationPatchCall<'a, C> {
6348 self._request = new_value;
6349 self
6350 }
6351 /// Output only. Name of the `Registration` resource, in the format `projects/*/locations/*/registrations/`.
6352 ///
6353 /// Sets the *name* path property to the given value.
6354 ///
6355 /// Even though the property as already been set when instantiating this call,
6356 /// we provide this method for API completeness.
6357 pub fn name(mut self, new_value: &str) -> ProjectLocationRegistrationPatchCall<'a, C> {
6358 self._name = new_value.to_string();
6359 self
6360 }
6361 /// Required. The field mask describing which fields to update as a comma-separated list. For example, if only the labels are being updated, the `update_mask` is `"labels"`.
6362 ///
6363 /// Sets the *update mask* query property to the given value.
6364 pub fn update_mask(
6365 mut self,
6366 new_value: common::FieldMask,
6367 ) -> ProjectLocationRegistrationPatchCall<'a, C> {
6368 self._update_mask = Some(new_value);
6369 self
6370 }
6371 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6372 /// while executing the actual API request.
6373 ///
6374 /// ````text
6375 /// It should be used to handle progress information, and to implement a certain level of resilience.
6376 /// ````
6377 ///
6378 /// Sets the *delegate* property to the given value.
6379 pub fn delegate(
6380 mut self,
6381 new_value: &'a mut dyn common::Delegate,
6382 ) -> ProjectLocationRegistrationPatchCall<'a, C> {
6383 self._delegate = Some(new_value);
6384 self
6385 }
6386
6387 /// Set any additional parameter of the query string used in the request.
6388 /// It should be used to set parameters which are not yet available through their own
6389 /// setters.
6390 ///
6391 /// Please note that this method must not be used to set any of the known parameters
6392 /// which have their own setter method. If done anyway, the request will fail.
6393 ///
6394 /// # Additional Parameters
6395 ///
6396 /// * *$.xgafv* (query-string) - V1 error format.
6397 /// * *access_token* (query-string) - OAuth access token.
6398 /// * *alt* (query-string) - Data format for response.
6399 /// * *callback* (query-string) - JSONP
6400 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6401 /// * *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.
6402 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6403 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6404 /// * *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.
6405 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6406 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6407 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationPatchCall<'a, C>
6408 where
6409 T: AsRef<str>,
6410 {
6411 self._additional_params
6412 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6413 self
6414 }
6415
6416 /// Identifies the authorization scope for the method you are building.
6417 ///
6418 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6419 /// [`Scope::CloudPlatform`].
6420 ///
6421 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6422 /// tokens for more than one scope.
6423 ///
6424 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6425 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6426 /// sufficient, a read-write scope will do as well.
6427 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationPatchCall<'a, C>
6428 where
6429 St: AsRef<str>,
6430 {
6431 self._scopes.insert(String::from(scope.as_ref()));
6432 self
6433 }
6434 /// Identifies the authorization scope(s) for the method you are building.
6435 ///
6436 /// See [`Self::add_scope()`] for details.
6437 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationPatchCall<'a, C>
6438 where
6439 I: IntoIterator<Item = St>,
6440 St: AsRef<str>,
6441 {
6442 self._scopes
6443 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6444 self
6445 }
6446
6447 /// Removes all scopes, and no default scope will be used either.
6448 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6449 /// for details).
6450 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationPatchCall<'a, C> {
6451 self._scopes.clear();
6452 self
6453 }
6454}
6455
6456/// Registers a new domain name and creates a corresponding `Registration` resource. Call `RetrieveRegisterParameters` first to check availability of the domain name and determine parameters like price that are needed to build a call to this method. A successful call creates a `Registration` resource in state `REGISTRATION_PENDING`, which resolves to `ACTIVE` within 1-2 minutes, indicating that the domain was successfully registered. If the resource ends up in state `REGISTRATION_FAILED`, it indicates that the domain was not registered successfully, and you can safely delete the resource and retry registration.
6457///
6458/// A builder for the *locations.registrations.register* method supported by a *project* resource.
6459/// It is not used directly, but through a [`ProjectMethods`] instance.
6460///
6461/// # Example
6462///
6463/// Instantiate a resource method builder
6464///
6465/// ```test_harness,no_run
6466/// # extern crate hyper;
6467/// # extern crate hyper_rustls;
6468/// # extern crate google_domains1 as domains1;
6469/// use domains1::api::RegisterDomainRequest;
6470/// # async fn dox() {
6471/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6472///
6473/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6474/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6475/// # .with_native_roots()
6476/// # .unwrap()
6477/// # .https_only()
6478/// # .enable_http2()
6479/// # .build();
6480///
6481/// # let executor = hyper_util::rt::TokioExecutor::new();
6482/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6483/// # secret,
6484/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6485/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6486/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6487/// # ),
6488/// # ).build().await.unwrap();
6489///
6490/// # let client = hyper_util::client::legacy::Client::builder(
6491/// # hyper_util::rt::TokioExecutor::new()
6492/// # )
6493/// # .build(
6494/// # hyper_rustls::HttpsConnectorBuilder::new()
6495/// # .with_native_roots()
6496/// # .unwrap()
6497/// # .https_or_http()
6498/// # .enable_http2()
6499/// # .build()
6500/// # );
6501/// # let mut hub = CloudDomains::new(client, auth);
6502/// // As the method needs a request, you would usually fill it with the desired information
6503/// // into the respective structure. Some of the parts shown here might not be applicable !
6504/// // Values shown here are possibly random and not representative !
6505/// let mut req = RegisterDomainRequest::default();
6506///
6507/// // You can configure optional parameters by calling the respective setters at will, and
6508/// // execute the final call using `doit()`.
6509/// // Values shown here are possibly random and not representative !
6510/// let result = hub.projects().locations_registrations_register(req, "parent")
6511/// .doit().await;
6512/// # }
6513/// ```
6514pub struct ProjectLocationRegistrationRegisterCall<'a, C>
6515where
6516 C: 'a,
6517{
6518 hub: &'a CloudDomains<C>,
6519 _request: RegisterDomainRequest,
6520 _parent: String,
6521 _delegate: Option<&'a mut dyn common::Delegate>,
6522 _additional_params: HashMap<String, String>,
6523 _scopes: BTreeSet<String>,
6524}
6525
6526impl<'a, C> common::CallBuilder for ProjectLocationRegistrationRegisterCall<'a, C> {}
6527
6528impl<'a, C> ProjectLocationRegistrationRegisterCall<'a, C>
6529where
6530 C: common::Connector,
6531{
6532 /// Perform the operation you have build so far.
6533 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6534 use std::borrow::Cow;
6535 use std::io::{Read, Seek};
6536
6537 use common::{url::Params, ToParts};
6538 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6539
6540 let mut dd = common::DefaultDelegate;
6541 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6542 dlg.begin(common::MethodInfo {
6543 id: "domains.projects.locations.registrations.register",
6544 http_method: hyper::Method::POST,
6545 });
6546
6547 for &field in ["alt", "parent"].iter() {
6548 if self._additional_params.contains_key(field) {
6549 dlg.finished(false);
6550 return Err(common::Error::FieldClash(field));
6551 }
6552 }
6553
6554 let mut params = Params::with_capacity(4 + self._additional_params.len());
6555 params.push("parent", self._parent);
6556
6557 params.extend(self._additional_params.iter());
6558
6559 params.push("alt", "json");
6560 let mut url = self.hub._base_url.clone() + "v1/{+parent}/registrations:register";
6561 if self._scopes.is_empty() {
6562 self._scopes
6563 .insert(Scope::CloudPlatform.as_ref().to_string());
6564 }
6565
6566 #[allow(clippy::single_element_loop)]
6567 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6568 url = params.uri_replacement(url, param_name, find_this, true);
6569 }
6570 {
6571 let to_remove = ["parent"];
6572 params.remove_params(&to_remove);
6573 }
6574
6575 let url = params.parse_with_url(&url);
6576
6577 let mut json_mime_type = mime::APPLICATION_JSON;
6578 let mut request_value_reader = {
6579 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6580 common::remove_json_null_values(&mut value);
6581 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6582 serde_json::to_writer(&mut dst, &value).unwrap();
6583 dst
6584 };
6585 let request_size = request_value_reader
6586 .seek(std::io::SeekFrom::End(0))
6587 .unwrap();
6588 request_value_reader
6589 .seek(std::io::SeekFrom::Start(0))
6590 .unwrap();
6591
6592 loop {
6593 let token = match self
6594 .hub
6595 .auth
6596 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6597 .await
6598 {
6599 Ok(token) => token,
6600 Err(e) => match dlg.token(e) {
6601 Ok(token) => token,
6602 Err(e) => {
6603 dlg.finished(false);
6604 return Err(common::Error::MissingToken(e));
6605 }
6606 },
6607 };
6608 request_value_reader
6609 .seek(std::io::SeekFrom::Start(0))
6610 .unwrap();
6611 let mut req_result = {
6612 let client = &self.hub.client;
6613 dlg.pre_request();
6614 let mut req_builder = hyper::Request::builder()
6615 .method(hyper::Method::POST)
6616 .uri(url.as_str())
6617 .header(USER_AGENT, self.hub._user_agent.clone());
6618
6619 if let Some(token) = token.as_ref() {
6620 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6621 }
6622
6623 let request = req_builder
6624 .header(CONTENT_TYPE, json_mime_type.to_string())
6625 .header(CONTENT_LENGTH, request_size as u64)
6626 .body(common::to_body(
6627 request_value_reader.get_ref().clone().into(),
6628 ));
6629
6630 client.request(request.unwrap()).await
6631 };
6632
6633 match req_result {
6634 Err(err) => {
6635 if let common::Retry::After(d) = dlg.http_error(&err) {
6636 sleep(d).await;
6637 continue;
6638 }
6639 dlg.finished(false);
6640 return Err(common::Error::HttpError(err));
6641 }
6642 Ok(res) => {
6643 let (mut parts, body) = res.into_parts();
6644 let mut body = common::Body::new(body);
6645 if !parts.status.is_success() {
6646 let bytes = common::to_bytes(body).await.unwrap_or_default();
6647 let error = serde_json::from_str(&common::to_string(&bytes));
6648 let response = common::to_response(parts, bytes.into());
6649
6650 if let common::Retry::After(d) =
6651 dlg.http_failure(&response, error.as_ref().ok())
6652 {
6653 sleep(d).await;
6654 continue;
6655 }
6656
6657 dlg.finished(false);
6658
6659 return Err(match error {
6660 Ok(value) => common::Error::BadRequest(value),
6661 _ => common::Error::Failure(response),
6662 });
6663 }
6664 let response = {
6665 let bytes = common::to_bytes(body).await.unwrap_or_default();
6666 let encoded = common::to_string(&bytes);
6667 match serde_json::from_str(&encoded) {
6668 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6669 Err(error) => {
6670 dlg.response_json_decode_error(&encoded, &error);
6671 return Err(common::Error::JsonDecodeError(
6672 encoded.to_string(),
6673 error,
6674 ));
6675 }
6676 }
6677 };
6678
6679 dlg.finished(true);
6680 return Ok(response);
6681 }
6682 }
6683 }
6684 }
6685
6686 ///
6687 /// Sets the *request* property to the given value.
6688 ///
6689 /// Even though the property as already been set when instantiating this call,
6690 /// we provide this method for API completeness.
6691 pub fn request(
6692 mut self,
6693 new_value: RegisterDomainRequest,
6694 ) -> ProjectLocationRegistrationRegisterCall<'a, C> {
6695 self._request = new_value;
6696 self
6697 }
6698 /// Required. The parent resource of the `Registration`. Must be in the format `projects/*/locations/*`.
6699 ///
6700 /// Sets the *parent* path property to the given value.
6701 ///
6702 /// Even though the property as already been set when instantiating this call,
6703 /// we provide this method for API completeness.
6704 pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistrationRegisterCall<'a, C> {
6705 self._parent = new_value.to_string();
6706 self
6707 }
6708 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6709 /// while executing the actual API request.
6710 ///
6711 /// ````text
6712 /// It should be used to handle progress information, and to implement a certain level of resilience.
6713 /// ````
6714 ///
6715 /// Sets the *delegate* property to the given value.
6716 pub fn delegate(
6717 mut self,
6718 new_value: &'a mut dyn common::Delegate,
6719 ) -> ProjectLocationRegistrationRegisterCall<'a, C> {
6720 self._delegate = Some(new_value);
6721 self
6722 }
6723
6724 /// Set any additional parameter of the query string used in the request.
6725 /// It should be used to set parameters which are not yet available through their own
6726 /// setters.
6727 ///
6728 /// Please note that this method must not be used to set any of the known parameters
6729 /// which have their own setter method. If done anyway, the request will fail.
6730 ///
6731 /// # Additional Parameters
6732 ///
6733 /// * *$.xgafv* (query-string) - V1 error format.
6734 /// * *access_token* (query-string) - OAuth access token.
6735 /// * *alt* (query-string) - Data format for response.
6736 /// * *callback* (query-string) - JSONP
6737 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6738 /// * *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.
6739 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6740 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6741 /// * *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.
6742 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6743 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6744 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationRegisterCall<'a, C>
6745 where
6746 T: AsRef<str>,
6747 {
6748 self._additional_params
6749 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6750 self
6751 }
6752
6753 /// Identifies the authorization scope for the method you are building.
6754 ///
6755 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6756 /// [`Scope::CloudPlatform`].
6757 ///
6758 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6759 /// tokens for more than one scope.
6760 ///
6761 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6762 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6763 /// sufficient, a read-write scope will do as well.
6764 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationRegisterCall<'a, C>
6765 where
6766 St: AsRef<str>,
6767 {
6768 self._scopes.insert(String::from(scope.as_ref()));
6769 self
6770 }
6771 /// Identifies the authorization scope(s) for the method you are building.
6772 ///
6773 /// See [`Self::add_scope()`] for details.
6774 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationRegisterCall<'a, C>
6775 where
6776 I: IntoIterator<Item = St>,
6777 St: AsRef<str>,
6778 {
6779 self._scopes
6780 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6781 self
6782 }
6783
6784 /// Removes all scopes, and no default scope will be used either.
6785 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6786 /// for details).
6787 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationRegisterCall<'a, C> {
6788 self._scopes.clear();
6789 self
6790 }
6791}
6792
6793/// Renews a recently expired domain. This method can only be called on domains that expired in the previous 30 days. After the renewal, the new expiration time of the domain is one year after the old expiration time and you are charged a `yearly_price` for the renewal.
6794///
6795/// A builder for the *locations.registrations.renewDomain* method supported by a *project* resource.
6796/// It is not used directly, but through a [`ProjectMethods`] instance.
6797///
6798/// # Example
6799///
6800/// Instantiate a resource method builder
6801///
6802/// ```test_harness,no_run
6803/// # extern crate hyper;
6804/// # extern crate hyper_rustls;
6805/// # extern crate google_domains1 as domains1;
6806/// use domains1::api::RenewDomainRequest;
6807/// # async fn dox() {
6808/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6809///
6810/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6811/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6812/// # .with_native_roots()
6813/// # .unwrap()
6814/// # .https_only()
6815/// # .enable_http2()
6816/// # .build();
6817///
6818/// # let executor = hyper_util::rt::TokioExecutor::new();
6819/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6820/// # secret,
6821/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6822/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6823/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6824/// # ),
6825/// # ).build().await.unwrap();
6826///
6827/// # let client = hyper_util::client::legacy::Client::builder(
6828/// # hyper_util::rt::TokioExecutor::new()
6829/// # )
6830/// # .build(
6831/// # hyper_rustls::HttpsConnectorBuilder::new()
6832/// # .with_native_roots()
6833/// # .unwrap()
6834/// # .https_or_http()
6835/// # .enable_http2()
6836/// # .build()
6837/// # );
6838/// # let mut hub = CloudDomains::new(client, auth);
6839/// // As the method needs a request, you would usually fill it with the desired information
6840/// // into the respective structure. Some of the parts shown here might not be applicable !
6841/// // Values shown here are possibly random and not representative !
6842/// let mut req = RenewDomainRequest::default();
6843///
6844/// // You can configure optional parameters by calling the respective setters at will, and
6845/// // execute the final call using `doit()`.
6846/// // Values shown here are possibly random and not representative !
6847/// let result = hub.projects().locations_registrations_renew_domain(req, "registration")
6848/// .doit().await;
6849/// # }
6850/// ```
6851pub struct ProjectLocationRegistrationRenewDomainCall<'a, C>
6852where
6853 C: 'a,
6854{
6855 hub: &'a CloudDomains<C>,
6856 _request: RenewDomainRequest,
6857 _registration: String,
6858 _delegate: Option<&'a mut dyn common::Delegate>,
6859 _additional_params: HashMap<String, String>,
6860 _scopes: BTreeSet<String>,
6861}
6862
6863impl<'a, C> common::CallBuilder for ProjectLocationRegistrationRenewDomainCall<'a, C> {}
6864
6865impl<'a, C> ProjectLocationRegistrationRenewDomainCall<'a, C>
6866where
6867 C: common::Connector,
6868{
6869 /// Perform the operation you have build so far.
6870 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6871 use std::borrow::Cow;
6872 use std::io::{Read, Seek};
6873
6874 use common::{url::Params, ToParts};
6875 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6876
6877 let mut dd = common::DefaultDelegate;
6878 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6879 dlg.begin(common::MethodInfo {
6880 id: "domains.projects.locations.registrations.renewDomain",
6881 http_method: hyper::Method::POST,
6882 });
6883
6884 for &field in ["alt", "registration"].iter() {
6885 if self._additional_params.contains_key(field) {
6886 dlg.finished(false);
6887 return Err(common::Error::FieldClash(field));
6888 }
6889 }
6890
6891 let mut params = Params::with_capacity(4 + self._additional_params.len());
6892 params.push("registration", self._registration);
6893
6894 params.extend(self._additional_params.iter());
6895
6896 params.push("alt", "json");
6897 let mut url = self.hub._base_url.clone() + "v1/{+registration}:renewDomain";
6898 if self._scopes.is_empty() {
6899 self._scopes
6900 .insert(Scope::CloudPlatform.as_ref().to_string());
6901 }
6902
6903 #[allow(clippy::single_element_loop)]
6904 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
6905 url = params.uri_replacement(url, param_name, find_this, true);
6906 }
6907 {
6908 let to_remove = ["registration"];
6909 params.remove_params(&to_remove);
6910 }
6911
6912 let url = params.parse_with_url(&url);
6913
6914 let mut json_mime_type = mime::APPLICATION_JSON;
6915 let mut request_value_reader = {
6916 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6917 common::remove_json_null_values(&mut value);
6918 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6919 serde_json::to_writer(&mut dst, &value).unwrap();
6920 dst
6921 };
6922 let request_size = request_value_reader
6923 .seek(std::io::SeekFrom::End(0))
6924 .unwrap();
6925 request_value_reader
6926 .seek(std::io::SeekFrom::Start(0))
6927 .unwrap();
6928
6929 loop {
6930 let token = match self
6931 .hub
6932 .auth
6933 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6934 .await
6935 {
6936 Ok(token) => token,
6937 Err(e) => match dlg.token(e) {
6938 Ok(token) => token,
6939 Err(e) => {
6940 dlg.finished(false);
6941 return Err(common::Error::MissingToken(e));
6942 }
6943 },
6944 };
6945 request_value_reader
6946 .seek(std::io::SeekFrom::Start(0))
6947 .unwrap();
6948 let mut req_result = {
6949 let client = &self.hub.client;
6950 dlg.pre_request();
6951 let mut req_builder = hyper::Request::builder()
6952 .method(hyper::Method::POST)
6953 .uri(url.as_str())
6954 .header(USER_AGENT, self.hub._user_agent.clone());
6955
6956 if let Some(token) = token.as_ref() {
6957 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6958 }
6959
6960 let request = req_builder
6961 .header(CONTENT_TYPE, json_mime_type.to_string())
6962 .header(CONTENT_LENGTH, request_size as u64)
6963 .body(common::to_body(
6964 request_value_reader.get_ref().clone().into(),
6965 ));
6966
6967 client.request(request.unwrap()).await
6968 };
6969
6970 match req_result {
6971 Err(err) => {
6972 if let common::Retry::After(d) = dlg.http_error(&err) {
6973 sleep(d).await;
6974 continue;
6975 }
6976 dlg.finished(false);
6977 return Err(common::Error::HttpError(err));
6978 }
6979 Ok(res) => {
6980 let (mut parts, body) = res.into_parts();
6981 let mut body = common::Body::new(body);
6982 if !parts.status.is_success() {
6983 let bytes = common::to_bytes(body).await.unwrap_or_default();
6984 let error = serde_json::from_str(&common::to_string(&bytes));
6985 let response = common::to_response(parts, bytes.into());
6986
6987 if let common::Retry::After(d) =
6988 dlg.http_failure(&response, error.as_ref().ok())
6989 {
6990 sleep(d).await;
6991 continue;
6992 }
6993
6994 dlg.finished(false);
6995
6996 return Err(match error {
6997 Ok(value) => common::Error::BadRequest(value),
6998 _ => common::Error::Failure(response),
6999 });
7000 }
7001 let response = {
7002 let bytes = common::to_bytes(body).await.unwrap_or_default();
7003 let encoded = common::to_string(&bytes);
7004 match serde_json::from_str(&encoded) {
7005 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7006 Err(error) => {
7007 dlg.response_json_decode_error(&encoded, &error);
7008 return Err(common::Error::JsonDecodeError(
7009 encoded.to_string(),
7010 error,
7011 ));
7012 }
7013 }
7014 };
7015
7016 dlg.finished(true);
7017 return Ok(response);
7018 }
7019 }
7020 }
7021 }
7022
7023 ///
7024 /// Sets the *request* property to the given value.
7025 ///
7026 /// Even though the property as already been set when instantiating this call,
7027 /// we provide this method for API completeness.
7028 pub fn request(
7029 mut self,
7030 new_value: RenewDomainRequest,
7031 ) -> ProjectLocationRegistrationRenewDomainCall<'a, C> {
7032 self._request = new_value;
7033 self
7034 }
7035 /// Required. The name of the `Registration` whish is being renewed, in the format `projects/*/locations/*/registrations/*`.
7036 ///
7037 /// Sets the *registration* path property to the given value.
7038 ///
7039 /// Even though the property as already been set when instantiating this call,
7040 /// we provide this method for API completeness.
7041 pub fn registration(
7042 mut self,
7043 new_value: &str,
7044 ) -> ProjectLocationRegistrationRenewDomainCall<'a, C> {
7045 self._registration = new_value.to_string();
7046 self
7047 }
7048 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7049 /// while executing the actual API request.
7050 ///
7051 /// ````text
7052 /// It should be used to handle progress information, and to implement a certain level of resilience.
7053 /// ````
7054 ///
7055 /// Sets the *delegate* property to the given value.
7056 pub fn delegate(
7057 mut self,
7058 new_value: &'a mut dyn common::Delegate,
7059 ) -> ProjectLocationRegistrationRenewDomainCall<'a, C> {
7060 self._delegate = Some(new_value);
7061 self
7062 }
7063
7064 /// Set any additional parameter of the query string used in the request.
7065 /// It should be used to set parameters which are not yet available through their own
7066 /// setters.
7067 ///
7068 /// Please note that this method must not be used to set any of the known parameters
7069 /// which have their own setter method. If done anyway, the request will fail.
7070 ///
7071 /// # Additional Parameters
7072 ///
7073 /// * *$.xgafv* (query-string) - V1 error format.
7074 /// * *access_token* (query-string) - OAuth access token.
7075 /// * *alt* (query-string) - Data format for response.
7076 /// * *callback* (query-string) - JSONP
7077 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7078 /// * *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.
7079 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7080 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7081 /// * *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.
7082 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7083 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7084 pub fn param<T>(
7085 mut self,
7086 name: T,
7087 value: T,
7088 ) -> ProjectLocationRegistrationRenewDomainCall<'a, C>
7089 where
7090 T: AsRef<str>,
7091 {
7092 self._additional_params
7093 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7094 self
7095 }
7096
7097 /// Identifies the authorization scope for the method you are building.
7098 ///
7099 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7100 /// [`Scope::CloudPlatform`].
7101 ///
7102 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7103 /// tokens for more than one scope.
7104 ///
7105 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7106 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7107 /// sufficient, a read-write scope will do as well.
7108 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationRenewDomainCall<'a, C>
7109 where
7110 St: AsRef<str>,
7111 {
7112 self._scopes.insert(String::from(scope.as_ref()));
7113 self
7114 }
7115 /// Identifies the authorization scope(s) for the method you are building.
7116 ///
7117 /// See [`Self::add_scope()`] for details.
7118 pub fn add_scopes<I, St>(
7119 mut self,
7120 scopes: I,
7121 ) -> ProjectLocationRegistrationRenewDomainCall<'a, C>
7122 where
7123 I: IntoIterator<Item = St>,
7124 St: AsRef<str>,
7125 {
7126 self._scopes
7127 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7128 self
7129 }
7130
7131 /// Removes all scopes, and no default scope will be used either.
7132 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7133 /// for details).
7134 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationRenewDomainCall<'a, C> {
7135 self._scopes.clear();
7136 self
7137 }
7138}
7139
7140/// Resets the authorization code of the `Registration` to a new random string. You can call this method only after 60 days have elapsed since the initial domain registration. Domains that have the `REQUIRE_PUSH_TRANSFER` property in the list of `domain_properties` don't support authorization codes and must use the `InitiatePushTransfer` method to initiate the process to transfer the domain to a different registrar.
7141///
7142/// A builder for the *locations.registrations.resetAuthorizationCode* method supported by a *project* resource.
7143/// It is not used directly, but through a [`ProjectMethods`] instance.
7144///
7145/// # Example
7146///
7147/// Instantiate a resource method builder
7148///
7149/// ```test_harness,no_run
7150/// # extern crate hyper;
7151/// # extern crate hyper_rustls;
7152/// # extern crate google_domains1 as domains1;
7153/// use domains1::api::ResetAuthorizationCodeRequest;
7154/// # async fn dox() {
7155/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7156///
7157/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7158/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7159/// # .with_native_roots()
7160/// # .unwrap()
7161/// # .https_only()
7162/// # .enable_http2()
7163/// # .build();
7164///
7165/// # let executor = hyper_util::rt::TokioExecutor::new();
7166/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7167/// # secret,
7168/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7169/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7170/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7171/// # ),
7172/// # ).build().await.unwrap();
7173///
7174/// # let client = hyper_util::client::legacy::Client::builder(
7175/// # hyper_util::rt::TokioExecutor::new()
7176/// # )
7177/// # .build(
7178/// # hyper_rustls::HttpsConnectorBuilder::new()
7179/// # .with_native_roots()
7180/// # .unwrap()
7181/// # .https_or_http()
7182/// # .enable_http2()
7183/// # .build()
7184/// # );
7185/// # let mut hub = CloudDomains::new(client, auth);
7186/// // As the method needs a request, you would usually fill it with the desired information
7187/// // into the respective structure. Some of the parts shown here might not be applicable !
7188/// // Values shown here are possibly random and not representative !
7189/// let mut req = ResetAuthorizationCodeRequest::default();
7190///
7191/// // You can configure optional parameters by calling the respective setters at will, and
7192/// // execute the final call using `doit()`.
7193/// // Values shown here are possibly random and not representative !
7194/// let result = hub.projects().locations_registrations_reset_authorization_code(req, "registration")
7195/// .doit().await;
7196/// # }
7197/// ```
7198pub struct ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C>
7199where
7200 C: 'a,
7201{
7202 hub: &'a CloudDomains<C>,
7203 _request: ResetAuthorizationCodeRequest,
7204 _registration: String,
7205 _delegate: Option<&'a mut dyn common::Delegate>,
7206 _additional_params: HashMap<String, String>,
7207 _scopes: BTreeSet<String>,
7208}
7209
7210impl<'a, C> common::CallBuilder for ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C> {}
7211
7212impl<'a, C> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C>
7213where
7214 C: common::Connector,
7215{
7216 /// Perform the operation you have build so far.
7217 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizationCode)> {
7218 use std::borrow::Cow;
7219 use std::io::{Read, Seek};
7220
7221 use common::{url::Params, ToParts};
7222 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7223
7224 let mut dd = common::DefaultDelegate;
7225 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7226 dlg.begin(common::MethodInfo {
7227 id: "domains.projects.locations.registrations.resetAuthorizationCode",
7228 http_method: hyper::Method::POST,
7229 });
7230
7231 for &field in ["alt", "registration"].iter() {
7232 if self._additional_params.contains_key(field) {
7233 dlg.finished(false);
7234 return Err(common::Error::FieldClash(field));
7235 }
7236 }
7237
7238 let mut params = Params::with_capacity(4 + self._additional_params.len());
7239 params.push("registration", self._registration);
7240
7241 params.extend(self._additional_params.iter());
7242
7243 params.push("alt", "json");
7244 let mut url = self.hub._base_url.clone() + "v1/{+registration}:resetAuthorizationCode";
7245 if self._scopes.is_empty() {
7246 self._scopes
7247 .insert(Scope::CloudPlatform.as_ref().to_string());
7248 }
7249
7250 #[allow(clippy::single_element_loop)]
7251 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
7252 url = params.uri_replacement(url, param_name, find_this, true);
7253 }
7254 {
7255 let to_remove = ["registration"];
7256 params.remove_params(&to_remove);
7257 }
7258
7259 let url = params.parse_with_url(&url);
7260
7261 let mut json_mime_type = mime::APPLICATION_JSON;
7262 let mut request_value_reader = {
7263 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7264 common::remove_json_null_values(&mut value);
7265 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7266 serde_json::to_writer(&mut dst, &value).unwrap();
7267 dst
7268 };
7269 let request_size = request_value_reader
7270 .seek(std::io::SeekFrom::End(0))
7271 .unwrap();
7272 request_value_reader
7273 .seek(std::io::SeekFrom::Start(0))
7274 .unwrap();
7275
7276 loop {
7277 let token = match self
7278 .hub
7279 .auth
7280 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7281 .await
7282 {
7283 Ok(token) => token,
7284 Err(e) => match dlg.token(e) {
7285 Ok(token) => token,
7286 Err(e) => {
7287 dlg.finished(false);
7288 return Err(common::Error::MissingToken(e));
7289 }
7290 },
7291 };
7292 request_value_reader
7293 .seek(std::io::SeekFrom::Start(0))
7294 .unwrap();
7295 let mut req_result = {
7296 let client = &self.hub.client;
7297 dlg.pre_request();
7298 let mut req_builder = hyper::Request::builder()
7299 .method(hyper::Method::POST)
7300 .uri(url.as_str())
7301 .header(USER_AGENT, self.hub._user_agent.clone());
7302
7303 if let Some(token) = token.as_ref() {
7304 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7305 }
7306
7307 let request = req_builder
7308 .header(CONTENT_TYPE, json_mime_type.to_string())
7309 .header(CONTENT_LENGTH, request_size as u64)
7310 .body(common::to_body(
7311 request_value_reader.get_ref().clone().into(),
7312 ));
7313
7314 client.request(request.unwrap()).await
7315 };
7316
7317 match req_result {
7318 Err(err) => {
7319 if let common::Retry::After(d) = dlg.http_error(&err) {
7320 sleep(d).await;
7321 continue;
7322 }
7323 dlg.finished(false);
7324 return Err(common::Error::HttpError(err));
7325 }
7326 Ok(res) => {
7327 let (mut parts, body) = res.into_parts();
7328 let mut body = common::Body::new(body);
7329 if !parts.status.is_success() {
7330 let bytes = common::to_bytes(body).await.unwrap_or_default();
7331 let error = serde_json::from_str(&common::to_string(&bytes));
7332 let response = common::to_response(parts, bytes.into());
7333
7334 if let common::Retry::After(d) =
7335 dlg.http_failure(&response, error.as_ref().ok())
7336 {
7337 sleep(d).await;
7338 continue;
7339 }
7340
7341 dlg.finished(false);
7342
7343 return Err(match error {
7344 Ok(value) => common::Error::BadRequest(value),
7345 _ => common::Error::Failure(response),
7346 });
7347 }
7348 let response = {
7349 let bytes = common::to_bytes(body).await.unwrap_or_default();
7350 let encoded = common::to_string(&bytes);
7351 match serde_json::from_str(&encoded) {
7352 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7353 Err(error) => {
7354 dlg.response_json_decode_error(&encoded, &error);
7355 return Err(common::Error::JsonDecodeError(
7356 encoded.to_string(),
7357 error,
7358 ));
7359 }
7360 }
7361 };
7362
7363 dlg.finished(true);
7364 return Ok(response);
7365 }
7366 }
7367 }
7368 }
7369
7370 ///
7371 /// Sets the *request* property to the given value.
7372 ///
7373 /// Even though the property as already been set when instantiating this call,
7374 /// we provide this method for API completeness.
7375 pub fn request(
7376 mut self,
7377 new_value: ResetAuthorizationCodeRequest,
7378 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C> {
7379 self._request = new_value;
7380 self
7381 }
7382 /// Required. The name of the `Registration` whose authorization code is being reset, in the format `projects/*/locations/*/registrations/*`.
7383 ///
7384 /// Sets the *registration* path property to the given value.
7385 ///
7386 /// Even though the property as already been set when instantiating this call,
7387 /// we provide this method for API completeness.
7388 pub fn registration(
7389 mut self,
7390 new_value: &str,
7391 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C> {
7392 self._registration = new_value.to_string();
7393 self
7394 }
7395 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7396 /// while executing the actual API request.
7397 ///
7398 /// ````text
7399 /// It should be used to handle progress information, and to implement a certain level of resilience.
7400 /// ````
7401 ///
7402 /// Sets the *delegate* property to the given value.
7403 pub fn delegate(
7404 mut self,
7405 new_value: &'a mut dyn common::Delegate,
7406 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C> {
7407 self._delegate = Some(new_value);
7408 self
7409 }
7410
7411 /// Set any additional parameter of the query string used in the request.
7412 /// It should be used to set parameters which are not yet available through their own
7413 /// setters.
7414 ///
7415 /// Please note that this method must not be used to set any of the known parameters
7416 /// which have their own setter method. If done anyway, the request will fail.
7417 ///
7418 /// # Additional Parameters
7419 ///
7420 /// * *$.xgafv* (query-string) - V1 error format.
7421 /// * *access_token* (query-string) - OAuth access token.
7422 /// * *alt* (query-string) - Data format for response.
7423 /// * *callback* (query-string) - JSONP
7424 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7425 /// * *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.
7426 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7427 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7428 /// * *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.
7429 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7430 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7431 pub fn param<T>(
7432 mut self,
7433 name: T,
7434 value: T,
7435 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C>
7436 where
7437 T: AsRef<str>,
7438 {
7439 self._additional_params
7440 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7441 self
7442 }
7443
7444 /// Identifies the authorization scope for the method you are building.
7445 ///
7446 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7447 /// [`Scope::CloudPlatform`].
7448 ///
7449 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7450 /// tokens for more than one scope.
7451 ///
7452 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7453 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7454 /// sufficient, a read-write scope will do as well.
7455 pub fn add_scope<St>(
7456 mut self,
7457 scope: St,
7458 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C>
7459 where
7460 St: AsRef<str>,
7461 {
7462 self._scopes.insert(String::from(scope.as_ref()));
7463 self
7464 }
7465 /// Identifies the authorization scope(s) for the method you are building.
7466 ///
7467 /// See [`Self::add_scope()`] for details.
7468 pub fn add_scopes<I, St>(
7469 mut self,
7470 scopes: I,
7471 ) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C>
7472 where
7473 I: IntoIterator<Item = St>,
7474 St: AsRef<str>,
7475 {
7476 self._scopes
7477 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7478 self
7479 }
7480
7481 /// Removes all scopes, and no default scope will be used either.
7482 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7483 /// for details).
7484 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationResetAuthorizationCodeCall<'a, C> {
7485 self._scopes.clear();
7486 self
7487 }
7488}
7489
7490/// Gets the authorization code of the `Registration` for the purpose of transferring the domain to another registrar. You can call this method only after 60 days have elapsed since the initial domain registration. Domains that have the `REQUIRE_PUSH_TRANSFER` property in the list of `domain_properties` don't support authorization codes and must use the `InitiatePushTransfer` method to initiate the process to transfer the domain to a different registrar.
7491///
7492/// A builder for the *locations.registrations.retrieveAuthorizationCode* method supported by a *project* resource.
7493/// It is not used directly, but through a [`ProjectMethods`] instance.
7494///
7495/// # Example
7496///
7497/// Instantiate a resource method builder
7498///
7499/// ```test_harness,no_run
7500/// # extern crate hyper;
7501/// # extern crate hyper_rustls;
7502/// # extern crate google_domains1 as domains1;
7503/// # async fn dox() {
7504/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7505///
7506/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7507/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7508/// # .with_native_roots()
7509/// # .unwrap()
7510/// # .https_only()
7511/// # .enable_http2()
7512/// # .build();
7513///
7514/// # let executor = hyper_util::rt::TokioExecutor::new();
7515/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7516/// # secret,
7517/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7518/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7519/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7520/// # ),
7521/// # ).build().await.unwrap();
7522///
7523/// # let client = hyper_util::client::legacy::Client::builder(
7524/// # hyper_util::rt::TokioExecutor::new()
7525/// # )
7526/// # .build(
7527/// # hyper_rustls::HttpsConnectorBuilder::new()
7528/// # .with_native_roots()
7529/// # .unwrap()
7530/// # .https_or_http()
7531/// # .enable_http2()
7532/// # .build()
7533/// # );
7534/// # let mut hub = CloudDomains::new(client, auth);
7535/// // You can configure optional parameters by calling the respective setters at will, and
7536/// // execute the final call using `doit()`.
7537/// // Values shown here are possibly random and not representative !
7538/// let result = hub.projects().locations_registrations_retrieve_authorization_code("registration")
7539/// .doit().await;
7540/// # }
7541/// ```
7542pub struct ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C>
7543where
7544 C: 'a,
7545{
7546 hub: &'a CloudDomains<C>,
7547 _registration: String,
7548 _delegate: Option<&'a mut dyn common::Delegate>,
7549 _additional_params: HashMap<String, String>,
7550 _scopes: BTreeSet<String>,
7551}
7552
7553impl<'a, C> common::CallBuilder
7554 for ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C>
7555{
7556}
7557
7558impl<'a, C> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C>
7559where
7560 C: common::Connector,
7561{
7562 /// Perform the operation you have build so far.
7563 pub async fn doit(mut self) -> common::Result<(common::Response, AuthorizationCode)> {
7564 use std::borrow::Cow;
7565 use std::io::{Read, Seek};
7566
7567 use common::{url::Params, ToParts};
7568 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7569
7570 let mut dd = common::DefaultDelegate;
7571 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7572 dlg.begin(common::MethodInfo {
7573 id: "domains.projects.locations.registrations.retrieveAuthorizationCode",
7574 http_method: hyper::Method::GET,
7575 });
7576
7577 for &field in ["alt", "registration"].iter() {
7578 if self._additional_params.contains_key(field) {
7579 dlg.finished(false);
7580 return Err(common::Error::FieldClash(field));
7581 }
7582 }
7583
7584 let mut params = Params::with_capacity(3 + self._additional_params.len());
7585 params.push("registration", self._registration);
7586
7587 params.extend(self._additional_params.iter());
7588
7589 params.push("alt", "json");
7590 let mut url = self.hub._base_url.clone() + "v1/{+registration}:retrieveAuthorizationCode";
7591 if self._scopes.is_empty() {
7592 self._scopes
7593 .insert(Scope::CloudPlatform.as_ref().to_string());
7594 }
7595
7596 #[allow(clippy::single_element_loop)]
7597 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
7598 url = params.uri_replacement(url, param_name, find_this, true);
7599 }
7600 {
7601 let to_remove = ["registration"];
7602 params.remove_params(&to_remove);
7603 }
7604
7605 let url = params.parse_with_url(&url);
7606
7607 loop {
7608 let token = match self
7609 .hub
7610 .auth
7611 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7612 .await
7613 {
7614 Ok(token) => token,
7615 Err(e) => match dlg.token(e) {
7616 Ok(token) => token,
7617 Err(e) => {
7618 dlg.finished(false);
7619 return Err(common::Error::MissingToken(e));
7620 }
7621 },
7622 };
7623 let mut req_result = {
7624 let client = &self.hub.client;
7625 dlg.pre_request();
7626 let mut req_builder = hyper::Request::builder()
7627 .method(hyper::Method::GET)
7628 .uri(url.as_str())
7629 .header(USER_AGENT, self.hub._user_agent.clone());
7630
7631 if let Some(token) = token.as_ref() {
7632 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7633 }
7634
7635 let request = req_builder
7636 .header(CONTENT_LENGTH, 0_u64)
7637 .body(common::to_body::<String>(None));
7638
7639 client.request(request.unwrap()).await
7640 };
7641
7642 match req_result {
7643 Err(err) => {
7644 if let common::Retry::After(d) = dlg.http_error(&err) {
7645 sleep(d).await;
7646 continue;
7647 }
7648 dlg.finished(false);
7649 return Err(common::Error::HttpError(err));
7650 }
7651 Ok(res) => {
7652 let (mut parts, body) = res.into_parts();
7653 let mut body = common::Body::new(body);
7654 if !parts.status.is_success() {
7655 let bytes = common::to_bytes(body).await.unwrap_or_default();
7656 let error = serde_json::from_str(&common::to_string(&bytes));
7657 let response = common::to_response(parts, bytes.into());
7658
7659 if let common::Retry::After(d) =
7660 dlg.http_failure(&response, error.as_ref().ok())
7661 {
7662 sleep(d).await;
7663 continue;
7664 }
7665
7666 dlg.finished(false);
7667
7668 return Err(match error {
7669 Ok(value) => common::Error::BadRequest(value),
7670 _ => common::Error::Failure(response),
7671 });
7672 }
7673 let response = {
7674 let bytes = common::to_bytes(body).await.unwrap_or_default();
7675 let encoded = common::to_string(&bytes);
7676 match serde_json::from_str(&encoded) {
7677 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7678 Err(error) => {
7679 dlg.response_json_decode_error(&encoded, &error);
7680 return Err(common::Error::JsonDecodeError(
7681 encoded.to_string(),
7682 error,
7683 ));
7684 }
7685 }
7686 };
7687
7688 dlg.finished(true);
7689 return Ok(response);
7690 }
7691 }
7692 }
7693 }
7694
7695 /// Required. The name of the `Registration` whose authorization code is being retrieved, in the format `projects/*/locations/*/registrations/*`.
7696 ///
7697 /// Sets the *registration* path property to the given value.
7698 ///
7699 /// Even though the property as already been set when instantiating this call,
7700 /// we provide this method for API completeness.
7701 pub fn registration(
7702 mut self,
7703 new_value: &str,
7704 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C> {
7705 self._registration = new_value.to_string();
7706 self
7707 }
7708 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7709 /// while executing the actual API request.
7710 ///
7711 /// ````text
7712 /// It should be used to handle progress information, and to implement a certain level of resilience.
7713 /// ````
7714 ///
7715 /// Sets the *delegate* property to the given value.
7716 pub fn delegate(
7717 mut self,
7718 new_value: &'a mut dyn common::Delegate,
7719 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C> {
7720 self._delegate = Some(new_value);
7721 self
7722 }
7723
7724 /// Set any additional parameter of the query string used in the request.
7725 /// It should be used to set parameters which are not yet available through their own
7726 /// setters.
7727 ///
7728 /// Please note that this method must not be used to set any of the known parameters
7729 /// which have their own setter method. If done anyway, the request will fail.
7730 ///
7731 /// # Additional Parameters
7732 ///
7733 /// * *$.xgafv* (query-string) - V1 error format.
7734 /// * *access_token* (query-string) - OAuth access token.
7735 /// * *alt* (query-string) - Data format for response.
7736 /// * *callback* (query-string) - JSONP
7737 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7738 /// * *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.
7739 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7740 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7741 /// * *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.
7742 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7743 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7744 pub fn param<T>(
7745 mut self,
7746 name: T,
7747 value: T,
7748 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C>
7749 where
7750 T: AsRef<str>,
7751 {
7752 self._additional_params
7753 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7754 self
7755 }
7756
7757 /// Identifies the authorization scope for the method you are building.
7758 ///
7759 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7760 /// [`Scope::CloudPlatform`].
7761 ///
7762 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7763 /// tokens for more than one scope.
7764 ///
7765 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7766 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7767 /// sufficient, a read-write scope will do as well.
7768 pub fn add_scope<St>(
7769 mut self,
7770 scope: St,
7771 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C>
7772 where
7773 St: AsRef<str>,
7774 {
7775 self._scopes.insert(String::from(scope.as_ref()));
7776 self
7777 }
7778 /// Identifies the authorization scope(s) for the method you are building.
7779 ///
7780 /// See [`Self::add_scope()`] for details.
7781 pub fn add_scopes<I, St>(
7782 mut self,
7783 scopes: I,
7784 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C>
7785 where
7786 I: IntoIterator<Item = St>,
7787 St: AsRef<str>,
7788 {
7789 self._scopes
7790 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7791 self
7792 }
7793
7794 /// Removes all scopes, and no default scope will be used either.
7795 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7796 /// for details).
7797 pub fn clear_scopes(
7798 mut self,
7799 ) -> ProjectLocationRegistrationRetrieveAuthorizationCodeCall<'a, C> {
7800 self._scopes.clear();
7801 self
7802 }
7803}
7804
7805/// Lists the DNS records from the Google Domains DNS zone for domains that use the deprecated `google_domains_dns` in the `Registration`'s `dns_settings`.
7806///
7807/// A builder for the *locations.registrations.retrieveGoogleDomainsDnsRecords* method supported by a *project* resource.
7808/// It is not used directly, but through a [`ProjectMethods`] instance.
7809///
7810/// # Example
7811///
7812/// Instantiate a resource method builder
7813///
7814/// ```test_harness,no_run
7815/// # extern crate hyper;
7816/// # extern crate hyper_rustls;
7817/// # extern crate google_domains1 as domains1;
7818/// # async fn dox() {
7819/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7820///
7821/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7822/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7823/// # .with_native_roots()
7824/// # .unwrap()
7825/// # .https_only()
7826/// # .enable_http2()
7827/// # .build();
7828///
7829/// # let executor = hyper_util::rt::TokioExecutor::new();
7830/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7831/// # secret,
7832/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7833/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7834/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7835/// # ),
7836/// # ).build().await.unwrap();
7837///
7838/// # let client = hyper_util::client::legacy::Client::builder(
7839/// # hyper_util::rt::TokioExecutor::new()
7840/// # )
7841/// # .build(
7842/// # hyper_rustls::HttpsConnectorBuilder::new()
7843/// # .with_native_roots()
7844/// # .unwrap()
7845/// # .https_or_http()
7846/// # .enable_http2()
7847/// # .build()
7848/// # );
7849/// # let mut hub = CloudDomains::new(client, auth);
7850/// // You can configure optional parameters by calling the respective setters at will, and
7851/// // execute the final call using `doit()`.
7852/// // Values shown here are possibly random and not representative !
7853/// let result = hub.projects().locations_registrations_retrieve_google_domains_dns_records("registration")
7854/// .page_token("est")
7855/// .page_size(-50)
7856/// .doit().await;
7857/// # }
7858/// ```
7859pub struct ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C>
7860where
7861 C: 'a,
7862{
7863 hub: &'a CloudDomains<C>,
7864 _registration: String,
7865 _page_token: Option<String>,
7866 _page_size: Option<i32>,
7867 _delegate: Option<&'a mut dyn common::Delegate>,
7868 _additional_params: HashMap<String, String>,
7869 _scopes: BTreeSet<String>,
7870}
7871
7872impl<'a, C> common::CallBuilder
7873 for ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C>
7874{
7875}
7876
7877impl<'a, C> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C>
7878where
7879 C: common::Connector,
7880{
7881 /// Perform the operation you have build so far.
7882 pub async fn doit(
7883 mut self,
7884 ) -> common::Result<(common::Response, RetrieveGoogleDomainsDnsRecordsResponse)> {
7885 use std::borrow::Cow;
7886 use std::io::{Read, Seek};
7887
7888 use common::{url::Params, ToParts};
7889 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7890
7891 let mut dd = common::DefaultDelegate;
7892 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7893 dlg.begin(common::MethodInfo {
7894 id: "domains.projects.locations.registrations.retrieveGoogleDomainsDnsRecords",
7895 http_method: hyper::Method::GET,
7896 });
7897
7898 for &field in ["alt", "registration", "pageToken", "pageSize"].iter() {
7899 if self._additional_params.contains_key(field) {
7900 dlg.finished(false);
7901 return Err(common::Error::FieldClash(field));
7902 }
7903 }
7904
7905 let mut params = Params::with_capacity(5 + self._additional_params.len());
7906 params.push("registration", self._registration);
7907 if let Some(value) = self._page_token.as_ref() {
7908 params.push("pageToken", value);
7909 }
7910 if let Some(value) = self._page_size.as_ref() {
7911 params.push("pageSize", value.to_string());
7912 }
7913
7914 params.extend(self._additional_params.iter());
7915
7916 params.push("alt", "json");
7917 let mut url =
7918 self.hub._base_url.clone() + "v1/{+registration}:retrieveGoogleDomainsDnsRecords";
7919 if self._scopes.is_empty() {
7920 self._scopes
7921 .insert(Scope::CloudPlatform.as_ref().to_string());
7922 }
7923
7924 #[allow(clippy::single_element_loop)]
7925 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
7926 url = params.uri_replacement(url, param_name, find_this, true);
7927 }
7928 {
7929 let to_remove = ["registration"];
7930 params.remove_params(&to_remove);
7931 }
7932
7933 let url = params.parse_with_url(&url);
7934
7935 loop {
7936 let token = match self
7937 .hub
7938 .auth
7939 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7940 .await
7941 {
7942 Ok(token) => token,
7943 Err(e) => match dlg.token(e) {
7944 Ok(token) => token,
7945 Err(e) => {
7946 dlg.finished(false);
7947 return Err(common::Error::MissingToken(e));
7948 }
7949 },
7950 };
7951 let mut req_result = {
7952 let client = &self.hub.client;
7953 dlg.pre_request();
7954 let mut req_builder = hyper::Request::builder()
7955 .method(hyper::Method::GET)
7956 .uri(url.as_str())
7957 .header(USER_AGENT, self.hub._user_agent.clone());
7958
7959 if let Some(token) = token.as_ref() {
7960 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7961 }
7962
7963 let request = req_builder
7964 .header(CONTENT_LENGTH, 0_u64)
7965 .body(common::to_body::<String>(None));
7966
7967 client.request(request.unwrap()).await
7968 };
7969
7970 match req_result {
7971 Err(err) => {
7972 if let common::Retry::After(d) = dlg.http_error(&err) {
7973 sleep(d).await;
7974 continue;
7975 }
7976 dlg.finished(false);
7977 return Err(common::Error::HttpError(err));
7978 }
7979 Ok(res) => {
7980 let (mut parts, body) = res.into_parts();
7981 let mut body = common::Body::new(body);
7982 if !parts.status.is_success() {
7983 let bytes = common::to_bytes(body).await.unwrap_or_default();
7984 let error = serde_json::from_str(&common::to_string(&bytes));
7985 let response = common::to_response(parts, bytes.into());
7986
7987 if let common::Retry::After(d) =
7988 dlg.http_failure(&response, error.as_ref().ok())
7989 {
7990 sleep(d).await;
7991 continue;
7992 }
7993
7994 dlg.finished(false);
7995
7996 return Err(match error {
7997 Ok(value) => common::Error::BadRequest(value),
7998 _ => common::Error::Failure(response),
7999 });
8000 }
8001 let response = {
8002 let bytes = common::to_bytes(body).await.unwrap_or_default();
8003 let encoded = common::to_string(&bytes);
8004 match serde_json::from_str(&encoded) {
8005 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8006 Err(error) => {
8007 dlg.response_json_decode_error(&encoded, &error);
8008 return Err(common::Error::JsonDecodeError(
8009 encoded.to_string(),
8010 error,
8011 ));
8012 }
8013 }
8014 };
8015
8016 dlg.finished(true);
8017 return Ok(response);
8018 }
8019 }
8020 }
8021 }
8022
8023 /// Required. The name of the `Registration` whose Google Domains DNS records details you are retrieving, in the format `projects/*/locations/*/registrations/*`.
8024 ///
8025 /// Sets the *registration* path property to the given value.
8026 ///
8027 /// Even though the property as already been set when instantiating this call,
8028 /// we provide this method for API completeness.
8029 pub fn registration(
8030 mut self,
8031 new_value: &str,
8032 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C> {
8033 self._registration = new_value.to_string();
8034 self
8035 }
8036 /// Optional. When set to the `next_page_token` from a prior response, provides the next page of results.
8037 ///
8038 /// Sets the *page token* query property to the given value.
8039 pub fn page_token(
8040 mut self,
8041 new_value: &str,
8042 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C> {
8043 self._page_token = Some(new_value.to_string());
8044 self
8045 }
8046 /// Optional. Maximum number of results to return.
8047 ///
8048 /// Sets the *page size* query property to the given value.
8049 pub fn page_size(
8050 mut self,
8051 new_value: i32,
8052 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C> {
8053 self._page_size = Some(new_value);
8054 self
8055 }
8056 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8057 /// while executing the actual API request.
8058 ///
8059 /// ````text
8060 /// It should be used to handle progress information, and to implement a certain level of resilience.
8061 /// ````
8062 ///
8063 /// Sets the *delegate* property to the given value.
8064 pub fn delegate(
8065 mut self,
8066 new_value: &'a mut dyn common::Delegate,
8067 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C> {
8068 self._delegate = Some(new_value);
8069 self
8070 }
8071
8072 /// Set any additional parameter of the query string used in the request.
8073 /// It should be used to set parameters which are not yet available through their own
8074 /// setters.
8075 ///
8076 /// Please note that this method must not be used to set any of the known parameters
8077 /// which have their own setter method. If done anyway, the request will fail.
8078 ///
8079 /// # Additional Parameters
8080 ///
8081 /// * *$.xgafv* (query-string) - V1 error format.
8082 /// * *access_token* (query-string) - OAuth access token.
8083 /// * *alt* (query-string) - Data format for response.
8084 /// * *callback* (query-string) - JSONP
8085 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8086 /// * *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.
8087 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8088 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8089 /// * *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.
8090 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8091 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8092 pub fn param<T>(
8093 mut self,
8094 name: T,
8095 value: T,
8096 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C>
8097 where
8098 T: AsRef<str>,
8099 {
8100 self._additional_params
8101 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8102 self
8103 }
8104
8105 /// Identifies the authorization scope for the method you are building.
8106 ///
8107 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8108 /// [`Scope::CloudPlatform`].
8109 ///
8110 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8111 /// tokens for more than one scope.
8112 ///
8113 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8114 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8115 /// sufficient, a read-write scope will do as well.
8116 pub fn add_scope<St>(
8117 mut self,
8118 scope: St,
8119 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C>
8120 where
8121 St: AsRef<str>,
8122 {
8123 self._scopes.insert(String::from(scope.as_ref()));
8124 self
8125 }
8126 /// Identifies the authorization scope(s) for the method you are building.
8127 ///
8128 /// See [`Self::add_scope()`] for details.
8129 pub fn add_scopes<I, St>(
8130 mut self,
8131 scopes: I,
8132 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C>
8133 where
8134 I: IntoIterator<Item = St>,
8135 St: AsRef<str>,
8136 {
8137 self._scopes
8138 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8139 self
8140 }
8141
8142 /// Removes all scopes, and no default scope will be used either.
8143 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8144 /// for details).
8145 pub fn clear_scopes(
8146 mut self,
8147 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsDnsRecordCall<'a, C> {
8148 self._scopes.clear();
8149 self
8150 }
8151}
8152
8153/// Lists the deprecated domain and email forwarding configurations you set up in the deprecated Google Domains UI. The configuration is present only for domains with the `google_domains_redirects_data_available` set to `true` in the `Registration`'s `dns_settings`. A forwarding configuration might not work correctly if required DNS records are not present in the domain's authoritative DNS Zone.
8154///
8155/// A builder for the *locations.registrations.retrieveGoogleDomainsForwardingConfig* method supported by a *project* resource.
8156/// It is not used directly, but through a [`ProjectMethods`] instance.
8157///
8158/// # Example
8159///
8160/// Instantiate a resource method builder
8161///
8162/// ```test_harness,no_run
8163/// # extern crate hyper;
8164/// # extern crate hyper_rustls;
8165/// # extern crate google_domains1 as domains1;
8166/// # async fn dox() {
8167/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8168///
8169/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8170/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8171/// # .with_native_roots()
8172/// # .unwrap()
8173/// # .https_only()
8174/// # .enable_http2()
8175/// # .build();
8176///
8177/// # let executor = hyper_util::rt::TokioExecutor::new();
8178/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8179/// # secret,
8180/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8181/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8182/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8183/// # ),
8184/// # ).build().await.unwrap();
8185///
8186/// # let client = hyper_util::client::legacy::Client::builder(
8187/// # hyper_util::rt::TokioExecutor::new()
8188/// # )
8189/// # .build(
8190/// # hyper_rustls::HttpsConnectorBuilder::new()
8191/// # .with_native_roots()
8192/// # .unwrap()
8193/// # .https_or_http()
8194/// # .enable_http2()
8195/// # .build()
8196/// # );
8197/// # let mut hub = CloudDomains::new(client, auth);
8198/// // You can configure optional parameters by calling the respective setters at will, and
8199/// // execute the final call using `doit()`.
8200/// // Values shown here are possibly random and not representative !
8201/// let result = hub.projects().locations_registrations_retrieve_google_domains_forwarding_config("registration")
8202/// .doit().await;
8203/// # }
8204/// ```
8205pub struct ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C>
8206where
8207 C: 'a,
8208{
8209 hub: &'a CloudDomains<C>,
8210 _registration: String,
8211 _delegate: Option<&'a mut dyn common::Delegate>,
8212 _additional_params: HashMap<String, String>,
8213 _scopes: BTreeSet<String>,
8214}
8215
8216impl<'a, C> common::CallBuilder
8217 for ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C>
8218{
8219}
8220
8221impl<'a, C> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C>
8222where
8223 C: common::Connector,
8224{
8225 /// Perform the operation you have build so far.
8226 pub async fn doit(
8227 mut self,
8228 ) -> common::Result<(
8229 common::Response,
8230 RetrieveGoogleDomainsForwardingConfigResponse,
8231 )> {
8232 use std::borrow::Cow;
8233 use std::io::{Read, Seek};
8234
8235 use common::{url::Params, ToParts};
8236 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8237
8238 let mut dd = common::DefaultDelegate;
8239 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8240 dlg.begin(common::MethodInfo {
8241 id: "domains.projects.locations.registrations.retrieveGoogleDomainsForwardingConfig",
8242 http_method: hyper::Method::GET,
8243 });
8244
8245 for &field in ["alt", "registration"].iter() {
8246 if self._additional_params.contains_key(field) {
8247 dlg.finished(false);
8248 return Err(common::Error::FieldClash(field));
8249 }
8250 }
8251
8252 let mut params = Params::with_capacity(3 + self._additional_params.len());
8253 params.push("registration", self._registration);
8254
8255 params.extend(self._additional_params.iter());
8256
8257 params.push("alt", "json");
8258 let mut url =
8259 self.hub._base_url.clone() + "v1/{+registration}:retrieveGoogleDomainsForwardingConfig";
8260 if self._scopes.is_empty() {
8261 self._scopes
8262 .insert(Scope::CloudPlatform.as_ref().to_string());
8263 }
8264
8265 #[allow(clippy::single_element_loop)]
8266 for &(find_this, param_name) in [("{+registration}", "registration")].iter() {
8267 url = params.uri_replacement(url, param_name, find_this, true);
8268 }
8269 {
8270 let to_remove = ["registration"];
8271 params.remove_params(&to_remove);
8272 }
8273
8274 let url = params.parse_with_url(&url);
8275
8276 loop {
8277 let token = match self
8278 .hub
8279 .auth
8280 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8281 .await
8282 {
8283 Ok(token) => token,
8284 Err(e) => match dlg.token(e) {
8285 Ok(token) => token,
8286 Err(e) => {
8287 dlg.finished(false);
8288 return Err(common::Error::MissingToken(e));
8289 }
8290 },
8291 };
8292 let mut req_result = {
8293 let client = &self.hub.client;
8294 dlg.pre_request();
8295 let mut req_builder = hyper::Request::builder()
8296 .method(hyper::Method::GET)
8297 .uri(url.as_str())
8298 .header(USER_AGENT, self.hub._user_agent.clone());
8299
8300 if let Some(token) = token.as_ref() {
8301 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8302 }
8303
8304 let request = req_builder
8305 .header(CONTENT_LENGTH, 0_u64)
8306 .body(common::to_body::<String>(None));
8307
8308 client.request(request.unwrap()).await
8309 };
8310
8311 match req_result {
8312 Err(err) => {
8313 if let common::Retry::After(d) = dlg.http_error(&err) {
8314 sleep(d).await;
8315 continue;
8316 }
8317 dlg.finished(false);
8318 return Err(common::Error::HttpError(err));
8319 }
8320 Ok(res) => {
8321 let (mut parts, body) = res.into_parts();
8322 let mut body = common::Body::new(body);
8323 if !parts.status.is_success() {
8324 let bytes = common::to_bytes(body).await.unwrap_or_default();
8325 let error = serde_json::from_str(&common::to_string(&bytes));
8326 let response = common::to_response(parts, bytes.into());
8327
8328 if let common::Retry::After(d) =
8329 dlg.http_failure(&response, error.as_ref().ok())
8330 {
8331 sleep(d).await;
8332 continue;
8333 }
8334
8335 dlg.finished(false);
8336
8337 return Err(match error {
8338 Ok(value) => common::Error::BadRequest(value),
8339 _ => common::Error::Failure(response),
8340 });
8341 }
8342 let response = {
8343 let bytes = common::to_bytes(body).await.unwrap_or_default();
8344 let encoded = common::to_string(&bytes);
8345 match serde_json::from_str(&encoded) {
8346 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8347 Err(error) => {
8348 dlg.response_json_decode_error(&encoded, &error);
8349 return Err(common::Error::JsonDecodeError(
8350 encoded.to_string(),
8351 error,
8352 ));
8353 }
8354 }
8355 };
8356
8357 dlg.finished(true);
8358 return Ok(response);
8359 }
8360 }
8361 }
8362 }
8363
8364 /// Required. The name of the `Registration` whose Google Domains forwarding configuration details are being retrieved, in the format `projects/*/locations/*/registrations/*`.
8365 ///
8366 /// Sets the *registration* path property to the given value.
8367 ///
8368 /// Even though the property as already been set when instantiating this call,
8369 /// we provide this method for API completeness.
8370 pub fn registration(
8371 mut self,
8372 new_value: &str,
8373 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C> {
8374 self._registration = new_value.to_string();
8375 self
8376 }
8377 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8378 /// while executing the actual API request.
8379 ///
8380 /// ````text
8381 /// It should be used to handle progress information, and to implement a certain level of resilience.
8382 /// ````
8383 ///
8384 /// Sets the *delegate* property to the given value.
8385 pub fn delegate(
8386 mut self,
8387 new_value: &'a mut dyn common::Delegate,
8388 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C> {
8389 self._delegate = Some(new_value);
8390 self
8391 }
8392
8393 /// Set any additional parameter of the query string used in the request.
8394 /// It should be used to set parameters which are not yet available through their own
8395 /// setters.
8396 ///
8397 /// Please note that this method must not be used to set any of the known parameters
8398 /// which have their own setter method. If done anyway, the request will fail.
8399 ///
8400 /// # Additional Parameters
8401 ///
8402 /// * *$.xgafv* (query-string) - V1 error format.
8403 /// * *access_token* (query-string) - OAuth access token.
8404 /// * *alt* (query-string) - Data format for response.
8405 /// * *callback* (query-string) - JSONP
8406 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8407 /// * *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.
8408 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8409 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8410 /// * *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.
8411 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8412 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8413 pub fn param<T>(
8414 mut self,
8415 name: T,
8416 value: T,
8417 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C>
8418 where
8419 T: AsRef<str>,
8420 {
8421 self._additional_params
8422 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8423 self
8424 }
8425
8426 /// Identifies the authorization scope for the method you are building.
8427 ///
8428 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8429 /// [`Scope::CloudPlatform`].
8430 ///
8431 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8432 /// tokens for more than one scope.
8433 ///
8434 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8435 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8436 /// sufficient, a read-write scope will do as well.
8437 pub fn add_scope<St>(
8438 mut self,
8439 scope: St,
8440 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C>
8441 where
8442 St: AsRef<str>,
8443 {
8444 self._scopes.insert(String::from(scope.as_ref()));
8445 self
8446 }
8447 /// Identifies the authorization scope(s) for the method you are building.
8448 ///
8449 /// See [`Self::add_scope()`] for details.
8450 pub fn add_scopes<I, St>(
8451 mut self,
8452 scopes: I,
8453 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C>
8454 where
8455 I: IntoIterator<Item = St>,
8456 St: AsRef<str>,
8457 {
8458 self._scopes
8459 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8460 self
8461 }
8462
8463 /// Removes all scopes, and no default scope will be used either.
8464 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8465 /// for details).
8466 pub fn clear_scopes(
8467 mut self,
8468 ) -> ProjectLocationRegistrationRetrieveGoogleDomainsForwardingConfigCall<'a, C> {
8469 self._scopes.clear();
8470 self
8471 }
8472}
8473
8474/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Lists domain names from [Google Domains](https://domains.google/) that can be imported to Cloud Domains using the `ImportDomain` method. Since individual users can own domains in Google Domains, the list of domains returned depends on the individual user making the call. Domains already managed by Cloud Domains are not returned.
8475///
8476/// A builder for the *locations.registrations.retrieveImportableDomains* method supported by a *project* resource.
8477/// It is not used directly, but through a [`ProjectMethods`] instance.
8478///
8479/// # Example
8480///
8481/// Instantiate a resource method builder
8482///
8483/// ```test_harness,no_run
8484/// # extern crate hyper;
8485/// # extern crate hyper_rustls;
8486/// # extern crate google_domains1 as domains1;
8487/// # async fn dox() {
8488/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8489///
8490/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8491/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8492/// # .with_native_roots()
8493/// # .unwrap()
8494/// # .https_only()
8495/// # .enable_http2()
8496/// # .build();
8497///
8498/// # let executor = hyper_util::rt::TokioExecutor::new();
8499/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8500/// # secret,
8501/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8502/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8503/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8504/// # ),
8505/// # ).build().await.unwrap();
8506///
8507/// # let client = hyper_util::client::legacy::Client::builder(
8508/// # hyper_util::rt::TokioExecutor::new()
8509/// # )
8510/// # .build(
8511/// # hyper_rustls::HttpsConnectorBuilder::new()
8512/// # .with_native_roots()
8513/// # .unwrap()
8514/// # .https_or_http()
8515/// # .enable_http2()
8516/// # .build()
8517/// # );
8518/// # let mut hub = CloudDomains::new(client, auth);
8519/// // You can configure optional parameters by calling the respective setters at will, and
8520/// // execute the final call using `doit()`.
8521/// // Values shown here are possibly random and not representative !
8522/// let result = hub.projects().locations_registrations_retrieve_importable_domains("location")
8523/// .page_token("gubergren")
8524/// .page_size(-17)
8525/// .doit().await;
8526/// # }
8527/// ```
8528pub struct ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C>
8529where
8530 C: 'a,
8531{
8532 hub: &'a CloudDomains<C>,
8533 _location: String,
8534 _page_token: Option<String>,
8535 _page_size: Option<i32>,
8536 _delegate: Option<&'a mut dyn common::Delegate>,
8537 _additional_params: HashMap<String, String>,
8538 _scopes: BTreeSet<String>,
8539}
8540
8541impl<'a, C> common::CallBuilder for ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {}
8542
8543impl<'a, C> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C>
8544where
8545 C: common::Connector,
8546{
8547 /// Perform the operation you have build so far.
8548 pub async fn doit(
8549 mut self,
8550 ) -> common::Result<(common::Response, RetrieveImportableDomainsResponse)> {
8551 use std::borrow::Cow;
8552 use std::io::{Read, Seek};
8553
8554 use common::{url::Params, ToParts};
8555 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8556
8557 let mut dd = common::DefaultDelegate;
8558 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8559 dlg.begin(common::MethodInfo {
8560 id: "domains.projects.locations.registrations.retrieveImportableDomains",
8561 http_method: hyper::Method::GET,
8562 });
8563
8564 for &field in ["alt", "location", "pageToken", "pageSize"].iter() {
8565 if self._additional_params.contains_key(field) {
8566 dlg.finished(false);
8567 return Err(common::Error::FieldClash(field));
8568 }
8569 }
8570
8571 let mut params = Params::with_capacity(5 + self._additional_params.len());
8572 params.push("location", self._location);
8573 if let Some(value) = self._page_token.as_ref() {
8574 params.push("pageToken", value);
8575 }
8576 if let Some(value) = self._page_size.as_ref() {
8577 params.push("pageSize", value.to_string());
8578 }
8579
8580 params.extend(self._additional_params.iter());
8581
8582 params.push("alt", "json");
8583 let mut url =
8584 self.hub._base_url.clone() + "v1/{+location}/registrations:retrieveImportableDomains";
8585 if self._scopes.is_empty() {
8586 self._scopes
8587 .insert(Scope::CloudPlatform.as_ref().to_string());
8588 }
8589
8590 #[allow(clippy::single_element_loop)]
8591 for &(find_this, param_name) in [("{+location}", "location")].iter() {
8592 url = params.uri_replacement(url, param_name, find_this, true);
8593 }
8594 {
8595 let to_remove = ["location"];
8596 params.remove_params(&to_remove);
8597 }
8598
8599 let url = params.parse_with_url(&url);
8600
8601 loop {
8602 let token = match self
8603 .hub
8604 .auth
8605 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8606 .await
8607 {
8608 Ok(token) => token,
8609 Err(e) => match dlg.token(e) {
8610 Ok(token) => token,
8611 Err(e) => {
8612 dlg.finished(false);
8613 return Err(common::Error::MissingToken(e));
8614 }
8615 },
8616 };
8617 let mut req_result = {
8618 let client = &self.hub.client;
8619 dlg.pre_request();
8620 let mut req_builder = hyper::Request::builder()
8621 .method(hyper::Method::GET)
8622 .uri(url.as_str())
8623 .header(USER_AGENT, self.hub._user_agent.clone());
8624
8625 if let Some(token) = token.as_ref() {
8626 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8627 }
8628
8629 let request = req_builder
8630 .header(CONTENT_LENGTH, 0_u64)
8631 .body(common::to_body::<String>(None));
8632
8633 client.request(request.unwrap()).await
8634 };
8635
8636 match req_result {
8637 Err(err) => {
8638 if let common::Retry::After(d) = dlg.http_error(&err) {
8639 sleep(d).await;
8640 continue;
8641 }
8642 dlg.finished(false);
8643 return Err(common::Error::HttpError(err));
8644 }
8645 Ok(res) => {
8646 let (mut parts, body) = res.into_parts();
8647 let mut body = common::Body::new(body);
8648 if !parts.status.is_success() {
8649 let bytes = common::to_bytes(body).await.unwrap_or_default();
8650 let error = serde_json::from_str(&common::to_string(&bytes));
8651 let response = common::to_response(parts, bytes.into());
8652
8653 if let common::Retry::After(d) =
8654 dlg.http_failure(&response, error.as_ref().ok())
8655 {
8656 sleep(d).await;
8657 continue;
8658 }
8659
8660 dlg.finished(false);
8661
8662 return Err(match error {
8663 Ok(value) => common::Error::BadRequest(value),
8664 _ => common::Error::Failure(response),
8665 });
8666 }
8667 let response = {
8668 let bytes = common::to_bytes(body).await.unwrap_or_default();
8669 let encoded = common::to_string(&bytes);
8670 match serde_json::from_str(&encoded) {
8671 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8672 Err(error) => {
8673 dlg.response_json_decode_error(&encoded, &error);
8674 return Err(common::Error::JsonDecodeError(
8675 encoded.to_string(),
8676 error,
8677 ));
8678 }
8679 }
8680 };
8681
8682 dlg.finished(true);
8683 return Ok(response);
8684 }
8685 }
8686 }
8687 }
8688
8689 /// Required. The location. Must be in the format `projects/*/locations/*`.
8690 ///
8691 /// Sets the *location* path property to the given value.
8692 ///
8693 /// Even though the property as already been set when instantiating this call,
8694 /// we provide this method for API completeness.
8695 pub fn location(
8696 mut self,
8697 new_value: &str,
8698 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {
8699 self._location = new_value.to_string();
8700 self
8701 }
8702 /// When set to the `next_page_token` from a prior response, provides the next page of results.
8703 ///
8704 /// Sets the *page token* query property to the given value.
8705 pub fn page_token(
8706 mut self,
8707 new_value: &str,
8708 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {
8709 self._page_token = Some(new_value.to_string());
8710 self
8711 }
8712 /// Maximum number of results to return.
8713 ///
8714 /// Sets the *page size* query property to the given value.
8715 pub fn page_size(
8716 mut self,
8717 new_value: i32,
8718 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {
8719 self._page_size = Some(new_value);
8720 self
8721 }
8722 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8723 /// while executing the actual API request.
8724 ///
8725 /// ````text
8726 /// It should be used to handle progress information, and to implement a certain level of resilience.
8727 /// ````
8728 ///
8729 /// Sets the *delegate* property to the given value.
8730 pub fn delegate(
8731 mut self,
8732 new_value: &'a mut dyn common::Delegate,
8733 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {
8734 self._delegate = Some(new_value);
8735 self
8736 }
8737
8738 /// Set any additional parameter of the query string used in the request.
8739 /// It should be used to set parameters which are not yet available through their own
8740 /// setters.
8741 ///
8742 /// Please note that this method must not be used to set any of the known parameters
8743 /// which have their own setter method. If done anyway, the request will fail.
8744 ///
8745 /// # Additional Parameters
8746 ///
8747 /// * *$.xgafv* (query-string) - V1 error format.
8748 /// * *access_token* (query-string) - OAuth access token.
8749 /// * *alt* (query-string) - Data format for response.
8750 /// * *callback* (query-string) - JSONP
8751 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8752 /// * *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.
8753 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8754 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8755 /// * *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.
8756 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8757 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8758 pub fn param<T>(
8759 mut self,
8760 name: T,
8761 value: T,
8762 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C>
8763 where
8764 T: AsRef<str>,
8765 {
8766 self._additional_params
8767 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8768 self
8769 }
8770
8771 /// Identifies the authorization scope for the method you are building.
8772 ///
8773 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8774 /// [`Scope::CloudPlatform`].
8775 ///
8776 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8777 /// tokens for more than one scope.
8778 ///
8779 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8780 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8781 /// sufficient, a read-write scope will do as well.
8782 pub fn add_scope<St>(
8783 mut self,
8784 scope: St,
8785 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C>
8786 where
8787 St: AsRef<str>,
8788 {
8789 self._scopes.insert(String::from(scope.as_ref()));
8790 self
8791 }
8792 /// Identifies the authorization scope(s) for the method you are building.
8793 ///
8794 /// See [`Self::add_scope()`] for details.
8795 pub fn add_scopes<I, St>(
8796 mut self,
8797 scopes: I,
8798 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C>
8799 where
8800 I: IntoIterator<Item = St>,
8801 St: AsRef<str>,
8802 {
8803 self._scopes
8804 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8805 self
8806 }
8807
8808 /// Removes all scopes, and no default scope will be used either.
8809 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8810 /// for details).
8811 pub fn clear_scopes(
8812 mut self,
8813 ) -> ProjectLocationRegistrationRetrieveImportableDomainCall<'a, C> {
8814 self._scopes.clear();
8815 self
8816 }
8817}
8818
8819/// Gets parameters needed to register a new domain name, including price and up-to-date availability. Use the returned values to call `RegisterDomain`.
8820///
8821/// A builder for the *locations.registrations.retrieveRegisterParameters* method supported by a *project* resource.
8822/// It is not used directly, but through a [`ProjectMethods`] instance.
8823///
8824/// # Example
8825///
8826/// Instantiate a resource method builder
8827///
8828/// ```test_harness,no_run
8829/// # extern crate hyper;
8830/// # extern crate hyper_rustls;
8831/// # extern crate google_domains1 as domains1;
8832/// # async fn dox() {
8833/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8834///
8835/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8836/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8837/// # .with_native_roots()
8838/// # .unwrap()
8839/// # .https_only()
8840/// # .enable_http2()
8841/// # .build();
8842///
8843/// # let executor = hyper_util::rt::TokioExecutor::new();
8844/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8845/// # secret,
8846/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8847/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8848/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8849/// # ),
8850/// # ).build().await.unwrap();
8851///
8852/// # let client = hyper_util::client::legacy::Client::builder(
8853/// # hyper_util::rt::TokioExecutor::new()
8854/// # )
8855/// # .build(
8856/// # hyper_rustls::HttpsConnectorBuilder::new()
8857/// # .with_native_roots()
8858/// # .unwrap()
8859/// # .https_or_http()
8860/// # .enable_http2()
8861/// # .build()
8862/// # );
8863/// # let mut hub = CloudDomains::new(client, auth);
8864/// // You can configure optional parameters by calling the respective setters at will, and
8865/// // execute the final call using `doit()`.
8866/// // Values shown here are possibly random and not representative !
8867/// let result = hub.projects().locations_registrations_retrieve_register_parameters("location")
8868/// .domain_name("Lorem")
8869/// .doit().await;
8870/// # }
8871/// ```
8872pub struct ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C>
8873where
8874 C: 'a,
8875{
8876 hub: &'a CloudDomains<C>,
8877 _location: String,
8878 _domain_name: Option<String>,
8879 _delegate: Option<&'a mut dyn common::Delegate>,
8880 _additional_params: HashMap<String, String>,
8881 _scopes: BTreeSet<String>,
8882}
8883
8884impl<'a, C> common::CallBuilder
8885 for ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C>
8886{
8887}
8888
8889impl<'a, C> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C>
8890where
8891 C: common::Connector,
8892{
8893 /// Perform the operation you have build so far.
8894 pub async fn doit(
8895 mut self,
8896 ) -> common::Result<(common::Response, RetrieveRegisterParametersResponse)> {
8897 use std::borrow::Cow;
8898 use std::io::{Read, Seek};
8899
8900 use common::{url::Params, ToParts};
8901 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8902
8903 let mut dd = common::DefaultDelegate;
8904 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8905 dlg.begin(common::MethodInfo {
8906 id: "domains.projects.locations.registrations.retrieveRegisterParameters",
8907 http_method: hyper::Method::GET,
8908 });
8909
8910 for &field in ["alt", "location", "domainName"].iter() {
8911 if self._additional_params.contains_key(field) {
8912 dlg.finished(false);
8913 return Err(common::Error::FieldClash(field));
8914 }
8915 }
8916
8917 let mut params = Params::with_capacity(4 + self._additional_params.len());
8918 params.push("location", self._location);
8919 if let Some(value) = self._domain_name.as_ref() {
8920 params.push("domainName", value);
8921 }
8922
8923 params.extend(self._additional_params.iter());
8924
8925 params.push("alt", "json");
8926 let mut url =
8927 self.hub._base_url.clone() + "v1/{+location}/registrations:retrieveRegisterParameters";
8928 if self._scopes.is_empty() {
8929 self._scopes
8930 .insert(Scope::CloudPlatform.as_ref().to_string());
8931 }
8932
8933 #[allow(clippy::single_element_loop)]
8934 for &(find_this, param_name) in [("{+location}", "location")].iter() {
8935 url = params.uri_replacement(url, param_name, find_this, true);
8936 }
8937 {
8938 let to_remove = ["location"];
8939 params.remove_params(&to_remove);
8940 }
8941
8942 let url = params.parse_with_url(&url);
8943
8944 loop {
8945 let token = match self
8946 .hub
8947 .auth
8948 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8949 .await
8950 {
8951 Ok(token) => token,
8952 Err(e) => match dlg.token(e) {
8953 Ok(token) => token,
8954 Err(e) => {
8955 dlg.finished(false);
8956 return Err(common::Error::MissingToken(e));
8957 }
8958 },
8959 };
8960 let mut req_result = {
8961 let client = &self.hub.client;
8962 dlg.pre_request();
8963 let mut req_builder = hyper::Request::builder()
8964 .method(hyper::Method::GET)
8965 .uri(url.as_str())
8966 .header(USER_AGENT, self.hub._user_agent.clone());
8967
8968 if let Some(token) = token.as_ref() {
8969 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8970 }
8971
8972 let request = req_builder
8973 .header(CONTENT_LENGTH, 0_u64)
8974 .body(common::to_body::<String>(None));
8975
8976 client.request(request.unwrap()).await
8977 };
8978
8979 match req_result {
8980 Err(err) => {
8981 if let common::Retry::After(d) = dlg.http_error(&err) {
8982 sleep(d).await;
8983 continue;
8984 }
8985 dlg.finished(false);
8986 return Err(common::Error::HttpError(err));
8987 }
8988 Ok(res) => {
8989 let (mut parts, body) = res.into_parts();
8990 let mut body = common::Body::new(body);
8991 if !parts.status.is_success() {
8992 let bytes = common::to_bytes(body).await.unwrap_or_default();
8993 let error = serde_json::from_str(&common::to_string(&bytes));
8994 let response = common::to_response(parts, bytes.into());
8995
8996 if let common::Retry::After(d) =
8997 dlg.http_failure(&response, error.as_ref().ok())
8998 {
8999 sleep(d).await;
9000 continue;
9001 }
9002
9003 dlg.finished(false);
9004
9005 return Err(match error {
9006 Ok(value) => common::Error::BadRequest(value),
9007 _ => common::Error::Failure(response),
9008 });
9009 }
9010 let response = {
9011 let bytes = common::to_bytes(body).await.unwrap_or_default();
9012 let encoded = common::to_string(&bytes);
9013 match serde_json::from_str(&encoded) {
9014 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9015 Err(error) => {
9016 dlg.response_json_decode_error(&encoded, &error);
9017 return Err(common::Error::JsonDecodeError(
9018 encoded.to_string(),
9019 error,
9020 ));
9021 }
9022 }
9023 };
9024
9025 dlg.finished(true);
9026 return Ok(response);
9027 }
9028 }
9029 }
9030 }
9031
9032 /// Required. The location. Must be in the format `projects/*/locations/*`.
9033 ///
9034 /// Sets the *location* path property to the given value.
9035 ///
9036 /// Even though the property as already been set when instantiating this call,
9037 /// we provide this method for API completeness.
9038 pub fn location(
9039 mut self,
9040 new_value: &str,
9041 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C> {
9042 self._location = new_value.to_string();
9043 self
9044 }
9045 /// Required. The domain name. Unicode domain names must be expressed in Punycode format.
9046 ///
9047 /// Sets the *domain name* query property to the given value.
9048 pub fn domain_name(
9049 mut self,
9050 new_value: &str,
9051 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C> {
9052 self._domain_name = Some(new_value.to_string());
9053 self
9054 }
9055 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9056 /// while executing the actual API request.
9057 ///
9058 /// ````text
9059 /// It should be used to handle progress information, and to implement a certain level of resilience.
9060 /// ````
9061 ///
9062 /// Sets the *delegate* property to the given value.
9063 pub fn delegate(
9064 mut self,
9065 new_value: &'a mut dyn common::Delegate,
9066 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C> {
9067 self._delegate = Some(new_value);
9068 self
9069 }
9070
9071 /// Set any additional parameter of the query string used in the request.
9072 /// It should be used to set parameters which are not yet available through their own
9073 /// setters.
9074 ///
9075 /// Please note that this method must not be used to set any of the known parameters
9076 /// which have their own setter method. If done anyway, the request will fail.
9077 ///
9078 /// # Additional Parameters
9079 ///
9080 /// * *$.xgafv* (query-string) - V1 error format.
9081 /// * *access_token* (query-string) - OAuth access token.
9082 /// * *alt* (query-string) - Data format for response.
9083 /// * *callback* (query-string) - JSONP
9084 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9085 /// * *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.
9086 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9087 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9088 /// * *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.
9089 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9090 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9091 pub fn param<T>(
9092 mut self,
9093 name: T,
9094 value: T,
9095 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C>
9096 where
9097 T: AsRef<str>,
9098 {
9099 self._additional_params
9100 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9101 self
9102 }
9103
9104 /// Identifies the authorization scope for the method you are building.
9105 ///
9106 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9107 /// [`Scope::CloudPlatform`].
9108 ///
9109 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9110 /// tokens for more than one scope.
9111 ///
9112 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9113 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9114 /// sufficient, a read-write scope will do as well.
9115 pub fn add_scope<St>(
9116 mut self,
9117 scope: St,
9118 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C>
9119 where
9120 St: AsRef<str>,
9121 {
9122 self._scopes.insert(String::from(scope.as_ref()));
9123 self
9124 }
9125 /// Identifies the authorization scope(s) for the method you are building.
9126 ///
9127 /// See [`Self::add_scope()`] for details.
9128 pub fn add_scopes<I, St>(
9129 mut self,
9130 scopes: I,
9131 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C>
9132 where
9133 I: IntoIterator<Item = St>,
9134 St: AsRef<str>,
9135 {
9136 self._scopes
9137 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9138 self
9139 }
9140
9141 /// Removes all scopes, and no default scope will be used either.
9142 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9143 /// for details).
9144 pub fn clear_scopes(
9145 mut self,
9146 ) -> ProjectLocationRegistrationRetrieveRegisterParameterCall<'a, C> {
9147 self._scopes.clear();
9148 self
9149 }
9150}
9151
9152/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Gets parameters needed to transfer a domain name from another registrar to Cloud Domains. For domains already managed by [Google Domains](https://domains.google/), use `ImportDomain` instead. Use the returned values to call `TransferDomain`.
9153///
9154/// A builder for the *locations.registrations.retrieveTransferParameters* method supported by a *project* resource.
9155/// It is not used directly, but through a [`ProjectMethods`] instance.
9156///
9157/// # Example
9158///
9159/// Instantiate a resource method builder
9160///
9161/// ```test_harness,no_run
9162/// # extern crate hyper;
9163/// # extern crate hyper_rustls;
9164/// # extern crate google_domains1 as domains1;
9165/// # async fn dox() {
9166/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9167///
9168/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9169/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9170/// # .with_native_roots()
9171/// # .unwrap()
9172/// # .https_only()
9173/// # .enable_http2()
9174/// # .build();
9175///
9176/// # let executor = hyper_util::rt::TokioExecutor::new();
9177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9178/// # secret,
9179/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9180/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9181/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9182/// # ),
9183/// # ).build().await.unwrap();
9184///
9185/// # let client = hyper_util::client::legacy::Client::builder(
9186/// # hyper_util::rt::TokioExecutor::new()
9187/// # )
9188/// # .build(
9189/// # hyper_rustls::HttpsConnectorBuilder::new()
9190/// # .with_native_roots()
9191/// # .unwrap()
9192/// # .https_or_http()
9193/// # .enable_http2()
9194/// # .build()
9195/// # );
9196/// # let mut hub = CloudDomains::new(client, auth);
9197/// // You can configure optional parameters by calling the respective setters at will, and
9198/// // execute the final call using `doit()`.
9199/// // Values shown here are possibly random and not representative !
9200/// let result = hub.projects().locations_registrations_retrieve_transfer_parameters("location")
9201/// .domain_name("labore")
9202/// .doit().await;
9203/// # }
9204/// ```
9205pub struct ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C>
9206where
9207 C: 'a,
9208{
9209 hub: &'a CloudDomains<C>,
9210 _location: String,
9211 _domain_name: Option<String>,
9212 _delegate: Option<&'a mut dyn common::Delegate>,
9213 _additional_params: HashMap<String, String>,
9214 _scopes: BTreeSet<String>,
9215}
9216
9217impl<'a, C> common::CallBuilder
9218 for ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C>
9219{
9220}
9221
9222impl<'a, C> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C>
9223where
9224 C: common::Connector,
9225{
9226 /// Perform the operation you have build so far.
9227 pub async fn doit(
9228 mut self,
9229 ) -> common::Result<(common::Response, RetrieveTransferParametersResponse)> {
9230 use std::borrow::Cow;
9231 use std::io::{Read, Seek};
9232
9233 use common::{url::Params, ToParts};
9234 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9235
9236 let mut dd = common::DefaultDelegate;
9237 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9238 dlg.begin(common::MethodInfo {
9239 id: "domains.projects.locations.registrations.retrieveTransferParameters",
9240 http_method: hyper::Method::GET,
9241 });
9242
9243 for &field in ["alt", "location", "domainName"].iter() {
9244 if self._additional_params.contains_key(field) {
9245 dlg.finished(false);
9246 return Err(common::Error::FieldClash(field));
9247 }
9248 }
9249
9250 let mut params = Params::with_capacity(4 + self._additional_params.len());
9251 params.push("location", self._location);
9252 if let Some(value) = self._domain_name.as_ref() {
9253 params.push("domainName", value);
9254 }
9255
9256 params.extend(self._additional_params.iter());
9257
9258 params.push("alt", "json");
9259 let mut url =
9260 self.hub._base_url.clone() + "v1/{+location}/registrations:retrieveTransferParameters";
9261 if self._scopes.is_empty() {
9262 self._scopes
9263 .insert(Scope::CloudPlatform.as_ref().to_string());
9264 }
9265
9266 #[allow(clippy::single_element_loop)]
9267 for &(find_this, param_name) in [("{+location}", "location")].iter() {
9268 url = params.uri_replacement(url, param_name, find_this, true);
9269 }
9270 {
9271 let to_remove = ["location"];
9272 params.remove_params(&to_remove);
9273 }
9274
9275 let url = params.parse_with_url(&url);
9276
9277 loop {
9278 let token = match self
9279 .hub
9280 .auth
9281 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9282 .await
9283 {
9284 Ok(token) => token,
9285 Err(e) => match dlg.token(e) {
9286 Ok(token) => token,
9287 Err(e) => {
9288 dlg.finished(false);
9289 return Err(common::Error::MissingToken(e));
9290 }
9291 },
9292 };
9293 let mut req_result = {
9294 let client = &self.hub.client;
9295 dlg.pre_request();
9296 let mut req_builder = hyper::Request::builder()
9297 .method(hyper::Method::GET)
9298 .uri(url.as_str())
9299 .header(USER_AGENT, self.hub._user_agent.clone());
9300
9301 if let Some(token) = token.as_ref() {
9302 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9303 }
9304
9305 let request = req_builder
9306 .header(CONTENT_LENGTH, 0_u64)
9307 .body(common::to_body::<String>(None));
9308
9309 client.request(request.unwrap()).await
9310 };
9311
9312 match req_result {
9313 Err(err) => {
9314 if let common::Retry::After(d) = dlg.http_error(&err) {
9315 sleep(d).await;
9316 continue;
9317 }
9318 dlg.finished(false);
9319 return Err(common::Error::HttpError(err));
9320 }
9321 Ok(res) => {
9322 let (mut parts, body) = res.into_parts();
9323 let mut body = common::Body::new(body);
9324 if !parts.status.is_success() {
9325 let bytes = common::to_bytes(body).await.unwrap_or_default();
9326 let error = serde_json::from_str(&common::to_string(&bytes));
9327 let response = common::to_response(parts, bytes.into());
9328
9329 if let common::Retry::After(d) =
9330 dlg.http_failure(&response, error.as_ref().ok())
9331 {
9332 sleep(d).await;
9333 continue;
9334 }
9335
9336 dlg.finished(false);
9337
9338 return Err(match error {
9339 Ok(value) => common::Error::BadRequest(value),
9340 _ => common::Error::Failure(response),
9341 });
9342 }
9343 let response = {
9344 let bytes = common::to_bytes(body).await.unwrap_or_default();
9345 let encoded = common::to_string(&bytes);
9346 match serde_json::from_str(&encoded) {
9347 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9348 Err(error) => {
9349 dlg.response_json_decode_error(&encoded, &error);
9350 return Err(common::Error::JsonDecodeError(
9351 encoded.to_string(),
9352 error,
9353 ));
9354 }
9355 }
9356 };
9357
9358 dlg.finished(true);
9359 return Ok(response);
9360 }
9361 }
9362 }
9363 }
9364
9365 /// Required. The location. Must be in the format `projects/*/locations/*`.
9366 ///
9367 /// Sets the *location* path property to the given value.
9368 ///
9369 /// Even though the property as already been set when instantiating this call,
9370 /// we provide this method for API completeness.
9371 pub fn location(
9372 mut self,
9373 new_value: &str,
9374 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C> {
9375 self._location = new_value.to_string();
9376 self
9377 }
9378 /// Required. The domain name. Unicode domain names must be expressed in Punycode format.
9379 ///
9380 /// Sets the *domain name* query property to the given value.
9381 pub fn domain_name(
9382 mut self,
9383 new_value: &str,
9384 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C> {
9385 self._domain_name = Some(new_value.to_string());
9386 self
9387 }
9388 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9389 /// while executing the actual API request.
9390 ///
9391 /// ````text
9392 /// It should be used to handle progress information, and to implement a certain level of resilience.
9393 /// ````
9394 ///
9395 /// Sets the *delegate* property to the given value.
9396 pub fn delegate(
9397 mut self,
9398 new_value: &'a mut dyn common::Delegate,
9399 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C> {
9400 self._delegate = Some(new_value);
9401 self
9402 }
9403
9404 /// Set any additional parameter of the query string used in the request.
9405 /// It should be used to set parameters which are not yet available through their own
9406 /// setters.
9407 ///
9408 /// Please note that this method must not be used to set any of the known parameters
9409 /// which have their own setter method. If done anyway, the request will fail.
9410 ///
9411 /// # Additional Parameters
9412 ///
9413 /// * *$.xgafv* (query-string) - V1 error format.
9414 /// * *access_token* (query-string) - OAuth access token.
9415 /// * *alt* (query-string) - Data format for response.
9416 /// * *callback* (query-string) - JSONP
9417 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9418 /// * *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.
9419 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9420 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9421 /// * *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.
9422 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9423 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9424 pub fn param<T>(
9425 mut self,
9426 name: T,
9427 value: T,
9428 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C>
9429 where
9430 T: AsRef<str>,
9431 {
9432 self._additional_params
9433 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9434 self
9435 }
9436
9437 /// Identifies the authorization scope for the method you are building.
9438 ///
9439 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9440 /// [`Scope::CloudPlatform`].
9441 ///
9442 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9443 /// tokens for more than one scope.
9444 ///
9445 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9446 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9447 /// sufficient, a read-write scope will do as well.
9448 pub fn add_scope<St>(
9449 mut self,
9450 scope: St,
9451 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C>
9452 where
9453 St: AsRef<str>,
9454 {
9455 self._scopes.insert(String::from(scope.as_ref()));
9456 self
9457 }
9458 /// Identifies the authorization scope(s) for the method you are building.
9459 ///
9460 /// See [`Self::add_scope()`] for details.
9461 pub fn add_scopes<I, St>(
9462 mut self,
9463 scopes: I,
9464 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C>
9465 where
9466 I: IntoIterator<Item = St>,
9467 St: AsRef<str>,
9468 {
9469 self._scopes
9470 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9471 self
9472 }
9473
9474 /// Removes all scopes, and no default scope will be used either.
9475 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9476 /// for details).
9477 pub fn clear_scopes(
9478 mut self,
9479 ) -> ProjectLocationRegistrationRetrieveTransferParameterCall<'a, C> {
9480 self._scopes.clear();
9481 self
9482 }
9483}
9484
9485/// Searches for available domain names similar to the provided query. Availability results from this method are approximate; call `RetrieveRegisterParameters` on a domain before registering to confirm availability.
9486///
9487/// A builder for the *locations.registrations.searchDomains* method supported by a *project* resource.
9488/// It is not used directly, but through a [`ProjectMethods`] instance.
9489///
9490/// # Example
9491///
9492/// Instantiate a resource method builder
9493///
9494/// ```test_harness,no_run
9495/// # extern crate hyper;
9496/// # extern crate hyper_rustls;
9497/// # extern crate google_domains1 as domains1;
9498/// # async fn dox() {
9499/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9500///
9501/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9502/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9503/// # .with_native_roots()
9504/// # .unwrap()
9505/// # .https_only()
9506/// # .enable_http2()
9507/// # .build();
9508///
9509/// # let executor = hyper_util::rt::TokioExecutor::new();
9510/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9511/// # secret,
9512/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9513/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9514/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9515/// # ),
9516/// # ).build().await.unwrap();
9517///
9518/// # let client = hyper_util::client::legacy::Client::builder(
9519/// # hyper_util::rt::TokioExecutor::new()
9520/// # )
9521/// # .build(
9522/// # hyper_rustls::HttpsConnectorBuilder::new()
9523/// # .with_native_roots()
9524/// # .unwrap()
9525/// # .https_or_http()
9526/// # .enable_http2()
9527/// # .build()
9528/// # );
9529/// # let mut hub = CloudDomains::new(client, auth);
9530/// // You can configure optional parameters by calling the respective setters at will, and
9531/// // execute the final call using `doit()`.
9532/// // Values shown here are possibly random and not representative !
9533/// let result = hub.projects().locations_registrations_search_domains("location")
9534/// .query("duo")
9535/// .doit().await;
9536/// # }
9537/// ```
9538pub struct ProjectLocationRegistrationSearchDomainCall<'a, C>
9539where
9540 C: 'a,
9541{
9542 hub: &'a CloudDomains<C>,
9543 _location: String,
9544 _query: Option<String>,
9545 _delegate: Option<&'a mut dyn common::Delegate>,
9546 _additional_params: HashMap<String, String>,
9547 _scopes: BTreeSet<String>,
9548}
9549
9550impl<'a, C> common::CallBuilder for ProjectLocationRegistrationSearchDomainCall<'a, C> {}
9551
9552impl<'a, C> ProjectLocationRegistrationSearchDomainCall<'a, C>
9553where
9554 C: common::Connector,
9555{
9556 /// Perform the operation you have build so far.
9557 pub async fn doit(mut self) -> common::Result<(common::Response, SearchDomainsResponse)> {
9558 use std::borrow::Cow;
9559 use std::io::{Read, Seek};
9560
9561 use common::{url::Params, ToParts};
9562 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9563
9564 let mut dd = common::DefaultDelegate;
9565 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9566 dlg.begin(common::MethodInfo {
9567 id: "domains.projects.locations.registrations.searchDomains",
9568 http_method: hyper::Method::GET,
9569 });
9570
9571 for &field in ["alt", "location", "query"].iter() {
9572 if self._additional_params.contains_key(field) {
9573 dlg.finished(false);
9574 return Err(common::Error::FieldClash(field));
9575 }
9576 }
9577
9578 let mut params = Params::with_capacity(4 + self._additional_params.len());
9579 params.push("location", self._location);
9580 if let Some(value) = self._query.as_ref() {
9581 params.push("query", value);
9582 }
9583
9584 params.extend(self._additional_params.iter());
9585
9586 params.push("alt", "json");
9587 let mut url = self.hub._base_url.clone() + "v1/{+location}/registrations:searchDomains";
9588 if self._scopes.is_empty() {
9589 self._scopes
9590 .insert(Scope::CloudPlatform.as_ref().to_string());
9591 }
9592
9593 #[allow(clippy::single_element_loop)]
9594 for &(find_this, param_name) in [("{+location}", "location")].iter() {
9595 url = params.uri_replacement(url, param_name, find_this, true);
9596 }
9597 {
9598 let to_remove = ["location"];
9599 params.remove_params(&to_remove);
9600 }
9601
9602 let url = params.parse_with_url(&url);
9603
9604 loop {
9605 let token = match self
9606 .hub
9607 .auth
9608 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9609 .await
9610 {
9611 Ok(token) => token,
9612 Err(e) => match dlg.token(e) {
9613 Ok(token) => token,
9614 Err(e) => {
9615 dlg.finished(false);
9616 return Err(common::Error::MissingToken(e));
9617 }
9618 },
9619 };
9620 let mut req_result = {
9621 let client = &self.hub.client;
9622 dlg.pre_request();
9623 let mut req_builder = hyper::Request::builder()
9624 .method(hyper::Method::GET)
9625 .uri(url.as_str())
9626 .header(USER_AGENT, self.hub._user_agent.clone());
9627
9628 if let Some(token) = token.as_ref() {
9629 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9630 }
9631
9632 let request = req_builder
9633 .header(CONTENT_LENGTH, 0_u64)
9634 .body(common::to_body::<String>(None));
9635
9636 client.request(request.unwrap()).await
9637 };
9638
9639 match req_result {
9640 Err(err) => {
9641 if let common::Retry::After(d) = dlg.http_error(&err) {
9642 sleep(d).await;
9643 continue;
9644 }
9645 dlg.finished(false);
9646 return Err(common::Error::HttpError(err));
9647 }
9648 Ok(res) => {
9649 let (mut parts, body) = res.into_parts();
9650 let mut body = common::Body::new(body);
9651 if !parts.status.is_success() {
9652 let bytes = common::to_bytes(body).await.unwrap_or_default();
9653 let error = serde_json::from_str(&common::to_string(&bytes));
9654 let response = common::to_response(parts, bytes.into());
9655
9656 if let common::Retry::After(d) =
9657 dlg.http_failure(&response, error.as_ref().ok())
9658 {
9659 sleep(d).await;
9660 continue;
9661 }
9662
9663 dlg.finished(false);
9664
9665 return Err(match error {
9666 Ok(value) => common::Error::BadRequest(value),
9667 _ => common::Error::Failure(response),
9668 });
9669 }
9670 let response = {
9671 let bytes = common::to_bytes(body).await.unwrap_or_default();
9672 let encoded = common::to_string(&bytes);
9673 match serde_json::from_str(&encoded) {
9674 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9675 Err(error) => {
9676 dlg.response_json_decode_error(&encoded, &error);
9677 return Err(common::Error::JsonDecodeError(
9678 encoded.to_string(),
9679 error,
9680 ));
9681 }
9682 }
9683 };
9684
9685 dlg.finished(true);
9686 return Ok(response);
9687 }
9688 }
9689 }
9690 }
9691
9692 /// Required. The location. Must be in the format `projects/*/locations/*`.
9693 ///
9694 /// Sets the *location* path property to the given value.
9695 ///
9696 /// Even though the property as already been set when instantiating this call,
9697 /// we provide this method for API completeness.
9698 pub fn location(
9699 mut self,
9700 new_value: &str,
9701 ) -> ProjectLocationRegistrationSearchDomainCall<'a, C> {
9702 self._location = new_value.to_string();
9703 self
9704 }
9705 /// Required. String used to search for available domain names.
9706 ///
9707 /// Sets the *query* query property to the given value.
9708 pub fn query(mut self, new_value: &str) -> ProjectLocationRegistrationSearchDomainCall<'a, C> {
9709 self._query = Some(new_value.to_string());
9710 self
9711 }
9712 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9713 /// while executing the actual API request.
9714 ///
9715 /// ````text
9716 /// It should be used to handle progress information, and to implement a certain level of resilience.
9717 /// ````
9718 ///
9719 /// Sets the *delegate* property to the given value.
9720 pub fn delegate(
9721 mut self,
9722 new_value: &'a mut dyn common::Delegate,
9723 ) -> ProjectLocationRegistrationSearchDomainCall<'a, C> {
9724 self._delegate = Some(new_value);
9725 self
9726 }
9727
9728 /// Set any additional parameter of the query string used in the request.
9729 /// It should be used to set parameters which are not yet available through their own
9730 /// setters.
9731 ///
9732 /// Please note that this method must not be used to set any of the known parameters
9733 /// which have their own setter method. If done anyway, the request will fail.
9734 ///
9735 /// # Additional Parameters
9736 ///
9737 /// * *$.xgafv* (query-string) - V1 error format.
9738 /// * *access_token* (query-string) - OAuth access token.
9739 /// * *alt* (query-string) - Data format for response.
9740 /// * *callback* (query-string) - JSONP
9741 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9742 /// * *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.
9743 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9744 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9745 /// * *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.
9746 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9747 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9748 pub fn param<T>(
9749 mut self,
9750 name: T,
9751 value: T,
9752 ) -> ProjectLocationRegistrationSearchDomainCall<'a, C>
9753 where
9754 T: AsRef<str>,
9755 {
9756 self._additional_params
9757 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9758 self
9759 }
9760
9761 /// Identifies the authorization scope for the method you are building.
9762 ///
9763 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9764 /// [`Scope::CloudPlatform`].
9765 ///
9766 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9767 /// tokens for more than one scope.
9768 ///
9769 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9770 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9771 /// sufficient, a read-write scope will do as well.
9772 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationSearchDomainCall<'a, C>
9773 where
9774 St: AsRef<str>,
9775 {
9776 self._scopes.insert(String::from(scope.as_ref()));
9777 self
9778 }
9779 /// Identifies the authorization scope(s) for the method you are building.
9780 ///
9781 /// See [`Self::add_scope()`] for details.
9782 pub fn add_scopes<I, St>(
9783 mut self,
9784 scopes: I,
9785 ) -> ProjectLocationRegistrationSearchDomainCall<'a, C>
9786 where
9787 I: IntoIterator<Item = St>,
9788 St: AsRef<str>,
9789 {
9790 self._scopes
9791 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9792 self
9793 }
9794
9795 /// Removes all scopes, and no default scope will be used either.
9796 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9797 /// for details).
9798 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationSearchDomainCall<'a, C> {
9799 self._scopes.clear();
9800 self
9801 }
9802}
9803
9804/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
9805///
9806/// A builder for the *locations.registrations.setIamPolicy* method supported by a *project* resource.
9807/// It is not used directly, but through a [`ProjectMethods`] instance.
9808///
9809/// # Example
9810///
9811/// Instantiate a resource method builder
9812///
9813/// ```test_harness,no_run
9814/// # extern crate hyper;
9815/// # extern crate hyper_rustls;
9816/// # extern crate google_domains1 as domains1;
9817/// use domains1::api::SetIamPolicyRequest;
9818/// # async fn dox() {
9819/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9820///
9821/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9822/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9823/// # .with_native_roots()
9824/// # .unwrap()
9825/// # .https_only()
9826/// # .enable_http2()
9827/// # .build();
9828///
9829/// # let executor = hyper_util::rt::TokioExecutor::new();
9830/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9831/// # secret,
9832/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9833/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9834/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9835/// # ),
9836/// # ).build().await.unwrap();
9837///
9838/// # let client = hyper_util::client::legacy::Client::builder(
9839/// # hyper_util::rt::TokioExecutor::new()
9840/// # )
9841/// # .build(
9842/// # hyper_rustls::HttpsConnectorBuilder::new()
9843/// # .with_native_roots()
9844/// # .unwrap()
9845/// # .https_or_http()
9846/// # .enable_http2()
9847/// # .build()
9848/// # );
9849/// # let mut hub = CloudDomains::new(client, auth);
9850/// // As the method needs a request, you would usually fill it with the desired information
9851/// // into the respective structure. Some of the parts shown here might not be applicable !
9852/// // Values shown here are possibly random and not representative !
9853/// let mut req = SetIamPolicyRequest::default();
9854///
9855/// // You can configure optional parameters by calling the respective setters at will, and
9856/// // execute the final call using `doit()`.
9857/// // Values shown here are possibly random and not representative !
9858/// let result = hub.projects().locations_registrations_set_iam_policy(req, "resource")
9859/// .doit().await;
9860/// # }
9861/// ```
9862pub struct ProjectLocationRegistrationSetIamPolicyCall<'a, C>
9863where
9864 C: 'a,
9865{
9866 hub: &'a CloudDomains<C>,
9867 _request: SetIamPolicyRequest,
9868 _resource: String,
9869 _delegate: Option<&'a mut dyn common::Delegate>,
9870 _additional_params: HashMap<String, String>,
9871 _scopes: BTreeSet<String>,
9872}
9873
9874impl<'a, C> common::CallBuilder for ProjectLocationRegistrationSetIamPolicyCall<'a, C> {}
9875
9876impl<'a, C> ProjectLocationRegistrationSetIamPolicyCall<'a, C>
9877where
9878 C: common::Connector,
9879{
9880 /// Perform the operation you have build so far.
9881 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
9882 use std::borrow::Cow;
9883 use std::io::{Read, Seek};
9884
9885 use common::{url::Params, ToParts};
9886 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9887
9888 let mut dd = common::DefaultDelegate;
9889 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9890 dlg.begin(common::MethodInfo {
9891 id: "domains.projects.locations.registrations.setIamPolicy",
9892 http_method: hyper::Method::POST,
9893 });
9894
9895 for &field in ["alt", "resource"].iter() {
9896 if self._additional_params.contains_key(field) {
9897 dlg.finished(false);
9898 return Err(common::Error::FieldClash(field));
9899 }
9900 }
9901
9902 let mut params = Params::with_capacity(4 + self._additional_params.len());
9903 params.push("resource", self._resource);
9904
9905 params.extend(self._additional_params.iter());
9906
9907 params.push("alt", "json");
9908 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
9909 if self._scopes.is_empty() {
9910 self._scopes
9911 .insert(Scope::CloudPlatform.as_ref().to_string());
9912 }
9913
9914 #[allow(clippy::single_element_loop)]
9915 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
9916 url = params.uri_replacement(url, param_name, find_this, true);
9917 }
9918 {
9919 let to_remove = ["resource"];
9920 params.remove_params(&to_remove);
9921 }
9922
9923 let url = params.parse_with_url(&url);
9924
9925 let mut json_mime_type = mime::APPLICATION_JSON;
9926 let mut request_value_reader = {
9927 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9928 common::remove_json_null_values(&mut value);
9929 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9930 serde_json::to_writer(&mut dst, &value).unwrap();
9931 dst
9932 };
9933 let request_size = request_value_reader
9934 .seek(std::io::SeekFrom::End(0))
9935 .unwrap();
9936 request_value_reader
9937 .seek(std::io::SeekFrom::Start(0))
9938 .unwrap();
9939
9940 loop {
9941 let token = match self
9942 .hub
9943 .auth
9944 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9945 .await
9946 {
9947 Ok(token) => token,
9948 Err(e) => match dlg.token(e) {
9949 Ok(token) => token,
9950 Err(e) => {
9951 dlg.finished(false);
9952 return Err(common::Error::MissingToken(e));
9953 }
9954 },
9955 };
9956 request_value_reader
9957 .seek(std::io::SeekFrom::Start(0))
9958 .unwrap();
9959 let mut req_result = {
9960 let client = &self.hub.client;
9961 dlg.pre_request();
9962 let mut req_builder = hyper::Request::builder()
9963 .method(hyper::Method::POST)
9964 .uri(url.as_str())
9965 .header(USER_AGENT, self.hub._user_agent.clone());
9966
9967 if let Some(token) = token.as_ref() {
9968 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9969 }
9970
9971 let request = req_builder
9972 .header(CONTENT_TYPE, json_mime_type.to_string())
9973 .header(CONTENT_LENGTH, request_size as u64)
9974 .body(common::to_body(
9975 request_value_reader.get_ref().clone().into(),
9976 ));
9977
9978 client.request(request.unwrap()).await
9979 };
9980
9981 match req_result {
9982 Err(err) => {
9983 if let common::Retry::After(d) = dlg.http_error(&err) {
9984 sleep(d).await;
9985 continue;
9986 }
9987 dlg.finished(false);
9988 return Err(common::Error::HttpError(err));
9989 }
9990 Ok(res) => {
9991 let (mut parts, body) = res.into_parts();
9992 let mut body = common::Body::new(body);
9993 if !parts.status.is_success() {
9994 let bytes = common::to_bytes(body).await.unwrap_or_default();
9995 let error = serde_json::from_str(&common::to_string(&bytes));
9996 let response = common::to_response(parts, bytes.into());
9997
9998 if let common::Retry::After(d) =
9999 dlg.http_failure(&response, error.as_ref().ok())
10000 {
10001 sleep(d).await;
10002 continue;
10003 }
10004
10005 dlg.finished(false);
10006
10007 return Err(match error {
10008 Ok(value) => common::Error::BadRequest(value),
10009 _ => common::Error::Failure(response),
10010 });
10011 }
10012 let response = {
10013 let bytes = common::to_bytes(body).await.unwrap_or_default();
10014 let encoded = common::to_string(&bytes);
10015 match serde_json::from_str(&encoded) {
10016 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10017 Err(error) => {
10018 dlg.response_json_decode_error(&encoded, &error);
10019 return Err(common::Error::JsonDecodeError(
10020 encoded.to_string(),
10021 error,
10022 ));
10023 }
10024 }
10025 };
10026
10027 dlg.finished(true);
10028 return Ok(response);
10029 }
10030 }
10031 }
10032 }
10033
10034 ///
10035 /// Sets the *request* property to the given value.
10036 ///
10037 /// Even though the property as already been set when instantiating this call,
10038 /// we provide this method for API completeness.
10039 pub fn request(
10040 mut self,
10041 new_value: SetIamPolicyRequest,
10042 ) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C> {
10043 self._request = new_value;
10044 self
10045 }
10046 /// 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.
10047 ///
10048 /// Sets the *resource* path property to the given value.
10049 ///
10050 /// Even though the property as already been set when instantiating this call,
10051 /// we provide this method for API completeness.
10052 pub fn resource(
10053 mut self,
10054 new_value: &str,
10055 ) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C> {
10056 self._resource = new_value.to_string();
10057 self
10058 }
10059 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10060 /// while executing the actual API request.
10061 ///
10062 /// ````text
10063 /// It should be used to handle progress information, and to implement a certain level of resilience.
10064 /// ````
10065 ///
10066 /// Sets the *delegate* property to the given value.
10067 pub fn delegate(
10068 mut self,
10069 new_value: &'a mut dyn common::Delegate,
10070 ) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C> {
10071 self._delegate = Some(new_value);
10072 self
10073 }
10074
10075 /// Set any additional parameter of the query string used in the request.
10076 /// It should be used to set parameters which are not yet available through their own
10077 /// setters.
10078 ///
10079 /// Please note that this method must not be used to set any of the known parameters
10080 /// which have their own setter method. If done anyway, the request will fail.
10081 ///
10082 /// # Additional Parameters
10083 ///
10084 /// * *$.xgafv* (query-string) - V1 error format.
10085 /// * *access_token* (query-string) - OAuth access token.
10086 /// * *alt* (query-string) - Data format for response.
10087 /// * *callback* (query-string) - JSONP
10088 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10089 /// * *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.
10090 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10091 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10092 /// * *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.
10093 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10094 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10095 pub fn param<T>(
10096 mut self,
10097 name: T,
10098 value: T,
10099 ) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C>
10100 where
10101 T: AsRef<str>,
10102 {
10103 self._additional_params
10104 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10105 self
10106 }
10107
10108 /// Identifies the authorization scope for the method you are building.
10109 ///
10110 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10111 /// [`Scope::CloudPlatform`].
10112 ///
10113 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10114 /// tokens for more than one scope.
10115 ///
10116 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10117 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10118 /// sufficient, a read-write scope will do as well.
10119 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C>
10120 where
10121 St: AsRef<str>,
10122 {
10123 self._scopes.insert(String::from(scope.as_ref()));
10124 self
10125 }
10126 /// Identifies the authorization scope(s) for the method you are building.
10127 ///
10128 /// See [`Self::add_scope()`] for details.
10129 pub fn add_scopes<I, St>(
10130 mut self,
10131 scopes: I,
10132 ) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C>
10133 where
10134 I: IntoIterator<Item = St>,
10135 St: AsRef<str>,
10136 {
10137 self._scopes
10138 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10139 self
10140 }
10141
10142 /// Removes all scopes, and no default scope will be used either.
10143 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10144 /// for details).
10145 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationSetIamPolicyCall<'a, C> {
10146 self._scopes.clear();
10147 self
10148 }
10149}
10150
10151/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return 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.
10152///
10153/// A builder for the *locations.registrations.testIamPermissions* method supported by a *project* resource.
10154/// It is not used directly, but through a [`ProjectMethods`] instance.
10155///
10156/// # Example
10157///
10158/// Instantiate a resource method builder
10159///
10160/// ```test_harness,no_run
10161/// # extern crate hyper;
10162/// # extern crate hyper_rustls;
10163/// # extern crate google_domains1 as domains1;
10164/// use domains1::api::TestIamPermissionsRequest;
10165/// # async fn dox() {
10166/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10167///
10168/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10169/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10170/// # .with_native_roots()
10171/// # .unwrap()
10172/// # .https_only()
10173/// # .enable_http2()
10174/// # .build();
10175///
10176/// # let executor = hyper_util::rt::TokioExecutor::new();
10177/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10178/// # secret,
10179/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10180/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10181/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10182/// # ),
10183/// # ).build().await.unwrap();
10184///
10185/// # let client = hyper_util::client::legacy::Client::builder(
10186/// # hyper_util::rt::TokioExecutor::new()
10187/// # )
10188/// # .build(
10189/// # hyper_rustls::HttpsConnectorBuilder::new()
10190/// # .with_native_roots()
10191/// # .unwrap()
10192/// # .https_or_http()
10193/// # .enable_http2()
10194/// # .build()
10195/// # );
10196/// # let mut hub = CloudDomains::new(client, auth);
10197/// // As the method needs a request, you would usually fill it with the desired information
10198/// // into the respective structure. Some of the parts shown here might not be applicable !
10199/// // Values shown here are possibly random and not representative !
10200/// let mut req = TestIamPermissionsRequest::default();
10201///
10202/// // You can configure optional parameters by calling the respective setters at will, and
10203/// // execute the final call using `doit()`.
10204/// // Values shown here are possibly random and not representative !
10205/// let result = hub.projects().locations_registrations_test_iam_permissions(req, "resource")
10206/// .doit().await;
10207/// # }
10208/// ```
10209pub struct ProjectLocationRegistrationTestIamPermissionCall<'a, C>
10210where
10211 C: 'a,
10212{
10213 hub: &'a CloudDomains<C>,
10214 _request: TestIamPermissionsRequest,
10215 _resource: String,
10216 _delegate: Option<&'a mut dyn common::Delegate>,
10217 _additional_params: HashMap<String, String>,
10218 _scopes: BTreeSet<String>,
10219}
10220
10221impl<'a, C> common::CallBuilder for ProjectLocationRegistrationTestIamPermissionCall<'a, C> {}
10222
10223impl<'a, C> ProjectLocationRegistrationTestIamPermissionCall<'a, C>
10224where
10225 C: common::Connector,
10226{
10227 /// Perform the operation you have build so far.
10228 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
10229 use std::borrow::Cow;
10230 use std::io::{Read, Seek};
10231
10232 use common::{url::Params, ToParts};
10233 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10234
10235 let mut dd = common::DefaultDelegate;
10236 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10237 dlg.begin(common::MethodInfo {
10238 id: "domains.projects.locations.registrations.testIamPermissions",
10239 http_method: hyper::Method::POST,
10240 });
10241
10242 for &field in ["alt", "resource"].iter() {
10243 if self._additional_params.contains_key(field) {
10244 dlg.finished(false);
10245 return Err(common::Error::FieldClash(field));
10246 }
10247 }
10248
10249 let mut params = Params::with_capacity(4 + self._additional_params.len());
10250 params.push("resource", self._resource);
10251
10252 params.extend(self._additional_params.iter());
10253
10254 params.push("alt", "json");
10255 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
10256 if self._scopes.is_empty() {
10257 self._scopes
10258 .insert(Scope::CloudPlatform.as_ref().to_string());
10259 }
10260
10261 #[allow(clippy::single_element_loop)]
10262 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10263 url = params.uri_replacement(url, param_name, find_this, true);
10264 }
10265 {
10266 let to_remove = ["resource"];
10267 params.remove_params(&to_remove);
10268 }
10269
10270 let url = params.parse_with_url(&url);
10271
10272 let mut json_mime_type = mime::APPLICATION_JSON;
10273 let mut request_value_reader = {
10274 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10275 common::remove_json_null_values(&mut value);
10276 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10277 serde_json::to_writer(&mut dst, &value).unwrap();
10278 dst
10279 };
10280 let request_size = request_value_reader
10281 .seek(std::io::SeekFrom::End(0))
10282 .unwrap();
10283 request_value_reader
10284 .seek(std::io::SeekFrom::Start(0))
10285 .unwrap();
10286
10287 loop {
10288 let token = match self
10289 .hub
10290 .auth
10291 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10292 .await
10293 {
10294 Ok(token) => token,
10295 Err(e) => match dlg.token(e) {
10296 Ok(token) => token,
10297 Err(e) => {
10298 dlg.finished(false);
10299 return Err(common::Error::MissingToken(e));
10300 }
10301 },
10302 };
10303 request_value_reader
10304 .seek(std::io::SeekFrom::Start(0))
10305 .unwrap();
10306 let mut req_result = {
10307 let client = &self.hub.client;
10308 dlg.pre_request();
10309 let mut req_builder = hyper::Request::builder()
10310 .method(hyper::Method::POST)
10311 .uri(url.as_str())
10312 .header(USER_AGENT, self.hub._user_agent.clone());
10313
10314 if let Some(token) = token.as_ref() {
10315 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10316 }
10317
10318 let request = req_builder
10319 .header(CONTENT_TYPE, json_mime_type.to_string())
10320 .header(CONTENT_LENGTH, request_size as u64)
10321 .body(common::to_body(
10322 request_value_reader.get_ref().clone().into(),
10323 ));
10324
10325 client.request(request.unwrap()).await
10326 };
10327
10328 match req_result {
10329 Err(err) => {
10330 if let common::Retry::After(d) = dlg.http_error(&err) {
10331 sleep(d).await;
10332 continue;
10333 }
10334 dlg.finished(false);
10335 return Err(common::Error::HttpError(err));
10336 }
10337 Ok(res) => {
10338 let (mut parts, body) = res.into_parts();
10339 let mut body = common::Body::new(body);
10340 if !parts.status.is_success() {
10341 let bytes = common::to_bytes(body).await.unwrap_or_default();
10342 let error = serde_json::from_str(&common::to_string(&bytes));
10343 let response = common::to_response(parts, bytes.into());
10344
10345 if let common::Retry::After(d) =
10346 dlg.http_failure(&response, error.as_ref().ok())
10347 {
10348 sleep(d).await;
10349 continue;
10350 }
10351
10352 dlg.finished(false);
10353
10354 return Err(match error {
10355 Ok(value) => common::Error::BadRequest(value),
10356 _ => common::Error::Failure(response),
10357 });
10358 }
10359 let response = {
10360 let bytes = common::to_bytes(body).await.unwrap_or_default();
10361 let encoded = common::to_string(&bytes);
10362 match serde_json::from_str(&encoded) {
10363 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10364 Err(error) => {
10365 dlg.response_json_decode_error(&encoded, &error);
10366 return Err(common::Error::JsonDecodeError(
10367 encoded.to_string(),
10368 error,
10369 ));
10370 }
10371 }
10372 };
10373
10374 dlg.finished(true);
10375 return Ok(response);
10376 }
10377 }
10378 }
10379 }
10380
10381 ///
10382 /// Sets the *request* property to the given value.
10383 ///
10384 /// Even though the property as already been set when instantiating this call,
10385 /// we provide this method for API completeness.
10386 pub fn request(
10387 mut self,
10388 new_value: TestIamPermissionsRequest,
10389 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C> {
10390 self._request = new_value;
10391 self
10392 }
10393 /// 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.
10394 ///
10395 /// Sets the *resource* path property to the given value.
10396 ///
10397 /// Even though the property as already been set when instantiating this call,
10398 /// we provide this method for API completeness.
10399 pub fn resource(
10400 mut self,
10401 new_value: &str,
10402 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C> {
10403 self._resource = new_value.to_string();
10404 self
10405 }
10406 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10407 /// while executing the actual API request.
10408 ///
10409 /// ````text
10410 /// It should be used to handle progress information, and to implement a certain level of resilience.
10411 /// ````
10412 ///
10413 /// Sets the *delegate* property to the given value.
10414 pub fn delegate(
10415 mut self,
10416 new_value: &'a mut dyn common::Delegate,
10417 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C> {
10418 self._delegate = Some(new_value);
10419 self
10420 }
10421
10422 /// Set any additional parameter of the query string used in the request.
10423 /// It should be used to set parameters which are not yet available through their own
10424 /// setters.
10425 ///
10426 /// Please note that this method must not be used to set any of the known parameters
10427 /// which have their own setter method. If done anyway, the request will fail.
10428 ///
10429 /// # Additional Parameters
10430 ///
10431 /// * *$.xgafv* (query-string) - V1 error format.
10432 /// * *access_token* (query-string) - OAuth access token.
10433 /// * *alt* (query-string) - Data format for response.
10434 /// * *callback* (query-string) - JSONP
10435 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10436 /// * *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.
10437 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10438 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10439 /// * *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.
10440 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10441 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10442 pub fn param<T>(
10443 mut self,
10444 name: T,
10445 value: T,
10446 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C>
10447 where
10448 T: AsRef<str>,
10449 {
10450 self._additional_params
10451 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10452 self
10453 }
10454
10455 /// Identifies the authorization scope for the method you are building.
10456 ///
10457 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10458 /// [`Scope::CloudPlatform`].
10459 ///
10460 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10461 /// tokens for more than one scope.
10462 ///
10463 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10464 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10465 /// sufficient, a read-write scope will do as well.
10466 pub fn add_scope<St>(
10467 mut self,
10468 scope: St,
10469 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C>
10470 where
10471 St: AsRef<str>,
10472 {
10473 self._scopes.insert(String::from(scope.as_ref()));
10474 self
10475 }
10476 /// Identifies the authorization scope(s) for the method you are building.
10477 ///
10478 /// See [`Self::add_scope()`] for details.
10479 pub fn add_scopes<I, St>(
10480 mut self,
10481 scopes: I,
10482 ) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C>
10483 where
10484 I: IntoIterator<Item = St>,
10485 St: AsRef<str>,
10486 {
10487 self._scopes
10488 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10489 self
10490 }
10491
10492 /// Removes all scopes, and no default scope will be used either.
10493 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10494 /// for details).
10495 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationTestIamPermissionCall<'a, C> {
10496 self._scopes.clear();
10497 self
10498 }
10499}
10500
10501/// Deprecated: For more information, see [Cloud Domains feature deprecation](https://cloud.google.com/domains/docs/deprecations/feature-deprecations) Transfers a domain name from another registrar to Cloud Domains. For domains already managed by [Google Domains](https://domains.google/), use `ImportDomain` instead. Before calling this method, go to the domain's current registrar to unlock the domain for transfer and retrieve the domain's transfer authorization code. Then call `RetrieveTransferParameters` to confirm that the domain is unlocked and to get values needed to build a call to this method. A successful call creates a `Registration` resource in state `TRANSFER_PENDING`. It can take several days to complete the transfer process. The registrant can often speed up this process by approving the transfer through the current registrar, either by clicking a link in an email from the registrar or by visiting the registrar's website. A few minutes after transfer approval, the resource transitions to state `ACTIVE`, indicating that the transfer was successful. If the transfer is rejected or the request expires without being approved, the resource can end up in state `TRANSFER_FAILED`. If transfer fails, you can safely delete the resource and retry the transfer.
10502///
10503/// A builder for the *locations.registrations.transfer* method supported by a *project* resource.
10504/// It is not used directly, but through a [`ProjectMethods`] instance.
10505///
10506/// # Example
10507///
10508/// Instantiate a resource method builder
10509///
10510/// ```test_harness,no_run
10511/// # extern crate hyper;
10512/// # extern crate hyper_rustls;
10513/// # extern crate google_domains1 as domains1;
10514/// use domains1::api::TransferDomainRequest;
10515/// # async fn dox() {
10516/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10517///
10518/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10519/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10520/// # .with_native_roots()
10521/// # .unwrap()
10522/// # .https_only()
10523/// # .enable_http2()
10524/// # .build();
10525///
10526/// # let executor = hyper_util::rt::TokioExecutor::new();
10527/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10528/// # secret,
10529/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10530/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10531/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10532/// # ),
10533/// # ).build().await.unwrap();
10534///
10535/// # let client = hyper_util::client::legacy::Client::builder(
10536/// # hyper_util::rt::TokioExecutor::new()
10537/// # )
10538/// # .build(
10539/// # hyper_rustls::HttpsConnectorBuilder::new()
10540/// # .with_native_roots()
10541/// # .unwrap()
10542/// # .https_or_http()
10543/// # .enable_http2()
10544/// # .build()
10545/// # );
10546/// # let mut hub = CloudDomains::new(client, auth);
10547/// // As the method needs a request, you would usually fill it with the desired information
10548/// // into the respective structure. Some of the parts shown here might not be applicable !
10549/// // Values shown here are possibly random and not representative !
10550/// let mut req = TransferDomainRequest::default();
10551///
10552/// // You can configure optional parameters by calling the respective setters at will, and
10553/// // execute the final call using `doit()`.
10554/// // Values shown here are possibly random and not representative !
10555/// let result = hub.projects().locations_registrations_transfer(req, "parent")
10556/// .doit().await;
10557/// # }
10558/// ```
10559pub struct ProjectLocationRegistrationTransferCall<'a, C>
10560where
10561 C: 'a,
10562{
10563 hub: &'a CloudDomains<C>,
10564 _request: TransferDomainRequest,
10565 _parent: String,
10566 _delegate: Option<&'a mut dyn common::Delegate>,
10567 _additional_params: HashMap<String, String>,
10568 _scopes: BTreeSet<String>,
10569}
10570
10571impl<'a, C> common::CallBuilder for ProjectLocationRegistrationTransferCall<'a, C> {}
10572
10573impl<'a, C> ProjectLocationRegistrationTransferCall<'a, C>
10574where
10575 C: common::Connector,
10576{
10577 /// Perform the operation you have build so far.
10578 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10579 use std::borrow::Cow;
10580 use std::io::{Read, Seek};
10581
10582 use common::{url::Params, ToParts};
10583 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10584
10585 let mut dd = common::DefaultDelegate;
10586 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10587 dlg.begin(common::MethodInfo {
10588 id: "domains.projects.locations.registrations.transfer",
10589 http_method: hyper::Method::POST,
10590 });
10591
10592 for &field in ["alt", "parent"].iter() {
10593 if self._additional_params.contains_key(field) {
10594 dlg.finished(false);
10595 return Err(common::Error::FieldClash(field));
10596 }
10597 }
10598
10599 let mut params = Params::with_capacity(4 + self._additional_params.len());
10600 params.push("parent", self._parent);
10601
10602 params.extend(self._additional_params.iter());
10603
10604 params.push("alt", "json");
10605 let mut url = self.hub._base_url.clone() + "v1/{+parent}/registrations:transfer";
10606 if self._scopes.is_empty() {
10607 self._scopes
10608 .insert(Scope::CloudPlatform.as_ref().to_string());
10609 }
10610
10611 #[allow(clippy::single_element_loop)]
10612 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10613 url = params.uri_replacement(url, param_name, find_this, true);
10614 }
10615 {
10616 let to_remove = ["parent"];
10617 params.remove_params(&to_remove);
10618 }
10619
10620 let url = params.parse_with_url(&url);
10621
10622 let mut json_mime_type = mime::APPLICATION_JSON;
10623 let mut request_value_reader = {
10624 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10625 common::remove_json_null_values(&mut value);
10626 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10627 serde_json::to_writer(&mut dst, &value).unwrap();
10628 dst
10629 };
10630 let request_size = request_value_reader
10631 .seek(std::io::SeekFrom::End(0))
10632 .unwrap();
10633 request_value_reader
10634 .seek(std::io::SeekFrom::Start(0))
10635 .unwrap();
10636
10637 loop {
10638 let token = match self
10639 .hub
10640 .auth
10641 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10642 .await
10643 {
10644 Ok(token) => token,
10645 Err(e) => match dlg.token(e) {
10646 Ok(token) => token,
10647 Err(e) => {
10648 dlg.finished(false);
10649 return Err(common::Error::MissingToken(e));
10650 }
10651 },
10652 };
10653 request_value_reader
10654 .seek(std::io::SeekFrom::Start(0))
10655 .unwrap();
10656 let mut req_result = {
10657 let client = &self.hub.client;
10658 dlg.pre_request();
10659 let mut req_builder = hyper::Request::builder()
10660 .method(hyper::Method::POST)
10661 .uri(url.as_str())
10662 .header(USER_AGENT, self.hub._user_agent.clone());
10663
10664 if let Some(token) = token.as_ref() {
10665 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10666 }
10667
10668 let request = req_builder
10669 .header(CONTENT_TYPE, json_mime_type.to_string())
10670 .header(CONTENT_LENGTH, request_size as u64)
10671 .body(common::to_body(
10672 request_value_reader.get_ref().clone().into(),
10673 ));
10674
10675 client.request(request.unwrap()).await
10676 };
10677
10678 match req_result {
10679 Err(err) => {
10680 if let common::Retry::After(d) = dlg.http_error(&err) {
10681 sleep(d).await;
10682 continue;
10683 }
10684 dlg.finished(false);
10685 return Err(common::Error::HttpError(err));
10686 }
10687 Ok(res) => {
10688 let (mut parts, body) = res.into_parts();
10689 let mut body = common::Body::new(body);
10690 if !parts.status.is_success() {
10691 let bytes = common::to_bytes(body).await.unwrap_or_default();
10692 let error = serde_json::from_str(&common::to_string(&bytes));
10693 let response = common::to_response(parts, bytes.into());
10694
10695 if let common::Retry::After(d) =
10696 dlg.http_failure(&response, error.as_ref().ok())
10697 {
10698 sleep(d).await;
10699 continue;
10700 }
10701
10702 dlg.finished(false);
10703
10704 return Err(match error {
10705 Ok(value) => common::Error::BadRequest(value),
10706 _ => common::Error::Failure(response),
10707 });
10708 }
10709 let response = {
10710 let bytes = common::to_bytes(body).await.unwrap_or_default();
10711 let encoded = common::to_string(&bytes);
10712 match serde_json::from_str(&encoded) {
10713 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10714 Err(error) => {
10715 dlg.response_json_decode_error(&encoded, &error);
10716 return Err(common::Error::JsonDecodeError(
10717 encoded.to_string(),
10718 error,
10719 ));
10720 }
10721 }
10722 };
10723
10724 dlg.finished(true);
10725 return Ok(response);
10726 }
10727 }
10728 }
10729 }
10730
10731 ///
10732 /// Sets the *request* property to the given value.
10733 ///
10734 /// Even though the property as already been set when instantiating this call,
10735 /// we provide this method for API completeness.
10736 pub fn request(
10737 mut self,
10738 new_value: TransferDomainRequest,
10739 ) -> ProjectLocationRegistrationTransferCall<'a, C> {
10740 self._request = new_value;
10741 self
10742 }
10743 /// Required. The parent resource of the `Registration`. Must be in the format `projects/*/locations/*`.
10744 ///
10745 /// Sets the *parent* path property to the given value.
10746 ///
10747 /// Even though the property as already been set when instantiating this call,
10748 /// we provide this method for API completeness.
10749 pub fn parent(mut self, new_value: &str) -> ProjectLocationRegistrationTransferCall<'a, C> {
10750 self._parent = new_value.to_string();
10751 self
10752 }
10753 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10754 /// while executing the actual API request.
10755 ///
10756 /// ````text
10757 /// It should be used to handle progress information, and to implement a certain level of resilience.
10758 /// ````
10759 ///
10760 /// Sets the *delegate* property to the given value.
10761 pub fn delegate(
10762 mut self,
10763 new_value: &'a mut dyn common::Delegate,
10764 ) -> ProjectLocationRegistrationTransferCall<'a, C> {
10765 self._delegate = Some(new_value);
10766 self
10767 }
10768
10769 /// Set any additional parameter of the query string used in the request.
10770 /// It should be used to set parameters which are not yet available through their own
10771 /// setters.
10772 ///
10773 /// Please note that this method must not be used to set any of the known parameters
10774 /// which have their own setter method. If done anyway, the request will fail.
10775 ///
10776 /// # Additional Parameters
10777 ///
10778 /// * *$.xgafv* (query-string) - V1 error format.
10779 /// * *access_token* (query-string) - OAuth access token.
10780 /// * *alt* (query-string) - Data format for response.
10781 /// * *callback* (query-string) - JSONP
10782 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10783 /// * *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.
10784 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10785 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10786 /// * *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.
10787 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10788 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10789 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationRegistrationTransferCall<'a, C>
10790 where
10791 T: AsRef<str>,
10792 {
10793 self._additional_params
10794 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10795 self
10796 }
10797
10798 /// Identifies the authorization scope for the method you are building.
10799 ///
10800 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10801 /// [`Scope::CloudPlatform`].
10802 ///
10803 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10804 /// tokens for more than one scope.
10805 ///
10806 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10807 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10808 /// sufficient, a read-write scope will do as well.
10809 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationRegistrationTransferCall<'a, C>
10810 where
10811 St: AsRef<str>,
10812 {
10813 self._scopes.insert(String::from(scope.as_ref()));
10814 self
10815 }
10816 /// Identifies the authorization scope(s) for the method you are building.
10817 ///
10818 /// See [`Self::add_scope()`] for details.
10819 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationRegistrationTransferCall<'a, C>
10820 where
10821 I: IntoIterator<Item = St>,
10822 St: AsRef<str>,
10823 {
10824 self._scopes
10825 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10826 self
10827 }
10828
10829 /// Removes all scopes, and no default scope will be used either.
10830 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10831 /// for details).
10832 pub fn clear_scopes(mut self) -> ProjectLocationRegistrationTransferCall<'a, C> {
10833 self._scopes.clear();
10834 self
10835 }
10836}
10837
10838/// Gets information about a location.
10839///
10840/// A builder for the *locations.get* method supported by a *project* resource.
10841/// It is not used directly, but through a [`ProjectMethods`] instance.
10842///
10843/// # Example
10844///
10845/// Instantiate a resource method builder
10846///
10847/// ```test_harness,no_run
10848/// # extern crate hyper;
10849/// # extern crate hyper_rustls;
10850/// # extern crate google_domains1 as domains1;
10851/// # async fn dox() {
10852/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10853///
10854/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10855/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10856/// # .with_native_roots()
10857/// # .unwrap()
10858/// # .https_only()
10859/// # .enable_http2()
10860/// # .build();
10861///
10862/// # let executor = hyper_util::rt::TokioExecutor::new();
10863/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10864/// # secret,
10865/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10866/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10867/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10868/// # ),
10869/// # ).build().await.unwrap();
10870///
10871/// # let client = hyper_util::client::legacy::Client::builder(
10872/// # hyper_util::rt::TokioExecutor::new()
10873/// # )
10874/// # .build(
10875/// # hyper_rustls::HttpsConnectorBuilder::new()
10876/// # .with_native_roots()
10877/// # .unwrap()
10878/// # .https_or_http()
10879/// # .enable_http2()
10880/// # .build()
10881/// # );
10882/// # let mut hub = CloudDomains::new(client, auth);
10883/// // You can configure optional parameters by calling the respective setters at will, and
10884/// // execute the final call using `doit()`.
10885/// // Values shown here are possibly random and not representative !
10886/// let result = hub.projects().locations_get("name")
10887/// .doit().await;
10888/// # }
10889/// ```
10890pub struct ProjectLocationGetCall<'a, C>
10891where
10892 C: 'a,
10893{
10894 hub: &'a CloudDomains<C>,
10895 _name: String,
10896 _delegate: Option<&'a mut dyn common::Delegate>,
10897 _additional_params: HashMap<String, String>,
10898 _scopes: BTreeSet<String>,
10899}
10900
10901impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
10902
10903impl<'a, C> ProjectLocationGetCall<'a, C>
10904where
10905 C: common::Connector,
10906{
10907 /// Perform the operation you have build so far.
10908 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
10909 use std::borrow::Cow;
10910 use std::io::{Read, Seek};
10911
10912 use common::{url::Params, ToParts};
10913 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10914
10915 let mut dd = common::DefaultDelegate;
10916 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10917 dlg.begin(common::MethodInfo {
10918 id: "domains.projects.locations.get",
10919 http_method: hyper::Method::GET,
10920 });
10921
10922 for &field in ["alt", "name"].iter() {
10923 if self._additional_params.contains_key(field) {
10924 dlg.finished(false);
10925 return Err(common::Error::FieldClash(field));
10926 }
10927 }
10928
10929 let mut params = Params::with_capacity(3 + self._additional_params.len());
10930 params.push("name", self._name);
10931
10932 params.extend(self._additional_params.iter());
10933
10934 params.push("alt", "json");
10935 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10936 if self._scopes.is_empty() {
10937 self._scopes
10938 .insert(Scope::CloudPlatform.as_ref().to_string());
10939 }
10940
10941 #[allow(clippy::single_element_loop)]
10942 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10943 url = params.uri_replacement(url, param_name, find_this, true);
10944 }
10945 {
10946 let to_remove = ["name"];
10947 params.remove_params(&to_remove);
10948 }
10949
10950 let url = params.parse_with_url(&url);
10951
10952 loop {
10953 let token = match self
10954 .hub
10955 .auth
10956 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10957 .await
10958 {
10959 Ok(token) => token,
10960 Err(e) => match dlg.token(e) {
10961 Ok(token) => token,
10962 Err(e) => {
10963 dlg.finished(false);
10964 return Err(common::Error::MissingToken(e));
10965 }
10966 },
10967 };
10968 let mut req_result = {
10969 let client = &self.hub.client;
10970 dlg.pre_request();
10971 let mut req_builder = hyper::Request::builder()
10972 .method(hyper::Method::GET)
10973 .uri(url.as_str())
10974 .header(USER_AGENT, self.hub._user_agent.clone());
10975
10976 if let Some(token) = token.as_ref() {
10977 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10978 }
10979
10980 let request = req_builder
10981 .header(CONTENT_LENGTH, 0_u64)
10982 .body(common::to_body::<String>(None));
10983
10984 client.request(request.unwrap()).await
10985 };
10986
10987 match req_result {
10988 Err(err) => {
10989 if let common::Retry::After(d) = dlg.http_error(&err) {
10990 sleep(d).await;
10991 continue;
10992 }
10993 dlg.finished(false);
10994 return Err(common::Error::HttpError(err));
10995 }
10996 Ok(res) => {
10997 let (mut parts, body) = res.into_parts();
10998 let mut body = common::Body::new(body);
10999 if !parts.status.is_success() {
11000 let bytes = common::to_bytes(body).await.unwrap_or_default();
11001 let error = serde_json::from_str(&common::to_string(&bytes));
11002 let response = common::to_response(parts, bytes.into());
11003
11004 if let common::Retry::After(d) =
11005 dlg.http_failure(&response, error.as_ref().ok())
11006 {
11007 sleep(d).await;
11008 continue;
11009 }
11010
11011 dlg.finished(false);
11012
11013 return Err(match error {
11014 Ok(value) => common::Error::BadRequest(value),
11015 _ => common::Error::Failure(response),
11016 });
11017 }
11018 let response = {
11019 let bytes = common::to_bytes(body).await.unwrap_or_default();
11020 let encoded = common::to_string(&bytes);
11021 match serde_json::from_str(&encoded) {
11022 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11023 Err(error) => {
11024 dlg.response_json_decode_error(&encoded, &error);
11025 return Err(common::Error::JsonDecodeError(
11026 encoded.to_string(),
11027 error,
11028 ));
11029 }
11030 }
11031 };
11032
11033 dlg.finished(true);
11034 return Ok(response);
11035 }
11036 }
11037 }
11038 }
11039
11040 /// Resource name for the location.
11041 ///
11042 /// Sets the *name* path property to the given value.
11043 ///
11044 /// Even though the property as already been set when instantiating this call,
11045 /// we provide this method for API completeness.
11046 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
11047 self._name = new_value.to_string();
11048 self
11049 }
11050 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11051 /// while executing the actual API request.
11052 ///
11053 /// ````text
11054 /// It should be used to handle progress information, and to implement a certain level of resilience.
11055 /// ````
11056 ///
11057 /// Sets the *delegate* property to the given value.
11058 pub fn delegate(
11059 mut self,
11060 new_value: &'a mut dyn common::Delegate,
11061 ) -> ProjectLocationGetCall<'a, C> {
11062 self._delegate = Some(new_value);
11063 self
11064 }
11065
11066 /// Set any additional parameter of the query string used in the request.
11067 /// It should be used to set parameters which are not yet available through their own
11068 /// setters.
11069 ///
11070 /// Please note that this method must not be used to set any of the known parameters
11071 /// which have their own setter method. If done anyway, the request will fail.
11072 ///
11073 /// # Additional Parameters
11074 ///
11075 /// * *$.xgafv* (query-string) - V1 error format.
11076 /// * *access_token* (query-string) - OAuth access token.
11077 /// * *alt* (query-string) - Data format for response.
11078 /// * *callback* (query-string) - JSONP
11079 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11080 /// * *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.
11081 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11082 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11083 /// * *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.
11084 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11085 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11086 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
11087 where
11088 T: AsRef<str>,
11089 {
11090 self._additional_params
11091 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11092 self
11093 }
11094
11095 /// Identifies the authorization scope for the method you are building.
11096 ///
11097 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11098 /// [`Scope::CloudPlatform`].
11099 ///
11100 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11101 /// tokens for more than one scope.
11102 ///
11103 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11104 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11105 /// sufficient, a read-write scope will do as well.
11106 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
11107 where
11108 St: AsRef<str>,
11109 {
11110 self._scopes.insert(String::from(scope.as_ref()));
11111 self
11112 }
11113 /// Identifies the authorization scope(s) for the method you are building.
11114 ///
11115 /// See [`Self::add_scope()`] for details.
11116 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
11117 where
11118 I: IntoIterator<Item = St>,
11119 St: AsRef<str>,
11120 {
11121 self._scopes
11122 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11123 self
11124 }
11125
11126 /// Removes all scopes, and no default scope will be used either.
11127 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11128 /// for details).
11129 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
11130 self._scopes.clear();
11131 self
11132 }
11133}
11134
11135/// Lists information about the supported locations for this service.
11136///
11137/// A builder for the *locations.list* method supported by a *project* resource.
11138/// It is not used directly, but through a [`ProjectMethods`] instance.
11139///
11140/// # Example
11141///
11142/// Instantiate a resource method builder
11143///
11144/// ```test_harness,no_run
11145/// # extern crate hyper;
11146/// # extern crate hyper_rustls;
11147/// # extern crate google_domains1 as domains1;
11148/// # async fn dox() {
11149/// # use domains1::{CloudDomains, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11150///
11151/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11152/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11153/// # .with_native_roots()
11154/// # .unwrap()
11155/// # .https_only()
11156/// # .enable_http2()
11157/// # .build();
11158///
11159/// # let executor = hyper_util::rt::TokioExecutor::new();
11160/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11161/// # secret,
11162/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11163/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11164/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11165/// # ),
11166/// # ).build().await.unwrap();
11167///
11168/// # let client = hyper_util::client::legacy::Client::builder(
11169/// # hyper_util::rt::TokioExecutor::new()
11170/// # )
11171/// # .build(
11172/// # hyper_rustls::HttpsConnectorBuilder::new()
11173/// # .with_native_roots()
11174/// # .unwrap()
11175/// # .https_or_http()
11176/// # .enable_http2()
11177/// # .build()
11178/// # );
11179/// # let mut hub = CloudDomains::new(client, auth);
11180/// // You can configure optional parameters by calling the respective setters at will, and
11181/// // execute the final call using `doit()`.
11182/// // Values shown here are possibly random and not representative !
11183/// let result = hub.projects().locations_list("name")
11184/// .page_token("sed")
11185/// .page_size(-24)
11186/// .filter("et")
11187/// .add_extra_location_types("vero")
11188/// .doit().await;
11189/// # }
11190/// ```
11191pub struct ProjectLocationListCall<'a, C>
11192where
11193 C: 'a,
11194{
11195 hub: &'a CloudDomains<C>,
11196 _name: String,
11197 _page_token: Option<String>,
11198 _page_size: Option<i32>,
11199 _filter: Option<String>,
11200 _extra_location_types: Vec<String>,
11201 _delegate: Option<&'a mut dyn common::Delegate>,
11202 _additional_params: HashMap<String, String>,
11203 _scopes: BTreeSet<String>,
11204}
11205
11206impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
11207
11208impl<'a, C> ProjectLocationListCall<'a, C>
11209where
11210 C: common::Connector,
11211{
11212 /// Perform the operation you have build so far.
11213 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
11214 use std::borrow::Cow;
11215 use std::io::{Read, Seek};
11216
11217 use common::{url::Params, ToParts};
11218 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11219
11220 let mut dd = common::DefaultDelegate;
11221 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11222 dlg.begin(common::MethodInfo {
11223 id: "domains.projects.locations.list",
11224 http_method: hyper::Method::GET,
11225 });
11226
11227 for &field in [
11228 "alt",
11229 "name",
11230 "pageToken",
11231 "pageSize",
11232 "filter",
11233 "extraLocationTypes",
11234 ]
11235 .iter()
11236 {
11237 if self._additional_params.contains_key(field) {
11238 dlg.finished(false);
11239 return Err(common::Error::FieldClash(field));
11240 }
11241 }
11242
11243 let mut params = Params::with_capacity(7 + self._additional_params.len());
11244 params.push("name", self._name);
11245 if let Some(value) = self._page_token.as_ref() {
11246 params.push("pageToken", value);
11247 }
11248 if let Some(value) = self._page_size.as_ref() {
11249 params.push("pageSize", value.to_string());
11250 }
11251 if let Some(value) = self._filter.as_ref() {
11252 params.push("filter", value);
11253 }
11254 if !self._extra_location_types.is_empty() {
11255 for f in self._extra_location_types.iter() {
11256 params.push("extraLocationTypes", f);
11257 }
11258 }
11259
11260 params.extend(self._additional_params.iter());
11261
11262 params.push("alt", "json");
11263 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
11264 if self._scopes.is_empty() {
11265 self._scopes
11266 .insert(Scope::CloudPlatform.as_ref().to_string());
11267 }
11268
11269 #[allow(clippy::single_element_loop)]
11270 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11271 url = params.uri_replacement(url, param_name, find_this, true);
11272 }
11273 {
11274 let to_remove = ["name"];
11275 params.remove_params(&to_remove);
11276 }
11277
11278 let url = params.parse_with_url(&url);
11279
11280 loop {
11281 let token = match self
11282 .hub
11283 .auth
11284 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11285 .await
11286 {
11287 Ok(token) => token,
11288 Err(e) => match dlg.token(e) {
11289 Ok(token) => token,
11290 Err(e) => {
11291 dlg.finished(false);
11292 return Err(common::Error::MissingToken(e));
11293 }
11294 },
11295 };
11296 let mut req_result = {
11297 let client = &self.hub.client;
11298 dlg.pre_request();
11299 let mut req_builder = hyper::Request::builder()
11300 .method(hyper::Method::GET)
11301 .uri(url.as_str())
11302 .header(USER_AGENT, self.hub._user_agent.clone());
11303
11304 if let Some(token) = token.as_ref() {
11305 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11306 }
11307
11308 let request = req_builder
11309 .header(CONTENT_LENGTH, 0_u64)
11310 .body(common::to_body::<String>(None));
11311
11312 client.request(request.unwrap()).await
11313 };
11314
11315 match req_result {
11316 Err(err) => {
11317 if let common::Retry::After(d) = dlg.http_error(&err) {
11318 sleep(d).await;
11319 continue;
11320 }
11321 dlg.finished(false);
11322 return Err(common::Error::HttpError(err));
11323 }
11324 Ok(res) => {
11325 let (mut parts, body) = res.into_parts();
11326 let mut body = common::Body::new(body);
11327 if !parts.status.is_success() {
11328 let bytes = common::to_bytes(body).await.unwrap_or_default();
11329 let error = serde_json::from_str(&common::to_string(&bytes));
11330 let response = common::to_response(parts, bytes.into());
11331
11332 if let common::Retry::After(d) =
11333 dlg.http_failure(&response, error.as_ref().ok())
11334 {
11335 sleep(d).await;
11336 continue;
11337 }
11338
11339 dlg.finished(false);
11340
11341 return Err(match error {
11342 Ok(value) => common::Error::BadRequest(value),
11343 _ => common::Error::Failure(response),
11344 });
11345 }
11346 let response = {
11347 let bytes = common::to_bytes(body).await.unwrap_or_default();
11348 let encoded = common::to_string(&bytes);
11349 match serde_json::from_str(&encoded) {
11350 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11351 Err(error) => {
11352 dlg.response_json_decode_error(&encoded, &error);
11353 return Err(common::Error::JsonDecodeError(
11354 encoded.to_string(),
11355 error,
11356 ));
11357 }
11358 }
11359 };
11360
11361 dlg.finished(true);
11362 return Ok(response);
11363 }
11364 }
11365 }
11366 }
11367
11368 /// The resource that owns the locations collection, if applicable.
11369 ///
11370 /// Sets the *name* path property to the given value.
11371 ///
11372 /// Even though the property as already been set when instantiating this call,
11373 /// we provide this method for API completeness.
11374 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11375 self._name = new_value.to_string();
11376 self
11377 }
11378 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
11379 ///
11380 /// Sets the *page token* query property to the given value.
11381 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11382 self._page_token = Some(new_value.to_string());
11383 self
11384 }
11385 /// The maximum number of results to return. If not set, the service selects a default.
11386 ///
11387 /// Sets the *page size* query property to the given value.
11388 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
11389 self._page_size = Some(new_value);
11390 self
11391 }
11392 /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
11393 ///
11394 /// Sets the *filter* query property to the given value.
11395 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11396 self._filter = Some(new_value.to_string());
11397 self
11398 }
11399 /// Optional. Unless explicitly documented otherwise, don't use this unsupported field which is primarily intended for internal usage.
11400 ///
11401 /// Append the given value to the *extra location types* query property.
11402 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
11403 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
11404 self._extra_location_types.push(new_value.to_string());
11405 self
11406 }
11407 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11408 /// while executing the actual API request.
11409 ///
11410 /// ````text
11411 /// It should be used to handle progress information, and to implement a certain level of resilience.
11412 /// ````
11413 ///
11414 /// Sets the *delegate* property to the given value.
11415 pub fn delegate(
11416 mut self,
11417 new_value: &'a mut dyn common::Delegate,
11418 ) -> ProjectLocationListCall<'a, C> {
11419 self._delegate = Some(new_value);
11420 self
11421 }
11422
11423 /// Set any additional parameter of the query string used in the request.
11424 /// It should be used to set parameters which are not yet available through their own
11425 /// setters.
11426 ///
11427 /// Please note that this method must not be used to set any of the known parameters
11428 /// which have their own setter method. If done anyway, the request will fail.
11429 ///
11430 /// # Additional Parameters
11431 ///
11432 /// * *$.xgafv* (query-string) - V1 error format.
11433 /// * *access_token* (query-string) - OAuth access token.
11434 /// * *alt* (query-string) - Data format for response.
11435 /// * *callback* (query-string) - JSONP
11436 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11437 /// * *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.
11438 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11439 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11440 /// * *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.
11441 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11442 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11443 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
11444 where
11445 T: AsRef<str>,
11446 {
11447 self._additional_params
11448 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11449 self
11450 }
11451
11452 /// Identifies the authorization scope for the method you are building.
11453 ///
11454 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11455 /// [`Scope::CloudPlatform`].
11456 ///
11457 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11458 /// tokens for more than one scope.
11459 ///
11460 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11461 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11462 /// sufficient, a read-write scope will do as well.
11463 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
11464 where
11465 St: AsRef<str>,
11466 {
11467 self._scopes.insert(String::from(scope.as_ref()));
11468 self
11469 }
11470 /// Identifies the authorization scope(s) for the method you are building.
11471 ///
11472 /// See [`Self::add_scope()`] for details.
11473 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
11474 where
11475 I: IntoIterator<Item = St>,
11476 St: AsRef<str>,
11477 {
11478 self._scopes
11479 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11480 self
11481 }
11482
11483 /// Removes all scopes, and no default scope will be used either.
11484 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11485 /// for details).
11486 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
11487 self._scopes.clear();
11488 self
11489 }
11490}