Skip to main content

google_cloud_dns_v1/
client.rs

1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Cloud DNS.
22///
23/// # Example
24/// ```
25/// # use google_cloud_dns_v1::client::Changes;
26/// async fn sample(
27/// ) -> anyhow::Result<()> {
28///     let client = Changes::builder().build().await?;
29///     let response = client.create()
30///         /* set fields */
31///         .send().await?;
32///     println!("response {:?}", response);
33///     Ok(())
34/// }
35/// ```
36///
37/// # Service Description
38///
39/// Service for the `changes` resource.
40///
41/// # Configuration
42///
43/// To configure `Changes` use the `with_*` methods in the type returned
44/// by [builder()][Changes::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48///   (`https://dns.googleapis.com`). Applications using regional
49///   endpoints or running in restricted networks (e.g. a network configured
50///   with [Private Google Access with VPC Service Controls]) may want to
51///   override this default.
52/// * [with_credentials()]: by default this client uses
53///   [Application Default Credentials]. Applications using custom
54///   authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::changes::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::changes::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `Changes` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `Changes` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[derive(Clone, Debug)]
68pub struct Changes {
69    inner: std::sync::Arc<dyn super::stub::dynamic::Changes>,
70}
71
72impl Changes {
73    /// Returns a builder for [Changes].
74    ///
75    /// ```
76    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77    /// # use google_cloud_dns_v1::client::Changes;
78    /// let client = Changes::builder().build().await?;
79    /// # Ok(()) }
80    /// ```
81    pub fn builder() -> super::builder::changes::ClientBuilder {
82        crate::new_client_builder(super::builder::changes::client::Factory)
83    }
84
85    /// Creates a new client from the provided stub.
86    ///
87    /// The most common case for calling this function is in tests mocking the
88    /// client's behavior.
89    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
90    where
91        T: super::stub::Changes + 'static,
92    {
93        Self { inner: stub.into() }
94    }
95
96    pub(crate) async fn new(
97        config: gaxi::options::ClientConfig,
98    ) -> crate::ClientBuilderResult<Self> {
99        let inner = Self::build_inner(config).await?;
100        Ok(Self { inner })
101    }
102
103    async fn build_inner(
104        conf: gaxi::options::ClientConfig,
105    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Changes>> {
106        if gaxi::options::tracing_enabled(&conf) {
107            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
108        }
109        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
110    }
111
112    async fn build_transport(
113        conf: gaxi::options::ClientConfig,
114    ) -> crate::ClientBuilderResult<impl super::stub::Changes> {
115        super::transport::Changes::new(conf).await
116    }
117
118    async fn build_with_tracing(
119        conf: gaxi::options::ClientConfig,
120    ) -> crate::ClientBuilderResult<impl super::stub::Changes> {
121        Self::build_transport(conf)
122            .await
123            .map(super::tracing::Changes::new)
124    }
125
126    /// Atomically updates the ResourceRecordSet collection. Note: While `dns.changes.create` is the baseline permission required to invoke this method, additional permissions are checked depending on the specific additions or deletions contained in the payload.
127    ///
128    /// # Example
129    /// ```
130    /// # use google_cloud_dns_v1::client::Changes;
131    /// use google_cloud_dns_v1::Result;
132    /// async fn sample(
133    ///    client: &Changes
134    /// ) -> Result<()> {
135    ///     let response = client.create()
136    ///         /* set fields */
137    ///         .send().await?;
138    ///     println!("response {:?}", response);
139    ///     Ok(())
140    /// }
141    /// ```
142    pub fn create(&self) -> super::builder::changes::Create {
143        super::builder::changes::Create::new(self.inner.clone())
144    }
145
146    /// Fetches the representation of an existing Change.
147    ///
148    /// # Example
149    /// ```
150    /// # use google_cloud_dns_v1::client::Changes;
151    /// use google_cloud_dns_v1::Result;
152    /// async fn sample(
153    ///    client: &Changes
154    /// ) -> Result<()> {
155    ///     let response = client.get()
156    ///         /* set fields */
157    ///         .send().await?;
158    ///     println!("response {:?}", response);
159    ///     Ok(())
160    /// }
161    /// ```
162    pub fn get(&self) -> super::builder::changes::Get {
163        super::builder::changes::Get::new(self.inner.clone())
164    }
165
166    /// Enumerates Changes to a ResourceRecordSet collection.
167    ///
168    /// # Example
169    /// ```
170    /// # use google_cloud_dns_v1::client::Changes;
171    /// use google_cloud_gax::paginator::ItemPaginator as _;
172    /// use google_cloud_dns_v1::Result;
173    /// async fn sample(
174    ///    client: &Changes
175    /// ) -> Result<()> {
176    ///     let mut list = client.list()
177    ///         /* set fields */
178    ///         .by_item();
179    ///     while let Some(item) = list.next().await.transpose()? {
180    ///         println!("{:?}", item);
181    ///     }
182    ///     Ok(())
183    /// }
184    /// ```
185    pub fn list(&self) -> super::builder::changes::List {
186        super::builder::changes::List::new(self.inner.clone())
187    }
188}
189
190/// Implements a client for the Cloud DNS.
191///
192/// # Example
193/// ```
194/// # use google_cloud_dns_v1::client::DnsKeys;
195/// async fn sample(
196/// ) -> anyhow::Result<()> {
197///     let client = DnsKeys::builder().build().await?;
198///     let response = client.get()
199///         /* set fields */
200///         .send().await?;
201///     println!("response {:?}", response);
202///     Ok(())
203/// }
204/// ```
205///
206/// # Service Description
207///
208/// Service for the `dnsKeys` resource.
209///
210/// # Configuration
211///
212/// To configure `DnsKeys` use the `with_*` methods in the type returned
213/// by [builder()][DnsKeys::builder]. The default configuration should
214/// work for most applications. Common configuration changes include
215///
216/// * [with_endpoint()]: by default this client uses the global default endpoint
217///   (`https://dns.googleapis.com`). Applications using regional
218///   endpoints or running in restricted networks (e.g. a network configured
219///   with [Private Google Access with VPC Service Controls]) may want to
220///   override this default.
221/// * [with_credentials()]: by default this client uses
222///   [Application Default Credentials]. Applications using custom
223///   authentication may need to override this default.
224///
225/// [with_endpoint()]: super::builder::dns_keys::ClientBuilder::with_endpoint
226/// [with_credentials()]: super::builder::dns_keys::ClientBuilder::with_credentials
227/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
228/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
229///
230/// # Pooling and Cloning
231///
232/// `DnsKeys` holds a connection pool internally, it is advised to
233/// create one and reuse it. You do not need to wrap `DnsKeys` in
234/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
235/// already uses an `Arc` internally.
236#[derive(Clone, Debug)]
237pub struct DnsKeys {
238    inner: std::sync::Arc<dyn super::stub::dynamic::DnsKeys>,
239}
240
241impl DnsKeys {
242    /// Returns a builder for [DnsKeys].
243    ///
244    /// ```
245    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
246    /// # use google_cloud_dns_v1::client::DnsKeys;
247    /// let client = DnsKeys::builder().build().await?;
248    /// # Ok(()) }
249    /// ```
250    pub fn builder() -> super::builder::dns_keys::ClientBuilder {
251        crate::new_client_builder(super::builder::dns_keys::client::Factory)
252    }
253
254    /// Creates a new client from the provided stub.
255    ///
256    /// The most common case for calling this function is in tests mocking the
257    /// client's behavior.
258    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
259    where
260        T: super::stub::DnsKeys + 'static,
261    {
262        Self { inner: stub.into() }
263    }
264
265    pub(crate) async fn new(
266        config: gaxi::options::ClientConfig,
267    ) -> crate::ClientBuilderResult<Self> {
268        let inner = Self::build_inner(config).await?;
269        Ok(Self { inner })
270    }
271
272    async fn build_inner(
273        conf: gaxi::options::ClientConfig,
274    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DnsKeys>> {
275        if gaxi::options::tracing_enabled(&conf) {
276            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
277        }
278        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
279    }
280
281    async fn build_transport(
282        conf: gaxi::options::ClientConfig,
283    ) -> crate::ClientBuilderResult<impl super::stub::DnsKeys> {
284        super::transport::DnsKeys::new(conf).await
285    }
286
287    async fn build_with_tracing(
288        conf: gaxi::options::ClientConfig,
289    ) -> crate::ClientBuilderResult<impl super::stub::DnsKeys> {
290        Self::build_transport(conf)
291            .await
292            .map(super::tracing::DnsKeys::new)
293    }
294
295    /// Fetches the representation of an existing DnsKey.
296    ///
297    /// # Example
298    /// ```
299    /// # use google_cloud_dns_v1::client::DnsKeys;
300    /// use google_cloud_dns_v1::Result;
301    /// async fn sample(
302    ///    client: &DnsKeys
303    /// ) -> Result<()> {
304    ///     let response = client.get()
305    ///         /* set fields */
306    ///         .send().await?;
307    ///     println!("response {:?}", response);
308    ///     Ok(())
309    /// }
310    /// ```
311    pub fn get(&self) -> super::builder::dns_keys::Get {
312        super::builder::dns_keys::Get::new(self.inner.clone())
313    }
314
315    /// Enumerates DnsKeys to a ResourceRecordSet collection.
316    ///
317    /// # Example
318    /// ```
319    /// # use google_cloud_dns_v1::client::DnsKeys;
320    /// use google_cloud_gax::paginator::ItemPaginator as _;
321    /// use google_cloud_dns_v1::Result;
322    /// async fn sample(
323    ///    client: &DnsKeys
324    /// ) -> Result<()> {
325    ///     let mut list = client.list()
326    ///         /* set fields */
327    ///         .by_item();
328    ///     while let Some(item) = list.next().await.transpose()? {
329    ///         println!("{:?}", item);
330    ///     }
331    ///     Ok(())
332    /// }
333    /// ```
334    pub fn list(&self) -> super::builder::dns_keys::List {
335        super::builder::dns_keys::List::new(self.inner.clone())
336    }
337}
338
339/// Implements a client for the Cloud DNS.
340///
341/// # Example
342/// ```
343/// # use google_cloud_dns_v1::client::ManagedZoneOperations;
344/// async fn sample(
345/// ) -> anyhow::Result<()> {
346///     let client = ManagedZoneOperations::builder().build().await?;
347///     let response = client.get()
348///         /* set fields */
349///         .send().await?;
350///     println!("response {:?}", response);
351///     Ok(())
352/// }
353/// ```
354///
355/// # Service Description
356///
357/// Service for the `managedZoneOperations` resource.
358///
359/// # Configuration
360///
361/// To configure `ManagedZoneOperations` use the `with_*` methods in the type returned
362/// by [builder()][ManagedZoneOperations::builder]. The default configuration should
363/// work for most applications. Common configuration changes include
364///
365/// * [with_endpoint()]: by default this client uses the global default endpoint
366///   (`https://dns.googleapis.com`). Applications using regional
367///   endpoints or running in restricted networks (e.g. a network configured
368///   with [Private Google Access with VPC Service Controls]) may want to
369///   override this default.
370/// * [with_credentials()]: by default this client uses
371///   [Application Default Credentials]. Applications using custom
372///   authentication may need to override this default.
373///
374/// [with_endpoint()]: super::builder::managed_zone_operations::ClientBuilder::with_endpoint
375/// [with_credentials()]: super::builder::managed_zone_operations::ClientBuilder::with_credentials
376/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
377/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
378///
379/// # Pooling and Cloning
380///
381/// `ManagedZoneOperations` holds a connection pool internally, it is advised to
382/// create one and reuse it. You do not need to wrap `ManagedZoneOperations` in
383/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
384/// already uses an `Arc` internally.
385#[derive(Clone, Debug)]
386pub struct ManagedZoneOperations {
387    inner: std::sync::Arc<dyn super::stub::dynamic::ManagedZoneOperations>,
388}
389
390impl ManagedZoneOperations {
391    /// Returns a builder for [ManagedZoneOperations].
392    ///
393    /// ```
394    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
395    /// # use google_cloud_dns_v1::client::ManagedZoneOperations;
396    /// let client = ManagedZoneOperations::builder().build().await?;
397    /// # Ok(()) }
398    /// ```
399    pub fn builder() -> super::builder::managed_zone_operations::ClientBuilder {
400        crate::new_client_builder(super::builder::managed_zone_operations::client::Factory)
401    }
402
403    /// Creates a new client from the provided stub.
404    ///
405    /// The most common case for calling this function is in tests mocking the
406    /// client's behavior.
407    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
408    where
409        T: super::stub::ManagedZoneOperations + 'static,
410    {
411        Self { inner: stub.into() }
412    }
413
414    pub(crate) async fn new(
415        config: gaxi::options::ClientConfig,
416    ) -> crate::ClientBuilderResult<Self> {
417        let inner = Self::build_inner(config).await?;
418        Ok(Self { inner })
419    }
420
421    async fn build_inner(
422        conf: gaxi::options::ClientConfig,
423    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ManagedZoneOperations>>
424    {
425        if gaxi::options::tracing_enabled(&conf) {
426            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
427        }
428        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
429    }
430
431    async fn build_transport(
432        conf: gaxi::options::ClientConfig,
433    ) -> crate::ClientBuilderResult<impl super::stub::ManagedZoneOperations> {
434        super::transport::ManagedZoneOperations::new(conf).await
435    }
436
437    async fn build_with_tracing(
438        conf: gaxi::options::ClientConfig,
439    ) -> crate::ClientBuilderResult<impl super::stub::ManagedZoneOperations> {
440        Self::build_transport(conf)
441            .await
442            .map(super::tracing::ManagedZoneOperations::new)
443    }
444
445    /// Fetches the representation of an existing Operation.
446    ///
447    /// # Example
448    /// ```
449    /// # use google_cloud_dns_v1::client::ManagedZoneOperations;
450    /// use google_cloud_dns_v1::Result;
451    /// async fn sample(
452    ///    client: &ManagedZoneOperations
453    /// ) -> Result<()> {
454    ///     let response = client.get()
455    ///         /* set fields */
456    ///         .send().await?;
457    ///     println!("response {:?}", response);
458    ///     Ok(())
459    /// }
460    /// ```
461    pub fn get(&self) -> super::builder::managed_zone_operations::Get {
462        super::builder::managed_zone_operations::Get::new(self.inner.clone())
463    }
464
465    /// Enumerates Operations for the given ManagedZone.
466    ///
467    /// # Example
468    /// ```
469    /// # use google_cloud_dns_v1::client::ManagedZoneOperations;
470    /// use google_cloud_gax::paginator::ItemPaginator as _;
471    /// use google_cloud_dns_v1::Result;
472    /// async fn sample(
473    ///    client: &ManagedZoneOperations
474    /// ) -> Result<()> {
475    ///     let mut list = client.list()
476    ///         /* set fields */
477    ///         .by_item();
478    ///     while let Some(item) = list.next().await.transpose()? {
479    ///         println!("{:?}", item);
480    ///     }
481    ///     Ok(())
482    /// }
483    /// ```
484    pub fn list(&self) -> super::builder::managed_zone_operations::List {
485        super::builder::managed_zone_operations::List::new(self.inner.clone())
486    }
487}
488
489/// Implements a client for the Cloud DNS.
490///
491/// # Example
492/// ```
493/// # use google_cloud_dns_v1::client::ManagedZones;
494/// async fn sample(
495/// ) -> anyhow::Result<()> {
496///     let client = ManagedZones::builder().build().await?;
497///     let response = client.create()
498///         /* set fields */
499///         .send().await?;
500///     println!("response {:?}", response);
501///     Ok(())
502/// }
503/// ```
504///
505/// # Service Description
506///
507/// Service for the `managedZones` resource.
508///
509/// # Configuration
510///
511/// To configure `ManagedZones` use the `with_*` methods in the type returned
512/// by [builder()][ManagedZones::builder]. The default configuration should
513/// work for most applications. Common configuration changes include
514///
515/// * [with_endpoint()]: by default this client uses the global default endpoint
516///   (`https://dns.googleapis.com`). Applications using regional
517///   endpoints or running in restricted networks (e.g. a network configured
518///   with [Private Google Access with VPC Service Controls]) may want to
519///   override this default.
520/// * [with_credentials()]: by default this client uses
521///   [Application Default Credentials]. Applications using custom
522///   authentication may need to override this default.
523///
524/// [with_endpoint()]: super::builder::managed_zones::ClientBuilder::with_endpoint
525/// [with_credentials()]: super::builder::managed_zones::ClientBuilder::with_credentials
526/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
527/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
528///
529/// # Pooling and Cloning
530///
531/// `ManagedZones` holds a connection pool internally, it is advised to
532/// create one and reuse it. You do not need to wrap `ManagedZones` in
533/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
534/// already uses an `Arc` internally.
535#[derive(Clone, Debug)]
536pub struct ManagedZones {
537    inner: std::sync::Arc<dyn super::stub::dynamic::ManagedZones>,
538}
539
540impl ManagedZones {
541    /// Returns a builder for [ManagedZones].
542    ///
543    /// ```
544    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
545    /// # use google_cloud_dns_v1::client::ManagedZones;
546    /// let client = ManagedZones::builder().build().await?;
547    /// # Ok(()) }
548    /// ```
549    pub fn builder() -> super::builder::managed_zones::ClientBuilder {
550        crate::new_client_builder(super::builder::managed_zones::client::Factory)
551    }
552
553    /// Creates a new client from the provided stub.
554    ///
555    /// The most common case for calling this function is in tests mocking the
556    /// client's behavior.
557    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
558    where
559        T: super::stub::ManagedZones + 'static,
560    {
561        Self { inner: stub.into() }
562    }
563
564    pub(crate) async fn new(
565        config: gaxi::options::ClientConfig,
566    ) -> crate::ClientBuilderResult<Self> {
567        let inner = Self::build_inner(config).await?;
568        Ok(Self { inner })
569    }
570
571    async fn build_inner(
572        conf: gaxi::options::ClientConfig,
573    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ManagedZones>> {
574        if gaxi::options::tracing_enabled(&conf) {
575            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
576        }
577        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
578    }
579
580    async fn build_transport(
581        conf: gaxi::options::ClientConfig,
582    ) -> crate::ClientBuilderResult<impl super::stub::ManagedZones> {
583        super::transport::ManagedZones::new(conf).await
584    }
585
586    async fn build_with_tracing(
587        conf: gaxi::options::ClientConfig,
588    ) -> crate::ClientBuilderResult<impl super::stub::ManagedZones> {
589        Self::build_transport(conf)
590            .await
591            .map(super::tracing::ManagedZones::new)
592    }
593
594    /// Creates a new ManagedZone. Note: While `dns.managedZones.create` is the baseline permission required to invoke this method, additional permissions are required if the managed zone configuration references other resources.
595    ///
596    /// # Example
597    /// ```
598    /// # use google_cloud_dns_v1::client::ManagedZones;
599    /// use google_cloud_dns_v1::Result;
600    /// async fn sample(
601    ///    client: &ManagedZones
602    /// ) -> Result<()> {
603    ///     let response = client.create()
604    ///         /* set fields */
605    ///         .send().await?;
606    ///     println!("response {:?}", response);
607    ///     Ok(())
608    /// }
609    /// ```
610    pub fn create(&self) -> super::builder::managed_zones::Create {
611        super::builder::managed_zones::Create::new(self.inner.clone())
612    }
613
614    /// Deletes a previously created ManagedZone.
615    ///
616    /// # Example
617    /// ```
618    /// # use google_cloud_dns_v1::client::ManagedZones;
619    /// use google_cloud_dns_v1::Result;
620    /// async fn sample(
621    ///    client: &ManagedZones
622    /// ) -> Result<()> {
623    ///     client.delete()
624    ///         /* set fields */
625    ///         .send().await?;
626    ///     Ok(())
627    /// }
628    /// ```
629    pub fn delete(&self) -> super::builder::managed_zones::Delete {
630        super::builder::managed_zones::Delete::new(self.inner.clone())
631    }
632
633    /// Fetches the representation of an existing ManagedZone.
634    ///
635    /// # Example
636    /// ```
637    /// # use google_cloud_dns_v1::client::ManagedZones;
638    /// use google_cloud_dns_v1::Result;
639    /// async fn sample(
640    ///    client: &ManagedZones
641    /// ) -> Result<()> {
642    ///     let response = client.get()
643    ///         /* set fields */
644    ///         .send().await?;
645    ///     println!("response {:?}", response);
646    ///     Ok(())
647    /// }
648    /// ```
649    pub fn get(&self) -> super::builder::managed_zones::Get {
650        super::builder::managed_zones::Get::new(self.inner.clone())
651    }
652
653    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
654    ///
655    /// # Example
656    /// ```
657    /// # use google_cloud_dns_v1::client::ManagedZones;
658    /// use google_cloud_dns_v1::Result;
659    /// async fn sample(
660    ///    client: &ManagedZones
661    /// ) -> Result<()> {
662    ///     let response = client.get_iam_policy()
663    ///         /* set fields */
664    ///         .send().await?;
665    ///     println!("response {:?}", response);
666    ///     Ok(())
667    /// }
668    /// ```
669    pub fn get_iam_policy(&self) -> super::builder::managed_zones::GetIamPolicy {
670        super::builder::managed_zones::GetIamPolicy::new(self.inner.clone())
671    }
672
673    /// Enumerates ManagedZones that have been created but not yet deleted.
674    ///
675    /// # Example
676    /// ```
677    /// # use google_cloud_dns_v1::client::ManagedZones;
678    /// use google_cloud_gax::paginator::ItemPaginator as _;
679    /// use google_cloud_dns_v1::Result;
680    /// async fn sample(
681    ///    client: &ManagedZones
682    /// ) -> Result<()> {
683    ///     let mut list = client.list()
684    ///         /* set fields */
685    ///         .by_item();
686    ///     while let Some(item) = list.next().await.transpose()? {
687    ///         println!("{:?}", item);
688    ///     }
689    ///     Ok(())
690    /// }
691    /// ```
692    pub fn list(&self) -> super::builder::managed_zones::List {
693        super::builder::managed_zones::List::new(self.inner.clone())
694    }
695
696    /// Applies a partial update to an existing ManagedZone.
697    ///
698    /// # Example
699    /// ```
700    /// # use google_cloud_dns_v1::client::ManagedZones;
701    /// use google_cloud_lro::Poller;
702    /// use google_cloud_dns_v1::Result;
703    /// async fn sample(
704    ///    client: &ManagedZones
705    /// ) -> Result<()> {
706    ///     let response = client.patch()
707    ///         /* set fields */
708    ///         .poller().until_done().await?;
709    ///     println!("response {:?}", response);
710    ///     Ok(())
711    /// }
712    /// ```
713    pub fn patch(&self) -> super::builder::managed_zones::Patch {
714        super::builder::managed_zones::Patch::new(self.inner.clone())
715    }
716
717    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
718    ///
719    /// # Example
720    /// ```
721    /// # use google_cloud_dns_v1::client::ManagedZones;
722    /// use google_cloud_dns_v1::Result;
723    /// async fn sample(
724    ///    client: &ManagedZones
725    /// ) -> Result<()> {
726    ///     let response = client.set_iam_policy()
727    ///         /* set fields */
728    ///         .send().await?;
729    ///     println!("response {:?}", response);
730    ///     Ok(())
731    /// }
732    /// ```
733    pub fn set_iam_policy(&self) -> super::builder::managed_zones::SetIamPolicy {
734        super::builder::managed_zones::SetIamPolicy::new(self.inner.clone())
735    }
736
737    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this returns an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
738    ///
739    /// # Example
740    /// ```
741    /// # use google_cloud_dns_v1::client::ManagedZones;
742    /// use google_cloud_dns_v1::Result;
743    /// async fn sample(
744    ///    client: &ManagedZones
745    /// ) -> Result<()> {
746    ///     let response = client.test_iam_permissions()
747    ///         /* set fields */
748    ///         .send().await?;
749    ///     println!("response {:?}", response);
750    ///     Ok(())
751    /// }
752    /// ```
753    pub fn test_iam_permissions(&self) -> super::builder::managed_zones::TestIamPermissions {
754        super::builder::managed_zones::TestIamPermissions::new(self.inner.clone())
755    }
756
757    /// Updates an existing ManagedZone.
758    ///
759    /// # Example
760    /// ```
761    /// # use google_cloud_dns_v1::client::ManagedZones;
762    /// use google_cloud_lro::Poller;
763    /// use google_cloud_dns_v1::Result;
764    /// async fn sample(
765    ///    client: &ManagedZones
766    /// ) -> Result<()> {
767    ///     let response = client.update()
768    ///         /* set fields */
769    ///         .poller().until_done().await?;
770    ///     println!("response {:?}", response);
771    ///     Ok(())
772    /// }
773    /// ```
774    pub fn update(&self) -> super::builder::managed_zones::Update {
775        super::builder::managed_zones::Update::new(self.inner.clone())
776    }
777
778    /// Fetches the representation of an existing Operation.
779    ///
780    /// # Example
781    /// ```
782    /// # use google_cloud_dns_v1::client::ManagedZones;
783    /// use google_cloud_dns_v1::Result;
784    /// async fn sample(
785    ///    client: &ManagedZones
786    /// ) -> Result<()> {
787    ///     let response = client.get_operation()
788    ///         /* set fields */
789    ///         .send().await?;
790    ///     println!("response {:?}", response);
791    ///     Ok(())
792    /// }
793    /// ```
794    pub fn get_operation(&self) -> super::builder::managed_zones::GetOperation {
795        super::builder::managed_zones::GetOperation::new(self.inner.clone())
796    }
797}
798
799/// Implements a client for the Cloud DNS.
800///
801/// # Example
802/// ```
803/// # use google_cloud_dns_v1::client::Policies;
804/// async fn sample(
805/// ) -> anyhow::Result<()> {
806///     let client = Policies::builder().build().await?;
807///     let response = client.create()
808///         /* set fields */
809///         .send().await?;
810///     println!("response {:?}", response);
811///     Ok(())
812/// }
813/// ```
814///
815/// # Service Description
816///
817/// Service for the `policies` resource.
818///
819/// # Configuration
820///
821/// To configure `Policies` use the `with_*` methods in the type returned
822/// by [builder()][Policies::builder]. The default configuration should
823/// work for most applications. Common configuration changes include
824///
825/// * [with_endpoint()]: by default this client uses the global default endpoint
826///   (`https://dns.googleapis.com`). Applications using regional
827///   endpoints or running in restricted networks (e.g. a network configured
828///   with [Private Google Access with VPC Service Controls]) may want to
829///   override this default.
830/// * [with_credentials()]: by default this client uses
831///   [Application Default Credentials]. Applications using custom
832///   authentication may need to override this default.
833///
834/// [with_endpoint()]: super::builder::policies::ClientBuilder::with_endpoint
835/// [with_credentials()]: super::builder::policies::ClientBuilder::with_credentials
836/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
837/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
838///
839/// # Pooling and Cloning
840///
841/// `Policies` holds a connection pool internally, it is advised to
842/// create one and reuse it. You do not need to wrap `Policies` in
843/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
844/// already uses an `Arc` internally.
845#[derive(Clone, Debug)]
846pub struct Policies {
847    inner: std::sync::Arc<dyn super::stub::dynamic::Policies>,
848}
849
850impl Policies {
851    /// Returns a builder for [Policies].
852    ///
853    /// ```
854    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
855    /// # use google_cloud_dns_v1::client::Policies;
856    /// let client = Policies::builder().build().await?;
857    /// # Ok(()) }
858    /// ```
859    pub fn builder() -> super::builder::policies::ClientBuilder {
860        crate::new_client_builder(super::builder::policies::client::Factory)
861    }
862
863    /// Creates a new client from the provided stub.
864    ///
865    /// The most common case for calling this function is in tests mocking the
866    /// client's behavior.
867    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
868    where
869        T: super::stub::Policies + 'static,
870    {
871        Self { inner: stub.into() }
872    }
873
874    pub(crate) async fn new(
875        config: gaxi::options::ClientConfig,
876    ) -> crate::ClientBuilderResult<Self> {
877        let inner = Self::build_inner(config).await?;
878        Ok(Self { inner })
879    }
880
881    async fn build_inner(
882        conf: gaxi::options::ClientConfig,
883    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Policies>> {
884        if gaxi::options::tracing_enabled(&conf) {
885            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
886        }
887        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
888    }
889
890    async fn build_transport(
891        conf: gaxi::options::ClientConfig,
892    ) -> crate::ClientBuilderResult<impl super::stub::Policies> {
893        super::transport::Policies::new(conf).await
894    }
895
896    async fn build_with_tracing(
897        conf: gaxi::options::ClientConfig,
898    ) -> crate::ClientBuilderResult<impl super::stub::Policies> {
899        Self::build_transport(conf)
900            .await
901            .map(super::tracing::Policies::new)
902    }
903
904    /// Creates a new policy.
905    ///
906    /// # Example
907    /// ```
908    /// # use google_cloud_dns_v1::client::Policies;
909    /// use google_cloud_dns_v1::Result;
910    /// async fn sample(
911    ///    client: &Policies
912    /// ) -> Result<()> {
913    ///     let response = client.create()
914    ///         /* set fields */
915    ///         .send().await?;
916    ///     println!("response {:?}", response);
917    ///     Ok(())
918    /// }
919    /// ```
920    pub fn create(&self) -> super::builder::policies::Create {
921        super::builder::policies::Create::new(self.inner.clone())
922    }
923
924    /// Deletes a previously created policy. Fails if the policy is still being referenced by a network.
925    ///
926    /// # Example
927    /// ```
928    /// # use google_cloud_dns_v1::client::Policies;
929    /// use google_cloud_dns_v1::Result;
930    /// async fn sample(
931    ///    client: &Policies
932    /// ) -> Result<()> {
933    ///     client.delete()
934    ///         /* set fields */
935    ///         .send().await?;
936    ///     Ok(())
937    /// }
938    /// ```
939    pub fn delete(&self) -> super::builder::policies::Delete {
940        super::builder::policies::Delete::new(self.inner.clone())
941    }
942
943    /// Fetches the representation of an existing policy.
944    ///
945    /// # Example
946    /// ```
947    /// # use google_cloud_dns_v1::client::Policies;
948    /// use google_cloud_dns_v1::Result;
949    /// async fn sample(
950    ///    client: &Policies
951    /// ) -> Result<()> {
952    ///     let response = client.get()
953    ///         /* set fields */
954    ///         .send().await?;
955    ///     println!("response {:?}", response);
956    ///     Ok(())
957    /// }
958    /// ```
959    pub fn get(&self) -> super::builder::policies::Get {
960        super::builder::policies::Get::new(self.inner.clone())
961    }
962
963    /// Enumerates all policies associated with a project.
964    ///
965    /// # Example
966    /// ```
967    /// # use google_cloud_dns_v1::client::Policies;
968    /// use google_cloud_gax::paginator::ItemPaginator as _;
969    /// use google_cloud_dns_v1::Result;
970    /// async fn sample(
971    ///    client: &Policies
972    /// ) -> Result<()> {
973    ///     let mut list = client.list()
974    ///         /* set fields */
975    ///         .by_item();
976    ///     while let Some(item) = list.next().await.transpose()? {
977    ///         println!("{:?}", item);
978    ///     }
979    ///     Ok(())
980    /// }
981    /// ```
982    pub fn list(&self) -> super::builder::policies::List {
983        super::builder::policies::List::new(self.inner.clone())
984    }
985
986    /// Applies a partial update to an existing policy.
987    ///
988    /// # Example
989    /// ```
990    /// # use google_cloud_dns_v1::client::Policies;
991    /// use google_cloud_dns_v1::Result;
992    /// async fn sample(
993    ///    client: &Policies
994    /// ) -> Result<()> {
995    ///     let response = client.patch()
996    ///         /* set fields */
997    ///         .send().await?;
998    ///     println!("response {:?}", response);
999    ///     Ok(())
1000    /// }
1001    /// ```
1002    pub fn patch(&self) -> super::builder::policies::Patch {
1003        super::builder::policies::Patch::new(self.inner.clone())
1004    }
1005
1006    /// Updates an existing policy.
1007    ///
1008    /// # Example
1009    /// ```
1010    /// # use google_cloud_dns_v1::client::Policies;
1011    /// use google_cloud_dns_v1::Result;
1012    /// async fn sample(
1013    ///    client: &Policies
1014    /// ) -> Result<()> {
1015    ///     let response = client.update()
1016    ///         /* set fields */
1017    ///         .send().await?;
1018    ///     println!("response {:?}", response);
1019    ///     Ok(())
1020    /// }
1021    /// ```
1022    pub fn update(&self) -> super::builder::policies::Update {
1023        super::builder::policies::Update::new(self.inner.clone())
1024    }
1025}
1026
1027/// Implements a client for the Cloud DNS.
1028///
1029/// # Example
1030/// ```
1031/// # use google_cloud_dns_v1::client::Projects;
1032/// async fn sample(
1033/// ) -> anyhow::Result<()> {
1034///     let client = Projects::builder().build().await?;
1035///     let response = client.get()
1036///         /* set fields */
1037///         .send().await?;
1038///     println!("response {:?}", response);
1039///     Ok(())
1040/// }
1041/// ```
1042///
1043/// # Service Description
1044///
1045/// Service for the `projects` resource.
1046///
1047/// # Configuration
1048///
1049/// To configure `Projects` use the `with_*` methods in the type returned
1050/// by [builder()][Projects::builder]. The default configuration should
1051/// work for most applications. Common configuration changes include
1052///
1053/// * [with_endpoint()]: by default this client uses the global default endpoint
1054///   (`https://dns.googleapis.com`). Applications using regional
1055///   endpoints or running in restricted networks (e.g. a network configured
1056///   with [Private Google Access with VPC Service Controls]) may want to
1057///   override this default.
1058/// * [with_credentials()]: by default this client uses
1059///   [Application Default Credentials]. Applications using custom
1060///   authentication may need to override this default.
1061///
1062/// [with_endpoint()]: super::builder::projects::ClientBuilder::with_endpoint
1063/// [with_credentials()]: super::builder::projects::ClientBuilder::with_credentials
1064/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1065/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1066///
1067/// # Pooling and Cloning
1068///
1069/// `Projects` holds a connection pool internally, it is advised to
1070/// create one and reuse it. You do not need to wrap `Projects` in
1071/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1072/// already uses an `Arc` internally.
1073#[derive(Clone, Debug)]
1074pub struct Projects {
1075    inner: std::sync::Arc<dyn super::stub::dynamic::Projects>,
1076}
1077
1078impl Projects {
1079    /// Returns a builder for [Projects].
1080    ///
1081    /// ```
1082    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1083    /// # use google_cloud_dns_v1::client::Projects;
1084    /// let client = Projects::builder().build().await?;
1085    /// # Ok(()) }
1086    /// ```
1087    pub fn builder() -> super::builder::projects::ClientBuilder {
1088        crate::new_client_builder(super::builder::projects::client::Factory)
1089    }
1090
1091    /// Creates a new client from the provided stub.
1092    ///
1093    /// The most common case for calling this function is in tests mocking the
1094    /// client's behavior.
1095    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1096    where
1097        T: super::stub::Projects + 'static,
1098    {
1099        Self { inner: stub.into() }
1100    }
1101
1102    pub(crate) async fn new(
1103        config: gaxi::options::ClientConfig,
1104    ) -> crate::ClientBuilderResult<Self> {
1105        let inner = Self::build_inner(config).await?;
1106        Ok(Self { inner })
1107    }
1108
1109    async fn build_inner(
1110        conf: gaxi::options::ClientConfig,
1111    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Projects>> {
1112        if gaxi::options::tracing_enabled(&conf) {
1113            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1114        }
1115        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1116    }
1117
1118    async fn build_transport(
1119        conf: gaxi::options::ClientConfig,
1120    ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
1121        super::transport::Projects::new(conf).await
1122    }
1123
1124    async fn build_with_tracing(
1125        conf: gaxi::options::ClientConfig,
1126    ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
1127        Self::build_transport(conf)
1128            .await
1129            .map(super::tracing::Projects::new)
1130    }
1131
1132    /// Fetches the representation of an existing Project.
1133    ///
1134    /// # Example
1135    /// ```
1136    /// # use google_cloud_dns_v1::client::Projects;
1137    /// use google_cloud_dns_v1::Result;
1138    /// async fn sample(
1139    ///    client: &Projects
1140    /// ) -> Result<()> {
1141    ///     let response = client.get()
1142    ///         /* set fields */
1143    ///         .send().await?;
1144    ///     println!("response {:?}", response);
1145    ///     Ok(())
1146    /// }
1147    /// ```
1148    pub fn get(&self) -> super::builder::projects::Get {
1149        super::builder::projects::Get::new(self.inner.clone())
1150    }
1151}
1152
1153/// Implements a client for the Cloud DNS.
1154///
1155/// # Example
1156/// ```
1157/// # use google_cloud_dns_v1::client::ResourceRecordSets;
1158/// async fn sample(
1159/// ) -> anyhow::Result<()> {
1160///     let client = ResourceRecordSets::builder().build().await?;
1161///     let response = client.create()
1162///         /* set fields */
1163///         .send().await?;
1164///     println!("response {:?}", response);
1165///     Ok(())
1166/// }
1167/// ```
1168///
1169/// # Service Description
1170///
1171/// Service for the `resourceRecordSets` resource.
1172///
1173/// # Configuration
1174///
1175/// To configure `ResourceRecordSets` use the `with_*` methods in the type returned
1176/// by [builder()][ResourceRecordSets::builder]. The default configuration should
1177/// work for most applications. Common configuration changes include
1178///
1179/// * [with_endpoint()]: by default this client uses the global default endpoint
1180///   (`https://dns.googleapis.com`). Applications using regional
1181///   endpoints or running in restricted networks (e.g. a network configured
1182///   with [Private Google Access with VPC Service Controls]) may want to
1183///   override this default.
1184/// * [with_credentials()]: by default this client uses
1185///   [Application Default Credentials]. Applications using custom
1186///   authentication may need to override this default.
1187///
1188/// [with_endpoint()]: super::builder::resource_record_sets::ClientBuilder::with_endpoint
1189/// [with_credentials()]: super::builder::resource_record_sets::ClientBuilder::with_credentials
1190/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1191/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1192///
1193/// # Pooling and Cloning
1194///
1195/// `ResourceRecordSets` holds a connection pool internally, it is advised to
1196/// create one and reuse it. You do not need to wrap `ResourceRecordSets` in
1197/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1198/// already uses an `Arc` internally.
1199#[derive(Clone, Debug)]
1200pub struct ResourceRecordSets {
1201    inner: std::sync::Arc<dyn super::stub::dynamic::ResourceRecordSets>,
1202}
1203
1204impl ResourceRecordSets {
1205    /// Returns a builder for [ResourceRecordSets].
1206    ///
1207    /// ```
1208    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1209    /// # use google_cloud_dns_v1::client::ResourceRecordSets;
1210    /// let client = ResourceRecordSets::builder().build().await?;
1211    /// # Ok(()) }
1212    /// ```
1213    pub fn builder() -> super::builder::resource_record_sets::ClientBuilder {
1214        crate::new_client_builder(super::builder::resource_record_sets::client::Factory)
1215    }
1216
1217    /// Creates a new client from the provided stub.
1218    ///
1219    /// The most common case for calling this function is in tests mocking the
1220    /// client's behavior.
1221    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1222    where
1223        T: super::stub::ResourceRecordSets + 'static,
1224    {
1225        Self { inner: stub.into() }
1226    }
1227
1228    pub(crate) async fn new(
1229        config: gaxi::options::ClientConfig,
1230    ) -> crate::ClientBuilderResult<Self> {
1231        let inner = Self::build_inner(config).await?;
1232        Ok(Self { inner })
1233    }
1234
1235    async fn build_inner(
1236        conf: gaxi::options::ClientConfig,
1237    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ResourceRecordSets>>
1238    {
1239        if gaxi::options::tracing_enabled(&conf) {
1240            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1241        }
1242        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1243    }
1244
1245    async fn build_transport(
1246        conf: gaxi::options::ClientConfig,
1247    ) -> crate::ClientBuilderResult<impl super::stub::ResourceRecordSets> {
1248        super::transport::ResourceRecordSets::new(conf).await
1249    }
1250
1251    async fn build_with_tracing(
1252        conf: gaxi::options::ClientConfig,
1253    ) -> crate::ClientBuilderResult<impl super::stub::ResourceRecordSets> {
1254        Self::build_transport(conf)
1255            .await
1256            .map(super::tracing::ResourceRecordSets::new)
1257    }
1258
1259    /// Creates a new ResourceRecordSet.
1260    ///
1261    /// # Example
1262    /// ```
1263    /// # use google_cloud_dns_v1::client::ResourceRecordSets;
1264    /// use google_cloud_dns_v1::Result;
1265    /// async fn sample(
1266    ///    client: &ResourceRecordSets
1267    /// ) -> Result<()> {
1268    ///     let response = client.create()
1269    ///         /* set fields */
1270    ///         .send().await?;
1271    ///     println!("response {:?}", response);
1272    ///     Ok(())
1273    /// }
1274    /// ```
1275    pub fn create(&self) -> super::builder::resource_record_sets::Create {
1276        super::builder::resource_record_sets::Create::new(self.inner.clone())
1277    }
1278
1279    /// Deletes a previously created ResourceRecordSet.
1280    ///
1281    /// # Example
1282    /// ```
1283    /// # use google_cloud_dns_v1::client::ResourceRecordSets;
1284    /// use google_cloud_dns_v1::Result;
1285    /// async fn sample(
1286    ///    client: &ResourceRecordSets
1287    /// ) -> Result<()> {
1288    ///     let response = client.delete()
1289    ///         /* set fields */
1290    ///         .send().await?;
1291    ///     println!("response {:?}", response);
1292    ///     Ok(())
1293    /// }
1294    /// ```
1295    pub fn delete(&self) -> super::builder::resource_record_sets::Delete {
1296        super::builder::resource_record_sets::Delete::new(self.inner.clone())
1297    }
1298
1299    /// Fetches the representation of an existing ResourceRecordSet.
1300    ///
1301    /// # Example
1302    /// ```
1303    /// # use google_cloud_dns_v1::client::ResourceRecordSets;
1304    /// use google_cloud_dns_v1::Result;
1305    /// async fn sample(
1306    ///    client: &ResourceRecordSets
1307    /// ) -> Result<()> {
1308    ///     let response = client.get()
1309    ///         /* set fields */
1310    ///         .send().await?;
1311    ///     println!("response {:?}", response);
1312    ///     Ok(())
1313    /// }
1314    /// ```
1315    pub fn get(&self) -> super::builder::resource_record_sets::Get {
1316        super::builder::resource_record_sets::Get::new(self.inner.clone())
1317    }
1318
1319    /// Enumerates ResourceRecordSets that you have created but not yet deleted.
1320    ///
1321    /// # Example
1322    /// ```
1323    /// # use google_cloud_dns_v1::client::ResourceRecordSets;
1324    /// use google_cloud_gax::paginator::ItemPaginator as _;
1325    /// use google_cloud_dns_v1::Result;
1326    /// async fn sample(
1327    ///    client: &ResourceRecordSets
1328    /// ) -> Result<()> {
1329    ///     let mut list = client.list()
1330    ///         /* set fields */
1331    ///         .by_item();
1332    ///     while let Some(item) = list.next().await.transpose()? {
1333    ///         println!("{:?}", item);
1334    ///     }
1335    ///     Ok(())
1336    /// }
1337    /// ```
1338    pub fn list(&self) -> super::builder::resource_record_sets::List {
1339        super::builder::resource_record_sets::List::new(self.inner.clone())
1340    }
1341
1342    /// Applies a partial update to an existing ResourceRecordSet.
1343    ///
1344    /// # Example
1345    /// ```
1346    /// # use google_cloud_dns_v1::client::ResourceRecordSets;
1347    /// use google_cloud_dns_v1::Result;
1348    /// async fn sample(
1349    ///    client: &ResourceRecordSets
1350    /// ) -> Result<()> {
1351    ///     let response = client.patch()
1352    ///         /* set fields */
1353    ///         .send().await?;
1354    ///     println!("response {:?}", response);
1355    ///     Ok(())
1356    /// }
1357    /// ```
1358    pub fn patch(&self) -> super::builder::resource_record_sets::Patch {
1359        super::builder::resource_record_sets::Patch::new(self.inner.clone())
1360    }
1361}
1362
1363/// Implements a client for the Cloud DNS.
1364///
1365/// # Example
1366/// ```
1367/// # use google_cloud_dns_v1::client::ResponsePolicies;
1368/// async fn sample(
1369/// ) -> anyhow::Result<()> {
1370///     let client = ResponsePolicies::builder().build().await?;
1371///     let response = client.create()
1372///         /* set fields */
1373///         .send().await?;
1374///     println!("response {:?}", response);
1375///     Ok(())
1376/// }
1377/// ```
1378///
1379/// # Service Description
1380///
1381/// Service for the `responsePolicies` resource.
1382///
1383/// # Configuration
1384///
1385/// To configure `ResponsePolicies` use the `with_*` methods in the type returned
1386/// by [builder()][ResponsePolicies::builder]. The default configuration should
1387/// work for most applications. Common configuration changes include
1388///
1389/// * [with_endpoint()]: by default this client uses the global default endpoint
1390///   (`https://dns.googleapis.com`). Applications using regional
1391///   endpoints or running in restricted networks (e.g. a network configured
1392///   with [Private Google Access with VPC Service Controls]) may want to
1393///   override this default.
1394/// * [with_credentials()]: by default this client uses
1395///   [Application Default Credentials]. Applications using custom
1396///   authentication may need to override this default.
1397///
1398/// [with_endpoint()]: super::builder::response_policies::ClientBuilder::with_endpoint
1399/// [with_credentials()]: super::builder::response_policies::ClientBuilder::with_credentials
1400/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1401/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1402///
1403/// # Pooling and Cloning
1404///
1405/// `ResponsePolicies` holds a connection pool internally, it is advised to
1406/// create one and reuse it. You do not need to wrap `ResponsePolicies` in
1407/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1408/// already uses an `Arc` internally.
1409#[derive(Clone, Debug)]
1410pub struct ResponsePolicies {
1411    inner: std::sync::Arc<dyn super::stub::dynamic::ResponsePolicies>,
1412}
1413
1414impl ResponsePolicies {
1415    /// Returns a builder for [ResponsePolicies].
1416    ///
1417    /// ```
1418    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1419    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1420    /// let client = ResponsePolicies::builder().build().await?;
1421    /// # Ok(()) }
1422    /// ```
1423    pub fn builder() -> super::builder::response_policies::ClientBuilder {
1424        crate::new_client_builder(super::builder::response_policies::client::Factory)
1425    }
1426
1427    /// Creates a new client from the provided stub.
1428    ///
1429    /// The most common case for calling this function is in tests mocking the
1430    /// client's behavior.
1431    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1432    where
1433        T: super::stub::ResponsePolicies + 'static,
1434    {
1435        Self { inner: stub.into() }
1436    }
1437
1438    pub(crate) async fn new(
1439        config: gaxi::options::ClientConfig,
1440    ) -> crate::ClientBuilderResult<Self> {
1441        let inner = Self::build_inner(config).await?;
1442        Ok(Self { inner })
1443    }
1444
1445    async fn build_inner(
1446        conf: gaxi::options::ClientConfig,
1447    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ResponsePolicies>>
1448    {
1449        if gaxi::options::tracing_enabled(&conf) {
1450            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1451        }
1452        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1453    }
1454
1455    async fn build_transport(
1456        conf: gaxi::options::ClientConfig,
1457    ) -> crate::ClientBuilderResult<impl super::stub::ResponsePolicies> {
1458        super::transport::ResponsePolicies::new(conf).await
1459    }
1460
1461    async fn build_with_tracing(
1462        conf: gaxi::options::ClientConfig,
1463    ) -> crate::ClientBuilderResult<impl super::stub::ResponsePolicies> {
1464        Self::build_transport(conf)
1465            .await
1466            .map(super::tracing::ResponsePolicies::new)
1467    }
1468
1469    /// Creates a new Response Policy
1470    ///
1471    /// # Example
1472    /// ```
1473    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1474    /// use google_cloud_dns_v1::Result;
1475    /// async fn sample(
1476    ///    client: &ResponsePolicies
1477    /// ) -> Result<()> {
1478    ///     let response = client.create()
1479    ///         /* set fields */
1480    ///         .send().await?;
1481    ///     println!("response {:?}", response);
1482    ///     Ok(())
1483    /// }
1484    /// ```
1485    pub fn create(&self) -> super::builder::response_policies::Create {
1486        super::builder::response_policies::Create::new(self.inner.clone())
1487    }
1488
1489    /// Deletes a previously created Response Policy. Fails if the response policy is non-empty or still being referenced by a network.
1490    ///
1491    /// # Example
1492    /// ```
1493    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1494    /// use google_cloud_dns_v1::Result;
1495    /// async fn sample(
1496    ///    client: &ResponsePolicies
1497    /// ) -> Result<()> {
1498    ///     client.delete()
1499    ///         /* set fields */
1500    ///         .send().await?;
1501    ///     Ok(())
1502    /// }
1503    /// ```
1504    pub fn delete(&self) -> super::builder::response_policies::Delete {
1505        super::builder::response_policies::Delete::new(self.inner.clone())
1506    }
1507
1508    /// Fetches the representation of an existing Response Policy.
1509    ///
1510    /// # Example
1511    /// ```
1512    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1513    /// use google_cloud_dns_v1::Result;
1514    /// async fn sample(
1515    ///    client: &ResponsePolicies
1516    /// ) -> Result<()> {
1517    ///     let response = client.get()
1518    ///         /* set fields */
1519    ///         .send().await?;
1520    ///     println!("response {:?}", response);
1521    ///     Ok(())
1522    /// }
1523    /// ```
1524    pub fn get(&self) -> super::builder::response_policies::Get {
1525        super::builder::response_policies::Get::new(self.inner.clone())
1526    }
1527
1528    /// Enumerates all Response Policies associated with a project.
1529    ///
1530    /// # Example
1531    /// ```
1532    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1533    /// use google_cloud_gax::paginator::ItemPaginator as _;
1534    /// use google_cloud_dns_v1::Result;
1535    /// async fn sample(
1536    ///    client: &ResponsePolicies
1537    /// ) -> Result<()> {
1538    ///     let mut list = client.list()
1539    ///         /* set fields */
1540    ///         .by_item();
1541    ///     while let Some(item) = list.next().await.transpose()? {
1542    ///         println!("{:?}", item);
1543    ///     }
1544    ///     Ok(())
1545    /// }
1546    /// ```
1547    pub fn list(&self) -> super::builder::response_policies::List {
1548        super::builder::response_policies::List::new(self.inner.clone())
1549    }
1550
1551    /// Applies a partial update to an existing Response Policy.
1552    ///
1553    /// # Example
1554    /// ```
1555    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1556    /// use google_cloud_dns_v1::Result;
1557    /// async fn sample(
1558    ///    client: &ResponsePolicies
1559    /// ) -> Result<()> {
1560    ///     let response = client.patch()
1561    ///         /* set fields */
1562    ///         .send().await?;
1563    ///     println!("response {:?}", response);
1564    ///     Ok(())
1565    /// }
1566    /// ```
1567    pub fn patch(&self) -> super::builder::response_policies::Patch {
1568        super::builder::response_policies::Patch::new(self.inner.clone())
1569    }
1570
1571    /// Updates an existing Response Policy.
1572    ///
1573    /// # Example
1574    /// ```
1575    /// # use google_cloud_dns_v1::client::ResponsePolicies;
1576    /// use google_cloud_dns_v1::Result;
1577    /// async fn sample(
1578    ///    client: &ResponsePolicies
1579    /// ) -> Result<()> {
1580    ///     let response = client.update()
1581    ///         /* set fields */
1582    ///         .send().await?;
1583    ///     println!("response {:?}", response);
1584    ///     Ok(())
1585    /// }
1586    /// ```
1587    pub fn update(&self) -> super::builder::response_policies::Update {
1588        super::builder::response_policies::Update::new(self.inner.clone())
1589    }
1590}
1591
1592/// Implements a client for the Cloud DNS.
1593///
1594/// # Example
1595/// ```
1596/// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1597/// async fn sample(
1598/// ) -> anyhow::Result<()> {
1599///     let client = ResponsePolicyRules::builder().build().await?;
1600///     let response = client.create()
1601///         /* set fields */
1602///         .send().await?;
1603///     println!("response {:?}", response);
1604///     Ok(())
1605/// }
1606/// ```
1607///
1608/// # Service Description
1609///
1610/// Service for the `responsePolicyRules` resource.
1611///
1612/// # Configuration
1613///
1614/// To configure `ResponsePolicyRules` use the `with_*` methods in the type returned
1615/// by [builder()][ResponsePolicyRules::builder]. The default configuration should
1616/// work for most applications. Common configuration changes include
1617///
1618/// * [with_endpoint()]: by default this client uses the global default endpoint
1619///   (`https://dns.googleapis.com`). Applications using regional
1620///   endpoints or running in restricted networks (e.g. a network configured
1621///   with [Private Google Access with VPC Service Controls]) may want to
1622///   override this default.
1623/// * [with_credentials()]: by default this client uses
1624///   [Application Default Credentials]. Applications using custom
1625///   authentication may need to override this default.
1626///
1627/// [with_endpoint()]: super::builder::response_policy_rules::ClientBuilder::with_endpoint
1628/// [with_credentials()]: super::builder::response_policy_rules::ClientBuilder::with_credentials
1629/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1630/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1631///
1632/// # Pooling and Cloning
1633///
1634/// `ResponsePolicyRules` holds a connection pool internally, it is advised to
1635/// create one and reuse it. You do not need to wrap `ResponsePolicyRules` in
1636/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1637/// already uses an `Arc` internally.
1638#[derive(Clone, Debug)]
1639pub struct ResponsePolicyRules {
1640    inner: std::sync::Arc<dyn super::stub::dynamic::ResponsePolicyRules>,
1641}
1642
1643impl ResponsePolicyRules {
1644    /// Returns a builder for [ResponsePolicyRules].
1645    ///
1646    /// ```
1647    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1648    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1649    /// let client = ResponsePolicyRules::builder().build().await?;
1650    /// # Ok(()) }
1651    /// ```
1652    pub fn builder() -> super::builder::response_policy_rules::ClientBuilder {
1653        crate::new_client_builder(super::builder::response_policy_rules::client::Factory)
1654    }
1655
1656    /// Creates a new client from the provided stub.
1657    ///
1658    /// The most common case for calling this function is in tests mocking the
1659    /// client's behavior.
1660    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1661    where
1662        T: super::stub::ResponsePolicyRules + 'static,
1663    {
1664        Self { inner: stub.into() }
1665    }
1666
1667    pub(crate) async fn new(
1668        config: gaxi::options::ClientConfig,
1669    ) -> crate::ClientBuilderResult<Self> {
1670        let inner = Self::build_inner(config).await?;
1671        Ok(Self { inner })
1672    }
1673
1674    async fn build_inner(
1675        conf: gaxi::options::ClientConfig,
1676    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ResponsePolicyRules>>
1677    {
1678        if gaxi::options::tracing_enabled(&conf) {
1679            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1680        }
1681        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1682    }
1683
1684    async fn build_transport(
1685        conf: gaxi::options::ClientConfig,
1686    ) -> crate::ClientBuilderResult<impl super::stub::ResponsePolicyRules> {
1687        super::transport::ResponsePolicyRules::new(conf).await
1688    }
1689
1690    async fn build_with_tracing(
1691        conf: gaxi::options::ClientConfig,
1692    ) -> crate::ClientBuilderResult<impl super::stub::ResponsePolicyRules> {
1693        Self::build_transport(conf)
1694            .await
1695            .map(super::tracing::ResponsePolicyRules::new)
1696    }
1697
1698    /// Creates a new Response Policy Rule.
1699    ///
1700    /// # Example
1701    /// ```
1702    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1703    /// use google_cloud_dns_v1::Result;
1704    /// async fn sample(
1705    ///    client: &ResponsePolicyRules
1706    /// ) -> Result<()> {
1707    ///     let response = client.create()
1708    ///         /* set fields */
1709    ///         .send().await?;
1710    ///     println!("response {:?}", response);
1711    ///     Ok(())
1712    /// }
1713    /// ```
1714    pub fn create(&self) -> super::builder::response_policy_rules::Create {
1715        super::builder::response_policy_rules::Create::new(self.inner.clone())
1716    }
1717
1718    /// Deletes a previously created Response Policy Rule.
1719    ///
1720    /// # Example
1721    /// ```
1722    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1723    /// use google_cloud_dns_v1::Result;
1724    /// async fn sample(
1725    ///    client: &ResponsePolicyRules
1726    /// ) -> Result<()> {
1727    ///     client.delete()
1728    ///         /* set fields */
1729    ///         .send().await?;
1730    ///     Ok(())
1731    /// }
1732    /// ```
1733    pub fn delete(&self) -> super::builder::response_policy_rules::Delete {
1734        super::builder::response_policy_rules::Delete::new(self.inner.clone())
1735    }
1736
1737    /// Fetches the representation of an existing Response Policy Rule.
1738    ///
1739    /// # Example
1740    /// ```
1741    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1742    /// use google_cloud_dns_v1::Result;
1743    /// async fn sample(
1744    ///    client: &ResponsePolicyRules
1745    /// ) -> Result<()> {
1746    ///     let response = client.get()
1747    ///         /* set fields */
1748    ///         .send().await?;
1749    ///     println!("response {:?}", response);
1750    ///     Ok(())
1751    /// }
1752    /// ```
1753    pub fn get(&self) -> super::builder::response_policy_rules::Get {
1754        super::builder::response_policy_rules::Get::new(self.inner.clone())
1755    }
1756
1757    /// Enumerates all Response Policy Rules associated with a project.
1758    ///
1759    /// # Example
1760    /// ```
1761    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1762    /// use google_cloud_gax::paginator::ItemPaginator as _;
1763    /// use google_cloud_dns_v1::Result;
1764    /// async fn sample(
1765    ///    client: &ResponsePolicyRules
1766    /// ) -> Result<()> {
1767    ///     let mut list = client.list()
1768    ///         /* set fields */
1769    ///         .by_item();
1770    ///     while let Some(item) = list.next().await.transpose()? {
1771    ///         println!("{:?}", item);
1772    ///     }
1773    ///     Ok(())
1774    /// }
1775    /// ```
1776    pub fn list(&self) -> super::builder::response_policy_rules::List {
1777        super::builder::response_policy_rules::List::new(self.inner.clone())
1778    }
1779
1780    /// Applies a partial update to an existing Response Policy Rule.
1781    ///
1782    /// # Example
1783    /// ```
1784    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1785    /// use google_cloud_dns_v1::Result;
1786    /// async fn sample(
1787    ///    client: &ResponsePolicyRules
1788    /// ) -> Result<()> {
1789    ///     let response = client.patch()
1790    ///         /* set fields */
1791    ///         .send().await?;
1792    ///     println!("response {:?}", response);
1793    ///     Ok(())
1794    /// }
1795    /// ```
1796    pub fn patch(&self) -> super::builder::response_policy_rules::Patch {
1797        super::builder::response_policy_rules::Patch::new(self.inner.clone())
1798    }
1799
1800    /// Updates an existing Response Policy Rule.
1801    ///
1802    /// # Example
1803    /// ```
1804    /// # use google_cloud_dns_v1::client::ResponsePolicyRules;
1805    /// use google_cloud_dns_v1::Result;
1806    /// async fn sample(
1807    ///    client: &ResponsePolicyRules
1808    /// ) -> Result<()> {
1809    ///     let response = client.update()
1810    ///         /* set fields */
1811    ///         .send().await?;
1812    ///     println!("response {:?}", response);
1813    ///     Ok(())
1814    /// }
1815    /// ```
1816    pub fn update(&self) -> super::builder::response_policy_rules::Update {
1817        super::builder::response_policy_rules::Update::new(self.inner.clone())
1818    }
1819}