google_cloud_compute_v1/client.rs
1// Copyright 2025 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 Google Compute Engine API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_compute_v1::client::AcceleratorTypes;
26/// async fn sample(
27/// ) -> anyhow::Result<()> {
28/// let client = AcceleratorTypes::builder().build().await?;
29/// // use `client` to make requests to the Google Compute Engine API.
30/// Ok(())
31/// }
32/// ```
33///
34/// # Service Description
35///
36/// Service for the `acceleratorTypes` resource.
37///
38/// # Configuration
39///
40/// To configure `AcceleratorTypes` use the `with_*` methods in the type returned
41/// by [builder()][AcceleratorTypes::builder]. The default configuration should
42/// work for most applications. Common configuration changes include
43///
44/// * [with_endpoint()]: by default this client uses the global default endpoint
45/// (`https://compute.googleapis.com`). Applications using regional
46/// endpoints or running in restricted networks (e.g. a network configured
47/// with [Private Google Access with VPC Service Controls]) may want to
48/// override this default.
49/// * [with_credentials()]: by default this client uses
50/// [Application Default Credentials]. Applications using custom
51/// authentication may need to override this default.
52///
53/// [with_endpoint()]: super::builder::accelerator_types::ClientBuilder::with_endpoint
54/// [with_credentials()]: super::builder::accelerator_types::ClientBuilder::with_credentials
55/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
56/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
57///
58/// # Pooling and Cloning
59///
60/// `AcceleratorTypes` holds a connection pool internally, it is advised to
61/// create one and reuse it. You do not need to wrap `AcceleratorTypes` in
62/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
63/// already uses an `Arc` internally.
64#[cfg(feature = "accelerator-types")]
65#[cfg_attr(docsrs, doc(cfg(feature = "accelerator-types")))]
66#[derive(Clone, Debug)]
67pub struct AcceleratorTypes {
68 inner: std::sync::Arc<dyn super::stub::dynamic::AcceleratorTypes>,
69}
70
71#[cfg(feature = "accelerator-types")]
72impl AcceleratorTypes {
73 /// Returns a builder for [AcceleratorTypes].
74 ///
75 /// ```
76 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77 /// # use google_cloud_compute_v1::client::AcceleratorTypes;
78 /// let client = AcceleratorTypes::builder().build().await?;
79 /// # Ok(()) }
80 /// ```
81 pub fn builder() -> super::builder::accelerator_types::ClientBuilder {
82 crate::new_client_builder(super::builder::accelerator_types::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::AcceleratorTypes + '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::AcceleratorTypes>>
106 {
107 if gaxi::options::tracing_enabled(&conf) {
108 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
109 }
110 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
111 }
112
113 async fn build_transport(
114 conf: gaxi::options::ClientConfig,
115 ) -> crate::ClientBuilderResult<impl super::stub::AcceleratorTypes> {
116 super::transport::AcceleratorTypes::new(conf).await
117 }
118
119 async fn build_with_tracing(
120 conf: gaxi::options::ClientConfig,
121 ) -> crate::ClientBuilderResult<impl super::stub::AcceleratorTypes> {
122 Self::build_transport(conf)
123 .await
124 .map(super::tracing::AcceleratorTypes::new)
125 }
126
127 /// Retrieves an aggregated list of accelerator types.
128 ///
129 /// To prevent failure, it is recommended that you set the
130 /// `returnPartialSuccess` parameter to `true`.
131 pub fn aggregated_list(&self) -> super::builder::accelerator_types::AggregatedList {
132 super::builder::accelerator_types::AggregatedList::new(self.inner.clone())
133 }
134
135 /// Returns the specified accelerator type.
136 pub fn get(&self) -> super::builder::accelerator_types::Get {
137 super::builder::accelerator_types::Get::new(self.inner.clone())
138 }
139
140 /// Retrieves a list of accelerator types that are available to the specified
141 /// project.
142 pub fn list(&self) -> super::builder::accelerator_types::List {
143 super::builder::accelerator_types::List::new(self.inner.clone())
144 }
145}
146
147/// Implements a client for the Google Compute Engine API.
148///
149/// # Example
150/// ```
151/// # use google_cloud_compute_v1::client::Addresses;
152/// async fn sample(
153/// ) -> anyhow::Result<()> {
154/// let client = Addresses::builder().build().await?;
155/// // use `client` to make requests to the Google Compute Engine API.
156/// Ok(())
157/// }
158/// ```
159///
160/// # Service Description
161///
162/// Service for the `addresses` resource.
163///
164/// # Configuration
165///
166/// To configure `Addresses` use the `with_*` methods in the type returned
167/// by [builder()][Addresses::builder]. The default configuration should
168/// work for most applications. Common configuration changes include
169///
170/// * [with_endpoint()]: by default this client uses the global default endpoint
171/// (`https://compute.googleapis.com`). Applications using regional
172/// endpoints or running in restricted networks (e.g. a network configured
173/// with [Private Google Access with VPC Service Controls]) may want to
174/// override this default.
175/// * [with_credentials()]: by default this client uses
176/// [Application Default Credentials]. Applications using custom
177/// authentication may need to override this default.
178///
179/// [with_endpoint()]: super::builder::addresses::ClientBuilder::with_endpoint
180/// [with_credentials()]: super::builder::addresses::ClientBuilder::with_credentials
181/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
182/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
183///
184/// # Pooling and Cloning
185///
186/// `Addresses` holds a connection pool internally, it is advised to
187/// create one and reuse it. You do not need to wrap `Addresses` in
188/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
189/// already uses an `Arc` internally.
190#[cfg(feature = "addresses")]
191#[cfg_attr(docsrs, doc(cfg(feature = "addresses")))]
192#[derive(Clone, Debug)]
193pub struct Addresses {
194 inner: std::sync::Arc<dyn super::stub::dynamic::Addresses>,
195}
196
197#[cfg(feature = "addresses")]
198impl Addresses {
199 /// Returns a builder for [Addresses].
200 ///
201 /// ```
202 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
203 /// # use google_cloud_compute_v1::client::Addresses;
204 /// let client = Addresses::builder().build().await?;
205 /// # Ok(()) }
206 /// ```
207 pub fn builder() -> super::builder::addresses::ClientBuilder {
208 crate::new_client_builder(super::builder::addresses::client::Factory)
209 }
210
211 /// Creates a new client from the provided stub.
212 ///
213 /// The most common case for calling this function is in tests mocking the
214 /// client's behavior.
215 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
216 where
217 T: super::stub::Addresses + 'static,
218 {
219 Self { inner: stub.into() }
220 }
221
222 pub(crate) async fn new(
223 config: gaxi::options::ClientConfig,
224 ) -> crate::ClientBuilderResult<Self> {
225 let inner = Self::build_inner(config).await?;
226 Ok(Self { inner })
227 }
228
229 async fn build_inner(
230 conf: gaxi::options::ClientConfig,
231 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Addresses>> {
232 if gaxi::options::tracing_enabled(&conf) {
233 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
234 }
235 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
236 }
237
238 async fn build_transport(
239 conf: gaxi::options::ClientConfig,
240 ) -> crate::ClientBuilderResult<impl super::stub::Addresses> {
241 super::transport::Addresses::new(conf).await
242 }
243
244 async fn build_with_tracing(
245 conf: gaxi::options::ClientConfig,
246 ) -> crate::ClientBuilderResult<impl super::stub::Addresses> {
247 Self::build_transport(conf)
248 .await
249 .map(super::tracing::Addresses::new)
250 }
251
252 /// Retrieves an aggregated list of addresses.
253 ///
254 /// To prevent failure, it is recommended that you set the
255 /// `returnPartialSuccess` parameter to `true`.
256 pub fn aggregated_list(&self) -> super::builder::addresses::AggregatedList {
257 super::builder::addresses::AggregatedList::new(self.inner.clone())
258 }
259
260 /// Deletes the specified address resource.
261 pub fn delete(&self) -> super::builder::addresses::Delete {
262 super::builder::addresses::Delete::new(self.inner.clone())
263 }
264
265 /// Returns the specified address resource.
266 pub fn get(&self) -> super::builder::addresses::Get {
267 super::builder::addresses::Get::new(self.inner.clone())
268 }
269
270 /// Creates an address resource in the specified project by using the data
271 /// included in the request.
272 pub fn insert(&self) -> super::builder::addresses::Insert {
273 super::builder::addresses::Insert::new(self.inner.clone())
274 }
275
276 /// Retrieves a list of addresses contained within
277 /// the specified region.
278 pub fn list(&self) -> super::builder::addresses::List {
279 super::builder::addresses::List::new(self.inner.clone())
280 }
281
282 /// Moves the specified address resource.
283 pub fn r#move(&self) -> super::builder::addresses::Move {
284 super::builder::addresses::Move::new(self.inner.clone())
285 }
286
287 /// Sets the labels on an Address. To learn more about labels, read theLabeling
288 /// Resources documentation.
289 pub fn set_labels(&self) -> super::builder::addresses::SetLabels {
290 super::builder::addresses::SetLabels::new(self.inner.clone())
291 }
292
293 /// Returns permissions that a caller has on the specified resource.
294 pub fn test_iam_permissions(&self) -> super::builder::addresses::TestIamPermissions {
295 super::builder::addresses::TestIamPermissions::new(self.inner.clone())
296 }
297
298 /// Retrieves the specified region-specific Operations resource.
299 pub fn get_operation(&self) -> super::builder::addresses::GetOperation {
300 super::builder::addresses::GetOperation::new(self.inner.clone())
301 }
302}
303
304/// Implements a client for the Google Compute Engine API.
305///
306/// # Example
307/// ```
308/// # use google_cloud_compute_v1::client::Advice;
309/// async fn sample(
310/// ) -> anyhow::Result<()> {
311/// let client = Advice::builder().build().await?;
312/// // use `client` to make requests to the Google Compute Engine API.
313/// Ok(())
314/// }
315/// ```
316///
317/// # Service Description
318///
319/// Service for the `advice` resource.
320///
321/// # Configuration
322///
323/// To configure `Advice` use the `with_*` methods in the type returned
324/// by [builder()][Advice::builder]. The default configuration should
325/// work for most applications. Common configuration changes include
326///
327/// * [with_endpoint()]: by default this client uses the global default endpoint
328/// (`https://compute.googleapis.com`). Applications using regional
329/// endpoints or running in restricted networks (e.g. a network configured
330/// with [Private Google Access with VPC Service Controls]) may want to
331/// override this default.
332/// * [with_credentials()]: by default this client uses
333/// [Application Default Credentials]. Applications using custom
334/// authentication may need to override this default.
335///
336/// [with_endpoint()]: super::builder::advice::ClientBuilder::with_endpoint
337/// [with_credentials()]: super::builder::advice::ClientBuilder::with_credentials
338/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
339/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
340///
341/// # Pooling and Cloning
342///
343/// `Advice` holds a connection pool internally, it is advised to
344/// create one and reuse it. You do not need to wrap `Advice` in
345/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
346/// already uses an `Arc` internally.
347#[cfg(feature = "advice")]
348#[cfg_attr(docsrs, doc(cfg(feature = "advice")))]
349#[derive(Clone, Debug)]
350pub struct Advice {
351 inner: std::sync::Arc<dyn super::stub::dynamic::Advice>,
352}
353
354#[cfg(feature = "advice")]
355impl Advice {
356 /// Returns a builder for [Advice].
357 ///
358 /// ```
359 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
360 /// # use google_cloud_compute_v1::client::Advice;
361 /// let client = Advice::builder().build().await?;
362 /// # Ok(()) }
363 /// ```
364 pub fn builder() -> super::builder::advice::ClientBuilder {
365 crate::new_client_builder(super::builder::advice::client::Factory)
366 }
367
368 /// Creates a new client from the provided stub.
369 ///
370 /// The most common case for calling this function is in tests mocking the
371 /// client's behavior.
372 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
373 where
374 T: super::stub::Advice + 'static,
375 {
376 Self { inner: stub.into() }
377 }
378
379 pub(crate) async fn new(
380 config: gaxi::options::ClientConfig,
381 ) -> crate::ClientBuilderResult<Self> {
382 let inner = Self::build_inner(config).await?;
383 Ok(Self { inner })
384 }
385
386 async fn build_inner(
387 conf: gaxi::options::ClientConfig,
388 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Advice>> {
389 if gaxi::options::tracing_enabled(&conf) {
390 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
391 }
392 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
393 }
394
395 async fn build_transport(
396 conf: gaxi::options::ClientConfig,
397 ) -> crate::ClientBuilderResult<impl super::stub::Advice> {
398 super::transport::Advice::new(conf).await
399 }
400
401 async fn build_with_tracing(
402 conf: gaxi::options::ClientConfig,
403 ) -> crate::ClientBuilderResult<impl super::stub::Advice> {
404 Self::build_transport(conf)
405 .await
406 .map(super::tracing::Advice::new)
407 }
408
409 /// Advise how, where and when to create the requested amount of instances
410 /// with specified accelerators, within the specified time and location limits.
411 /// The method recommends creating future reservations for the requested
412 /// resources.
413 pub fn calendar_mode(&self) -> super::builder::advice::CalendarMode {
414 super::builder::advice::CalendarMode::new(self.inner.clone())
415 }
416}
417
418/// Implements a client for the Google Compute Engine API.
419///
420/// # Example
421/// ```
422/// # use google_cloud_compute_v1::client::Autoscalers;
423/// async fn sample(
424/// ) -> anyhow::Result<()> {
425/// let client = Autoscalers::builder().build().await?;
426/// // use `client` to make requests to the Google Compute Engine API.
427/// Ok(())
428/// }
429/// ```
430///
431/// # Service Description
432///
433/// Service for the `autoscalers` resource.
434///
435/// # Configuration
436///
437/// To configure `Autoscalers` use the `with_*` methods in the type returned
438/// by [builder()][Autoscalers::builder]. The default configuration should
439/// work for most applications. Common configuration changes include
440///
441/// * [with_endpoint()]: by default this client uses the global default endpoint
442/// (`https://compute.googleapis.com`). Applications using regional
443/// endpoints or running in restricted networks (e.g. a network configured
444/// with [Private Google Access with VPC Service Controls]) may want to
445/// override this default.
446/// * [with_credentials()]: by default this client uses
447/// [Application Default Credentials]. Applications using custom
448/// authentication may need to override this default.
449///
450/// [with_endpoint()]: super::builder::autoscalers::ClientBuilder::with_endpoint
451/// [with_credentials()]: super::builder::autoscalers::ClientBuilder::with_credentials
452/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
453/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
454///
455/// # Pooling and Cloning
456///
457/// `Autoscalers` holds a connection pool internally, it is advised to
458/// create one and reuse it. You do not need to wrap `Autoscalers` in
459/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
460/// already uses an `Arc` internally.
461#[cfg(feature = "autoscalers")]
462#[cfg_attr(docsrs, doc(cfg(feature = "autoscalers")))]
463#[derive(Clone, Debug)]
464pub struct Autoscalers {
465 inner: std::sync::Arc<dyn super::stub::dynamic::Autoscalers>,
466}
467
468#[cfg(feature = "autoscalers")]
469impl Autoscalers {
470 /// Returns a builder for [Autoscalers].
471 ///
472 /// ```
473 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
474 /// # use google_cloud_compute_v1::client::Autoscalers;
475 /// let client = Autoscalers::builder().build().await?;
476 /// # Ok(()) }
477 /// ```
478 pub fn builder() -> super::builder::autoscalers::ClientBuilder {
479 crate::new_client_builder(super::builder::autoscalers::client::Factory)
480 }
481
482 /// Creates a new client from the provided stub.
483 ///
484 /// The most common case for calling this function is in tests mocking the
485 /// client's behavior.
486 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
487 where
488 T: super::stub::Autoscalers + 'static,
489 {
490 Self { inner: stub.into() }
491 }
492
493 pub(crate) async fn new(
494 config: gaxi::options::ClientConfig,
495 ) -> crate::ClientBuilderResult<Self> {
496 let inner = Self::build_inner(config).await?;
497 Ok(Self { inner })
498 }
499
500 async fn build_inner(
501 conf: gaxi::options::ClientConfig,
502 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Autoscalers>> {
503 if gaxi::options::tracing_enabled(&conf) {
504 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
505 }
506 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
507 }
508
509 async fn build_transport(
510 conf: gaxi::options::ClientConfig,
511 ) -> crate::ClientBuilderResult<impl super::stub::Autoscalers> {
512 super::transport::Autoscalers::new(conf).await
513 }
514
515 async fn build_with_tracing(
516 conf: gaxi::options::ClientConfig,
517 ) -> crate::ClientBuilderResult<impl super::stub::Autoscalers> {
518 Self::build_transport(conf)
519 .await
520 .map(super::tracing::Autoscalers::new)
521 }
522
523 /// Retrieves an aggregated list of autoscalers.
524 ///
525 /// To prevent failure, it is recommended that you set the
526 /// `returnPartialSuccess` parameter to `true`.
527 pub fn aggregated_list(&self) -> super::builder::autoscalers::AggregatedList {
528 super::builder::autoscalers::AggregatedList::new(self.inner.clone())
529 }
530
531 /// Deletes the specified autoscaler.
532 pub fn delete(&self) -> super::builder::autoscalers::Delete {
533 super::builder::autoscalers::Delete::new(self.inner.clone())
534 }
535
536 /// Returns the specified autoscaler resource.
537 pub fn get(&self) -> super::builder::autoscalers::Get {
538 super::builder::autoscalers::Get::new(self.inner.clone())
539 }
540
541 /// Creates an autoscaler in the specified project using the data
542 /// included in the request.
543 pub fn insert(&self) -> super::builder::autoscalers::Insert {
544 super::builder::autoscalers::Insert::new(self.inner.clone())
545 }
546
547 /// Retrieves a list of autoscalers contained within
548 /// the specified zone.
549 pub fn list(&self) -> super::builder::autoscalers::List {
550 super::builder::autoscalers::List::new(self.inner.clone())
551 }
552
553 /// Updates an autoscaler in the specified project using the data
554 /// included in the request. This method supportsPATCH
555 /// semantics and uses theJSON merge
556 /// patch format and processing rules.
557 pub fn patch(&self) -> super::builder::autoscalers::Patch {
558 super::builder::autoscalers::Patch::new(self.inner.clone())
559 }
560
561 /// Returns permissions that a caller has on the specified resource.
562 pub fn test_iam_permissions(&self) -> super::builder::autoscalers::TestIamPermissions {
563 super::builder::autoscalers::TestIamPermissions::new(self.inner.clone())
564 }
565
566 /// Updates an autoscaler in the specified project using the data
567 /// included in the request.
568 pub fn update(&self) -> super::builder::autoscalers::Update {
569 super::builder::autoscalers::Update::new(self.inner.clone())
570 }
571
572 /// Retrieves the specified zone-specific Operations resource.
573 pub fn get_operation(&self) -> super::builder::autoscalers::GetOperation {
574 super::builder::autoscalers::GetOperation::new(self.inner.clone())
575 }
576}
577
578/// Implements a client for the Google Compute Engine API.
579///
580/// # Example
581/// ```
582/// # use google_cloud_compute_v1::client::BackendBuckets;
583/// async fn sample(
584/// ) -> anyhow::Result<()> {
585/// let client = BackendBuckets::builder().build().await?;
586/// // use `client` to make requests to the Google Compute Engine API.
587/// Ok(())
588/// }
589/// ```
590///
591/// # Service Description
592///
593/// Service for the `backendBuckets` resource.
594///
595/// # Configuration
596///
597/// To configure `BackendBuckets` use the `with_*` methods in the type returned
598/// by [builder()][BackendBuckets::builder]. The default configuration should
599/// work for most applications. Common configuration changes include
600///
601/// * [with_endpoint()]: by default this client uses the global default endpoint
602/// (`https://compute.googleapis.com`). Applications using regional
603/// endpoints or running in restricted networks (e.g. a network configured
604/// with [Private Google Access with VPC Service Controls]) may want to
605/// override this default.
606/// * [with_credentials()]: by default this client uses
607/// [Application Default Credentials]. Applications using custom
608/// authentication may need to override this default.
609///
610/// [with_endpoint()]: super::builder::backend_buckets::ClientBuilder::with_endpoint
611/// [with_credentials()]: super::builder::backend_buckets::ClientBuilder::with_credentials
612/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
613/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
614///
615/// # Pooling and Cloning
616///
617/// `BackendBuckets` holds a connection pool internally, it is advised to
618/// create one and reuse it. You do not need to wrap `BackendBuckets` in
619/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
620/// already uses an `Arc` internally.
621#[cfg(feature = "backend-buckets")]
622#[cfg_attr(docsrs, doc(cfg(feature = "backend-buckets")))]
623#[derive(Clone, Debug)]
624pub struct BackendBuckets {
625 inner: std::sync::Arc<dyn super::stub::dynamic::BackendBuckets>,
626}
627
628#[cfg(feature = "backend-buckets")]
629impl BackendBuckets {
630 /// Returns a builder for [BackendBuckets].
631 ///
632 /// ```
633 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
634 /// # use google_cloud_compute_v1::client::BackendBuckets;
635 /// let client = BackendBuckets::builder().build().await?;
636 /// # Ok(()) }
637 /// ```
638 pub fn builder() -> super::builder::backend_buckets::ClientBuilder {
639 crate::new_client_builder(super::builder::backend_buckets::client::Factory)
640 }
641
642 /// Creates a new client from the provided stub.
643 ///
644 /// The most common case for calling this function is in tests mocking the
645 /// client's behavior.
646 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
647 where
648 T: super::stub::BackendBuckets + 'static,
649 {
650 Self { inner: stub.into() }
651 }
652
653 pub(crate) async fn new(
654 config: gaxi::options::ClientConfig,
655 ) -> crate::ClientBuilderResult<Self> {
656 let inner = Self::build_inner(config).await?;
657 Ok(Self { inner })
658 }
659
660 async fn build_inner(
661 conf: gaxi::options::ClientConfig,
662 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::BackendBuckets>> {
663 if gaxi::options::tracing_enabled(&conf) {
664 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
665 }
666 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
667 }
668
669 async fn build_transport(
670 conf: gaxi::options::ClientConfig,
671 ) -> crate::ClientBuilderResult<impl super::stub::BackendBuckets> {
672 super::transport::BackendBuckets::new(conf).await
673 }
674
675 async fn build_with_tracing(
676 conf: gaxi::options::ClientConfig,
677 ) -> crate::ClientBuilderResult<impl super::stub::BackendBuckets> {
678 Self::build_transport(conf)
679 .await
680 .map(super::tracing::BackendBuckets::new)
681 }
682
683 /// Adds a key for validating requests with signed URLs for this backend
684 /// bucket.
685 pub fn add_signed_url_key(&self) -> super::builder::backend_buckets::AddSignedUrlKey {
686 super::builder::backend_buckets::AddSignedUrlKey::new(self.inner.clone())
687 }
688
689 /// Retrieves the list of all BackendBucket resources, regional and global,
690 /// available to the specified project.
691 ///
692 /// To prevent failure, it is recommended that you set the
693 /// `returnPartialSuccess` parameter to `true`.
694 pub fn aggregated_list(&self) -> super::builder::backend_buckets::AggregatedList {
695 super::builder::backend_buckets::AggregatedList::new(self.inner.clone())
696 }
697
698 /// Deletes the specified BackendBucket resource.
699 pub fn delete(&self) -> super::builder::backend_buckets::Delete {
700 super::builder::backend_buckets::Delete::new(self.inner.clone())
701 }
702
703 /// Deletes a key for validating requests with signed URLs for this backend
704 /// bucket.
705 pub fn delete_signed_url_key(&self) -> super::builder::backend_buckets::DeleteSignedUrlKey {
706 super::builder::backend_buckets::DeleteSignedUrlKey::new(self.inner.clone())
707 }
708
709 /// Returns the specified BackendBucket resource.
710 pub fn get(&self) -> super::builder::backend_buckets::Get {
711 super::builder::backend_buckets::Get::new(self.inner.clone())
712 }
713
714 /// Gets the access control policy for a resource. May be empty if no such
715 /// policy or resource exists.
716 pub fn get_iam_policy(&self) -> super::builder::backend_buckets::GetIamPolicy {
717 super::builder::backend_buckets::GetIamPolicy::new(self.inner.clone())
718 }
719
720 /// Creates a BackendBucket resource in the specified project using
721 /// the data included in the request.
722 pub fn insert(&self) -> super::builder::backend_buckets::Insert {
723 super::builder::backend_buckets::Insert::new(self.inner.clone())
724 }
725
726 /// Retrieves the list of BackendBucket resources available to the specified
727 /// project.
728 pub fn list(&self) -> super::builder::backend_buckets::List {
729 super::builder::backend_buckets::List::new(self.inner.clone())
730 }
731
732 /// Retrieves a list of all usable backend buckets in the specified project.
733 pub fn list_usable(&self) -> super::builder::backend_buckets::ListUsable {
734 super::builder::backend_buckets::ListUsable::new(self.inner.clone())
735 }
736
737 /// Updates the specified BackendBucket resource with the data included in the
738 /// request. This method supportsPATCH
739 /// semantics and uses theJSON merge
740 /// patch format and processing rules.
741 pub fn patch(&self) -> super::builder::backend_buckets::Patch {
742 super::builder::backend_buckets::Patch::new(self.inner.clone())
743 }
744
745 /// Sets the edge security policy for the specified backend bucket.
746 pub fn set_edge_security_policy(
747 &self,
748 ) -> super::builder::backend_buckets::SetEdgeSecurityPolicy {
749 super::builder::backend_buckets::SetEdgeSecurityPolicy::new(self.inner.clone())
750 }
751
752 /// Sets the access control policy on the specified resource.
753 /// Replaces any existing policy.
754 pub fn set_iam_policy(&self) -> super::builder::backend_buckets::SetIamPolicy {
755 super::builder::backend_buckets::SetIamPolicy::new(self.inner.clone())
756 }
757
758 /// Returns permissions that a caller has on the specified resource.
759 pub fn test_iam_permissions(&self) -> super::builder::backend_buckets::TestIamPermissions {
760 super::builder::backend_buckets::TestIamPermissions::new(self.inner.clone())
761 }
762
763 /// Updates the specified BackendBucket resource with the data included in the
764 /// request.
765 pub fn update(&self) -> super::builder::backend_buckets::Update {
766 super::builder::backend_buckets::Update::new(self.inner.clone())
767 }
768
769 /// Retrieves the specified Operations resource.
770 pub fn get_operation(&self) -> super::builder::backend_buckets::GetOperation {
771 super::builder::backend_buckets::GetOperation::new(self.inner.clone())
772 }
773}
774
775/// Implements a client for the Google Compute Engine API.
776///
777/// # Example
778/// ```
779/// # use google_cloud_compute_v1::client::BackendServices;
780/// async fn sample(
781/// ) -> anyhow::Result<()> {
782/// let client = BackendServices::builder().build().await?;
783/// // use `client` to make requests to the Google Compute Engine API.
784/// Ok(())
785/// }
786/// ```
787///
788/// # Service Description
789///
790/// Service for the `backendServices` resource.
791///
792/// # Configuration
793///
794/// To configure `BackendServices` use the `with_*` methods in the type returned
795/// by [builder()][BackendServices::builder]. The default configuration should
796/// work for most applications. Common configuration changes include
797///
798/// * [with_endpoint()]: by default this client uses the global default endpoint
799/// (`https://compute.googleapis.com`). Applications using regional
800/// endpoints or running in restricted networks (e.g. a network configured
801/// with [Private Google Access with VPC Service Controls]) may want to
802/// override this default.
803/// * [with_credentials()]: by default this client uses
804/// [Application Default Credentials]. Applications using custom
805/// authentication may need to override this default.
806///
807/// [with_endpoint()]: super::builder::backend_services::ClientBuilder::with_endpoint
808/// [with_credentials()]: super::builder::backend_services::ClientBuilder::with_credentials
809/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
810/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
811///
812/// # Pooling and Cloning
813///
814/// `BackendServices` holds a connection pool internally, it is advised to
815/// create one and reuse it. You do not need to wrap `BackendServices` in
816/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
817/// already uses an `Arc` internally.
818#[cfg(feature = "backend-services")]
819#[cfg_attr(docsrs, doc(cfg(feature = "backend-services")))]
820#[derive(Clone, Debug)]
821pub struct BackendServices {
822 inner: std::sync::Arc<dyn super::stub::dynamic::BackendServices>,
823}
824
825#[cfg(feature = "backend-services")]
826impl BackendServices {
827 /// Returns a builder for [BackendServices].
828 ///
829 /// ```
830 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
831 /// # use google_cloud_compute_v1::client::BackendServices;
832 /// let client = BackendServices::builder().build().await?;
833 /// # Ok(()) }
834 /// ```
835 pub fn builder() -> super::builder::backend_services::ClientBuilder {
836 crate::new_client_builder(super::builder::backend_services::client::Factory)
837 }
838
839 /// Creates a new client from the provided stub.
840 ///
841 /// The most common case for calling this function is in tests mocking the
842 /// client's behavior.
843 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
844 where
845 T: super::stub::BackendServices + 'static,
846 {
847 Self { inner: stub.into() }
848 }
849
850 pub(crate) async fn new(
851 config: gaxi::options::ClientConfig,
852 ) -> crate::ClientBuilderResult<Self> {
853 let inner = Self::build_inner(config).await?;
854 Ok(Self { inner })
855 }
856
857 async fn build_inner(
858 conf: gaxi::options::ClientConfig,
859 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::BackendServices>> {
860 if gaxi::options::tracing_enabled(&conf) {
861 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
862 }
863 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
864 }
865
866 async fn build_transport(
867 conf: gaxi::options::ClientConfig,
868 ) -> crate::ClientBuilderResult<impl super::stub::BackendServices> {
869 super::transport::BackendServices::new(conf).await
870 }
871
872 async fn build_with_tracing(
873 conf: gaxi::options::ClientConfig,
874 ) -> crate::ClientBuilderResult<impl super::stub::BackendServices> {
875 Self::build_transport(conf)
876 .await
877 .map(super::tracing::BackendServices::new)
878 }
879
880 /// Adds a key for validating requests with signed URLs for this backend
881 /// service.
882 pub fn add_signed_url_key(&self) -> super::builder::backend_services::AddSignedUrlKey {
883 super::builder::backend_services::AddSignedUrlKey::new(self.inner.clone())
884 }
885
886 /// Retrieves the list of all BackendService resources, regional and global,
887 /// available to the specified project.
888 ///
889 /// To prevent failure, it is recommended that you set the
890 /// `returnPartialSuccess` parameter to `true`.
891 pub fn aggregated_list(&self) -> super::builder::backend_services::AggregatedList {
892 super::builder::backend_services::AggregatedList::new(self.inner.clone())
893 }
894
895 /// Deletes the specified BackendService resource.
896 pub fn delete(&self) -> super::builder::backend_services::Delete {
897 super::builder::backend_services::Delete::new(self.inner.clone())
898 }
899
900 /// Deletes a key for validating requests with signed URLs for this backend
901 /// service.
902 pub fn delete_signed_url_key(&self) -> super::builder::backend_services::DeleteSignedUrlKey {
903 super::builder::backend_services::DeleteSignedUrlKey::new(self.inner.clone())
904 }
905
906 /// Returns the specified BackendService resource.
907 pub fn get(&self) -> super::builder::backend_services::Get {
908 super::builder::backend_services::Get::new(self.inner.clone())
909 }
910
911 /// Returns effective security policies applied to this backend service.
912 pub fn get_effective_security_policies(
913 &self,
914 ) -> super::builder::backend_services::GetEffectiveSecurityPolicies {
915 super::builder::backend_services::GetEffectiveSecurityPolicies::new(self.inner.clone())
916 }
917
918 /// Gets the most recent health check results for this
919 /// BackendService.
920 ///
921 /// Example request body:
922 ///
923 /// {
924 /// "group": "/zones/us-east1-b/instanceGroups/lb-backend-example"
925 /// }
926 pub fn get_health(&self) -> super::builder::backend_services::GetHealth {
927 super::builder::backend_services::GetHealth::new(self.inner.clone())
928 }
929
930 /// Gets the access control policy for a resource. May be empty if no such
931 /// policy or resource exists.
932 pub fn get_iam_policy(&self) -> super::builder::backend_services::GetIamPolicy {
933 super::builder::backend_services::GetIamPolicy::new(self.inner.clone())
934 }
935
936 /// Creates a BackendService resource in the specified project using
937 /// the data included in the request. For more information, see
938 /// Backend services overview.
939 pub fn insert(&self) -> super::builder::backend_services::Insert {
940 super::builder::backend_services::Insert::new(self.inner.clone())
941 }
942
943 /// Retrieves the list of BackendService resources available to the specified
944 /// project.
945 pub fn list(&self) -> super::builder::backend_services::List {
946 super::builder::backend_services::List::new(self.inner.clone())
947 }
948
949 /// Retrieves a list of all usable backend services in the specified project.
950 pub fn list_usable(&self) -> super::builder::backend_services::ListUsable {
951 super::builder::backend_services::ListUsable::new(self.inner.clone())
952 }
953
954 /// Patches the specified BackendService resource with the data included in the
955 /// request. For more information, see
956 /// Backend services overview. This method
957 /// supports PATCH semantics and uses the JSON merge
958 /// patch format and processing rules.
959 pub fn patch(&self) -> super::builder::backend_services::Patch {
960 super::builder::backend_services::Patch::new(self.inner.clone())
961 }
962
963 /// Sets the edge security policy for the specified backend service.
964 pub fn set_edge_security_policy(
965 &self,
966 ) -> super::builder::backend_services::SetEdgeSecurityPolicy {
967 super::builder::backend_services::SetEdgeSecurityPolicy::new(self.inner.clone())
968 }
969
970 /// Sets the access control policy on the specified resource.
971 /// Replaces any existing policy.
972 pub fn set_iam_policy(&self) -> super::builder::backend_services::SetIamPolicy {
973 super::builder::backend_services::SetIamPolicy::new(self.inner.clone())
974 }
975
976 /// Sets the Google Cloud Armor security policy for the specified backend
977 /// service. For more information, seeGoogle
978 /// Cloud Armor Overview
979 pub fn set_security_policy(&self) -> super::builder::backend_services::SetSecurityPolicy {
980 super::builder::backend_services::SetSecurityPolicy::new(self.inner.clone())
981 }
982
983 /// Returns permissions that a caller has on the specified resource.
984 pub fn test_iam_permissions(&self) -> super::builder::backend_services::TestIamPermissions {
985 super::builder::backend_services::TestIamPermissions::new(self.inner.clone())
986 }
987
988 /// Updates the specified BackendService resource with the data included in the
989 /// request. For more information, seeBackend
990 /// services overview.
991 pub fn update(&self) -> super::builder::backend_services::Update {
992 super::builder::backend_services::Update::new(self.inner.clone())
993 }
994
995 /// Retrieves the specified Operations resource.
996 pub fn get_operation(&self) -> super::builder::backend_services::GetOperation {
997 super::builder::backend_services::GetOperation::new(self.inner.clone())
998 }
999}
1000
1001/// Implements a client for the Google Compute Engine API.
1002///
1003/// # Example
1004/// ```
1005/// # use google_cloud_compute_v1::client::CrossSiteNetworks;
1006/// async fn sample(
1007/// ) -> anyhow::Result<()> {
1008/// let client = CrossSiteNetworks::builder().build().await?;
1009/// // use `client` to make requests to the Google Compute Engine API.
1010/// Ok(())
1011/// }
1012/// ```
1013///
1014/// # Service Description
1015///
1016/// Service for the `crossSiteNetworks` resource.
1017///
1018/// # Configuration
1019///
1020/// To configure `CrossSiteNetworks` use the `with_*` methods in the type returned
1021/// by [builder()][CrossSiteNetworks::builder]. The default configuration should
1022/// work for most applications. Common configuration changes include
1023///
1024/// * [with_endpoint()]: by default this client uses the global default endpoint
1025/// (`https://compute.googleapis.com`). Applications using regional
1026/// endpoints or running in restricted networks (e.g. a network configured
1027/// with [Private Google Access with VPC Service Controls]) may want to
1028/// override this default.
1029/// * [with_credentials()]: by default this client uses
1030/// [Application Default Credentials]. Applications using custom
1031/// authentication may need to override this default.
1032///
1033/// [with_endpoint()]: super::builder::cross_site_networks::ClientBuilder::with_endpoint
1034/// [with_credentials()]: super::builder::cross_site_networks::ClientBuilder::with_credentials
1035/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1036/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1037///
1038/// # Pooling and Cloning
1039///
1040/// `CrossSiteNetworks` holds a connection pool internally, it is advised to
1041/// create one and reuse it. You do not need to wrap `CrossSiteNetworks` in
1042/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1043/// already uses an `Arc` internally.
1044#[cfg(feature = "cross-site-networks")]
1045#[cfg_attr(docsrs, doc(cfg(feature = "cross-site-networks")))]
1046#[derive(Clone, Debug)]
1047pub struct CrossSiteNetworks {
1048 inner: std::sync::Arc<dyn super::stub::dynamic::CrossSiteNetworks>,
1049}
1050
1051#[cfg(feature = "cross-site-networks")]
1052impl CrossSiteNetworks {
1053 /// Returns a builder for [CrossSiteNetworks].
1054 ///
1055 /// ```
1056 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1057 /// # use google_cloud_compute_v1::client::CrossSiteNetworks;
1058 /// let client = CrossSiteNetworks::builder().build().await?;
1059 /// # Ok(()) }
1060 /// ```
1061 pub fn builder() -> super::builder::cross_site_networks::ClientBuilder {
1062 crate::new_client_builder(super::builder::cross_site_networks::client::Factory)
1063 }
1064
1065 /// Creates a new client from the provided stub.
1066 ///
1067 /// The most common case for calling this function is in tests mocking the
1068 /// client's behavior.
1069 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1070 where
1071 T: super::stub::CrossSiteNetworks + 'static,
1072 {
1073 Self { inner: stub.into() }
1074 }
1075
1076 pub(crate) async fn new(
1077 config: gaxi::options::ClientConfig,
1078 ) -> crate::ClientBuilderResult<Self> {
1079 let inner = Self::build_inner(config).await?;
1080 Ok(Self { inner })
1081 }
1082
1083 async fn build_inner(
1084 conf: gaxi::options::ClientConfig,
1085 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CrossSiteNetworks>>
1086 {
1087 if gaxi::options::tracing_enabled(&conf) {
1088 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1089 }
1090 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1091 }
1092
1093 async fn build_transport(
1094 conf: gaxi::options::ClientConfig,
1095 ) -> crate::ClientBuilderResult<impl super::stub::CrossSiteNetworks> {
1096 super::transport::CrossSiteNetworks::new(conf).await
1097 }
1098
1099 async fn build_with_tracing(
1100 conf: gaxi::options::ClientConfig,
1101 ) -> crate::ClientBuilderResult<impl super::stub::CrossSiteNetworks> {
1102 Self::build_transport(conf)
1103 .await
1104 .map(super::tracing::CrossSiteNetworks::new)
1105 }
1106
1107 /// Deletes the specified cross-site network in the given scope.
1108 pub fn delete(&self) -> super::builder::cross_site_networks::Delete {
1109 super::builder::cross_site_networks::Delete::new(self.inner.clone())
1110 }
1111
1112 /// Returns the specified cross-site network in the given scope.
1113 pub fn get(&self) -> super::builder::cross_site_networks::Get {
1114 super::builder::cross_site_networks::Get::new(self.inner.clone())
1115 }
1116
1117 /// Creates a cross-site network in the specified project in the given scope
1118 /// using the parameters that are included in the request.
1119 pub fn insert(&self) -> super::builder::cross_site_networks::Insert {
1120 super::builder::cross_site_networks::Insert::new(self.inner.clone())
1121 }
1122
1123 /// Lists the cross-site networks for a project in the given scope.
1124 pub fn list(&self) -> super::builder::cross_site_networks::List {
1125 super::builder::cross_site_networks::List::new(self.inner.clone())
1126 }
1127
1128 /// Updates the specified cross-site network with the data included in
1129 /// the request. This method supportsPATCH
1130 /// semantics and uses theJSON merge
1131 /// patch format and processing rules.
1132 pub fn patch(&self) -> super::builder::cross_site_networks::Patch {
1133 super::builder::cross_site_networks::Patch::new(self.inner.clone())
1134 }
1135
1136 /// Retrieves the specified Operations resource.
1137 pub fn get_operation(&self) -> super::builder::cross_site_networks::GetOperation {
1138 super::builder::cross_site_networks::GetOperation::new(self.inner.clone())
1139 }
1140}
1141
1142/// Implements a client for the Google Compute Engine API.
1143///
1144/// # Example
1145/// ```
1146/// # use google_cloud_compute_v1::client::DiskTypes;
1147/// async fn sample(
1148/// ) -> anyhow::Result<()> {
1149/// let client = DiskTypes::builder().build().await?;
1150/// // use `client` to make requests to the Google Compute Engine API.
1151/// Ok(())
1152/// }
1153/// ```
1154///
1155/// # Service Description
1156///
1157/// Service for the `diskTypes` resource.
1158///
1159/// # Configuration
1160///
1161/// To configure `DiskTypes` use the `with_*` methods in the type returned
1162/// by [builder()][DiskTypes::builder]. The default configuration should
1163/// work for most applications. Common configuration changes include
1164///
1165/// * [with_endpoint()]: by default this client uses the global default endpoint
1166/// (`https://compute.googleapis.com`). Applications using regional
1167/// endpoints or running in restricted networks (e.g. a network configured
1168/// with [Private Google Access with VPC Service Controls]) may want to
1169/// override this default.
1170/// * [with_credentials()]: by default this client uses
1171/// [Application Default Credentials]. Applications using custom
1172/// authentication may need to override this default.
1173///
1174/// [with_endpoint()]: super::builder::disk_types::ClientBuilder::with_endpoint
1175/// [with_credentials()]: super::builder::disk_types::ClientBuilder::with_credentials
1176/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1177/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1178///
1179/// # Pooling and Cloning
1180///
1181/// `DiskTypes` holds a connection pool internally, it is advised to
1182/// create one and reuse it. You do not need to wrap `DiskTypes` in
1183/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1184/// already uses an `Arc` internally.
1185#[cfg(feature = "disk-types")]
1186#[cfg_attr(docsrs, doc(cfg(feature = "disk-types")))]
1187#[derive(Clone, Debug)]
1188pub struct DiskTypes {
1189 inner: std::sync::Arc<dyn super::stub::dynamic::DiskTypes>,
1190}
1191
1192#[cfg(feature = "disk-types")]
1193impl DiskTypes {
1194 /// Returns a builder for [DiskTypes].
1195 ///
1196 /// ```
1197 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1198 /// # use google_cloud_compute_v1::client::DiskTypes;
1199 /// let client = DiskTypes::builder().build().await?;
1200 /// # Ok(()) }
1201 /// ```
1202 pub fn builder() -> super::builder::disk_types::ClientBuilder {
1203 crate::new_client_builder(super::builder::disk_types::client::Factory)
1204 }
1205
1206 /// Creates a new client from the provided stub.
1207 ///
1208 /// The most common case for calling this function is in tests mocking the
1209 /// client's behavior.
1210 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1211 where
1212 T: super::stub::DiskTypes + 'static,
1213 {
1214 Self { inner: stub.into() }
1215 }
1216
1217 pub(crate) async fn new(
1218 config: gaxi::options::ClientConfig,
1219 ) -> crate::ClientBuilderResult<Self> {
1220 let inner = Self::build_inner(config).await?;
1221 Ok(Self { inner })
1222 }
1223
1224 async fn build_inner(
1225 conf: gaxi::options::ClientConfig,
1226 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DiskTypes>> {
1227 if gaxi::options::tracing_enabled(&conf) {
1228 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1229 }
1230 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1231 }
1232
1233 async fn build_transport(
1234 conf: gaxi::options::ClientConfig,
1235 ) -> crate::ClientBuilderResult<impl super::stub::DiskTypes> {
1236 super::transport::DiskTypes::new(conf).await
1237 }
1238
1239 async fn build_with_tracing(
1240 conf: gaxi::options::ClientConfig,
1241 ) -> crate::ClientBuilderResult<impl super::stub::DiskTypes> {
1242 Self::build_transport(conf)
1243 .await
1244 .map(super::tracing::DiskTypes::new)
1245 }
1246
1247 /// Retrieves an aggregated list of disk types.
1248 ///
1249 /// To prevent failure, it is recommended that you set the
1250 /// `returnPartialSuccess` parameter to `true`.
1251 pub fn aggregated_list(&self) -> super::builder::disk_types::AggregatedList {
1252 super::builder::disk_types::AggregatedList::new(self.inner.clone())
1253 }
1254
1255 /// Returns the specified disk type.
1256 pub fn get(&self) -> super::builder::disk_types::Get {
1257 super::builder::disk_types::Get::new(self.inner.clone())
1258 }
1259
1260 /// Retrieves a list of disk types available to the specified
1261 /// project.
1262 pub fn list(&self) -> super::builder::disk_types::List {
1263 super::builder::disk_types::List::new(self.inner.clone())
1264 }
1265}
1266
1267/// Implements a client for the Google Compute Engine API.
1268///
1269/// # Example
1270/// ```
1271/// # use google_cloud_compute_v1::client::Disks;
1272/// async fn sample(
1273/// ) -> anyhow::Result<()> {
1274/// let client = Disks::builder().build().await?;
1275/// // use `client` to make requests to the Google Compute Engine API.
1276/// Ok(())
1277/// }
1278/// ```
1279///
1280/// # Service Description
1281///
1282/// Service for the `disks` resource.
1283///
1284/// # Configuration
1285///
1286/// To configure `Disks` use the `with_*` methods in the type returned
1287/// by [builder()][Disks::builder]. The default configuration should
1288/// work for most applications. Common configuration changes include
1289///
1290/// * [with_endpoint()]: by default this client uses the global default endpoint
1291/// (`https://compute.googleapis.com`). Applications using regional
1292/// endpoints or running in restricted networks (e.g. a network configured
1293/// with [Private Google Access with VPC Service Controls]) may want to
1294/// override this default.
1295/// * [with_credentials()]: by default this client uses
1296/// [Application Default Credentials]. Applications using custom
1297/// authentication may need to override this default.
1298///
1299/// [with_endpoint()]: super::builder::disks::ClientBuilder::with_endpoint
1300/// [with_credentials()]: super::builder::disks::ClientBuilder::with_credentials
1301/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1302/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1303///
1304/// # Pooling and Cloning
1305///
1306/// `Disks` holds a connection pool internally, it is advised to
1307/// create one and reuse it. You do not need to wrap `Disks` in
1308/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1309/// already uses an `Arc` internally.
1310#[cfg(feature = "disks")]
1311#[cfg_attr(docsrs, doc(cfg(feature = "disks")))]
1312#[derive(Clone, Debug)]
1313pub struct Disks {
1314 inner: std::sync::Arc<dyn super::stub::dynamic::Disks>,
1315}
1316
1317#[cfg(feature = "disks")]
1318impl Disks {
1319 /// Returns a builder for [Disks].
1320 ///
1321 /// ```
1322 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1323 /// # use google_cloud_compute_v1::client::Disks;
1324 /// let client = Disks::builder().build().await?;
1325 /// # Ok(()) }
1326 /// ```
1327 pub fn builder() -> super::builder::disks::ClientBuilder {
1328 crate::new_client_builder(super::builder::disks::client::Factory)
1329 }
1330
1331 /// Creates a new client from the provided stub.
1332 ///
1333 /// The most common case for calling this function is in tests mocking the
1334 /// client's behavior.
1335 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1336 where
1337 T: super::stub::Disks + 'static,
1338 {
1339 Self { inner: stub.into() }
1340 }
1341
1342 pub(crate) async fn new(
1343 config: gaxi::options::ClientConfig,
1344 ) -> crate::ClientBuilderResult<Self> {
1345 let inner = Self::build_inner(config).await?;
1346 Ok(Self { inner })
1347 }
1348
1349 async fn build_inner(
1350 conf: gaxi::options::ClientConfig,
1351 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Disks>> {
1352 if gaxi::options::tracing_enabled(&conf) {
1353 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1354 }
1355 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1356 }
1357
1358 async fn build_transport(
1359 conf: gaxi::options::ClientConfig,
1360 ) -> crate::ClientBuilderResult<impl super::stub::Disks> {
1361 super::transport::Disks::new(conf).await
1362 }
1363
1364 async fn build_with_tracing(
1365 conf: gaxi::options::ClientConfig,
1366 ) -> crate::ClientBuilderResult<impl super::stub::Disks> {
1367 Self::build_transport(conf)
1368 .await
1369 .map(super::tracing::Disks::new)
1370 }
1371
1372 /// Adds existing resource policies to a disk. You can only add one
1373 /// policy which will be applied to this disk for scheduling snapshot
1374 /// creation.
1375 pub fn add_resource_policies(&self) -> super::builder::disks::AddResourcePolicies {
1376 super::builder::disks::AddResourcePolicies::new(self.inner.clone())
1377 }
1378
1379 /// Retrieves an aggregated list of persistent disks.
1380 ///
1381 /// To prevent failure, it is recommended that you set the
1382 /// `returnPartialSuccess` parameter to `true`.
1383 pub fn aggregated_list(&self) -> super::builder::disks::AggregatedList {
1384 super::builder::disks::AggregatedList::new(self.inner.clone())
1385 }
1386
1387 /// Bulk create a set of disks.
1388 pub fn bulk_insert(&self) -> super::builder::disks::BulkInsert {
1389 super::builder::disks::BulkInsert::new(self.inner.clone())
1390 }
1391
1392 /// Sets the labels on many disks at once. To learn more about labels, read theLabeling
1393 /// Resources documentation.
1394 pub fn bulk_set_labels(&self) -> super::builder::disks::BulkSetLabels {
1395 super::builder::disks::BulkSetLabels::new(self.inner.clone())
1396 }
1397
1398 /// Creates a snapshot of a specified persistent disk. For regular snapshot
1399 /// creation, consider using snapshots.insert
1400 /// instead, as that method supports more features, such as creating snapshots
1401 /// in a project different from the source disk project.
1402 pub fn create_snapshot(&self) -> super::builder::disks::CreateSnapshot {
1403 super::builder::disks::CreateSnapshot::new(self.inner.clone())
1404 }
1405
1406 /// Deletes the specified persistent disk. Deleting a disk removes its data
1407 /// permanently and is irreversible. However, deleting a disk does not
1408 /// delete any snapshots
1409 /// previously made from the disk. You must separatelydelete
1410 /// snapshots.
1411 pub fn delete(&self) -> super::builder::disks::Delete {
1412 super::builder::disks::Delete::new(self.inner.clone())
1413 }
1414
1415 /// Returns the specified persistent disk.
1416 pub fn get(&self) -> super::builder::disks::Get {
1417 super::builder::disks::Get::new(self.inner.clone())
1418 }
1419
1420 /// Gets the access control policy for a resource. May be empty if no such
1421 /// policy or resource exists.
1422 pub fn get_iam_policy(&self) -> super::builder::disks::GetIamPolicy {
1423 super::builder::disks::GetIamPolicy::new(self.inner.clone())
1424 }
1425
1426 /// Creates a persistent disk in the specified project using the data
1427 /// in the request. You can create a disk from a source
1428 /// (sourceImage, sourceSnapshot, orsourceDisk) or create an empty 500 GB data disk by
1429 /// omitting all properties. You can also create a disk that is larger than
1430 /// the default size by specifying the sizeGb property.
1431 pub fn insert(&self) -> super::builder::disks::Insert {
1432 super::builder::disks::Insert::new(self.inner.clone())
1433 }
1434
1435 /// Retrieves a list of persistent disks contained within
1436 /// the specified zone.
1437 pub fn list(&self) -> super::builder::disks::List {
1438 super::builder::disks::List::new(self.inner.clone())
1439 }
1440
1441 /// Removes resource policies from a disk.
1442 pub fn remove_resource_policies(&self) -> super::builder::disks::RemoveResourcePolicies {
1443 super::builder::disks::RemoveResourcePolicies::new(self.inner.clone())
1444 }
1445
1446 /// Resizes the specified persistent disk.
1447 /// You can only increase the size of the disk.
1448 pub fn resize(&self) -> super::builder::disks::Resize {
1449 super::builder::disks::Resize::new(self.inner.clone())
1450 }
1451
1452 /// Sets the access control policy on the specified resource.
1453 /// Replaces any existing policy.
1454 pub fn set_iam_policy(&self) -> super::builder::disks::SetIamPolicy {
1455 super::builder::disks::SetIamPolicy::new(self.inner.clone())
1456 }
1457
1458 /// Sets the labels on a disk. To learn more about labels, read theLabeling
1459 /// Resources documentation.
1460 pub fn set_labels(&self) -> super::builder::disks::SetLabels {
1461 super::builder::disks::SetLabels::new(self.inner.clone())
1462 }
1463
1464 /// Starts asynchronous replication.
1465 /// Must be invoked on the primary disk.
1466 pub fn start_async_replication(&self) -> super::builder::disks::StartAsyncReplication {
1467 super::builder::disks::StartAsyncReplication::new(self.inner.clone())
1468 }
1469
1470 /// Stops asynchronous replication.
1471 /// Can be invoked either on the primary or on the secondary disk.
1472 pub fn stop_async_replication(&self) -> super::builder::disks::StopAsyncReplication {
1473 super::builder::disks::StopAsyncReplication::new(self.inner.clone())
1474 }
1475
1476 /// Stops asynchronous replication for a consistency group of disks.
1477 /// Can be invoked either in the primary or secondary scope.
1478 pub fn stop_group_async_replication(&self) -> super::builder::disks::StopGroupAsyncReplication {
1479 super::builder::disks::StopGroupAsyncReplication::new(self.inner.clone())
1480 }
1481
1482 /// Returns permissions that a caller has on the specified resource.
1483 pub fn test_iam_permissions(&self) -> super::builder::disks::TestIamPermissions {
1484 super::builder::disks::TestIamPermissions::new(self.inner.clone())
1485 }
1486
1487 /// Updates the specified disk with the data included in the request.
1488 /// The update is performed only on selected fields included as part
1489 /// of update-mask.
1490 pub fn update(&self) -> super::builder::disks::Update {
1491 super::builder::disks::Update::new(self.inner.clone())
1492 }
1493
1494 /// Rotates the customer-managed
1495 /// encryption key to the latest version for the specified persistent disk.
1496 pub fn update_kms_key(&self) -> super::builder::disks::UpdateKmsKey {
1497 super::builder::disks::UpdateKmsKey::new(self.inner.clone())
1498 }
1499
1500 /// Retrieves the specified zone-specific Operations resource.
1501 pub fn get_operation(&self) -> super::builder::disks::GetOperation {
1502 super::builder::disks::GetOperation::new(self.inner.clone())
1503 }
1504}
1505
1506/// Implements a client for the Google Compute Engine API.
1507///
1508/// # Example
1509/// ```
1510/// # use google_cloud_compute_v1::client::ExternalVpnGateways;
1511/// async fn sample(
1512/// ) -> anyhow::Result<()> {
1513/// let client = ExternalVpnGateways::builder().build().await?;
1514/// // use `client` to make requests to the Google Compute Engine API.
1515/// Ok(())
1516/// }
1517/// ```
1518///
1519/// # Service Description
1520///
1521/// Service for the `externalVpnGateways` resource.
1522///
1523/// # Configuration
1524///
1525/// To configure `ExternalVpnGateways` use the `with_*` methods in the type returned
1526/// by [builder()][ExternalVpnGateways::builder]. The default configuration should
1527/// work for most applications. Common configuration changes include
1528///
1529/// * [with_endpoint()]: by default this client uses the global default endpoint
1530/// (`https://compute.googleapis.com`). Applications using regional
1531/// endpoints or running in restricted networks (e.g. a network configured
1532/// with [Private Google Access with VPC Service Controls]) may want to
1533/// override this default.
1534/// * [with_credentials()]: by default this client uses
1535/// [Application Default Credentials]. Applications using custom
1536/// authentication may need to override this default.
1537///
1538/// [with_endpoint()]: super::builder::external_vpn_gateways::ClientBuilder::with_endpoint
1539/// [with_credentials()]: super::builder::external_vpn_gateways::ClientBuilder::with_credentials
1540/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1541/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1542///
1543/// # Pooling and Cloning
1544///
1545/// `ExternalVpnGateways` holds a connection pool internally, it is advised to
1546/// create one and reuse it. You do not need to wrap `ExternalVpnGateways` in
1547/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1548/// already uses an `Arc` internally.
1549#[cfg(feature = "external-vpn-gateways")]
1550#[cfg_attr(docsrs, doc(cfg(feature = "external-vpn-gateways")))]
1551#[derive(Clone, Debug)]
1552pub struct ExternalVpnGateways {
1553 inner: std::sync::Arc<dyn super::stub::dynamic::ExternalVpnGateways>,
1554}
1555
1556#[cfg(feature = "external-vpn-gateways")]
1557impl ExternalVpnGateways {
1558 /// Returns a builder for [ExternalVpnGateways].
1559 ///
1560 /// ```
1561 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1562 /// # use google_cloud_compute_v1::client::ExternalVpnGateways;
1563 /// let client = ExternalVpnGateways::builder().build().await?;
1564 /// # Ok(()) }
1565 /// ```
1566 pub fn builder() -> super::builder::external_vpn_gateways::ClientBuilder {
1567 crate::new_client_builder(super::builder::external_vpn_gateways::client::Factory)
1568 }
1569
1570 /// Creates a new client from the provided stub.
1571 ///
1572 /// The most common case for calling this function is in tests mocking the
1573 /// client's behavior.
1574 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1575 where
1576 T: super::stub::ExternalVpnGateways + 'static,
1577 {
1578 Self { inner: stub.into() }
1579 }
1580
1581 pub(crate) async fn new(
1582 config: gaxi::options::ClientConfig,
1583 ) -> crate::ClientBuilderResult<Self> {
1584 let inner = Self::build_inner(config).await?;
1585 Ok(Self { inner })
1586 }
1587
1588 async fn build_inner(
1589 conf: gaxi::options::ClientConfig,
1590 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ExternalVpnGateways>>
1591 {
1592 if gaxi::options::tracing_enabled(&conf) {
1593 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1594 }
1595 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1596 }
1597
1598 async fn build_transport(
1599 conf: gaxi::options::ClientConfig,
1600 ) -> crate::ClientBuilderResult<impl super::stub::ExternalVpnGateways> {
1601 super::transport::ExternalVpnGateways::new(conf).await
1602 }
1603
1604 async fn build_with_tracing(
1605 conf: gaxi::options::ClientConfig,
1606 ) -> crate::ClientBuilderResult<impl super::stub::ExternalVpnGateways> {
1607 Self::build_transport(conf)
1608 .await
1609 .map(super::tracing::ExternalVpnGateways::new)
1610 }
1611
1612 /// Deletes the specified externalVpnGateway.
1613 pub fn delete(&self) -> super::builder::external_vpn_gateways::Delete {
1614 super::builder::external_vpn_gateways::Delete::new(self.inner.clone())
1615 }
1616
1617 /// Returns the specified externalVpnGateway. Get a list of available
1618 /// externalVpnGateways by making a list() request.
1619 pub fn get(&self) -> super::builder::external_vpn_gateways::Get {
1620 super::builder::external_vpn_gateways::Get::new(self.inner.clone())
1621 }
1622
1623 /// Creates a ExternalVpnGateway in the specified project using
1624 /// the data included in the request.
1625 pub fn insert(&self) -> super::builder::external_vpn_gateways::Insert {
1626 super::builder::external_vpn_gateways::Insert::new(self.inner.clone())
1627 }
1628
1629 /// Retrieves the list of ExternalVpnGateway available to the specified
1630 /// project.
1631 pub fn list(&self) -> super::builder::external_vpn_gateways::List {
1632 super::builder::external_vpn_gateways::List::new(self.inner.clone())
1633 }
1634
1635 /// Sets the labels on an ExternalVpnGateway. To learn more about labels,
1636 /// read the Labeling
1637 /// Resources documentation.
1638 pub fn set_labels(&self) -> super::builder::external_vpn_gateways::SetLabels {
1639 super::builder::external_vpn_gateways::SetLabels::new(self.inner.clone())
1640 }
1641
1642 /// Returns permissions that a caller has on the specified resource.
1643 pub fn test_iam_permissions(
1644 &self,
1645 ) -> super::builder::external_vpn_gateways::TestIamPermissions {
1646 super::builder::external_vpn_gateways::TestIamPermissions::new(self.inner.clone())
1647 }
1648
1649 /// Retrieves the specified Operations resource.
1650 pub fn get_operation(&self) -> super::builder::external_vpn_gateways::GetOperation {
1651 super::builder::external_vpn_gateways::GetOperation::new(self.inner.clone())
1652 }
1653}
1654
1655/// Implements a client for the Google Compute Engine API.
1656///
1657/// # Example
1658/// ```
1659/// # use google_cloud_compute_v1::client::FirewallPolicies;
1660/// async fn sample(
1661/// ) -> anyhow::Result<()> {
1662/// let client = FirewallPolicies::builder().build().await?;
1663/// // use `client` to make requests to the Google Compute Engine API.
1664/// Ok(())
1665/// }
1666/// ```
1667///
1668/// # Service Description
1669///
1670/// Service for the `firewallPolicies` resource.
1671///
1672/// # Configuration
1673///
1674/// To configure `FirewallPolicies` use the `with_*` methods in the type returned
1675/// by [builder()][FirewallPolicies::builder]. The default configuration should
1676/// work for most applications. Common configuration changes include
1677///
1678/// * [with_endpoint()]: by default this client uses the global default endpoint
1679/// (`https://compute.googleapis.com`). Applications using regional
1680/// endpoints or running in restricted networks (e.g. a network configured
1681/// with [Private Google Access with VPC Service Controls]) may want to
1682/// override this default.
1683/// * [with_credentials()]: by default this client uses
1684/// [Application Default Credentials]. Applications using custom
1685/// authentication may need to override this default.
1686///
1687/// [with_endpoint()]: super::builder::firewall_policies::ClientBuilder::with_endpoint
1688/// [with_credentials()]: super::builder::firewall_policies::ClientBuilder::with_credentials
1689/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1690/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1691///
1692/// # Pooling and Cloning
1693///
1694/// `FirewallPolicies` holds a connection pool internally, it is advised to
1695/// create one and reuse it. You do not need to wrap `FirewallPolicies` in
1696/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1697/// already uses an `Arc` internally.
1698#[cfg(feature = "firewall-policies")]
1699#[cfg_attr(docsrs, doc(cfg(feature = "firewall-policies")))]
1700#[derive(Clone, Debug)]
1701pub struct FirewallPolicies {
1702 inner: std::sync::Arc<dyn super::stub::dynamic::FirewallPolicies>,
1703}
1704
1705#[cfg(feature = "firewall-policies")]
1706impl FirewallPolicies {
1707 /// Returns a builder for [FirewallPolicies].
1708 ///
1709 /// ```
1710 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1711 /// # use google_cloud_compute_v1::client::FirewallPolicies;
1712 /// let client = FirewallPolicies::builder().build().await?;
1713 /// # Ok(()) }
1714 /// ```
1715 pub fn builder() -> super::builder::firewall_policies::ClientBuilder {
1716 crate::new_client_builder(super::builder::firewall_policies::client::Factory)
1717 }
1718
1719 /// Creates a new client from the provided stub.
1720 ///
1721 /// The most common case for calling this function is in tests mocking the
1722 /// client's behavior.
1723 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1724 where
1725 T: super::stub::FirewallPolicies + 'static,
1726 {
1727 Self { inner: stub.into() }
1728 }
1729
1730 pub(crate) async fn new(
1731 config: gaxi::options::ClientConfig,
1732 ) -> crate::ClientBuilderResult<Self> {
1733 let inner = Self::build_inner(config).await?;
1734 Ok(Self { inner })
1735 }
1736
1737 async fn build_inner(
1738 conf: gaxi::options::ClientConfig,
1739 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FirewallPolicies>>
1740 {
1741 if gaxi::options::tracing_enabled(&conf) {
1742 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1743 }
1744 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1745 }
1746
1747 async fn build_transport(
1748 conf: gaxi::options::ClientConfig,
1749 ) -> crate::ClientBuilderResult<impl super::stub::FirewallPolicies> {
1750 super::transport::FirewallPolicies::new(conf).await
1751 }
1752
1753 async fn build_with_tracing(
1754 conf: gaxi::options::ClientConfig,
1755 ) -> crate::ClientBuilderResult<impl super::stub::FirewallPolicies> {
1756 Self::build_transport(conf)
1757 .await
1758 .map(super::tracing::FirewallPolicies::new)
1759 }
1760
1761 /// Inserts an association for the specified firewall policy.
1762 pub fn add_association(&self) -> super::builder::firewall_policies::AddAssociation {
1763 super::builder::firewall_policies::AddAssociation::new(self.inner.clone())
1764 }
1765
1766 /// Inserts a rule into a firewall policy.
1767 pub fn add_rule(&self) -> super::builder::firewall_policies::AddRule {
1768 super::builder::firewall_policies::AddRule::new(self.inner.clone())
1769 }
1770
1771 /// Copies rules to the specified firewall policy.
1772 pub fn clone_rules(&self) -> super::builder::firewall_policies::CloneRules {
1773 super::builder::firewall_policies::CloneRules::new(self.inner.clone())
1774 }
1775
1776 /// Deletes the specified policy.
1777 pub fn delete(&self) -> super::builder::firewall_policies::Delete {
1778 super::builder::firewall_policies::Delete::new(self.inner.clone())
1779 }
1780
1781 /// Returns the specified firewall policy.
1782 pub fn get(&self) -> super::builder::firewall_policies::Get {
1783 super::builder::firewall_policies::Get::new(self.inner.clone())
1784 }
1785
1786 /// Gets an association with the specified name.
1787 pub fn get_association(&self) -> super::builder::firewall_policies::GetAssociation {
1788 super::builder::firewall_policies::GetAssociation::new(self.inner.clone())
1789 }
1790
1791 /// Gets the access control policy for a resource. May be empty if no such
1792 /// policy or resource exists.
1793 pub fn get_iam_policy(&self) -> super::builder::firewall_policies::GetIamPolicy {
1794 super::builder::firewall_policies::GetIamPolicy::new(self.inner.clone())
1795 }
1796
1797 /// Gets a rule of the specified priority.
1798 pub fn get_rule(&self) -> super::builder::firewall_policies::GetRule {
1799 super::builder::firewall_policies::GetRule::new(self.inner.clone())
1800 }
1801
1802 /// Creates a new policy in the specified project using the data included in
1803 /// the request.
1804 pub fn insert(&self) -> super::builder::firewall_policies::Insert {
1805 super::builder::firewall_policies::Insert::new(self.inner.clone())
1806 }
1807
1808 /// Lists all the policies that have been configured for the specified
1809 /// folder or organization.
1810 pub fn list(&self) -> super::builder::firewall_policies::List {
1811 super::builder::firewall_policies::List::new(self.inner.clone())
1812 }
1813
1814 /// Lists associations of a specified target, i.e., organization or folder.
1815 pub fn list_associations(&self) -> super::builder::firewall_policies::ListAssociations {
1816 super::builder::firewall_policies::ListAssociations::new(self.inner.clone())
1817 }
1818
1819 /// Moves the specified firewall policy.
1820 pub fn r#move(&self) -> super::builder::firewall_policies::Move {
1821 super::builder::firewall_policies::Move::new(self.inner.clone())
1822 }
1823
1824 /// Patches the specified policy with the data included in the request.
1825 pub fn patch(&self) -> super::builder::firewall_policies::Patch {
1826 super::builder::firewall_policies::Patch::new(self.inner.clone())
1827 }
1828
1829 /// Patches a rule of the specified priority.
1830 pub fn patch_rule(&self) -> super::builder::firewall_policies::PatchRule {
1831 super::builder::firewall_policies::PatchRule::new(self.inner.clone())
1832 }
1833
1834 /// Removes an association for the specified firewall policy.
1835 pub fn remove_association(&self) -> super::builder::firewall_policies::RemoveAssociation {
1836 super::builder::firewall_policies::RemoveAssociation::new(self.inner.clone())
1837 }
1838
1839 /// Deletes a rule of the specified priority.
1840 pub fn remove_rule(&self) -> super::builder::firewall_policies::RemoveRule {
1841 super::builder::firewall_policies::RemoveRule::new(self.inner.clone())
1842 }
1843
1844 /// Sets the access control policy on the specified resource.
1845 /// Replaces any existing policy.
1846 pub fn set_iam_policy(&self) -> super::builder::firewall_policies::SetIamPolicy {
1847 super::builder::firewall_policies::SetIamPolicy::new(self.inner.clone())
1848 }
1849
1850 /// Returns permissions that a caller has on the specified resource.
1851 pub fn test_iam_permissions(&self) -> super::builder::firewall_policies::TestIamPermissions {
1852 super::builder::firewall_policies::TestIamPermissions::new(self.inner.clone())
1853 }
1854
1855 /// Retrieves the specified Operations resource. Gets a list of operations
1856 /// by making a `list()` request.
1857 pub fn get_operation(&self) -> super::builder::firewall_policies::GetOperation {
1858 super::builder::firewall_policies::GetOperation::new(self.inner.clone())
1859 }
1860}
1861
1862/// Implements a client for the Google Compute Engine API.
1863///
1864/// # Example
1865/// ```
1866/// # use google_cloud_compute_v1::client::Firewalls;
1867/// async fn sample(
1868/// ) -> anyhow::Result<()> {
1869/// let client = Firewalls::builder().build().await?;
1870/// // use `client` to make requests to the Google Compute Engine API.
1871/// Ok(())
1872/// }
1873/// ```
1874///
1875/// # Service Description
1876///
1877/// Service for the `firewalls` resource.
1878///
1879/// # Configuration
1880///
1881/// To configure `Firewalls` use the `with_*` methods in the type returned
1882/// by [builder()][Firewalls::builder]. The default configuration should
1883/// work for most applications. Common configuration changes include
1884///
1885/// * [with_endpoint()]: by default this client uses the global default endpoint
1886/// (`https://compute.googleapis.com`). Applications using regional
1887/// endpoints or running in restricted networks (e.g. a network configured
1888/// with [Private Google Access with VPC Service Controls]) may want to
1889/// override this default.
1890/// * [with_credentials()]: by default this client uses
1891/// [Application Default Credentials]. Applications using custom
1892/// authentication may need to override this default.
1893///
1894/// [with_endpoint()]: super::builder::firewalls::ClientBuilder::with_endpoint
1895/// [with_credentials()]: super::builder::firewalls::ClientBuilder::with_credentials
1896/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1897/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1898///
1899/// # Pooling and Cloning
1900///
1901/// `Firewalls` holds a connection pool internally, it is advised to
1902/// create one and reuse it. You do not need to wrap `Firewalls` in
1903/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1904/// already uses an `Arc` internally.
1905#[cfg(feature = "firewalls")]
1906#[cfg_attr(docsrs, doc(cfg(feature = "firewalls")))]
1907#[derive(Clone, Debug)]
1908pub struct Firewalls {
1909 inner: std::sync::Arc<dyn super::stub::dynamic::Firewalls>,
1910}
1911
1912#[cfg(feature = "firewalls")]
1913impl Firewalls {
1914 /// Returns a builder for [Firewalls].
1915 ///
1916 /// ```
1917 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1918 /// # use google_cloud_compute_v1::client::Firewalls;
1919 /// let client = Firewalls::builder().build().await?;
1920 /// # Ok(()) }
1921 /// ```
1922 pub fn builder() -> super::builder::firewalls::ClientBuilder {
1923 crate::new_client_builder(super::builder::firewalls::client::Factory)
1924 }
1925
1926 /// Creates a new client from the provided stub.
1927 ///
1928 /// The most common case for calling this function is in tests mocking the
1929 /// client's behavior.
1930 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1931 where
1932 T: super::stub::Firewalls + 'static,
1933 {
1934 Self { inner: stub.into() }
1935 }
1936
1937 pub(crate) async fn new(
1938 config: gaxi::options::ClientConfig,
1939 ) -> crate::ClientBuilderResult<Self> {
1940 let inner = Self::build_inner(config).await?;
1941 Ok(Self { inner })
1942 }
1943
1944 async fn build_inner(
1945 conf: gaxi::options::ClientConfig,
1946 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Firewalls>> {
1947 if gaxi::options::tracing_enabled(&conf) {
1948 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1949 }
1950 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1951 }
1952
1953 async fn build_transport(
1954 conf: gaxi::options::ClientConfig,
1955 ) -> crate::ClientBuilderResult<impl super::stub::Firewalls> {
1956 super::transport::Firewalls::new(conf).await
1957 }
1958
1959 async fn build_with_tracing(
1960 conf: gaxi::options::ClientConfig,
1961 ) -> crate::ClientBuilderResult<impl super::stub::Firewalls> {
1962 Self::build_transport(conf)
1963 .await
1964 .map(super::tracing::Firewalls::new)
1965 }
1966
1967 /// Deletes the specified firewall.
1968 pub fn delete(&self) -> super::builder::firewalls::Delete {
1969 super::builder::firewalls::Delete::new(self.inner.clone())
1970 }
1971
1972 /// Returns the specified firewall.
1973 pub fn get(&self) -> super::builder::firewalls::Get {
1974 super::builder::firewalls::Get::new(self.inner.clone())
1975 }
1976
1977 /// Creates a firewall rule in the specified project using the data
1978 /// included in the request.
1979 pub fn insert(&self) -> super::builder::firewalls::Insert {
1980 super::builder::firewalls::Insert::new(self.inner.clone())
1981 }
1982
1983 /// Retrieves the list of firewall rules available to the specified
1984 /// project.
1985 pub fn list(&self) -> super::builder::firewalls::List {
1986 super::builder::firewalls::List::new(self.inner.clone())
1987 }
1988
1989 /// Updates the specified firewall rule with the data included in the
1990 /// request. This method supportsPATCH
1991 /// semantics and uses theJSON merge
1992 /// patch format and processing rules.
1993 pub fn patch(&self) -> super::builder::firewalls::Patch {
1994 super::builder::firewalls::Patch::new(self.inner.clone())
1995 }
1996
1997 /// Returns permissions that a caller has on the specified resource.
1998 pub fn test_iam_permissions(&self) -> super::builder::firewalls::TestIamPermissions {
1999 super::builder::firewalls::TestIamPermissions::new(self.inner.clone())
2000 }
2001
2002 /// Updates the specified firewall rule with the data included in the
2003 /// request.
2004 /// Note that all fields will be updated if using PUT, even fields that are not
2005 /// specified. To update individual fields, please use PATCH instead.
2006 pub fn update(&self) -> super::builder::firewalls::Update {
2007 super::builder::firewalls::Update::new(self.inner.clone())
2008 }
2009
2010 /// Retrieves the specified Operations resource.
2011 pub fn get_operation(&self) -> super::builder::firewalls::GetOperation {
2012 super::builder::firewalls::GetOperation::new(self.inner.clone())
2013 }
2014}
2015
2016/// Implements a client for the Google Compute Engine API.
2017///
2018/// # Example
2019/// ```
2020/// # use google_cloud_compute_v1::client::ForwardingRules;
2021/// async fn sample(
2022/// ) -> anyhow::Result<()> {
2023/// let client = ForwardingRules::builder().build().await?;
2024/// // use `client` to make requests to the Google Compute Engine API.
2025/// Ok(())
2026/// }
2027/// ```
2028///
2029/// # Service Description
2030///
2031/// Service for the `forwardingRules` resource.
2032///
2033/// # Configuration
2034///
2035/// To configure `ForwardingRules` use the `with_*` methods in the type returned
2036/// by [builder()][ForwardingRules::builder]. The default configuration should
2037/// work for most applications. Common configuration changes include
2038///
2039/// * [with_endpoint()]: by default this client uses the global default endpoint
2040/// (`https://compute.googleapis.com`). Applications using regional
2041/// endpoints or running in restricted networks (e.g. a network configured
2042/// with [Private Google Access with VPC Service Controls]) may want to
2043/// override this default.
2044/// * [with_credentials()]: by default this client uses
2045/// [Application Default Credentials]. Applications using custom
2046/// authentication may need to override this default.
2047///
2048/// [with_endpoint()]: super::builder::forwarding_rules::ClientBuilder::with_endpoint
2049/// [with_credentials()]: super::builder::forwarding_rules::ClientBuilder::with_credentials
2050/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2051/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2052///
2053/// # Pooling and Cloning
2054///
2055/// `ForwardingRules` holds a connection pool internally, it is advised to
2056/// create one and reuse it. You do not need to wrap `ForwardingRules` in
2057/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2058/// already uses an `Arc` internally.
2059#[cfg(feature = "forwarding-rules")]
2060#[cfg_attr(docsrs, doc(cfg(feature = "forwarding-rules")))]
2061#[derive(Clone, Debug)]
2062pub struct ForwardingRules {
2063 inner: std::sync::Arc<dyn super::stub::dynamic::ForwardingRules>,
2064}
2065
2066#[cfg(feature = "forwarding-rules")]
2067impl ForwardingRules {
2068 /// Returns a builder for [ForwardingRules].
2069 ///
2070 /// ```
2071 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2072 /// # use google_cloud_compute_v1::client::ForwardingRules;
2073 /// let client = ForwardingRules::builder().build().await?;
2074 /// # Ok(()) }
2075 /// ```
2076 pub fn builder() -> super::builder::forwarding_rules::ClientBuilder {
2077 crate::new_client_builder(super::builder::forwarding_rules::client::Factory)
2078 }
2079
2080 /// Creates a new client from the provided stub.
2081 ///
2082 /// The most common case for calling this function is in tests mocking the
2083 /// client's behavior.
2084 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2085 where
2086 T: super::stub::ForwardingRules + 'static,
2087 {
2088 Self { inner: stub.into() }
2089 }
2090
2091 pub(crate) async fn new(
2092 config: gaxi::options::ClientConfig,
2093 ) -> crate::ClientBuilderResult<Self> {
2094 let inner = Self::build_inner(config).await?;
2095 Ok(Self { inner })
2096 }
2097
2098 async fn build_inner(
2099 conf: gaxi::options::ClientConfig,
2100 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ForwardingRules>> {
2101 if gaxi::options::tracing_enabled(&conf) {
2102 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2103 }
2104 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2105 }
2106
2107 async fn build_transport(
2108 conf: gaxi::options::ClientConfig,
2109 ) -> crate::ClientBuilderResult<impl super::stub::ForwardingRules> {
2110 super::transport::ForwardingRules::new(conf).await
2111 }
2112
2113 async fn build_with_tracing(
2114 conf: gaxi::options::ClientConfig,
2115 ) -> crate::ClientBuilderResult<impl super::stub::ForwardingRules> {
2116 Self::build_transport(conf)
2117 .await
2118 .map(super::tracing::ForwardingRules::new)
2119 }
2120
2121 /// Retrieves an aggregated list of forwarding rules.
2122 ///
2123 /// To prevent failure, it is recommended that you set the
2124 /// `returnPartialSuccess` parameter to `true`.
2125 pub fn aggregated_list(&self) -> super::builder::forwarding_rules::AggregatedList {
2126 super::builder::forwarding_rules::AggregatedList::new(self.inner.clone())
2127 }
2128
2129 /// Deletes the specified ForwardingRule resource.
2130 pub fn delete(&self) -> super::builder::forwarding_rules::Delete {
2131 super::builder::forwarding_rules::Delete::new(self.inner.clone())
2132 }
2133
2134 /// Returns the specified ForwardingRule resource.
2135 pub fn get(&self) -> super::builder::forwarding_rules::Get {
2136 super::builder::forwarding_rules::Get::new(self.inner.clone())
2137 }
2138
2139 /// Creates a ForwardingRule resource in the specified project and region using
2140 /// the data included in the request.
2141 pub fn insert(&self) -> super::builder::forwarding_rules::Insert {
2142 super::builder::forwarding_rules::Insert::new(self.inner.clone())
2143 }
2144
2145 /// Retrieves a list of ForwardingRule resources available to the specified
2146 /// project and region.
2147 pub fn list(&self) -> super::builder::forwarding_rules::List {
2148 super::builder::forwarding_rules::List::new(self.inner.clone())
2149 }
2150
2151 /// Updates the specified forwarding rule with the data included in the
2152 /// request. This method supportsPATCH
2153 /// semantics and uses theJSON merge
2154 /// patch format and processing rules. Currently, you can only
2155 /// patch the network_tier field.
2156 pub fn patch(&self) -> super::builder::forwarding_rules::Patch {
2157 super::builder::forwarding_rules::Patch::new(self.inner.clone())
2158 }
2159
2160 /// Sets the labels on the specified resource. To learn more about labels,
2161 /// read the
2162 /// Labeling Resources documentation.
2163 pub fn set_labels(&self) -> super::builder::forwarding_rules::SetLabels {
2164 super::builder::forwarding_rules::SetLabels::new(self.inner.clone())
2165 }
2166
2167 /// Changes target URL for forwarding rule. The new target should be of the
2168 /// same type as the old target.
2169 pub fn set_target(&self) -> super::builder::forwarding_rules::SetTarget {
2170 super::builder::forwarding_rules::SetTarget::new(self.inner.clone())
2171 }
2172
2173 /// Retrieves the specified region-specific Operations resource.
2174 pub fn get_operation(&self) -> super::builder::forwarding_rules::GetOperation {
2175 super::builder::forwarding_rules::GetOperation::new(self.inner.clone())
2176 }
2177}
2178
2179/// Implements a client for the Google Compute Engine API.
2180///
2181/// # Example
2182/// ```
2183/// # use google_cloud_compute_v1::client::FutureReservations;
2184/// async fn sample(
2185/// ) -> anyhow::Result<()> {
2186/// let client = FutureReservations::builder().build().await?;
2187/// // use `client` to make requests to the Google Compute Engine API.
2188/// Ok(())
2189/// }
2190/// ```
2191///
2192/// # Service Description
2193///
2194/// Service for the `futureReservations` resource.
2195///
2196/// # Configuration
2197///
2198/// To configure `FutureReservations` use the `with_*` methods in the type returned
2199/// by [builder()][FutureReservations::builder]. The default configuration should
2200/// work for most applications. Common configuration changes include
2201///
2202/// * [with_endpoint()]: by default this client uses the global default endpoint
2203/// (`https://compute.googleapis.com`). Applications using regional
2204/// endpoints or running in restricted networks (e.g. a network configured
2205/// with [Private Google Access with VPC Service Controls]) may want to
2206/// override this default.
2207/// * [with_credentials()]: by default this client uses
2208/// [Application Default Credentials]. Applications using custom
2209/// authentication may need to override this default.
2210///
2211/// [with_endpoint()]: super::builder::future_reservations::ClientBuilder::with_endpoint
2212/// [with_credentials()]: super::builder::future_reservations::ClientBuilder::with_credentials
2213/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2214/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2215///
2216/// # Pooling and Cloning
2217///
2218/// `FutureReservations` holds a connection pool internally, it is advised to
2219/// create one and reuse it. You do not need to wrap `FutureReservations` in
2220/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2221/// already uses an `Arc` internally.
2222#[cfg(feature = "future-reservations")]
2223#[cfg_attr(docsrs, doc(cfg(feature = "future-reservations")))]
2224#[derive(Clone, Debug)]
2225pub struct FutureReservations {
2226 inner: std::sync::Arc<dyn super::stub::dynamic::FutureReservations>,
2227}
2228
2229#[cfg(feature = "future-reservations")]
2230impl FutureReservations {
2231 /// Returns a builder for [FutureReservations].
2232 ///
2233 /// ```
2234 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2235 /// # use google_cloud_compute_v1::client::FutureReservations;
2236 /// let client = FutureReservations::builder().build().await?;
2237 /// # Ok(()) }
2238 /// ```
2239 pub fn builder() -> super::builder::future_reservations::ClientBuilder {
2240 crate::new_client_builder(super::builder::future_reservations::client::Factory)
2241 }
2242
2243 /// Creates a new client from the provided stub.
2244 ///
2245 /// The most common case for calling this function is in tests mocking the
2246 /// client's behavior.
2247 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2248 where
2249 T: super::stub::FutureReservations + 'static,
2250 {
2251 Self { inner: stub.into() }
2252 }
2253
2254 pub(crate) async fn new(
2255 config: gaxi::options::ClientConfig,
2256 ) -> crate::ClientBuilderResult<Self> {
2257 let inner = Self::build_inner(config).await?;
2258 Ok(Self { inner })
2259 }
2260
2261 async fn build_inner(
2262 conf: gaxi::options::ClientConfig,
2263 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FutureReservations>>
2264 {
2265 if gaxi::options::tracing_enabled(&conf) {
2266 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2267 }
2268 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2269 }
2270
2271 async fn build_transport(
2272 conf: gaxi::options::ClientConfig,
2273 ) -> crate::ClientBuilderResult<impl super::stub::FutureReservations> {
2274 super::transport::FutureReservations::new(conf).await
2275 }
2276
2277 async fn build_with_tracing(
2278 conf: gaxi::options::ClientConfig,
2279 ) -> crate::ClientBuilderResult<impl super::stub::FutureReservations> {
2280 Self::build_transport(conf)
2281 .await
2282 .map(super::tracing::FutureReservations::new)
2283 }
2284
2285 /// Retrieves an aggregated list of future reservations.
2286 ///
2287 /// To prevent failure, it is recommended that you set the
2288 /// `returnPartialSuccess` parameter to `true`.
2289 pub fn aggregated_list(&self) -> super::builder::future_reservations::AggregatedList {
2290 super::builder::future_reservations::AggregatedList::new(self.inner.clone())
2291 }
2292
2293 /// Cancel the specified future reservation.
2294 pub fn cancel(&self) -> super::builder::future_reservations::Cancel {
2295 super::builder::future_reservations::Cancel::new(self.inner.clone())
2296 }
2297
2298 /// Deletes the specified future reservation.
2299 pub fn delete(&self) -> super::builder::future_reservations::Delete {
2300 super::builder::future_reservations::Delete::new(self.inner.clone())
2301 }
2302
2303 /// Retrieves information about the specified future reservation.
2304 pub fn get(&self) -> super::builder::future_reservations::Get {
2305 super::builder::future_reservations::Get::new(self.inner.clone())
2306 }
2307
2308 /// Creates a new Future Reservation.
2309 pub fn insert(&self) -> super::builder::future_reservations::Insert {
2310 super::builder::future_reservations::Insert::new(self.inner.clone())
2311 }
2312
2313 /// A list of all the future reservations that have been configured for the
2314 /// specified project in specified zone.
2315 pub fn list(&self) -> super::builder::future_reservations::List {
2316 super::builder::future_reservations::List::new(self.inner.clone())
2317 }
2318
2319 /// Updates the specified future reservation.
2320 pub fn update(&self) -> super::builder::future_reservations::Update {
2321 super::builder::future_reservations::Update::new(self.inner.clone())
2322 }
2323
2324 /// Retrieves the specified zone-specific Operations resource.
2325 pub fn get_operation(&self) -> super::builder::future_reservations::GetOperation {
2326 super::builder::future_reservations::GetOperation::new(self.inner.clone())
2327 }
2328}
2329
2330/// Implements a client for the Google Compute Engine API.
2331///
2332/// # Example
2333/// ```
2334/// # use google_cloud_compute_v1::client::GlobalAddresses;
2335/// async fn sample(
2336/// ) -> anyhow::Result<()> {
2337/// let client = GlobalAddresses::builder().build().await?;
2338/// // use `client` to make requests to the Google Compute Engine API.
2339/// Ok(())
2340/// }
2341/// ```
2342///
2343/// # Service Description
2344///
2345/// Service for the `globalAddresses` resource.
2346///
2347/// # Configuration
2348///
2349/// To configure `GlobalAddresses` use the `with_*` methods in the type returned
2350/// by [builder()][GlobalAddresses::builder]. The default configuration should
2351/// work for most applications. Common configuration changes include
2352///
2353/// * [with_endpoint()]: by default this client uses the global default endpoint
2354/// (`https://compute.googleapis.com`). Applications using regional
2355/// endpoints or running in restricted networks (e.g. a network configured
2356/// with [Private Google Access with VPC Service Controls]) may want to
2357/// override this default.
2358/// * [with_credentials()]: by default this client uses
2359/// [Application Default Credentials]. Applications using custom
2360/// authentication may need to override this default.
2361///
2362/// [with_endpoint()]: super::builder::global_addresses::ClientBuilder::with_endpoint
2363/// [with_credentials()]: super::builder::global_addresses::ClientBuilder::with_credentials
2364/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2365/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2366///
2367/// # Pooling and Cloning
2368///
2369/// `GlobalAddresses` holds a connection pool internally, it is advised to
2370/// create one and reuse it. You do not need to wrap `GlobalAddresses` in
2371/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2372/// already uses an `Arc` internally.
2373#[cfg(feature = "global-addresses")]
2374#[cfg_attr(docsrs, doc(cfg(feature = "global-addresses")))]
2375#[derive(Clone, Debug)]
2376pub struct GlobalAddresses {
2377 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalAddresses>,
2378}
2379
2380#[cfg(feature = "global-addresses")]
2381impl GlobalAddresses {
2382 /// Returns a builder for [GlobalAddresses].
2383 ///
2384 /// ```
2385 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2386 /// # use google_cloud_compute_v1::client::GlobalAddresses;
2387 /// let client = GlobalAddresses::builder().build().await?;
2388 /// # Ok(()) }
2389 /// ```
2390 pub fn builder() -> super::builder::global_addresses::ClientBuilder {
2391 crate::new_client_builder(super::builder::global_addresses::client::Factory)
2392 }
2393
2394 /// Creates a new client from the provided stub.
2395 ///
2396 /// The most common case for calling this function is in tests mocking the
2397 /// client's behavior.
2398 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2399 where
2400 T: super::stub::GlobalAddresses + 'static,
2401 {
2402 Self { inner: stub.into() }
2403 }
2404
2405 pub(crate) async fn new(
2406 config: gaxi::options::ClientConfig,
2407 ) -> crate::ClientBuilderResult<Self> {
2408 let inner = Self::build_inner(config).await?;
2409 Ok(Self { inner })
2410 }
2411
2412 async fn build_inner(
2413 conf: gaxi::options::ClientConfig,
2414 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GlobalAddresses>> {
2415 if gaxi::options::tracing_enabled(&conf) {
2416 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2417 }
2418 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2419 }
2420
2421 async fn build_transport(
2422 conf: gaxi::options::ClientConfig,
2423 ) -> crate::ClientBuilderResult<impl super::stub::GlobalAddresses> {
2424 super::transport::GlobalAddresses::new(conf).await
2425 }
2426
2427 async fn build_with_tracing(
2428 conf: gaxi::options::ClientConfig,
2429 ) -> crate::ClientBuilderResult<impl super::stub::GlobalAddresses> {
2430 Self::build_transport(conf)
2431 .await
2432 .map(super::tracing::GlobalAddresses::new)
2433 }
2434
2435 /// Deletes the specified address resource.
2436 pub fn delete(&self) -> super::builder::global_addresses::Delete {
2437 super::builder::global_addresses::Delete::new(self.inner.clone())
2438 }
2439
2440 /// Returns the specified address resource.
2441 pub fn get(&self) -> super::builder::global_addresses::Get {
2442 super::builder::global_addresses::Get::new(self.inner.clone())
2443 }
2444
2445 /// Creates an address resource in the specified project by using the data
2446 /// included in the request.
2447 pub fn insert(&self) -> super::builder::global_addresses::Insert {
2448 super::builder::global_addresses::Insert::new(self.inner.clone())
2449 }
2450
2451 /// Retrieves a list of global addresses.
2452 pub fn list(&self) -> super::builder::global_addresses::List {
2453 super::builder::global_addresses::List::new(self.inner.clone())
2454 }
2455
2456 /// Moves the specified address resource from one project to another project.
2457 pub fn r#move(&self) -> super::builder::global_addresses::Move {
2458 super::builder::global_addresses::Move::new(self.inner.clone())
2459 }
2460
2461 /// Sets the labels on a GlobalAddress. To learn more about labels, read theLabeling
2462 /// Resources documentation.
2463 pub fn set_labels(&self) -> super::builder::global_addresses::SetLabels {
2464 super::builder::global_addresses::SetLabels::new(self.inner.clone())
2465 }
2466
2467 /// Returns permissions that a caller has on the specified resource.
2468 pub fn test_iam_permissions(&self) -> super::builder::global_addresses::TestIamPermissions {
2469 super::builder::global_addresses::TestIamPermissions::new(self.inner.clone())
2470 }
2471
2472 /// Retrieves the specified Operations resource.
2473 pub fn get_operation(&self) -> super::builder::global_addresses::GetOperation {
2474 super::builder::global_addresses::GetOperation::new(self.inner.clone())
2475 }
2476}
2477
2478/// Implements a client for the Google Compute Engine API.
2479///
2480/// # Example
2481/// ```
2482/// # use google_cloud_compute_v1::client::GlobalForwardingRules;
2483/// async fn sample(
2484/// ) -> anyhow::Result<()> {
2485/// let client = GlobalForwardingRules::builder().build().await?;
2486/// // use `client` to make requests to the Google Compute Engine API.
2487/// Ok(())
2488/// }
2489/// ```
2490///
2491/// # Service Description
2492///
2493/// Service for the `globalForwardingRules` resource.
2494///
2495/// # Configuration
2496///
2497/// To configure `GlobalForwardingRules` use the `with_*` methods in the type returned
2498/// by [builder()][GlobalForwardingRules::builder]. The default configuration should
2499/// work for most applications. Common configuration changes include
2500///
2501/// * [with_endpoint()]: by default this client uses the global default endpoint
2502/// (`https://compute.googleapis.com`). Applications using regional
2503/// endpoints or running in restricted networks (e.g. a network configured
2504/// with [Private Google Access with VPC Service Controls]) may want to
2505/// override this default.
2506/// * [with_credentials()]: by default this client uses
2507/// [Application Default Credentials]. Applications using custom
2508/// authentication may need to override this default.
2509///
2510/// [with_endpoint()]: super::builder::global_forwarding_rules::ClientBuilder::with_endpoint
2511/// [with_credentials()]: super::builder::global_forwarding_rules::ClientBuilder::with_credentials
2512/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2513/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2514///
2515/// # Pooling and Cloning
2516///
2517/// `GlobalForwardingRules` holds a connection pool internally, it is advised to
2518/// create one and reuse it. You do not need to wrap `GlobalForwardingRules` in
2519/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2520/// already uses an `Arc` internally.
2521#[cfg(feature = "global-forwarding-rules")]
2522#[cfg_attr(docsrs, doc(cfg(feature = "global-forwarding-rules")))]
2523#[derive(Clone, Debug)]
2524pub struct GlobalForwardingRules {
2525 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalForwardingRules>,
2526}
2527
2528#[cfg(feature = "global-forwarding-rules")]
2529impl GlobalForwardingRules {
2530 /// Returns a builder for [GlobalForwardingRules].
2531 ///
2532 /// ```
2533 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2534 /// # use google_cloud_compute_v1::client::GlobalForwardingRules;
2535 /// let client = GlobalForwardingRules::builder().build().await?;
2536 /// # Ok(()) }
2537 /// ```
2538 pub fn builder() -> super::builder::global_forwarding_rules::ClientBuilder {
2539 crate::new_client_builder(super::builder::global_forwarding_rules::client::Factory)
2540 }
2541
2542 /// Creates a new client from the provided stub.
2543 ///
2544 /// The most common case for calling this function is in tests mocking the
2545 /// client's behavior.
2546 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2547 where
2548 T: super::stub::GlobalForwardingRules + 'static,
2549 {
2550 Self { inner: stub.into() }
2551 }
2552
2553 pub(crate) async fn new(
2554 config: gaxi::options::ClientConfig,
2555 ) -> crate::ClientBuilderResult<Self> {
2556 let inner = Self::build_inner(config).await?;
2557 Ok(Self { inner })
2558 }
2559
2560 async fn build_inner(
2561 conf: gaxi::options::ClientConfig,
2562 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GlobalForwardingRules>>
2563 {
2564 if gaxi::options::tracing_enabled(&conf) {
2565 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2566 }
2567 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2568 }
2569
2570 async fn build_transport(
2571 conf: gaxi::options::ClientConfig,
2572 ) -> crate::ClientBuilderResult<impl super::stub::GlobalForwardingRules> {
2573 super::transport::GlobalForwardingRules::new(conf).await
2574 }
2575
2576 async fn build_with_tracing(
2577 conf: gaxi::options::ClientConfig,
2578 ) -> crate::ClientBuilderResult<impl super::stub::GlobalForwardingRules> {
2579 Self::build_transport(conf)
2580 .await
2581 .map(super::tracing::GlobalForwardingRules::new)
2582 }
2583
2584 /// Deletes the specified GlobalForwardingRule resource.
2585 pub fn delete(&self) -> super::builder::global_forwarding_rules::Delete {
2586 super::builder::global_forwarding_rules::Delete::new(self.inner.clone())
2587 }
2588
2589 /// Returns the specified GlobalForwardingRule resource. Gets a list of
2590 /// available forwarding rules by making a list() request.
2591 pub fn get(&self) -> super::builder::global_forwarding_rules::Get {
2592 super::builder::global_forwarding_rules::Get::new(self.inner.clone())
2593 }
2594
2595 /// Creates a GlobalForwardingRule resource in the specified project using
2596 /// the data included in the request.
2597 pub fn insert(&self) -> super::builder::global_forwarding_rules::Insert {
2598 super::builder::global_forwarding_rules::Insert::new(self.inner.clone())
2599 }
2600
2601 /// Retrieves a list of GlobalForwardingRule resources available to the
2602 /// specified project.
2603 pub fn list(&self) -> super::builder::global_forwarding_rules::List {
2604 super::builder::global_forwarding_rules::List::new(self.inner.clone())
2605 }
2606
2607 /// Updates the specified forwarding rule with the data included in the
2608 /// request. This method supportsPATCH
2609 /// semantics and uses theJSON merge
2610 /// patch format and processing rules. Currently, you can only
2611 /// patch the network_tier field.
2612 pub fn patch(&self) -> super::builder::global_forwarding_rules::Patch {
2613 super::builder::global_forwarding_rules::Patch::new(self.inner.clone())
2614 }
2615
2616 /// Sets the labels on the specified resource. To learn more about labels,
2617 /// read the
2618 /// Labeling resources documentation.
2619 pub fn set_labels(&self) -> super::builder::global_forwarding_rules::SetLabels {
2620 super::builder::global_forwarding_rules::SetLabels::new(self.inner.clone())
2621 }
2622
2623 /// Changes target URL for the GlobalForwardingRule resource. The new target
2624 /// should be of the same type as the old target.
2625 pub fn set_target(&self) -> super::builder::global_forwarding_rules::SetTarget {
2626 super::builder::global_forwarding_rules::SetTarget::new(self.inner.clone())
2627 }
2628
2629 /// Retrieves the specified Operations resource.
2630 pub fn get_operation(&self) -> super::builder::global_forwarding_rules::GetOperation {
2631 super::builder::global_forwarding_rules::GetOperation::new(self.inner.clone())
2632 }
2633}
2634
2635/// Implements a client for the Google Compute Engine API.
2636///
2637/// # Example
2638/// ```
2639/// # use google_cloud_compute_v1::client::GlobalNetworkEndpointGroups;
2640/// async fn sample(
2641/// ) -> anyhow::Result<()> {
2642/// let client = GlobalNetworkEndpointGroups::builder().build().await?;
2643/// // use `client` to make requests to the Google Compute Engine API.
2644/// Ok(())
2645/// }
2646/// ```
2647///
2648/// # Service Description
2649///
2650/// Service for the `globalNetworkEndpointGroups` resource.
2651///
2652/// # Configuration
2653///
2654/// To configure `GlobalNetworkEndpointGroups` use the `with_*` methods in the type returned
2655/// by [builder()][GlobalNetworkEndpointGroups::builder]. The default configuration should
2656/// work for most applications. Common configuration changes include
2657///
2658/// * [with_endpoint()]: by default this client uses the global default endpoint
2659/// (`https://compute.googleapis.com`). Applications using regional
2660/// endpoints or running in restricted networks (e.g. a network configured
2661/// with [Private Google Access with VPC Service Controls]) may want to
2662/// override this default.
2663/// * [with_credentials()]: by default this client uses
2664/// [Application Default Credentials]. Applications using custom
2665/// authentication may need to override this default.
2666///
2667/// [with_endpoint()]: super::builder::global_network_endpoint_groups::ClientBuilder::with_endpoint
2668/// [with_credentials()]: super::builder::global_network_endpoint_groups::ClientBuilder::with_credentials
2669/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2670/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2671///
2672/// # Pooling and Cloning
2673///
2674/// `GlobalNetworkEndpointGroups` holds a connection pool internally, it is advised to
2675/// create one and reuse it. You do not need to wrap `GlobalNetworkEndpointGroups` in
2676/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2677/// already uses an `Arc` internally.
2678#[cfg(feature = "global-network-endpoint-groups")]
2679#[cfg_attr(docsrs, doc(cfg(feature = "global-network-endpoint-groups")))]
2680#[derive(Clone, Debug)]
2681pub struct GlobalNetworkEndpointGroups {
2682 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalNetworkEndpointGroups>,
2683}
2684
2685#[cfg(feature = "global-network-endpoint-groups")]
2686impl GlobalNetworkEndpointGroups {
2687 /// Returns a builder for [GlobalNetworkEndpointGroups].
2688 ///
2689 /// ```
2690 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2691 /// # use google_cloud_compute_v1::client::GlobalNetworkEndpointGroups;
2692 /// let client = GlobalNetworkEndpointGroups::builder().build().await?;
2693 /// # Ok(()) }
2694 /// ```
2695 pub fn builder() -> super::builder::global_network_endpoint_groups::ClientBuilder {
2696 crate::new_client_builder(super::builder::global_network_endpoint_groups::client::Factory)
2697 }
2698
2699 /// Creates a new client from the provided stub.
2700 ///
2701 /// The most common case for calling this function is in tests mocking the
2702 /// client's behavior.
2703 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2704 where
2705 T: super::stub::GlobalNetworkEndpointGroups + 'static,
2706 {
2707 Self { inner: stub.into() }
2708 }
2709
2710 pub(crate) async fn new(
2711 config: gaxi::options::ClientConfig,
2712 ) -> crate::ClientBuilderResult<Self> {
2713 let inner = Self::build_inner(config).await?;
2714 Ok(Self { inner })
2715 }
2716
2717 async fn build_inner(
2718 conf: gaxi::options::ClientConfig,
2719 ) -> crate::ClientBuilderResult<
2720 std::sync::Arc<dyn super::stub::dynamic::GlobalNetworkEndpointGroups>,
2721 > {
2722 if gaxi::options::tracing_enabled(&conf) {
2723 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2724 }
2725 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2726 }
2727
2728 async fn build_transport(
2729 conf: gaxi::options::ClientConfig,
2730 ) -> crate::ClientBuilderResult<impl super::stub::GlobalNetworkEndpointGroups> {
2731 super::transport::GlobalNetworkEndpointGroups::new(conf).await
2732 }
2733
2734 async fn build_with_tracing(
2735 conf: gaxi::options::ClientConfig,
2736 ) -> crate::ClientBuilderResult<impl super::stub::GlobalNetworkEndpointGroups> {
2737 Self::build_transport(conf)
2738 .await
2739 .map(super::tracing::GlobalNetworkEndpointGroups::new)
2740 }
2741
2742 /// Attach a network endpoint to the specified network endpoint group.
2743 pub fn attach_network_endpoints(
2744 &self,
2745 ) -> super::builder::global_network_endpoint_groups::AttachNetworkEndpoints {
2746 super::builder::global_network_endpoint_groups::AttachNetworkEndpoints::new(
2747 self.inner.clone(),
2748 )
2749 }
2750
2751 /// Deletes the specified network endpoint group.Note that the NEG cannot be
2752 /// deleted if there are backend services referencing it.
2753 pub fn delete(&self) -> super::builder::global_network_endpoint_groups::Delete {
2754 super::builder::global_network_endpoint_groups::Delete::new(self.inner.clone())
2755 }
2756
2757 /// Detach the network endpoint from the specified network endpoint group.
2758 pub fn detach_network_endpoints(
2759 &self,
2760 ) -> super::builder::global_network_endpoint_groups::DetachNetworkEndpoints {
2761 super::builder::global_network_endpoint_groups::DetachNetworkEndpoints::new(
2762 self.inner.clone(),
2763 )
2764 }
2765
2766 /// Returns the specified network endpoint group.
2767 pub fn get(&self) -> super::builder::global_network_endpoint_groups::Get {
2768 super::builder::global_network_endpoint_groups::Get::new(self.inner.clone())
2769 }
2770
2771 /// Creates a network endpoint group in the specified project using the
2772 /// parameters that are included in the request.
2773 ///
2774 /// Note: Use the following APIs to manage network endpoint groups:
2775 ///
2776 /// - To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
2777 /// NEGs): zonal
2778 /// API
2779 /// - To manage NEGs with regional scope (such as regional internet NEGs,
2780 /// serverless NEGs, Private Service Connect NEGs): regional
2781 /// API
2782 /// - To manage NEGs with global scope (such as global internet NEGs):global
2783 /// API
2784 pub fn insert(&self) -> super::builder::global_network_endpoint_groups::Insert {
2785 super::builder::global_network_endpoint_groups::Insert::new(self.inner.clone())
2786 }
2787
2788 /// Retrieves the list of network endpoint groups that are located in the
2789 /// specified project.
2790 pub fn list(&self) -> super::builder::global_network_endpoint_groups::List {
2791 super::builder::global_network_endpoint_groups::List::new(self.inner.clone())
2792 }
2793
2794 /// Lists the network endpoints in the specified network endpoint group.
2795 pub fn list_network_endpoints(
2796 &self,
2797 ) -> super::builder::global_network_endpoint_groups::ListNetworkEndpoints {
2798 super::builder::global_network_endpoint_groups::ListNetworkEndpoints::new(
2799 self.inner.clone(),
2800 )
2801 }
2802
2803 /// Retrieves the specified Operations resource.
2804 pub fn get_operation(&self) -> super::builder::global_network_endpoint_groups::GetOperation {
2805 super::builder::global_network_endpoint_groups::GetOperation::new(self.inner.clone())
2806 }
2807}
2808
2809/// Implements a client for the Google Compute Engine API.
2810///
2811/// # Example
2812/// ```
2813/// # use google_cloud_compute_v1::client::GlobalOperations;
2814/// async fn sample(
2815/// ) -> anyhow::Result<()> {
2816/// let client = GlobalOperations::builder().build().await?;
2817/// // use `client` to make requests to the Google Compute Engine API.
2818/// Ok(())
2819/// }
2820/// ```
2821///
2822/// # Service Description
2823///
2824/// Service for the `globalOperations` resource.
2825///
2826/// # Configuration
2827///
2828/// To configure `GlobalOperations` use the `with_*` methods in the type returned
2829/// by [builder()][GlobalOperations::builder]. The default configuration should
2830/// work for most applications. Common configuration changes include
2831///
2832/// * [with_endpoint()]: by default this client uses the global default endpoint
2833/// (`https://compute.googleapis.com`). Applications using regional
2834/// endpoints or running in restricted networks (e.g. a network configured
2835/// with [Private Google Access with VPC Service Controls]) may want to
2836/// override this default.
2837/// * [with_credentials()]: by default this client uses
2838/// [Application Default Credentials]. Applications using custom
2839/// authentication may need to override this default.
2840///
2841/// [with_endpoint()]: super::builder::global_operations::ClientBuilder::with_endpoint
2842/// [with_credentials()]: super::builder::global_operations::ClientBuilder::with_credentials
2843/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2844/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2845///
2846/// # Pooling and Cloning
2847///
2848/// `GlobalOperations` holds a connection pool internally, it is advised to
2849/// create one and reuse it. You do not need to wrap `GlobalOperations` in
2850/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2851/// already uses an `Arc` internally.
2852#[cfg(feature = "global-operations")]
2853#[cfg_attr(docsrs, doc(cfg(feature = "global-operations")))]
2854#[derive(Clone, Debug)]
2855pub struct GlobalOperations {
2856 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalOperations>,
2857}
2858
2859#[cfg(feature = "global-operations")]
2860impl GlobalOperations {
2861 /// Returns a builder for [GlobalOperations].
2862 ///
2863 /// ```
2864 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2865 /// # use google_cloud_compute_v1::client::GlobalOperations;
2866 /// let client = GlobalOperations::builder().build().await?;
2867 /// # Ok(()) }
2868 /// ```
2869 pub fn builder() -> super::builder::global_operations::ClientBuilder {
2870 crate::new_client_builder(super::builder::global_operations::client::Factory)
2871 }
2872
2873 /// Creates a new client from the provided stub.
2874 ///
2875 /// The most common case for calling this function is in tests mocking the
2876 /// client's behavior.
2877 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2878 where
2879 T: super::stub::GlobalOperations + 'static,
2880 {
2881 Self { inner: stub.into() }
2882 }
2883
2884 pub(crate) async fn new(
2885 config: gaxi::options::ClientConfig,
2886 ) -> crate::ClientBuilderResult<Self> {
2887 let inner = Self::build_inner(config).await?;
2888 Ok(Self { inner })
2889 }
2890
2891 async fn build_inner(
2892 conf: gaxi::options::ClientConfig,
2893 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GlobalOperations>>
2894 {
2895 if gaxi::options::tracing_enabled(&conf) {
2896 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2897 }
2898 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2899 }
2900
2901 async fn build_transport(
2902 conf: gaxi::options::ClientConfig,
2903 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOperations> {
2904 super::transport::GlobalOperations::new(conf).await
2905 }
2906
2907 async fn build_with_tracing(
2908 conf: gaxi::options::ClientConfig,
2909 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOperations> {
2910 Self::build_transport(conf)
2911 .await
2912 .map(super::tracing::GlobalOperations::new)
2913 }
2914
2915 /// Retrieves an aggregated list of all operations.
2916 ///
2917 /// To prevent failure, Google recommends that you set the
2918 /// `returnPartialSuccess` parameter to `true`.
2919 pub fn aggregated_list(&self) -> super::builder::global_operations::AggregatedList {
2920 super::builder::global_operations::AggregatedList::new(self.inner.clone())
2921 }
2922
2923 /// Deletes the specified Operations resource.
2924 pub fn delete(&self) -> super::builder::global_operations::Delete {
2925 super::builder::global_operations::Delete::new(self.inner.clone())
2926 }
2927
2928 /// Retrieves the specified Operations resource.
2929 pub fn get(&self) -> super::builder::global_operations::Get {
2930 super::builder::global_operations::Get::new(self.inner.clone())
2931 }
2932
2933 /// Retrieves a list of Operation resources contained within the specified
2934 /// project.
2935 pub fn list(&self) -> super::builder::global_operations::List {
2936 super::builder::global_operations::List::new(self.inner.clone())
2937 }
2938
2939 /// Waits for the specified Operation resource to return as `DONE`
2940 /// or for the request to approach the 2 minute deadline, and retrieves the
2941 /// specified Operation resource. This method differs from the
2942 /// `GET` method in that it waits for no more than the default
2943 /// deadline (2 minutes) and then returns the current state of the operation,
2944 /// which might be `DONE` or still in progress.
2945 ///
2946 /// This method is called on a best-effort basis. Specifically:
2947 ///
2948 /// ```norust
2949 /// - In uncommon cases, when the server is overloaded, the request might
2950 /// return before the default deadline is reached, or might return after zero
2951 /// seconds.
2952 /// ```
2953 ///
2954 /// - If the default deadline is reached, there is no guarantee that the
2955 /// operation is actually done when the method returns. Be prepared to retry
2956 /// if the operation is not `DONE`.
2957 pub fn wait(&self) -> super::builder::global_operations::Wait {
2958 super::builder::global_operations::Wait::new(self.inner.clone())
2959 }
2960}
2961
2962/// Implements a client for the Google Compute Engine API.
2963///
2964/// # Example
2965/// ```
2966/// # use google_cloud_compute_v1::client::GlobalOrganizationOperations;
2967/// async fn sample(
2968/// ) -> anyhow::Result<()> {
2969/// let client = GlobalOrganizationOperations::builder().build().await?;
2970/// // use `client` to make requests to the Google Compute Engine API.
2971/// Ok(())
2972/// }
2973/// ```
2974///
2975/// # Service Description
2976///
2977/// Service for the `globalOrganizationOperations` resource.
2978///
2979/// # Configuration
2980///
2981/// To configure `GlobalOrganizationOperations` use the `with_*` methods in the type returned
2982/// by [builder()][GlobalOrganizationOperations::builder]. The default configuration should
2983/// work for most applications. Common configuration changes include
2984///
2985/// * [with_endpoint()]: by default this client uses the global default endpoint
2986/// (`https://compute.googleapis.com`). Applications using regional
2987/// endpoints or running in restricted networks (e.g. a network configured
2988/// with [Private Google Access with VPC Service Controls]) may want to
2989/// override this default.
2990/// * [with_credentials()]: by default this client uses
2991/// [Application Default Credentials]. Applications using custom
2992/// authentication may need to override this default.
2993///
2994/// [with_endpoint()]: super::builder::global_organization_operations::ClientBuilder::with_endpoint
2995/// [with_credentials()]: super::builder::global_organization_operations::ClientBuilder::with_credentials
2996/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2997/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2998///
2999/// # Pooling and Cloning
3000///
3001/// `GlobalOrganizationOperations` holds a connection pool internally, it is advised to
3002/// create one and reuse it. You do not need to wrap `GlobalOrganizationOperations` in
3003/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3004/// already uses an `Arc` internally.
3005#[cfg(feature = "global-organization-operations")]
3006#[cfg_attr(docsrs, doc(cfg(feature = "global-organization-operations")))]
3007#[derive(Clone, Debug)]
3008pub struct GlobalOrganizationOperations {
3009 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalOrganizationOperations>,
3010}
3011
3012#[cfg(feature = "global-organization-operations")]
3013impl GlobalOrganizationOperations {
3014 /// Returns a builder for [GlobalOrganizationOperations].
3015 ///
3016 /// ```
3017 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3018 /// # use google_cloud_compute_v1::client::GlobalOrganizationOperations;
3019 /// let client = GlobalOrganizationOperations::builder().build().await?;
3020 /// # Ok(()) }
3021 /// ```
3022 pub fn builder() -> super::builder::global_organization_operations::ClientBuilder {
3023 crate::new_client_builder(super::builder::global_organization_operations::client::Factory)
3024 }
3025
3026 /// Creates a new client from the provided stub.
3027 ///
3028 /// The most common case for calling this function is in tests mocking the
3029 /// client's behavior.
3030 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3031 where
3032 T: super::stub::GlobalOrganizationOperations + 'static,
3033 {
3034 Self { inner: stub.into() }
3035 }
3036
3037 pub(crate) async fn new(
3038 config: gaxi::options::ClientConfig,
3039 ) -> crate::ClientBuilderResult<Self> {
3040 let inner = Self::build_inner(config).await?;
3041 Ok(Self { inner })
3042 }
3043
3044 async fn build_inner(
3045 conf: gaxi::options::ClientConfig,
3046 ) -> crate::ClientBuilderResult<
3047 std::sync::Arc<dyn super::stub::dynamic::GlobalOrganizationOperations>,
3048 > {
3049 if gaxi::options::tracing_enabled(&conf) {
3050 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3051 }
3052 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3053 }
3054
3055 async fn build_transport(
3056 conf: gaxi::options::ClientConfig,
3057 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOrganizationOperations> {
3058 super::transport::GlobalOrganizationOperations::new(conf).await
3059 }
3060
3061 async fn build_with_tracing(
3062 conf: gaxi::options::ClientConfig,
3063 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOrganizationOperations> {
3064 Self::build_transport(conf)
3065 .await
3066 .map(super::tracing::GlobalOrganizationOperations::new)
3067 }
3068
3069 /// Deletes the specified Operations resource.
3070 pub fn delete(&self) -> super::builder::global_organization_operations::Delete {
3071 super::builder::global_organization_operations::Delete::new(self.inner.clone())
3072 }
3073
3074 /// Retrieves the specified Operations resource. Gets a list of operations
3075 /// by making a `list()` request.
3076 pub fn get(&self) -> super::builder::global_organization_operations::Get {
3077 super::builder::global_organization_operations::Get::new(self.inner.clone())
3078 }
3079
3080 /// Retrieves a list of Operation resources contained within the specified
3081 /// organization.
3082 pub fn list(&self) -> super::builder::global_organization_operations::List {
3083 super::builder::global_organization_operations::List::new(self.inner.clone())
3084 }
3085}
3086
3087/// Implements a client for the Google Compute Engine API.
3088///
3089/// # Example
3090/// ```
3091/// # use google_cloud_compute_v1::client::GlobalPublicDelegatedPrefixes;
3092/// async fn sample(
3093/// ) -> anyhow::Result<()> {
3094/// let client = GlobalPublicDelegatedPrefixes::builder().build().await?;
3095/// // use `client` to make requests to the Google Compute Engine API.
3096/// Ok(())
3097/// }
3098/// ```
3099///
3100/// # Service Description
3101///
3102/// Service for the `globalPublicDelegatedPrefixes` resource.
3103///
3104/// # Configuration
3105///
3106/// To configure `GlobalPublicDelegatedPrefixes` use the `with_*` methods in the type returned
3107/// by [builder()][GlobalPublicDelegatedPrefixes::builder]. The default configuration should
3108/// work for most applications. Common configuration changes include
3109///
3110/// * [with_endpoint()]: by default this client uses the global default endpoint
3111/// (`https://compute.googleapis.com`). Applications using regional
3112/// endpoints or running in restricted networks (e.g. a network configured
3113/// with [Private Google Access with VPC Service Controls]) may want to
3114/// override this default.
3115/// * [with_credentials()]: by default this client uses
3116/// [Application Default Credentials]. Applications using custom
3117/// authentication may need to override this default.
3118///
3119/// [with_endpoint()]: super::builder::global_public_delegated_prefixes::ClientBuilder::with_endpoint
3120/// [with_credentials()]: super::builder::global_public_delegated_prefixes::ClientBuilder::with_credentials
3121/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3122/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3123///
3124/// # Pooling and Cloning
3125///
3126/// `GlobalPublicDelegatedPrefixes` holds a connection pool internally, it is advised to
3127/// create one and reuse it. You do not need to wrap `GlobalPublicDelegatedPrefixes` in
3128/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3129/// already uses an `Arc` internally.
3130#[cfg(feature = "global-public-delegated-prefixes")]
3131#[cfg_attr(docsrs, doc(cfg(feature = "global-public-delegated-prefixes")))]
3132#[derive(Clone, Debug)]
3133pub struct GlobalPublicDelegatedPrefixes {
3134 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalPublicDelegatedPrefixes>,
3135}
3136
3137#[cfg(feature = "global-public-delegated-prefixes")]
3138impl GlobalPublicDelegatedPrefixes {
3139 /// Returns a builder for [GlobalPublicDelegatedPrefixes].
3140 ///
3141 /// ```
3142 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3143 /// # use google_cloud_compute_v1::client::GlobalPublicDelegatedPrefixes;
3144 /// let client = GlobalPublicDelegatedPrefixes::builder().build().await?;
3145 /// # Ok(()) }
3146 /// ```
3147 pub fn builder() -> super::builder::global_public_delegated_prefixes::ClientBuilder {
3148 crate::new_client_builder(super::builder::global_public_delegated_prefixes::client::Factory)
3149 }
3150
3151 /// Creates a new client from the provided stub.
3152 ///
3153 /// The most common case for calling this function is in tests mocking the
3154 /// client's behavior.
3155 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3156 where
3157 T: super::stub::GlobalPublicDelegatedPrefixes + 'static,
3158 {
3159 Self { inner: stub.into() }
3160 }
3161
3162 pub(crate) async fn new(
3163 config: gaxi::options::ClientConfig,
3164 ) -> crate::ClientBuilderResult<Self> {
3165 let inner = Self::build_inner(config).await?;
3166 Ok(Self { inner })
3167 }
3168
3169 async fn build_inner(
3170 conf: gaxi::options::ClientConfig,
3171 ) -> crate::ClientBuilderResult<
3172 std::sync::Arc<dyn super::stub::dynamic::GlobalPublicDelegatedPrefixes>,
3173 > {
3174 if gaxi::options::tracing_enabled(&conf) {
3175 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3176 }
3177 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3178 }
3179
3180 async fn build_transport(
3181 conf: gaxi::options::ClientConfig,
3182 ) -> crate::ClientBuilderResult<impl super::stub::GlobalPublicDelegatedPrefixes> {
3183 super::transport::GlobalPublicDelegatedPrefixes::new(conf).await
3184 }
3185
3186 async fn build_with_tracing(
3187 conf: gaxi::options::ClientConfig,
3188 ) -> crate::ClientBuilderResult<impl super::stub::GlobalPublicDelegatedPrefixes> {
3189 Self::build_transport(conf)
3190 .await
3191 .map(super::tracing::GlobalPublicDelegatedPrefixes::new)
3192 }
3193
3194 /// Deletes the specified global PublicDelegatedPrefix.
3195 pub fn delete(&self) -> super::builder::global_public_delegated_prefixes::Delete {
3196 super::builder::global_public_delegated_prefixes::Delete::new(self.inner.clone())
3197 }
3198
3199 /// Returns the specified global PublicDelegatedPrefix resource.
3200 pub fn get(&self) -> super::builder::global_public_delegated_prefixes::Get {
3201 super::builder::global_public_delegated_prefixes::Get::new(self.inner.clone())
3202 }
3203
3204 /// Creates a global PublicDelegatedPrefix in the specified project using the
3205 /// parameters that are included in the request.
3206 pub fn insert(&self) -> super::builder::global_public_delegated_prefixes::Insert {
3207 super::builder::global_public_delegated_prefixes::Insert::new(self.inner.clone())
3208 }
3209
3210 /// Lists the global PublicDelegatedPrefixes for a project.
3211 pub fn list(&self) -> super::builder::global_public_delegated_prefixes::List {
3212 super::builder::global_public_delegated_prefixes::List::new(self.inner.clone())
3213 }
3214
3215 /// Patches the specified global PublicDelegatedPrefix resource with the data
3216 /// included in the request. This method supportsPATCH
3217 /// semantics and usesJSON merge
3218 /// patch format and processing rules.
3219 pub fn patch(&self) -> super::builder::global_public_delegated_prefixes::Patch {
3220 super::builder::global_public_delegated_prefixes::Patch::new(self.inner.clone())
3221 }
3222
3223 /// Retrieves the specified Operations resource.
3224 pub fn get_operation(&self) -> super::builder::global_public_delegated_prefixes::GetOperation {
3225 super::builder::global_public_delegated_prefixes::GetOperation::new(self.inner.clone())
3226 }
3227}
3228
3229/// Implements a client for the Google Compute Engine API.
3230///
3231/// # Example
3232/// ```
3233/// # use google_cloud_compute_v1::client::GlobalVmExtensionPolicies;
3234/// async fn sample(
3235/// ) -> anyhow::Result<()> {
3236/// let client = GlobalVmExtensionPolicies::builder().build().await?;
3237/// // use `client` to make requests to the Google Compute Engine API.
3238/// Ok(())
3239/// }
3240/// ```
3241///
3242/// # Service Description
3243///
3244/// Service for the `globalVmExtensionPolicies` resource.
3245///
3246/// # Configuration
3247///
3248/// To configure `GlobalVmExtensionPolicies` use the `with_*` methods in the type returned
3249/// by [builder()][GlobalVmExtensionPolicies::builder]. The default configuration should
3250/// work for most applications. Common configuration changes include
3251///
3252/// * [with_endpoint()]: by default this client uses the global default endpoint
3253/// (`https://compute.googleapis.com`). Applications using regional
3254/// endpoints or running in restricted networks (e.g. a network configured
3255/// with [Private Google Access with VPC Service Controls]) may want to
3256/// override this default.
3257/// * [with_credentials()]: by default this client uses
3258/// [Application Default Credentials]. Applications using custom
3259/// authentication may need to override this default.
3260///
3261/// [with_endpoint()]: super::builder::global_vm_extension_policies::ClientBuilder::with_endpoint
3262/// [with_credentials()]: super::builder::global_vm_extension_policies::ClientBuilder::with_credentials
3263/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3264/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3265///
3266/// # Pooling and Cloning
3267///
3268/// `GlobalVmExtensionPolicies` holds a connection pool internally, it is advised to
3269/// create one and reuse it. You do not need to wrap `GlobalVmExtensionPolicies` in
3270/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3271/// already uses an `Arc` internally.
3272#[cfg(feature = "global-vm-extension-policies")]
3273#[cfg_attr(docsrs, doc(cfg(feature = "global-vm-extension-policies")))]
3274#[derive(Clone, Debug)]
3275pub struct GlobalVmExtensionPolicies {
3276 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalVmExtensionPolicies>,
3277}
3278
3279#[cfg(feature = "global-vm-extension-policies")]
3280impl GlobalVmExtensionPolicies {
3281 /// Returns a builder for [GlobalVmExtensionPolicies].
3282 ///
3283 /// ```
3284 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3285 /// # use google_cloud_compute_v1::client::GlobalVmExtensionPolicies;
3286 /// let client = GlobalVmExtensionPolicies::builder().build().await?;
3287 /// # Ok(()) }
3288 /// ```
3289 pub fn builder() -> super::builder::global_vm_extension_policies::ClientBuilder {
3290 crate::new_client_builder(super::builder::global_vm_extension_policies::client::Factory)
3291 }
3292
3293 /// Creates a new client from the provided stub.
3294 ///
3295 /// The most common case for calling this function is in tests mocking the
3296 /// client's behavior.
3297 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3298 where
3299 T: super::stub::GlobalVmExtensionPolicies + 'static,
3300 {
3301 Self { inner: stub.into() }
3302 }
3303
3304 pub(crate) async fn new(
3305 config: gaxi::options::ClientConfig,
3306 ) -> crate::ClientBuilderResult<Self> {
3307 let inner = Self::build_inner(config).await?;
3308 Ok(Self { inner })
3309 }
3310
3311 async fn build_inner(
3312 conf: gaxi::options::ClientConfig,
3313 ) -> crate::ClientBuilderResult<
3314 std::sync::Arc<dyn super::stub::dynamic::GlobalVmExtensionPolicies>,
3315 > {
3316 if gaxi::options::tracing_enabled(&conf) {
3317 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3318 }
3319 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3320 }
3321
3322 async fn build_transport(
3323 conf: gaxi::options::ClientConfig,
3324 ) -> crate::ClientBuilderResult<impl super::stub::GlobalVmExtensionPolicies> {
3325 super::transport::GlobalVmExtensionPolicies::new(conf).await
3326 }
3327
3328 async fn build_with_tracing(
3329 conf: gaxi::options::ClientConfig,
3330 ) -> crate::ClientBuilderResult<impl super::stub::GlobalVmExtensionPolicies> {
3331 Self::build_transport(conf)
3332 .await
3333 .map(super::tracing::GlobalVmExtensionPolicies::new)
3334 }
3335
3336 /// Retrieves the list of all VM Extension Policy resources
3337 /// available to the specified project.
3338 ///
3339 /// To prevent failure, it's recommended that you set the
3340 /// `returnPartialSuccess` parameter to `true`.
3341 pub fn aggregated_list(&self) -> super::builder::global_vm_extension_policies::AggregatedList {
3342 super::builder::global_vm_extension_policies::AggregatedList::new(self.inner.clone())
3343 }
3344
3345 /// Purge scoped resources (zonal policies) from a global VM extension
3346 /// policy, and then delete the global VM extension policy. Purge of the scoped
3347 /// resources is a pre-condition of the global VM extension policy deletion.
3348 /// The deletion of the global VM extension policy happens after the purge
3349 /// rollout is done, so it's not a part of the LRO. It's an automatic process
3350 /// that triggers in the backend.
3351 pub fn delete(&self) -> super::builder::global_vm_extension_policies::Delete {
3352 super::builder::global_vm_extension_policies::Delete::new(self.inner.clone())
3353 }
3354
3355 /// Gets details of a global VM extension policy.
3356 pub fn get(&self) -> super::builder::global_vm_extension_policies::Get {
3357 super::builder::global_vm_extension_policies::Get::new(self.inner.clone())
3358 }
3359
3360 /// Creates a new project level GlobalVmExtensionPolicy.
3361 pub fn insert(&self) -> super::builder::global_vm_extension_policies::Insert {
3362 super::builder::global_vm_extension_policies::Insert::new(self.inner.clone())
3363 }
3364
3365 /// Lists global VM extension policies.
3366 pub fn list(&self) -> super::builder::global_vm_extension_policies::List {
3367 super::builder::global_vm_extension_policies::List::new(self.inner.clone())
3368 }
3369
3370 /// Updates a global VM extension policy.
3371 pub fn update(&self) -> super::builder::global_vm_extension_policies::Update {
3372 super::builder::global_vm_extension_policies::Update::new(self.inner.clone())
3373 }
3374
3375 /// Retrieves the specified Operations resource.
3376 pub fn get_operation(&self) -> super::builder::global_vm_extension_policies::GetOperation {
3377 super::builder::global_vm_extension_policies::GetOperation::new(self.inner.clone())
3378 }
3379}
3380
3381/// Implements a client for the Google Compute Engine API.
3382///
3383/// # Example
3384/// ```
3385/// # use google_cloud_compute_v1::client::HealthChecks;
3386/// async fn sample(
3387/// ) -> anyhow::Result<()> {
3388/// let client = HealthChecks::builder().build().await?;
3389/// // use `client` to make requests to the Google Compute Engine API.
3390/// Ok(())
3391/// }
3392/// ```
3393///
3394/// # Service Description
3395///
3396/// Service for the `healthChecks` resource.
3397///
3398/// # Configuration
3399///
3400/// To configure `HealthChecks` use the `with_*` methods in the type returned
3401/// by [builder()][HealthChecks::builder]. The default configuration should
3402/// work for most applications. Common configuration changes include
3403///
3404/// * [with_endpoint()]: by default this client uses the global default endpoint
3405/// (`https://compute.googleapis.com`). Applications using regional
3406/// endpoints or running in restricted networks (e.g. a network configured
3407/// with [Private Google Access with VPC Service Controls]) may want to
3408/// override this default.
3409/// * [with_credentials()]: by default this client uses
3410/// [Application Default Credentials]. Applications using custom
3411/// authentication may need to override this default.
3412///
3413/// [with_endpoint()]: super::builder::health_checks::ClientBuilder::with_endpoint
3414/// [with_credentials()]: super::builder::health_checks::ClientBuilder::with_credentials
3415/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3416/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3417///
3418/// # Pooling and Cloning
3419///
3420/// `HealthChecks` holds a connection pool internally, it is advised to
3421/// create one and reuse it. You do not need to wrap `HealthChecks` in
3422/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3423/// already uses an `Arc` internally.
3424#[cfg(feature = "health-checks")]
3425#[cfg_attr(docsrs, doc(cfg(feature = "health-checks")))]
3426#[derive(Clone, Debug)]
3427pub struct HealthChecks {
3428 inner: std::sync::Arc<dyn super::stub::dynamic::HealthChecks>,
3429}
3430
3431#[cfg(feature = "health-checks")]
3432impl HealthChecks {
3433 /// Returns a builder for [HealthChecks].
3434 ///
3435 /// ```
3436 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3437 /// # use google_cloud_compute_v1::client::HealthChecks;
3438 /// let client = HealthChecks::builder().build().await?;
3439 /// # Ok(()) }
3440 /// ```
3441 pub fn builder() -> super::builder::health_checks::ClientBuilder {
3442 crate::new_client_builder(super::builder::health_checks::client::Factory)
3443 }
3444
3445 /// Creates a new client from the provided stub.
3446 ///
3447 /// The most common case for calling this function is in tests mocking the
3448 /// client's behavior.
3449 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3450 where
3451 T: super::stub::HealthChecks + 'static,
3452 {
3453 Self { inner: stub.into() }
3454 }
3455
3456 pub(crate) async fn new(
3457 config: gaxi::options::ClientConfig,
3458 ) -> crate::ClientBuilderResult<Self> {
3459 let inner = Self::build_inner(config).await?;
3460 Ok(Self { inner })
3461 }
3462
3463 async fn build_inner(
3464 conf: gaxi::options::ClientConfig,
3465 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HealthChecks>> {
3466 if gaxi::options::tracing_enabled(&conf) {
3467 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3468 }
3469 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3470 }
3471
3472 async fn build_transport(
3473 conf: gaxi::options::ClientConfig,
3474 ) -> crate::ClientBuilderResult<impl super::stub::HealthChecks> {
3475 super::transport::HealthChecks::new(conf).await
3476 }
3477
3478 async fn build_with_tracing(
3479 conf: gaxi::options::ClientConfig,
3480 ) -> crate::ClientBuilderResult<impl super::stub::HealthChecks> {
3481 Self::build_transport(conf)
3482 .await
3483 .map(super::tracing::HealthChecks::new)
3484 }
3485
3486 /// Retrieves the list of all HealthCheck resources, regional and global,
3487 /// available to the specified project.
3488 ///
3489 /// To prevent failure, Google recommends that you set the
3490 /// `returnPartialSuccess` parameter to `true`.
3491 pub fn aggregated_list(&self) -> super::builder::health_checks::AggregatedList {
3492 super::builder::health_checks::AggregatedList::new(self.inner.clone())
3493 }
3494
3495 /// Deletes the specified HealthCheck resource.
3496 pub fn delete(&self) -> super::builder::health_checks::Delete {
3497 super::builder::health_checks::Delete::new(self.inner.clone())
3498 }
3499
3500 /// Returns the specified HealthCheck resource.
3501 pub fn get(&self) -> super::builder::health_checks::Get {
3502 super::builder::health_checks::Get::new(self.inner.clone())
3503 }
3504
3505 /// Creates a HealthCheck resource in the specified project using the data
3506 /// included in the request.
3507 pub fn insert(&self) -> super::builder::health_checks::Insert {
3508 super::builder::health_checks::Insert::new(self.inner.clone())
3509 }
3510
3511 /// Retrieves the list of HealthCheck resources available to the specified
3512 /// project.
3513 pub fn list(&self) -> super::builder::health_checks::List {
3514 super::builder::health_checks::List::new(self.inner.clone())
3515 }
3516
3517 /// Updates a HealthCheck resource in the specified project using the data
3518 /// included in the request. This method supportsPATCH
3519 /// semantics and uses theJSON merge
3520 /// patch format and processing rules.
3521 pub fn patch(&self) -> super::builder::health_checks::Patch {
3522 super::builder::health_checks::Patch::new(self.inner.clone())
3523 }
3524
3525 /// Returns permissions that a caller has on the specified resource.
3526 pub fn test_iam_permissions(&self) -> super::builder::health_checks::TestIamPermissions {
3527 super::builder::health_checks::TestIamPermissions::new(self.inner.clone())
3528 }
3529
3530 /// Updates a HealthCheck resource in the specified project using the data
3531 /// included in the request.
3532 pub fn update(&self) -> super::builder::health_checks::Update {
3533 super::builder::health_checks::Update::new(self.inner.clone())
3534 }
3535
3536 /// Retrieves the specified Operations resource.
3537 pub fn get_operation(&self) -> super::builder::health_checks::GetOperation {
3538 super::builder::health_checks::GetOperation::new(self.inner.clone())
3539 }
3540}
3541
3542/// Implements a client for the Google Compute Engine API.
3543///
3544/// # Example
3545/// ```
3546/// # use google_cloud_compute_v1::client::HttpHealthChecks;
3547/// async fn sample(
3548/// ) -> anyhow::Result<()> {
3549/// let client = HttpHealthChecks::builder().build().await?;
3550/// // use `client` to make requests to the Google Compute Engine API.
3551/// Ok(())
3552/// }
3553/// ```
3554///
3555/// # Service Description
3556///
3557/// Service for the `httpHealthChecks` resource.
3558///
3559/// # Configuration
3560///
3561/// To configure `HttpHealthChecks` use the `with_*` methods in the type returned
3562/// by [builder()][HttpHealthChecks::builder]. The default configuration should
3563/// work for most applications. Common configuration changes include
3564///
3565/// * [with_endpoint()]: by default this client uses the global default endpoint
3566/// (`https://compute.googleapis.com`). Applications using regional
3567/// endpoints or running in restricted networks (e.g. a network configured
3568/// with [Private Google Access with VPC Service Controls]) may want to
3569/// override this default.
3570/// * [with_credentials()]: by default this client uses
3571/// [Application Default Credentials]. Applications using custom
3572/// authentication may need to override this default.
3573///
3574/// [with_endpoint()]: super::builder::http_health_checks::ClientBuilder::with_endpoint
3575/// [with_credentials()]: super::builder::http_health_checks::ClientBuilder::with_credentials
3576/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3577/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3578///
3579/// # Pooling and Cloning
3580///
3581/// `HttpHealthChecks` holds a connection pool internally, it is advised to
3582/// create one and reuse it. You do not need to wrap `HttpHealthChecks` in
3583/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3584/// already uses an `Arc` internally.
3585#[cfg(feature = "http-health-checks")]
3586#[cfg_attr(docsrs, doc(cfg(feature = "http-health-checks")))]
3587#[derive(Clone, Debug)]
3588pub struct HttpHealthChecks {
3589 inner: std::sync::Arc<dyn super::stub::dynamic::HttpHealthChecks>,
3590}
3591
3592#[cfg(feature = "http-health-checks")]
3593impl HttpHealthChecks {
3594 /// Returns a builder for [HttpHealthChecks].
3595 ///
3596 /// ```
3597 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3598 /// # use google_cloud_compute_v1::client::HttpHealthChecks;
3599 /// let client = HttpHealthChecks::builder().build().await?;
3600 /// # Ok(()) }
3601 /// ```
3602 pub fn builder() -> super::builder::http_health_checks::ClientBuilder {
3603 crate::new_client_builder(super::builder::http_health_checks::client::Factory)
3604 }
3605
3606 /// Creates a new client from the provided stub.
3607 ///
3608 /// The most common case for calling this function is in tests mocking the
3609 /// client's behavior.
3610 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3611 where
3612 T: super::stub::HttpHealthChecks + 'static,
3613 {
3614 Self { inner: stub.into() }
3615 }
3616
3617 pub(crate) async fn new(
3618 config: gaxi::options::ClientConfig,
3619 ) -> crate::ClientBuilderResult<Self> {
3620 let inner = Self::build_inner(config).await?;
3621 Ok(Self { inner })
3622 }
3623
3624 async fn build_inner(
3625 conf: gaxi::options::ClientConfig,
3626 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HttpHealthChecks>>
3627 {
3628 if gaxi::options::tracing_enabled(&conf) {
3629 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3630 }
3631 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3632 }
3633
3634 async fn build_transport(
3635 conf: gaxi::options::ClientConfig,
3636 ) -> crate::ClientBuilderResult<impl super::stub::HttpHealthChecks> {
3637 super::transport::HttpHealthChecks::new(conf).await
3638 }
3639
3640 async fn build_with_tracing(
3641 conf: gaxi::options::ClientConfig,
3642 ) -> crate::ClientBuilderResult<impl super::stub::HttpHealthChecks> {
3643 Self::build_transport(conf)
3644 .await
3645 .map(super::tracing::HttpHealthChecks::new)
3646 }
3647
3648 /// Deletes the specified HttpHealthCheck resource.
3649 pub fn delete(&self) -> super::builder::http_health_checks::Delete {
3650 super::builder::http_health_checks::Delete::new(self.inner.clone())
3651 }
3652
3653 /// Returns the specified HttpHealthCheck resource.
3654 pub fn get(&self) -> super::builder::http_health_checks::Get {
3655 super::builder::http_health_checks::Get::new(self.inner.clone())
3656 }
3657
3658 /// Creates a HttpHealthCheck resource in the specified project using the data
3659 /// included in the request.
3660 pub fn insert(&self) -> super::builder::http_health_checks::Insert {
3661 super::builder::http_health_checks::Insert::new(self.inner.clone())
3662 }
3663
3664 /// Retrieves the list of HttpHealthCheck resources available to the specified
3665 /// project.
3666 pub fn list(&self) -> super::builder::http_health_checks::List {
3667 super::builder::http_health_checks::List::new(self.inner.clone())
3668 }
3669
3670 /// Updates a HttpHealthCheck resource in the specified project using the data
3671 /// included in the request. This method supportsPATCH
3672 /// semantics and uses theJSON merge
3673 /// patch format and processing rules.
3674 pub fn patch(&self) -> super::builder::http_health_checks::Patch {
3675 super::builder::http_health_checks::Patch::new(self.inner.clone())
3676 }
3677
3678 /// Returns permissions that a caller has on the specified resource.
3679 pub fn test_iam_permissions(&self) -> super::builder::http_health_checks::TestIamPermissions {
3680 super::builder::http_health_checks::TestIamPermissions::new(self.inner.clone())
3681 }
3682
3683 /// Updates a HttpHealthCheck resource in the specified project using the data
3684 /// included in the request.
3685 pub fn update(&self) -> super::builder::http_health_checks::Update {
3686 super::builder::http_health_checks::Update::new(self.inner.clone())
3687 }
3688
3689 /// Retrieves the specified Operations resource.
3690 pub fn get_operation(&self) -> super::builder::http_health_checks::GetOperation {
3691 super::builder::http_health_checks::GetOperation::new(self.inner.clone())
3692 }
3693}
3694
3695/// Implements a client for the Google Compute Engine API.
3696///
3697/// # Example
3698/// ```
3699/// # use google_cloud_compute_v1::client::HttpsHealthChecks;
3700/// async fn sample(
3701/// ) -> anyhow::Result<()> {
3702/// let client = HttpsHealthChecks::builder().build().await?;
3703/// // use `client` to make requests to the Google Compute Engine API.
3704/// Ok(())
3705/// }
3706/// ```
3707///
3708/// # Service Description
3709///
3710/// Service for the `httpsHealthChecks` resource.
3711///
3712/// # Configuration
3713///
3714/// To configure `HttpsHealthChecks` use the `with_*` methods in the type returned
3715/// by [builder()][HttpsHealthChecks::builder]. The default configuration should
3716/// work for most applications. Common configuration changes include
3717///
3718/// * [with_endpoint()]: by default this client uses the global default endpoint
3719/// (`https://compute.googleapis.com`). Applications using regional
3720/// endpoints or running in restricted networks (e.g. a network configured
3721/// with [Private Google Access with VPC Service Controls]) may want to
3722/// override this default.
3723/// * [with_credentials()]: by default this client uses
3724/// [Application Default Credentials]. Applications using custom
3725/// authentication may need to override this default.
3726///
3727/// [with_endpoint()]: super::builder::https_health_checks::ClientBuilder::with_endpoint
3728/// [with_credentials()]: super::builder::https_health_checks::ClientBuilder::with_credentials
3729/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3730/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3731///
3732/// # Pooling and Cloning
3733///
3734/// `HttpsHealthChecks` holds a connection pool internally, it is advised to
3735/// create one and reuse it. You do not need to wrap `HttpsHealthChecks` in
3736/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3737/// already uses an `Arc` internally.
3738#[cfg(feature = "https-health-checks")]
3739#[cfg_attr(docsrs, doc(cfg(feature = "https-health-checks")))]
3740#[derive(Clone, Debug)]
3741pub struct HttpsHealthChecks {
3742 inner: std::sync::Arc<dyn super::stub::dynamic::HttpsHealthChecks>,
3743}
3744
3745#[cfg(feature = "https-health-checks")]
3746impl HttpsHealthChecks {
3747 /// Returns a builder for [HttpsHealthChecks].
3748 ///
3749 /// ```
3750 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3751 /// # use google_cloud_compute_v1::client::HttpsHealthChecks;
3752 /// let client = HttpsHealthChecks::builder().build().await?;
3753 /// # Ok(()) }
3754 /// ```
3755 pub fn builder() -> super::builder::https_health_checks::ClientBuilder {
3756 crate::new_client_builder(super::builder::https_health_checks::client::Factory)
3757 }
3758
3759 /// Creates a new client from the provided stub.
3760 ///
3761 /// The most common case for calling this function is in tests mocking the
3762 /// client's behavior.
3763 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3764 where
3765 T: super::stub::HttpsHealthChecks + 'static,
3766 {
3767 Self { inner: stub.into() }
3768 }
3769
3770 pub(crate) async fn new(
3771 config: gaxi::options::ClientConfig,
3772 ) -> crate::ClientBuilderResult<Self> {
3773 let inner = Self::build_inner(config).await?;
3774 Ok(Self { inner })
3775 }
3776
3777 async fn build_inner(
3778 conf: gaxi::options::ClientConfig,
3779 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HttpsHealthChecks>>
3780 {
3781 if gaxi::options::tracing_enabled(&conf) {
3782 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3783 }
3784 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3785 }
3786
3787 async fn build_transport(
3788 conf: gaxi::options::ClientConfig,
3789 ) -> crate::ClientBuilderResult<impl super::stub::HttpsHealthChecks> {
3790 super::transport::HttpsHealthChecks::new(conf).await
3791 }
3792
3793 async fn build_with_tracing(
3794 conf: gaxi::options::ClientConfig,
3795 ) -> crate::ClientBuilderResult<impl super::stub::HttpsHealthChecks> {
3796 Self::build_transport(conf)
3797 .await
3798 .map(super::tracing::HttpsHealthChecks::new)
3799 }
3800
3801 /// Deletes the specified HttpsHealthCheck resource.
3802 pub fn delete(&self) -> super::builder::https_health_checks::Delete {
3803 super::builder::https_health_checks::Delete::new(self.inner.clone())
3804 }
3805
3806 /// Returns the specified HttpsHealthCheck resource.
3807 pub fn get(&self) -> super::builder::https_health_checks::Get {
3808 super::builder::https_health_checks::Get::new(self.inner.clone())
3809 }
3810
3811 /// Creates a HttpsHealthCheck resource in the specified project using the data
3812 /// included in the request.
3813 pub fn insert(&self) -> super::builder::https_health_checks::Insert {
3814 super::builder::https_health_checks::Insert::new(self.inner.clone())
3815 }
3816
3817 /// Retrieves the list of HttpsHealthCheck resources available to the specified
3818 /// project.
3819 pub fn list(&self) -> super::builder::https_health_checks::List {
3820 super::builder::https_health_checks::List::new(self.inner.clone())
3821 }
3822
3823 /// Updates a HttpsHealthCheck resource in the specified project using the data
3824 /// included in the request. This method supportsPATCH
3825 /// semantics and uses theJSON merge
3826 /// patch format and processing rules.
3827 pub fn patch(&self) -> super::builder::https_health_checks::Patch {
3828 super::builder::https_health_checks::Patch::new(self.inner.clone())
3829 }
3830
3831 /// Returns permissions that a caller has on the specified resource.
3832 pub fn test_iam_permissions(&self) -> super::builder::https_health_checks::TestIamPermissions {
3833 super::builder::https_health_checks::TestIamPermissions::new(self.inner.clone())
3834 }
3835
3836 /// Updates a HttpsHealthCheck resource in the specified project using the data
3837 /// included in the request.
3838 pub fn update(&self) -> super::builder::https_health_checks::Update {
3839 super::builder::https_health_checks::Update::new(self.inner.clone())
3840 }
3841
3842 /// Retrieves the specified Operations resource.
3843 pub fn get_operation(&self) -> super::builder::https_health_checks::GetOperation {
3844 super::builder::https_health_checks::GetOperation::new(self.inner.clone())
3845 }
3846}
3847
3848/// Implements a client for the Google Compute Engine API.
3849///
3850/// # Example
3851/// ```
3852/// # use google_cloud_compute_v1::client::ImageFamilyViews;
3853/// async fn sample(
3854/// ) -> anyhow::Result<()> {
3855/// let client = ImageFamilyViews::builder().build().await?;
3856/// // use `client` to make requests to the Google Compute Engine API.
3857/// Ok(())
3858/// }
3859/// ```
3860///
3861/// # Service Description
3862///
3863/// Service for the `imageFamilyViews` resource.
3864///
3865/// # Configuration
3866///
3867/// To configure `ImageFamilyViews` use the `with_*` methods in the type returned
3868/// by [builder()][ImageFamilyViews::builder]. The default configuration should
3869/// work for most applications. Common configuration changes include
3870///
3871/// * [with_endpoint()]: by default this client uses the global default endpoint
3872/// (`https://compute.googleapis.com`). Applications using regional
3873/// endpoints or running in restricted networks (e.g. a network configured
3874/// with [Private Google Access with VPC Service Controls]) may want to
3875/// override this default.
3876/// * [with_credentials()]: by default this client uses
3877/// [Application Default Credentials]. Applications using custom
3878/// authentication may need to override this default.
3879///
3880/// [with_endpoint()]: super::builder::image_family_views::ClientBuilder::with_endpoint
3881/// [with_credentials()]: super::builder::image_family_views::ClientBuilder::with_credentials
3882/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3883/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3884///
3885/// # Pooling and Cloning
3886///
3887/// `ImageFamilyViews` holds a connection pool internally, it is advised to
3888/// create one and reuse it. You do not need to wrap `ImageFamilyViews` in
3889/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3890/// already uses an `Arc` internally.
3891#[cfg(feature = "image-family-views")]
3892#[cfg_attr(docsrs, doc(cfg(feature = "image-family-views")))]
3893#[derive(Clone, Debug)]
3894pub struct ImageFamilyViews {
3895 inner: std::sync::Arc<dyn super::stub::dynamic::ImageFamilyViews>,
3896}
3897
3898#[cfg(feature = "image-family-views")]
3899impl ImageFamilyViews {
3900 /// Returns a builder for [ImageFamilyViews].
3901 ///
3902 /// ```
3903 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3904 /// # use google_cloud_compute_v1::client::ImageFamilyViews;
3905 /// let client = ImageFamilyViews::builder().build().await?;
3906 /// # Ok(()) }
3907 /// ```
3908 pub fn builder() -> super::builder::image_family_views::ClientBuilder {
3909 crate::new_client_builder(super::builder::image_family_views::client::Factory)
3910 }
3911
3912 /// Creates a new client from the provided stub.
3913 ///
3914 /// The most common case for calling this function is in tests mocking the
3915 /// client's behavior.
3916 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3917 where
3918 T: super::stub::ImageFamilyViews + 'static,
3919 {
3920 Self { inner: stub.into() }
3921 }
3922
3923 pub(crate) async fn new(
3924 config: gaxi::options::ClientConfig,
3925 ) -> crate::ClientBuilderResult<Self> {
3926 let inner = Self::build_inner(config).await?;
3927 Ok(Self { inner })
3928 }
3929
3930 async fn build_inner(
3931 conf: gaxi::options::ClientConfig,
3932 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ImageFamilyViews>>
3933 {
3934 if gaxi::options::tracing_enabled(&conf) {
3935 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3936 }
3937 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3938 }
3939
3940 async fn build_transport(
3941 conf: gaxi::options::ClientConfig,
3942 ) -> crate::ClientBuilderResult<impl super::stub::ImageFamilyViews> {
3943 super::transport::ImageFamilyViews::new(conf).await
3944 }
3945
3946 async fn build_with_tracing(
3947 conf: gaxi::options::ClientConfig,
3948 ) -> crate::ClientBuilderResult<impl super::stub::ImageFamilyViews> {
3949 Self::build_transport(conf)
3950 .await
3951 .map(super::tracing::ImageFamilyViews::new)
3952 }
3953
3954 /// Returns the latest image that is part of an image family, is not
3955 /// deprecated and is rolled out in the specified zone.
3956 pub fn get(&self) -> super::builder::image_family_views::Get {
3957 super::builder::image_family_views::Get::new(self.inner.clone())
3958 }
3959}
3960
3961/// Implements a client for the Google Compute Engine API.
3962///
3963/// # Example
3964/// ```
3965/// # use google_cloud_compute_v1::client::Images;
3966/// async fn sample(
3967/// ) -> anyhow::Result<()> {
3968/// let client = Images::builder().build().await?;
3969/// // use `client` to make requests to the Google Compute Engine API.
3970/// Ok(())
3971/// }
3972/// ```
3973///
3974/// # Service Description
3975///
3976/// Service for the `images` resource.
3977///
3978/// # Configuration
3979///
3980/// To configure `Images` use the `with_*` methods in the type returned
3981/// by [builder()][Images::builder]. The default configuration should
3982/// work for most applications. Common configuration changes include
3983///
3984/// * [with_endpoint()]: by default this client uses the global default endpoint
3985/// (`https://compute.googleapis.com`). Applications using regional
3986/// endpoints or running in restricted networks (e.g. a network configured
3987/// with [Private Google Access with VPC Service Controls]) may want to
3988/// override this default.
3989/// * [with_credentials()]: by default this client uses
3990/// [Application Default Credentials]. Applications using custom
3991/// authentication may need to override this default.
3992///
3993/// [with_endpoint()]: super::builder::images::ClientBuilder::with_endpoint
3994/// [with_credentials()]: super::builder::images::ClientBuilder::with_credentials
3995/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3996/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3997///
3998/// # Pooling and Cloning
3999///
4000/// `Images` holds a connection pool internally, it is advised to
4001/// create one and reuse it. You do not need to wrap `Images` in
4002/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4003/// already uses an `Arc` internally.
4004#[cfg(feature = "images")]
4005#[cfg_attr(docsrs, doc(cfg(feature = "images")))]
4006#[derive(Clone, Debug)]
4007pub struct Images {
4008 inner: std::sync::Arc<dyn super::stub::dynamic::Images>,
4009}
4010
4011#[cfg(feature = "images")]
4012impl Images {
4013 /// Returns a builder for [Images].
4014 ///
4015 /// ```
4016 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4017 /// # use google_cloud_compute_v1::client::Images;
4018 /// let client = Images::builder().build().await?;
4019 /// # Ok(()) }
4020 /// ```
4021 pub fn builder() -> super::builder::images::ClientBuilder {
4022 crate::new_client_builder(super::builder::images::client::Factory)
4023 }
4024
4025 /// Creates a new client from the provided stub.
4026 ///
4027 /// The most common case for calling this function is in tests mocking the
4028 /// client's behavior.
4029 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4030 where
4031 T: super::stub::Images + 'static,
4032 {
4033 Self { inner: stub.into() }
4034 }
4035
4036 pub(crate) async fn new(
4037 config: gaxi::options::ClientConfig,
4038 ) -> crate::ClientBuilderResult<Self> {
4039 let inner = Self::build_inner(config).await?;
4040 Ok(Self { inner })
4041 }
4042
4043 async fn build_inner(
4044 conf: gaxi::options::ClientConfig,
4045 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Images>> {
4046 if gaxi::options::tracing_enabled(&conf) {
4047 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4048 }
4049 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4050 }
4051
4052 async fn build_transport(
4053 conf: gaxi::options::ClientConfig,
4054 ) -> crate::ClientBuilderResult<impl super::stub::Images> {
4055 super::transport::Images::new(conf).await
4056 }
4057
4058 async fn build_with_tracing(
4059 conf: gaxi::options::ClientConfig,
4060 ) -> crate::ClientBuilderResult<impl super::stub::Images> {
4061 Self::build_transport(conf)
4062 .await
4063 .map(super::tracing::Images::new)
4064 }
4065
4066 /// Deletes the specified image.
4067 pub fn delete(&self) -> super::builder::images::Delete {
4068 super::builder::images::Delete::new(self.inner.clone())
4069 }
4070
4071 /// Sets the deprecation status of an image.
4072 ///
4073 /// If an empty request body is given, clears the deprecation status instead.
4074 pub fn deprecate(&self) -> super::builder::images::Deprecate {
4075 super::builder::images::Deprecate::new(self.inner.clone())
4076 }
4077
4078 /// Returns the specified image.
4079 pub fn get(&self) -> super::builder::images::Get {
4080 super::builder::images::Get::new(self.inner.clone())
4081 }
4082
4083 /// Returns the latest image that is part of an image family and is not
4084 /// deprecated. For more information on image families, seePublic
4085 /// image families documentation.
4086 pub fn get_from_family(&self) -> super::builder::images::GetFromFamily {
4087 super::builder::images::GetFromFamily::new(self.inner.clone())
4088 }
4089
4090 /// Gets the access control policy for a resource. May be empty if no such
4091 /// policy or resource exists.
4092 pub fn get_iam_policy(&self) -> super::builder::images::GetIamPolicy {
4093 super::builder::images::GetIamPolicy::new(self.inner.clone())
4094 }
4095
4096 /// Creates an image in the specified project using the data included
4097 /// in the request.
4098 pub fn insert(&self) -> super::builder::images::Insert {
4099 super::builder::images::Insert::new(self.inner.clone())
4100 }
4101
4102 /// Retrieves the list of custom images
4103 /// available to the specified project. Custom images are images you
4104 /// create that belong to your project. This method does not
4105 /// get any images that belong to other projects, including publicly-available
4106 /// images, like Debian 8. If you want to get a list of publicly-available
4107 /// images, use this method to make a request to the respective image project,
4108 /// such as debian-cloud or windows-cloud.
4109 pub fn list(&self) -> super::builder::images::List {
4110 super::builder::images::List::new(self.inner.clone())
4111 }
4112
4113 /// Patches the specified image with the data included in the request.
4114 /// Only the following fields can be modified: family, description,
4115 /// deprecation status.
4116 pub fn patch(&self) -> super::builder::images::Patch {
4117 super::builder::images::Patch::new(self.inner.clone())
4118 }
4119
4120 /// Sets the access control policy on the specified resource.
4121 /// Replaces any existing policy.
4122 pub fn set_iam_policy(&self) -> super::builder::images::SetIamPolicy {
4123 super::builder::images::SetIamPolicy::new(self.inner.clone())
4124 }
4125
4126 /// Sets the labels on an image. To learn more about labels, read theLabeling
4127 /// Resources documentation.
4128 pub fn set_labels(&self) -> super::builder::images::SetLabels {
4129 super::builder::images::SetLabels::new(self.inner.clone())
4130 }
4131
4132 /// Returns permissions that a caller has on the specified resource.
4133 pub fn test_iam_permissions(&self) -> super::builder::images::TestIamPermissions {
4134 super::builder::images::TestIamPermissions::new(self.inner.clone())
4135 }
4136
4137 /// Retrieves the specified Operations resource.
4138 pub fn get_operation(&self) -> super::builder::images::GetOperation {
4139 super::builder::images::GetOperation::new(self.inner.clone())
4140 }
4141}
4142
4143/// Implements a client for the Google Compute Engine API.
4144///
4145/// # Example
4146/// ```
4147/// # use google_cloud_compute_v1::client::InstanceGroupManagerResizeRequests;
4148/// async fn sample(
4149/// ) -> anyhow::Result<()> {
4150/// let client = InstanceGroupManagerResizeRequests::builder().build().await?;
4151/// // use `client` to make requests to the Google Compute Engine API.
4152/// Ok(())
4153/// }
4154/// ```
4155///
4156/// # Service Description
4157///
4158/// Service for the `instanceGroupManagerResizeRequests` resource.
4159///
4160/// # Configuration
4161///
4162/// To configure `InstanceGroupManagerResizeRequests` use the `with_*` methods in the type returned
4163/// by [builder()][InstanceGroupManagerResizeRequests::builder]. The default configuration should
4164/// work for most applications. Common configuration changes include
4165///
4166/// * [with_endpoint()]: by default this client uses the global default endpoint
4167/// (`https://compute.googleapis.com`). Applications using regional
4168/// endpoints or running in restricted networks (e.g. a network configured
4169/// with [Private Google Access with VPC Service Controls]) may want to
4170/// override this default.
4171/// * [with_credentials()]: by default this client uses
4172/// [Application Default Credentials]. Applications using custom
4173/// authentication may need to override this default.
4174///
4175/// [with_endpoint()]: super::builder::instance_group_manager_resize_requests::ClientBuilder::with_endpoint
4176/// [with_credentials()]: super::builder::instance_group_manager_resize_requests::ClientBuilder::with_credentials
4177/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4178/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4179///
4180/// # Pooling and Cloning
4181///
4182/// `InstanceGroupManagerResizeRequests` holds a connection pool internally, it is advised to
4183/// create one and reuse it. You do not need to wrap `InstanceGroupManagerResizeRequests` in
4184/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4185/// already uses an `Arc` internally.
4186#[cfg(feature = "instance-group-manager-resize-requests")]
4187#[cfg_attr(docsrs, doc(cfg(feature = "instance-group-manager-resize-requests")))]
4188#[derive(Clone, Debug)]
4189pub struct InstanceGroupManagerResizeRequests {
4190 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagerResizeRequests>,
4191}
4192
4193#[cfg(feature = "instance-group-manager-resize-requests")]
4194impl InstanceGroupManagerResizeRequests {
4195 /// Returns a builder for [InstanceGroupManagerResizeRequests].
4196 ///
4197 /// ```
4198 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4199 /// # use google_cloud_compute_v1::client::InstanceGroupManagerResizeRequests;
4200 /// let client = InstanceGroupManagerResizeRequests::builder().build().await?;
4201 /// # Ok(()) }
4202 /// ```
4203 pub fn builder() -> super::builder::instance_group_manager_resize_requests::ClientBuilder {
4204 crate::new_client_builder(
4205 super::builder::instance_group_manager_resize_requests::client::Factory,
4206 )
4207 }
4208
4209 /// Creates a new client from the provided stub.
4210 ///
4211 /// The most common case for calling this function is in tests mocking the
4212 /// client's behavior.
4213 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4214 where
4215 T: super::stub::InstanceGroupManagerResizeRequests + 'static,
4216 {
4217 Self { inner: stub.into() }
4218 }
4219
4220 pub(crate) async fn new(
4221 config: gaxi::options::ClientConfig,
4222 ) -> crate::ClientBuilderResult<Self> {
4223 let inner = Self::build_inner(config).await?;
4224 Ok(Self { inner })
4225 }
4226
4227 async fn build_inner(
4228 conf: gaxi::options::ClientConfig,
4229 ) -> crate::ClientBuilderResult<
4230 std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagerResizeRequests>,
4231 > {
4232 if gaxi::options::tracing_enabled(&conf) {
4233 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4234 }
4235 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4236 }
4237
4238 async fn build_transport(
4239 conf: gaxi::options::ClientConfig,
4240 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagerResizeRequests> {
4241 super::transport::InstanceGroupManagerResizeRequests::new(conf).await
4242 }
4243
4244 async fn build_with_tracing(
4245 conf: gaxi::options::ClientConfig,
4246 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagerResizeRequests> {
4247 Self::build_transport(conf)
4248 .await
4249 .map(super::tracing::InstanceGroupManagerResizeRequests::new)
4250 }
4251
4252 /// Cancels the specified resize request and removes it from the queue.
4253 /// Cancelled resize request does no longer wait for the resources to be
4254 /// provisioned. Cancel is only possible for requests that are accepted in the
4255 /// queue.
4256 pub fn cancel(&self) -> super::builder::instance_group_manager_resize_requests::Cancel {
4257 super::builder::instance_group_manager_resize_requests::Cancel::new(self.inner.clone())
4258 }
4259
4260 /// Deletes the specified, inactive resize request. Requests that are still
4261 /// active cannot be deleted. Deleting request does not delete instances that
4262 /// were provisioned previously.
4263 pub fn delete(&self) -> super::builder::instance_group_manager_resize_requests::Delete {
4264 super::builder::instance_group_manager_resize_requests::Delete::new(self.inner.clone())
4265 }
4266
4267 /// Returns all of the details about the specified resize request.
4268 pub fn get(&self) -> super::builder::instance_group_manager_resize_requests::Get {
4269 super::builder::instance_group_manager_resize_requests::Get::new(self.inner.clone())
4270 }
4271
4272 /// Creates a new resize request that starts provisioning VMs immediately
4273 /// or queues VM creation.
4274 pub fn insert(&self) -> super::builder::instance_group_manager_resize_requests::Insert {
4275 super::builder::instance_group_manager_resize_requests::Insert::new(self.inner.clone())
4276 }
4277
4278 /// Retrieves a list of resize requests that are contained in the
4279 /// managed instance group.
4280 pub fn list(&self) -> super::builder::instance_group_manager_resize_requests::List {
4281 super::builder::instance_group_manager_resize_requests::List::new(self.inner.clone())
4282 }
4283
4284 /// Retrieves the specified zone-specific Operations resource.
4285 pub fn get_operation(
4286 &self,
4287 ) -> super::builder::instance_group_manager_resize_requests::GetOperation {
4288 super::builder::instance_group_manager_resize_requests::GetOperation::new(
4289 self.inner.clone(),
4290 )
4291 }
4292}
4293
4294/// Implements a client for the Google Compute Engine API.
4295///
4296/// # Example
4297/// ```
4298/// # use google_cloud_compute_v1::client::InstanceGroupManagers;
4299/// async fn sample(
4300/// ) -> anyhow::Result<()> {
4301/// let client = InstanceGroupManagers::builder().build().await?;
4302/// // use `client` to make requests to the Google Compute Engine API.
4303/// Ok(())
4304/// }
4305/// ```
4306///
4307/// # Service Description
4308///
4309/// Service for the `instanceGroupManagers` resource.
4310///
4311/// # Configuration
4312///
4313/// To configure `InstanceGroupManagers` use the `with_*` methods in the type returned
4314/// by [builder()][InstanceGroupManagers::builder]. The default configuration should
4315/// work for most applications. Common configuration changes include
4316///
4317/// * [with_endpoint()]: by default this client uses the global default endpoint
4318/// (`https://compute.googleapis.com`). Applications using regional
4319/// endpoints or running in restricted networks (e.g. a network configured
4320/// with [Private Google Access with VPC Service Controls]) may want to
4321/// override this default.
4322/// * [with_credentials()]: by default this client uses
4323/// [Application Default Credentials]. Applications using custom
4324/// authentication may need to override this default.
4325///
4326/// [with_endpoint()]: super::builder::instance_group_managers::ClientBuilder::with_endpoint
4327/// [with_credentials()]: super::builder::instance_group_managers::ClientBuilder::with_credentials
4328/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4329/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4330///
4331/// # Pooling and Cloning
4332///
4333/// `InstanceGroupManagers` holds a connection pool internally, it is advised to
4334/// create one and reuse it. You do not need to wrap `InstanceGroupManagers` in
4335/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4336/// already uses an `Arc` internally.
4337#[cfg(feature = "instance-group-managers")]
4338#[cfg_attr(docsrs, doc(cfg(feature = "instance-group-managers")))]
4339#[derive(Clone, Debug)]
4340pub struct InstanceGroupManagers {
4341 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagers>,
4342}
4343
4344#[cfg(feature = "instance-group-managers")]
4345impl InstanceGroupManagers {
4346 /// Returns a builder for [InstanceGroupManagers].
4347 ///
4348 /// ```
4349 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4350 /// # use google_cloud_compute_v1::client::InstanceGroupManagers;
4351 /// let client = InstanceGroupManagers::builder().build().await?;
4352 /// # Ok(()) }
4353 /// ```
4354 pub fn builder() -> super::builder::instance_group_managers::ClientBuilder {
4355 crate::new_client_builder(super::builder::instance_group_managers::client::Factory)
4356 }
4357
4358 /// Creates a new client from the provided stub.
4359 ///
4360 /// The most common case for calling this function is in tests mocking the
4361 /// client's behavior.
4362 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4363 where
4364 T: super::stub::InstanceGroupManagers + 'static,
4365 {
4366 Self { inner: stub.into() }
4367 }
4368
4369 pub(crate) async fn new(
4370 config: gaxi::options::ClientConfig,
4371 ) -> crate::ClientBuilderResult<Self> {
4372 let inner = Self::build_inner(config).await?;
4373 Ok(Self { inner })
4374 }
4375
4376 async fn build_inner(
4377 conf: gaxi::options::ClientConfig,
4378 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagers>>
4379 {
4380 if gaxi::options::tracing_enabled(&conf) {
4381 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4382 }
4383 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4384 }
4385
4386 async fn build_transport(
4387 conf: gaxi::options::ClientConfig,
4388 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagers> {
4389 super::transport::InstanceGroupManagers::new(conf).await
4390 }
4391
4392 async fn build_with_tracing(
4393 conf: gaxi::options::ClientConfig,
4394 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagers> {
4395 Self::build_transport(conf)
4396 .await
4397 .map(super::tracing::InstanceGroupManagers::new)
4398 }
4399
4400 /// Flags the specified instances to be removed from the
4401 /// managed instance group. Abandoning an instance does not delete the
4402 /// instance, but it does remove the instance from any target pools that are
4403 /// applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
4404 /// number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
4405 /// not yet been removed from the group. You must separately verify the
4406 /// status of the abandoning action with thelistmanagedinstances
4407 /// method.
4408 ///
4409 /// If the group is part of a backend
4410 /// service that has enabled
4411 /// connection draining, it can take up to 60 seconds after the connection
4412 /// draining duration has elapsed before the VM instance is removed or deleted.
4413 ///
4414 /// You can specify a maximum of 1000 instances with this method per request.
4415 pub fn abandon_instances(&self) -> super::builder::instance_group_managers::AbandonInstances {
4416 super::builder::instance_group_managers::AbandonInstances::new(self.inner.clone())
4417 }
4418
4419 /// Retrieves the list of managed instance groups and groups them by zone.
4420 ///
4421 /// To prevent failure, Google recommends that you set the
4422 /// `returnPartialSuccess` parameter to `true`.
4423 pub fn aggregated_list(&self) -> super::builder::instance_group_managers::AggregatedList {
4424 super::builder::instance_group_managers::AggregatedList::new(self.inner.clone())
4425 }
4426
4427 /// Applies changes to selected instances on the managed instance group.
4428 /// This method can be used to apply new overrides and/or new versions.
4429 pub fn apply_updates_to_instances(
4430 &self,
4431 ) -> super::builder::instance_group_managers::ApplyUpdatesToInstances {
4432 super::builder::instance_group_managers::ApplyUpdatesToInstances::new(self.inner.clone())
4433 }
4434
4435 /// Creates instances with per-instance configurations in this managed instance
4436 /// group. Instances are created using the current instance template. Thecreate instances operation is marked DONE if thecreateInstances request is successful. The underlying actions
4437 /// take additional time. You must separately verify the status of thecreating or actions with the listmanagedinstances
4438 /// method.
4439 pub fn create_instances(&self) -> super::builder::instance_group_managers::CreateInstances {
4440 super::builder::instance_group_managers::CreateInstances::new(self.inner.clone())
4441 }
4442
4443 /// Deletes the specified managed instance group and all of the instances
4444 /// in that group. Note that the instance group must not belong to a
4445 /// backend service. Read
4446 /// Deleting an instance group for more information.
4447 pub fn delete(&self) -> super::builder::instance_group_managers::Delete {
4448 super::builder::instance_group_managers::Delete::new(self.inner.clone())
4449 }
4450
4451 /// Flags the specified instances in the managed instance group for immediate
4452 /// deletion. The instances are also removed from any target
4453 /// pools of which they were a member. This method reduces thetargetSize of the managed instance group by the number of
4454 /// instances that you delete. This operation is marked as DONE
4455 /// when the action is scheduled even if the instances are still being deleted.
4456 /// You must separately verify the status of the deleting action
4457 /// with thelistmanagedinstances
4458 /// method.
4459 ///
4460 /// If the group is part of a backend
4461 /// service that has enabled
4462 /// connection draining, it can take up to 60 seconds after the connection
4463 /// draining duration has elapsed before the VM instance is removed or deleted.
4464 ///
4465 /// You can specify a maximum of 1000 instances with this method per request.
4466 pub fn delete_instances(&self) -> super::builder::instance_group_managers::DeleteInstances {
4467 super::builder::instance_group_managers::DeleteInstances::new(self.inner.clone())
4468 }
4469
4470 /// Deletes selected per-instance configurations for the managed instance
4471 /// group.
4472 pub fn delete_per_instance_configs(
4473 &self,
4474 ) -> super::builder::instance_group_managers::DeletePerInstanceConfigs {
4475 super::builder::instance_group_managers::DeletePerInstanceConfigs::new(self.inner.clone())
4476 }
4477
4478 /// Returns all of the details about the specified managed instance group.
4479 pub fn get(&self) -> super::builder::instance_group_managers::Get {
4480 super::builder::instance_group_managers::Get::new(self.inner.clone())
4481 }
4482
4483 /// Creates a managed instance group using the information that you specify
4484 /// in the request. After the group is created, instances in the group are
4485 /// created using the specified instance template.
4486 /// This operation is marked as DONE when the group is created
4487 /// even if the instances in the group have not yet been created. You
4488 /// must separately verify the status of the individual instances with thelistmanagedinstances
4489 /// method.
4490 ///
4491 /// A managed instance group can have up to 1000 VM instances per group. Please
4492 /// contact Cloud Support if you need an increase in
4493 /// this limit.
4494 pub fn insert(&self) -> super::builder::instance_group_managers::Insert {
4495 super::builder::instance_group_managers::Insert::new(self.inner.clone())
4496 }
4497
4498 /// Retrieves a list of managed instance groups that are contained within the
4499 /// specified project and zone.
4500 pub fn list(&self) -> super::builder::instance_group_managers::List {
4501 super::builder::instance_group_managers::List::new(self.inner.clone())
4502 }
4503
4504 /// Lists all errors thrown by actions on instances for a given managed
4505 /// instance group. The filter and orderBy query
4506 /// parameters are not supported.
4507 pub fn list_errors(&self) -> super::builder::instance_group_managers::ListErrors {
4508 super::builder::instance_group_managers::ListErrors::new(self.inner.clone())
4509 }
4510
4511 /// Lists all of the instances in the managed instance group. Each instance
4512 /// in the list has a currentAction, which indicates the action
4513 /// that the managed instance group is performing on the instance. For example,
4514 /// if the group is still creating an instance, the currentAction
4515 /// is CREATING. If a previous action failed, the
4516 /// list displays the errors for that failed action. The orderBy
4517 /// query parameter is not supported. The `pageToken` query parameter is
4518 /// supported only if the group's `listManagedInstancesResults` field is set
4519 /// to `PAGINATED`.
4520 pub fn list_managed_instances(
4521 &self,
4522 ) -> super::builder::instance_group_managers::ListManagedInstances {
4523 super::builder::instance_group_managers::ListManagedInstances::new(self.inner.clone())
4524 }
4525
4526 /// Lists all of the per-instance configurations defined for the managed
4527 /// instance group. The orderBy query parameter is not supported.
4528 pub fn list_per_instance_configs(
4529 &self,
4530 ) -> super::builder::instance_group_managers::ListPerInstanceConfigs {
4531 super::builder::instance_group_managers::ListPerInstanceConfigs::new(self.inner.clone())
4532 }
4533
4534 /// Updates a managed instance group using the information that you specify
4535 /// in the request.
4536 /// This operation is marked as DONE when the group is patched
4537 /// even if the instances in the group are still in the process of being
4538 /// patched. You must separately verify the status of the individual instances
4539 /// with thelistManagedInstances
4540 /// method. This method supportsPATCH
4541 /// semantics and uses theJSON merge
4542 /// patch format and processing rules.
4543 ///
4544 /// If you update your group to specify a new template or instance
4545 /// configuration, it's possible that your intended specification for each VM
4546 /// in the group is different from the current state of that VM. To learn how
4547 /// to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
4548 /// a MIG.
4549 pub fn patch(&self) -> super::builder::instance_group_managers::Patch {
4550 super::builder::instance_group_managers::Patch::new(self.inner.clone())
4551 }
4552
4553 /// Inserts or patches per-instance configurations for the managed instance
4554 /// group. perInstanceConfig.name serves as a key used to
4555 /// distinguish whether to perform insert or patch.
4556 pub fn patch_per_instance_configs(
4557 &self,
4558 ) -> super::builder::instance_group_managers::PatchPerInstanceConfigs {
4559 super::builder::instance_group_managers::PatchPerInstanceConfigs::new(self.inner.clone())
4560 }
4561
4562 /// Flags the specified VM instances in the managed instance group to be
4563 /// immediately recreated. Each instance is recreated using the group's current
4564 /// configuration. This operation is marked as DONE when the flag
4565 /// is set even if the instances have not yet been recreated. You must
4566 /// separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
4567 /// the status of managed instances.
4568 ///
4569 /// If the group is part of a backend
4570 /// service that has enabled
4571 /// connection draining, it can take up to 60 seconds after the connection
4572 /// draining duration has elapsed before the VM instance is removed or deleted.
4573 ///
4574 /// You can specify a maximum of 1000 instances with this method per request.
4575 pub fn recreate_instances(&self) -> super::builder::instance_group_managers::RecreateInstances {
4576 super::builder::instance_group_managers::RecreateInstances::new(self.inner.clone())
4577 }
4578
4579 /// Resizes the managed instance group. If you increase the size, the group
4580 /// creates new instances using the current instance template. If you decrease
4581 /// the size, the group deletes instances. The resize operation is markedDONE when the resize actions are scheduled even if the group
4582 /// has not yet added or deleted any instances. You must separately
4583 /// verify the status of the creating or deleting
4584 /// actions with thelistmanagedinstances
4585 /// method.
4586 ///
4587 /// When resizing down, the instance group arbitrarily chooses the order in
4588 /// which VMs are deleted. The group takes into account some VM attributes when
4589 /// making the selection including:
4590 ///
4591 /// + The status of the VM instance.
4592 /// + The health of the VM instance.
4593 /// + The instance template version the VM is based on.
4594 /// + For regional managed instance groups, the location of the VM instance.
4595 ///
4596 /// This list is subject to change.
4597 ///
4598 /// If the group is part of a backend
4599 /// service that has enabled
4600 /// connection draining, it can take up to 60 seconds after the connection
4601 /// draining duration has elapsed before the VM instance is removed or deleted.
4602 pub fn resize(&self) -> super::builder::instance_group_managers::Resize {
4603 super::builder::instance_group_managers::Resize::new(self.inner.clone())
4604 }
4605
4606 /// Flags the specified instances in the managed instance group to be
4607 /// resumed. This method increases thetargetSize and decreases the targetSuspendedSize
4608 /// of the managed instance group by the number of instances that you resume.
4609 /// The resumeInstances operation is marked DONE if
4610 /// the resumeInstances request is successful. The underlying
4611 /// actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
4612 /// method.
4613 ///
4614 /// In this request, you can only specify instances that are suspended. For
4615 /// example, if an instance was previously suspended using the suspendInstances
4616 /// method, it can be resumed using the resumeInstances method.
4617 ///
4618 /// If a health check is attached to the managed instance group, the specified
4619 /// instances will be verified as healthy after they are resumed.
4620 ///
4621 /// You can specify a maximum of 1000 instances with this method per request.
4622 pub fn resume_instances(&self) -> super::builder::instance_group_managers::ResumeInstances {
4623 super::builder::instance_group_managers::ResumeInstances::new(self.inner.clone())
4624 }
4625
4626 /// Specifies the instance template to use when creating new instances in this
4627 /// group. The templates for existing instances in the group do not change
4628 /// unless you run recreateInstances, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE.
4629 pub fn set_instance_template(
4630 &self,
4631 ) -> super::builder::instance_group_managers::SetInstanceTemplate {
4632 super::builder::instance_group_managers::SetInstanceTemplate::new(self.inner.clone())
4633 }
4634
4635 /// Modifies the target pools to which all instances in this managed instance
4636 /// group are assigned. The target pools automatically apply to all of the
4637 /// instances in the managed instance group. This operation is markedDONE when you make the request even if the instances have not
4638 /// yet been added to their target pools. The change might take some time to
4639 /// apply to all of the instances in the group depending on the size of the
4640 /// group.
4641 pub fn set_target_pools(&self) -> super::builder::instance_group_managers::SetTargetPools {
4642 super::builder::instance_group_managers::SetTargetPools::new(self.inner.clone())
4643 }
4644
4645 /// Flags the specified instances in the managed instance group to be
4646 /// started. This method increases thetargetSize and decreases the targetStoppedSize
4647 /// of the managed instance group by the number of instances that you start.
4648 /// The startInstances operation is marked DONE if
4649 /// the startInstances request is successful. The underlying
4650 /// actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
4651 /// method.
4652 ///
4653 /// In this request, you can only specify instances that are stopped. For
4654 /// example, if an instance was previously stopped using the stopInstances
4655 /// method, it can be started using the startInstances method.
4656 ///
4657 /// If a health check is attached to the managed instance group, the specified
4658 /// instances will be verified as healthy after they are started.
4659 ///
4660 /// You can specify a maximum of 1000 instances with this method per request.
4661 pub fn start_instances(&self) -> super::builder::instance_group_managers::StartInstances {
4662 super::builder::instance_group_managers::StartInstances::new(self.inner.clone())
4663 }
4664
4665 /// Flags the specified instances in the managed instance group to be
4666 /// immediately stopped. You can only specify instances that are running in
4667 /// this request. This method reduces thetargetSize and increases the targetStoppedSize
4668 /// of the managed instance group by the number of instances that you stop.
4669 /// The stopInstances operation is marked DONE if
4670 /// the stopInstances request is successful. The underlying
4671 /// actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
4672 /// method.
4673 ///
4674 /// If the standbyPolicy.initialDelaySec field is set, the group
4675 /// delays stopping the instances until initialDelaySec have
4676 /// passed from instance.creationTimestamp (that is, when the
4677 /// instance was created). This delay gives your application time to
4678 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
4679 /// will be zero delay.
4680 ///
4681 /// If the group is part of a backend
4682 /// service that has enabled
4683 /// connection draining, it can take up to 60 seconds after the connection
4684 /// draining duration has elapsed before the VM instance is stopped.
4685 ///
4686 /// Stopped instances can be started using the startInstances
4687 /// method.
4688 ///
4689 /// You can specify a maximum of 1000 instances with this method per request.
4690 pub fn stop_instances(&self) -> super::builder::instance_group_managers::StopInstances {
4691 super::builder::instance_group_managers::StopInstances::new(self.inner.clone())
4692 }
4693
4694 /// Flags the specified instances in the managed instance group to be
4695 /// immediately suspended. You can only specify instances that are running in
4696 /// this request. This method reduces thetargetSize and increases the targetSuspendedSize
4697 /// of the managed instance group by the number of instances that you suspend.
4698 /// The suspendInstances operation is marked DONE if
4699 /// the suspendInstances request is successful. The underlying
4700 /// actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
4701 /// method.
4702 ///
4703 /// If the standbyPolicy.initialDelaySec field is set, the group
4704 /// delays suspension of the instances until initialDelaySec have
4705 /// passed from instance.creationTimestamp (that is, when the
4706 /// instance was created). This delay gives your application time to
4707 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
4708 /// will be zero delay.
4709 ///
4710 /// If the group is part of a backend
4711 /// service that has enabled
4712 /// connection draining, it can take up to 60 seconds after the connection
4713 /// draining duration has elapsed before the VM instance is suspended.
4714 ///
4715 /// Suspended instances can be resumed using the resumeInstances
4716 /// method.
4717 ///
4718 /// You can specify a maximum of 1000 instances with this method per request.
4719 pub fn suspend_instances(&self) -> super::builder::instance_group_managers::SuspendInstances {
4720 super::builder::instance_group_managers::SuspendInstances::new(self.inner.clone())
4721 }
4722
4723 /// Inserts or updates per-instance configurations for the managed instance
4724 /// group. perInstanceConfig.name serves as a key used to
4725 /// distinguish whether to perform insert or patch.
4726 pub fn update_per_instance_configs(
4727 &self,
4728 ) -> super::builder::instance_group_managers::UpdatePerInstanceConfigs {
4729 super::builder::instance_group_managers::UpdatePerInstanceConfigs::new(self.inner.clone())
4730 }
4731
4732 /// Retrieves the specified zone-specific Operations resource.
4733 pub fn get_operation(&self) -> super::builder::instance_group_managers::GetOperation {
4734 super::builder::instance_group_managers::GetOperation::new(self.inner.clone())
4735 }
4736}
4737
4738/// Implements a client for the Google Compute Engine API.
4739///
4740/// # Example
4741/// ```
4742/// # use google_cloud_compute_v1::client::InstanceGroups;
4743/// async fn sample(
4744/// ) -> anyhow::Result<()> {
4745/// let client = InstanceGroups::builder().build().await?;
4746/// // use `client` to make requests to the Google Compute Engine API.
4747/// Ok(())
4748/// }
4749/// ```
4750///
4751/// # Service Description
4752///
4753/// Service for the `instanceGroups` resource.
4754///
4755/// # Configuration
4756///
4757/// To configure `InstanceGroups` use the `with_*` methods in the type returned
4758/// by [builder()][InstanceGroups::builder]. The default configuration should
4759/// work for most applications. Common configuration changes include
4760///
4761/// * [with_endpoint()]: by default this client uses the global default endpoint
4762/// (`https://compute.googleapis.com`). Applications using regional
4763/// endpoints or running in restricted networks (e.g. a network configured
4764/// with [Private Google Access with VPC Service Controls]) may want to
4765/// override this default.
4766/// * [with_credentials()]: by default this client uses
4767/// [Application Default Credentials]. Applications using custom
4768/// authentication may need to override this default.
4769///
4770/// [with_endpoint()]: super::builder::instance_groups::ClientBuilder::with_endpoint
4771/// [with_credentials()]: super::builder::instance_groups::ClientBuilder::with_credentials
4772/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4773/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4774///
4775/// # Pooling and Cloning
4776///
4777/// `InstanceGroups` holds a connection pool internally, it is advised to
4778/// create one and reuse it. You do not need to wrap `InstanceGroups` in
4779/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4780/// already uses an `Arc` internally.
4781#[cfg(feature = "instance-groups")]
4782#[cfg_attr(docsrs, doc(cfg(feature = "instance-groups")))]
4783#[derive(Clone, Debug)]
4784pub struct InstanceGroups {
4785 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroups>,
4786}
4787
4788#[cfg(feature = "instance-groups")]
4789impl InstanceGroups {
4790 /// Returns a builder for [InstanceGroups].
4791 ///
4792 /// ```
4793 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4794 /// # use google_cloud_compute_v1::client::InstanceGroups;
4795 /// let client = InstanceGroups::builder().build().await?;
4796 /// # Ok(()) }
4797 /// ```
4798 pub fn builder() -> super::builder::instance_groups::ClientBuilder {
4799 crate::new_client_builder(super::builder::instance_groups::client::Factory)
4800 }
4801
4802 /// Creates a new client from the provided stub.
4803 ///
4804 /// The most common case for calling this function is in tests mocking the
4805 /// client's behavior.
4806 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4807 where
4808 T: super::stub::InstanceGroups + 'static,
4809 {
4810 Self { inner: stub.into() }
4811 }
4812
4813 pub(crate) async fn new(
4814 config: gaxi::options::ClientConfig,
4815 ) -> crate::ClientBuilderResult<Self> {
4816 let inner = Self::build_inner(config).await?;
4817 Ok(Self { inner })
4818 }
4819
4820 async fn build_inner(
4821 conf: gaxi::options::ClientConfig,
4822 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceGroups>> {
4823 if gaxi::options::tracing_enabled(&conf) {
4824 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4825 }
4826 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4827 }
4828
4829 async fn build_transport(
4830 conf: gaxi::options::ClientConfig,
4831 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroups> {
4832 super::transport::InstanceGroups::new(conf).await
4833 }
4834
4835 async fn build_with_tracing(
4836 conf: gaxi::options::ClientConfig,
4837 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroups> {
4838 Self::build_transport(conf)
4839 .await
4840 .map(super::tracing::InstanceGroups::new)
4841 }
4842
4843 /// Adds a list of instances to the specified instance group. All of the
4844 /// instances in the instance group must be in the same network/subnetwork.
4845 /// Read
4846 /// Adding instances for more information.
4847 pub fn add_instances(&self) -> super::builder::instance_groups::AddInstances {
4848 super::builder::instance_groups::AddInstances::new(self.inner.clone())
4849 }
4850
4851 /// Retrieves the list of instance groups and sorts them by zone.
4852 ///
4853 /// To prevent failure, Google recommends that you set the
4854 /// `returnPartialSuccess` parameter to `true`.
4855 pub fn aggregated_list(&self) -> super::builder::instance_groups::AggregatedList {
4856 super::builder::instance_groups::AggregatedList::new(self.inner.clone())
4857 }
4858
4859 /// Deletes the specified instance group. The instances in the group are not
4860 /// deleted. Note that instance group must not belong to a backend service.
4861 /// Read
4862 /// Deleting an instance group for more information.
4863 pub fn delete(&self) -> super::builder::instance_groups::Delete {
4864 super::builder::instance_groups::Delete::new(self.inner.clone())
4865 }
4866
4867 /// Returns the specified zonal instance group. Get a list of available zonal
4868 /// instance groups by making a list() request.
4869 ///
4870 /// For managed instance groups, use theinstanceGroupManagers
4871 /// or regionInstanceGroupManagers
4872 /// methods instead.
4873 pub fn get(&self) -> super::builder::instance_groups::Get {
4874 super::builder::instance_groups::Get::new(self.inner.clone())
4875 }
4876
4877 /// Creates an instance group in the specified project using the
4878 /// parameters that are included in the request.
4879 pub fn insert(&self) -> super::builder::instance_groups::Insert {
4880 super::builder::instance_groups::Insert::new(self.inner.clone())
4881 }
4882
4883 /// Retrieves the list of zonal instance group resources contained within the
4884 /// specified zone.
4885 ///
4886 /// For managed instance groups, use theinstanceGroupManagers
4887 /// or regionInstanceGroupManagers
4888 /// methods instead.
4889 pub fn list(&self) -> super::builder::instance_groups::List {
4890 super::builder::instance_groups::List::new(self.inner.clone())
4891 }
4892
4893 /// Lists the instances in the specified instance group.
4894 /// The orderBy query parameter is not supported.
4895 /// The filter query parameter is supported, but only for
4896 /// expressions that use `eq` (equal) or `ne` (not equal) operators.
4897 pub fn list_instances(&self) -> super::builder::instance_groups::ListInstances {
4898 super::builder::instance_groups::ListInstances::new(self.inner.clone())
4899 }
4900
4901 /// Removes one or more instances from the specified instance group, but does
4902 /// not delete those instances.
4903 ///
4904 /// If the group is part of a backend
4905 /// service that has enabled
4906 /// connection draining, it can take up to 60 seconds after the connection
4907 /// draining duration before the VM instance is removed or deleted.
4908 pub fn remove_instances(&self) -> super::builder::instance_groups::RemoveInstances {
4909 super::builder::instance_groups::RemoveInstances::new(self.inner.clone())
4910 }
4911
4912 /// Sets the named ports for the specified instance group.
4913 pub fn set_named_ports(&self) -> super::builder::instance_groups::SetNamedPorts {
4914 super::builder::instance_groups::SetNamedPorts::new(self.inner.clone())
4915 }
4916
4917 /// Returns permissions that a caller has on the specified resource.
4918 pub fn test_iam_permissions(&self) -> super::builder::instance_groups::TestIamPermissions {
4919 super::builder::instance_groups::TestIamPermissions::new(self.inner.clone())
4920 }
4921
4922 /// Retrieves the specified zone-specific Operations resource.
4923 pub fn get_operation(&self) -> super::builder::instance_groups::GetOperation {
4924 super::builder::instance_groups::GetOperation::new(self.inner.clone())
4925 }
4926}
4927
4928/// Implements a client for the Google Compute Engine API.
4929///
4930/// # Example
4931/// ```
4932/// # use google_cloud_compute_v1::client::InstanceSettings;
4933/// async fn sample(
4934/// ) -> anyhow::Result<()> {
4935/// let client = InstanceSettings::builder().build().await?;
4936/// // use `client` to make requests to the Google Compute Engine API.
4937/// Ok(())
4938/// }
4939/// ```
4940///
4941/// # Service Description
4942///
4943/// Service for the `instanceSettings` resource.
4944///
4945/// # Configuration
4946///
4947/// To configure `InstanceSettings` use the `with_*` methods in the type returned
4948/// by [builder()][InstanceSettings::builder]. The default configuration should
4949/// work for most applications. Common configuration changes include
4950///
4951/// * [with_endpoint()]: by default this client uses the global default endpoint
4952/// (`https://compute.googleapis.com`). Applications using regional
4953/// endpoints or running in restricted networks (e.g. a network configured
4954/// with [Private Google Access with VPC Service Controls]) may want to
4955/// override this default.
4956/// * [with_credentials()]: by default this client uses
4957/// [Application Default Credentials]. Applications using custom
4958/// authentication may need to override this default.
4959///
4960/// [with_endpoint()]: super::builder::instance_settings::ClientBuilder::with_endpoint
4961/// [with_credentials()]: super::builder::instance_settings::ClientBuilder::with_credentials
4962/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4963/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4964///
4965/// # Pooling and Cloning
4966///
4967/// `InstanceSettings` holds a connection pool internally, it is advised to
4968/// create one and reuse it. You do not need to wrap `InstanceSettings` in
4969/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4970/// already uses an `Arc` internally.
4971#[cfg(feature = "instance-settings")]
4972#[cfg_attr(docsrs, doc(cfg(feature = "instance-settings")))]
4973#[derive(Clone, Debug)]
4974pub struct InstanceSettings {
4975 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceSettings>,
4976}
4977
4978#[cfg(feature = "instance-settings")]
4979impl InstanceSettings {
4980 /// Returns a builder for [InstanceSettings].
4981 ///
4982 /// ```
4983 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4984 /// # use google_cloud_compute_v1::client::InstanceSettings;
4985 /// let client = InstanceSettings::builder().build().await?;
4986 /// # Ok(()) }
4987 /// ```
4988 pub fn builder() -> super::builder::instance_settings::ClientBuilder {
4989 crate::new_client_builder(super::builder::instance_settings::client::Factory)
4990 }
4991
4992 /// Creates a new client from the provided stub.
4993 ///
4994 /// The most common case for calling this function is in tests mocking the
4995 /// client's behavior.
4996 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4997 where
4998 T: super::stub::InstanceSettings + 'static,
4999 {
5000 Self { inner: stub.into() }
5001 }
5002
5003 pub(crate) async fn new(
5004 config: gaxi::options::ClientConfig,
5005 ) -> crate::ClientBuilderResult<Self> {
5006 let inner = Self::build_inner(config).await?;
5007 Ok(Self { inner })
5008 }
5009
5010 async fn build_inner(
5011 conf: gaxi::options::ClientConfig,
5012 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceSettings>>
5013 {
5014 if gaxi::options::tracing_enabled(&conf) {
5015 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5016 }
5017 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5018 }
5019
5020 async fn build_transport(
5021 conf: gaxi::options::ClientConfig,
5022 ) -> crate::ClientBuilderResult<impl super::stub::InstanceSettings> {
5023 super::transport::InstanceSettings::new(conf).await
5024 }
5025
5026 async fn build_with_tracing(
5027 conf: gaxi::options::ClientConfig,
5028 ) -> crate::ClientBuilderResult<impl super::stub::InstanceSettings> {
5029 Self::build_transport(conf)
5030 .await
5031 .map(super::tracing::InstanceSettings::new)
5032 }
5033
5034 /// Get Instance settings.
5035 pub fn get(&self) -> super::builder::instance_settings::Get {
5036 super::builder::instance_settings::Get::new(self.inner.clone())
5037 }
5038
5039 /// Patch Instance settings
5040 pub fn patch(&self) -> super::builder::instance_settings::Patch {
5041 super::builder::instance_settings::Patch::new(self.inner.clone())
5042 }
5043
5044 /// Retrieves the specified zone-specific Operations resource.
5045 pub fn get_operation(&self) -> super::builder::instance_settings::GetOperation {
5046 super::builder::instance_settings::GetOperation::new(self.inner.clone())
5047 }
5048}
5049
5050/// Implements a client for the Google Compute Engine API.
5051///
5052/// # Example
5053/// ```
5054/// # use google_cloud_compute_v1::client::InstanceTemplates;
5055/// async fn sample(
5056/// ) -> anyhow::Result<()> {
5057/// let client = InstanceTemplates::builder().build().await?;
5058/// // use `client` to make requests to the Google Compute Engine API.
5059/// Ok(())
5060/// }
5061/// ```
5062///
5063/// # Service Description
5064///
5065/// Service for the `instanceTemplates` resource.
5066///
5067/// # Configuration
5068///
5069/// To configure `InstanceTemplates` use the `with_*` methods in the type returned
5070/// by [builder()][InstanceTemplates::builder]. The default configuration should
5071/// work for most applications. Common configuration changes include
5072///
5073/// * [with_endpoint()]: by default this client uses the global default endpoint
5074/// (`https://compute.googleapis.com`). Applications using regional
5075/// endpoints or running in restricted networks (e.g. a network configured
5076/// with [Private Google Access with VPC Service Controls]) may want to
5077/// override this default.
5078/// * [with_credentials()]: by default this client uses
5079/// [Application Default Credentials]. Applications using custom
5080/// authentication may need to override this default.
5081///
5082/// [with_endpoint()]: super::builder::instance_templates::ClientBuilder::with_endpoint
5083/// [with_credentials()]: super::builder::instance_templates::ClientBuilder::with_credentials
5084/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5085/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5086///
5087/// # Pooling and Cloning
5088///
5089/// `InstanceTemplates` holds a connection pool internally, it is advised to
5090/// create one and reuse it. You do not need to wrap `InstanceTemplates` in
5091/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5092/// already uses an `Arc` internally.
5093#[cfg(feature = "instance-templates")]
5094#[cfg_attr(docsrs, doc(cfg(feature = "instance-templates")))]
5095#[derive(Clone, Debug)]
5096pub struct InstanceTemplates {
5097 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceTemplates>,
5098}
5099
5100#[cfg(feature = "instance-templates")]
5101impl InstanceTemplates {
5102 /// Returns a builder for [InstanceTemplates].
5103 ///
5104 /// ```
5105 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5106 /// # use google_cloud_compute_v1::client::InstanceTemplates;
5107 /// let client = InstanceTemplates::builder().build().await?;
5108 /// # Ok(()) }
5109 /// ```
5110 pub fn builder() -> super::builder::instance_templates::ClientBuilder {
5111 crate::new_client_builder(super::builder::instance_templates::client::Factory)
5112 }
5113
5114 /// Creates a new client from the provided stub.
5115 ///
5116 /// The most common case for calling this function is in tests mocking the
5117 /// client's behavior.
5118 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5119 where
5120 T: super::stub::InstanceTemplates + 'static,
5121 {
5122 Self { inner: stub.into() }
5123 }
5124
5125 pub(crate) async fn new(
5126 config: gaxi::options::ClientConfig,
5127 ) -> crate::ClientBuilderResult<Self> {
5128 let inner = Self::build_inner(config).await?;
5129 Ok(Self { inner })
5130 }
5131
5132 async fn build_inner(
5133 conf: gaxi::options::ClientConfig,
5134 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceTemplates>>
5135 {
5136 if gaxi::options::tracing_enabled(&conf) {
5137 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5138 }
5139 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5140 }
5141
5142 async fn build_transport(
5143 conf: gaxi::options::ClientConfig,
5144 ) -> crate::ClientBuilderResult<impl super::stub::InstanceTemplates> {
5145 super::transport::InstanceTemplates::new(conf).await
5146 }
5147
5148 async fn build_with_tracing(
5149 conf: gaxi::options::ClientConfig,
5150 ) -> crate::ClientBuilderResult<impl super::stub::InstanceTemplates> {
5151 Self::build_transport(conf)
5152 .await
5153 .map(super::tracing::InstanceTemplates::new)
5154 }
5155
5156 /// Retrieves the list of all InstanceTemplates resources, regional and global,
5157 /// available to the specified project.
5158 ///
5159 /// To prevent failure, Google recommends that you set the
5160 /// `returnPartialSuccess` parameter to `true`.
5161 pub fn aggregated_list(&self) -> super::builder::instance_templates::AggregatedList {
5162 super::builder::instance_templates::AggregatedList::new(self.inner.clone())
5163 }
5164
5165 /// Deletes the specified instance template. Deleting an instance template is
5166 /// permanent and cannot be undone. It is not possible to delete templates
5167 /// that are already in use by a managed instance group.
5168 pub fn delete(&self) -> super::builder::instance_templates::Delete {
5169 super::builder::instance_templates::Delete::new(self.inner.clone())
5170 }
5171
5172 /// Returns the specified instance template.
5173 pub fn get(&self) -> super::builder::instance_templates::Get {
5174 super::builder::instance_templates::Get::new(self.inner.clone())
5175 }
5176
5177 /// Gets the access control policy for a resource. May be empty if no such
5178 /// policy or resource exists.
5179 pub fn get_iam_policy(&self) -> super::builder::instance_templates::GetIamPolicy {
5180 super::builder::instance_templates::GetIamPolicy::new(self.inner.clone())
5181 }
5182
5183 /// Creates an instance template in the specified project using the
5184 /// data that is included in the request. If you are creating a new template to
5185 /// update an existing instance group, your new instance template must use the
5186 /// same network or, if applicable, the same subnetwork as the original
5187 /// template.
5188 pub fn insert(&self) -> super::builder::instance_templates::Insert {
5189 super::builder::instance_templates::Insert::new(self.inner.clone())
5190 }
5191
5192 /// Retrieves a list of instance templates that are contained within
5193 /// the specified project.
5194 pub fn list(&self) -> super::builder::instance_templates::List {
5195 super::builder::instance_templates::List::new(self.inner.clone())
5196 }
5197
5198 /// Sets the access control policy on the specified resource.
5199 /// Replaces any existing policy.
5200 pub fn set_iam_policy(&self) -> super::builder::instance_templates::SetIamPolicy {
5201 super::builder::instance_templates::SetIamPolicy::new(self.inner.clone())
5202 }
5203
5204 /// Returns permissions that a caller has on the specified resource.
5205 pub fn test_iam_permissions(&self) -> super::builder::instance_templates::TestIamPermissions {
5206 super::builder::instance_templates::TestIamPermissions::new(self.inner.clone())
5207 }
5208
5209 /// Retrieves the specified Operations resource.
5210 pub fn get_operation(&self) -> super::builder::instance_templates::GetOperation {
5211 super::builder::instance_templates::GetOperation::new(self.inner.clone())
5212 }
5213}
5214
5215/// Implements a client for the Google Compute Engine API.
5216///
5217/// # Example
5218/// ```
5219/// # use google_cloud_compute_v1::client::Instances;
5220/// async fn sample(
5221/// ) -> anyhow::Result<()> {
5222/// let client = Instances::builder().build().await?;
5223/// // use `client` to make requests to the Google Compute Engine API.
5224/// Ok(())
5225/// }
5226/// ```
5227///
5228/// # Service Description
5229///
5230/// Service for the `instances` resource.
5231///
5232/// # Configuration
5233///
5234/// To configure `Instances` use the `with_*` methods in the type returned
5235/// by [builder()][Instances::builder]. The default configuration should
5236/// work for most applications. Common configuration changes include
5237///
5238/// * [with_endpoint()]: by default this client uses the global default endpoint
5239/// (`https://compute.googleapis.com`). Applications using regional
5240/// endpoints or running in restricted networks (e.g. a network configured
5241/// with [Private Google Access with VPC Service Controls]) may want to
5242/// override this default.
5243/// * [with_credentials()]: by default this client uses
5244/// [Application Default Credentials]. Applications using custom
5245/// authentication may need to override this default.
5246///
5247/// [with_endpoint()]: super::builder::instances::ClientBuilder::with_endpoint
5248/// [with_credentials()]: super::builder::instances::ClientBuilder::with_credentials
5249/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5250/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5251///
5252/// # Pooling and Cloning
5253///
5254/// `Instances` holds a connection pool internally, it is advised to
5255/// create one and reuse it. You do not need to wrap `Instances` in
5256/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5257/// already uses an `Arc` internally.
5258#[cfg(feature = "instances")]
5259#[cfg_attr(docsrs, doc(cfg(feature = "instances")))]
5260#[derive(Clone, Debug)]
5261pub struct Instances {
5262 inner: std::sync::Arc<dyn super::stub::dynamic::Instances>,
5263}
5264
5265#[cfg(feature = "instances")]
5266impl Instances {
5267 /// Returns a builder for [Instances].
5268 ///
5269 /// ```
5270 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5271 /// # use google_cloud_compute_v1::client::Instances;
5272 /// let client = Instances::builder().build().await?;
5273 /// # Ok(()) }
5274 /// ```
5275 pub fn builder() -> super::builder::instances::ClientBuilder {
5276 crate::new_client_builder(super::builder::instances::client::Factory)
5277 }
5278
5279 /// Creates a new client from the provided stub.
5280 ///
5281 /// The most common case for calling this function is in tests mocking the
5282 /// client's behavior.
5283 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5284 where
5285 T: super::stub::Instances + 'static,
5286 {
5287 Self { inner: stub.into() }
5288 }
5289
5290 pub(crate) async fn new(
5291 config: gaxi::options::ClientConfig,
5292 ) -> crate::ClientBuilderResult<Self> {
5293 let inner = Self::build_inner(config).await?;
5294 Ok(Self { inner })
5295 }
5296
5297 async fn build_inner(
5298 conf: gaxi::options::ClientConfig,
5299 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Instances>> {
5300 if gaxi::options::tracing_enabled(&conf) {
5301 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5302 }
5303 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5304 }
5305
5306 async fn build_transport(
5307 conf: gaxi::options::ClientConfig,
5308 ) -> crate::ClientBuilderResult<impl super::stub::Instances> {
5309 super::transport::Instances::new(conf).await
5310 }
5311
5312 async fn build_with_tracing(
5313 conf: gaxi::options::ClientConfig,
5314 ) -> crate::ClientBuilderResult<impl super::stub::Instances> {
5315 Self::build_transport(conf)
5316 .await
5317 .map(super::tracing::Instances::new)
5318 }
5319
5320 /// Adds an access config to an instance's network interface.
5321 pub fn add_access_config(&self) -> super::builder::instances::AddAccessConfig {
5322 super::builder::instances::AddAccessConfig::new(self.inner.clone())
5323 }
5324
5325 /// Adds one dynamic network interface to an active instance.
5326 pub fn add_network_interface(&self) -> super::builder::instances::AddNetworkInterface {
5327 super::builder::instances::AddNetworkInterface::new(self.inner.clone())
5328 }
5329
5330 /// Adds existing resource policies to an instance. You can only add one
5331 /// policy right now which will be applied to this instance for scheduling live
5332 /// migrations.
5333 pub fn add_resource_policies(&self) -> super::builder::instances::AddResourcePolicies {
5334 super::builder::instances::AddResourcePolicies::new(self.inner.clone())
5335 }
5336
5337 /// Retrieves an aggregated list of all of the instances in your project
5338 /// across all regions and zones.
5339 ///
5340 /// The performance of this method degrades when a filter is specified on a
5341 /// project that has a very large number of instances.
5342 ///
5343 /// To prevent failure, Google recommends that you set the
5344 /// `returnPartialSuccess` parameter to `true`.
5345 pub fn aggregated_list(&self) -> super::builder::instances::AggregatedList {
5346 super::builder::instances::AggregatedList::new(self.inner.clone())
5347 }
5348
5349 /// Attaches an existing Disk resource to an instance. You must first
5350 /// create the disk before you can attach it. It is not possible to create
5351 /// and attach a disk at the same time. For more information, readAdding a
5352 /// persistent disk to your instance.
5353 pub fn attach_disk(&self) -> super::builder::instances::AttachDisk {
5354 super::builder::instances::AttachDisk::new(self.inner.clone())
5355 }
5356
5357 /// Creates multiple instances. Count specifies the number of instances to
5358 /// create. For more information, seeAbout bulk
5359 /// creation of VMs.
5360 pub fn bulk_insert(&self) -> super::builder::instances::BulkInsert {
5361 super::builder::instances::BulkInsert::new(self.inner.clone())
5362 }
5363
5364 /// Deletes the specified Instance resource. For more information, seeDeleting
5365 /// an instance.
5366 pub fn delete(&self) -> super::builder::instances::Delete {
5367 super::builder::instances::Delete::new(self.inner.clone())
5368 }
5369
5370 /// Deletes an access config from an instance's network interface.
5371 pub fn delete_access_config(&self) -> super::builder::instances::DeleteAccessConfig {
5372 super::builder::instances::DeleteAccessConfig::new(self.inner.clone())
5373 }
5374
5375 /// Deletes one dynamic network interface from an active instance.
5376 /// InstancesDeleteNetworkInterfaceRequest indicates:
5377 ///
5378 /// - instance from which to delete, using project+zone+resource_id fields;
5379 /// - dynamic network interface to be deleted, using network_interface_name
5380 /// field;
5381 pub fn delete_network_interface(&self) -> super::builder::instances::DeleteNetworkInterface {
5382 super::builder::instances::DeleteNetworkInterface::new(self.inner.clone())
5383 }
5384
5385 /// Detaches a disk from an instance.
5386 pub fn detach_disk(&self) -> super::builder::instances::DetachDisk {
5387 super::builder::instances::DetachDisk::new(self.inner.clone())
5388 }
5389
5390 /// Returns the specified Instance resource.
5391 pub fn get(&self) -> super::builder::instances::Get {
5392 super::builder::instances::Get::new(self.inner.clone())
5393 }
5394
5395 /// Returns effective firewalls applied to an interface of the instance.
5396 pub fn get_effective_firewalls(&self) -> super::builder::instances::GetEffectiveFirewalls {
5397 super::builder::instances::GetEffectiveFirewalls::new(self.inner.clone())
5398 }
5399
5400 /// Returns the specified guest attributes entry.
5401 pub fn get_guest_attributes(&self) -> super::builder::instances::GetGuestAttributes {
5402 super::builder::instances::GetGuestAttributes::new(self.inner.clone())
5403 }
5404
5405 /// Gets the access control policy for a resource. May be empty if no such
5406 /// policy or resource exists.
5407 pub fn get_iam_policy(&self) -> super::builder::instances::GetIamPolicy {
5408 super::builder::instances::GetIamPolicy::new(self.inner.clone())
5409 }
5410
5411 /// Returns the screenshot from the specified instance.
5412 pub fn get_screenshot(&self) -> super::builder::instances::GetScreenshot {
5413 super::builder::instances::GetScreenshot::new(self.inner.clone())
5414 }
5415
5416 /// Returns the last 1 MB of serial port output from the specified instance.
5417 pub fn get_serial_port_output(&self) -> super::builder::instances::GetSerialPortOutput {
5418 super::builder::instances::GetSerialPortOutput::new(self.inner.clone())
5419 }
5420
5421 /// Returns the Shielded Instance Identity of an instance
5422 pub fn get_shielded_instance_identity(
5423 &self,
5424 ) -> super::builder::instances::GetShieldedInstanceIdentity {
5425 super::builder::instances::GetShieldedInstanceIdentity::new(self.inner.clone())
5426 }
5427
5428 /// Creates an instance resource in the specified project using the data
5429 /// included in the request.
5430 pub fn insert(&self) -> super::builder::instances::Insert {
5431 super::builder::instances::Insert::new(self.inner.clone())
5432 }
5433
5434 /// Retrieves the list of instances contained within
5435 /// the specified zone.
5436 pub fn list(&self) -> super::builder::instances::List {
5437 super::builder::instances::List::new(self.inner.clone())
5438 }
5439
5440 /// Retrieves a list of resources that refer to the VM instance specified in
5441 /// the request. For example, if the VM instance is part of a managed or
5442 /// unmanaged instance group, the referrers list includes the instance group.
5443 /// For more information, readViewing
5444 /// referrers to VM instances.
5445 pub fn list_referrers(&self) -> super::builder::instances::ListReferrers {
5446 super::builder::instances::ListReferrers::new(self.inner.clone())
5447 }
5448
5449 /// Perform a manual maintenance on the instance.
5450 pub fn perform_maintenance(&self) -> super::builder::instances::PerformMaintenance {
5451 super::builder::instances::PerformMaintenance::new(self.inner.clone())
5452 }
5453
5454 /// Removes resource policies from an instance.
5455 pub fn remove_resource_policies(&self) -> super::builder::instances::RemoveResourcePolicies {
5456 super::builder::instances::RemoveResourcePolicies::new(self.inner.clone())
5457 }
5458
5459 /// Mark the host as faulty and try to restart the instance on a new host.
5460 pub fn report_host_as_faulty(&self) -> super::builder::instances::ReportHostAsFaulty {
5461 super::builder::instances::ReportHostAsFaulty::new(self.inner.clone())
5462 }
5463
5464 /// Performs a reset on the instance. This is a hard reset. The VM
5465 /// does not do a graceful shutdown. For more information, seeResetting
5466 /// an instance.
5467 pub fn reset(&self) -> super::builder::instances::Reset {
5468 super::builder::instances::Reset::new(self.inner.clone())
5469 }
5470
5471 /// Resumes an instance that was suspended using theinstances().suspend
5472 /// method.
5473 pub fn resume(&self) -> super::builder::instances::Resume {
5474 super::builder::instances::Resume::new(self.inner.clone())
5475 }
5476
5477 /// Sends diagnostic interrupt to the instance.
5478 pub fn send_diagnostic_interrupt(&self) -> super::builder::instances::SendDiagnosticInterrupt {
5479 super::builder::instances::SendDiagnosticInterrupt::new(self.inner.clone())
5480 }
5481
5482 /// Sets deletion protection on the instance.
5483 pub fn set_deletion_protection(&self) -> super::builder::instances::SetDeletionProtection {
5484 super::builder::instances::SetDeletionProtection::new(self.inner.clone())
5485 }
5486
5487 /// Sets the auto-delete flag for a disk attached to an instance.
5488 pub fn set_disk_auto_delete(&self) -> super::builder::instances::SetDiskAutoDelete {
5489 super::builder::instances::SetDiskAutoDelete::new(self.inner.clone())
5490 }
5491
5492 /// Sets the access control policy on the specified resource.
5493 /// Replaces any existing policy.
5494 pub fn set_iam_policy(&self) -> super::builder::instances::SetIamPolicy {
5495 super::builder::instances::SetIamPolicy::new(self.inner.clone())
5496 }
5497
5498 /// Sets labels on an instance. To learn more about labels, read theLabeling
5499 /// Resources documentation.
5500 pub fn set_labels(&self) -> super::builder::instances::SetLabels {
5501 super::builder::instances::SetLabels::new(self.inner.clone())
5502 }
5503
5504 /// Changes the number and/or type of accelerator for a stopped instance to the
5505 /// values specified in the request.
5506 pub fn set_machine_resources(&self) -> super::builder::instances::SetMachineResources {
5507 super::builder::instances::SetMachineResources::new(self.inner.clone())
5508 }
5509
5510 /// Changes the machine type for a stopped instance to the machine
5511 /// type specified in the request.
5512 pub fn set_machine_type(&self) -> super::builder::instances::SetMachineType {
5513 super::builder::instances::SetMachineType::new(self.inner.clone())
5514 }
5515
5516 /// Sets metadata for the specified instance to the data included
5517 /// in the request.
5518 pub fn set_metadata(&self) -> super::builder::instances::SetMetadata {
5519 super::builder::instances::SetMetadata::new(self.inner.clone())
5520 }
5521
5522 /// Changes the minimum CPU platform that this instance should use.
5523 /// This method can only
5524 /// be called on a stopped instance. For more information, readSpecifying a
5525 /// Minimum CPU Platform.
5526 pub fn set_min_cpu_platform(&self) -> super::builder::instances::SetMinCpuPlatform {
5527 super::builder::instances::SetMinCpuPlatform::new(self.inner.clone())
5528 }
5529
5530 /// Sets name of an instance.
5531 pub fn set_name(&self) -> super::builder::instances::SetName {
5532 super::builder::instances::SetName::new(self.inner.clone())
5533 }
5534
5535 /// Sets an instance's scheduling options. You can only call this method on astopped instance,
5536 /// that is, a VM instance that is in a `TERMINATED` state. SeeInstance Life
5537 /// Cycle for more information on the possible instance states.
5538 /// For more information about setting scheduling options for a VM, seeSet
5539 /// VM host maintenance policy.
5540 pub fn set_scheduling(&self) -> super::builder::instances::SetScheduling {
5541 super::builder::instances::SetScheduling::new(self.inner.clone())
5542 }
5543
5544 /// Sets the Google Cloud Armor security policy for the specified instance.
5545 /// For more information, seeGoogle
5546 /// Cloud Armor Overview
5547 pub fn set_security_policy(&self) -> super::builder::instances::SetSecurityPolicy {
5548 super::builder::instances::SetSecurityPolicy::new(self.inner.clone())
5549 }
5550
5551 /// Sets the service account on the instance. For more information,
5552 /// readChanging
5553 /// the service account and access scopes for an instance.
5554 pub fn set_service_account(&self) -> super::builder::instances::SetServiceAccount {
5555 super::builder::instances::SetServiceAccount::new(self.inner.clone())
5556 }
5557
5558 /// Sets the Shielded Instance integrity policy for an instance. You can
5559 /// only use this method on a running instance. This method
5560 /// supports PATCH semantics and uses the JSON merge
5561 /// patch format and processing rules.
5562 pub fn set_shielded_instance_integrity_policy(
5563 &self,
5564 ) -> super::builder::instances::SetShieldedInstanceIntegrityPolicy {
5565 super::builder::instances::SetShieldedInstanceIntegrityPolicy::new(self.inner.clone())
5566 }
5567
5568 /// Sets network tags
5569 /// for the specified instance to the data included in the request.
5570 pub fn set_tags(&self) -> super::builder::instances::SetTags {
5571 super::builder::instances::SetTags::new(self.inner.clone())
5572 }
5573
5574 /// Simulates a host maintenance event on a VM. For more information, see
5575 /// Simulate a host maintenance event.
5576 pub fn simulate_maintenance_event(
5577 &self,
5578 ) -> super::builder::instances::SimulateMaintenanceEvent {
5579 super::builder::instances::SimulateMaintenanceEvent::new(self.inner.clone())
5580 }
5581
5582 /// Starts an instance that was stopped using theinstances().stop
5583 /// method. For more information, seeRestart an
5584 /// instance.
5585 pub fn start(&self) -> super::builder::instances::Start {
5586 super::builder::instances::Start::new(self.inner.clone())
5587 }
5588
5589 /// Starts an instance that was stopped using theinstances().stop
5590 /// method. For more information, seeRestart an
5591 /// instance.
5592 pub fn start_with_encryption_key(&self) -> super::builder::instances::StartWithEncryptionKey {
5593 super::builder::instances::StartWithEncryptionKey::new(self.inner.clone())
5594 }
5595
5596 /// Stops a running instance, shutting it down cleanly, and allows
5597 /// you to restart the instance at a later time. Stopped instances do not incur
5598 /// VM usage charges while they are stopped. However, resources that the VM is
5599 /// using, such as persistent disks and static IP addresses, will continue to
5600 /// be charged until they are deleted. For more information, seeStopping
5601 /// an instance.
5602 pub fn stop(&self) -> super::builder::instances::Stop {
5603 super::builder::instances::Stop::new(self.inner.clone())
5604 }
5605
5606 /// This method suspends a running instance, saving its state to persistent
5607 /// storage, and allows you to resume the instance at a later time. Suspended
5608 /// instances have no compute costs (cores or RAM), and incur only storage
5609 /// charges for the saved VM memory and localSSD data. Any charged resources
5610 /// the virtual machine was using, such as persistent disks and static IP
5611 /// addresses, will continue to be charged while the instance is suspended.
5612 /// For more information, see
5613 /// Suspending and resuming an instance.
5614 pub fn suspend(&self) -> super::builder::instances::Suspend {
5615 super::builder::instances::Suspend::new(self.inner.clone())
5616 }
5617
5618 /// Returns permissions that a caller has on the specified resource.
5619 pub fn test_iam_permissions(&self) -> super::builder::instances::TestIamPermissions {
5620 super::builder::instances::TestIamPermissions::new(self.inner.clone())
5621 }
5622
5623 /// Updates an instance only if the necessary resources are available. This
5624 /// method can update only a specific set of instance properties. See
5625 /// Updating a running instance for a list of updatable instance
5626 /// properties.
5627 pub fn update(&self) -> super::builder::instances::Update {
5628 super::builder::instances::Update::new(self.inner.clone())
5629 }
5630
5631 /// Updates the specified access config from an instance's network interface
5632 /// with the data included in the request. This method supportsPATCH
5633 /// semantics and uses theJSON merge
5634 /// patch format and processing rules.
5635 pub fn update_access_config(&self) -> super::builder::instances::UpdateAccessConfig {
5636 super::builder::instances::UpdateAccessConfig::new(self.inner.clone())
5637 }
5638
5639 /// Updates the Display config for a VM instance. You can
5640 /// only use this method on a stopped VM instance. This method supportsPATCH
5641 /// semantics and uses theJSON merge
5642 /// patch format and processing rules.
5643 pub fn update_display_device(&self) -> super::builder::instances::UpdateDisplayDevice {
5644 super::builder::instances::UpdateDisplayDevice::new(self.inner.clone())
5645 }
5646
5647 /// Updates an instance's network interface. This method can only update an
5648 /// interface's alias IP range and attached network. See Modifying
5649 /// alias IP ranges for an existing instance for instructions on
5650 /// changing alias IP ranges. See Migrating
5651 /// a VM between networks for instructions on migrating an interface.
5652 /// This method follows PATCH semantics.
5653 pub fn update_network_interface(&self) -> super::builder::instances::UpdateNetworkInterface {
5654 super::builder::instances::UpdateNetworkInterface::new(self.inner.clone())
5655 }
5656
5657 /// Updates the Shielded Instance config for an instance. You can
5658 /// only use this method on a stopped instance. This method supportsPATCH
5659 /// semantics and uses theJSON merge
5660 /// patch format and processing rules.
5661 pub fn update_shielded_instance_config(
5662 &self,
5663 ) -> super::builder::instances::UpdateShieldedInstanceConfig {
5664 super::builder::instances::UpdateShieldedInstanceConfig::new(self.inner.clone())
5665 }
5666
5667 /// Retrieves the specified zone-specific Operations resource.
5668 pub fn get_operation(&self) -> super::builder::instances::GetOperation {
5669 super::builder::instances::GetOperation::new(self.inner.clone())
5670 }
5671}
5672
5673/// Implements a client for the Google Compute Engine API.
5674///
5675/// # Example
5676/// ```
5677/// # use google_cloud_compute_v1::client::InstantSnapshotGroups;
5678/// async fn sample(
5679/// ) -> anyhow::Result<()> {
5680/// let client = InstantSnapshotGroups::builder().build().await?;
5681/// // use `client` to make requests to the Google Compute Engine API.
5682/// Ok(())
5683/// }
5684/// ```
5685///
5686/// # Service Description
5687///
5688/// Service for the `instantSnapshotGroups` resource.
5689///
5690/// # Configuration
5691///
5692/// To configure `InstantSnapshotGroups` use the `with_*` methods in the type returned
5693/// by [builder()][InstantSnapshotGroups::builder]. The default configuration should
5694/// work for most applications. Common configuration changes include
5695///
5696/// * [with_endpoint()]: by default this client uses the global default endpoint
5697/// (`https://compute.googleapis.com`). Applications using regional
5698/// endpoints or running in restricted networks (e.g. a network configured
5699/// with [Private Google Access with VPC Service Controls]) may want to
5700/// override this default.
5701/// * [with_credentials()]: by default this client uses
5702/// [Application Default Credentials]. Applications using custom
5703/// authentication may need to override this default.
5704///
5705/// [with_endpoint()]: super::builder::instant_snapshot_groups::ClientBuilder::with_endpoint
5706/// [with_credentials()]: super::builder::instant_snapshot_groups::ClientBuilder::with_credentials
5707/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5708/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5709///
5710/// # Pooling and Cloning
5711///
5712/// `InstantSnapshotGroups` holds a connection pool internally, it is advised to
5713/// create one and reuse it. You do not need to wrap `InstantSnapshotGroups` in
5714/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5715/// already uses an `Arc` internally.
5716#[cfg(feature = "instant-snapshot-groups")]
5717#[cfg_attr(docsrs, doc(cfg(feature = "instant-snapshot-groups")))]
5718#[derive(Clone, Debug)]
5719pub struct InstantSnapshotGroups {
5720 inner: std::sync::Arc<dyn super::stub::dynamic::InstantSnapshotGroups>,
5721}
5722
5723#[cfg(feature = "instant-snapshot-groups")]
5724impl InstantSnapshotGroups {
5725 /// Returns a builder for [InstantSnapshotGroups].
5726 ///
5727 /// ```
5728 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5729 /// # use google_cloud_compute_v1::client::InstantSnapshotGroups;
5730 /// let client = InstantSnapshotGroups::builder().build().await?;
5731 /// # Ok(()) }
5732 /// ```
5733 pub fn builder() -> super::builder::instant_snapshot_groups::ClientBuilder {
5734 crate::new_client_builder(super::builder::instant_snapshot_groups::client::Factory)
5735 }
5736
5737 /// Creates a new client from the provided stub.
5738 ///
5739 /// The most common case for calling this function is in tests mocking the
5740 /// client's behavior.
5741 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5742 where
5743 T: super::stub::InstantSnapshotGroups + 'static,
5744 {
5745 Self { inner: stub.into() }
5746 }
5747
5748 pub(crate) async fn new(
5749 config: gaxi::options::ClientConfig,
5750 ) -> crate::ClientBuilderResult<Self> {
5751 let inner = Self::build_inner(config).await?;
5752 Ok(Self { inner })
5753 }
5754
5755 async fn build_inner(
5756 conf: gaxi::options::ClientConfig,
5757 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstantSnapshotGroups>>
5758 {
5759 if gaxi::options::tracing_enabled(&conf) {
5760 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5761 }
5762 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5763 }
5764
5765 async fn build_transport(
5766 conf: gaxi::options::ClientConfig,
5767 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshotGroups> {
5768 super::transport::InstantSnapshotGroups::new(conf).await
5769 }
5770
5771 async fn build_with_tracing(
5772 conf: gaxi::options::ClientConfig,
5773 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshotGroups> {
5774 Self::build_transport(conf)
5775 .await
5776 .map(super::tracing::InstantSnapshotGroups::new)
5777 }
5778
5779 /// deletes a Zonal InstantSnapshotGroup resource
5780 pub fn delete(&self) -> super::builder::instant_snapshot_groups::Delete {
5781 super::builder::instant_snapshot_groups::Delete::new(self.inner.clone())
5782 }
5783
5784 /// returns the specified InstantSnapshotGroup resource in the specified zone.
5785 pub fn get(&self) -> super::builder::instant_snapshot_groups::Get {
5786 super::builder::instant_snapshot_groups::Get::new(self.inner.clone())
5787 }
5788
5789 /// Gets the access control policy for a resource. May be empty if no such
5790 /// policy or resource exists.
5791 pub fn get_iam_policy(&self) -> super::builder::instant_snapshot_groups::GetIamPolicy {
5792 super::builder::instant_snapshot_groups::GetIamPolicy::new(self.inner.clone())
5793 }
5794
5795 /// inserts a Zonal InstantSnapshotGroup resource
5796 pub fn insert(&self) -> super::builder::instant_snapshot_groups::Insert {
5797 super::builder::instant_snapshot_groups::Insert::new(self.inner.clone())
5798 }
5799
5800 /// retrieves the list of InstantSnapshotGroup resources contained within
5801 /// the specified zone.
5802 pub fn list(&self) -> super::builder::instant_snapshot_groups::List {
5803 super::builder::instant_snapshot_groups::List::new(self.inner.clone())
5804 }
5805
5806 /// Sets the access control policy on the specified resource.
5807 /// Replaces any existing policy.
5808 pub fn set_iam_policy(&self) -> super::builder::instant_snapshot_groups::SetIamPolicy {
5809 super::builder::instant_snapshot_groups::SetIamPolicy::new(self.inner.clone())
5810 }
5811
5812 /// Returns permissions that a caller has on the specified resource.
5813 pub fn test_iam_permissions(
5814 &self,
5815 ) -> super::builder::instant_snapshot_groups::TestIamPermissions {
5816 super::builder::instant_snapshot_groups::TestIamPermissions::new(self.inner.clone())
5817 }
5818
5819 /// Retrieves the specified zone-specific Operations resource.
5820 pub fn get_operation(&self) -> super::builder::instant_snapshot_groups::GetOperation {
5821 super::builder::instant_snapshot_groups::GetOperation::new(self.inner.clone())
5822 }
5823}
5824
5825/// Implements a client for the Google Compute Engine API.
5826///
5827/// # Example
5828/// ```
5829/// # use google_cloud_compute_v1::client::InstantSnapshots;
5830/// async fn sample(
5831/// ) -> anyhow::Result<()> {
5832/// let client = InstantSnapshots::builder().build().await?;
5833/// // use `client` to make requests to the Google Compute Engine API.
5834/// Ok(())
5835/// }
5836/// ```
5837///
5838/// # Service Description
5839///
5840/// Service for the `instantSnapshots` resource.
5841///
5842/// # Configuration
5843///
5844/// To configure `InstantSnapshots` use the `with_*` methods in the type returned
5845/// by [builder()][InstantSnapshots::builder]. The default configuration should
5846/// work for most applications. Common configuration changes include
5847///
5848/// * [with_endpoint()]: by default this client uses the global default endpoint
5849/// (`https://compute.googleapis.com`). Applications using regional
5850/// endpoints or running in restricted networks (e.g. a network configured
5851/// with [Private Google Access with VPC Service Controls]) may want to
5852/// override this default.
5853/// * [with_credentials()]: by default this client uses
5854/// [Application Default Credentials]. Applications using custom
5855/// authentication may need to override this default.
5856///
5857/// [with_endpoint()]: super::builder::instant_snapshots::ClientBuilder::with_endpoint
5858/// [with_credentials()]: super::builder::instant_snapshots::ClientBuilder::with_credentials
5859/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5860/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5861///
5862/// # Pooling and Cloning
5863///
5864/// `InstantSnapshots` holds a connection pool internally, it is advised to
5865/// create one and reuse it. You do not need to wrap `InstantSnapshots` in
5866/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5867/// already uses an `Arc` internally.
5868#[cfg(feature = "instant-snapshots")]
5869#[cfg_attr(docsrs, doc(cfg(feature = "instant-snapshots")))]
5870#[derive(Clone, Debug)]
5871pub struct InstantSnapshots {
5872 inner: std::sync::Arc<dyn super::stub::dynamic::InstantSnapshots>,
5873}
5874
5875#[cfg(feature = "instant-snapshots")]
5876impl InstantSnapshots {
5877 /// Returns a builder for [InstantSnapshots].
5878 ///
5879 /// ```
5880 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5881 /// # use google_cloud_compute_v1::client::InstantSnapshots;
5882 /// let client = InstantSnapshots::builder().build().await?;
5883 /// # Ok(()) }
5884 /// ```
5885 pub fn builder() -> super::builder::instant_snapshots::ClientBuilder {
5886 crate::new_client_builder(super::builder::instant_snapshots::client::Factory)
5887 }
5888
5889 /// Creates a new client from the provided stub.
5890 ///
5891 /// The most common case for calling this function is in tests mocking the
5892 /// client's behavior.
5893 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5894 where
5895 T: super::stub::InstantSnapshots + 'static,
5896 {
5897 Self { inner: stub.into() }
5898 }
5899
5900 pub(crate) async fn new(
5901 config: gaxi::options::ClientConfig,
5902 ) -> crate::ClientBuilderResult<Self> {
5903 let inner = Self::build_inner(config).await?;
5904 Ok(Self { inner })
5905 }
5906
5907 async fn build_inner(
5908 conf: gaxi::options::ClientConfig,
5909 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstantSnapshots>>
5910 {
5911 if gaxi::options::tracing_enabled(&conf) {
5912 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5913 }
5914 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5915 }
5916
5917 async fn build_transport(
5918 conf: gaxi::options::ClientConfig,
5919 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshots> {
5920 super::transport::InstantSnapshots::new(conf).await
5921 }
5922
5923 async fn build_with_tracing(
5924 conf: gaxi::options::ClientConfig,
5925 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshots> {
5926 Self::build_transport(conf)
5927 .await
5928 .map(super::tracing::InstantSnapshots::new)
5929 }
5930
5931 /// Retrieves an aggregated list of instantSnapshots.
5932 ///
5933 /// To prevent failure, Google recommends that you set the
5934 /// `returnPartialSuccess` parameter to `true`.
5935 pub fn aggregated_list(&self) -> super::builder::instant_snapshots::AggregatedList {
5936 super::builder::instant_snapshots::AggregatedList::new(self.inner.clone())
5937 }
5938
5939 /// Deletes the specified InstantSnapshot resource. Keep in mind that deleting
5940 /// a single instantSnapshot might not necessarily delete all the data on that
5941 /// instantSnapshot. If any data on the instantSnapshot that is marked for
5942 /// deletion is needed for subsequent instantSnapshots, the data will be moved
5943 /// to the next corresponding instantSnapshot.
5944 ///
5945 /// For more information, seeDeleting
5946 /// instantSnapshots.
5947 pub fn delete(&self) -> super::builder::instant_snapshots::Delete {
5948 super::builder::instant_snapshots::Delete::new(self.inner.clone())
5949 }
5950
5951 /// Returns the specified InstantSnapshot resource in the specified zone.
5952 pub fn get(&self) -> super::builder::instant_snapshots::Get {
5953 super::builder::instant_snapshots::Get::new(self.inner.clone())
5954 }
5955
5956 /// Gets the access control policy for a resource. May be empty if no such
5957 /// policy or resource exists.
5958 pub fn get_iam_policy(&self) -> super::builder::instant_snapshots::GetIamPolicy {
5959 super::builder::instant_snapshots::GetIamPolicy::new(self.inner.clone())
5960 }
5961
5962 /// Creates an instant snapshot in the specified zone.
5963 pub fn insert(&self) -> super::builder::instant_snapshots::Insert {
5964 super::builder::instant_snapshots::Insert::new(self.inner.clone())
5965 }
5966
5967 /// Retrieves the list of InstantSnapshot resources contained within
5968 /// the specified zone.
5969 pub fn list(&self) -> super::builder::instant_snapshots::List {
5970 super::builder::instant_snapshots::List::new(self.inner.clone())
5971 }
5972
5973 /// Sets the access control policy on the specified resource.
5974 /// Replaces any existing policy.
5975 pub fn set_iam_policy(&self) -> super::builder::instant_snapshots::SetIamPolicy {
5976 super::builder::instant_snapshots::SetIamPolicy::new(self.inner.clone())
5977 }
5978
5979 /// Sets the labels on a instantSnapshot in the given zone. To learn more about
5980 /// labels, read the Labeling
5981 /// Resources documentation.
5982 pub fn set_labels(&self) -> super::builder::instant_snapshots::SetLabels {
5983 super::builder::instant_snapshots::SetLabels::new(self.inner.clone())
5984 }
5985
5986 /// Returns permissions that a caller has on the specified resource.
5987 pub fn test_iam_permissions(&self) -> super::builder::instant_snapshots::TestIamPermissions {
5988 super::builder::instant_snapshots::TestIamPermissions::new(self.inner.clone())
5989 }
5990
5991 /// Retrieves the specified zone-specific Operations resource.
5992 pub fn get_operation(&self) -> super::builder::instant_snapshots::GetOperation {
5993 super::builder::instant_snapshots::GetOperation::new(self.inner.clone())
5994 }
5995}
5996
5997/// Implements a client for the Google Compute Engine API.
5998///
5999/// # Example
6000/// ```
6001/// # use google_cloud_compute_v1::client::InterconnectAttachmentGroups;
6002/// async fn sample(
6003/// ) -> anyhow::Result<()> {
6004/// let client = InterconnectAttachmentGroups::builder().build().await?;
6005/// // use `client` to make requests to the Google Compute Engine API.
6006/// Ok(())
6007/// }
6008/// ```
6009///
6010/// # Service Description
6011///
6012/// Service for the `interconnectAttachmentGroups` resource.
6013///
6014/// # Configuration
6015///
6016/// To configure `InterconnectAttachmentGroups` use the `with_*` methods in the type returned
6017/// by [builder()][InterconnectAttachmentGroups::builder]. The default configuration should
6018/// work for most applications. Common configuration changes include
6019///
6020/// * [with_endpoint()]: by default this client uses the global default endpoint
6021/// (`https://compute.googleapis.com`). Applications using regional
6022/// endpoints or running in restricted networks (e.g. a network configured
6023/// with [Private Google Access with VPC Service Controls]) may want to
6024/// override this default.
6025/// * [with_credentials()]: by default this client uses
6026/// [Application Default Credentials]. Applications using custom
6027/// authentication may need to override this default.
6028///
6029/// [with_endpoint()]: super::builder::interconnect_attachment_groups::ClientBuilder::with_endpoint
6030/// [with_credentials()]: super::builder::interconnect_attachment_groups::ClientBuilder::with_credentials
6031/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6032/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6033///
6034/// # Pooling and Cloning
6035///
6036/// `InterconnectAttachmentGroups` holds a connection pool internally, it is advised to
6037/// create one and reuse it. You do not need to wrap `InterconnectAttachmentGroups` in
6038/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6039/// already uses an `Arc` internally.
6040#[cfg(feature = "interconnect-attachment-groups")]
6041#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-attachment-groups")))]
6042#[derive(Clone, Debug)]
6043pub struct InterconnectAttachmentGroups {
6044 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachmentGroups>,
6045}
6046
6047#[cfg(feature = "interconnect-attachment-groups")]
6048impl InterconnectAttachmentGroups {
6049 /// Returns a builder for [InterconnectAttachmentGroups].
6050 ///
6051 /// ```
6052 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6053 /// # use google_cloud_compute_v1::client::InterconnectAttachmentGroups;
6054 /// let client = InterconnectAttachmentGroups::builder().build().await?;
6055 /// # Ok(()) }
6056 /// ```
6057 pub fn builder() -> super::builder::interconnect_attachment_groups::ClientBuilder {
6058 crate::new_client_builder(super::builder::interconnect_attachment_groups::client::Factory)
6059 }
6060
6061 /// Creates a new client from the provided stub.
6062 ///
6063 /// The most common case for calling this function is in tests mocking the
6064 /// client's behavior.
6065 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6066 where
6067 T: super::stub::InterconnectAttachmentGroups + 'static,
6068 {
6069 Self { inner: stub.into() }
6070 }
6071
6072 pub(crate) async fn new(
6073 config: gaxi::options::ClientConfig,
6074 ) -> crate::ClientBuilderResult<Self> {
6075 let inner = Self::build_inner(config).await?;
6076 Ok(Self { inner })
6077 }
6078
6079 async fn build_inner(
6080 conf: gaxi::options::ClientConfig,
6081 ) -> crate::ClientBuilderResult<
6082 std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachmentGroups>,
6083 > {
6084 if gaxi::options::tracing_enabled(&conf) {
6085 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6086 }
6087 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6088 }
6089
6090 async fn build_transport(
6091 conf: gaxi::options::ClientConfig,
6092 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachmentGroups> {
6093 super::transport::InterconnectAttachmentGroups::new(conf).await
6094 }
6095
6096 async fn build_with_tracing(
6097 conf: gaxi::options::ClientConfig,
6098 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachmentGroups> {
6099 Self::build_transport(conf)
6100 .await
6101 .map(super::tracing::InterconnectAttachmentGroups::new)
6102 }
6103
6104 /// Deletes the specified InterconnectAttachmentGroup in the given scope
6105 pub fn delete(&self) -> super::builder::interconnect_attachment_groups::Delete {
6106 super::builder::interconnect_attachment_groups::Delete::new(self.inner.clone())
6107 }
6108
6109 /// Returns the specified InterconnectAttachmentGroup resource in the given
6110 /// scope.
6111 pub fn get(&self) -> super::builder::interconnect_attachment_groups::Get {
6112 super::builder::interconnect_attachment_groups::Get::new(self.inner.clone())
6113 }
6114
6115 /// Gets the access control policy for a resource. May be empty if no such
6116 /// policy or resource exists.
6117 pub fn get_iam_policy(&self) -> super::builder::interconnect_attachment_groups::GetIamPolicy {
6118 super::builder::interconnect_attachment_groups::GetIamPolicy::new(self.inner.clone())
6119 }
6120
6121 /// Returns the InterconnectAttachmentStatuses for the specified
6122 /// InterconnectAttachmentGroup resource.
6123 pub fn get_operational_status(
6124 &self,
6125 ) -> super::builder::interconnect_attachment_groups::GetOperationalStatus {
6126 super::builder::interconnect_attachment_groups::GetOperationalStatus::new(
6127 self.inner.clone(),
6128 )
6129 }
6130
6131 /// Creates a InterconnectAttachmentGroup in the specified project in the given
6132 /// scope using the parameters that are included in the request.
6133 pub fn insert(&self) -> super::builder::interconnect_attachment_groups::Insert {
6134 super::builder::interconnect_attachment_groups::Insert::new(self.inner.clone())
6135 }
6136
6137 /// Lists the InterconnectAttachmentGroups for a project in the given scope.
6138 pub fn list(&self) -> super::builder::interconnect_attachment_groups::List {
6139 super::builder::interconnect_attachment_groups::List::new(self.inner.clone())
6140 }
6141
6142 /// Patches the specified InterconnectAttachmentGroup resource with the data
6143 /// included in the request. This method supports PATCH
6144 /// semantics and usesJSON merge
6145 /// patch format and processing rules.
6146 pub fn patch(&self) -> super::builder::interconnect_attachment_groups::Patch {
6147 super::builder::interconnect_attachment_groups::Patch::new(self.inner.clone())
6148 }
6149
6150 /// Sets the access control policy on the specified resource.
6151 /// Replaces any existing policy.
6152 pub fn set_iam_policy(&self) -> super::builder::interconnect_attachment_groups::SetIamPolicy {
6153 super::builder::interconnect_attachment_groups::SetIamPolicy::new(self.inner.clone())
6154 }
6155
6156 /// Returns permissions that a caller has on the specified resource.
6157 pub fn test_iam_permissions(
6158 &self,
6159 ) -> super::builder::interconnect_attachment_groups::TestIamPermissions {
6160 super::builder::interconnect_attachment_groups::TestIamPermissions::new(self.inner.clone())
6161 }
6162
6163 /// Retrieves the specified Operations resource.
6164 pub fn get_operation(&self) -> super::builder::interconnect_attachment_groups::GetOperation {
6165 super::builder::interconnect_attachment_groups::GetOperation::new(self.inner.clone())
6166 }
6167}
6168
6169/// Implements a client for the Google Compute Engine API.
6170///
6171/// # Example
6172/// ```
6173/// # use google_cloud_compute_v1::client::InterconnectAttachments;
6174/// async fn sample(
6175/// ) -> anyhow::Result<()> {
6176/// let client = InterconnectAttachments::builder().build().await?;
6177/// // use `client` to make requests to the Google Compute Engine API.
6178/// Ok(())
6179/// }
6180/// ```
6181///
6182/// # Service Description
6183///
6184/// Service for the `interconnectAttachments` resource.
6185///
6186/// # Configuration
6187///
6188/// To configure `InterconnectAttachments` use the `with_*` methods in the type returned
6189/// by [builder()][InterconnectAttachments::builder]. The default configuration should
6190/// work for most applications. Common configuration changes include
6191///
6192/// * [with_endpoint()]: by default this client uses the global default endpoint
6193/// (`https://compute.googleapis.com`). Applications using regional
6194/// endpoints or running in restricted networks (e.g. a network configured
6195/// with [Private Google Access with VPC Service Controls]) may want to
6196/// override this default.
6197/// * [with_credentials()]: by default this client uses
6198/// [Application Default Credentials]. Applications using custom
6199/// authentication may need to override this default.
6200///
6201/// [with_endpoint()]: super::builder::interconnect_attachments::ClientBuilder::with_endpoint
6202/// [with_credentials()]: super::builder::interconnect_attachments::ClientBuilder::with_credentials
6203/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6204/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6205///
6206/// # Pooling and Cloning
6207///
6208/// `InterconnectAttachments` holds a connection pool internally, it is advised to
6209/// create one and reuse it. You do not need to wrap `InterconnectAttachments` in
6210/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6211/// already uses an `Arc` internally.
6212#[cfg(feature = "interconnect-attachments")]
6213#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-attachments")))]
6214#[derive(Clone, Debug)]
6215pub struct InterconnectAttachments {
6216 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachments>,
6217}
6218
6219#[cfg(feature = "interconnect-attachments")]
6220impl InterconnectAttachments {
6221 /// Returns a builder for [InterconnectAttachments].
6222 ///
6223 /// ```
6224 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6225 /// # use google_cloud_compute_v1::client::InterconnectAttachments;
6226 /// let client = InterconnectAttachments::builder().build().await?;
6227 /// # Ok(()) }
6228 /// ```
6229 pub fn builder() -> super::builder::interconnect_attachments::ClientBuilder {
6230 crate::new_client_builder(super::builder::interconnect_attachments::client::Factory)
6231 }
6232
6233 /// Creates a new client from the provided stub.
6234 ///
6235 /// The most common case for calling this function is in tests mocking the
6236 /// client's behavior.
6237 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6238 where
6239 T: super::stub::InterconnectAttachments + 'static,
6240 {
6241 Self { inner: stub.into() }
6242 }
6243
6244 pub(crate) async fn new(
6245 config: gaxi::options::ClientConfig,
6246 ) -> crate::ClientBuilderResult<Self> {
6247 let inner = Self::build_inner(config).await?;
6248 Ok(Self { inner })
6249 }
6250
6251 async fn build_inner(
6252 conf: gaxi::options::ClientConfig,
6253 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachments>>
6254 {
6255 if gaxi::options::tracing_enabled(&conf) {
6256 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6257 }
6258 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6259 }
6260
6261 async fn build_transport(
6262 conf: gaxi::options::ClientConfig,
6263 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachments> {
6264 super::transport::InterconnectAttachments::new(conf).await
6265 }
6266
6267 async fn build_with_tracing(
6268 conf: gaxi::options::ClientConfig,
6269 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachments> {
6270 Self::build_transport(conf)
6271 .await
6272 .map(super::tracing::InterconnectAttachments::new)
6273 }
6274
6275 /// Retrieves an aggregated list of interconnect attachments.
6276 ///
6277 /// To prevent failure, Google recommends that you set the
6278 /// `returnPartialSuccess` parameter to `true`.
6279 pub fn aggregated_list(&self) -> super::builder::interconnect_attachments::AggregatedList {
6280 super::builder::interconnect_attachments::AggregatedList::new(self.inner.clone())
6281 }
6282
6283 /// Deletes the specified interconnect attachment.
6284 pub fn delete(&self) -> super::builder::interconnect_attachments::Delete {
6285 super::builder::interconnect_attachments::Delete::new(self.inner.clone())
6286 }
6287
6288 /// Returns the specified interconnect attachment.
6289 pub fn get(&self) -> super::builder::interconnect_attachments::Get {
6290 super::builder::interconnect_attachments::Get::new(self.inner.clone())
6291 }
6292
6293 /// Creates an InterconnectAttachment in the specified project using the data
6294 /// included in the request.
6295 pub fn insert(&self) -> super::builder::interconnect_attachments::Insert {
6296 super::builder::interconnect_attachments::Insert::new(self.inner.clone())
6297 }
6298
6299 /// Retrieves the list of interconnect attachments contained within
6300 /// the specified region.
6301 pub fn list(&self) -> super::builder::interconnect_attachments::List {
6302 super::builder::interconnect_attachments::List::new(self.inner.clone())
6303 }
6304
6305 /// Updates the specified interconnect attachment with the data included in the
6306 /// request. This method supportsPATCH
6307 /// semantics and uses theJSON merge
6308 /// patch format and processing rules.
6309 pub fn patch(&self) -> super::builder::interconnect_attachments::Patch {
6310 super::builder::interconnect_attachments::Patch::new(self.inner.clone())
6311 }
6312
6313 /// Sets the labels on an InterconnectAttachment. To learn more about labels,
6314 /// read the Labeling
6315 /// Resources documentation.
6316 pub fn set_labels(&self) -> super::builder::interconnect_attachments::SetLabels {
6317 super::builder::interconnect_attachments::SetLabels::new(self.inner.clone())
6318 }
6319
6320 /// Retrieves the specified region-specific Operations resource.
6321 pub fn get_operation(&self) -> super::builder::interconnect_attachments::GetOperation {
6322 super::builder::interconnect_attachments::GetOperation::new(self.inner.clone())
6323 }
6324}
6325
6326/// Implements a client for the Google Compute Engine API.
6327///
6328/// # Example
6329/// ```
6330/// # use google_cloud_compute_v1::client::InterconnectGroups;
6331/// async fn sample(
6332/// ) -> anyhow::Result<()> {
6333/// let client = InterconnectGroups::builder().build().await?;
6334/// // use `client` to make requests to the Google Compute Engine API.
6335/// Ok(())
6336/// }
6337/// ```
6338///
6339/// # Service Description
6340///
6341/// Service for the `interconnectGroups` resource.
6342///
6343/// # Configuration
6344///
6345/// To configure `InterconnectGroups` use the `with_*` methods in the type returned
6346/// by [builder()][InterconnectGroups::builder]. The default configuration should
6347/// work for most applications. Common configuration changes include
6348///
6349/// * [with_endpoint()]: by default this client uses the global default endpoint
6350/// (`https://compute.googleapis.com`). Applications using regional
6351/// endpoints or running in restricted networks (e.g. a network configured
6352/// with [Private Google Access with VPC Service Controls]) may want to
6353/// override this default.
6354/// * [with_credentials()]: by default this client uses
6355/// [Application Default Credentials]. Applications using custom
6356/// authentication may need to override this default.
6357///
6358/// [with_endpoint()]: super::builder::interconnect_groups::ClientBuilder::with_endpoint
6359/// [with_credentials()]: super::builder::interconnect_groups::ClientBuilder::with_credentials
6360/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6361/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6362///
6363/// # Pooling and Cloning
6364///
6365/// `InterconnectGroups` holds a connection pool internally, it is advised to
6366/// create one and reuse it. You do not need to wrap `InterconnectGroups` in
6367/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6368/// already uses an `Arc` internally.
6369#[cfg(feature = "interconnect-groups")]
6370#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-groups")))]
6371#[derive(Clone, Debug)]
6372pub struct InterconnectGroups {
6373 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectGroups>,
6374}
6375
6376#[cfg(feature = "interconnect-groups")]
6377impl InterconnectGroups {
6378 /// Returns a builder for [InterconnectGroups].
6379 ///
6380 /// ```
6381 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6382 /// # use google_cloud_compute_v1::client::InterconnectGroups;
6383 /// let client = InterconnectGroups::builder().build().await?;
6384 /// # Ok(()) }
6385 /// ```
6386 pub fn builder() -> super::builder::interconnect_groups::ClientBuilder {
6387 crate::new_client_builder(super::builder::interconnect_groups::client::Factory)
6388 }
6389
6390 /// Creates a new client from the provided stub.
6391 ///
6392 /// The most common case for calling this function is in tests mocking the
6393 /// client's behavior.
6394 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6395 where
6396 T: super::stub::InterconnectGroups + 'static,
6397 {
6398 Self { inner: stub.into() }
6399 }
6400
6401 pub(crate) async fn new(
6402 config: gaxi::options::ClientConfig,
6403 ) -> crate::ClientBuilderResult<Self> {
6404 let inner = Self::build_inner(config).await?;
6405 Ok(Self { inner })
6406 }
6407
6408 async fn build_inner(
6409 conf: gaxi::options::ClientConfig,
6410 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InterconnectGroups>>
6411 {
6412 if gaxi::options::tracing_enabled(&conf) {
6413 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6414 }
6415 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6416 }
6417
6418 async fn build_transport(
6419 conf: gaxi::options::ClientConfig,
6420 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectGroups> {
6421 super::transport::InterconnectGroups::new(conf).await
6422 }
6423
6424 async fn build_with_tracing(
6425 conf: gaxi::options::ClientConfig,
6426 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectGroups> {
6427 Self::build_transport(conf)
6428 .await
6429 .map(super::tracing::InterconnectGroups::new)
6430 }
6431
6432 /// Create Interconnects with redundancy by creating them in a specified
6433 /// interconnect group.
6434 pub fn create_members(&self) -> super::builder::interconnect_groups::CreateMembers {
6435 super::builder::interconnect_groups::CreateMembers::new(self.inner.clone())
6436 }
6437
6438 /// Deletes the specified InterconnectGroup in the given scope
6439 pub fn delete(&self) -> super::builder::interconnect_groups::Delete {
6440 super::builder::interconnect_groups::Delete::new(self.inner.clone())
6441 }
6442
6443 /// Returns the specified InterconnectGroup resource in the given scope.
6444 pub fn get(&self) -> super::builder::interconnect_groups::Get {
6445 super::builder::interconnect_groups::Get::new(self.inner.clone())
6446 }
6447
6448 /// Gets the access control policy for a resource. May be empty if no such
6449 /// policy or resource exists.
6450 pub fn get_iam_policy(&self) -> super::builder::interconnect_groups::GetIamPolicy {
6451 super::builder::interconnect_groups::GetIamPolicy::new(self.inner.clone())
6452 }
6453
6454 /// Returns the interconnectStatuses for the specified
6455 /// InterconnectGroup.
6456 pub fn get_operational_status(
6457 &self,
6458 ) -> super::builder::interconnect_groups::GetOperationalStatus {
6459 super::builder::interconnect_groups::GetOperationalStatus::new(self.inner.clone())
6460 }
6461
6462 /// Creates a InterconnectGroup in the specified project in the given scope
6463 /// using the parameters that are included in the request.
6464 pub fn insert(&self) -> super::builder::interconnect_groups::Insert {
6465 super::builder::interconnect_groups::Insert::new(self.inner.clone())
6466 }
6467
6468 /// Lists the InterconnectGroups for a project in the given scope.
6469 pub fn list(&self) -> super::builder::interconnect_groups::List {
6470 super::builder::interconnect_groups::List::new(self.inner.clone())
6471 }
6472
6473 /// Patches the specified InterconnectGroup resource with the data included in
6474 /// the request. This method supports PATCH
6475 /// semantics and usesJSON merge
6476 /// patch format and processing rules.
6477 pub fn patch(&self) -> super::builder::interconnect_groups::Patch {
6478 super::builder::interconnect_groups::Patch::new(self.inner.clone())
6479 }
6480
6481 /// Sets the access control policy on the specified resource.
6482 /// Replaces any existing policy.
6483 pub fn set_iam_policy(&self) -> super::builder::interconnect_groups::SetIamPolicy {
6484 super::builder::interconnect_groups::SetIamPolicy::new(self.inner.clone())
6485 }
6486
6487 /// Returns permissions that a caller has on the specified resource.
6488 pub fn test_iam_permissions(&self) -> super::builder::interconnect_groups::TestIamPermissions {
6489 super::builder::interconnect_groups::TestIamPermissions::new(self.inner.clone())
6490 }
6491
6492 /// Retrieves the specified Operations resource.
6493 pub fn get_operation(&self) -> super::builder::interconnect_groups::GetOperation {
6494 super::builder::interconnect_groups::GetOperation::new(self.inner.clone())
6495 }
6496}
6497
6498/// Implements a client for the Google Compute Engine API.
6499///
6500/// # Example
6501/// ```
6502/// # use google_cloud_compute_v1::client::InterconnectLocations;
6503/// async fn sample(
6504/// ) -> anyhow::Result<()> {
6505/// let client = InterconnectLocations::builder().build().await?;
6506/// // use `client` to make requests to the Google Compute Engine API.
6507/// Ok(())
6508/// }
6509/// ```
6510///
6511/// # Service Description
6512///
6513/// Service for the `interconnectLocations` resource.
6514///
6515/// # Configuration
6516///
6517/// To configure `InterconnectLocations` use the `with_*` methods in the type returned
6518/// by [builder()][InterconnectLocations::builder]. The default configuration should
6519/// work for most applications. Common configuration changes include
6520///
6521/// * [with_endpoint()]: by default this client uses the global default endpoint
6522/// (`https://compute.googleapis.com`). Applications using regional
6523/// endpoints or running in restricted networks (e.g. a network configured
6524/// with [Private Google Access with VPC Service Controls]) may want to
6525/// override this default.
6526/// * [with_credentials()]: by default this client uses
6527/// [Application Default Credentials]. Applications using custom
6528/// authentication may need to override this default.
6529///
6530/// [with_endpoint()]: super::builder::interconnect_locations::ClientBuilder::with_endpoint
6531/// [with_credentials()]: super::builder::interconnect_locations::ClientBuilder::with_credentials
6532/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6533/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6534///
6535/// # Pooling and Cloning
6536///
6537/// `InterconnectLocations` holds a connection pool internally, it is advised to
6538/// create one and reuse it. You do not need to wrap `InterconnectLocations` in
6539/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6540/// already uses an `Arc` internally.
6541#[cfg(feature = "interconnect-locations")]
6542#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-locations")))]
6543#[derive(Clone, Debug)]
6544pub struct InterconnectLocations {
6545 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectLocations>,
6546}
6547
6548#[cfg(feature = "interconnect-locations")]
6549impl InterconnectLocations {
6550 /// Returns a builder for [InterconnectLocations].
6551 ///
6552 /// ```
6553 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6554 /// # use google_cloud_compute_v1::client::InterconnectLocations;
6555 /// let client = InterconnectLocations::builder().build().await?;
6556 /// # Ok(()) }
6557 /// ```
6558 pub fn builder() -> super::builder::interconnect_locations::ClientBuilder {
6559 crate::new_client_builder(super::builder::interconnect_locations::client::Factory)
6560 }
6561
6562 /// Creates a new client from the provided stub.
6563 ///
6564 /// The most common case for calling this function is in tests mocking the
6565 /// client's behavior.
6566 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6567 where
6568 T: super::stub::InterconnectLocations + 'static,
6569 {
6570 Self { inner: stub.into() }
6571 }
6572
6573 pub(crate) async fn new(
6574 config: gaxi::options::ClientConfig,
6575 ) -> crate::ClientBuilderResult<Self> {
6576 let inner = Self::build_inner(config).await?;
6577 Ok(Self { inner })
6578 }
6579
6580 async fn build_inner(
6581 conf: gaxi::options::ClientConfig,
6582 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InterconnectLocations>>
6583 {
6584 if gaxi::options::tracing_enabled(&conf) {
6585 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6586 }
6587 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6588 }
6589
6590 async fn build_transport(
6591 conf: gaxi::options::ClientConfig,
6592 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectLocations> {
6593 super::transport::InterconnectLocations::new(conf).await
6594 }
6595
6596 async fn build_with_tracing(
6597 conf: gaxi::options::ClientConfig,
6598 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectLocations> {
6599 Self::build_transport(conf)
6600 .await
6601 .map(super::tracing::InterconnectLocations::new)
6602 }
6603
6604 /// Returns the details for the specified interconnect location. Gets a list of
6605 /// available interconnect locations by making a list() request.
6606 pub fn get(&self) -> super::builder::interconnect_locations::Get {
6607 super::builder::interconnect_locations::Get::new(self.inner.clone())
6608 }
6609
6610 /// Retrieves the list of interconnect locations available to the specified
6611 /// project.
6612 pub fn list(&self) -> super::builder::interconnect_locations::List {
6613 super::builder::interconnect_locations::List::new(self.inner.clone())
6614 }
6615}
6616
6617/// Implements a client for the Google Compute Engine API.
6618///
6619/// # Example
6620/// ```
6621/// # use google_cloud_compute_v1::client::InterconnectRemoteLocations;
6622/// async fn sample(
6623/// ) -> anyhow::Result<()> {
6624/// let client = InterconnectRemoteLocations::builder().build().await?;
6625/// // use `client` to make requests to the Google Compute Engine API.
6626/// Ok(())
6627/// }
6628/// ```
6629///
6630/// # Service Description
6631///
6632/// Service for the `interconnectRemoteLocations` resource.
6633///
6634/// # Configuration
6635///
6636/// To configure `InterconnectRemoteLocations` use the `with_*` methods in the type returned
6637/// by [builder()][InterconnectRemoteLocations::builder]. The default configuration should
6638/// work for most applications. Common configuration changes include
6639///
6640/// * [with_endpoint()]: by default this client uses the global default endpoint
6641/// (`https://compute.googleapis.com`). Applications using regional
6642/// endpoints or running in restricted networks (e.g. a network configured
6643/// with [Private Google Access with VPC Service Controls]) may want to
6644/// override this default.
6645/// * [with_credentials()]: by default this client uses
6646/// [Application Default Credentials]. Applications using custom
6647/// authentication may need to override this default.
6648///
6649/// [with_endpoint()]: super::builder::interconnect_remote_locations::ClientBuilder::with_endpoint
6650/// [with_credentials()]: super::builder::interconnect_remote_locations::ClientBuilder::with_credentials
6651/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6652/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6653///
6654/// # Pooling and Cloning
6655///
6656/// `InterconnectRemoteLocations` holds a connection pool internally, it is advised to
6657/// create one and reuse it. You do not need to wrap `InterconnectRemoteLocations` in
6658/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6659/// already uses an `Arc` internally.
6660#[cfg(feature = "interconnect-remote-locations")]
6661#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-remote-locations")))]
6662#[derive(Clone, Debug)]
6663pub struct InterconnectRemoteLocations {
6664 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectRemoteLocations>,
6665}
6666
6667#[cfg(feature = "interconnect-remote-locations")]
6668impl InterconnectRemoteLocations {
6669 /// Returns a builder for [InterconnectRemoteLocations].
6670 ///
6671 /// ```
6672 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6673 /// # use google_cloud_compute_v1::client::InterconnectRemoteLocations;
6674 /// let client = InterconnectRemoteLocations::builder().build().await?;
6675 /// # Ok(()) }
6676 /// ```
6677 pub fn builder() -> super::builder::interconnect_remote_locations::ClientBuilder {
6678 crate::new_client_builder(super::builder::interconnect_remote_locations::client::Factory)
6679 }
6680
6681 /// Creates a new client from the provided stub.
6682 ///
6683 /// The most common case for calling this function is in tests mocking the
6684 /// client's behavior.
6685 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6686 where
6687 T: super::stub::InterconnectRemoteLocations + 'static,
6688 {
6689 Self { inner: stub.into() }
6690 }
6691
6692 pub(crate) async fn new(
6693 config: gaxi::options::ClientConfig,
6694 ) -> crate::ClientBuilderResult<Self> {
6695 let inner = Self::build_inner(config).await?;
6696 Ok(Self { inner })
6697 }
6698
6699 async fn build_inner(
6700 conf: gaxi::options::ClientConfig,
6701 ) -> crate::ClientBuilderResult<
6702 std::sync::Arc<dyn super::stub::dynamic::InterconnectRemoteLocations>,
6703 > {
6704 if gaxi::options::tracing_enabled(&conf) {
6705 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6706 }
6707 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6708 }
6709
6710 async fn build_transport(
6711 conf: gaxi::options::ClientConfig,
6712 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectRemoteLocations> {
6713 super::transport::InterconnectRemoteLocations::new(conf).await
6714 }
6715
6716 async fn build_with_tracing(
6717 conf: gaxi::options::ClientConfig,
6718 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectRemoteLocations> {
6719 Self::build_transport(conf)
6720 .await
6721 .map(super::tracing::InterconnectRemoteLocations::new)
6722 }
6723
6724 /// Returns the details for the specified interconnect remote location. Gets a
6725 /// list of available interconnect remote locations by making alist() request.
6726 pub fn get(&self) -> super::builder::interconnect_remote_locations::Get {
6727 super::builder::interconnect_remote_locations::Get::new(self.inner.clone())
6728 }
6729
6730 /// Retrieves the list of interconnect remote locations available to the
6731 /// specified project.
6732 pub fn list(&self) -> super::builder::interconnect_remote_locations::List {
6733 super::builder::interconnect_remote_locations::List::new(self.inner.clone())
6734 }
6735}
6736
6737/// Implements a client for the Google Compute Engine API.
6738///
6739/// # Example
6740/// ```
6741/// # use google_cloud_compute_v1::client::Interconnects;
6742/// async fn sample(
6743/// ) -> anyhow::Result<()> {
6744/// let client = Interconnects::builder().build().await?;
6745/// // use `client` to make requests to the Google Compute Engine API.
6746/// Ok(())
6747/// }
6748/// ```
6749///
6750/// # Service Description
6751///
6752/// Service for the `interconnects` resource.
6753///
6754/// # Configuration
6755///
6756/// To configure `Interconnects` use the `with_*` methods in the type returned
6757/// by [builder()][Interconnects::builder]. The default configuration should
6758/// work for most applications. Common configuration changes include
6759///
6760/// * [with_endpoint()]: by default this client uses the global default endpoint
6761/// (`https://compute.googleapis.com`). Applications using regional
6762/// endpoints or running in restricted networks (e.g. a network configured
6763/// with [Private Google Access with VPC Service Controls]) may want to
6764/// override this default.
6765/// * [with_credentials()]: by default this client uses
6766/// [Application Default Credentials]. Applications using custom
6767/// authentication may need to override this default.
6768///
6769/// [with_endpoint()]: super::builder::interconnects::ClientBuilder::with_endpoint
6770/// [with_credentials()]: super::builder::interconnects::ClientBuilder::with_credentials
6771/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6772/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6773///
6774/// # Pooling and Cloning
6775///
6776/// `Interconnects` holds a connection pool internally, it is advised to
6777/// create one and reuse it. You do not need to wrap `Interconnects` in
6778/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6779/// already uses an `Arc` internally.
6780#[cfg(feature = "interconnects")]
6781#[cfg_attr(docsrs, doc(cfg(feature = "interconnects")))]
6782#[derive(Clone, Debug)]
6783pub struct Interconnects {
6784 inner: std::sync::Arc<dyn super::stub::dynamic::Interconnects>,
6785}
6786
6787#[cfg(feature = "interconnects")]
6788impl Interconnects {
6789 /// Returns a builder for [Interconnects].
6790 ///
6791 /// ```
6792 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6793 /// # use google_cloud_compute_v1::client::Interconnects;
6794 /// let client = Interconnects::builder().build().await?;
6795 /// # Ok(()) }
6796 /// ```
6797 pub fn builder() -> super::builder::interconnects::ClientBuilder {
6798 crate::new_client_builder(super::builder::interconnects::client::Factory)
6799 }
6800
6801 /// Creates a new client from the provided stub.
6802 ///
6803 /// The most common case for calling this function is in tests mocking the
6804 /// client's behavior.
6805 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6806 where
6807 T: super::stub::Interconnects + 'static,
6808 {
6809 Self { inner: stub.into() }
6810 }
6811
6812 pub(crate) async fn new(
6813 config: gaxi::options::ClientConfig,
6814 ) -> crate::ClientBuilderResult<Self> {
6815 let inner = Self::build_inner(config).await?;
6816 Ok(Self { inner })
6817 }
6818
6819 async fn build_inner(
6820 conf: gaxi::options::ClientConfig,
6821 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Interconnects>> {
6822 if gaxi::options::tracing_enabled(&conf) {
6823 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6824 }
6825 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6826 }
6827
6828 async fn build_transport(
6829 conf: gaxi::options::ClientConfig,
6830 ) -> crate::ClientBuilderResult<impl super::stub::Interconnects> {
6831 super::transport::Interconnects::new(conf).await
6832 }
6833
6834 async fn build_with_tracing(
6835 conf: gaxi::options::ClientConfig,
6836 ) -> crate::ClientBuilderResult<impl super::stub::Interconnects> {
6837 Self::build_transport(conf)
6838 .await
6839 .map(super::tracing::Interconnects::new)
6840 }
6841
6842 /// Deletes the specified Interconnect.
6843 pub fn delete(&self) -> super::builder::interconnects::Delete {
6844 super::builder::interconnects::Delete::new(self.inner.clone())
6845 }
6846
6847 /// Returns the specified Interconnect. Get a list of available Interconnects
6848 /// by making a list() request.
6849 pub fn get(&self) -> super::builder::interconnects::Get {
6850 super::builder::interconnects::Get::new(self.inner.clone())
6851 }
6852
6853 /// Returns the interconnectDiagnostics for the specified
6854 /// Interconnect.
6855 ///
6856 /// In the event of a
6857 /// global outage, do not use this API to make decisions about where to
6858 /// redirect your network traffic.
6859 ///
6860 /// Unlike a VLAN attachment, which is regional, a Cloud Interconnect
6861 /// connection is a global resource. A global outage can prevent this
6862 /// API from functioning properly.
6863 pub fn get_diagnostics(&self) -> super::builder::interconnects::GetDiagnostics {
6864 super::builder::interconnects::GetDiagnostics::new(self.inner.clone())
6865 }
6866
6867 /// Returns the interconnectMacsecConfig for the specified
6868 /// Interconnect.
6869 pub fn get_macsec_config(&self) -> super::builder::interconnects::GetMacsecConfig {
6870 super::builder::interconnects::GetMacsecConfig::new(self.inner.clone())
6871 }
6872
6873 /// Creates an Interconnect in the specified project using
6874 /// the data included in the request.
6875 pub fn insert(&self) -> super::builder::interconnects::Insert {
6876 super::builder::interconnects::Insert::new(self.inner.clone())
6877 }
6878
6879 /// Retrieves the list of Interconnects available to the specified project.
6880 pub fn list(&self) -> super::builder::interconnects::List {
6881 super::builder::interconnects::List::new(self.inner.clone())
6882 }
6883
6884 /// Updates the specified Interconnect with the data included in the request.
6885 /// This method supportsPATCH
6886 /// semantics and uses theJSON merge
6887 /// patch format and processing rules.
6888 pub fn patch(&self) -> super::builder::interconnects::Patch {
6889 super::builder::interconnects::Patch::new(self.inner.clone())
6890 }
6891
6892 /// Sets the labels on an Interconnect. To learn more about labels,
6893 /// read the Labeling
6894 /// Resources documentation.
6895 pub fn set_labels(&self) -> super::builder::interconnects::SetLabels {
6896 super::builder::interconnects::SetLabels::new(self.inner.clone())
6897 }
6898
6899 /// Retrieves the specified Operations resource.
6900 pub fn get_operation(&self) -> super::builder::interconnects::GetOperation {
6901 super::builder::interconnects::GetOperation::new(self.inner.clone())
6902 }
6903}
6904
6905/// Implements a client for the Google Compute Engine API.
6906///
6907/// # Example
6908/// ```
6909/// # use google_cloud_compute_v1::client::LicenseCodes;
6910/// async fn sample(
6911/// ) -> anyhow::Result<()> {
6912/// let client = LicenseCodes::builder().build().await?;
6913/// // use `client` to make requests to the Google Compute Engine API.
6914/// Ok(())
6915/// }
6916/// ```
6917///
6918/// # Service Description
6919///
6920/// Service for the `licenseCodes` resource.
6921///
6922/// # Configuration
6923///
6924/// To configure `LicenseCodes` use the `with_*` methods in the type returned
6925/// by [builder()][LicenseCodes::builder]. The default configuration should
6926/// work for most applications. Common configuration changes include
6927///
6928/// * [with_endpoint()]: by default this client uses the global default endpoint
6929/// (`https://compute.googleapis.com`). Applications using regional
6930/// endpoints or running in restricted networks (e.g. a network configured
6931/// with [Private Google Access with VPC Service Controls]) may want to
6932/// override this default.
6933/// * [with_credentials()]: by default this client uses
6934/// [Application Default Credentials]. Applications using custom
6935/// authentication may need to override this default.
6936///
6937/// [with_endpoint()]: super::builder::license_codes::ClientBuilder::with_endpoint
6938/// [with_credentials()]: super::builder::license_codes::ClientBuilder::with_credentials
6939/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6940/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6941///
6942/// # Pooling and Cloning
6943///
6944/// `LicenseCodes` holds a connection pool internally, it is advised to
6945/// create one and reuse it. You do not need to wrap `LicenseCodes` in
6946/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6947/// already uses an `Arc` internally.
6948#[cfg(feature = "license-codes")]
6949#[cfg_attr(docsrs, doc(cfg(feature = "license-codes")))]
6950#[derive(Clone, Debug)]
6951pub struct LicenseCodes {
6952 inner: std::sync::Arc<dyn super::stub::dynamic::LicenseCodes>,
6953}
6954
6955#[cfg(feature = "license-codes")]
6956impl LicenseCodes {
6957 /// Returns a builder for [LicenseCodes].
6958 ///
6959 /// ```
6960 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6961 /// # use google_cloud_compute_v1::client::LicenseCodes;
6962 /// let client = LicenseCodes::builder().build().await?;
6963 /// # Ok(()) }
6964 /// ```
6965 pub fn builder() -> super::builder::license_codes::ClientBuilder {
6966 crate::new_client_builder(super::builder::license_codes::client::Factory)
6967 }
6968
6969 /// Creates a new client from the provided stub.
6970 ///
6971 /// The most common case for calling this function is in tests mocking the
6972 /// client's behavior.
6973 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6974 where
6975 T: super::stub::LicenseCodes + 'static,
6976 {
6977 Self { inner: stub.into() }
6978 }
6979
6980 pub(crate) async fn new(
6981 config: gaxi::options::ClientConfig,
6982 ) -> crate::ClientBuilderResult<Self> {
6983 let inner = Self::build_inner(config).await?;
6984 Ok(Self { inner })
6985 }
6986
6987 async fn build_inner(
6988 conf: gaxi::options::ClientConfig,
6989 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::LicenseCodes>> {
6990 if gaxi::options::tracing_enabled(&conf) {
6991 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6992 }
6993 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6994 }
6995
6996 async fn build_transport(
6997 conf: gaxi::options::ClientConfig,
6998 ) -> crate::ClientBuilderResult<impl super::stub::LicenseCodes> {
6999 super::transport::LicenseCodes::new(conf).await
7000 }
7001
7002 async fn build_with_tracing(
7003 conf: gaxi::options::ClientConfig,
7004 ) -> crate::ClientBuilderResult<impl super::stub::LicenseCodes> {
7005 Self::build_transport(conf)
7006 .await
7007 .map(super::tracing::LicenseCodes::new)
7008 }
7009
7010 /// Return a specified license code. License codes are mirrored across
7011 /// all projects that have permissions to read the License Code.
7012 /// *Caution* This resource is intended
7013 /// for use only by third-party partners who are creatingCloud Marketplace
7014 /// images.
7015 pub fn get(&self) -> super::builder::license_codes::Get {
7016 super::builder::license_codes::Get::new(self.inner.clone())
7017 }
7018
7019 /// Gets the access control policy for a resource. May be empty if no such
7020 /// policy or resource exists.
7021 /// *Caution* This resource is intended
7022 /// for use only by third-party partners who are creatingCloud Marketplace
7023 /// images.
7024 pub fn get_iam_policy(&self) -> super::builder::license_codes::GetIamPolicy {
7025 super::builder::license_codes::GetIamPolicy::new(self.inner.clone())
7026 }
7027
7028 /// Sets the access control policy on the specified resource.
7029 /// Replaces any existing policy.
7030 /// *Caution* This resource is intended
7031 /// for use only by third-party partners who are creatingCloud Marketplace
7032 /// images.
7033 pub fn set_iam_policy(&self) -> super::builder::license_codes::SetIamPolicy {
7034 super::builder::license_codes::SetIamPolicy::new(self.inner.clone())
7035 }
7036
7037 /// Returns permissions that a caller has on the specified resource.
7038 /// *Caution* This resource is intended
7039 /// for use only by third-party partners who are creatingCloud Marketplace
7040 /// images.
7041 pub fn test_iam_permissions(&self) -> super::builder::license_codes::TestIamPermissions {
7042 super::builder::license_codes::TestIamPermissions::new(self.inner.clone())
7043 }
7044}
7045
7046/// Implements a client for the Google Compute Engine API.
7047///
7048/// # Example
7049/// ```
7050/// # use google_cloud_compute_v1::client::Licenses;
7051/// async fn sample(
7052/// ) -> anyhow::Result<()> {
7053/// let client = Licenses::builder().build().await?;
7054/// // use `client` to make requests to the Google Compute Engine API.
7055/// Ok(())
7056/// }
7057/// ```
7058///
7059/// # Service Description
7060///
7061/// Service for the `licenses` resource.
7062///
7063/// # Configuration
7064///
7065/// To configure `Licenses` use the `with_*` methods in the type returned
7066/// by [builder()][Licenses::builder]. The default configuration should
7067/// work for most applications. Common configuration changes include
7068///
7069/// * [with_endpoint()]: by default this client uses the global default endpoint
7070/// (`https://compute.googleapis.com`). Applications using regional
7071/// endpoints or running in restricted networks (e.g. a network configured
7072/// with [Private Google Access with VPC Service Controls]) may want to
7073/// override this default.
7074/// * [with_credentials()]: by default this client uses
7075/// [Application Default Credentials]. Applications using custom
7076/// authentication may need to override this default.
7077///
7078/// [with_endpoint()]: super::builder::licenses::ClientBuilder::with_endpoint
7079/// [with_credentials()]: super::builder::licenses::ClientBuilder::with_credentials
7080/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7081/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7082///
7083/// # Pooling and Cloning
7084///
7085/// `Licenses` holds a connection pool internally, it is advised to
7086/// create one and reuse it. You do not need to wrap `Licenses` in
7087/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7088/// already uses an `Arc` internally.
7089#[cfg(feature = "licenses")]
7090#[cfg_attr(docsrs, doc(cfg(feature = "licenses")))]
7091#[derive(Clone, Debug)]
7092pub struct Licenses {
7093 inner: std::sync::Arc<dyn super::stub::dynamic::Licenses>,
7094}
7095
7096#[cfg(feature = "licenses")]
7097impl Licenses {
7098 /// Returns a builder for [Licenses].
7099 ///
7100 /// ```
7101 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7102 /// # use google_cloud_compute_v1::client::Licenses;
7103 /// let client = Licenses::builder().build().await?;
7104 /// # Ok(()) }
7105 /// ```
7106 pub fn builder() -> super::builder::licenses::ClientBuilder {
7107 crate::new_client_builder(super::builder::licenses::client::Factory)
7108 }
7109
7110 /// Creates a new client from the provided stub.
7111 ///
7112 /// The most common case for calling this function is in tests mocking the
7113 /// client's behavior.
7114 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7115 where
7116 T: super::stub::Licenses + 'static,
7117 {
7118 Self { inner: stub.into() }
7119 }
7120
7121 pub(crate) async fn new(
7122 config: gaxi::options::ClientConfig,
7123 ) -> crate::ClientBuilderResult<Self> {
7124 let inner = Self::build_inner(config).await?;
7125 Ok(Self { inner })
7126 }
7127
7128 async fn build_inner(
7129 conf: gaxi::options::ClientConfig,
7130 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Licenses>> {
7131 if gaxi::options::tracing_enabled(&conf) {
7132 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7133 }
7134 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7135 }
7136
7137 async fn build_transport(
7138 conf: gaxi::options::ClientConfig,
7139 ) -> crate::ClientBuilderResult<impl super::stub::Licenses> {
7140 super::transport::Licenses::new(conf).await
7141 }
7142
7143 async fn build_with_tracing(
7144 conf: gaxi::options::ClientConfig,
7145 ) -> crate::ClientBuilderResult<impl super::stub::Licenses> {
7146 Self::build_transport(conf)
7147 .await
7148 .map(super::tracing::Licenses::new)
7149 }
7150
7151 /// Deletes the specified license.
7152 /// *Caution* This resource is intended
7153 /// for use only by third-party partners who are creatingCloud Marketplace
7154 /// images.
7155 pub fn delete(&self) -> super::builder::licenses::Delete {
7156 super::builder::licenses::Delete::new(self.inner.clone())
7157 }
7158
7159 /// Returns the specified License resource.
7160 /// *Caution* This resource is intended
7161 /// for use only by third-party partners who are creatingCloud Marketplace
7162 /// images.
7163 pub fn get(&self) -> super::builder::licenses::Get {
7164 super::builder::licenses::Get::new(self.inner.clone())
7165 }
7166
7167 /// Gets the access control policy for a resource. May be empty if no such
7168 /// policy or resource exists.
7169 /// *Caution* This resource is intended
7170 /// for use only by third-party partners who are creatingCloud Marketplace
7171 /// images.
7172 pub fn get_iam_policy(&self) -> super::builder::licenses::GetIamPolicy {
7173 super::builder::licenses::GetIamPolicy::new(self.inner.clone())
7174 }
7175
7176 /// Create a License resource in the specified project.
7177 /// *Caution* This resource is intended
7178 /// for use only by third-party partners who are creatingCloud Marketplace
7179 /// images.
7180 pub fn insert(&self) -> super::builder::licenses::Insert {
7181 super::builder::licenses::Insert::new(self.inner.clone())
7182 }
7183
7184 /// Retrieves the list of licenses
7185 /// available in the specified project. This method does not
7186 /// get any licenses that belong to other projects, including licenses attached
7187 /// to publicly-available images, like Debian 9. If you want to get a list of
7188 /// publicly-available licenses, use this method to make a request to the
7189 /// respective image project, such as debian-cloud orwindows-cloud.
7190 /// *Caution* This resource is intended
7191 /// for use only by third-party partners who are creatingCloud Marketplace
7192 /// images.
7193 pub fn list(&self) -> super::builder::licenses::List {
7194 super::builder::licenses::List::new(self.inner.clone())
7195 }
7196
7197 /// Sets the access control policy on the specified resource.
7198 /// Replaces any existing policy.
7199 /// *Caution* This resource is intended
7200 /// for use only by third-party partners who are creatingCloud Marketplace
7201 /// images.
7202 pub fn set_iam_policy(&self) -> super::builder::licenses::SetIamPolicy {
7203 super::builder::licenses::SetIamPolicy::new(self.inner.clone())
7204 }
7205
7206 /// Returns permissions that a caller has on the specified resource.
7207 /// *Caution* This resource is intended
7208 /// for use only by third-party partners who are creatingCloud Marketplace
7209 /// images.
7210 pub fn test_iam_permissions(&self) -> super::builder::licenses::TestIamPermissions {
7211 super::builder::licenses::TestIamPermissions::new(self.inner.clone())
7212 }
7213
7214 /// Updates a License resource in the specified project.
7215 /// *Caution* This resource is intended
7216 /// for use only by third-party partners who are creatingCloud Marketplace
7217 /// images.
7218 pub fn update(&self) -> super::builder::licenses::Update {
7219 super::builder::licenses::Update::new(self.inner.clone())
7220 }
7221
7222 /// Retrieves the specified Operations resource.
7223 pub fn get_operation(&self) -> super::builder::licenses::GetOperation {
7224 super::builder::licenses::GetOperation::new(self.inner.clone())
7225 }
7226}
7227
7228/// Implements a client for the Google Compute Engine API.
7229///
7230/// # Example
7231/// ```
7232/// # use google_cloud_compute_v1::client::MachineImages;
7233/// async fn sample(
7234/// ) -> anyhow::Result<()> {
7235/// let client = MachineImages::builder().build().await?;
7236/// // use `client` to make requests to the Google Compute Engine API.
7237/// Ok(())
7238/// }
7239/// ```
7240///
7241/// # Service Description
7242///
7243/// Service for the `machineImages` resource.
7244///
7245/// # Configuration
7246///
7247/// To configure `MachineImages` use the `with_*` methods in the type returned
7248/// by [builder()][MachineImages::builder]. The default configuration should
7249/// work for most applications. Common configuration changes include
7250///
7251/// * [with_endpoint()]: by default this client uses the global default endpoint
7252/// (`https://compute.googleapis.com`). Applications using regional
7253/// endpoints or running in restricted networks (e.g. a network configured
7254/// with [Private Google Access with VPC Service Controls]) may want to
7255/// override this default.
7256/// * [with_credentials()]: by default this client uses
7257/// [Application Default Credentials]. Applications using custom
7258/// authentication may need to override this default.
7259///
7260/// [with_endpoint()]: super::builder::machine_images::ClientBuilder::with_endpoint
7261/// [with_credentials()]: super::builder::machine_images::ClientBuilder::with_credentials
7262/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7263/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7264///
7265/// # Pooling and Cloning
7266///
7267/// `MachineImages` holds a connection pool internally, it is advised to
7268/// create one and reuse it. You do not need to wrap `MachineImages` in
7269/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7270/// already uses an `Arc` internally.
7271#[cfg(feature = "machine-images")]
7272#[cfg_attr(docsrs, doc(cfg(feature = "machine-images")))]
7273#[derive(Clone, Debug)]
7274pub struct MachineImages {
7275 inner: std::sync::Arc<dyn super::stub::dynamic::MachineImages>,
7276}
7277
7278#[cfg(feature = "machine-images")]
7279impl MachineImages {
7280 /// Returns a builder for [MachineImages].
7281 ///
7282 /// ```
7283 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7284 /// # use google_cloud_compute_v1::client::MachineImages;
7285 /// let client = MachineImages::builder().build().await?;
7286 /// # Ok(()) }
7287 /// ```
7288 pub fn builder() -> super::builder::machine_images::ClientBuilder {
7289 crate::new_client_builder(super::builder::machine_images::client::Factory)
7290 }
7291
7292 /// Creates a new client from the provided stub.
7293 ///
7294 /// The most common case for calling this function is in tests mocking the
7295 /// client's behavior.
7296 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7297 where
7298 T: super::stub::MachineImages + 'static,
7299 {
7300 Self { inner: stub.into() }
7301 }
7302
7303 pub(crate) async fn new(
7304 config: gaxi::options::ClientConfig,
7305 ) -> crate::ClientBuilderResult<Self> {
7306 let inner = Self::build_inner(config).await?;
7307 Ok(Self { inner })
7308 }
7309
7310 async fn build_inner(
7311 conf: gaxi::options::ClientConfig,
7312 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MachineImages>> {
7313 if gaxi::options::tracing_enabled(&conf) {
7314 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7315 }
7316 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7317 }
7318
7319 async fn build_transport(
7320 conf: gaxi::options::ClientConfig,
7321 ) -> crate::ClientBuilderResult<impl super::stub::MachineImages> {
7322 super::transport::MachineImages::new(conf).await
7323 }
7324
7325 async fn build_with_tracing(
7326 conf: gaxi::options::ClientConfig,
7327 ) -> crate::ClientBuilderResult<impl super::stub::MachineImages> {
7328 Self::build_transport(conf)
7329 .await
7330 .map(super::tracing::MachineImages::new)
7331 }
7332
7333 /// Deletes the specified machine image. Deleting a machine image is permanent
7334 /// and cannot be undone.
7335 pub fn delete(&self) -> super::builder::machine_images::Delete {
7336 super::builder::machine_images::Delete::new(self.inner.clone())
7337 }
7338
7339 /// Returns the specified machine image.
7340 pub fn get(&self) -> super::builder::machine_images::Get {
7341 super::builder::machine_images::Get::new(self.inner.clone())
7342 }
7343
7344 /// Gets the access control policy for a resource. May be empty if no such
7345 /// policy or resource exists.
7346 pub fn get_iam_policy(&self) -> super::builder::machine_images::GetIamPolicy {
7347 super::builder::machine_images::GetIamPolicy::new(self.inner.clone())
7348 }
7349
7350 /// Creates a machine image in the specified project using the
7351 /// data that is included in the request. If you are creating a new machine
7352 /// image to update an existing instance, your new machine image should use the
7353 /// same network or, if applicable, the same subnetwork as the original
7354 /// instance.
7355 pub fn insert(&self) -> super::builder::machine_images::Insert {
7356 super::builder::machine_images::Insert::new(self.inner.clone())
7357 }
7358
7359 /// Retrieves a list of machine images that are contained within
7360 /// the specified project.
7361 pub fn list(&self) -> super::builder::machine_images::List {
7362 super::builder::machine_images::List::new(self.inner.clone())
7363 }
7364
7365 /// Sets the access control policy on the specified resource.
7366 /// Replaces any existing policy.
7367 pub fn set_iam_policy(&self) -> super::builder::machine_images::SetIamPolicy {
7368 super::builder::machine_images::SetIamPolicy::new(self.inner.clone())
7369 }
7370
7371 /// Sets the labels on a machine image. To learn more about labels, read theLabeling
7372 /// Resources documentation.
7373 pub fn set_labels(&self) -> super::builder::machine_images::SetLabels {
7374 super::builder::machine_images::SetLabels::new(self.inner.clone())
7375 }
7376
7377 /// Returns permissions that a caller has on the specified resource.
7378 pub fn test_iam_permissions(&self) -> super::builder::machine_images::TestIamPermissions {
7379 super::builder::machine_images::TestIamPermissions::new(self.inner.clone())
7380 }
7381
7382 /// Retrieves the specified Operations resource.
7383 pub fn get_operation(&self) -> super::builder::machine_images::GetOperation {
7384 super::builder::machine_images::GetOperation::new(self.inner.clone())
7385 }
7386}
7387
7388/// Implements a client for the Google Compute Engine API.
7389///
7390/// # Example
7391/// ```
7392/// # use google_cloud_compute_v1::client::MachineTypes;
7393/// async fn sample(
7394/// ) -> anyhow::Result<()> {
7395/// let client = MachineTypes::builder().build().await?;
7396/// // use `client` to make requests to the Google Compute Engine API.
7397/// Ok(())
7398/// }
7399/// ```
7400///
7401/// # Service Description
7402///
7403/// Service for the `machineTypes` resource.
7404///
7405/// # Configuration
7406///
7407/// To configure `MachineTypes` use the `with_*` methods in the type returned
7408/// by [builder()][MachineTypes::builder]. The default configuration should
7409/// work for most applications. Common configuration changes include
7410///
7411/// * [with_endpoint()]: by default this client uses the global default endpoint
7412/// (`https://compute.googleapis.com`). Applications using regional
7413/// endpoints or running in restricted networks (e.g. a network configured
7414/// with [Private Google Access with VPC Service Controls]) may want to
7415/// override this default.
7416/// * [with_credentials()]: by default this client uses
7417/// [Application Default Credentials]. Applications using custom
7418/// authentication may need to override this default.
7419///
7420/// [with_endpoint()]: super::builder::machine_types::ClientBuilder::with_endpoint
7421/// [with_credentials()]: super::builder::machine_types::ClientBuilder::with_credentials
7422/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7423/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7424///
7425/// # Pooling and Cloning
7426///
7427/// `MachineTypes` holds a connection pool internally, it is advised to
7428/// create one and reuse it. You do not need to wrap `MachineTypes` in
7429/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7430/// already uses an `Arc` internally.
7431#[cfg(feature = "machine-types")]
7432#[cfg_attr(docsrs, doc(cfg(feature = "machine-types")))]
7433#[derive(Clone, Debug)]
7434pub struct MachineTypes {
7435 inner: std::sync::Arc<dyn super::stub::dynamic::MachineTypes>,
7436}
7437
7438#[cfg(feature = "machine-types")]
7439impl MachineTypes {
7440 /// Returns a builder for [MachineTypes].
7441 ///
7442 /// ```
7443 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7444 /// # use google_cloud_compute_v1::client::MachineTypes;
7445 /// let client = MachineTypes::builder().build().await?;
7446 /// # Ok(()) }
7447 /// ```
7448 pub fn builder() -> super::builder::machine_types::ClientBuilder {
7449 crate::new_client_builder(super::builder::machine_types::client::Factory)
7450 }
7451
7452 /// Creates a new client from the provided stub.
7453 ///
7454 /// The most common case for calling this function is in tests mocking the
7455 /// client's behavior.
7456 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7457 where
7458 T: super::stub::MachineTypes + 'static,
7459 {
7460 Self { inner: stub.into() }
7461 }
7462
7463 pub(crate) async fn new(
7464 config: gaxi::options::ClientConfig,
7465 ) -> crate::ClientBuilderResult<Self> {
7466 let inner = Self::build_inner(config).await?;
7467 Ok(Self { inner })
7468 }
7469
7470 async fn build_inner(
7471 conf: gaxi::options::ClientConfig,
7472 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MachineTypes>> {
7473 if gaxi::options::tracing_enabled(&conf) {
7474 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7475 }
7476 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7477 }
7478
7479 async fn build_transport(
7480 conf: gaxi::options::ClientConfig,
7481 ) -> crate::ClientBuilderResult<impl super::stub::MachineTypes> {
7482 super::transport::MachineTypes::new(conf).await
7483 }
7484
7485 async fn build_with_tracing(
7486 conf: gaxi::options::ClientConfig,
7487 ) -> crate::ClientBuilderResult<impl super::stub::MachineTypes> {
7488 Self::build_transport(conf)
7489 .await
7490 .map(super::tracing::MachineTypes::new)
7491 }
7492
7493 /// Retrieves an aggregated list of machine types.
7494 ///
7495 /// To prevent failure, Google recommends that you set the
7496 /// `returnPartialSuccess` parameter to `true`.
7497 pub fn aggregated_list(&self) -> super::builder::machine_types::AggregatedList {
7498 super::builder::machine_types::AggregatedList::new(self.inner.clone())
7499 }
7500
7501 /// Returns the specified machine type.
7502 pub fn get(&self) -> super::builder::machine_types::Get {
7503 super::builder::machine_types::Get::new(self.inner.clone())
7504 }
7505
7506 /// Retrieves a list of machine types available to the specified
7507 /// project.
7508 pub fn list(&self) -> super::builder::machine_types::List {
7509 super::builder::machine_types::List::new(self.inner.clone())
7510 }
7511}
7512
7513/// Implements a client for the Google Compute Engine API.
7514///
7515/// # Example
7516/// ```
7517/// # use google_cloud_compute_v1::client::NetworkAttachments;
7518/// async fn sample(
7519/// ) -> anyhow::Result<()> {
7520/// let client = NetworkAttachments::builder().build().await?;
7521/// // use `client` to make requests to the Google Compute Engine API.
7522/// Ok(())
7523/// }
7524/// ```
7525///
7526/// # Service Description
7527///
7528/// Service for the `networkAttachments` resource.
7529///
7530/// # Configuration
7531///
7532/// To configure `NetworkAttachments` use the `with_*` methods in the type returned
7533/// by [builder()][NetworkAttachments::builder]. The default configuration should
7534/// work for most applications. Common configuration changes include
7535///
7536/// * [with_endpoint()]: by default this client uses the global default endpoint
7537/// (`https://compute.googleapis.com`). Applications using regional
7538/// endpoints or running in restricted networks (e.g. a network configured
7539/// with [Private Google Access with VPC Service Controls]) may want to
7540/// override this default.
7541/// * [with_credentials()]: by default this client uses
7542/// [Application Default Credentials]. Applications using custom
7543/// authentication may need to override this default.
7544///
7545/// [with_endpoint()]: super::builder::network_attachments::ClientBuilder::with_endpoint
7546/// [with_credentials()]: super::builder::network_attachments::ClientBuilder::with_credentials
7547/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7548/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7549///
7550/// # Pooling and Cloning
7551///
7552/// `NetworkAttachments` holds a connection pool internally, it is advised to
7553/// create one and reuse it. You do not need to wrap `NetworkAttachments` in
7554/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7555/// already uses an `Arc` internally.
7556#[cfg(feature = "network-attachments")]
7557#[cfg_attr(docsrs, doc(cfg(feature = "network-attachments")))]
7558#[derive(Clone, Debug)]
7559pub struct NetworkAttachments {
7560 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkAttachments>,
7561}
7562
7563#[cfg(feature = "network-attachments")]
7564impl NetworkAttachments {
7565 /// Returns a builder for [NetworkAttachments].
7566 ///
7567 /// ```
7568 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7569 /// # use google_cloud_compute_v1::client::NetworkAttachments;
7570 /// let client = NetworkAttachments::builder().build().await?;
7571 /// # Ok(()) }
7572 /// ```
7573 pub fn builder() -> super::builder::network_attachments::ClientBuilder {
7574 crate::new_client_builder(super::builder::network_attachments::client::Factory)
7575 }
7576
7577 /// Creates a new client from the provided stub.
7578 ///
7579 /// The most common case for calling this function is in tests mocking the
7580 /// client's behavior.
7581 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7582 where
7583 T: super::stub::NetworkAttachments + 'static,
7584 {
7585 Self { inner: stub.into() }
7586 }
7587
7588 pub(crate) async fn new(
7589 config: gaxi::options::ClientConfig,
7590 ) -> crate::ClientBuilderResult<Self> {
7591 let inner = Self::build_inner(config).await?;
7592 Ok(Self { inner })
7593 }
7594
7595 async fn build_inner(
7596 conf: gaxi::options::ClientConfig,
7597 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkAttachments>>
7598 {
7599 if gaxi::options::tracing_enabled(&conf) {
7600 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7601 }
7602 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7603 }
7604
7605 async fn build_transport(
7606 conf: gaxi::options::ClientConfig,
7607 ) -> crate::ClientBuilderResult<impl super::stub::NetworkAttachments> {
7608 super::transport::NetworkAttachments::new(conf).await
7609 }
7610
7611 async fn build_with_tracing(
7612 conf: gaxi::options::ClientConfig,
7613 ) -> crate::ClientBuilderResult<impl super::stub::NetworkAttachments> {
7614 Self::build_transport(conf)
7615 .await
7616 .map(super::tracing::NetworkAttachments::new)
7617 }
7618
7619 /// Retrieves the list of all NetworkAttachment resources,
7620 /// regional and global, available to the specified project.
7621 ///
7622 /// To prevent failure, Google recommends that you set the
7623 /// `returnPartialSuccess` parameter to `true`.
7624 pub fn aggregated_list(&self) -> super::builder::network_attachments::AggregatedList {
7625 super::builder::network_attachments::AggregatedList::new(self.inner.clone())
7626 }
7627
7628 /// Deletes the specified NetworkAttachment in the given scope
7629 pub fn delete(&self) -> super::builder::network_attachments::Delete {
7630 super::builder::network_attachments::Delete::new(self.inner.clone())
7631 }
7632
7633 /// Returns the specified NetworkAttachment resource in the given scope.
7634 pub fn get(&self) -> super::builder::network_attachments::Get {
7635 super::builder::network_attachments::Get::new(self.inner.clone())
7636 }
7637
7638 /// Gets the access control policy for a resource. May be empty if no such
7639 /// policy or resource exists.
7640 pub fn get_iam_policy(&self) -> super::builder::network_attachments::GetIamPolicy {
7641 super::builder::network_attachments::GetIamPolicy::new(self.inner.clone())
7642 }
7643
7644 /// Creates a NetworkAttachment in the specified project in the given scope
7645 /// using the parameters that are included in the request.
7646 pub fn insert(&self) -> super::builder::network_attachments::Insert {
7647 super::builder::network_attachments::Insert::new(self.inner.clone())
7648 }
7649
7650 /// Lists the NetworkAttachments for a project in the given scope.
7651 pub fn list(&self) -> super::builder::network_attachments::List {
7652 super::builder::network_attachments::List::new(self.inner.clone())
7653 }
7654
7655 /// Patches the specified NetworkAttachment resource with the data included in
7656 /// the request. This method supports PATCH
7657 /// semantics and usesJSON merge
7658 /// patch format and processing rules.
7659 pub fn patch(&self) -> super::builder::network_attachments::Patch {
7660 super::builder::network_attachments::Patch::new(self.inner.clone())
7661 }
7662
7663 /// Sets the access control policy on the specified resource.
7664 /// Replaces any existing policy.
7665 pub fn set_iam_policy(&self) -> super::builder::network_attachments::SetIamPolicy {
7666 super::builder::network_attachments::SetIamPolicy::new(self.inner.clone())
7667 }
7668
7669 /// Returns permissions that a caller has on the specified resource.
7670 pub fn test_iam_permissions(&self) -> super::builder::network_attachments::TestIamPermissions {
7671 super::builder::network_attachments::TestIamPermissions::new(self.inner.clone())
7672 }
7673
7674 /// Retrieves the specified region-specific Operations resource.
7675 pub fn get_operation(&self) -> super::builder::network_attachments::GetOperation {
7676 super::builder::network_attachments::GetOperation::new(self.inner.clone())
7677 }
7678}
7679
7680/// Implements a client for the Google Compute Engine API.
7681///
7682/// # Example
7683/// ```
7684/// # use google_cloud_compute_v1::client::NetworkEdgeSecurityServices;
7685/// async fn sample(
7686/// ) -> anyhow::Result<()> {
7687/// let client = NetworkEdgeSecurityServices::builder().build().await?;
7688/// // use `client` to make requests to the Google Compute Engine API.
7689/// Ok(())
7690/// }
7691/// ```
7692///
7693/// # Service Description
7694///
7695/// Service for the `networkEdgeSecurityServices` resource.
7696///
7697/// # Configuration
7698///
7699/// To configure `NetworkEdgeSecurityServices` use the `with_*` methods in the type returned
7700/// by [builder()][NetworkEdgeSecurityServices::builder]. The default configuration should
7701/// work for most applications. Common configuration changes include
7702///
7703/// * [with_endpoint()]: by default this client uses the global default endpoint
7704/// (`https://compute.googleapis.com`). Applications using regional
7705/// endpoints or running in restricted networks (e.g. a network configured
7706/// with [Private Google Access with VPC Service Controls]) may want to
7707/// override this default.
7708/// * [with_credentials()]: by default this client uses
7709/// [Application Default Credentials]. Applications using custom
7710/// authentication may need to override this default.
7711///
7712/// [with_endpoint()]: super::builder::network_edge_security_services::ClientBuilder::with_endpoint
7713/// [with_credentials()]: super::builder::network_edge_security_services::ClientBuilder::with_credentials
7714/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7715/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7716///
7717/// # Pooling and Cloning
7718///
7719/// `NetworkEdgeSecurityServices` holds a connection pool internally, it is advised to
7720/// create one and reuse it. You do not need to wrap `NetworkEdgeSecurityServices` in
7721/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7722/// already uses an `Arc` internally.
7723#[cfg(feature = "network-edge-security-services")]
7724#[cfg_attr(docsrs, doc(cfg(feature = "network-edge-security-services")))]
7725#[derive(Clone, Debug)]
7726pub struct NetworkEdgeSecurityServices {
7727 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkEdgeSecurityServices>,
7728}
7729
7730#[cfg(feature = "network-edge-security-services")]
7731impl NetworkEdgeSecurityServices {
7732 /// Returns a builder for [NetworkEdgeSecurityServices].
7733 ///
7734 /// ```
7735 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7736 /// # use google_cloud_compute_v1::client::NetworkEdgeSecurityServices;
7737 /// let client = NetworkEdgeSecurityServices::builder().build().await?;
7738 /// # Ok(()) }
7739 /// ```
7740 pub fn builder() -> super::builder::network_edge_security_services::ClientBuilder {
7741 crate::new_client_builder(super::builder::network_edge_security_services::client::Factory)
7742 }
7743
7744 /// Creates a new client from the provided stub.
7745 ///
7746 /// The most common case for calling this function is in tests mocking the
7747 /// client's behavior.
7748 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7749 where
7750 T: super::stub::NetworkEdgeSecurityServices + 'static,
7751 {
7752 Self { inner: stub.into() }
7753 }
7754
7755 pub(crate) async fn new(
7756 config: gaxi::options::ClientConfig,
7757 ) -> crate::ClientBuilderResult<Self> {
7758 let inner = Self::build_inner(config).await?;
7759 Ok(Self { inner })
7760 }
7761
7762 async fn build_inner(
7763 conf: gaxi::options::ClientConfig,
7764 ) -> crate::ClientBuilderResult<
7765 std::sync::Arc<dyn super::stub::dynamic::NetworkEdgeSecurityServices>,
7766 > {
7767 if gaxi::options::tracing_enabled(&conf) {
7768 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7769 }
7770 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7771 }
7772
7773 async fn build_transport(
7774 conf: gaxi::options::ClientConfig,
7775 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEdgeSecurityServices> {
7776 super::transport::NetworkEdgeSecurityServices::new(conf).await
7777 }
7778
7779 async fn build_with_tracing(
7780 conf: gaxi::options::ClientConfig,
7781 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEdgeSecurityServices> {
7782 Self::build_transport(conf)
7783 .await
7784 .map(super::tracing::NetworkEdgeSecurityServices::new)
7785 }
7786
7787 /// Retrieves the list of all NetworkEdgeSecurityService resources available to
7788 /// the specified project.
7789 ///
7790 /// To prevent failure, Google recommends that you set the
7791 /// `returnPartialSuccess` parameter to `true`.
7792 pub fn aggregated_list(
7793 &self,
7794 ) -> super::builder::network_edge_security_services::AggregatedList {
7795 super::builder::network_edge_security_services::AggregatedList::new(self.inner.clone())
7796 }
7797
7798 /// Deletes the specified service.
7799 pub fn delete(&self) -> super::builder::network_edge_security_services::Delete {
7800 super::builder::network_edge_security_services::Delete::new(self.inner.clone())
7801 }
7802
7803 /// Gets a specified NetworkEdgeSecurityService.
7804 pub fn get(&self) -> super::builder::network_edge_security_services::Get {
7805 super::builder::network_edge_security_services::Get::new(self.inner.clone())
7806 }
7807
7808 /// Creates a new service in the specified project using the data included in
7809 /// the request.
7810 pub fn insert(&self) -> super::builder::network_edge_security_services::Insert {
7811 super::builder::network_edge_security_services::Insert::new(self.inner.clone())
7812 }
7813
7814 /// Patches the specified policy with the data included in the request.
7815 pub fn patch(&self) -> super::builder::network_edge_security_services::Patch {
7816 super::builder::network_edge_security_services::Patch::new(self.inner.clone())
7817 }
7818
7819 /// Retrieves the specified region-specific Operations resource.
7820 pub fn get_operation(&self) -> super::builder::network_edge_security_services::GetOperation {
7821 super::builder::network_edge_security_services::GetOperation::new(self.inner.clone())
7822 }
7823}
7824
7825/// Implements a client for the Google Compute Engine API.
7826///
7827/// # Example
7828/// ```
7829/// # use google_cloud_compute_v1::client::NetworkEndpointGroups;
7830/// async fn sample(
7831/// ) -> anyhow::Result<()> {
7832/// let client = NetworkEndpointGroups::builder().build().await?;
7833/// // use `client` to make requests to the Google Compute Engine API.
7834/// Ok(())
7835/// }
7836/// ```
7837///
7838/// # Service Description
7839///
7840/// Service for the `networkEndpointGroups` resource.
7841///
7842/// # Configuration
7843///
7844/// To configure `NetworkEndpointGroups` use the `with_*` methods in the type returned
7845/// by [builder()][NetworkEndpointGroups::builder]. The default configuration should
7846/// work for most applications. Common configuration changes include
7847///
7848/// * [with_endpoint()]: by default this client uses the global default endpoint
7849/// (`https://compute.googleapis.com`). Applications using regional
7850/// endpoints or running in restricted networks (e.g. a network configured
7851/// with [Private Google Access with VPC Service Controls]) may want to
7852/// override this default.
7853/// * [with_credentials()]: by default this client uses
7854/// [Application Default Credentials]. Applications using custom
7855/// authentication may need to override this default.
7856///
7857/// [with_endpoint()]: super::builder::network_endpoint_groups::ClientBuilder::with_endpoint
7858/// [with_credentials()]: super::builder::network_endpoint_groups::ClientBuilder::with_credentials
7859/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7860/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7861///
7862/// # Pooling and Cloning
7863///
7864/// `NetworkEndpointGroups` holds a connection pool internally, it is advised to
7865/// create one and reuse it. You do not need to wrap `NetworkEndpointGroups` in
7866/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7867/// already uses an `Arc` internally.
7868#[cfg(feature = "network-endpoint-groups")]
7869#[cfg_attr(docsrs, doc(cfg(feature = "network-endpoint-groups")))]
7870#[derive(Clone, Debug)]
7871pub struct NetworkEndpointGroups {
7872 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkEndpointGroups>,
7873}
7874
7875#[cfg(feature = "network-endpoint-groups")]
7876impl NetworkEndpointGroups {
7877 /// Returns a builder for [NetworkEndpointGroups].
7878 ///
7879 /// ```
7880 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7881 /// # use google_cloud_compute_v1::client::NetworkEndpointGroups;
7882 /// let client = NetworkEndpointGroups::builder().build().await?;
7883 /// # Ok(()) }
7884 /// ```
7885 pub fn builder() -> super::builder::network_endpoint_groups::ClientBuilder {
7886 crate::new_client_builder(super::builder::network_endpoint_groups::client::Factory)
7887 }
7888
7889 /// Creates a new client from the provided stub.
7890 ///
7891 /// The most common case for calling this function is in tests mocking the
7892 /// client's behavior.
7893 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7894 where
7895 T: super::stub::NetworkEndpointGroups + 'static,
7896 {
7897 Self { inner: stub.into() }
7898 }
7899
7900 pub(crate) async fn new(
7901 config: gaxi::options::ClientConfig,
7902 ) -> crate::ClientBuilderResult<Self> {
7903 let inner = Self::build_inner(config).await?;
7904 Ok(Self { inner })
7905 }
7906
7907 async fn build_inner(
7908 conf: gaxi::options::ClientConfig,
7909 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkEndpointGroups>>
7910 {
7911 if gaxi::options::tracing_enabled(&conf) {
7912 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7913 }
7914 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7915 }
7916
7917 async fn build_transport(
7918 conf: gaxi::options::ClientConfig,
7919 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEndpointGroups> {
7920 super::transport::NetworkEndpointGroups::new(conf).await
7921 }
7922
7923 async fn build_with_tracing(
7924 conf: gaxi::options::ClientConfig,
7925 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEndpointGroups> {
7926 Self::build_transport(conf)
7927 .await
7928 .map(super::tracing::NetworkEndpointGroups::new)
7929 }
7930
7931 /// Retrieves the list of network endpoint groups and sorts them by zone.
7932 ///
7933 /// To prevent failure, Google recommends that you set the
7934 /// `returnPartialSuccess` parameter to `true`.
7935 pub fn aggregated_list(&self) -> super::builder::network_endpoint_groups::AggregatedList {
7936 super::builder::network_endpoint_groups::AggregatedList::new(self.inner.clone())
7937 }
7938
7939 /// Attach a list of network endpoints to the specified network endpoint group.
7940 pub fn attach_network_endpoints(
7941 &self,
7942 ) -> super::builder::network_endpoint_groups::AttachNetworkEndpoints {
7943 super::builder::network_endpoint_groups::AttachNetworkEndpoints::new(self.inner.clone())
7944 }
7945
7946 /// Deletes the specified network endpoint group. The network endpoints in the
7947 /// NEG and the VM instances they belong to are not terminated when the NEG is
7948 /// deleted. Note that the NEG cannot be deleted if there are backend services
7949 /// referencing it.
7950 pub fn delete(&self) -> super::builder::network_endpoint_groups::Delete {
7951 super::builder::network_endpoint_groups::Delete::new(self.inner.clone())
7952 }
7953
7954 /// Detach a list of network endpoints from the specified network endpoint
7955 /// group.
7956 pub fn detach_network_endpoints(
7957 &self,
7958 ) -> super::builder::network_endpoint_groups::DetachNetworkEndpoints {
7959 super::builder::network_endpoint_groups::DetachNetworkEndpoints::new(self.inner.clone())
7960 }
7961
7962 /// Returns the specified network endpoint group.
7963 pub fn get(&self) -> super::builder::network_endpoint_groups::Get {
7964 super::builder::network_endpoint_groups::Get::new(self.inner.clone())
7965 }
7966
7967 /// Creates a network endpoint group in the specified project using the
7968 /// parameters that are included in the request.
7969 ///
7970 /// Note: Use the following APIs to manage network endpoint groups:
7971 ///
7972 /// - To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
7973 /// NEGs): zonal
7974 /// API
7975 /// - To manage NEGs with regional scope (such as regional internet NEGs,
7976 /// serverless NEGs, Private Service Connect NEGs): regional
7977 /// API
7978 /// - To manage NEGs with global scope (such as global internet NEGs):global
7979 /// API
7980 pub fn insert(&self) -> super::builder::network_endpoint_groups::Insert {
7981 super::builder::network_endpoint_groups::Insert::new(self.inner.clone())
7982 }
7983
7984 /// Retrieves the list of network endpoint groups that are located in the
7985 /// specified project and zone.
7986 pub fn list(&self) -> super::builder::network_endpoint_groups::List {
7987 super::builder::network_endpoint_groups::List::new(self.inner.clone())
7988 }
7989
7990 /// Lists the network endpoints in the specified network endpoint group.
7991 pub fn list_network_endpoints(
7992 &self,
7993 ) -> super::builder::network_endpoint_groups::ListNetworkEndpoints {
7994 super::builder::network_endpoint_groups::ListNetworkEndpoints::new(self.inner.clone())
7995 }
7996
7997 /// Returns permissions that a caller has on the specified resource.
7998 pub fn test_iam_permissions(
7999 &self,
8000 ) -> super::builder::network_endpoint_groups::TestIamPermissions {
8001 super::builder::network_endpoint_groups::TestIamPermissions::new(self.inner.clone())
8002 }
8003
8004 /// Retrieves the specified zone-specific Operations resource.
8005 pub fn get_operation(&self) -> super::builder::network_endpoint_groups::GetOperation {
8006 super::builder::network_endpoint_groups::GetOperation::new(self.inner.clone())
8007 }
8008}
8009
8010/// Implements a client for the Google Compute Engine API.
8011///
8012/// # Example
8013/// ```
8014/// # use google_cloud_compute_v1::client::NetworkFirewallPolicies;
8015/// async fn sample(
8016/// ) -> anyhow::Result<()> {
8017/// let client = NetworkFirewallPolicies::builder().build().await?;
8018/// // use `client` to make requests to the Google Compute Engine API.
8019/// Ok(())
8020/// }
8021/// ```
8022///
8023/// # Service Description
8024///
8025/// Service for the `networkFirewallPolicies` resource.
8026///
8027/// # Configuration
8028///
8029/// To configure `NetworkFirewallPolicies` use the `with_*` methods in the type returned
8030/// by [builder()][NetworkFirewallPolicies::builder]. The default configuration should
8031/// work for most applications. Common configuration changes include
8032///
8033/// * [with_endpoint()]: by default this client uses the global default endpoint
8034/// (`https://compute.googleapis.com`). Applications using regional
8035/// endpoints or running in restricted networks (e.g. a network configured
8036/// with [Private Google Access with VPC Service Controls]) may want to
8037/// override this default.
8038/// * [with_credentials()]: by default this client uses
8039/// [Application Default Credentials]. Applications using custom
8040/// authentication may need to override this default.
8041///
8042/// [with_endpoint()]: super::builder::network_firewall_policies::ClientBuilder::with_endpoint
8043/// [with_credentials()]: super::builder::network_firewall_policies::ClientBuilder::with_credentials
8044/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8045/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8046///
8047/// # Pooling and Cloning
8048///
8049/// `NetworkFirewallPolicies` holds a connection pool internally, it is advised to
8050/// create one and reuse it. You do not need to wrap `NetworkFirewallPolicies` in
8051/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8052/// already uses an `Arc` internally.
8053#[cfg(feature = "network-firewall-policies")]
8054#[cfg_attr(docsrs, doc(cfg(feature = "network-firewall-policies")))]
8055#[derive(Clone, Debug)]
8056pub struct NetworkFirewallPolicies {
8057 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkFirewallPolicies>,
8058}
8059
8060#[cfg(feature = "network-firewall-policies")]
8061impl NetworkFirewallPolicies {
8062 /// Returns a builder for [NetworkFirewallPolicies].
8063 ///
8064 /// ```
8065 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8066 /// # use google_cloud_compute_v1::client::NetworkFirewallPolicies;
8067 /// let client = NetworkFirewallPolicies::builder().build().await?;
8068 /// # Ok(()) }
8069 /// ```
8070 pub fn builder() -> super::builder::network_firewall_policies::ClientBuilder {
8071 crate::new_client_builder(super::builder::network_firewall_policies::client::Factory)
8072 }
8073
8074 /// Creates a new client from the provided stub.
8075 ///
8076 /// The most common case for calling this function is in tests mocking the
8077 /// client's behavior.
8078 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8079 where
8080 T: super::stub::NetworkFirewallPolicies + 'static,
8081 {
8082 Self { inner: stub.into() }
8083 }
8084
8085 pub(crate) async fn new(
8086 config: gaxi::options::ClientConfig,
8087 ) -> crate::ClientBuilderResult<Self> {
8088 let inner = Self::build_inner(config).await?;
8089 Ok(Self { inner })
8090 }
8091
8092 async fn build_inner(
8093 conf: gaxi::options::ClientConfig,
8094 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkFirewallPolicies>>
8095 {
8096 if gaxi::options::tracing_enabled(&conf) {
8097 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8098 }
8099 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8100 }
8101
8102 async fn build_transport(
8103 conf: gaxi::options::ClientConfig,
8104 ) -> crate::ClientBuilderResult<impl super::stub::NetworkFirewallPolicies> {
8105 super::transport::NetworkFirewallPolicies::new(conf).await
8106 }
8107
8108 async fn build_with_tracing(
8109 conf: gaxi::options::ClientConfig,
8110 ) -> crate::ClientBuilderResult<impl super::stub::NetworkFirewallPolicies> {
8111 Self::build_transport(conf)
8112 .await
8113 .map(super::tracing::NetworkFirewallPolicies::new)
8114 }
8115
8116 /// Inserts an association for the specified firewall policy.
8117 pub fn add_association(&self) -> super::builder::network_firewall_policies::AddAssociation {
8118 super::builder::network_firewall_policies::AddAssociation::new(self.inner.clone())
8119 }
8120
8121 /// Inserts a packet mirroring rule into a firewall policy.
8122 pub fn add_packet_mirroring_rule(
8123 &self,
8124 ) -> super::builder::network_firewall_policies::AddPacketMirroringRule {
8125 super::builder::network_firewall_policies::AddPacketMirroringRule::new(self.inner.clone())
8126 }
8127
8128 /// Inserts a rule into a firewall policy.
8129 pub fn add_rule(&self) -> super::builder::network_firewall_policies::AddRule {
8130 super::builder::network_firewall_policies::AddRule::new(self.inner.clone())
8131 }
8132
8133 /// Retrieves an aggregated list of network firewall policies, listing network
8134 /// firewall policies from all applicable scopes (global and regional) and
8135 /// grouping the results per scope.
8136 ///
8137 /// To prevent failure, it is recommended that you set the
8138 /// `returnPartialSuccess` parameter to `true`.
8139 pub fn aggregated_list(&self) -> super::builder::network_firewall_policies::AggregatedList {
8140 super::builder::network_firewall_policies::AggregatedList::new(self.inner.clone())
8141 }
8142
8143 /// Copies rules to the specified firewall policy.
8144 pub fn clone_rules(&self) -> super::builder::network_firewall_policies::CloneRules {
8145 super::builder::network_firewall_policies::CloneRules::new(self.inner.clone())
8146 }
8147
8148 /// Deletes the specified policy.
8149 pub fn delete(&self) -> super::builder::network_firewall_policies::Delete {
8150 super::builder::network_firewall_policies::Delete::new(self.inner.clone())
8151 }
8152
8153 /// Returns the specified network firewall policy.
8154 pub fn get(&self) -> super::builder::network_firewall_policies::Get {
8155 super::builder::network_firewall_policies::Get::new(self.inner.clone())
8156 }
8157
8158 /// Gets an association with the specified name.
8159 pub fn get_association(&self) -> super::builder::network_firewall_policies::GetAssociation {
8160 super::builder::network_firewall_policies::GetAssociation::new(self.inner.clone())
8161 }
8162
8163 /// Gets the access control policy for a resource. May be empty if no such
8164 /// policy or resource exists.
8165 pub fn get_iam_policy(&self) -> super::builder::network_firewall_policies::GetIamPolicy {
8166 super::builder::network_firewall_policies::GetIamPolicy::new(self.inner.clone())
8167 }
8168
8169 /// Gets a packet mirroring rule of the specified priority.
8170 pub fn get_packet_mirroring_rule(
8171 &self,
8172 ) -> super::builder::network_firewall_policies::GetPacketMirroringRule {
8173 super::builder::network_firewall_policies::GetPacketMirroringRule::new(self.inner.clone())
8174 }
8175
8176 /// Gets a rule of the specified priority.
8177 pub fn get_rule(&self) -> super::builder::network_firewall_policies::GetRule {
8178 super::builder::network_firewall_policies::GetRule::new(self.inner.clone())
8179 }
8180
8181 /// Creates a new policy in the specified project using the data included in
8182 /// the request.
8183 pub fn insert(&self) -> super::builder::network_firewall_policies::Insert {
8184 super::builder::network_firewall_policies::Insert::new(self.inner.clone())
8185 }
8186
8187 /// Lists all the policies that have been configured for the specified project.
8188 pub fn list(&self) -> super::builder::network_firewall_policies::List {
8189 super::builder::network_firewall_policies::List::new(self.inner.clone())
8190 }
8191
8192 /// Patches the specified policy with the data included in the request.
8193 pub fn patch(&self) -> super::builder::network_firewall_policies::Patch {
8194 super::builder::network_firewall_policies::Patch::new(self.inner.clone())
8195 }
8196
8197 /// Patches a packet mirroring rule of the specified priority.
8198 pub fn patch_packet_mirroring_rule(
8199 &self,
8200 ) -> super::builder::network_firewall_policies::PatchPacketMirroringRule {
8201 super::builder::network_firewall_policies::PatchPacketMirroringRule::new(self.inner.clone())
8202 }
8203
8204 /// Patches a rule of the specified priority.
8205 pub fn patch_rule(&self) -> super::builder::network_firewall_policies::PatchRule {
8206 super::builder::network_firewall_policies::PatchRule::new(self.inner.clone())
8207 }
8208
8209 /// Removes an association for the specified firewall policy.
8210 pub fn remove_association(
8211 &self,
8212 ) -> super::builder::network_firewall_policies::RemoveAssociation {
8213 super::builder::network_firewall_policies::RemoveAssociation::new(self.inner.clone())
8214 }
8215
8216 /// Deletes a packet mirroring rule of the specified priority.
8217 pub fn remove_packet_mirroring_rule(
8218 &self,
8219 ) -> super::builder::network_firewall_policies::RemovePacketMirroringRule {
8220 super::builder::network_firewall_policies::RemovePacketMirroringRule::new(
8221 self.inner.clone(),
8222 )
8223 }
8224
8225 /// Deletes a rule of the specified priority.
8226 pub fn remove_rule(&self) -> super::builder::network_firewall_policies::RemoveRule {
8227 super::builder::network_firewall_policies::RemoveRule::new(self.inner.clone())
8228 }
8229
8230 /// Sets the access control policy on the specified resource.
8231 /// Replaces any existing policy.
8232 pub fn set_iam_policy(&self) -> super::builder::network_firewall_policies::SetIamPolicy {
8233 super::builder::network_firewall_policies::SetIamPolicy::new(self.inner.clone())
8234 }
8235
8236 /// Returns permissions that a caller has on the specified resource.
8237 pub fn test_iam_permissions(
8238 &self,
8239 ) -> super::builder::network_firewall_policies::TestIamPermissions {
8240 super::builder::network_firewall_policies::TestIamPermissions::new(self.inner.clone())
8241 }
8242
8243 /// Retrieves the specified Operations resource.
8244 pub fn get_operation(&self) -> super::builder::network_firewall_policies::GetOperation {
8245 super::builder::network_firewall_policies::GetOperation::new(self.inner.clone())
8246 }
8247}
8248
8249/// Implements a client for the Google Compute Engine API.
8250///
8251/// # Example
8252/// ```
8253/// # use google_cloud_compute_v1::client::NetworkProfiles;
8254/// async fn sample(
8255/// ) -> anyhow::Result<()> {
8256/// let client = NetworkProfiles::builder().build().await?;
8257/// // use `client` to make requests to the Google Compute Engine API.
8258/// Ok(())
8259/// }
8260/// ```
8261///
8262/// # Service Description
8263///
8264/// Service for the `networkProfiles` resource.
8265///
8266/// # Configuration
8267///
8268/// To configure `NetworkProfiles` use the `with_*` methods in the type returned
8269/// by [builder()][NetworkProfiles::builder]. The default configuration should
8270/// work for most applications. Common configuration changes include
8271///
8272/// * [with_endpoint()]: by default this client uses the global default endpoint
8273/// (`https://compute.googleapis.com`). Applications using regional
8274/// endpoints or running in restricted networks (e.g. a network configured
8275/// with [Private Google Access with VPC Service Controls]) may want to
8276/// override this default.
8277/// * [with_credentials()]: by default this client uses
8278/// [Application Default Credentials]. Applications using custom
8279/// authentication may need to override this default.
8280///
8281/// [with_endpoint()]: super::builder::network_profiles::ClientBuilder::with_endpoint
8282/// [with_credentials()]: super::builder::network_profiles::ClientBuilder::with_credentials
8283/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8284/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8285///
8286/// # Pooling and Cloning
8287///
8288/// `NetworkProfiles` holds a connection pool internally, it is advised to
8289/// create one and reuse it. You do not need to wrap `NetworkProfiles` in
8290/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8291/// already uses an `Arc` internally.
8292#[cfg(feature = "network-profiles")]
8293#[cfg_attr(docsrs, doc(cfg(feature = "network-profiles")))]
8294#[derive(Clone, Debug)]
8295pub struct NetworkProfiles {
8296 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkProfiles>,
8297}
8298
8299#[cfg(feature = "network-profiles")]
8300impl NetworkProfiles {
8301 /// Returns a builder for [NetworkProfiles].
8302 ///
8303 /// ```
8304 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8305 /// # use google_cloud_compute_v1::client::NetworkProfiles;
8306 /// let client = NetworkProfiles::builder().build().await?;
8307 /// # Ok(()) }
8308 /// ```
8309 pub fn builder() -> super::builder::network_profiles::ClientBuilder {
8310 crate::new_client_builder(super::builder::network_profiles::client::Factory)
8311 }
8312
8313 /// Creates a new client from the provided stub.
8314 ///
8315 /// The most common case for calling this function is in tests mocking the
8316 /// client's behavior.
8317 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8318 where
8319 T: super::stub::NetworkProfiles + 'static,
8320 {
8321 Self { inner: stub.into() }
8322 }
8323
8324 pub(crate) async fn new(
8325 config: gaxi::options::ClientConfig,
8326 ) -> crate::ClientBuilderResult<Self> {
8327 let inner = Self::build_inner(config).await?;
8328 Ok(Self { inner })
8329 }
8330
8331 async fn build_inner(
8332 conf: gaxi::options::ClientConfig,
8333 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkProfiles>> {
8334 if gaxi::options::tracing_enabled(&conf) {
8335 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8336 }
8337 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8338 }
8339
8340 async fn build_transport(
8341 conf: gaxi::options::ClientConfig,
8342 ) -> crate::ClientBuilderResult<impl super::stub::NetworkProfiles> {
8343 super::transport::NetworkProfiles::new(conf).await
8344 }
8345
8346 async fn build_with_tracing(
8347 conf: gaxi::options::ClientConfig,
8348 ) -> crate::ClientBuilderResult<impl super::stub::NetworkProfiles> {
8349 Self::build_transport(conf)
8350 .await
8351 .map(super::tracing::NetworkProfiles::new)
8352 }
8353
8354 /// Returns the specified network profile.
8355 pub fn get(&self) -> super::builder::network_profiles::Get {
8356 super::builder::network_profiles::Get::new(self.inner.clone())
8357 }
8358
8359 /// Retrieves a list of network profiles available to the specified
8360 /// project.
8361 pub fn list(&self) -> super::builder::network_profiles::List {
8362 super::builder::network_profiles::List::new(self.inner.clone())
8363 }
8364}
8365
8366/// Implements a client for the Google Compute Engine API.
8367///
8368/// # Example
8369/// ```
8370/// # use google_cloud_compute_v1::client::Networks;
8371/// async fn sample(
8372/// ) -> anyhow::Result<()> {
8373/// let client = Networks::builder().build().await?;
8374/// // use `client` to make requests to the Google Compute Engine API.
8375/// Ok(())
8376/// }
8377/// ```
8378///
8379/// # Service Description
8380///
8381/// Service for the `networks` resource.
8382///
8383/// # Configuration
8384///
8385/// To configure `Networks` use the `with_*` methods in the type returned
8386/// by [builder()][Networks::builder]. The default configuration should
8387/// work for most applications. Common configuration changes include
8388///
8389/// * [with_endpoint()]: by default this client uses the global default endpoint
8390/// (`https://compute.googleapis.com`). Applications using regional
8391/// endpoints or running in restricted networks (e.g. a network configured
8392/// with [Private Google Access with VPC Service Controls]) may want to
8393/// override this default.
8394/// * [with_credentials()]: by default this client uses
8395/// [Application Default Credentials]. Applications using custom
8396/// authentication may need to override this default.
8397///
8398/// [with_endpoint()]: super::builder::networks::ClientBuilder::with_endpoint
8399/// [with_credentials()]: super::builder::networks::ClientBuilder::with_credentials
8400/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8401/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8402///
8403/// # Pooling and Cloning
8404///
8405/// `Networks` holds a connection pool internally, it is advised to
8406/// create one and reuse it. You do not need to wrap `Networks` in
8407/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8408/// already uses an `Arc` internally.
8409#[cfg(feature = "networks")]
8410#[cfg_attr(docsrs, doc(cfg(feature = "networks")))]
8411#[derive(Clone, Debug)]
8412pub struct Networks {
8413 inner: std::sync::Arc<dyn super::stub::dynamic::Networks>,
8414}
8415
8416#[cfg(feature = "networks")]
8417impl Networks {
8418 /// Returns a builder for [Networks].
8419 ///
8420 /// ```
8421 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8422 /// # use google_cloud_compute_v1::client::Networks;
8423 /// let client = Networks::builder().build().await?;
8424 /// # Ok(()) }
8425 /// ```
8426 pub fn builder() -> super::builder::networks::ClientBuilder {
8427 crate::new_client_builder(super::builder::networks::client::Factory)
8428 }
8429
8430 /// Creates a new client from the provided stub.
8431 ///
8432 /// The most common case for calling this function is in tests mocking the
8433 /// client's behavior.
8434 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8435 where
8436 T: super::stub::Networks + 'static,
8437 {
8438 Self { inner: stub.into() }
8439 }
8440
8441 pub(crate) async fn new(
8442 config: gaxi::options::ClientConfig,
8443 ) -> crate::ClientBuilderResult<Self> {
8444 let inner = Self::build_inner(config).await?;
8445 Ok(Self { inner })
8446 }
8447
8448 async fn build_inner(
8449 conf: gaxi::options::ClientConfig,
8450 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Networks>> {
8451 if gaxi::options::tracing_enabled(&conf) {
8452 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8453 }
8454 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8455 }
8456
8457 async fn build_transport(
8458 conf: gaxi::options::ClientConfig,
8459 ) -> crate::ClientBuilderResult<impl super::stub::Networks> {
8460 super::transport::Networks::new(conf).await
8461 }
8462
8463 async fn build_with_tracing(
8464 conf: gaxi::options::ClientConfig,
8465 ) -> crate::ClientBuilderResult<impl super::stub::Networks> {
8466 Self::build_transport(conf)
8467 .await
8468 .map(super::tracing::Networks::new)
8469 }
8470
8471 /// Adds a peering to the specified network.
8472 pub fn add_peering(&self) -> super::builder::networks::AddPeering {
8473 super::builder::networks::AddPeering::new(self.inner.clone())
8474 }
8475
8476 /// Cancel requests to remove a peering from the specified network. Applicable
8477 /// only for PeeringConnection with update_strategy=CONSENSUS. Cancels a
8478 /// request to remove a peering from the specified network.
8479 pub fn cancel_request_remove_peering(
8480 &self,
8481 ) -> super::builder::networks::CancelRequestRemovePeering {
8482 super::builder::networks::CancelRequestRemovePeering::new(self.inner.clone())
8483 }
8484
8485 /// Deletes the specified network.
8486 pub fn delete(&self) -> super::builder::networks::Delete {
8487 super::builder::networks::Delete::new(self.inner.clone())
8488 }
8489
8490 /// Returns the specified network.
8491 pub fn get(&self) -> super::builder::networks::Get {
8492 super::builder::networks::Get::new(self.inner.clone())
8493 }
8494
8495 /// Returns the effective firewalls on a given network.
8496 pub fn get_effective_firewalls(&self) -> super::builder::networks::GetEffectiveFirewalls {
8497 super::builder::networks::GetEffectiveFirewalls::new(self.inner.clone())
8498 }
8499
8500 /// Creates a network in the specified project using the data included
8501 /// in the request.
8502 pub fn insert(&self) -> super::builder::networks::Insert {
8503 super::builder::networks::Insert::new(self.inner.clone())
8504 }
8505
8506 /// Retrieves the list of networks available to the specified project.
8507 pub fn list(&self) -> super::builder::networks::List {
8508 super::builder::networks::List::new(self.inner.clone())
8509 }
8510
8511 /// Lists the peering routes exchanged over peering connection.
8512 pub fn list_peering_routes(&self) -> super::builder::networks::ListPeeringRoutes {
8513 super::builder::networks::ListPeeringRoutes::new(self.inner.clone())
8514 }
8515
8516 /// Patches the specified network with the data included in the request.
8517 /// Only routingConfig can be modified.
8518 pub fn patch(&self) -> super::builder::networks::Patch {
8519 super::builder::networks::Patch::new(self.inner.clone())
8520 }
8521
8522 /// Removes a peering from the specified network.
8523 pub fn remove_peering(&self) -> super::builder::networks::RemovePeering {
8524 super::builder::networks::RemovePeering::new(self.inner.clone())
8525 }
8526
8527 /// Requests to remove a peering from the specified network. Applicable only
8528 /// for PeeringConnection with update_strategy=CONSENSUS.
8529 pub fn request_remove_peering(&self) -> super::builder::networks::RequestRemovePeering {
8530 super::builder::networks::RequestRemovePeering::new(self.inner.clone())
8531 }
8532
8533 /// Switches the network mode from auto subnet mode to custom subnet mode.
8534 pub fn switch_to_custom_mode(&self) -> super::builder::networks::SwitchToCustomMode {
8535 super::builder::networks::SwitchToCustomMode::new(self.inner.clone())
8536 }
8537
8538 /// Updates the specified network peering with the data included in the
8539 /// request. You can only modify the NetworkPeering.export_custom_routes field
8540 /// and the NetworkPeering.import_custom_routes field.
8541 pub fn update_peering(&self) -> super::builder::networks::UpdatePeering {
8542 super::builder::networks::UpdatePeering::new(self.inner.clone())
8543 }
8544
8545 /// Retrieves the specified Operations resource.
8546 pub fn get_operation(&self) -> super::builder::networks::GetOperation {
8547 super::builder::networks::GetOperation::new(self.inner.clone())
8548 }
8549}
8550
8551/// Implements a client for the Google Compute Engine API.
8552///
8553/// # Example
8554/// ```
8555/// # use google_cloud_compute_v1::client::NodeGroups;
8556/// async fn sample(
8557/// ) -> anyhow::Result<()> {
8558/// let client = NodeGroups::builder().build().await?;
8559/// // use `client` to make requests to the Google Compute Engine API.
8560/// Ok(())
8561/// }
8562/// ```
8563///
8564/// # Service Description
8565///
8566/// Service for the `nodeGroups` resource.
8567///
8568/// # Configuration
8569///
8570/// To configure `NodeGroups` use the `with_*` methods in the type returned
8571/// by [builder()][NodeGroups::builder]. The default configuration should
8572/// work for most applications. Common configuration changes include
8573///
8574/// * [with_endpoint()]: by default this client uses the global default endpoint
8575/// (`https://compute.googleapis.com`). Applications using regional
8576/// endpoints or running in restricted networks (e.g. a network configured
8577/// with [Private Google Access with VPC Service Controls]) may want to
8578/// override this default.
8579/// * [with_credentials()]: by default this client uses
8580/// [Application Default Credentials]. Applications using custom
8581/// authentication may need to override this default.
8582///
8583/// [with_endpoint()]: super::builder::node_groups::ClientBuilder::with_endpoint
8584/// [with_credentials()]: super::builder::node_groups::ClientBuilder::with_credentials
8585/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8586/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8587///
8588/// # Pooling and Cloning
8589///
8590/// `NodeGroups` holds a connection pool internally, it is advised to
8591/// create one and reuse it. You do not need to wrap `NodeGroups` in
8592/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8593/// already uses an `Arc` internally.
8594#[cfg(feature = "node-groups")]
8595#[cfg_attr(docsrs, doc(cfg(feature = "node-groups")))]
8596#[derive(Clone, Debug)]
8597pub struct NodeGroups {
8598 inner: std::sync::Arc<dyn super::stub::dynamic::NodeGroups>,
8599}
8600
8601#[cfg(feature = "node-groups")]
8602impl NodeGroups {
8603 /// Returns a builder for [NodeGroups].
8604 ///
8605 /// ```
8606 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8607 /// # use google_cloud_compute_v1::client::NodeGroups;
8608 /// let client = NodeGroups::builder().build().await?;
8609 /// # Ok(()) }
8610 /// ```
8611 pub fn builder() -> super::builder::node_groups::ClientBuilder {
8612 crate::new_client_builder(super::builder::node_groups::client::Factory)
8613 }
8614
8615 /// Creates a new client from the provided stub.
8616 ///
8617 /// The most common case for calling this function is in tests mocking the
8618 /// client's behavior.
8619 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8620 where
8621 T: super::stub::NodeGroups + 'static,
8622 {
8623 Self { inner: stub.into() }
8624 }
8625
8626 pub(crate) async fn new(
8627 config: gaxi::options::ClientConfig,
8628 ) -> crate::ClientBuilderResult<Self> {
8629 let inner = Self::build_inner(config).await?;
8630 Ok(Self { inner })
8631 }
8632
8633 async fn build_inner(
8634 conf: gaxi::options::ClientConfig,
8635 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeGroups>> {
8636 if gaxi::options::tracing_enabled(&conf) {
8637 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8638 }
8639 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8640 }
8641
8642 async fn build_transport(
8643 conf: gaxi::options::ClientConfig,
8644 ) -> crate::ClientBuilderResult<impl super::stub::NodeGroups> {
8645 super::transport::NodeGroups::new(conf).await
8646 }
8647
8648 async fn build_with_tracing(
8649 conf: gaxi::options::ClientConfig,
8650 ) -> crate::ClientBuilderResult<impl super::stub::NodeGroups> {
8651 Self::build_transport(conf)
8652 .await
8653 .map(super::tracing::NodeGroups::new)
8654 }
8655
8656 /// Adds specified number of nodes to the node group.
8657 pub fn add_nodes(&self) -> super::builder::node_groups::AddNodes {
8658 super::builder::node_groups::AddNodes::new(self.inner.clone())
8659 }
8660
8661 /// Retrieves an aggregated list of node groups.
8662 /// Note: use nodeGroups.listNodes for more details about each group.
8663 ///
8664 /// To prevent failure, Google recommends that you set the
8665 /// `returnPartialSuccess` parameter to `true`.
8666 pub fn aggregated_list(&self) -> super::builder::node_groups::AggregatedList {
8667 super::builder::node_groups::AggregatedList::new(self.inner.clone())
8668 }
8669
8670 /// Deletes the specified NodeGroup resource.
8671 pub fn delete(&self) -> super::builder::node_groups::Delete {
8672 super::builder::node_groups::Delete::new(self.inner.clone())
8673 }
8674
8675 /// Deletes specified nodes from the node group.
8676 pub fn delete_nodes(&self) -> super::builder::node_groups::DeleteNodes {
8677 super::builder::node_groups::DeleteNodes::new(self.inner.clone())
8678 }
8679
8680 /// Returns the specified NodeGroup. Get a list of available NodeGroups
8681 /// by making a list() request.
8682 /// Note: the "nodes" field should not be used. Use nodeGroups.listNodes
8683 /// instead.
8684 pub fn get(&self) -> super::builder::node_groups::Get {
8685 super::builder::node_groups::Get::new(self.inner.clone())
8686 }
8687
8688 /// Gets the access control policy for a resource. May be empty if no such
8689 /// policy or resource exists.
8690 pub fn get_iam_policy(&self) -> super::builder::node_groups::GetIamPolicy {
8691 super::builder::node_groups::GetIamPolicy::new(self.inner.clone())
8692 }
8693
8694 /// Creates a NodeGroup resource in the specified project using the data
8695 /// included in the request.
8696 pub fn insert(&self) -> super::builder::node_groups::Insert {
8697 super::builder::node_groups::Insert::new(self.inner.clone())
8698 }
8699
8700 /// Retrieves a list of node groups available to the specified project.
8701 /// Note: use nodeGroups.listNodes for more details about each group.
8702 pub fn list(&self) -> super::builder::node_groups::List {
8703 super::builder::node_groups::List::new(self.inner.clone())
8704 }
8705
8706 /// Lists nodes in the node group.
8707 pub fn list_nodes(&self) -> super::builder::node_groups::ListNodes {
8708 super::builder::node_groups::ListNodes::new(self.inner.clone())
8709 }
8710
8711 /// Updates the specified node group.
8712 pub fn patch(&self) -> super::builder::node_groups::Patch {
8713 super::builder::node_groups::Patch::new(self.inner.clone())
8714 }
8715
8716 /// Perform maintenance on a subset of nodes in the node group.
8717 pub fn perform_maintenance(&self) -> super::builder::node_groups::PerformMaintenance {
8718 super::builder::node_groups::PerformMaintenance::new(self.inner.clone())
8719 }
8720
8721 /// Sets the access control policy on the specified resource.
8722 /// Replaces any existing policy.
8723 pub fn set_iam_policy(&self) -> super::builder::node_groups::SetIamPolicy {
8724 super::builder::node_groups::SetIamPolicy::new(self.inner.clone())
8725 }
8726
8727 /// Updates the node template of the node group.
8728 pub fn set_node_template(&self) -> super::builder::node_groups::SetNodeTemplate {
8729 super::builder::node_groups::SetNodeTemplate::new(self.inner.clone())
8730 }
8731
8732 /// Simulates maintenance event on specified nodes from the node group.
8733 pub fn simulate_maintenance_event(
8734 &self,
8735 ) -> super::builder::node_groups::SimulateMaintenanceEvent {
8736 super::builder::node_groups::SimulateMaintenanceEvent::new(self.inner.clone())
8737 }
8738
8739 /// Returns permissions that a caller has on the specified resource.
8740 pub fn test_iam_permissions(&self) -> super::builder::node_groups::TestIamPermissions {
8741 super::builder::node_groups::TestIamPermissions::new(self.inner.clone())
8742 }
8743
8744 /// Retrieves the specified zone-specific Operations resource.
8745 pub fn get_operation(&self) -> super::builder::node_groups::GetOperation {
8746 super::builder::node_groups::GetOperation::new(self.inner.clone())
8747 }
8748}
8749
8750/// Implements a client for the Google Compute Engine API.
8751///
8752/// # Example
8753/// ```
8754/// # use google_cloud_compute_v1::client::NodeTemplates;
8755/// async fn sample(
8756/// ) -> anyhow::Result<()> {
8757/// let client = NodeTemplates::builder().build().await?;
8758/// // use `client` to make requests to the Google Compute Engine API.
8759/// Ok(())
8760/// }
8761/// ```
8762///
8763/// # Service Description
8764///
8765/// Service for the `nodeTemplates` resource.
8766///
8767/// # Configuration
8768///
8769/// To configure `NodeTemplates` use the `with_*` methods in the type returned
8770/// by [builder()][NodeTemplates::builder]. The default configuration should
8771/// work for most applications. Common configuration changes include
8772///
8773/// * [with_endpoint()]: by default this client uses the global default endpoint
8774/// (`https://compute.googleapis.com`). Applications using regional
8775/// endpoints or running in restricted networks (e.g. a network configured
8776/// with [Private Google Access with VPC Service Controls]) may want to
8777/// override this default.
8778/// * [with_credentials()]: by default this client uses
8779/// [Application Default Credentials]. Applications using custom
8780/// authentication may need to override this default.
8781///
8782/// [with_endpoint()]: super::builder::node_templates::ClientBuilder::with_endpoint
8783/// [with_credentials()]: super::builder::node_templates::ClientBuilder::with_credentials
8784/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8785/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8786///
8787/// # Pooling and Cloning
8788///
8789/// `NodeTemplates` holds a connection pool internally, it is advised to
8790/// create one and reuse it. You do not need to wrap `NodeTemplates` in
8791/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8792/// already uses an `Arc` internally.
8793#[cfg(feature = "node-templates")]
8794#[cfg_attr(docsrs, doc(cfg(feature = "node-templates")))]
8795#[derive(Clone, Debug)]
8796pub struct NodeTemplates {
8797 inner: std::sync::Arc<dyn super::stub::dynamic::NodeTemplates>,
8798}
8799
8800#[cfg(feature = "node-templates")]
8801impl NodeTemplates {
8802 /// Returns a builder for [NodeTemplates].
8803 ///
8804 /// ```
8805 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8806 /// # use google_cloud_compute_v1::client::NodeTemplates;
8807 /// let client = NodeTemplates::builder().build().await?;
8808 /// # Ok(()) }
8809 /// ```
8810 pub fn builder() -> super::builder::node_templates::ClientBuilder {
8811 crate::new_client_builder(super::builder::node_templates::client::Factory)
8812 }
8813
8814 /// Creates a new client from the provided stub.
8815 ///
8816 /// The most common case for calling this function is in tests mocking the
8817 /// client's behavior.
8818 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8819 where
8820 T: super::stub::NodeTemplates + 'static,
8821 {
8822 Self { inner: stub.into() }
8823 }
8824
8825 pub(crate) async fn new(
8826 config: gaxi::options::ClientConfig,
8827 ) -> crate::ClientBuilderResult<Self> {
8828 let inner = Self::build_inner(config).await?;
8829 Ok(Self { inner })
8830 }
8831
8832 async fn build_inner(
8833 conf: gaxi::options::ClientConfig,
8834 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeTemplates>> {
8835 if gaxi::options::tracing_enabled(&conf) {
8836 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8837 }
8838 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8839 }
8840
8841 async fn build_transport(
8842 conf: gaxi::options::ClientConfig,
8843 ) -> crate::ClientBuilderResult<impl super::stub::NodeTemplates> {
8844 super::transport::NodeTemplates::new(conf).await
8845 }
8846
8847 async fn build_with_tracing(
8848 conf: gaxi::options::ClientConfig,
8849 ) -> crate::ClientBuilderResult<impl super::stub::NodeTemplates> {
8850 Self::build_transport(conf)
8851 .await
8852 .map(super::tracing::NodeTemplates::new)
8853 }
8854
8855 /// Retrieves an aggregated list of node templates.
8856 ///
8857 /// To prevent failure, Google recommends that you set the
8858 /// `returnPartialSuccess` parameter to `true`.
8859 pub fn aggregated_list(&self) -> super::builder::node_templates::AggregatedList {
8860 super::builder::node_templates::AggregatedList::new(self.inner.clone())
8861 }
8862
8863 /// Deletes the specified NodeTemplate resource.
8864 pub fn delete(&self) -> super::builder::node_templates::Delete {
8865 super::builder::node_templates::Delete::new(self.inner.clone())
8866 }
8867
8868 /// Returns the specified node template.
8869 pub fn get(&self) -> super::builder::node_templates::Get {
8870 super::builder::node_templates::Get::new(self.inner.clone())
8871 }
8872
8873 /// Gets the access control policy for a resource. May be empty if no such
8874 /// policy or resource exists.
8875 pub fn get_iam_policy(&self) -> super::builder::node_templates::GetIamPolicy {
8876 super::builder::node_templates::GetIamPolicy::new(self.inner.clone())
8877 }
8878
8879 /// Creates a NodeTemplate resource in the specified project using the data
8880 /// included in the request.
8881 pub fn insert(&self) -> super::builder::node_templates::Insert {
8882 super::builder::node_templates::Insert::new(self.inner.clone())
8883 }
8884
8885 /// Retrieves a list of node templates available to the specified
8886 /// project.
8887 pub fn list(&self) -> super::builder::node_templates::List {
8888 super::builder::node_templates::List::new(self.inner.clone())
8889 }
8890
8891 /// Sets the access control policy on the specified resource.
8892 /// Replaces any existing policy.
8893 pub fn set_iam_policy(&self) -> super::builder::node_templates::SetIamPolicy {
8894 super::builder::node_templates::SetIamPolicy::new(self.inner.clone())
8895 }
8896
8897 /// Returns permissions that a caller has on the specified resource.
8898 pub fn test_iam_permissions(&self) -> super::builder::node_templates::TestIamPermissions {
8899 super::builder::node_templates::TestIamPermissions::new(self.inner.clone())
8900 }
8901
8902 /// Retrieves the specified region-specific Operations resource.
8903 pub fn get_operation(&self) -> super::builder::node_templates::GetOperation {
8904 super::builder::node_templates::GetOperation::new(self.inner.clone())
8905 }
8906}
8907
8908/// Implements a client for the Google Compute Engine API.
8909///
8910/// # Example
8911/// ```
8912/// # use google_cloud_compute_v1::client::NodeTypes;
8913/// async fn sample(
8914/// ) -> anyhow::Result<()> {
8915/// let client = NodeTypes::builder().build().await?;
8916/// // use `client` to make requests to the Google Compute Engine API.
8917/// Ok(())
8918/// }
8919/// ```
8920///
8921/// # Service Description
8922///
8923/// Service for the `nodeTypes` resource.
8924///
8925/// # Configuration
8926///
8927/// To configure `NodeTypes` use the `with_*` methods in the type returned
8928/// by [builder()][NodeTypes::builder]. The default configuration should
8929/// work for most applications. Common configuration changes include
8930///
8931/// * [with_endpoint()]: by default this client uses the global default endpoint
8932/// (`https://compute.googleapis.com`). Applications using regional
8933/// endpoints or running in restricted networks (e.g. a network configured
8934/// with [Private Google Access with VPC Service Controls]) may want to
8935/// override this default.
8936/// * [with_credentials()]: by default this client uses
8937/// [Application Default Credentials]. Applications using custom
8938/// authentication may need to override this default.
8939///
8940/// [with_endpoint()]: super::builder::node_types::ClientBuilder::with_endpoint
8941/// [with_credentials()]: super::builder::node_types::ClientBuilder::with_credentials
8942/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8943/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8944///
8945/// # Pooling and Cloning
8946///
8947/// `NodeTypes` holds a connection pool internally, it is advised to
8948/// create one and reuse it. You do not need to wrap `NodeTypes` in
8949/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8950/// already uses an `Arc` internally.
8951#[cfg(feature = "node-types")]
8952#[cfg_attr(docsrs, doc(cfg(feature = "node-types")))]
8953#[derive(Clone, Debug)]
8954pub struct NodeTypes {
8955 inner: std::sync::Arc<dyn super::stub::dynamic::NodeTypes>,
8956}
8957
8958#[cfg(feature = "node-types")]
8959impl NodeTypes {
8960 /// Returns a builder for [NodeTypes].
8961 ///
8962 /// ```
8963 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8964 /// # use google_cloud_compute_v1::client::NodeTypes;
8965 /// let client = NodeTypes::builder().build().await?;
8966 /// # Ok(()) }
8967 /// ```
8968 pub fn builder() -> super::builder::node_types::ClientBuilder {
8969 crate::new_client_builder(super::builder::node_types::client::Factory)
8970 }
8971
8972 /// Creates a new client from the provided stub.
8973 ///
8974 /// The most common case for calling this function is in tests mocking the
8975 /// client's behavior.
8976 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8977 where
8978 T: super::stub::NodeTypes + 'static,
8979 {
8980 Self { inner: stub.into() }
8981 }
8982
8983 pub(crate) async fn new(
8984 config: gaxi::options::ClientConfig,
8985 ) -> crate::ClientBuilderResult<Self> {
8986 let inner = Self::build_inner(config).await?;
8987 Ok(Self { inner })
8988 }
8989
8990 async fn build_inner(
8991 conf: gaxi::options::ClientConfig,
8992 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeTypes>> {
8993 if gaxi::options::tracing_enabled(&conf) {
8994 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8995 }
8996 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8997 }
8998
8999 async fn build_transport(
9000 conf: gaxi::options::ClientConfig,
9001 ) -> crate::ClientBuilderResult<impl super::stub::NodeTypes> {
9002 super::transport::NodeTypes::new(conf).await
9003 }
9004
9005 async fn build_with_tracing(
9006 conf: gaxi::options::ClientConfig,
9007 ) -> crate::ClientBuilderResult<impl super::stub::NodeTypes> {
9008 Self::build_transport(conf)
9009 .await
9010 .map(super::tracing::NodeTypes::new)
9011 }
9012
9013 /// Retrieves an aggregated list of node types.
9014 ///
9015 /// To prevent failure, Google recommends that you set the
9016 /// `returnPartialSuccess` parameter to `true`.
9017 pub fn aggregated_list(&self) -> super::builder::node_types::AggregatedList {
9018 super::builder::node_types::AggregatedList::new(self.inner.clone())
9019 }
9020
9021 /// Returns the specified node type.
9022 pub fn get(&self) -> super::builder::node_types::Get {
9023 super::builder::node_types::Get::new(self.inner.clone())
9024 }
9025
9026 /// Retrieves a list of node types available to the specified
9027 /// project.
9028 pub fn list(&self) -> super::builder::node_types::List {
9029 super::builder::node_types::List::new(self.inner.clone())
9030 }
9031}
9032
9033/// Implements a client for the Google Compute Engine API.
9034///
9035/// # Example
9036/// ```
9037/// # use google_cloud_compute_v1::client::OrganizationSecurityPolicies;
9038/// async fn sample(
9039/// ) -> anyhow::Result<()> {
9040/// let client = OrganizationSecurityPolicies::builder().build().await?;
9041/// // use `client` to make requests to the Google Compute Engine API.
9042/// Ok(())
9043/// }
9044/// ```
9045///
9046/// # Service Description
9047///
9048/// Service for the `organizationSecurityPolicies` resource.
9049///
9050/// # Configuration
9051///
9052/// To configure `OrganizationSecurityPolicies` use the `with_*` methods in the type returned
9053/// by [builder()][OrganizationSecurityPolicies::builder]. The default configuration should
9054/// work for most applications. Common configuration changes include
9055///
9056/// * [with_endpoint()]: by default this client uses the global default endpoint
9057/// (`https://compute.googleapis.com`). Applications using regional
9058/// endpoints or running in restricted networks (e.g. a network configured
9059/// with [Private Google Access with VPC Service Controls]) may want to
9060/// override this default.
9061/// * [with_credentials()]: by default this client uses
9062/// [Application Default Credentials]. Applications using custom
9063/// authentication may need to override this default.
9064///
9065/// [with_endpoint()]: super::builder::organization_security_policies::ClientBuilder::with_endpoint
9066/// [with_credentials()]: super::builder::organization_security_policies::ClientBuilder::with_credentials
9067/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9068/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9069///
9070/// # Pooling and Cloning
9071///
9072/// `OrganizationSecurityPolicies` holds a connection pool internally, it is advised to
9073/// create one and reuse it. You do not need to wrap `OrganizationSecurityPolicies` in
9074/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9075/// already uses an `Arc` internally.
9076#[cfg(feature = "organization-security-policies")]
9077#[cfg_attr(docsrs, doc(cfg(feature = "organization-security-policies")))]
9078#[derive(Clone, Debug)]
9079pub struct OrganizationSecurityPolicies {
9080 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityPolicies>,
9081}
9082
9083#[cfg(feature = "organization-security-policies")]
9084impl OrganizationSecurityPolicies {
9085 /// Returns a builder for [OrganizationSecurityPolicies].
9086 ///
9087 /// ```
9088 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9089 /// # use google_cloud_compute_v1::client::OrganizationSecurityPolicies;
9090 /// let client = OrganizationSecurityPolicies::builder().build().await?;
9091 /// # Ok(()) }
9092 /// ```
9093 pub fn builder() -> super::builder::organization_security_policies::ClientBuilder {
9094 crate::new_client_builder(super::builder::organization_security_policies::client::Factory)
9095 }
9096
9097 /// Creates a new client from the provided stub.
9098 ///
9099 /// The most common case for calling this function is in tests mocking the
9100 /// client's behavior.
9101 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9102 where
9103 T: super::stub::OrganizationSecurityPolicies + 'static,
9104 {
9105 Self { inner: stub.into() }
9106 }
9107
9108 pub(crate) async fn new(
9109 config: gaxi::options::ClientConfig,
9110 ) -> crate::ClientBuilderResult<Self> {
9111 let inner = Self::build_inner(config).await?;
9112 Ok(Self { inner })
9113 }
9114
9115 async fn build_inner(
9116 conf: gaxi::options::ClientConfig,
9117 ) -> crate::ClientBuilderResult<
9118 std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityPolicies>,
9119 > {
9120 if gaxi::options::tracing_enabled(&conf) {
9121 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9122 }
9123 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9124 }
9125
9126 async fn build_transport(
9127 conf: gaxi::options::ClientConfig,
9128 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityPolicies> {
9129 super::transport::OrganizationSecurityPolicies::new(conf).await
9130 }
9131
9132 async fn build_with_tracing(
9133 conf: gaxi::options::ClientConfig,
9134 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityPolicies> {
9135 Self::build_transport(conf)
9136 .await
9137 .map(super::tracing::OrganizationSecurityPolicies::new)
9138 }
9139
9140 /// Inserts an association for the specified security policy.
9141 ///
9142 /// This has billing implications. Projects in the hierarchy with effective
9143 /// hierarchical security policies will be automatically enrolled into Cloud
9144 /// Armor Enterprise if not already enrolled.
9145 ///
9146 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9147 /// versions of this API were used to modify firewall policies. This usage is
9148 /// now disabled for most organizations. Use firewallPolicies.addAssociation
9149 /// instead.
9150 pub fn add_association(
9151 &self,
9152 ) -> super::builder::organization_security_policies::AddAssociation {
9153 super::builder::organization_security_policies::AddAssociation::new(self.inner.clone())
9154 }
9155
9156 /// Inserts a rule into a security policy.
9157 ///
9158 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9159 /// versions of this API were used to modify firewall policies. This usage is
9160 /// now disabled for most organizations. Use firewallPolicies.addRule instead.
9161 pub fn add_rule(&self) -> super::builder::organization_security_policies::AddRule {
9162 super::builder::organization_security_policies::AddRule::new(self.inner.clone())
9163 }
9164
9165 /// Copies rules to the specified security policy.
9166 ///
9167 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9168 /// versions of this API were used to modify firewall policies. This usage is
9169 /// now disabled for most organizations. Use firewallPolicies.cloneRules
9170 /// instead.
9171 pub fn copy_rules(&self) -> super::builder::organization_security_policies::CopyRules {
9172 super::builder::organization_security_policies::CopyRules::new(self.inner.clone())
9173 }
9174
9175 /// Deletes the specified policy.
9176 ///
9177 /// Use this API to remove Cloud Armor policies. Previously, alpha and beta
9178 /// versions of this API were used to remove firewall policies. This usage is
9179 /// now disabled for most organizations. Use firewallPolicies.delete instead.
9180 pub fn delete(&self) -> super::builder::organization_security_policies::Delete {
9181 super::builder::organization_security_policies::Delete::new(self.inner.clone())
9182 }
9183
9184 /// List all of the ordered rules present in a single specified policy.
9185 ///
9186 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9187 /// versions of this API were used to read firewall policies. This usage is now
9188 /// disabled for most organizations. Use firewallPolicies.get instead.
9189 pub fn get(&self) -> super::builder::organization_security_policies::Get {
9190 super::builder::organization_security_policies::Get::new(self.inner.clone())
9191 }
9192
9193 /// Gets an association with the specified name.
9194 ///
9195 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9196 /// versions of this API were used to read firewall policies. This usage is
9197 /// now disabled for most organizations. Use firewallPolicies.getAssociation
9198 /// instead.
9199 pub fn get_association(
9200 &self,
9201 ) -> super::builder::organization_security_policies::GetAssociation {
9202 super::builder::organization_security_policies::GetAssociation::new(self.inner.clone())
9203 }
9204
9205 /// Gets a rule at the specified priority.
9206 ///
9207 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9208 /// versions of this API were used to read firewall policies. This usage is now
9209 /// disabled for most organizations. Use firewallPolicies.getRule instead.
9210 pub fn get_rule(&self) -> super::builder::organization_security_policies::GetRule {
9211 super::builder::organization_security_policies::GetRule::new(self.inner.clone())
9212 }
9213
9214 /// Creates a new policy in the specified organization using the data included
9215 /// in the request.
9216 ///
9217 /// Use this API to add Cloud Armor policies. Previously, alpha and beta
9218 /// versions of this API were used to add firewall policies. This usage is now
9219 /// disabled for most organizations. Use firewallPolicies.insert instead.
9220 pub fn insert(&self) -> super::builder::organization_security_policies::Insert {
9221 super::builder::organization_security_policies::Insert::new(self.inner.clone())
9222 }
9223
9224 /// List all the policies that have been configured for the specified
9225 /// organization.
9226 ///
9227 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9228 /// versions of this API were used to read firewall policies. This usage is now
9229 /// disabled for most organizations. Use firewallPolicies.list instead.
9230 pub fn list(&self) -> super::builder::organization_security_policies::List {
9231 super::builder::organization_security_policies::List::new(self.inner.clone())
9232 }
9233
9234 /// Lists associations of a specified target, i.e., organization or folder.
9235 ///
9236 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9237 /// versions of this API were used to read firewall policies. This usage is
9238 /// now disabled for most organizations. Use firewallPolicies.listAssociations
9239 /// instead.
9240 pub fn list_associations(
9241 &self,
9242 ) -> super::builder::organization_security_policies::ListAssociations {
9243 super::builder::organization_security_policies::ListAssociations::new(self.inner.clone())
9244 }
9245
9246 /// Gets the current list of preconfigured Web Application Firewall (WAF)
9247 /// expressions.
9248 pub fn list_preconfigured_expression_sets(
9249 &self,
9250 ) -> super::builder::organization_security_policies::ListPreconfiguredExpressionSets {
9251 super::builder::organization_security_policies::ListPreconfiguredExpressionSets::new(
9252 self.inner.clone(),
9253 )
9254 }
9255
9256 /// Moves the specified security policy.
9257 ///
9258 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9259 /// versions of this API were used to modify firewall policies. This usage is
9260 /// now disabled for most organizations. Use firewallPolicies.move instead.
9261 pub fn r#move(&self) -> super::builder::organization_security_policies::Move {
9262 super::builder::organization_security_policies::Move::new(self.inner.clone())
9263 }
9264
9265 /// Patches the specified policy with the data included in the request.
9266 ///
9267 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9268 /// versions of this API were used to modify firewall policies. This usage is
9269 /// now disabled for most organizations. Use firewallPolicies.patch instead.
9270 pub fn patch(&self) -> super::builder::organization_security_policies::Patch {
9271 super::builder::organization_security_policies::Patch::new(self.inner.clone())
9272 }
9273
9274 /// Patches a rule at the specified priority.
9275 ///
9276 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9277 /// versions of this API were used to modify firewall policies. This usage is
9278 /// now disabled for most organizations. Use firewallPolicies.patchRule
9279 /// instead.
9280 pub fn patch_rule(&self) -> super::builder::organization_security_policies::PatchRule {
9281 super::builder::organization_security_policies::PatchRule::new(self.inner.clone())
9282 }
9283
9284 /// Removes an association for the specified security policy.
9285 ///
9286 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9287 /// versions of this API were used to modify firewall policies. This usage is
9288 /// now disabled for most organizations. Use firewallPolicies.removeAssociation
9289 /// instead.
9290 pub fn remove_association(
9291 &self,
9292 ) -> super::builder::organization_security_policies::RemoveAssociation {
9293 super::builder::organization_security_policies::RemoveAssociation::new(self.inner.clone())
9294 }
9295
9296 /// Deletes a rule at the specified priority.
9297 ///
9298 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9299 /// versions of this API were used to modify firewall policies. This usage is
9300 /// now disabled for most organizations. Use firewallPolicies.removeRule
9301 /// instead.
9302 pub fn remove_rule(&self) -> super::builder::organization_security_policies::RemoveRule {
9303 super::builder::organization_security_policies::RemoveRule::new(self.inner.clone())
9304 }
9305
9306 /// Retrieves the specified Operations resource. Gets a list of operations
9307 /// by making a `list()` request.
9308 pub fn get_operation(&self) -> super::builder::organization_security_policies::GetOperation {
9309 super::builder::organization_security_policies::GetOperation::new(self.inner.clone())
9310 }
9311}
9312
9313/// Implements a client for the Google Compute Engine API.
9314///
9315/// # Example
9316/// ```
9317/// # use google_cloud_compute_v1::client::PacketMirrorings;
9318/// async fn sample(
9319/// ) -> anyhow::Result<()> {
9320/// let client = PacketMirrorings::builder().build().await?;
9321/// // use `client` to make requests to the Google Compute Engine API.
9322/// Ok(())
9323/// }
9324/// ```
9325///
9326/// # Service Description
9327///
9328/// Service for the `packetMirrorings` resource.
9329///
9330/// # Configuration
9331///
9332/// To configure `PacketMirrorings` use the `with_*` methods in the type returned
9333/// by [builder()][PacketMirrorings::builder]. The default configuration should
9334/// work for most applications. Common configuration changes include
9335///
9336/// * [with_endpoint()]: by default this client uses the global default endpoint
9337/// (`https://compute.googleapis.com`). Applications using regional
9338/// endpoints or running in restricted networks (e.g. a network configured
9339/// with [Private Google Access with VPC Service Controls]) may want to
9340/// override this default.
9341/// * [with_credentials()]: by default this client uses
9342/// [Application Default Credentials]. Applications using custom
9343/// authentication may need to override this default.
9344///
9345/// [with_endpoint()]: super::builder::packet_mirrorings::ClientBuilder::with_endpoint
9346/// [with_credentials()]: super::builder::packet_mirrorings::ClientBuilder::with_credentials
9347/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9348/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9349///
9350/// # Pooling and Cloning
9351///
9352/// `PacketMirrorings` holds a connection pool internally, it is advised to
9353/// create one and reuse it. You do not need to wrap `PacketMirrorings` in
9354/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9355/// already uses an `Arc` internally.
9356#[cfg(feature = "packet-mirrorings")]
9357#[cfg_attr(docsrs, doc(cfg(feature = "packet-mirrorings")))]
9358#[derive(Clone, Debug)]
9359pub struct PacketMirrorings {
9360 inner: std::sync::Arc<dyn super::stub::dynamic::PacketMirrorings>,
9361}
9362
9363#[cfg(feature = "packet-mirrorings")]
9364impl PacketMirrorings {
9365 /// Returns a builder for [PacketMirrorings].
9366 ///
9367 /// ```
9368 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9369 /// # use google_cloud_compute_v1::client::PacketMirrorings;
9370 /// let client = PacketMirrorings::builder().build().await?;
9371 /// # Ok(()) }
9372 /// ```
9373 pub fn builder() -> super::builder::packet_mirrorings::ClientBuilder {
9374 crate::new_client_builder(super::builder::packet_mirrorings::client::Factory)
9375 }
9376
9377 /// Creates a new client from the provided stub.
9378 ///
9379 /// The most common case for calling this function is in tests mocking the
9380 /// client's behavior.
9381 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9382 where
9383 T: super::stub::PacketMirrorings + 'static,
9384 {
9385 Self { inner: stub.into() }
9386 }
9387
9388 pub(crate) async fn new(
9389 config: gaxi::options::ClientConfig,
9390 ) -> crate::ClientBuilderResult<Self> {
9391 let inner = Self::build_inner(config).await?;
9392 Ok(Self { inner })
9393 }
9394
9395 async fn build_inner(
9396 conf: gaxi::options::ClientConfig,
9397 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PacketMirrorings>>
9398 {
9399 if gaxi::options::tracing_enabled(&conf) {
9400 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9401 }
9402 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9403 }
9404
9405 async fn build_transport(
9406 conf: gaxi::options::ClientConfig,
9407 ) -> crate::ClientBuilderResult<impl super::stub::PacketMirrorings> {
9408 super::transport::PacketMirrorings::new(conf).await
9409 }
9410
9411 async fn build_with_tracing(
9412 conf: gaxi::options::ClientConfig,
9413 ) -> crate::ClientBuilderResult<impl super::stub::PacketMirrorings> {
9414 Self::build_transport(conf)
9415 .await
9416 .map(super::tracing::PacketMirrorings::new)
9417 }
9418
9419 /// Retrieves an aggregated list of packetMirrorings.
9420 ///
9421 /// To prevent failure, Google recommends that you set the
9422 /// `returnPartialSuccess` parameter to `true`.
9423 pub fn aggregated_list(&self) -> super::builder::packet_mirrorings::AggregatedList {
9424 super::builder::packet_mirrorings::AggregatedList::new(self.inner.clone())
9425 }
9426
9427 /// Deletes the specified PacketMirroring resource.
9428 pub fn delete(&self) -> super::builder::packet_mirrorings::Delete {
9429 super::builder::packet_mirrorings::Delete::new(self.inner.clone())
9430 }
9431
9432 /// Returns the specified PacketMirroring resource.
9433 pub fn get(&self) -> super::builder::packet_mirrorings::Get {
9434 super::builder::packet_mirrorings::Get::new(self.inner.clone())
9435 }
9436
9437 /// Creates a PacketMirroring resource in the specified project and region
9438 /// using the data included in the request.
9439 pub fn insert(&self) -> super::builder::packet_mirrorings::Insert {
9440 super::builder::packet_mirrorings::Insert::new(self.inner.clone())
9441 }
9442
9443 /// Retrieves a list of PacketMirroring resources available to the specified
9444 /// project and region.
9445 pub fn list(&self) -> super::builder::packet_mirrorings::List {
9446 super::builder::packet_mirrorings::List::new(self.inner.clone())
9447 }
9448
9449 /// Patches the specified PacketMirroring resource with the data included in
9450 /// the request. This method supportsPATCH
9451 /// semantics and usesJSON merge
9452 /// patch format and processing rules.
9453 pub fn patch(&self) -> super::builder::packet_mirrorings::Patch {
9454 super::builder::packet_mirrorings::Patch::new(self.inner.clone())
9455 }
9456
9457 /// Returns permissions that a caller has on the specified resource.
9458 pub fn test_iam_permissions(&self) -> super::builder::packet_mirrorings::TestIamPermissions {
9459 super::builder::packet_mirrorings::TestIamPermissions::new(self.inner.clone())
9460 }
9461
9462 /// Retrieves the specified region-specific Operations resource.
9463 pub fn get_operation(&self) -> super::builder::packet_mirrorings::GetOperation {
9464 super::builder::packet_mirrorings::GetOperation::new(self.inner.clone())
9465 }
9466}
9467
9468/// Implements a client for the Google Compute Engine API.
9469///
9470/// # Example
9471/// ```
9472/// # use google_cloud_compute_v1::client::PreviewFeatures;
9473/// async fn sample(
9474/// ) -> anyhow::Result<()> {
9475/// let client = PreviewFeatures::builder().build().await?;
9476/// // use `client` to make requests to the Google Compute Engine API.
9477/// Ok(())
9478/// }
9479/// ```
9480///
9481/// # Service Description
9482///
9483/// Service for the `previewFeatures` resource.
9484///
9485/// # Configuration
9486///
9487/// To configure `PreviewFeatures` use the `with_*` methods in the type returned
9488/// by [builder()][PreviewFeatures::builder]. The default configuration should
9489/// work for most applications. Common configuration changes include
9490///
9491/// * [with_endpoint()]: by default this client uses the global default endpoint
9492/// (`https://compute.googleapis.com`). Applications using regional
9493/// endpoints or running in restricted networks (e.g. a network configured
9494/// with [Private Google Access with VPC Service Controls]) may want to
9495/// override this default.
9496/// * [with_credentials()]: by default this client uses
9497/// [Application Default Credentials]. Applications using custom
9498/// authentication may need to override this default.
9499///
9500/// [with_endpoint()]: super::builder::preview_features::ClientBuilder::with_endpoint
9501/// [with_credentials()]: super::builder::preview_features::ClientBuilder::with_credentials
9502/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9503/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9504///
9505/// # Pooling and Cloning
9506///
9507/// `PreviewFeatures` holds a connection pool internally, it is advised to
9508/// create one and reuse it. You do not need to wrap `PreviewFeatures` in
9509/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9510/// already uses an `Arc` internally.
9511#[cfg(feature = "preview-features")]
9512#[cfg_attr(docsrs, doc(cfg(feature = "preview-features")))]
9513#[derive(Clone, Debug)]
9514pub struct PreviewFeatures {
9515 inner: std::sync::Arc<dyn super::stub::dynamic::PreviewFeatures>,
9516}
9517
9518#[cfg(feature = "preview-features")]
9519impl PreviewFeatures {
9520 /// Returns a builder for [PreviewFeatures].
9521 ///
9522 /// ```
9523 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9524 /// # use google_cloud_compute_v1::client::PreviewFeatures;
9525 /// let client = PreviewFeatures::builder().build().await?;
9526 /// # Ok(()) }
9527 /// ```
9528 pub fn builder() -> super::builder::preview_features::ClientBuilder {
9529 crate::new_client_builder(super::builder::preview_features::client::Factory)
9530 }
9531
9532 /// Creates a new client from the provided stub.
9533 ///
9534 /// The most common case for calling this function is in tests mocking the
9535 /// client's behavior.
9536 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9537 where
9538 T: super::stub::PreviewFeatures + 'static,
9539 {
9540 Self { inner: stub.into() }
9541 }
9542
9543 pub(crate) async fn new(
9544 config: gaxi::options::ClientConfig,
9545 ) -> crate::ClientBuilderResult<Self> {
9546 let inner = Self::build_inner(config).await?;
9547 Ok(Self { inner })
9548 }
9549
9550 async fn build_inner(
9551 conf: gaxi::options::ClientConfig,
9552 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PreviewFeatures>> {
9553 if gaxi::options::tracing_enabled(&conf) {
9554 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9555 }
9556 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9557 }
9558
9559 async fn build_transport(
9560 conf: gaxi::options::ClientConfig,
9561 ) -> crate::ClientBuilderResult<impl super::stub::PreviewFeatures> {
9562 super::transport::PreviewFeatures::new(conf).await
9563 }
9564
9565 async fn build_with_tracing(
9566 conf: gaxi::options::ClientConfig,
9567 ) -> crate::ClientBuilderResult<impl super::stub::PreviewFeatures> {
9568 Self::build_transport(conf)
9569 .await
9570 .map(super::tracing::PreviewFeatures::new)
9571 }
9572
9573 /// Returns the details of the given PreviewFeature.
9574 pub fn get(&self) -> super::builder::preview_features::Get {
9575 super::builder::preview_features::Get::new(self.inner.clone())
9576 }
9577
9578 /// Returns the details of the given PreviewFeature.
9579 pub fn list(&self) -> super::builder::preview_features::List {
9580 super::builder::preview_features::List::new(self.inner.clone())
9581 }
9582
9583 /// Patches the given PreviewFeature. This method is used to enable or disable
9584 /// a PreviewFeature.
9585 pub fn update(&self) -> super::builder::preview_features::Update {
9586 super::builder::preview_features::Update::new(self.inner.clone())
9587 }
9588
9589 /// Retrieves the specified Operations resource.
9590 pub fn get_operation(&self) -> super::builder::preview_features::GetOperation {
9591 super::builder::preview_features::GetOperation::new(self.inner.clone())
9592 }
9593}
9594
9595/// Implements a client for the Google Compute Engine API.
9596///
9597/// # Example
9598/// ```
9599/// # use google_cloud_compute_v1::client::Projects;
9600/// async fn sample(
9601/// ) -> anyhow::Result<()> {
9602/// let client = Projects::builder().build().await?;
9603/// // use `client` to make requests to the Google Compute Engine API.
9604/// Ok(())
9605/// }
9606/// ```
9607///
9608/// # Service Description
9609///
9610/// Service for the `projects` resource.
9611///
9612/// # Configuration
9613///
9614/// To configure `Projects` use the `with_*` methods in the type returned
9615/// by [builder()][Projects::builder]. The default configuration should
9616/// work for most applications. Common configuration changes include
9617///
9618/// * [with_endpoint()]: by default this client uses the global default endpoint
9619/// (`https://compute.googleapis.com`). Applications using regional
9620/// endpoints or running in restricted networks (e.g. a network configured
9621/// with [Private Google Access with VPC Service Controls]) may want to
9622/// override this default.
9623/// * [with_credentials()]: by default this client uses
9624/// [Application Default Credentials]. Applications using custom
9625/// authentication may need to override this default.
9626///
9627/// [with_endpoint()]: super::builder::projects::ClientBuilder::with_endpoint
9628/// [with_credentials()]: super::builder::projects::ClientBuilder::with_credentials
9629/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9630/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9631///
9632/// # Pooling and Cloning
9633///
9634/// `Projects` holds a connection pool internally, it is advised to
9635/// create one and reuse it. You do not need to wrap `Projects` in
9636/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9637/// already uses an `Arc` internally.
9638#[cfg(feature = "projects")]
9639#[cfg_attr(docsrs, doc(cfg(feature = "projects")))]
9640#[derive(Clone, Debug)]
9641pub struct Projects {
9642 inner: std::sync::Arc<dyn super::stub::dynamic::Projects>,
9643}
9644
9645#[cfg(feature = "projects")]
9646impl Projects {
9647 /// Returns a builder for [Projects].
9648 ///
9649 /// ```
9650 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9651 /// # use google_cloud_compute_v1::client::Projects;
9652 /// let client = Projects::builder().build().await?;
9653 /// # Ok(()) }
9654 /// ```
9655 pub fn builder() -> super::builder::projects::ClientBuilder {
9656 crate::new_client_builder(super::builder::projects::client::Factory)
9657 }
9658
9659 /// Creates a new client from the provided stub.
9660 ///
9661 /// The most common case for calling this function is in tests mocking the
9662 /// client's behavior.
9663 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9664 where
9665 T: super::stub::Projects + 'static,
9666 {
9667 Self { inner: stub.into() }
9668 }
9669
9670 pub(crate) async fn new(
9671 config: gaxi::options::ClientConfig,
9672 ) -> crate::ClientBuilderResult<Self> {
9673 let inner = Self::build_inner(config).await?;
9674 Ok(Self { inner })
9675 }
9676
9677 async fn build_inner(
9678 conf: gaxi::options::ClientConfig,
9679 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Projects>> {
9680 if gaxi::options::tracing_enabled(&conf) {
9681 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9682 }
9683 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9684 }
9685
9686 async fn build_transport(
9687 conf: gaxi::options::ClientConfig,
9688 ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
9689 super::transport::Projects::new(conf).await
9690 }
9691
9692 async fn build_with_tracing(
9693 conf: gaxi::options::ClientConfig,
9694 ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
9695 Self::build_transport(conf)
9696 .await
9697 .map(super::tracing::Projects::new)
9698 }
9699
9700 /// Disable this project as a shared VPC host project.
9701 pub fn disable_xpn_host(&self) -> super::builder::projects::DisableXpnHost {
9702 super::builder::projects::DisableXpnHost::new(self.inner.clone())
9703 }
9704
9705 /// Disable a service resource (also known as service project) associated with
9706 /// this host project.
9707 pub fn disable_xpn_resource(&self) -> super::builder::projects::DisableXpnResource {
9708 super::builder::projects::DisableXpnResource::new(self.inner.clone())
9709 }
9710
9711 /// Enable this project as a shared VPC host project.
9712 pub fn enable_xpn_host(&self) -> super::builder::projects::EnableXpnHost {
9713 super::builder::projects::EnableXpnHost::new(self.inner.clone())
9714 }
9715
9716 /// Enable service resource (a.k.a service project) for a host project, so that
9717 /// subnets in the host project can be used by instances in the service
9718 /// project.
9719 pub fn enable_xpn_resource(&self) -> super::builder::projects::EnableXpnResource {
9720 super::builder::projects::EnableXpnResource::new(self.inner.clone())
9721 }
9722
9723 /// Returns the specified Project resource.
9724 ///
9725 /// To decrease latency for this method, you can optionally omit any unneeded
9726 /// information from the response by using a field mask. This practice is
9727 /// especially recommended for unused quota information (the `quotas` field).
9728 /// To exclude one or more fields, set your request's `fields` query parameter
9729 /// to only include the fields you need. For example, to only include the `id`
9730 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
9731 /// your request.
9732 pub fn get(&self) -> super::builder::projects::Get {
9733 super::builder::projects::Get::new(self.inner.clone())
9734 }
9735
9736 /// Gets the shared VPC host project that this project links to. May be empty
9737 /// if no link exists.
9738 pub fn get_xpn_host(&self) -> super::builder::projects::GetXpnHost {
9739 super::builder::projects::GetXpnHost::new(self.inner.clone())
9740 }
9741
9742 /// Gets service resources (a.k.a service project) associated with this host
9743 /// project.
9744 pub fn get_xpn_resources(&self) -> super::builder::projects::GetXpnResources {
9745 super::builder::projects::GetXpnResources::new(self.inner.clone())
9746 }
9747
9748 /// Lists all shared VPC host projects visible to the user in an organization.
9749 pub fn list_xpn_hosts(&self) -> super::builder::projects::ListXpnHosts {
9750 super::builder::projects::ListXpnHosts::new(self.inner.clone())
9751 }
9752
9753 /// Moves a persistent disk from one zone to another.
9754 /// *Note*: The moveDisk API will be deprecated on September 29, 2026.
9755 ///
9756 /// Starting September 29, 2025, you can't use the moveDisk API on new
9757 /// projects. To move a disk to a different region or zone, follow the steps in
9758 /// [Change the location of a
9759 /// disk](https://cloud.google.com/compute/docs/disks/migrate-to-hyperdisk#migrate-to-hd).
9760 ///
9761 /// Projects that already use the moveDisk API can continue usage until
9762 /// September 29, 2026.
9763 ///
9764 /// Starting November 1, 2025, API responses will include a warning message in
9765 /// the response body about the upcoming deprecation. You can skip the message
9766 /// to continue using the service without interruption.
9767 #[deprecated]
9768 pub fn move_disk(&self) -> super::builder::projects::MoveDisk {
9769 super::builder::projects::MoveDisk::new(self.inner.clone())
9770 }
9771
9772 /// Moves an instance and its attached persistent disks from one zone to
9773 /// another.
9774 /// *Note*: Moving VMs or disks by using this method might
9775 /// cause unexpected behavior. For more information, see the [known
9776 /// issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior).
9777 /// [Deprecated] This method is deprecated. See [moving instance across
9778 /// zones](/compute/docs/instances/moving-instance-across-zones) instead.
9779 #[deprecated]
9780 pub fn move_instance(&self) -> super::builder::projects::MoveInstance {
9781 super::builder::projects::MoveInstance::new(self.inner.clone())
9782 }
9783
9784 /// Sets the Cloud Armor tier of the project. To set ENTERPRISE or above the
9785 /// billing account of the project must be subscribed to Cloud Armor
9786 /// Enterprise. See Subscribing
9787 /// to Cloud Armor Enterprise for more information.
9788 pub fn set_cloud_armor_tier(&self) -> super::builder::projects::SetCloudArmorTier {
9789 super::builder::projects::SetCloudArmorTier::new(self.inner.clone())
9790 }
9791
9792 /// Sets metadata common to all instances within the specified project using
9793 /// the data included in the request.
9794 pub fn set_common_instance_metadata(
9795 &self,
9796 ) -> super::builder::projects::SetCommonInstanceMetadata {
9797 super::builder::projects::SetCommonInstanceMetadata::new(self.inner.clone())
9798 }
9799
9800 /// Sets the default network tier of the project. The default network tier is
9801 /// used when an address/forwardingRule/instance is created without specifying
9802 /// the network tier field.
9803 pub fn set_default_network_tier(&self) -> super::builder::projects::SetDefaultNetworkTier {
9804 super::builder::projects::SetDefaultNetworkTier::new(self.inner.clone())
9805 }
9806
9807 /// Enables the usage export feature and sets theusage export bucket
9808 /// where reports are stored. If you provide an empty request body using this
9809 /// method, the usage export feature will be disabled.
9810 pub fn set_usage_export_bucket(&self) -> super::builder::projects::SetUsageExportBucket {
9811 super::builder::projects::SetUsageExportBucket::new(self.inner.clone())
9812 }
9813
9814 /// Retrieves the specified Operations resource.
9815 pub fn get_operation(&self) -> super::builder::projects::GetOperation {
9816 super::builder::projects::GetOperation::new(self.inner.clone())
9817 }
9818}
9819
9820/// Implements a client for the Google Compute Engine API.
9821///
9822/// # Example
9823/// ```
9824/// # use google_cloud_compute_v1::client::PublicAdvertisedPrefixes;
9825/// async fn sample(
9826/// ) -> anyhow::Result<()> {
9827/// let client = PublicAdvertisedPrefixes::builder().build().await?;
9828/// // use `client` to make requests to the Google Compute Engine API.
9829/// Ok(())
9830/// }
9831/// ```
9832///
9833/// # Service Description
9834///
9835/// Service for the `publicAdvertisedPrefixes` resource.
9836///
9837/// # Configuration
9838///
9839/// To configure `PublicAdvertisedPrefixes` use the `with_*` methods in the type returned
9840/// by [builder()][PublicAdvertisedPrefixes::builder]. The default configuration should
9841/// work for most applications. Common configuration changes include
9842///
9843/// * [with_endpoint()]: by default this client uses the global default endpoint
9844/// (`https://compute.googleapis.com`). Applications using regional
9845/// endpoints or running in restricted networks (e.g. a network configured
9846/// with [Private Google Access with VPC Service Controls]) may want to
9847/// override this default.
9848/// * [with_credentials()]: by default this client uses
9849/// [Application Default Credentials]. Applications using custom
9850/// authentication may need to override this default.
9851///
9852/// [with_endpoint()]: super::builder::public_advertised_prefixes::ClientBuilder::with_endpoint
9853/// [with_credentials()]: super::builder::public_advertised_prefixes::ClientBuilder::with_credentials
9854/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9855/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9856///
9857/// # Pooling and Cloning
9858///
9859/// `PublicAdvertisedPrefixes` holds a connection pool internally, it is advised to
9860/// create one and reuse it. You do not need to wrap `PublicAdvertisedPrefixes` in
9861/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9862/// already uses an `Arc` internally.
9863#[cfg(feature = "public-advertised-prefixes")]
9864#[cfg_attr(docsrs, doc(cfg(feature = "public-advertised-prefixes")))]
9865#[derive(Clone, Debug)]
9866pub struct PublicAdvertisedPrefixes {
9867 inner: std::sync::Arc<dyn super::stub::dynamic::PublicAdvertisedPrefixes>,
9868}
9869
9870#[cfg(feature = "public-advertised-prefixes")]
9871impl PublicAdvertisedPrefixes {
9872 /// Returns a builder for [PublicAdvertisedPrefixes].
9873 ///
9874 /// ```
9875 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9876 /// # use google_cloud_compute_v1::client::PublicAdvertisedPrefixes;
9877 /// let client = PublicAdvertisedPrefixes::builder().build().await?;
9878 /// # Ok(()) }
9879 /// ```
9880 pub fn builder() -> super::builder::public_advertised_prefixes::ClientBuilder {
9881 crate::new_client_builder(super::builder::public_advertised_prefixes::client::Factory)
9882 }
9883
9884 /// Creates a new client from the provided stub.
9885 ///
9886 /// The most common case for calling this function is in tests mocking the
9887 /// client's behavior.
9888 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9889 where
9890 T: super::stub::PublicAdvertisedPrefixes + 'static,
9891 {
9892 Self { inner: stub.into() }
9893 }
9894
9895 pub(crate) async fn new(
9896 config: gaxi::options::ClientConfig,
9897 ) -> crate::ClientBuilderResult<Self> {
9898 let inner = Self::build_inner(config).await?;
9899 Ok(Self { inner })
9900 }
9901
9902 async fn build_inner(
9903 conf: gaxi::options::ClientConfig,
9904 ) -> crate::ClientBuilderResult<
9905 std::sync::Arc<dyn super::stub::dynamic::PublicAdvertisedPrefixes>,
9906 > {
9907 if gaxi::options::tracing_enabled(&conf) {
9908 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9909 }
9910 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9911 }
9912
9913 async fn build_transport(
9914 conf: gaxi::options::ClientConfig,
9915 ) -> crate::ClientBuilderResult<impl super::stub::PublicAdvertisedPrefixes> {
9916 super::transport::PublicAdvertisedPrefixes::new(conf).await
9917 }
9918
9919 async fn build_with_tracing(
9920 conf: gaxi::options::ClientConfig,
9921 ) -> crate::ClientBuilderResult<impl super::stub::PublicAdvertisedPrefixes> {
9922 Self::build_transport(conf)
9923 .await
9924 .map(super::tracing::PublicAdvertisedPrefixes::new)
9925 }
9926
9927 /// Announces the specified PublicAdvertisedPrefix
9928 pub fn announce(&self) -> super::builder::public_advertised_prefixes::Announce {
9929 super::builder::public_advertised_prefixes::Announce::new(self.inner.clone())
9930 }
9931
9932 /// Deletes the specified PublicAdvertisedPrefix
9933 pub fn delete(&self) -> super::builder::public_advertised_prefixes::Delete {
9934 super::builder::public_advertised_prefixes::Delete::new(self.inner.clone())
9935 }
9936
9937 /// Returns the specified PublicAdvertisedPrefix resource.
9938 pub fn get(&self) -> super::builder::public_advertised_prefixes::Get {
9939 super::builder::public_advertised_prefixes::Get::new(self.inner.clone())
9940 }
9941
9942 /// Creates a PublicAdvertisedPrefix in the specified project
9943 /// using the parameters that are included in the request.
9944 pub fn insert(&self) -> super::builder::public_advertised_prefixes::Insert {
9945 super::builder::public_advertised_prefixes::Insert::new(self.inner.clone())
9946 }
9947
9948 /// Lists the PublicAdvertisedPrefixes for a project.
9949 pub fn list(&self) -> super::builder::public_advertised_prefixes::List {
9950 super::builder::public_advertised_prefixes::List::new(self.inner.clone())
9951 }
9952
9953 /// Patches the specified Router resource with the data included in the
9954 /// request. This method supportsPATCH
9955 /// semantics and usesJSON merge
9956 /// patch format and processing rules.
9957 pub fn patch(&self) -> super::builder::public_advertised_prefixes::Patch {
9958 super::builder::public_advertised_prefixes::Patch::new(self.inner.clone())
9959 }
9960
9961 /// Withdraws the specified PublicAdvertisedPrefix
9962 pub fn withdraw(&self) -> super::builder::public_advertised_prefixes::Withdraw {
9963 super::builder::public_advertised_prefixes::Withdraw::new(self.inner.clone())
9964 }
9965
9966 /// Retrieves the specified Operations resource.
9967 pub fn get_operation(&self) -> super::builder::public_advertised_prefixes::GetOperation {
9968 super::builder::public_advertised_prefixes::GetOperation::new(self.inner.clone())
9969 }
9970}
9971
9972/// Implements a client for the Google Compute Engine API.
9973///
9974/// # Example
9975/// ```
9976/// # use google_cloud_compute_v1::client::PublicDelegatedPrefixes;
9977/// async fn sample(
9978/// ) -> anyhow::Result<()> {
9979/// let client = PublicDelegatedPrefixes::builder().build().await?;
9980/// // use `client` to make requests to the Google Compute Engine API.
9981/// Ok(())
9982/// }
9983/// ```
9984///
9985/// # Service Description
9986///
9987/// Service for the `publicDelegatedPrefixes` resource.
9988///
9989/// # Configuration
9990///
9991/// To configure `PublicDelegatedPrefixes` use the `with_*` methods in the type returned
9992/// by [builder()][PublicDelegatedPrefixes::builder]. The default configuration should
9993/// work for most applications. Common configuration changes include
9994///
9995/// * [with_endpoint()]: by default this client uses the global default endpoint
9996/// (`https://compute.googleapis.com`). Applications using regional
9997/// endpoints or running in restricted networks (e.g. a network configured
9998/// with [Private Google Access with VPC Service Controls]) may want to
9999/// override this default.
10000/// * [with_credentials()]: by default this client uses
10001/// [Application Default Credentials]. Applications using custom
10002/// authentication may need to override this default.
10003///
10004/// [with_endpoint()]: super::builder::public_delegated_prefixes::ClientBuilder::with_endpoint
10005/// [with_credentials()]: super::builder::public_delegated_prefixes::ClientBuilder::with_credentials
10006/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10007/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10008///
10009/// # Pooling and Cloning
10010///
10011/// `PublicDelegatedPrefixes` holds a connection pool internally, it is advised to
10012/// create one and reuse it. You do not need to wrap `PublicDelegatedPrefixes` in
10013/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10014/// already uses an `Arc` internally.
10015#[cfg(feature = "public-delegated-prefixes")]
10016#[cfg_attr(docsrs, doc(cfg(feature = "public-delegated-prefixes")))]
10017#[derive(Clone, Debug)]
10018pub struct PublicDelegatedPrefixes {
10019 inner: std::sync::Arc<dyn super::stub::dynamic::PublicDelegatedPrefixes>,
10020}
10021
10022#[cfg(feature = "public-delegated-prefixes")]
10023impl PublicDelegatedPrefixes {
10024 /// Returns a builder for [PublicDelegatedPrefixes].
10025 ///
10026 /// ```
10027 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10028 /// # use google_cloud_compute_v1::client::PublicDelegatedPrefixes;
10029 /// let client = PublicDelegatedPrefixes::builder().build().await?;
10030 /// # Ok(()) }
10031 /// ```
10032 pub fn builder() -> super::builder::public_delegated_prefixes::ClientBuilder {
10033 crate::new_client_builder(super::builder::public_delegated_prefixes::client::Factory)
10034 }
10035
10036 /// Creates a new client from the provided stub.
10037 ///
10038 /// The most common case for calling this function is in tests mocking the
10039 /// client's behavior.
10040 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10041 where
10042 T: super::stub::PublicDelegatedPrefixes + 'static,
10043 {
10044 Self { inner: stub.into() }
10045 }
10046
10047 pub(crate) async fn new(
10048 config: gaxi::options::ClientConfig,
10049 ) -> crate::ClientBuilderResult<Self> {
10050 let inner = Self::build_inner(config).await?;
10051 Ok(Self { inner })
10052 }
10053
10054 async fn build_inner(
10055 conf: gaxi::options::ClientConfig,
10056 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PublicDelegatedPrefixes>>
10057 {
10058 if gaxi::options::tracing_enabled(&conf) {
10059 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10060 }
10061 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10062 }
10063
10064 async fn build_transport(
10065 conf: gaxi::options::ClientConfig,
10066 ) -> crate::ClientBuilderResult<impl super::stub::PublicDelegatedPrefixes> {
10067 super::transport::PublicDelegatedPrefixes::new(conf).await
10068 }
10069
10070 async fn build_with_tracing(
10071 conf: gaxi::options::ClientConfig,
10072 ) -> crate::ClientBuilderResult<impl super::stub::PublicDelegatedPrefixes> {
10073 Self::build_transport(conf)
10074 .await
10075 .map(super::tracing::PublicDelegatedPrefixes::new)
10076 }
10077
10078 /// Lists all PublicDelegatedPrefix resources owned by the specific project
10079 /// across all scopes.
10080 ///
10081 /// To prevent failure, Google recommends that you set the
10082 /// `returnPartialSuccess` parameter to `true`.
10083 pub fn aggregated_list(&self) -> super::builder::public_delegated_prefixes::AggregatedList {
10084 super::builder::public_delegated_prefixes::AggregatedList::new(self.inner.clone())
10085 }
10086
10087 /// Announces the specified PublicDelegatedPrefix in the given region.
10088 pub fn announce(&self) -> super::builder::public_delegated_prefixes::Announce {
10089 super::builder::public_delegated_prefixes::Announce::new(self.inner.clone())
10090 }
10091
10092 /// Deletes the specified PublicDelegatedPrefix in the given region.
10093 pub fn delete(&self) -> super::builder::public_delegated_prefixes::Delete {
10094 super::builder::public_delegated_prefixes::Delete::new(self.inner.clone())
10095 }
10096
10097 /// Returns the specified PublicDelegatedPrefix resource in the given region.
10098 pub fn get(&self) -> super::builder::public_delegated_prefixes::Get {
10099 super::builder::public_delegated_prefixes::Get::new(self.inner.clone())
10100 }
10101
10102 /// Creates a PublicDelegatedPrefix in the specified project in the given
10103 /// region using the parameters that are included in the request.
10104 pub fn insert(&self) -> super::builder::public_delegated_prefixes::Insert {
10105 super::builder::public_delegated_prefixes::Insert::new(self.inner.clone())
10106 }
10107
10108 /// Lists the PublicDelegatedPrefixes for a project in the given region.
10109 pub fn list(&self) -> super::builder::public_delegated_prefixes::List {
10110 super::builder::public_delegated_prefixes::List::new(self.inner.clone())
10111 }
10112
10113 /// Patches the specified PublicDelegatedPrefix resource with the data included
10114 /// in the request. This method supportsPATCH
10115 /// semantics and usesJSON merge
10116 /// patch format and processing rules.
10117 pub fn patch(&self) -> super::builder::public_delegated_prefixes::Patch {
10118 super::builder::public_delegated_prefixes::Patch::new(self.inner.clone())
10119 }
10120
10121 /// Withdraws the specified PublicDelegatedPrefix in the given region.
10122 pub fn withdraw(&self) -> super::builder::public_delegated_prefixes::Withdraw {
10123 super::builder::public_delegated_prefixes::Withdraw::new(self.inner.clone())
10124 }
10125
10126 /// Retrieves the specified region-specific Operations resource.
10127 pub fn get_operation(&self) -> super::builder::public_delegated_prefixes::GetOperation {
10128 super::builder::public_delegated_prefixes::GetOperation::new(self.inner.clone())
10129 }
10130}
10131
10132/// Implements a client for the Google Compute Engine API.
10133///
10134/// # Example
10135/// ```
10136/// # use google_cloud_compute_v1::client::RegionAutoscalers;
10137/// async fn sample(
10138/// ) -> anyhow::Result<()> {
10139/// let client = RegionAutoscalers::builder().build().await?;
10140/// // use `client` to make requests to the Google Compute Engine API.
10141/// Ok(())
10142/// }
10143/// ```
10144///
10145/// # Service Description
10146///
10147/// Service for the `regionAutoscalers` resource.
10148///
10149/// # Configuration
10150///
10151/// To configure `RegionAutoscalers` use the `with_*` methods in the type returned
10152/// by [builder()][RegionAutoscalers::builder]. The default configuration should
10153/// work for most applications. Common configuration changes include
10154///
10155/// * [with_endpoint()]: by default this client uses the global default endpoint
10156/// (`https://compute.googleapis.com`). Applications using regional
10157/// endpoints or running in restricted networks (e.g. a network configured
10158/// with [Private Google Access with VPC Service Controls]) may want to
10159/// override this default.
10160/// * [with_credentials()]: by default this client uses
10161/// [Application Default Credentials]. Applications using custom
10162/// authentication may need to override this default.
10163///
10164/// [with_endpoint()]: super::builder::region_autoscalers::ClientBuilder::with_endpoint
10165/// [with_credentials()]: super::builder::region_autoscalers::ClientBuilder::with_credentials
10166/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10167/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10168///
10169/// # Pooling and Cloning
10170///
10171/// `RegionAutoscalers` holds a connection pool internally, it is advised to
10172/// create one and reuse it. You do not need to wrap `RegionAutoscalers` in
10173/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10174/// already uses an `Arc` internally.
10175#[cfg(feature = "region-autoscalers")]
10176#[cfg_attr(docsrs, doc(cfg(feature = "region-autoscalers")))]
10177#[derive(Clone, Debug)]
10178pub struct RegionAutoscalers {
10179 inner: std::sync::Arc<dyn super::stub::dynamic::RegionAutoscalers>,
10180}
10181
10182#[cfg(feature = "region-autoscalers")]
10183impl RegionAutoscalers {
10184 /// Returns a builder for [RegionAutoscalers].
10185 ///
10186 /// ```
10187 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10188 /// # use google_cloud_compute_v1::client::RegionAutoscalers;
10189 /// let client = RegionAutoscalers::builder().build().await?;
10190 /// # Ok(()) }
10191 /// ```
10192 pub fn builder() -> super::builder::region_autoscalers::ClientBuilder {
10193 crate::new_client_builder(super::builder::region_autoscalers::client::Factory)
10194 }
10195
10196 /// Creates a new client from the provided stub.
10197 ///
10198 /// The most common case for calling this function is in tests mocking the
10199 /// client's behavior.
10200 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10201 where
10202 T: super::stub::RegionAutoscalers + 'static,
10203 {
10204 Self { inner: stub.into() }
10205 }
10206
10207 pub(crate) async fn new(
10208 config: gaxi::options::ClientConfig,
10209 ) -> crate::ClientBuilderResult<Self> {
10210 let inner = Self::build_inner(config).await?;
10211 Ok(Self { inner })
10212 }
10213
10214 async fn build_inner(
10215 conf: gaxi::options::ClientConfig,
10216 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionAutoscalers>>
10217 {
10218 if gaxi::options::tracing_enabled(&conf) {
10219 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10220 }
10221 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10222 }
10223
10224 async fn build_transport(
10225 conf: gaxi::options::ClientConfig,
10226 ) -> crate::ClientBuilderResult<impl super::stub::RegionAutoscalers> {
10227 super::transport::RegionAutoscalers::new(conf).await
10228 }
10229
10230 async fn build_with_tracing(
10231 conf: gaxi::options::ClientConfig,
10232 ) -> crate::ClientBuilderResult<impl super::stub::RegionAutoscalers> {
10233 Self::build_transport(conf)
10234 .await
10235 .map(super::tracing::RegionAutoscalers::new)
10236 }
10237
10238 /// Deletes the specified autoscaler.
10239 pub fn delete(&self) -> super::builder::region_autoscalers::Delete {
10240 super::builder::region_autoscalers::Delete::new(self.inner.clone())
10241 }
10242
10243 /// Returns the specified autoscaler.
10244 pub fn get(&self) -> super::builder::region_autoscalers::Get {
10245 super::builder::region_autoscalers::Get::new(self.inner.clone())
10246 }
10247
10248 /// Creates an autoscaler in the specified project using
10249 /// the data included in the request.
10250 pub fn insert(&self) -> super::builder::region_autoscalers::Insert {
10251 super::builder::region_autoscalers::Insert::new(self.inner.clone())
10252 }
10253
10254 /// Retrieves a list of autoscalers contained within
10255 /// the specified region.
10256 pub fn list(&self) -> super::builder::region_autoscalers::List {
10257 super::builder::region_autoscalers::List::new(self.inner.clone())
10258 }
10259
10260 /// Updates an autoscaler in the specified project using
10261 /// the data included in the request. This method supportsPATCH
10262 /// semantics and uses theJSON merge
10263 /// patch format and processing rules.
10264 pub fn patch(&self) -> super::builder::region_autoscalers::Patch {
10265 super::builder::region_autoscalers::Patch::new(self.inner.clone())
10266 }
10267
10268 /// Returns permissions that a caller has on the specified resource.
10269 pub fn test_iam_permissions(&self) -> super::builder::region_autoscalers::TestIamPermissions {
10270 super::builder::region_autoscalers::TestIamPermissions::new(self.inner.clone())
10271 }
10272
10273 /// Updates an autoscaler in the specified project using
10274 /// the data included in the request.
10275 pub fn update(&self) -> super::builder::region_autoscalers::Update {
10276 super::builder::region_autoscalers::Update::new(self.inner.clone())
10277 }
10278
10279 /// Retrieves the specified region-specific Operations resource.
10280 pub fn get_operation(&self) -> super::builder::region_autoscalers::GetOperation {
10281 super::builder::region_autoscalers::GetOperation::new(self.inner.clone())
10282 }
10283}
10284
10285/// Implements a client for the Google Compute Engine API.
10286///
10287/// # Example
10288/// ```
10289/// # use google_cloud_compute_v1::client::RegionBackendBuckets;
10290/// async fn sample(
10291/// ) -> anyhow::Result<()> {
10292/// let client = RegionBackendBuckets::builder().build().await?;
10293/// // use `client` to make requests to the Google Compute Engine API.
10294/// Ok(())
10295/// }
10296/// ```
10297///
10298/// # Service Description
10299///
10300/// Service for the `regionBackendBuckets` resource.
10301///
10302/// # Configuration
10303///
10304/// To configure `RegionBackendBuckets` use the `with_*` methods in the type returned
10305/// by [builder()][RegionBackendBuckets::builder]. The default configuration should
10306/// work for most applications. Common configuration changes include
10307///
10308/// * [with_endpoint()]: by default this client uses the global default endpoint
10309/// (`https://compute.googleapis.com`). Applications using regional
10310/// endpoints or running in restricted networks (e.g. a network configured
10311/// with [Private Google Access with VPC Service Controls]) may want to
10312/// override this default.
10313/// * [with_credentials()]: by default this client uses
10314/// [Application Default Credentials]. Applications using custom
10315/// authentication may need to override this default.
10316///
10317/// [with_endpoint()]: super::builder::region_backend_buckets::ClientBuilder::with_endpoint
10318/// [with_credentials()]: super::builder::region_backend_buckets::ClientBuilder::with_credentials
10319/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10320/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10321///
10322/// # Pooling and Cloning
10323///
10324/// `RegionBackendBuckets` holds a connection pool internally, it is advised to
10325/// create one and reuse it. You do not need to wrap `RegionBackendBuckets` in
10326/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10327/// already uses an `Arc` internally.
10328#[cfg(feature = "region-backend-buckets")]
10329#[cfg_attr(docsrs, doc(cfg(feature = "region-backend-buckets")))]
10330#[derive(Clone, Debug)]
10331pub struct RegionBackendBuckets {
10332 inner: std::sync::Arc<dyn super::stub::dynamic::RegionBackendBuckets>,
10333}
10334
10335#[cfg(feature = "region-backend-buckets")]
10336impl RegionBackendBuckets {
10337 /// Returns a builder for [RegionBackendBuckets].
10338 ///
10339 /// ```
10340 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10341 /// # use google_cloud_compute_v1::client::RegionBackendBuckets;
10342 /// let client = RegionBackendBuckets::builder().build().await?;
10343 /// # Ok(()) }
10344 /// ```
10345 pub fn builder() -> super::builder::region_backend_buckets::ClientBuilder {
10346 crate::new_client_builder(super::builder::region_backend_buckets::client::Factory)
10347 }
10348
10349 /// Creates a new client from the provided stub.
10350 ///
10351 /// The most common case for calling this function is in tests mocking the
10352 /// client's behavior.
10353 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10354 where
10355 T: super::stub::RegionBackendBuckets + 'static,
10356 {
10357 Self { inner: stub.into() }
10358 }
10359
10360 pub(crate) async fn new(
10361 config: gaxi::options::ClientConfig,
10362 ) -> crate::ClientBuilderResult<Self> {
10363 let inner = Self::build_inner(config).await?;
10364 Ok(Self { inner })
10365 }
10366
10367 async fn build_inner(
10368 conf: gaxi::options::ClientConfig,
10369 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionBackendBuckets>>
10370 {
10371 if gaxi::options::tracing_enabled(&conf) {
10372 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10373 }
10374 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10375 }
10376
10377 async fn build_transport(
10378 conf: gaxi::options::ClientConfig,
10379 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendBuckets> {
10380 super::transport::RegionBackendBuckets::new(conf).await
10381 }
10382
10383 async fn build_with_tracing(
10384 conf: gaxi::options::ClientConfig,
10385 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendBuckets> {
10386 Self::build_transport(conf)
10387 .await
10388 .map(super::tracing::RegionBackendBuckets::new)
10389 }
10390
10391 /// Deletes the specified regional BackendBucket resource.
10392 pub fn delete(&self) -> super::builder::region_backend_buckets::Delete {
10393 super::builder::region_backend_buckets::Delete::new(self.inner.clone())
10394 }
10395
10396 /// Returns the specified regional BackendBucket resource.
10397 pub fn get(&self) -> super::builder::region_backend_buckets::Get {
10398 super::builder::region_backend_buckets::Get::new(self.inner.clone())
10399 }
10400
10401 /// Gets the access control policy for a resource. May be empty if no such
10402 /// policy or resource exists.
10403 pub fn get_iam_policy(&self) -> super::builder::region_backend_buckets::GetIamPolicy {
10404 super::builder::region_backend_buckets::GetIamPolicy::new(self.inner.clone())
10405 }
10406
10407 /// Creates a RegionBackendBucket in the specified project in the given scope
10408 /// using the parameters that are included in the request.
10409 pub fn insert(&self) -> super::builder::region_backend_buckets::Insert {
10410 super::builder::region_backend_buckets::Insert::new(self.inner.clone())
10411 }
10412
10413 /// Retrieves the list of BackendBucket resources available to the specified
10414 /// project in the given region.
10415 pub fn list(&self) -> super::builder::region_backend_buckets::List {
10416 super::builder::region_backend_buckets::List::new(self.inner.clone())
10417 }
10418
10419 /// Retrieves a list of all usable backend buckets in the specified project in
10420 /// the given region.
10421 pub fn list_usable(&self) -> super::builder::region_backend_buckets::ListUsable {
10422 super::builder::region_backend_buckets::ListUsable::new(self.inner.clone())
10423 }
10424
10425 /// Updates the specified BackendBucket resource with the data included in the
10426 /// request. This method supportsPATCH
10427 /// semantics and uses theJSON merge
10428 /// patch format and processing rules.
10429 pub fn patch(&self) -> super::builder::region_backend_buckets::Patch {
10430 super::builder::region_backend_buckets::Patch::new(self.inner.clone())
10431 }
10432
10433 /// Sets the access control policy on the specified resource.
10434 /// Replaces any existing policy.
10435 pub fn set_iam_policy(&self) -> super::builder::region_backend_buckets::SetIamPolicy {
10436 super::builder::region_backend_buckets::SetIamPolicy::new(self.inner.clone())
10437 }
10438
10439 /// Returns permissions that a caller has on the specified resource.
10440 pub fn test_iam_permissions(
10441 &self,
10442 ) -> super::builder::region_backend_buckets::TestIamPermissions {
10443 super::builder::region_backend_buckets::TestIamPermissions::new(self.inner.clone())
10444 }
10445
10446 /// Retrieves the specified region-specific Operations resource.
10447 pub fn get_operation(&self) -> super::builder::region_backend_buckets::GetOperation {
10448 super::builder::region_backend_buckets::GetOperation::new(self.inner.clone())
10449 }
10450}
10451
10452/// Implements a client for the Google Compute Engine API.
10453///
10454/// # Example
10455/// ```
10456/// # use google_cloud_compute_v1::client::RegionBackendServices;
10457/// async fn sample(
10458/// ) -> anyhow::Result<()> {
10459/// let client = RegionBackendServices::builder().build().await?;
10460/// // use `client` to make requests to the Google Compute Engine API.
10461/// Ok(())
10462/// }
10463/// ```
10464///
10465/// # Service Description
10466///
10467/// Service for the `regionBackendServices` resource.
10468///
10469/// # Configuration
10470///
10471/// To configure `RegionBackendServices` use the `with_*` methods in the type returned
10472/// by [builder()][RegionBackendServices::builder]. The default configuration should
10473/// work for most applications. Common configuration changes include
10474///
10475/// * [with_endpoint()]: by default this client uses the global default endpoint
10476/// (`https://compute.googleapis.com`). Applications using regional
10477/// endpoints or running in restricted networks (e.g. a network configured
10478/// with [Private Google Access with VPC Service Controls]) may want to
10479/// override this default.
10480/// * [with_credentials()]: by default this client uses
10481/// [Application Default Credentials]. Applications using custom
10482/// authentication may need to override this default.
10483///
10484/// [with_endpoint()]: super::builder::region_backend_services::ClientBuilder::with_endpoint
10485/// [with_credentials()]: super::builder::region_backend_services::ClientBuilder::with_credentials
10486/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10487/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10488///
10489/// # Pooling and Cloning
10490///
10491/// `RegionBackendServices` holds a connection pool internally, it is advised to
10492/// create one and reuse it. You do not need to wrap `RegionBackendServices` in
10493/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10494/// already uses an `Arc` internally.
10495#[cfg(feature = "region-backend-services")]
10496#[cfg_attr(docsrs, doc(cfg(feature = "region-backend-services")))]
10497#[derive(Clone, Debug)]
10498pub struct RegionBackendServices {
10499 inner: std::sync::Arc<dyn super::stub::dynamic::RegionBackendServices>,
10500}
10501
10502#[cfg(feature = "region-backend-services")]
10503impl RegionBackendServices {
10504 /// Returns a builder for [RegionBackendServices].
10505 ///
10506 /// ```
10507 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10508 /// # use google_cloud_compute_v1::client::RegionBackendServices;
10509 /// let client = RegionBackendServices::builder().build().await?;
10510 /// # Ok(()) }
10511 /// ```
10512 pub fn builder() -> super::builder::region_backend_services::ClientBuilder {
10513 crate::new_client_builder(super::builder::region_backend_services::client::Factory)
10514 }
10515
10516 /// Creates a new client from the provided stub.
10517 ///
10518 /// The most common case for calling this function is in tests mocking the
10519 /// client's behavior.
10520 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10521 where
10522 T: super::stub::RegionBackendServices + 'static,
10523 {
10524 Self { inner: stub.into() }
10525 }
10526
10527 pub(crate) async fn new(
10528 config: gaxi::options::ClientConfig,
10529 ) -> crate::ClientBuilderResult<Self> {
10530 let inner = Self::build_inner(config).await?;
10531 Ok(Self { inner })
10532 }
10533
10534 async fn build_inner(
10535 conf: gaxi::options::ClientConfig,
10536 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionBackendServices>>
10537 {
10538 if gaxi::options::tracing_enabled(&conf) {
10539 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10540 }
10541 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10542 }
10543
10544 async fn build_transport(
10545 conf: gaxi::options::ClientConfig,
10546 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendServices> {
10547 super::transport::RegionBackendServices::new(conf).await
10548 }
10549
10550 async fn build_with_tracing(
10551 conf: gaxi::options::ClientConfig,
10552 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendServices> {
10553 Self::build_transport(conf)
10554 .await
10555 .map(super::tracing::RegionBackendServices::new)
10556 }
10557
10558 /// Deletes the specified regional BackendService resource.
10559 pub fn delete(&self) -> super::builder::region_backend_services::Delete {
10560 super::builder::region_backend_services::Delete::new(self.inner.clone())
10561 }
10562
10563 /// Returns the specified regional BackendService resource.
10564 pub fn get(&self) -> super::builder::region_backend_services::Get {
10565 super::builder::region_backend_services::Get::new(self.inner.clone())
10566 }
10567
10568 /// Gets the most recent health check results for this
10569 /// regional BackendService.
10570 pub fn get_health(&self) -> super::builder::region_backend_services::GetHealth {
10571 super::builder::region_backend_services::GetHealth::new(self.inner.clone())
10572 }
10573
10574 /// Gets the access control policy for a resource. May be empty if no such
10575 /// policy or resource exists.
10576 pub fn get_iam_policy(&self) -> super::builder::region_backend_services::GetIamPolicy {
10577 super::builder::region_backend_services::GetIamPolicy::new(self.inner.clone())
10578 }
10579
10580 /// Creates a regional BackendService resource in the specified project using
10581 /// the data included in the request. For more information, see
10582 /// Backend services overview.
10583 pub fn insert(&self) -> super::builder::region_backend_services::Insert {
10584 super::builder::region_backend_services::Insert::new(self.inner.clone())
10585 }
10586
10587 /// Retrieves the list of regional BackendService resources available to the
10588 /// specified project in the given region.
10589 pub fn list(&self) -> super::builder::region_backend_services::List {
10590 super::builder::region_backend_services::List::new(self.inner.clone())
10591 }
10592
10593 /// Retrieves a list of all usable backend services in the specified project in
10594 /// the given region.
10595 pub fn list_usable(&self) -> super::builder::region_backend_services::ListUsable {
10596 super::builder::region_backend_services::ListUsable::new(self.inner.clone())
10597 }
10598
10599 /// Updates the specified regional BackendService resource with the data
10600 /// included in the request. For more information, see
10601 /// Understanding backend services This method
10602 /// supports PATCH semantics and uses the JSON merge
10603 /// patch format and processing rules.
10604 pub fn patch(&self) -> super::builder::region_backend_services::Patch {
10605 super::builder::region_backend_services::Patch::new(self.inner.clone())
10606 }
10607
10608 /// Sets the access control policy on the specified resource.
10609 /// Replaces any existing policy.
10610 pub fn set_iam_policy(&self) -> super::builder::region_backend_services::SetIamPolicy {
10611 super::builder::region_backend_services::SetIamPolicy::new(self.inner.clone())
10612 }
10613
10614 /// Sets the Google Cloud Armor security policy for the specified backend
10615 /// service. For more information, seeGoogle
10616 /// Cloud Armor Overview
10617 pub fn set_security_policy(
10618 &self,
10619 ) -> super::builder::region_backend_services::SetSecurityPolicy {
10620 super::builder::region_backend_services::SetSecurityPolicy::new(self.inner.clone())
10621 }
10622
10623 /// Returns permissions that a caller has on the specified resource.
10624 pub fn test_iam_permissions(
10625 &self,
10626 ) -> super::builder::region_backend_services::TestIamPermissions {
10627 super::builder::region_backend_services::TestIamPermissions::new(self.inner.clone())
10628 }
10629
10630 /// Updates the specified regional BackendService resource with the data
10631 /// included in the request. For more information,
10632 /// see
10633 /// Backend services overview.
10634 pub fn update(&self) -> super::builder::region_backend_services::Update {
10635 super::builder::region_backend_services::Update::new(self.inner.clone())
10636 }
10637
10638 /// Retrieves the specified region-specific Operations resource.
10639 pub fn get_operation(&self) -> super::builder::region_backend_services::GetOperation {
10640 super::builder::region_backend_services::GetOperation::new(self.inner.clone())
10641 }
10642}
10643
10644/// Implements a client for the Google Compute Engine API.
10645///
10646/// # Example
10647/// ```
10648/// # use google_cloud_compute_v1::client::RegionCommitments;
10649/// async fn sample(
10650/// ) -> anyhow::Result<()> {
10651/// let client = RegionCommitments::builder().build().await?;
10652/// // use `client` to make requests to the Google Compute Engine API.
10653/// Ok(())
10654/// }
10655/// ```
10656///
10657/// # Service Description
10658///
10659/// Service for the `regionCommitments` resource.
10660///
10661/// # Configuration
10662///
10663/// To configure `RegionCommitments` use the `with_*` methods in the type returned
10664/// by [builder()][RegionCommitments::builder]. The default configuration should
10665/// work for most applications. Common configuration changes include
10666///
10667/// * [with_endpoint()]: by default this client uses the global default endpoint
10668/// (`https://compute.googleapis.com`). Applications using regional
10669/// endpoints or running in restricted networks (e.g. a network configured
10670/// with [Private Google Access with VPC Service Controls]) may want to
10671/// override this default.
10672/// * [with_credentials()]: by default this client uses
10673/// [Application Default Credentials]. Applications using custom
10674/// authentication may need to override this default.
10675///
10676/// [with_endpoint()]: super::builder::region_commitments::ClientBuilder::with_endpoint
10677/// [with_credentials()]: super::builder::region_commitments::ClientBuilder::with_credentials
10678/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10679/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10680///
10681/// # Pooling and Cloning
10682///
10683/// `RegionCommitments` holds a connection pool internally, it is advised to
10684/// create one and reuse it. You do not need to wrap `RegionCommitments` in
10685/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10686/// already uses an `Arc` internally.
10687#[cfg(feature = "region-commitments")]
10688#[cfg_attr(docsrs, doc(cfg(feature = "region-commitments")))]
10689#[derive(Clone, Debug)]
10690pub struct RegionCommitments {
10691 inner: std::sync::Arc<dyn super::stub::dynamic::RegionCommitments>,
10692}
10693
10694#[cfg(feature = "region-commitments")]
10695impl RegionCommitments {
10696 /// Returns a builder for [RegionCommitments].
10697 ///
10698 /// ```
10699 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10700 /// # use google_cloud_compute_v1::client::RegionCommitments;
10701 /// let client = RegionCommitments::builder().build().await?;
10702 /// # Ok(()) }
10703 /// ```
10704 pub fn builder() -> super::builder::region_commitments::ClientBuilder {
10705 crate::new_client_builder(super::builder::region_commitments::client::Factory)
10706 }
10707
10708 /// Creates a new client from the provided stub.
10709 ///
10710 /// The most common case for calling this function is in tests mocking the
10711 /// client's behavior.
10712 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10713 where
10714 T: super::stub::RegionCommitments + 'static,
10715 {
10716 Self { inner: stub.into() }
10717 }
10718
10719 pub(crate) async fn new(
10720 config: gaxi::options::ClientConfig,
10721 ) -> crate::ClientBuilderResult<Self> {
10722 let inner = Self::build_inner(config).await?;
10723 Ok(Self { inner })
10724 }
10725
10726 async fn build_inner(
10727 conf: gaxi::options::ClientConfig,
10728 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionCommitments>>
10729 {
10730 if gaxi::options::tracing_enabled(&conf) {
10731 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10732 }
10733 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10734 }
10735
10736 async fn build_transport(
10737 conf: gaxi::options::ClientConfig,
10738 ) -> crate::ClientBuilderResult<impl super::stub::RegionCommitments> {
10739 super::transport::RegionCommitments::new(conf).await
10740 }
10741
10742 async fn build_with_tracing(
10743 conf: gaxi::options::ClientConfig,
10744 ) -> crate::ClientBuilderResult<impl super::stub::RegionCommitments> {
10745 Self::build_transport(conf)
10746 .await
10747 .map(super::tracing::RegionCommitments::new)
10748 }
10749
10750 /// Retrieves an aggregated list of commitments by region.
10751 ///
10752 /// To prevent failure, it is recommended that you set the
10753 /// `returnPartialSuccess` parameter to `true`.
10754 pub fn aggregated_list(&self) -> super::builder::region_commitments::AggregatedList {
10755 super::builder::region_commitments::AggregatedList::new(self.inner.clone())
10756 }
10757
10758 /// Returns the specified commitment resource.
10759 pub fn get(&self) -> super::builder::region_commitments::Get {
10760 super::builder::region_commitments::Get::new(self.inner.clone())
10761 }
10762
10763 /// Creates a commitment in the specified project using the data
10764 /// included in the request.
10765 pub fn insert(&self) -> super::builder::region_commitments::Insert {
10766 super::builder::region_commitments::Insert::new(self.inner.clone())
10767 }
10768
10769 /// Retrieves a list of commitments contained within
10770 /// the specified region.
10771 pub fn list(&self) -> super::builder::region_commitments::List {
10772 super::builder::region_commitments::List::new(self.inner.clone())
10773 }
10774
10775 /// Updates the specified commitment with the data included in the request.
10776 /// Update is performed only on selected fields included as part of
10777 /// update-mask. Only the following fields can be updated: auto_renew and plan.
10778 pub fn update(&self) -> super::builder::region_commitments::Update {
10779 super::builder::region_commitments::Update::new(self.inner.clone())
10780 }
10781
10782 /// Retrieves the specified region-specific Operations resource.
10783 pub fn get_operation(&self) -> super::builder::region_commitments::GetOperation {
10784 super::builder::region_commitments::GetOperation::new(self.inner.clone())
10785 }
10786}
10787
10788/// Implements a client for the Google Compute Engine API.
10789///
10790/// # Example
10791/// ```
10792/// # use google_cloud_compute_v1::client::RegionCompositeHealthChecks;
10793/// async fn sample(
10794/// ) -> anyhow::Result<()> {
10795/// let client = RegionCompositeHealthChecks::builder().build().await?;
10796/// // use `client` to make requests to the Google Compute Engine API.
10797/// Ok(())
10798/// }
10799/// ```
10800///
10801/// # Service Description
10802///
10803/// Service for the `regionCompositeHealthChecks` resource.
10804///
10805/// # Configuration
10806///
10807/// To configure `RegionCompositeHealthChecks` use the `with_*` methods in the type returned
10808/// by [builder()][RegionCompositeHealthChecks::builder]. The default configuration should
10809/// work for most applications. Common configuration changes include
10810///
10811/// * [with_endpoint()]: by default this client uses the global default endpoint
10812/// (`https://compute.googleapis.com`). Applications using regional
10813/// endpoints or running in restricted networks (e.g. a network configured
10814/// with [Private Google Access with VPC Service Controls]) may want to
10815/// override this default.
10816/// * [with_credentials()]: by default this client uses
10817/// [Application Default Credentials]. Applications using custom
10818/// authentication may need to override this default.
10819///
10820/// [with_endpoint()]: super::builder::region_composite_health_checks::ClientBuilder::with_endpoint
10821/// [with_credentials()]: super::builder::region_composite_health_checks::ClientBuilder::with_credentials
10822/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10823/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10824///
10825/// # Pooling and Cloning
10826///
10827/// `RegionCompositeHealthChecks` holds a connection pool internally, it is advised to
10828/// create one and reuse it. You do not need to wrap `RegionCompositeHealthChecks` in
10829/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10830/// already uses an `Arc` internally.
10831#[cfg(feature = "region-composite-health-checks")]
10832#[cfg_attr(docsrs, doc(cfg(feature = "region-composite-health-checks")))]
10833#[derive(Clone, Debug)]
10834pub struct RegionCompositeHealthChecks {
10835 inner: std::sync::Arc<dyn super::stub::dynamic::RegionCompositeHealthChecks>,
10836}
10837
10838#[cfg(feature = "region-composite-health-checks")]
10839impl RegionCompositeHealthChecks {
10840 /// Returns a builder for [RegionCompositeHealthChecks].
10841 ///
10842 /// ```
10843 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10844 /// # use google_cloud_compute_v1::client::RegionCompositeHealthChecks;
10845 /// let client = RegionCompositeHealthChecks::builder().build().await?;
10846 /// # Ok(()) }
10847 /// ```
10848 pub fn builder() -> super::builder::region_composite_health_checks::ClientBuilder {
10849 crate::new_client_builder(super::builder::region_composite_health_checks::client::Factory)
10850 }
10851
10852 /// Creates a new client from the provided stub.
10853 ///
10854 /// The most common case for calling this function is in tests mocking the
10855 /// client's behavior.
10856 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10857 where
10858 T: super::stub::RegionCompositeHealthChecks + 'static,
10859 {
10860 Self { inner: stub.into() }
10861 }
10862
10863 pub(crate) async fn new(
10864 config: gaxi::options::ClientConfig,
10865 ) -> crate::ClientBuilderResult<Self> {
10866 let inner = Self::build_inner(config).await?;
10867 Ok(Self { inner })
10868 }
10869
10870 async fn build_inner(
10871 conf: gaxi::options::ClientConfig,
10872 ) -> crate::ClientBuilderResult<
10873 std::sync::Arc<dyn super::stub::dynamic::RegionCompositeHealthChecks>,
10874 > {
10875 if gaxi::options::tracing_enabled(&conf) {
10876 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10877 }
10878 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10879 }
10880
10881 async fn build_transport(
10882 conf: gaxi::options::ClientConfig,
10883 ) -> crate::ClientBuilderResult<impl super::stub::RegionCompositeHealthChecks> {
10884 super::transport::RegionCompositeHealthChecks::new(conf).await
10885 }
10886
10887 async fn build_with_tracing(
10888 conf: gaxi::options::ClientConfig,
10889 ) -> crate::ClientBuilderResult<impl super::stub::RegionCompositeHealthChecks> {
10890 Self::build_transport(conf)
10891 .await
10892 .map(super::tracing::RegionCompositeHealthChecks::new)
10893 }
10894
10895 /// Retrieves the list of all CompositeHealthCheck resources (all
10896 /// regional) available to the specified project.
10897 ///
10898 /// To prevent failure, it is recommended that you set the
10899 /// `returnPartialSuccess` parameter to `true`.
10900 pub fn aggregated_list(
10901 &self,
10902 ) -> super::builder::region_composite_health_checks::AggregatedList {
10903 super::builder::region_composite_health_checks::AggregatedList::new(self.inner.clone())
10904 }
10905
10906 /// Deletes the specified CompositeHealthCheck in the given region
10907 pub fn delete(&self) -> super::builder::region_composite_health_checks::Delete {
10908 super::builder::region_composite_health_checks::Delete::new(self.inner.clone())
10909 }
10910
10911 /// Returns the specified CompositeHealthCheck resource in the given region.
10912 pub fn get(&self) -> super::builder::region_composite_health_checks::Get {
10913 super::builder::region_composite_health_checks::Get::new(self.inner.clone())
10914 }
10915
10916 /// Gets the most recent health check results for this
10917 /// regional CompositeHealthCheck.
10918 pub fn get_health(&self) -> super::builder::region_composite_health_checks::GetHealth {
10919 super::builder::region_composite_health_checks::GetHealth::new(self.inner.clone())
10920 }
10921
10922 /// Create a CompositeHealthCheck in the specified project in the given region
10923 /// using the parameters that are included in the request.
10924 pub fn insert(&self) -> super::builder::region_composite_health_checks::Insert {
10925 super::builder::region_composite_health_checks::Insert::new(self.inner.clone())
10926 }
10927
10928 /// Lists the CompositeHealthChecks for a project in the given region.
10929 pub fn list(&self) -> super::builder::region_composite_health_checks::List {
10930 super::builder::region_composite_health_checks::List::new(self.inner.clone())
10931 }
10932
10933 /// Updates the specified regional CompositeHealthCheck resource
10934 /// with the data included in the request. This method supportsPATCH
10935 /// semantics and uses theJSON merge
10936 /// patch format and processing rules.
10937 pub fn patch(&self) -> super::builder::region_composite_health_checks::Patch {
10938 super::builder::region_composite_health_checks::Patch::new(self.inner.clone())
10939 }
10940
10941 /// Returns permissions that a caller has on the specified resource.
10942 pub fn test_iam_permissions(
10943 &self,
10944 ) -> super::builder::region_composite_health_checks::TestIamPermissions {
10945 super::builder::region_composite_health_checks::TestIamPermissions::new(self.inner.clone())
10946 }
10947
10948 /// Retrieves the specified region-specific Operations resource.
10949 pub fn get_operation(&self) -> super::builder::region_composite_health_checks::GetOperation {
10950 super::builder::region_composite_health_checks::GetOperation::new(self.inner.clone())
10951 }
10952}
10953
10954/// Implements a client for the Google Compute Engine API.
10955///
10956/// # Example
10957/// ```
10958/// # use google_cloud_compute_v1::client::RegionDiskTypes;
10959/// async fn sample(
10960/// ) -> anyhow::Result<()> {
10961/// let client = RegionDiskTypes::builder().build().await?;
10962/// // use `client` to make requests to the Google Compute Engine API.
10963/// Ok(())
10964/// }
10965/// ```
10966///
10967/// # Service Description
10968///
10969/// Service for the `regionDiskTypes` resource.
10970///
10971/// # Configuration
10972///
10973/// To configure `RegionDiskTypes` use the `with_*` methods in the type returned
10974/// by [builder()][RegionDiskTypes::builder]. The default configuration should
10975/// work for most applications. Common configuration changes include
10976///
10977/// * [with_endpoint()]: by default this client uses the global default endpoint
10978/// (`https://compute.googleapis.com`). Applications using regional
10979/// endpoints or running in restricted networks (e.g. a network configured
10980/// with [Private Google Access with VPC Service Controls]) may want to
10981/// override this default.
10982/// * [with_credentials()]: by default this client uses
10983/// [Application Default Credentials]. Applications using custom
10984/// authentication may need to override this default.
10985///
10986/// [with_endpoint()]: super::builder::region_disk_types::ClientBuilder::with_endpoint
10987/// [with_credentials()]: super::builder::region_disk_types::ClientBuilder::with_credentials
10988/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10989/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10990///
10991/// # Pooling and Cloning
10992///
10993/// `RegionDiskTypes` holds a connection pool internally, it is advised to
10994/// create one and reuse it. You do not need to wrap `RegionDiskTypes` in
10995/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10996/// already uses an `Arc` internally.
10997#[cfg(feature = "region-disk-types")]
10998#[cfg_attr(docsrs, doc(cfg(feature = "region-disk-types")))]
10999#[derive(Clone, Debug)]
11000pub struct RegionDiskTypes {
11001 inner: std::sync::Arc<dyn super::stub::dynamic::RegionDiskTypes>,
11002}
11003
11004#[cfg(feature = "region-disk-types")]
11005impl RegionDiskTypes {
11006 /// Returns a builder for [RegionDiskTypes].
11007 ///
11008 /// ```
11009 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11010 /// # use google_cloud_compute_v1::client::RegionDiskTypes;
11011 /// let client = RegionDiskTypes::builder().build().await?;
11012 /// # Ok(()) }
11013 /// ```
11014 pub fn builder() -> super::builder::region_disk_types::ClientBuilder {
11015 crate::new_client_builder(super::builder::region_disk_types::client::Factory)
11016 }
11017
11018 /// Creates a new client from the provided stub.
11019 ///
11020 /// The most common case for calling this function is in tests mocking the
11021 /// client's behavior.
11022 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11023 where
11024 T: super::stub::RegionDiskTypes + 'static,
11025 {
11026 Self { inner: stub.into() }
11027 }
11028
11029 pub(crate) async fn new(
11030 config: gaxi::options::ClientConfig,
11031 ) -> crate::ClientBuilderResult<Self> {
11032 let inner = Self::build_inner(config).await?;
11033 Ok(Self { inner })
11034 }
11035
11036 async fn build_inner(
11037 conf: gaxi::options::ClientConfig,
11038 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionDiskTypes>> {
11039 if gaxi::options::tracing_enabled(&conf) {
11040 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11041 }
11042 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11043 }
11044
11045 async fn build_transport(
11046 conf: gaxi::options::ClientConfig,
11047 ) -> crate::ClientBuilderResult<impl super::stub::RegionDiskTypes> {
11048 super::transport::RegionDiskTypes::new(conf).await
11049 }
11050
11051 async fn build_with_tracing(
11052 conf: gaxi::options::ClientConfig,
11053 ) -> crate::ClientBuilderResult<impl super::stub::RegionDiskTypes> {
11054 Self::build_transport(conf)
11055 .await
11056 .map(super::tracing::RegionDiskTypes::new)
11057 }
11058
11059 /// Returns the specified regional disk type.
11060 pub fn get(&self) -> super::builder::region_disk_types::Get {
11061 super::builder::region_disk_types::Get::new(self.inner.clone())
11062 }
11063
11064 /// Retrieves a list of regional disk types available to the specified project.
11065 pub fn list(&self) -> super::builder::region_disk_types::List {
11066 super::builder::region_disk_types::List::new(self.inner.clone())
11067 }
11068}
11069
11070/// Implements a client for the Google Compute Engine API.
11071///
11072/// # Example
11073/// ```
11074/// # use google_cloud_compute_v1::client::RegionDisks;
11075/// async fn sample(
11076/// ) -> anyhow::Result<()> {
11077/// let client = RegionDisks::builder().build().await?;
11078/// // use `client` to make requests to the Google Compute Engine API.
11079/// Ok(())
11080/// }
11081/// ```
11082///
11083/// # Service Description
11084///
11085/// Service for the `regionDisks` resource.
11086///
11087/// # Configuration
11088///
11089/// To configure `RegionDisks` use the `with_*` methods in the type returned
11090/// by [builder()][RegionDisks::builder]. The default configuration should
11091/// work for most applications. Common configuration changes include
11092///
11093/// * [with_endpoint()]: by default this client uses the global default endpoint
11094/// (`https://compute.googleapis.com`). Applications using regional
11095/// endpoints or running in restricted networks (e.g. a network configured
11096/// with [Private Google Access with VPC Service Controls]) may want to
11097/// override this default.
11098/// * [with_credentials()]: by default this client uses
11099/// [Application Default Credentials]. Applications using custom
11100/// authentication may need to override this default.
11101///
11102/// [with_endpoint()]: super::builder::region_disks::ClientBuilder::with_endpoint
11103/// [with_credentials()]: super::builder::region_disks::ClientBuilder::with_credentials
11104/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11105/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11106///
11107/// # Pooling and Cloning
11108///
11109/// `RegionDisks` holds a connection pool internally, it is advised to
11110/// create one and reuse it. You do not need to wrap `RegionDisks` in
11111/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11112/// already uses an `Arc` internally.
11113#[cfg(feature = "region-disks")]
11114#[cfg_attr(docsrs, doc(cfg(feature = "region-disks")))]
11115#[derive(Clone, Debug)]
11116pub struct RegionDisks {
11117 inner: std::sync::Arc<dyn super::stub::dynamic::RegionDisks>,
11118}
11119
11120#[cfg(feature = "region-disks")]
11121impl RegionDisks {
11122 /// Returns a builder for [RegionDisks].
11123 ///
11124 /// ```
11125 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11126 /// # use google_cloud_compute_v1::client::RegionDisks;
11127 /// let client = RegionDisks::builder().build().await?;
11128 /// # Ok(()) }
11129 /// ```
11130 pub fn builder() -> super::builder::region_disks::ClientBuilder {
11131 crate::new_client_builder(super::builder::region_disks::client::Factory)
11132 }
11133
11134 /// Creates a new client from the provided stub.
11135 ///
11136 /// The most common case for calling this function is in tests mocking the
11137 /// client's behavior.
11138 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11139 where
11140 T: super::stub::RegionDisks + 'static,
11141 {
11142 Self { inner: stub.into() }
11143 }
11144
11145 pub(crate) async fn new(
11146 config: gaxi::options::ClientConfig,
11147 ) -> crate::ClientBuilderResult<Self> {
11148 let inner = Self::build_inner(config).await?;
11149 Ok(Self { inner })
11150 }
11151
11152 async fn build_inner(
11153 conf: gaxi::options::ClientConfig,
11154 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionDisks>> {
11155 if gaxi::options::tracing_enabled(&conf) {
11156 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11157 }
11158 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11159 }
11160
11161 async fn build_transport(
11162 conf: gaxi::options::ClientConfig,
11163 ) -> crate::ClientBuilderResult<impl super::stub::RegionDisks> {
11164 super::transport::RegionDisks::new(conf).await
11165 }
11166
11167 async fn build_with_tracing(
11168 conf: gaxi::options::ClientConfig,
11169 ) -> crate::ClientBuilderResult<impl super::stub::RegionDisks> {
11170 Self::build_transport(conf)
11171 .await
11172 .map(super::tracing::RegionDisks::new)
11173 }
11174
11175 /// Adds existing resource policies to a regional disk. You can only add one
11176 /// policy which will be applied to this disk for scheduling snapshot
11177 /// creation.
11178 pub fn add_resource_policies(&self) -> super::builder::region_disks::AddResourcePolicies {
11179 super::builder::region_disks::AddResourcePolicies::new(self.inner.clone())
11180 }
11181
11182 /// Bulk create a set of disks.
11183 pub fn bulk_insert(&self) -> super::builder::region_disks::BulkInsert {
11184 super::builder::region_disks::BulkInsert::new(self.inner.clone())
11185 }
11186
11187 /// Creates a snapshot of a specified persistent disk. For regular snapshot
11188 /// creation, consider using snapshots.insert
11189 /// instead, as that method supports more features, such as creating snapshots
11190 /// in a project different from the source disk project.
11191 pub fn create_snapshot(&self) -> super::builder::region_disks::CreateSnapshot {
11192 super::builder::region_disks::CreateSnapshot::new(self.inner.clone())
11193 }
11194
11195 /// Deletes the specified regional persistent disk. Deleting a regional disk
11196 /// removes all the replicas of its data permanently and is irreversible.
11197 /// However, deleting a disk does not delete anysnapshots
11198 /// previously made from the disk. You must separatelydelete
11199 /// snapshots.
11200 pub fn delete(&self) -> super::builder::region_disks::Delete {
11201 super::builder::region_disks::Delete::new(self.inner.clone())
11202 }
11203
11204 /// Returns a specified regional persistent disk.
11205 pub fn get(&self) -> super::builder::region_disks::Get {
11206 super::builder::region_disks::Get::new(self.inner.clone())
11207 }
11208
11209 /// Gets the access control policy for a resource. May be empty if no such
11210 /// policy or resource exists.
11211 pub fn get_iam_policy(&self) -> super::builder::region_disks::GetIamPolicy {
11212 super::builder::region_disks::GetIamPolicy::new(self.inner.clone())
11213 }
11214
11215 /// Creates a persistent regional disk in the specified project using the data
11216 /// included in the request.
11217 pub fn insert(&self) -> super::builder::region_disks::Insert {
11218 super::builder::region_disks::Insert::new(self.inner.clone())
11219 }
11220
11221 /// Retrieves the list of persistent disks contained within
11222 /// the specified region.
11223 pub fn list(&self) -> super::builder::region_disks::List {
11224 super::builder::region_disks::List::new(self.inner.clone())
11225 }
11226
11227 /// Removes resource policies from a regional disk.
11228 pub fn remove_resource_policies(&self) -> super::builder::region_disks::RemoveResourcePolicies {
11229 super::builder::region_disks::RemoveResourcePolicies::new(self.inner.clone())
11230 }
11231
11232 /// Resizes the specified regional persistent disk.
11233 pub fn resize(&self) -> super::builder::region_disks::Resize {
11234 super::builder::region_disks::Resize::new(self.inner.clone())
11235 }
11236
11237 /// Sets the access control policy on the specified resource.
11238 /// Replaces any existing policy.
11239 pub fn set_iam_policy(&self) -> super::builder::region_disks::SetIamPolicy {
11240 super::builder::region_disks::SetIamPolicy::new(self.inner.clone())
11241 }
11242
11243 /// Sets the labels on the target regional disk.
11244 pub fn set_labels(&self) -> super::builder::region_disks::SetLabels {
11245 super::builder::region_disks::SetLabels::new(self.inner.clone())
11246 }
11247
11248 /// Starts asynchronous replication.
11249 /// Must be invoked on the primary disk.
11250 pub fn start_async_replication(&self) -> super::builder::region_disks::StartAsyncReplication {
11251 super::builder::region_disks::StartAsyncReplication::new(self.inner.clone())
11252 }
11253
11254 /// Stops asynchronous replication.
11255 /// Can be invoked either on the primary or on the secondary disk.
11256 pub fn stop_async_replication(&self) -> super::builder::region_disks::StopAsyncReplication {
11257 super::builder::region_disks::StopAsyncReplication::new(self.inner.clone())
11258 }
11259
11260 /// Stops asynchronous replication for a consistency group of disks.
11261 /// Can be invoked either in the primary or secondary scope.
11262 pub fn stop_group_async_replication(
11263 &self,
11264 ) -> super::builder::region_disks::StopGroupAsyncReplication {
11265 super::builder::region_disks::StopGroupAsyncReplication::new(self.inner.clone())
11266 }
11267
11268 /// Returns permissions that a caller has on the specified resource.
11269 pub fn test_iam_permissions(&self) -> super::builder::region_disks::TestIamPermissions {
11270 super::builder::region_disks::TestIamPermissions::new(self.inner.clone())
11271 }
11272
11273 /// Update the specified disk with the data included in the request. Update is
11274 /// performed only on selected fields included as part of update-mask.
11275 pub fn update(&self) -> super::builder::region_disks::Update {
11276 super::builder::region_disks::Update::new(self.inner.clone())
11277 }
11278
11279 /// Rotates the customer-managed
11280 /// encryption key to the latest version for the specified persistent disk.
11281 pub fn update_kms_key(&self) -> super::builder::region_disks::UpdateKmsKey {
11282 super::builder::region_disks::UpdateKmsKey::new(self.inner.clone())
11283 }
11284
11285 /// Retrieves the specified region-specific Operations resource.
11286 pub fn get_operation(&self) -> super::builder::region_disks::GetOperation {
11287 super::builder::region_disks::GetOperation::new(self.inner.clone())
11288 }
11289}
11290
11291/// Implements a client for the Google Compute Engine API.
11292///
11293/// # Example
11294/// ```
11295/// # use google_cloud_compute_v1::client::RegionHealthAggregationPolicies;
11296/// async fn sample(
11297/// ) -> anyhow::Result<()> {
11298/// let client = RegionHealthAggregationPolicies::builder().build().await?;
11299/// // use `client` to make requests to the Google Compute Engine API.
11300/// Ok(())
11301/// }
11302/// ```
11303///
11304/// # Service Description
11305///
11306/// Service for the `regionHealthAggregationPolicies` resource.
11307///
11308/// # Configuration
11309///
11310/// To configure `RegionHealthAggregationPolicies` use the `with_*` methods in the type returned
11311/// by [builder()][RegionHealthAggregationPolicies::builder]. The default configuration should
11312/// work for most applications. Common configuration changes include
11313///
11314/// * [with_endpoint()]: by default this client uses the global default endpoint
11315/// (`https://compute.googleapis.com`). Applications using regional
11316/// endpoints or running in restricted networks (e.g. a network configured
11317/// with [Private Google Access with VPC Service Controls]) may want to
11318/// override this default.
11319/// * [with_credentials()]: by default this client uses
11320/// [Application Default Credentials]. Applications using custom
11321/// authentication may need to override this default.
11322///
11323/// [with_endpoint()]: super::builder::region_health_aggregation_policies::ClientBuilder::with_endpoint
11324/// [with_credentials()]: super::builder::region_health_aggregation_policies::ClientBuilder::with_credentials
11325/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11326/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11327///
11328/// # Pooling and Cloning
11329///
11330/// `RegionHealthAggregationPolicies` holds a connection pool internally, it is advised to
11331/// create one and reuse it. You do not need to wrap `RegionHealthAggregationPolicies` in
11332/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11333/// already uses an `Arc` internally.
11334#[cfg(feature = "region-health-aggregation-policies")]
11335#[cfg_attr(docsrs, doc(cfg(feature = "region-health-aggregation-policies")))]
11336#[derive(Clone, Debug)]
11337pub struct RegionHealthAggregationPolicies {
11338 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthAggregationPolicies>,
11339}
11340
11341#[cfg(feature = "region-health-aggregation-policies")]
11342impl RegionHealthAggregationPolicies {
11343 /// Returns a builder for [RegionHealthAggregationPolicies].
11344 ///
11345 /// ```
11346 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11347 /// # use google_cloud_compute_v1::client::RegionHealthAggregationPolicies;
11348 /// let client = RegionHealthAggregationPolicies::builder().build().await?;
11349 /// # Ok(()) }
11350 /// ```
11351 pub fn builder() -> super::builder::region_health_aggregation_policies::ClientBuilder {
11352 crate::new_client_builder(
11353 super::builder::region_health_aggregation_policies::client::Factory,
11354 )
11355 }
11356
11357 /// Creates a new client from the provided stub.
11358 ///
11359 /// The most common case for calling this function is in tests mocking the
11360 /// client's behavior.
11361 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11362 where
11363 T: super::stub::RegionHealthAggregationPolicies + 'static,
11364 {
11365 Self { inner: stub.into() }
11366 }
11367
11368 pub(crate) async fn new(
11369 config: gaxi::options::ClientConfig,
11370 ) -> crate::ClientBuilderResult<Self> {
11371 let inner = Self::build_inner(config).await?;
11372 Ok(Self { inner })
11373 }
11374
11375 async fn build_inner(
11376 conf: gaxi::options::ClientConfig,
11377 ) -> crate::ClientBuilderResult<
11378 std::sync::Arc<dyn super::stub::dynamic::RegionHealthAggregationPolicies>,
11379 > {
11380 if gaxi::options::tracing_enabled(&conf) {
11381 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11382 }
11383 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11384 }
11385
11386 async fn build_transport(
11387 conf: gaxi::options::ClientConfig,
11388 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthAggregationPolicies> {
11389 super::transport::RegionHealthAggregationPolicies::new(conf).await
11390 }
11391
11392 async fn build_with_tracing(
11393 conf: gaxi::options::ClientConfig,
11394 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthAggregationPolicies> {
11395 Self::build_transport(conf)
11396 .await
11397 .map(super::tracing::RegionHealthAggregationPolicies::new)
11398 }
11399
11400 /// Retrieves the list of all HealthAggregationPolicy resources,
11401 /// regional and global, available to the specified project.
11402 ///
11403 /// To prevent failure, it is recommended that you set the
11404 /// `returnPartialSuccess` parameter to `true`.
11405 pub fn aggregated_list(
11406 &self,
11407 ) -> super::builder::region_health_aggregation_policies::AggregatedList {
11408 super::builder::region_health_aggregation_policies::AggregatedList::new(self.inner.clone())
11409 }
11410
11411 /// Deletes the specified HealthAggregationPolicy in the given region.
11412 pub fn delete(&self) -> super::builder::region_health_aggregation_policies::Delete {
11413 super::builder::region_health_aggregation_policies::Delete::new(self.inner.clone())
11414 }
11415
11416 /// Returns the specified HealthAggregationPolicy resource in the given region.
11417 pub fn get(&self) -> super::builder::region_health_aggregation_policies::Get {
11418 super::builder::region_health_aggregation_policies::Get::new(self.inner.clone())
11419 }
11420
11421 /// Create a HealthAggregationPolicy in the specified project in the given
11422 /// region using the parameters that are included in the request.
11423 pub fn insert(&self) -> super::builder::region_health_aggregation_policies::Insert {
11424 super::builder::region_health_aggregation_policies::Insert::new(self.inner.clone())
11425 }
11426
11427 /// Lists the HealthAggregationPolicies for a project in the given region.
11428 pub fn list(&self) -> super::builder::region_health_aggregation_policies::List {
11429 super::builder::region_health_aggregation_policies::List::new(self.inner.clone())
11430 }
11431
11432 /// Updates the specified regional HealthAggregationPolicy
11433 /// resource with the data included in the request. This method supportsPATCH
11434 /// semantics and uses theJSON merge
11435 /// patch format and processing rules.
11436 pub fn patch(&self) -> super::builder::region_health_aggregation_policies::Patch {
11437 super::builder::region_health_aggregation_policies::Patch::new(self.inner.clone())
11438 }
11439
11440 /// Returns permissions that a caller has on the specified resource.
11441 pub fn test_iam_permissions(
11442 &self,
11443 ) -> super::builder::region_health_aggregation_policies::TestIamPermissions {
11444 super::builder::region_health_aggregation_policies::TestIamPermissions::new(
11445 self.inner.clone(),
11446 )
11447 }
11448
11449 /// Retrieves the specified region-specific Operations resource.
11450 pub fn get_operation(
11451 &self,
11452 ) -> super::builder::region_health_aggregation_policies::GetOperation {
11453 super::builder::region_health_aggregation_policies::GetOperation::new(self.inner.clone())
11454 }
11455}
11456
11457/// Implements a client for the Google Compute Engine API.
11458///
11459/// # Example
11460/// ```
11461/// # use google_cloud_compute_v1::client::RegionHealthCheckServices;
11462/// async fn sample(
11463/// ) -> anyhow::Result<()> {
11464/// let client = RegionHealthCheckServices::builder().build().await?;
11465/// // use `client` to make requests to the Google Compute Engine API.
11466/// Ok(())
11467/// }
11468/// ```
11469///
11470/// # Service Description
11471///
11472/// Service for the `regionHealthCheckServices` resource.
11473///
11474/// # Configuration
11475///
11476/// To configure `RegionHealthCheckServices` use the `with_*` methods in the type returned
11477/// by [builder()][RegionHealthCheckServices::builder]. The default configuration should
11478/// work for most applications. Common configuration changes include
11479///
11480/// * [with_endpoint()]: by default this client uses the global default endpoint
11481/// (`https://compute.googleapis.com`). Applications using regional
11482/// endpoints or running in restricted networks (e.g. a network configured
11483/// with [Private Google Access with VPC Service Controls]) may want to
11484/// override this default.
11485/// * [with_credentials()]: by default this client uses
11486/// [Application Default Credentials]. Applications using custom
11487/// authentication may need to override this default.
11488///
11489/// [with_endpoint()]: super::builder::region_health_check_services::ClientBuilder::with_endpoint
11490/// [with_credentials()]: super::builder::region_health_check_services::ClientBuilder::with_credentials
11491/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11492/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11493///
11494/// # Pooling and Cloning
11495///
11496/// `RegionHealthCheckServices` holds a connection pool internally, it is advised to
11497/// create one and reuse it. You do not need to wrap `RegionHealthCheckServices` in
11498/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11499/// already uses an `Arc` internally.
11500#[cfg(feature = "region-health-check-services")]
11501#[cfg_attr(docsrs, doc(cfg(feature = "region-health-check-services")))]
11502#[derive(Clone, Debug)]
11503pub struct RegionHealthCheckServices {
11504 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthCheckServices>,
11505}
11506
11507#[cfg(feature = "region-health-check-services")]
11508impl RegionHealthCheckServices {
11509 /// Returns a builder for [RegionHealthCheckServices].
11510 ///
11511 /// ```
11512 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11513 /// # use google_cloud_compute_v1::client::RegionHealthCheckServices;
11514 /// let client = RegionHealthCheckServices::builder().build().await?;
11515 /// # Ok(()) }
11516 /// ```
11517 pub fn builder() -> super::builder::region_health_check_services::ClientBuilder {
11518 crate::new_client_builder(super::builder::region_health_check_services::client::Factory)
11519 }
11520
11521 /// Creates a new client from the provided stub.
11522 ///
11523 /// The most common case for calling this function is in tests mocking the
11524 /// client's behavior.
11525 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11526 where
11527 T: super::stub::RegionHealthCheckServices + 'static,
11528 {
11529 Self { inner: stub.into() }
11530 }
11531
11532 pub(crate) async fn new(
11533 config: gaxi::options::ClientConfig,
11534 ) -> crate::ClientBuilderResult<Self> {
11535 let inner = Self::build_inner(config).await?;
11536 Ok(Self { inner })
11537 }
11538
11539 async fn build_inner(
11540 conf: gaxi::options::ClientConfig,
11541 ) -> crate::ClientBuilderResult<
11542 std::sync::Arc<dyn super::stub::dynamic::RegionHealthCheckServices>,
11543 > {
11544 if gaxi::options::tracing_enabled(&conf) {
11545 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11546 }
11547 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11548 }
11549
11550 async fn build_transport(
11551 conf: gaxi::options::ClientConfig,
11552 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthCheckServices> {
11553 super::transport::RegionHealthCheckServices::new(conf).await
11554 }
11555
11556 async fn build_with_tracing(
11557 conf: gaxi::options::ClientConfig,
11558 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthCheckServices> {
11559 Self::build_transport(conf)
11560 .await
11561 .map(super::tracing::RegionHealthCheckServices::new)
11562 }
11563
11564 /// Retrieves the list of all HealthCheckService resources,
11565 /// regional and global, available to the specified project.
11566 ///
11567 /// To prevent failure, it is recommended that you set the
11568 /// `returnPartialSuccess` parameter to `true`.
11569 pub fn aggregated_list(&self) -> super::builder::region_health_check_services::AggregatedList {
11570 super::builder::region_health_check_services::AggregatedList::new(self.inner.clone())
11571 }
11572
11573 /// Deletes the specified regional HealthCheckService.
11574 pub fn delete(&self) -> super::builder::region_health_check_services::Delete {
11575 super::builder::region_health_check_services::Delete::new(self.inner.clone())
11576 }
11577
11578 /// Returns the specified regional HealthCheckService resource.
11579 pub fn get(&self) -> super::builder::region_health_check_services::Get {
11580 super::builder::region_health_check_services::Get::new(self.inner.clone())
11581 }
11582
11583 /// Creates a regional HealthCheckService resource in the
11584 /// specified project and region using the data included in the request.
11585 pub fn insert(&self) -> super::builder::region_health_check_services::Insert {
11586 super::builder::region_health_check_services::Insert::new(self.inner.clone())
11587 }
11588
11589 /// Lists all the HealthCheckService resources that have been
11590 /// configured for the specified project in the given region.
11591 pub fn list(&self) -> super::builder::region_health_check_services::List {
11592 super::builder::region_health_check_services::List::new(self.inner.clone())
11593 }
11594
11595 /// Updates the specified regional HealthCheckService resource
11596 /// with the data included in the request. This method supportsPATCH
11597 /// semantics and uses theJSON merge
11598 /// patch format and processing rules.
11599 pub fn patch(&self) -> super::builder::region_health_check_services::Patch {
11600 super::builder::region_health_check_services::Patch::new(self.inner.clone())
11601 }
11602
11603 /// Returns permissions that a caller has on the specified resource.
11604 pub fn test_iam_permissions(
11605 &self,
11606 ) -> super::builder::region_health_check_services::TestIamPermissions {
11607 super::builder::region_health_check_services::TestIamPermissions::new(self.inner.clone())
11608 }
11609
11610 /// Retrieves the specified region-specific Operations resource.
11611 pub fn get_operation(&self) -> super::builder::region_health_check_services::GetOperation {
11612 super::builder::region_health_check_services::GetOperation::new(self.inner.clone())
11613 }
11614}
11615
11616/// Implements a client for the Google Compute Engine API.
11617///
11618/// # Example
11619/// ```
11620/// # use google_cloud_compute_v1::client::RegionHealthChecks;
11621/// async fn sample(
11622/// ) -> anyhow::Result<()> {
11623/// let client = RegionHealthChecks::builder().build().await?;
11624/// // use `client` to make requests to the Google Compute Engine API.
11625/// Ok(())
11626/// }
11627/// ```
11628///
11629/// # Service Description
11630///
11631/// Service for the `regionHealthChecks` resource.
11632///
11633/// # Configuration
11634///
11635/// To configure `RegionHealthChecks` use the `with_*` methods in the type returned
11636/// by [builder()][RegionHealthChecks::builder]. The default configuration should
11637/// work for most applications. Common configuration changes include
11638///
11639/// * [with_endpoint()]: by default this client uses the global default endpoint
11640/// (`https://compute.googleapis.com`). Applications using regional
11641/// endpoints or running in restricted networks (e.g. a network configured
11642/// with [Private Google Access with VPC Service Controls]) may want to
11643/// override this default.
11644/// * [with_credentials()]: by default this client uses
11645/// [Application Default Credentials]. Applications using custom
11646/// authentication may need to override this default.
11647///
11648/// [with_endpoint()]: super::builder::region_health_checks::ClientBuilder::with_endpoint
11649/// [with_credentials()]: super::builder::region_health_checks::ClientBuilder::with_credentials
11650/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11651/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11652///
11653/// # Pooling and Cloning
11654///
11655/// `RegionHealthChecks` holds a connection pool internally, it is advised to
11656/// create one and reuse it. You do not need to wrap `RegionHealthChecks` in
11657/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11658/// already uses an `Arc` internally.
11659#[cfg(feature = "region-health-checks")]
11660#[cfg_attr(docsrs, doc(cfg(feature = "region-health-checks")))]
11661#[derive(Clone, Debug)]
11662pub struct RegionHealthChecks {
11663 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthChecks>,
11664}
11665
11666#[cfg(feature = "region-health-checks")]
11667impl RegionHealthChecks {
11668 /// Returns a builder for [RegionHealthChecks].
11669 ///
11670 /// ```
11671 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11672 /// # use google_cloud_compute_v1::client::RegionHealthChecks;
11673 /// let client = RegionHealthChecks::builder().build().await?;
11674 /// # Ok(()) }
11675 /// ```
11676 pub fn builder() -> super::builder::region_health_checks::ClientBuilder {
11677 crate::new_client_builder(super::builder::region_health_checks::client::Factory)
11678 }
11679
11680 /// Creates a new client from the provided stub.
11681 ///
11682 /// The most common case for calling this function is in tests mocking the
11683 /// client's behavior.
11684 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11685 where
11686 T: super::stub::RegionHealthChecks + 'static,
11687 {
11688 Self { inner: stub.into() }
11689 }
11690
11691 pub(crate) async fn new(
11692 config: gaxi::options::ClientConfig,
11693 ) -> crate::ClientBuilderResult<Self> {
11694 let inner = Self::build_inner(config).await?;
11695 Ok(Self { inner })
11696 }
11697
11698 async fn build_inner(
11699 conf: gaxi::options::ClientConfig,
11700 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionHealthChecks>>
11701 {
11702 if gaxi::options::tracing_enabled(&conf) {
11703 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11704 }
11705 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11706 }
11707
11708 async fn build_transport(
11709 conf: gaxi::options::ClientConfig,
11710 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthChecks> {
11711 super::transport::RegionHealthChecks::new(conf).await
11712 }
11713
11714 async fn build_with_tracing(
11715 conf: gaxi::options::ClientConfig,
11716 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthChecks> {
11717 Self::build_transport(conf)
11718 .await
11719 .map(super::tracing::RegionHealthChecks::new)
11720 }
11721
11722 /// Deletes the specified HealthCheck resource.
11723 pub fn delete(&self) -> super::builder::region_health_checks::Delete {
11724 super::builder::region_health_checks::Delete::new(self.inner.clone())
11725 }
11726
11727 /// Returns the specified HealthCheck resource.
11728 pub fn get(&self) -> super::builder::region_health_checks::Get {
11729 super::builder::region_health_checks::Get::new(self.inner.clone())
11730 }
11731
11732 /// Creates a HealthCheck resource in the specified project using the data
11733 /// included in the request.
11734 pub fn insert(&self) -> super::builder::region_health_checks::Insert {
11735 super::builder::region_health_checks::Insert::new(self.inner.clone())
11736 }
11737
11738 /// Retrieves the list of HealthCheck resources available to the specified
11739 /// project.
11740 pub fn list(&self) -> super::builder::region_health_checks::List {
11741 super::builder::region_health_checks::List::new(self.inner.clone())
11742 }
11743
11744 /// Updates a HealthCheck resource in the specified project using the data
11745 /// included in the request. This method supportsPATCH
11746 /// semantics and uses theJSON merge
11747 /// patch format and processing rules.
11748 pub fn patch(&self) -> super::builder::region_health_checks::Patch {
11749 super::builder::region_health_checks::Patch::new(self.inner.clone())
11750 }
11751
11752 /// Returns permissions that a caller has on the specified resource.
11753 pub fn test_iam_permissions(&self) -> super::builder::region_health_checks::TestIamPermissions {
11754 super::builder::region_health_checks::TestIamPermissions::new(self.inner.clone())
11755 }
11756
11757 /// Updates a HealthCheck resource in the specified project using the data
11758 /// included in the request.
11759 pub fn update(&self) -> super::builder::region_health_checks::Update {
11760 super::builder::region_health_checks::Update::new(self.inner.clone())
11761 }
11762
11763 /// Retrieves the specified region-specific Operations resource.
11764 pub fn get_operation(&self) -> super::builder::region_health_checks::GetOperation {
11765 super::builder::region_health_checks::GetOperation::new(self.inner.clone())
11766 }
11767}
11768
11769/// Implements a client for the Google Compute Engine API.
11770///
11771/// # Example
11772/// ```
11773/// # use google_cloud_compute_v1::client::RegionHealthSources;
11774/// async fn sample(
11775/// ) -> anyhow::Result<()> {
11776/// let client = RegionHealthSources::builder().build().await?;
11777/// // use `client` to make requests to the Google Compute Engine API.
11778/// Ok(())
11779/// }
11780/// ```
11781///
11782/// # Service Description
11783///
11784/// Service for the `regionHealthSources` resource.
11785///
11786/// # Configuration
11787///
11788/// To configure `RegionHealthSources` use the `with_*` methods in the type returned
11789/// by [builder()][RegionHealthSources::builder]. The default configuration should
11790/// work for most applications. Common configuration changes include
11791///
11792/// * [with_endpoint()]: by default this client uses the global default endpoint
11793/// (`https://compute.googleapis.com`). Applications using regional
11794/// endpoints or running in restricted networks (e.g. a network configured
11795/// with [Private Google Access with VPC Service Controls]) may want to
11796/// override this default.
11797/// * [with_credentials()]: by default this client uses
11798/// [Application Default Credentials]. Applications using custom
11799/// authentication may need to override this default.
11800///
11801/// [with_endpoint()]: super::builder::region_health_sources::ClientBuilder::with_endpoint
11802/// [with_credentials()]: super::builder::region_health_sources::ClientBuilder::with_credentials
11803/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11804/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11805///
11806/// # Pooling and Cloning
11807///
11808/// `RegionHealthSources` holds a connection pool internally, it is advised to
11809/// create one and reuse it. You do not need to wrap `RegionHealthSources` in
11810/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11811/// already uses an `Arc` internally.
11812#[cfg(feature = "region-health-sources")]
11813#[cfg_attr(docsrs, doc(cfg(feature = "region-health-sources")))]
11814#[derive(Clone, Debug)]
11815pub struct RegionHealthSources {
11816 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthSources>,
11817}
11818
11819#[cfg(feature = "region-health-sources")]
11820impl RegionHealthSources {
11821 /// Returns a builder for [RegionHealthSources].
11822 ///
11823 /// ```
11824 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11825 /// # use google_cloud_compute_v1::client::RegionHealthSources;
11826 /// let client = RegionHealthSources::builder().build().await?;
11827 /// # Ok(()) }
11828 /// ```
11829 pub fn builder() -> super::builder::region_health_sources::ClientBuilder {
11830 crate::new_client_builder(super::builder::region_health_sources::client::Factory)
11831 }
11832
11833 /// Creates a new client from the provided stub.
11834 ///
11835 /// The most common case for calling this function is in tests mocking the
11836 /// client's behavior.
11837 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11838 where
11839 T: super::stub::RegionHealthSources + 'static,
11840 {
11841 Self { inner: stub.into() }
11842 }
11843
11844 pub(crate) async fn new(
11845 config: gaxi::options::ClientConfig,
11846 ) -> crate::ClientBuilderResult<Self> {
11847 let inner = Self::build_inner(config).await?;
11848 Ok(Self { inner })
11849 }
11850
11851 async fn build_inner(
11852 conf: gaxi::options::ClientConfig,
11853 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionHealthSources>>
11854 {
11855 if gaxi::options::tracing_enabled(&conf) {
11856 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11857 }
11858 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11859 }
11860
11861 async fn build_transport(
11862 conf: gaxi::options::ClientConfig,
11863 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthSources> {
11864 super::transport::RegionHealthSources::new(conf).await
11865 }
11866
11867 async fn build_with_tracing(
11868 conf: gaxi::options::ClientConfig,
11869 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthSources> {
11870 Self::build_transport(conf)
11871 .await
11872 .map(super::tracing::RegionHealthSources::new)
11873 }
11874
11875 /// Retrieves the list of all HealthSource resources (all
11876 /// regional) available to the specified project.
11877 ///
11878 /// To prevent failure, Google recommends that you set the
11879 /// `returnPartialSuccess` parameter to `true`.
11880 pub fn aggregated_list(&self) -> super::builder::region_health_sources::AggregatedList {
11881 super::builder::region_health_sources::AggregatedList::new(self.inner.clone())
11882 }
11883
11884 /// Deletes the specified HealthSource in the given region
11885 pub fn delete(&self) -> super::builder::region_health_sources::Delete {
11886 super::builder::region_health_sources::Delete::new(self.inner.clone())
11887 }
11888
11889 /// Returns the specified HealthSource resource in the given region.
11890 pub fn get(&self) -> super::builder::region_health_sources::Get {
11891 super::builder::region_health_sources::Get::new(self.inner.clone())
11892 }
11893
11894 /// Gets the most recent health check results for this
11895 /// regional HealthSource.
11896 pub fn get_health(&self) -> super::builder::region_health_sources::GetHealth {
11897 super::builder::region_health_sources::GetHealth::new(self.inner.clone())
11898 }
11899
11900 /// Create a HealthSource in the specified project in the given region
11901 /// using the parameters that are included in the request.
11902 pub fn insert(&self) -> super::builder::region_health_sources::Insert {
11903 super::builder::region_health_sources::Insert::new(self.inner.clone())
11904 }
11905
11906 /// Lists the HealthSources for a project in the given region.
11907 pub fn list(&self) -> super::builder::region_health_sources::List {
11908 super::builder::region_health_sources::List::new(self.inner.clone())
11909 }
11910
11911 /// Updates the specified regional HealthSource resource
11912 /// with the data included in the request. This method supportsPATCH
11913 /// semantics and uses theJSON merge
11914 /// patch format and processing rules.
11915 pub fn patch(&self) -> super::builder::region_health_sources::Patch {
11916 super::builder::region_health_sources::Patch::new(self.inner.clone())
11917 }
11918
11919 /// Returns permissions that a caller has on the specified resource.
11920 pub fn test_iam_permissions(
11921 &self,
11922 ) -> super::builder::region_health_sources::TestIamPermissions {
11923 super::builder::region_health_sources::TestIamPermissions::new(self.inner.clone())
11924 }
11925
11926 /// Retrieves the specified region-specific Operations resource.
11927 pub fn get_operation(&self) -> super::builder::region_health_sources::GetOperation {
11928 super::builder::region_health_sources::GetOperation::new(self.inner.clone())
11929 }
11930}
11931
11932/// Implements a client for the Google Compute Engine API.
11933///
11934/// # Example
11935/// ```
11936/// # use google_cloud_compute_v1::client::RegionInstanceGroupManagerResizeRequests;
11937/// async fn sample(
11938/// ) -> anyhow::Result<()> {
11939/// let client = RegionInstanceGroupManagerResizeRequests::builder().build().await?;
11940/// // use `client` to make requests to the Google Compute Engine API.
11941/// Ok(())
11942/// }
11943/// ```
11944///
11945/// # Service Description
11946///
11947/// Service for the `regionInstanceGroupManagerResizeRequests` resource.
11948///
11949/// # Configuration
11950///
11951/// To configure `RegionInstanceGroupManagerResizeRequests` use the `with_*` methods in the type returned
11952/// by [builder()][RegionInstanceGroupManagerResizeRequests::builder]. The default configuration should
11953/// work for most applications. Common configuration changes include
11954///
11955/// * [with_endpoint()]: by default this client uses the global default endpoint
11956/// (`https://compute.googleapis.com`). Applications using regional
11957/// endpoints or running in restricted networks (e.g. a network configured
11958/// with [Private Google Access with VPC Service Controls]) may want to
11959/// override this default.
11960/// * [with_credentials()]: by default this client uses
11961/// [Application Default Credentials]. Applications using custom
11962/// authentication may need to override this default.
11963///
11964/// [with_endpoint()]: super::builder::region_instance_group_manager_resize_requests::ClientBuilder::with_endpoint
11965/// [with_credentials()]: super::builder::region_instance_group_manager_resize_requests::ClientBuilder::with_credentials
11966/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11967/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11968///
11969/// # Pooling and Cloning
11970///
11971/// `RegionInstanceGroupManagerResizeRequests` holds a connection pool internally, it is advised to
11972/// create one and reuse it. You do not need to wrap `RegionInstanceGroupManagerResizeRequests` in
11973/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11974/// already uses an `Arc` internally.
11975#[cfg(feature = "region-instance-group-manager-resize-requests")]
11976#[cfg_attr(
11977 docsrs,
11978 doc(cfg(feature = "region-instance-group-manager-resize-requests"))
11979)]
11980#[derive(Clone, Debug)]
11981pub struct RegionInstanceGroupManagerResizeRequests {
11982 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagerResizeRequests>,
11983}
11984
11985#[cfg(feature = "region-instance-group-manager-resize-requests")]
11986impl RegionInstanceGroupManagerResizeRequests {
11987 /// Returns a builder for [RegionInstanceGroupManagerResizeRequests].
11988 ///
11989 /// ```
11990 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11991 /// # use google_cloud_compute_v1::client::RegionInstanceGroupManagerResizeRequests;
11992 /// let client = RegionInstanceGroupManagerResizeRequests::builder().build().await?;
11993 /// # Ok(()) }
11994 /// ```
11995 pub fn builder() -> super::builder::region_instance_group_manager_resize_requests::ClientBuilder
11996 {
11997 crate::new_client_builder(
11998 super::builder::region_instance_group_manager_resize_requests::client::Factory,
11999 )
12000 }
12001
12002 /// Creates a new client from the provided stub.
12003 ///
12004 /// The most common case for calling this function is in tests mocking the
12005 /// client's behavior.
12006 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12007 where
12008 T: super::stub::RegionInstanceGroupManagerResizeRequests + 'static,
12009 {
12010 Self { inner: stub.into() }
12011 }
12012
12013 pub(crate) async fn new(
12014 config: gaxi::options::ClientConfig,
12015 ) -> crate::ClientBuilderResult<Self> {
12016 let inner = Self::build_inner(config).await?;
12017 Ok(Self { inner })
12018 }
12019
12020 async fn build_inner(
12021 conf: gaxi::options::ClientConfig,
12022 ) -> crate::ClientBuilderResult<
12023 std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagerResizeRequests>,
12024 > {
12025 if gaxi::options::tracing_enabled(&conf) {
12026 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12027 }
12028 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12029 }
12030
12031 async fn build_transport(
12032 conf: gaxi::options::ClientConfig,
12033 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagerResizeRequests>
12034 {
12035 super::transport::RegionInstanceGroupManagerResizeRequests::new(conf).await
12036 }
12037
12038 async fn build_with_tracing(
12039 conf: gaxi::options::ClientConfig,
12040 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagerResizeRequests>
12041 {
12042 Self::build_transport(conf)
12043 .await
12044 .map(super::tracing::RegionInstanceGroupManagerResizeRequests::new)
12045 }
12046
12047 /// Cancels the specified resize request.
12048 /// Cancelled resize request no longer waits for the resources to be
12049 /// provisioned. Cancel is only possible for requests that are in accepted
12050 /// state.
12051 pub fn cancel(&self) -> super::builder::region_instance_group_manager_resize_requests::Cancel {
12052 super::builder::region_instance_group_manager_resize_requests::Cancel::new(
12053 self.inner.clone(),
12054 )
12055 }
12056
12057 /// Deletes the specified, inactive resize request. Requests that are still
12058 /// active cannot be deleted. Deleting request does not delete instances that
12059 /// were provisioned previously.
12060 pub fn delete(&self) -> super::builder::region_instance_group_manager_resize_requests::Delete {
12061 super::builder::region_instance_group_manager_resize_requests::Delete::new(
12062 self.inner.clone(),
12063 )
12064 }
12065
12066 /// Returns all of the details about the specified resize request.
12067 pub fn get(&self) -> super::builder::region_instance_group_manager_resize_requests::Get {
12068 super::builder::region_instance_group_manager_resize_requests::Get::new(self.inner.clone())
12069 }
12070
12071 /// Creates a new Resize Request that starts provisioning VMs immediately
12072 /// or queues VM creation.
12073 pub fn insert(&self) -> super::builder::region_instance_group_manager_resize_requests::Insert {
12074 super::builder::region_instance_group_manager_resize_requests::Insert::new(
12075 self.inner.clone(),
12076 )
12077 }
12078
12079 /// Retrieves a list of Resize Requests that are contained in the
12080 /// managed instance group.
12081 pub fn list(&self) -> super::builder::region_instance_group_manager_resize_requests::List {
12082 super::builder::region_instance_group_manager_resize_requests::List::new(self.inner.clone())
12083 }
12084
12085 /// Retrieves the specified region-specific Operations resource.
12086 pub fn get_operation(
12087 &self,
12088 ) -> super::builder::region_instance_group_manager_resize_requests::GetOperation {
12089 super::builder::region_instance_group_manager_resize_requests::GetOperation::new(
12090 self.inner.clone(),
12091 )
12092 }
12093}
12094
12095/// Implements a client for the Google Compute Engine API.
12096///
12097/// # Example
12098/// ```
12099/// # use google_cloud_compute_v1::client::RegionInstanceGroupManagers;
12100/// async fn sample(
12101/// ) -> anyhow::Result<()> {
12102/// let client = RegionInstanceGroupManagers::builder().build().await?;
12103/// // use `client` to make requests to the Google Compute Engine API.
12104/// Ok(())
12105/// }
12106/// ```
12107///
12108/// # Service Description
12109///
12110/// Service for the `regionInstanceGroupManagers` resource.
12111///
12112/// # Configuration
12113///
12114/// To configure `RegionInstanceGroupManagers` use the `with_*` methods in the type returned
12115/// by [builder()][RegionInstanceGroupManagers::builder]. The default configuration should
12116/// work for most applications. Common configuration changes include
12117///
12118/// * [with_endpoint()]: by default this client uses the global default endpoint
12119/// (`https://compute.googleapis.com`). Applications using regional
12120/// endpoints or running in restricted networks (e.g. a network configured
12121/// with [Private Google Access with VPC Service Controls]) may want to
12122/// override this default.
12123/// * [with_credentials()]: by default this client uses
12124/// [Application Default Credentials]. Applications using custom
12125/// authentication may need to override this default.
12126///
12127/// [with_endpoint()]: super::builder::region_instance_group_managers::ClientBuilder::with_endpoint
12128/// [with_credentials()]: super::builder::region_instance_group_managers::ClientBuilder::with_credentials
12129/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12130/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12131///
12132/// # Pooling and Cloning
12133///
12134/// `RegionInstanceGroupManagers` holds a connection pool internally, it is advised to
12135/// create one and reuse it. You do not need to wrap `RegionInstanceGroupManagers` in
12136/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12137/// already uses an `Arc` internally.
12138#[cfg(feature = "region-instance-group-managers")]
12139#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-group-managers")))]
12140#[derive(Clone, Debug)]
12141pub struct RegionInstanceGroupManagers {
12142 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagers>,
12143}
12144
12145#[cfg(feature = "region-instance-group-managers")]
12146impl RegionInstanceGroupManagers {
12147 /// Returns a builder for [RegionInstanceGroupManagers].
12148 ///
12149 /// ```
12150 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12151 /// # use google_cloud_compute_v1::client::RegionInstanceGroupManagers;
12152 /// let client = RegionInstanceGroupManagers::builder().build().await?;
12153 /// # Ok(()) }
12154 /// ```
12155 pub fn builder() -> super::builder::region_instance_group_managers::ClientBuilder {
12156 crate::new_client_builder(super::builder::region_instance_group_managers::client::Factory)
12157 }
12158
12159 /// Creates a new client from the provided stub.
12160 ///
12161 /// The most common case for calling this function is in tests mocking the
12162 /// client's behavior.
12163 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12164 where
12165 T: super::stub::RegionInstanceGroupManagers + 'static,
12166 {
12167 Self { inner: stub.into() }
12168 }
12169
12170 pub(crate) async fn new(
12171 config: gaxi::options::ClientConfig,
12172 ) -> crate::ClientBuilderResult<Self> {
12173 let inner = Self::build_inner(config).await?;
12174 Ok(Self { inner })
12175 }
12176
12177 async fn build_inner(
12178 conf: gaxi::options::ClientConfig,
12179 ) -> crate::ClientBuilderResult<
12180 std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagers>,
12181 > {
12182 if gaxi::options::tracing_enabled(&conf) {
12183 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12184 }
12185 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12186 }
12187
12188 async fn build_transport(
12189 conf: gaxi::options::ClientConfig,
12190 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagers> {
12191 super::transport::RegionInstanceGroupManagers::new(conf).await
12192 }
12193
12194 async fn build_with_tracing(
12195 conf: gaxi::options::ClientConfig,
12196 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagers> {
12197 Self::build_transport(conf)
12198 .await
12199 .map(super::tracing::RegionInstanceGroupManagers::new)
12200 }
12201
12202 /// Flags the specified instances to be immediately removed from the managed
12203 /// instance group. Abandoning an instance does not delete the
12204 /// instance, but it does remove the instance from any target pools that are
12205 /// applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
12206 /// number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
12207 /// not yet been removed from the group. You must separately verify the
12208 /// status of the abandoning action with thelistmanagedinstances
12209 /// method.
12210 ///
12211 /// If the group is part of a backend
12212 /// service that has enabled
12213 /// connection draining, it can take up to 60 seconds after the connection
12214 /// draining duration has elapsed before the VM instance is removed or deleted.
12215 ///
12216 /// You can specify a maximum of 1000 instances with this method per request.
12217 pub fn abandon_instances(
12218 &self,
12219 ) -> super::builder::region_instance_group_managers::AbandonInstances {
12220 super::builder::region_instance_group_managers::AbandonInstances::new(self.inner.clone())
12221 }
12222
12223 /// Apply updates to selected instances the managed instance group.
12224 pub fn apply_updates_to_instances(
12225 &self,
12226 ) -> super::builder::region_instance_group_managers::ApplyUpdatesToInstances {
12227 super::builder::region_instance_group_managers::ApplyUpdatesToInstances::new(
12228 self.inner.clone(),
12229 )
12230 }
12231
12232 /// Creates instances with per-instance configurations in this regional managed
12233 /// instance group. Instances are created using the current instance template.
12234 /// The create instances operation is marked DONE if
12235 /// the createInstances request is successful. The underlying
12236 /// actions take additional time. You must separately verify the status of thecreating or actions with the listmanagedinstances
12237 /// method.
12238 pub fn create_instances(
12239 &self,
12240 ) -> super::builder::region_instance_group_managers::CreateInstances {
12241 super::builder::region_instance_group_managers::CreateInstances::new(self.inner.clone())
12242 }
12243
12244 /// Deletes the specified managed instance group and all of the instances
12245 /// in that group.
12246 pub fn delete(&self) -> super::builder::region_instance_group_managers::Delete {
12247 super::builder::region_instance_group_managers::Delete::new(self.inner.clone())
12248 }
12249
12250 /// Flags the specified instances in the managed instance group to be
12251 /// immediately deleted. The instances are also removed from any target
12252 /// pools of which they were a member. This method reduces thetargetSize of the managed instance group by the number of
12253 /// instances that you delete.
12254 /// The deleteInstances operation is marked DONE if
12255 /// the deleteInstances request is successful. The underlying
12256 /// actions take additional time. You must separately verify the status of thedeleting action with thelistmanagedinstances
12257 /// method.
12258 ///
12259 /// If the group is part of a backend
12260 /// service that has enabled
12261 /// connection draining, it can take up to 60 seconds after the connection
12262 /// draining duration has elapsed before the VM instance is removed or deleted.
12263 ///
12264 /// You can specify a maximum of 1000 instances with this method per request.
12265 pub fn delete_instances(
12266 &self,
12267 ) -> super::builder::region_instance_group_managers::DeleteInstances {
12268 super::builder::region_instance_group_managers::DeleteInstances::new(self.inner.clone())
12269 }
12270
12271 /// Deletes selected per-instance configurations for the managed instance
12272 /// group.
12273 pub fn delete_per_instance_configs(
12274 &self,
12275 ) -> super::builder::region_instance_group_managers::DeletePerInstanceConfigs {
12276 super::builder::region_instance_group_managers::DeletePerInstanceConfigs::new(
12277 self.inner.clone(),
12278 )
12279 }
12280
12281 /// Returns all of the details about the specified managed instance group.
12282 pub fn get(&self) -> super::builder::region_instance_group_managers::Get {
12283 super::builder::region_instance_group_managers::Get::new(self.inner.clone())
12284 }
12285
12286 /// Creates a managed instance group using the information that you specify
12287 /// in the request. After the group is created, instances in the group are
12288 /// created using the specified instance template.
12289 /// This operation is marked as DONE when the group is created
12290 /// even if the instances in the group have not yet been created. You must
12291 /// separately verify the status of the individual instances with thelistmanagedinstances
12292 /// method.
12293 ///
12294 /// A regional managed instance group can contain up to 2000 instances.
12295 pub fn insert(&self) -> super::builder::region_instance_group_managers::Insert {
12296 super::builder::region_instance_group_managers::Insert::new(self.inner.clone())
12297 }
12298
12299 /// Retrieves the list of managed instance groups that are contained
12300 /// within the specified region.
12301 pub fn list(&self) -> super::builder::region_instance_group_managers::List {
12302 super::builder::region_instance_group_managers::List::new(self.inner.clone())
12303 }
12304
12305 /// Lists all errors thrown by actions on instances for a given regional
12306 /// managed instance group. The filter andorderBy query parameters are not supported.
12307 pub fn list_errors(&self) -> super::builder::region_instance_group_managers::ListErrors {
12308 super::builder::region_instance_group_managers::ListErrors::new(self.inner.clone())
12309 }
12310
12311 /// Lists the instances in the managed instance group and instances that are
12312 /// scheduled to be created. The list includes any current actions
12313 /// that the group has scheduled for its instances. The orderBy
12314 /// query parameter is not supported. The `pageToken` query parameter is
12315 /// supported only if the group's `listManagedInstancesResults` field is set
12316 /// to `PAGINATED`.
12317 pub fn list_managed_instances(
12318 &self,
12319 ) -> super::builder::region_instance_group_managers::ListManagedInstances {
12320 super::builder::region_instance_group_managers::ListManagedInstances::new(
12321 self.inner.clone(),
12322 )
12323 }
12324
12325 /// Lists all of the per-instance configurations defined for the managed
12326 /// instance group. The orderBy query parameter is not supported.
12327 pub fn list_per_instance_configs(
12328 &self,
12329 ) -> super::builder::region_instance_group_managers::ListPerInstanceConfigs {
12330 super::builder::region_instance_group_managers::ListPerInstanceConfigs::new(
12331 self.inner.clone(),
12332 )
12333 }
12334
12335 /// Updates a managed instance group using the information that you specify
12336 /// in the request.
12337 /// This operation is marked as DONE when the group is patched
12338 /// even if the instances in the group are still in the process of being
12339 /// patched. You must separately verify the status of the individual instances
12340 /// with the listmanagedinstances
12341 /// method. This method supportsPATCH
12342 /// semantics and uses theJSON merge
12343 /// patch format and processing rules.
12344 ///
12345 /// If you update your group to specify a new template or instance
12346 /// configuration, it's possible that your intended specification for each VM
12347 /// in the group is different from the current state of that VM. To learn how
12348 /// to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
12349 /// a MIG.
12350 pub fn patch(&self) -> super::builder::region_instance_group_managers::Patch {
12351 super::builder::region_instance_group_managers::Patch::new(self.inner.clone())
12352 }
12353
12354 /// Inserts or patches per-instance configurations for the managed instance
12355 /// group. perInstanceConfig.name serves as a key used to
12356 /// distinguish whether to perform insert or patch.
12357 pub fn patch_per_instance_configs(
12358 &self,
12359 ) -> super::builder::region_instance_group_managers::PatchPerInstanceConfigs {
12360 super::builder::region_instance_group_managers::PatchPerInstanceConfigs::new(
12361 self.inner.clone(),
12362 )
12363 }
12364
12365 /// Flags the specified VM instances in the managed instance group to be
12366 /// immediately recreated. Each instance is recreated using the group's current
12367 /// configuration. This operation is marked as DONE when the flag
12368 /// is set even if the instances have not yet been recreated. You must
12369 /// separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
12370 /// the status of managed instances.
12371 ///
12372 /// If the group is part of a backend
12373 /// service that has enabled
12374 /// connection draining, it can take up to 60 seconds after the connection
12375 /// draining duration has elapsed before the VM instance is removed or deleted.
12376 ///
12377 /// You can specify a maximum of 1000 instances with this method per request.
12378 pub fn recreate_instances(
12379 &self,
12380 ) -> super::builder::region_instance_group_managers::RecreateInstances {
12381 super::builder::region_instance_group_managers::RecreateInstances::new(self.inner.clone())
12382 }
12383
12384 /// Changes the intended size of the managed instance group. If you increase
12385 /// the size, the group creates new instances using the current instance
12386 /// template. If you decrease the size, the group deletes one or more
12387 /// instances.
12388 ///
12389 /// The resize operation is marked DONE if theresize request is successful. The underlying actions take
12390 /// additional time. You must separately verify the status of thecreating or deleting actions with thelistmanagedinstances
12391 /// method.
12392 ///
12393 /// If the group is part of a backend
12394 /// service that has enabled
12395 /// connection draining, it can take up to 60 seconds after the connection
12396 /// draining duration has elapsed before the VM instance is removed or deleted.
12397 pub fn resize(&self) -> super::builder::region_instance_group_managers::Resize {
12398 super::builder::region_instance_group_managers::Resize::new(self.inner.clone())
12399 }
12400
12401 /// Flags the specified instances in the managed instance group to be
12402 /// resumed. This method increases thetargetSize and decreases the targetSuspendedSize
12403 /// of the managed instance group by the number of instances that you resume.
12404 /// The resumeInstances operation is marked DONE if
12405 /// the resumeInstances request is successful. The underlying
12406 /// actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
12407 /// method.
12408 ///
12409 /// In this request, you can only specify instances that are suspended. For
12410 /// example, if an instance was previously suspended using the suspendInstances
12411 /// method, it can be resumed using the resumeInstances method.
12412 ///
12413 /// If a health check is attached to the managed instance group, the specified
12414 /// instances will be verified as healthy after they are resumed.
12415 ///
12416 /// You can specify a maximum of 1000 instances with this method per request.
12417 pub fn resume_instances(
12418 &self,
12419 ) -> super::builder::region_instance_group_managers::ResumeInstances {
12420 super::builder::region_instance_group_managers::ResumeInstances::new(self.inner.clone())
12421 }
12422
12423 /// Sets the instance template to use when creating new instances or recreating
12424 /// instances in this group. Existing instances are not affected.
12425 pub fn set_instance_template(
12426 &self,
12427 ) -> super::builder::region_instance_group_managers::SetInstanceTemplate {
12428 super::builder::region_instance_group_managers::SetInstanceTemplate::new(self.inner.clone())
12429 }
12430
12431 /// Modifies the target pools to which all new instances in this group are
12432 /// assigned. Existing instances in the group are not affected.
12433 pub fn set_target_pools(
12434 &self,
12435 ) -> super::builder::region_instance_group_managers::SetTargetPools {
12436 super::builder::region_instance_group_managers::SetTargetPools::new(self.inner.clone())
12437 }
12438
12439 /// Flags the specified instances in the managed instance group to be
12440 /// started. This method increases thetargetSize and decreases the targetStoppedSize
12441 /// of the managed instance group by the number of instances that you start.
12442 /// The startInstances operation is marked DONE if
12443 /// the startInstances request is successful. The underlying
12444 /// actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
12445 /// method.
12446 ///
12447 /// In this request, you can only specify instances that are stopped. For
12448 /// example, if an instance was previously stopped using the stopInstances
12449 /// method, it can be started using the startInstances method.
12450 ///
12451 /// If a health check is attached to the managed instance group, the specified
12452 /// instances will be verified as healthy after they are started.
12453 ///
12454 /// You can specify a maximum of 1000 instances with this method per request.
12455 pub fn start_instances(
12456 &self,
12457 ) -> super::builder::region_instance_group_managers::StartInstances {
12458 super::builder::region_instance_group_managers::StartInstances::new(self.inner.clone())
12459 }
12460
12461 /// Flags the specified instances in the managed instance group to be
12462 /// immediately stopped. You can only specify instances that are running in
12463 /// this request. This method reduces thetargetSize and increases the targetStoppedSize
12464 /// of the managed instance group by the number of instances that you stop.
12465 /// The stopInstances operation is marked DONE if
12466 /// the stopInstances request is successful. The underlying
12467 /// actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
12468 /// method.
12469 ///
12470 /// If the standbyPolicy.initialDelaySec field is set, the group
12471 /// delays stopping the instances until initialDelaySec have
12472 /// passed from instance.creationTimestamp (that is, when the
12473 /// instance was created). This delay gives your application time to
12474 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
12475 /// will be zero delay.
12476 ///
12477 /// If the group is part of a backend
12478 /// service that has enabled
12479 /// connection draining, it can take up to 60 seconds after the connection
12480 /// draining duration has elapsed before the VM instance is stopped.
12481 ///
12482 /// Stopped instances can be started using the startInstances
12483 /// method.
12484 ///
12485 /// You can specify a maximum of 1000 instances with this method per request.
12486 pub fn stop_instances(&self) -> super::builder::region_instance_group_managers::StopInstances {
12487 super::builder::region_instance_group_managers::StopInstances::new(self.inner.clone())
12488 }
12489
12490 /// Flags the specified instances in the managed instance group to be
12491 /// immediately suspended. You can only specify instances that are running in
12492 /// this request. This method reduces thetargetSize and increases the targetSuspendedSize
12493 /// of the managed instance group by the number of instances that you suspend.
12494 /// The suspendInstances operation is marked DONE if
12495 /// the suspendInstances request is successful. The underlying
12496 /// actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
12497 /// method.
12498 ///
12499 /// If the standbyPolicy.initialDelaySec field is set, the group
12500 /// delays suspension of the instances until initialDelaySec have
12501 /// passed from instance.creationTimestamp (that is, when the
12502 /// instance was created). This delay gives your application time to
12503 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
12504 /// will be zero delay.
12505 ///
12506 /// If the group is part of a backend
12507 /// service that has enabled
12508 /// connection draining, it can take up to 60 seconds after the connection
12509 /// draining duration has elapsed before the VM instance is suspended.
12510 ///
12511 /// Suspended instances can be resumed using the resumeInstances
12512 /// method.
12513 ///
12514 /// You can specify a maximum of 1000 instances with this method per request.
12515 pub fn suspend_instances(
12516 &self,
12517 ) -> super::builder::region_instance_group_managers::SuspendInstances {
12518 super::builder::region_instance_group_managers::SuspendInstances::new(self.inner.clone())
12519 }
12520
12521 /// Inserts or updates per-instance configurations for the managed instance
12522 /// group. perInstanceConfig.name serves as a key used to
12523 /// distinguish whether to perform insert or patch.
12524 pub fn update_per_instance_configs(
12525 &self,
12526 ) -> super::builder::region_instance_group_managers::UpdatePerInstanceConfigs {
12527 super::builder::region_instance_group_managers::UpdatePerInstanceConfigs::new(
12528 self.inner.clone(),
12529 )
12530 }
12531
12532 /// Retrieves the specified region-specific Operations resource.
12533 pub fn get_operation(&self) -> super::builder::region_instance_group_managers::GetOperation {
12534 super::builder::region_instance_group_managers::GetOperation::new(self.inner.clone())
12535 }
12536}
12537
12538/// Implements a client for the Google Compute Engine API.
12539///
12540/// # Example
12541/// ```
12542/// # use google_cloud_compute_v1::client::RegionInstanceGroups;
12543/// async fn sample(
12544/// ) -> anyhow::Result<()> {
12545/// let client = RegionInstanceGroups::builder().build().await?;
12546/// // use `client` to make requests to the Google Compute Engine API.
12547/// Ok(())
12548/// }
12549/// ```
12550///
12551/// # Service Description
12552///
12553/// Service for the `regionInstanceGroups` resource.
12554///
12555/// # Configuration
12556///
12557/// To configure `RegionInstanceGroups` use the `with_*` methods in the type returned
12558/// by [builder()][RegionInstanceGroups::builder]. The default configuration should
12559/// work for most applications. Common configuration changes include
12560///
12561/// * [with_endpoint()]: by default this client uses the global default endpoint
12562/// (`https://compute.googleapis.com`). Applications using regional
12563/// endpoints or running in restricted networks (e.g. a network configured
12564/// with [Private Google Access with VPC Service Controls]) may want to
12565/// override this default.
12566/// * [with_credentials()]: by default this client uses
12567/// [Application Default Credentials]. Applications using custom
12568/// authentication may need to override this default.
12569///
12570/// [with_endpoint()]: super::builder::region_instance_groups::ClientBuilder::with_endpoint
12571/// [with_credentials()]: super::builder::region_instance_groups::ClientBuilder::with_credentials
12572/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12573/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12574///
12575/// # Pooling and Cloning
12576///
12577/// `RegionInstanceGroups` holds a connection pool internally, it is advised to
12578/// create one and reuse it. You do not need to wrap `RegionInstanceGroups` in
12579/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12580/// already uses an `Arc` internally.
12581#[cfg(feature = "region-instance-groups")]
12582#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-groups")))]
12583#[derive(Clone, Debug)]
12584pub struct RegionInstanceGroups {
12585 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroups>,
12586}
12587
12588#[cfg(feature = "region-instance-groups")]
12589impl RegionInstanceGroups {
12590 /// Returns a builder for [RegionInstanceGroups].
12591 ///
12592 /// ```
12593 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12594 /// # use google_cloud_compute_v1::client::RegionInstanceGroups;
12595 /// let client = RegionInstanceGroups::builder().build().await?;
12596 /// # Ok(()) }
12597 /// ```
12598 pub fn builder() -> super::builder::region_instance_groups::ClientBuilder {
12599 crate::new_client_builder(super::builder::region_instance_groups::client::Factory)
12600 }
12601
12602 /// Creates a new client from the provided stub.
12603 ///
12604 /// The most common case for calling this function is in tests mocking the
12605 /// client's behavior.
12606 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12607 where
12608 T: super::stub::RegionInstanceGroups + 'static,
12609 {
12610 Self { inner: stub.into() }
12611 }
12612
12613 pub(crate) async fn new(
12614 config: gaxi::options::ClientConfig,
12615 ) -> crate::ClientBuilderResult<Self> {
12616 let inner = Self::build_inner(config).await?;
12617 Ok(Self { inner })
12618 }
12619
12620 async fn build_inner(
12621 conf: gaxi::options::ClientConfig,
12622 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroups>>
12623 {
12624 if gaxi::options::tracing_enabled(&conf) {
12625 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12626 }
12627 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12628 }
12629
12630 async fn build_transport(
12631 conf: gaxi::options::ClientConfig,
12632 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroups> {
12633 super::transport::RegionInstanceGroups::new(conf).await
12634 }
12635
12636 async fn build_with_tracing(
12637 conf: gaxi::options::ClientConfig,
12638 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroups> {
12639 Self::build_transport(conf)
12640 .await
12641 .map(super::tracing::RegionInstanceGroups::new)
12642 }
12643
12644 /// Returns the specified instance group resource.
12645 pub fn get(&self) -> super::builder::region_instance_groups::Get {
12646 super::builder::region_instance_groups::Get::new(self.inner.clone())
12647 }
12648
12649 /// Retrieves the list of instance group resources contained within
12650 /// the specified region.
12651 pub fn list(&self) -> super::builder::region_instance_groups::List {
12652 super::builder::region_instance_groups::List::new(self.inner.clone())
12653 }
12654
12655 /// Lists the instances in the specified instance group and displays
12656 /// information about the named ports. Depending on the specified options, this
12657 /// method can list all instances or only the instances that are running.
12658 /// The orderBy query parameter is not supported.
12659 pub fn list_instances(&self) -> super::builder::region_instance_groups::ListInstances {
12660 super::builder::region_instance_groups::ListInstances::new(self.inner.clone())
12661 }
12662
12663 /// Sets the named ports for the specified regional instance group.
12664 pub fn set_named_ports(&self) -> super::builder::region_instance_groups::SetNamedPorts {
12665 super::builder::region_instance_groups::SetNamedPorts::new(self.inner.clone())
12666 }
12667
12668 /// Returns permissions that a caller has on the specified resource.
12669 pub fn test_iam_permissions(
12670 &self,
12671 ) -> super::builder::region_instance_groups::TestIamPermissions {
12672 super::builder::region_instance_groups::TestIamPermissions::new(self.inner.clone())
12673 }
12674
12675 /// Retrieves the specified region-specific Operations resource.
12676 pub fn get_operation(&self) -> super::builder::region_instance_groups::GetOperation {
12677 super::builder::region_instance_groups::GetOperation::new(self.inner.clone())
12678 }
12679}
12680
12681/// Implements a client for the Google Compute Engine API.
12682///
12683/// # Example
12684/// ```
12685/// # use google_cloud_compute_v1::client::RegionInstanceTemplates;
12686/// async fn sample(
12687/// ) -> anyhow::Result<()> {
12688/// let client = RegionInstanceTemplates::builder().build().await?;
12689/// // use `client` to make requests to the Google Compute Engine API.
12690/// Ok(())
12691/// }
12692/// ```
12693///
12694/// # Service Description
12695///
12696/// Service for the `regionInstanceTemplates` resource.
12697///
12698/// # Configuration
12699///
12700/// To configure `RegionInstanceTemplates` use the `with_*` methods in the type returned
12701/// by [builder()][RegionInstanceTemplates::builder]. The default configuration should
12702/// work for most applications. Common configuration changes include
12703///
12704/// * [with_endpoint()]: by default this client uses the global default endpoint
12705/// (`https://compute.googleapis.com`). Applications using regional
12706/// endpoints or running in restricted networks (e.g. a network configured
12707/// with [Private Google Access with VPC Service Controls]) may want to
12708/// override this default.
12709/// * [with_credentials()]: by default this client uses
12710/// [Application Default Credentials]. Applications using custom
12711/// authentication may need to override this default.
12712///
12713/// [with_endpoint()]: super::builder::region_instance_templates::ClientBuilder::with_endpoint
12714/// [with_credentials()]: super::builder::region_instance_templates::ClientBuilder::with_credentials
12715/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12716/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12717///
12718/// # Pooling and Cloning
12719///
12720/// `RegionInstanceTemplates` holds a connection pool internally, it is advised to
12721/// create one and reuse it. You do not need to wrap `RegionInstanceTemplates` in
12722/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12723/// already uses an `Arc` internally.
12724#[cfg(feature = "region-instance-templates")]
12725#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-templates")))]
12726#[derive(Clone, Debug)]
12727pub struct RegionInstanceTemplates {
12728 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceTemplates>,
12729}
12730
12731#[cfg(feature = "region-instance-templates")]
12732impl RegionInstanceTemplates {
12733 /// Returns a builder for [RegionInstanceTemplates].
12734 ///
12735 /// ```
12736 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12737 /// # use google_cloud_compute_v1::client::RegionInstanceTemplates;
12738 /// let client = RegionInstanceTemplates::builder().build().await?;
12739 /// # Ok(()) }
12740 /// ```
12741 pub fn builder() -> super::builder::region_instance_templates::ClientBuilder {
12742 crate::new_client_builder(super::builder::region_instance_templates::client::Factory)
12743 }
12744
12745 /// Creates a new client from the provided stub.
12746 ///
12747 /// The most common case for calling this function is in tests mocking the
12748 /// client's behavior.
12749 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12750 where
12751 T: super::stub::RegionInstanceTemplates + 'static,
12752 {
12753 Self { inner: stub.into() }
12754 }
12755
12756 pub(crate) async fn new(
12757 config: gaxi::options::ClientConfig,
12758 ) -> crate::ClientBuilderResult<Self> {
12759 let inner = Self::build_inner(config).await?;
12760 Ok(Self { inner })
12761 }
12762
12763 async fn build_inner(
12764 conf: gaxi::options::ClientConfig,
12765 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstanceTemplates>>
12766 {
12767 if gaxi::options::tracing_enabled(&conf) {
12768 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12769 }
12770 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12771 }
12772
12773 async fn build_transport(
12774 conf: gaxi::options::ClientConfig,
12775 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceTemplates> {
12776 super::transport::RegionInstanceTemplates::new(conf).await
12777 }
12778
12779 async fn build_with_tracing(
12780 conf: gaxi::options::ClientConfig,
12781 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceTemplates> {
12782 Self::build_transport(conf)
12783 .await
12784 .map(super::tracing::RegionInstanceTemplates::new)
12785 }
12786
12787 /// Deletes the specified instance template. Deleting an instance template is
12788 /// permanent and cannot be undone.
12789 pub fn delete(&self) -> super::builder::region_instance_templates::Delete {
12790 super::builder::region_instance_templates::Delete::new(self.inner.clone())
12791 }
12792
12793 /// Returns the specified instance template.
12794 pub fn get(&self) -> super::builder::region_instance_templates::Get {
12795 super::builder::region_instance_templates::Get::new(self.inner.clone())
12796 }
12797
12798 /// Creates an instance template in the specified project and region using the
12799 /// global instance template whose URL is included in the request.
12800 pub fn insert(&self) -> super::builder::region_instance_templates::Insert {
12801 super::builder::region_instance_templates::Insert::new(self.inner.clone())
12802 }
12803
12804 /// Retrieves a list of instance templates that are contained within the
12805 /// specified project and region.
12806 pub fn list(&self) -> super::builder::region_instance_templates::List {
12807 super::builder::region_instance_templates::List::new(self.inner.clone())
12808 }
12809
12810 /// Retrieves the specified region-specific Operations resource.
12811 pub fn get_operation(&self) -> super::builder::region_instance_templates::GetOperation {
12812 super::builder::region_instance_templates::GetOperation::new(self.inner.clone())
12813 }
12814}
12815
12816/// Implements a client for the Google Compute Engine API.
12817///
12818/// # Example
12819/// ```
12820/// # use google_cloud_compute_v1::client::RegionInstances;
12821/// async fn sample(
12822/// ) -> anyhow::Result<()> {
12823/// let client = RegionInstances::builder().build().await?;
12824/// // use `client` to make requests to the Google Compute Engine API.
12825/// Ok(())
12826/// }
12827/// ```
12828///
12829/// # Service Description
12830///
12831/// Service for the `regionInstances` resource.
12832///
12833/// # Configuration
12834///
12835/// To configure `RegionInstances` use the `with_*` methods in the type returned
12836/// by [builder()][RegionInstances::builder]. The default configuration should
12837/// work for most applications. Common configuration changes include
12838///
12839/// * [with_endpoint()]: by default this client uses the global default endpoint
12840/// (`https://compute.googleapis.com`). Applications using regional
12841/// endpoints or running in restricted networks (e.g. a network configured
12842/// with [Private Google Access with VPC Service Controls]) may want to
12843/// override this default.
12844/// * [with_credentials()]: by default this client uses
12845/// [Application Default Credentials]. Applications using custom
12846/// authentication may need to override this default.
12847///
12848/// [with_endpoint()]: super::builder::region_instances::ClientBuilder::with_endpoint
12849/// [with_credentials()]: super::builder::region_instances::ClientBuilder::with_credentials
12850/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12851/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12852///
12853/// # Pooling and Cloning
12854///
12855/// `RegionInstances` holds a connection pool internally, it is advised to
12856/// create one and reuse it. You do not need to wrap `RegionInstances` in
12857/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12858/// already uses an `Arc` internally.
12859#[cfg(feature = "region-instances")]
12860#[cfg_attr(docsrs, doc(cfg(feature = "region-instances")))]
12861#[derive(Clone, Debug)]
12862pub struct RegionInstances {
12863 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstances>,
12864}
12865
12866#[cfg(feature = "region-instances")]
12867impl RegionInstances {
12868 /// Returns a builder for [RegionInstances].
12869 ///
12870 /// ```
12871 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12872 /// # use google_cloud_compute_v1::client::RegionInstances;
12873 /// let client = RegionInstances::builder().build().await?;
12874 /// # Ok(()) }
12875 /// ```
12876 pub fn builder() -> super::builder::region_instances::ClientBuilder {
12877 crate::new_client_builder(super::builder::region_instances::client::Factory)
12878 }
12879
12880 /// Creates a new client from the provided stub.
12881 ///
12882 /// The most common case for calling this function is in tests mocking the
12883 /// client's behavior.
12884 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12885 where
12886 T: super::stub::RegionInstances + 'static,
12887 {
12888 Self { inner: stub.into() }
12889 }
12890
12891 pub(crate) async fn new(
12892 config: gaxi::options::ClientConfig,
12893 ) -> crate::ClientBuilderResult<Self> {
12894 let inner = Self::build_inner(config).await?;
12895 Ok(Self { inner })
12896 }
12897
12898 async fn build_inner(
12899 conf: gaxi::options::ClientConfig,
12900 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstances>> {
12901 if gaxi::options::tracing_enabled(&conf) {
12902 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12903 }
12904 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12905 }
12906
12907 async fn build_transport(
12908 conf: gaxi::options::ClientConfig,
12909 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstances> {
12910 super::transport::RegionInstances::new(conf).await
12911 }
12912
12913 async fn build_with_tracing(
12914 conf: gaxi::options::ClientConfig,
12915 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstances> {
12916 Self::build_transport(conf)
12917 .await
12918 .map(super::tracing::RegionInstances::new)
12919 }
12920
12921 /// Creates multiple instances in a given region. Count specifies the number of
12922 /// instances to create.
12923 pub fn bulk_insert(&self) -> super::builder::region_instances::BulkInsert {
12924 super::builder::region_instances::BulkInsert::new(self.inner.clone())
12925 }
12926
12927 /// Retrieves the specified region-specific Operations resource.
12928 pub fn get_operation(&self) -> super::builder::region_instances::GetOperation {
12929 super::builder::region_instances::GetOperation::new(self.inner.clone())
12930 }
12931}
12932
12933/// Implements a client for the Google Compute Engine API.
12934///
12935/// # Example
12936/// ```
12937/// # use google_cloud_compute_v1::client::RegionInstantSnapshotGroups;
12938/// async fn sample(
12939/// ) -> anyhow::Result<()> {
12940/// let client = RegionInstantSnapshotGroups::builder().build().await?;
12941/// // use `client` to make requests to the Google Compute Engine API.
12942/// Ok(())
12943/// }
12944/// ```
12945///
12946/// # Service Description
12947///
12948/// Service for the `regionInstantSnapshotGroups` resource.
12949///
12950/// # Configuration
12951///
12952/// To configure `RegionInstantSnapshotGroups` use the `with_*` methods in the type returned
12953/// by [builder()][RegionInstantSnapshotGroups::builder]. The default configuration should
12954/// work for most applications. Common configuration changes include
12955///
12956/// * [with_endpoint()]: by default this client uses the global default endpoint
12957/// (`https://compute.googleapis.com`). Applications using regional
12958/// endpoints or running in restricted networks (e.g. a network configured
12959/// with [Private Google Access with VPC Service Controls]) may want to
12960/// override this default.
12961/// * [with_credentials()]: by default this client uses
12962/// [Application Default Credentials]. Applications using custom
12963/// authentication may need to override this default.
12964///
12965/// [with_endpoint()]: super::builder::region_instant_snapshot_groups::ClientBuilder::with_endpoint
12966/// [with_credentials()]: super::builder::region_instant_snapshot_groups::ClientBuilder::with_credentials
12967/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12968/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12969///
12970/// # Pooling and Cloning
12971///
12972/// `RegionInstantSnapshotGroups` holds a connection pool internally, it is advised to
12973/// create one and reuse it. You do not need to wrap `RegionInstantSnapshotGroups` in
12974/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12975/// already uses an `Arc` internally.
12976#[cfg(feature = "region-instant-snapshot-groups")]
12977#[cfg_attr(docsrs, doc(cfg(feature = "region-instant-snapshot-groups")))]
12978#[derive(Clone, Debug)]
12979pub struct RegionInstantSnapshotGroups {
12980 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshotGroups>,
12981}
12982
12983#[cfg(feature = "region-instant-snapshot-groups")]
12984impl RegionInstantSnapshotGroups {
12985 /// Returns a builder for [RegionInstantSnapshotGroups].
12986 ///
12987 /// ```
12988 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12989 /// # use google_cloud_compute_v1::client::RegionInstantSnapshotGroups;
12990 /// let client = RegionInstantSnapshotGroups::builder().build().await?;
12991 /// # Ok(()) }
12992 /// ```
12993 pub fn builder() -> super::builder::region_instant_snapshot_groups::ClientBuilder {
12994 crate::new_client_builder(super::builder::region_instant_snapshot_groups::client::Factory)
12995 }
12996
12997 /// Creates a new client from the provided stub.
12998 ///
12999 /// The most common case for calling this function is in tests mocking the
13000 /// client's behavior.
13001 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13002 where
13003 T: super::stub::RegionInstantSnapshotGroups + 'static,
13004 {
13005 Self { inner: stub.into() }
13006 }
13007
13008 pub(crate) async fn new(
13009 config: gaxi::options::ClientConfig,
13010 ) -> crate::ClientBuilderResult<Self> {
13011 let inner = Self::build_inner(config).await?;
13012 Ok(Self { inner })
13013 }
13014
13015 async fn build_inner(
13016 conf: gaxi::options::ClientConfig,
13017 ) -> crate::ClientBuilderResult<
13018 std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshotGroups>,
13019 > {
13020 if gaxi::options::tracing_enabled(&conf) {
13021 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13022 }
13023 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13024 }
13025
13026 async fn build_transport(
13027 conf: gaxi::options::ClientConfig,
13028 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshotGroups> {
13029 super::transport::RegionInstantSnapshotGroups::new(conf).await
13030 }
13031
13032 async fn build_with_tracing(
13033 conf: gaxi::options::ClientConfig,
13034 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshotGroups> {
13035 Self::build_transport(conf)
13036 .await
13037 .map(super::tracing::RegionInstantSnapshotGroups::new)
13038 }
13039
13040 /// deletes a Regional InstantSnapshotGroup resource
13041 pub fn delete(&self) -> super::builder::region_instant_snapshot_groups::Delete {
13042 super::builder::region_instant_snapshot_groups::Delete::new(self.inner.clone())
13043 }
13044
13045 /// returns the specified InstantSnapshotGroup resource in the specified
13046 /// region.
13047 pub fn get(&self) -> super::builder::region_instant_snapshot_groups::Get {
13048 super::builder::region_instant_snapshot_groups::Get::new(self.inner.clone())
13049 }
13050
13051 /// Gets the access control policy for a resource. May be empty if no such
13052 /// policy or resource exists.
13053 pub fn get_iam_policy(&self) -> super::builder::region_instant_snapshot_groups::GetIamPolicy {
13054 super::builder::region_instant_snapshot_groups::GetIamPolicy::new(self.inner.clone())
13055 }
13056
13057 /// creates a Regional InstantSnapshotGroup resource
13058 pub fn insert(&self) -> super::builder::region_instant_snapshot_groups::Insert {
13059 super::builder::region_instant_snapshot_groups::Insert::new(self.inner.clone())
13060 }
13061
13062 /// retrieves the list of InstantSnapshotGroup resources contained within
13063 /// the specified region.
13064 pub fn list(&self) -> super::builder::region_instant_snapshot_groups::List {
13065 super::builder::region_instant_snapshot_groups::List::new(self.inner.clone())
13066 }
13067
13068 /// Sets the access control policy on the specified resource.
13069 /// Replaces any existing policy.
13070 pub fn set_iam_policy(&self) -> super::builder::region_instant_snapshot_groups::SetIamPolicy {
13071 super::builder::region_instant_snapshot_groups::SetIamPolicy::new(self.inner.clone())
13072 }
13073
13074 /// Returns permissions that a caller has on the specified resource.
13075 pub fn test_iam_permissions(
13076 &self,
13077 ) -> super::builder::region_instant_snapshot_groups::TestIamPermissions {
13078 super::builder::region_instant_snapshot_groups::TestIamPermissions::new(self.inner.clone())
13079 }
13080
13081 /// Retrieves the specified region-specific Operations resource.
13082 pub fn get_operation(&self) -> super::builder::region_instant_snapshot_groups::GetOperation {
13083 super::builder::region_instant_snapshot_groups::GetOperation::new(self.inner.clone())
13084 }
13085}
13086
13087/// Implements a client for the Google Compute Engine API.
13088///
13089/// # Example
13090/// ```
13091/// # use google_cloud_compute_v1::client::RegionInstantSnapshots;
13092/// async fn sample(
13093/// ) -> anyhow::Result<()> {
13094/// let client = RegionInstantSnapshots::builder().build().await?;
13095/// // use `client` to make requests to the Google Compute Engine API.
13096/// Ok(())
13097/// }
13098/// ```
13099///
13100/// # Service Description
13101///
13102/// Service for the `regionInstantSnapshots` resource.
13103///
13104/// # Configuration
13105///
13106/// To configure `RegionInstantSnapshots` use the `with_*` methods in the type returned
13107/// by [builder()][RegionInstantSnapshots::builder]. The default configuration should
13108/// work for most applications. Common configuration changes include
13109///
13110/// * [with_endpoint()]: by default this client uses the global default endpoint
13111/// (`https://compute.googleapis.com`). Applications using regional
13112/// endpoints or running in restricted networks (e.g. a network configured
13113/// with [Private Google Access with VPC Service Controls]) may want to
13114/// override this default.
13115/// * [with_credentials()]: by default this client uses
13116/// [Application Default Credentials]. Applications using custom
13117/// authentication may need to override this default.
13118///
13119/// [with_endpoint()]: super::builder::region_instant_snapshots::ClientBuilder::with_endpoint
13120/// [with_credentials()]: super::builder::region_instant_snapshots::ClientBuilder::with_credentials
13121/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13122/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13123///
13124/// # Pooling and Cloning
13125///
13126/// `RegionInstantSnapshots` holds a connection pool internally, it is advised to
13127/// create one and reuse it. You do not need to wrap `RegionInstantSnapshots` in
13128/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13129/// already uses an `Arc` internally.
13130#[cfg(feature = "region-instant-snapshots")]
13131#[cfg_attr(docsrs, doc(cfg(feature = "region-instant-snapshots")))]
13132#[derive(Clone, Debug)]
13133pub struct RegionInstantSnapshots {
13134 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshots>,
13135}
13136
13137#[cfg(feature = "region-instant-snapshots")]
13138impl RegionInstantSnapshots {
13139 /// Returns a builder for [RegionInstantSnapshots].
13140 ///
13141 /// ```
13142 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13143 /// # use google_cloud_compute_v1::client::RegionInstantSnapshots;
13144 /// let client = RegionInstantSnapshots::builder().build().await?;
13145 /// # Ok(()) }
13146 /// ```
13147 pub fn builder() -> super::builder::region_instant_snapshots::ClientBuilder {
13148 crate::new_client_builder(super::builder::region_instant_snapshots::client::Factory)
13149 }
13150
13151 /// Creates a new client from the provided stub.
13152 ///
13153 /// The most common case for calling this function is in tests mocking the
13154 /// client's behavior.
13155 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13156 where
13157 T: super::stub::RegionInstantSnapshots + 'static,
13158 {
13159 Self { inner: stub.into() }
13160 }
13161
13162 pub(crate) async fn new(
13163 config: gaxi::options::ClientConfig,
13164 ) -> crate::ClientBuilderResult<Self> {
13165 let inner = Self::build_inner(config).await?;
13166 Ok(Self { inner })
13167 }
13168
13169 async fn build_inner(
13170 conf: gaxi::options::ClientConfig,
13171 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshots>>
13172 {
13173 if gaxi::options::tracing_enabled(&conf) {
13174 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13175 }
13176 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13177 }
13178
13179 async fn build_transport(
13180 conf: gaxi::options::ClientConfig,
13181 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshots> {
13182 super::transport::RegionInstantSnapshots::new(conf).await
13183 }
13184
13185 async fn build_with_tracing(
13186 conf: gaxi::options::ClientConfig,
13187 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshots> {
13188 Self::build_transport(conf)
13189 .await
13190 .map(super::tracing::RegionInstantSnapshots::new)
13191 }
13192
13193 /// Deletes the specified InstantSnapshot resource. Keep in mind that deleting
13194 /// a single instantSnapshot might not necessarily delete all the data on that
13195 /// instantSnapshot. If any data on the instantSnapshot that is marked for
13196 /// deletion is needed for subsequent instantSnapshots, the data will be moved
13197 /// to the next corresponding instantSnapshot.
13198 ///
13199 /// For more information, seeDeleting
13200 /// instantSnapshots.
13201 pub fn delete(&self) -> super::builder::region_instant_snapshots::Delete {
13202 super::builder::region_instant_snapshots::Delete::new(self.inner.clone())
13203 }
13204
13205 /// Returns the specified InstantSnapshot resource in the specified region.
13206 pub fn get(&self) -> super::builder::region_instant_snapshots::Get {
13207 super::builder::region_instant_snapshots::Get::new(self.inner.clone())
13208 }
13209
13210 /// Gets the access control policy for a resource. May be empty if no such
13211 /// policy or resource exists.
13212 pub fn get_iam_policy(&self) -> super::builder::region_instant_snapshots::GetIamPolicy {
13213 super::builder::region_instant_snapshots::GetIamPolicy::new(self.inner.clone())
13214 }
13215
13216 /// Creates an instant snapshot in the specified region.
13217 pub fn insert(&self) -> super::builder::region_instant_snapshots::Insert {
13218 super::builder::region_instant_snapshots::Insert::new(self.inner.clone())
13219 }
13220
13221 /// Retrieves the list of InstantSnapshot resources contained within
13222 /// the specified region.
13223 pub fn list(&self) -> super::builder::region_instant_snapshots::List {
13224 super::builder::region_instant_snapshots::List::new(self.inner.clone())
13225 }
13226
13227 /// Sets the access control policy on the specified resource.
13228 /// Replaces any existing policy.
13229 pub fn set_iam_policy(&self) -> super::builder::region_instant_snapshots::SetIamPolicy {
13230 super::builder::region_instant_snapshots::SetIamPolicy::new(self.inner.clone())
13231 }
13232
13233 /// Sets the labels on a instantSnapshot in the given region. To learn more
13234 /// about labels, read the Labeling
13235 /// Resources documentation.
13236 pub fn set_labels(&self) -> super::builder::region_instant_snapshots::SetLabels {
13237 super::builder::region_instant_snapshots::SetLabels::new(self.inner.clone())
13238 }
13239
13240 /// Returns permissions that a caller has on the specified resource.
13241 pub fn test_iam_permissions(
13242 &self,
13243 ) -> super::builder::region_instant_snapshots::TestIamPermissions {
13244 super::builder::region_instant_snapshots::TestIamPermissions::new(self.inner.clone())
13245 }
13246
13247 /// Retrieves the specified region-specific Operations resource.
13248 pub fn get_operation(&self) -> super::builder::region_instant_snapshots::GetOperation {
13249 super::builder::region_instant_snapshots::GetOperation::new(self.inner.clone())
13250 }
13251}
13252
13253/// Implements a client for the Google Compute Engine API.
13254///
13255/// # Example
13256/// ```
13257/// # use google_cloud_compute_v1::client::RegionNetworkEndpointGroups;
13258/// async fn sample(
13259/// ) -> anyhow::Result<()> {
13260/// let client = RegionNetworkEndpointGroups::builder().build().await?;
13261/// // use `client` to make requests to the Google Compute Engine API.
13262/// Ok(())
13263/// }
13264/// ```
13265///
13266/// # Service Description
13267///
13268/// Service for the `regionNetworkEndpointGroups` resource.
13269///
13270/// # Configuration
13271///
13272/// To configure `RegionNetworkEndpointGroups` use the `with_*` methods in the type returned
13273/// by [builder()][RegionNetworkEndpointGroups::builder]. The default configuration should
13274/// work for most applications. Common configuration changes include
13275///
13276/// * [with_endpoint()]: by default this client uses the global default endpoint
13277/// (`https://compute.googleapis.com`). Applications using regional
13278/// endpoints or running in restricted networks (e.g. a network configured
13279/// with [Private Google Access with VPC Service Controls]) may want to
13280/// override this default.
13281/// * [with_credentials()]: by default this client uses
13282/// [Application Default Credentials]. Applications using custom
13283/// authentication may need to override this default.
13284///
13285/// [with_endpoint()]: super::builder::region_network_endpoint_groups::ClientBuilder::with_endpoint
13286/// [with_credentials()]: super::builder::region_network_endpoint_groups::ClientBuilder::with_credentials
13287/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13288/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13289///
13290/// # Pooling and Cloning
13291///
13292/// `RegionNetworkEndpointGroups` holds a connection pool internally, it is advised to
13293/// create one and reuse it. You do not need to wrap `RegionNetworkEndpointGroups` in
13294/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13295/// already uses an `Arc` internally.
13296#[cfg(feature = "region-network-endpoint-groups")]
13297#[cfg_attr(docsrs, doc(cfg(feature = "region-network-endpoint-groups")))]
13298#[derive(Clone, Debug)]
13299pub struct RegionNetworkEndpointGroups {
13300 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNetworkEndpointGroups>,
13301}
13302
13303#[cfg(feature = "region-network-endpoint-groups")]
13304impl RegionNetworkEndpointGroups {
13305 /// Returns a builder for [RegionNetworkEndpointGroups].
13306 ///
13307 /// ```
13308 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13309 /// # use google_cloud_compute_v1::client::RegionNetworkEndpointGroups;
13310 /// let client = RegionNetworkEndpointGroups::builder().build().await?;
13311 /// # Ok(()) }
13312 /// ```
13313 pub fn builder() -> super::builder::region_network_endpoint_groups::ClientBuilder {
13314 crate::new_client_builder(super::builder::region_network_endpoint_groups::client::Factory)
13315 }
13316
13317 /// Creates a new client from the provided stub.
13318 ///
13319 /// The most common case for calling this function is in tests mocking the
13320 /// client's behavior.
13321 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13322 where
13323 T: super::stub::RegionNetworkEndpointGroups + 'static,
13324 {
13325 Self { inner: stub.into() }
13326 }
13327
13328 pub(crate) async fn new(
13329 config: gaxi::options::ClientConfig,
13330 ) -> crate::ClientBuilderResult<Self> {
13331 let inner = Self::build_inner(config).await?;
13332 Ok(Self { inner })
13333 }
13334
13335 async fn build_inner(
13336 conf: gaxi::options::ClientConfig,
13337 ) -> crate::ClientBuilderResult<
13338 std::sync::Arc<dyn super::stub::dynamic::RegionNetworkEndpointGroups>,
13339 > {
13340 if gaxi::options::tracing_enabled(&conf) {
13341 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13342 }
13343 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13344 }
13345
13346 async fn build_transport(
13347 conf: gaxi::options::ClientConfig,
13348 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkEndpointGroups> {
13349 super::transport::RegionNetworkEndpointGroups::new(conf).await
13350 }
13351
13352 async fn build_with_tracing(
13353 conf: gaxi::options::ClientConfig,
13354 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkEndpointGroups> {
13355 Self::build_transport(conf)
13356 .await
13357 .map(super::tracing::RegionNetworkEndpointGroups::new)
13358 }
13359
13360 /// Attach a list of network endpoints to the specified network endpoint group.
13361 pub fn attach_network_endpoints(
13362 &self,
13363 ) -> super::builder::region_network_endpoint_groups::AttachNetworkEndpoints {
13364 super::builder::region_network_endpoint_groups::AttachNetworkEndpoints::new(
13365 self.inner.clone(),
13366 )
13367 }
13368
13369 /// Deletes the specified network endpoint group. Note that the NEG cannot be
13370 /// deleted if it is configured as a backend of a backend service.
13371 pub fn delete(&self) -> super::builder::region_network_endpoint_groups::Delete {
13372 super::builder::region_network_endpoint_groups::Delete::new(self.inner.clone())
13373 }
13374
13375 /// Detach the network endpoint from the specified network endpoint group.
13376 pub fn detach_network_endpoints(
13377 &self,
13378 ) -> super::builder::region_network_endpoint_groups::DetachNetworkEndpoints {
13379 super::builder::region_network_endpoint_groups::DetachNetworkEndpoints::new(
13380 self.inner.clone(),
13381 )
13382 }
13383
13384 /// Returns the specified network endpoint group.
13385 pub fn get(&self) -> super::builder::region_network_endpoint_groups::Get {
13386 super::builder::region_network_endpoint_groups::Get::new(self.inner.clone())
13387 }
13388
13389 /// Creates a network endpoint group in the specified project using the
13390 /// parameters that are included in the request.
13391 ///
13392 /// Note: Use the following APIs to manage network endpoint groups:
13393 ///
13394 /// - To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
13395 /// NEGs): zonal
13396 /// API
13397 /// - To manage NEGs with regional scope (such as regional internet NEGs,
13398 /// serverless NEGs, Private Service Connect NEGs): regional
13399 /// API
13400 /// - To manage NEGs with global scope (such as global internet NEGs):global
13401 /// API
13402 pub fn insert(&self) -> super::builder::region_network_endpoint_groups::Insert {
13403 super::builder::region_network_endpoint_groups::Insert::new(self.inner.clone())
13404 }
13405
13406 /// Retrieves the list of regional network endpoint groups available to the
13407 /// specified project in the given region.
13408 pub fn list(&self) -> super::builder::region_network_endpoint_groups::List {
13409 super::builder::region_network_endpoint_groups::List::new(self.inner.clone())
13410 }
13411
13412 /// Lists the network endpoints in the specified network endpoint group.
13413 pub fn list_network_endpoints(
13414 &self,
13415 ) -> super::builder::region_network_endpoint_groups::ListNetworkEndpoints {
13416 super::builder::region_network_endpoint_groups::ListNetworkEndpoints::new(
13417 self.inner.clone(),
13418 )
13419 }
13420
13421 /// Retrieves the specified region-specific Operations resource.
13422 pub fn get_operation(&self) -> super::builder::region_network_endpoint_groups::GetOperation {
13423 super::builder::region_network_endpoint_groups::GetOperation::new(self.inner.clone())
13424 }
13425}
13426
13427/// Implements a client for the Google Compute Engine API.
13428///
13429/// # Example
13430/// ```
13431/// # use google_cloud_compute_v1::client::RegionNetworkFirewallPolicies;
13432/// async fn sample(
13433/// ) -> anyhow::Result<()> {
13434/// let client = RegionNetworkFirewallPolicies::builder().build().await?;
13435/// // use `client` to make requests to the Google Compute Engine API.
13436/// Ok(())
13437/// }
13438/// ```
13439///
13440/// # Service Description
13441///
13442/// Service for the `regionNetworkFirewallPolicies` resource.
13443///
13444/// # Configuration
13445///
13446/// To configure `RegionNetworkFirewallPolicies` use the `with_*` methods in the type returned
13447/// by [builder()][RegionNetworkFirewallPolicies::builder]. The default configuration should
13448/// work for most applications. Common configuration changes include
13449///
13450/// * [with_endpoint()]: by default this client uses the global default endpoint
13451/// (`https://compute.googleapis.com`). Applications using regional
13452/// endpoints or running in restricted networks (e.g. a network configured
13453/// with [Private Google Access with VPC Service Controls]) may want to
13454/// override this default.
13455/// * [with_credentials()]: by default this client uses
13456/// [Application Default Credentials]. Applications using custom
13457/// authentication may need to override this default.
13458///
13459/// [with_endpoint()]: super::builder::region_network_firewall_policies::ClientBuilder::with_endpoint
13460/// [with_credentials()]: super::builder::region_network_firewall_policies::ClientBuilder::with_credentials
13461/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13462/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13463///
13464/// # Pooling and Cloning
13465///
13466/// `RegionNetworkFirewallPolicies` holds a connection pool internally, it is advised to
13467/// create one and reuse it. You do not need to wrap `RegionNetworkFirewallPolicies` in
13468/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13469/// already uses an `Arc` internally.
13470#[cfg(feature = "region-network-firewall-policies")]
13471#[cfg_attr(docsrs, doc(cfg(feature = "region-network-firewall-policies")))]
13472#[derive(Clone, Debug)]
13473pub struct RegionNetworkFirewallPolicies {
13474 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNetworkFirewallPolicies>,
13475}
13476
13477#[cfg(feature = "region-network-firewall-policies")]
13478impl RegionNetworkFirewallPolicies {
13479 /// Returns a builder for [RegionNetworkFirewallPolicies].
13480 ///
13481 /// ```
13482 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13483 /// # use google_cloud_compute_v1::client::RegionNetworkFirewallPolicies;
13484 /// let client = RegionNetworkFirewallPolicies::builder().build().await?;
13485 /// # Ok(()) }
13486 /// ```
13487 pub fn builder() -> super::builder::region_network_firewall_policies::ClientBuilder {
13488 crate::new_client_builder(super::builder::region_network_firewall_policies::client::Factory)
13489 }
13490
13491 /// Creates a new client from the provided stub.
13492 ///
13493 /// The most common case for calling this function is in tests mocking the
13494 /// client's behavior.
13495 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13496 where
13497 T: super::stub::RegionNetworkFirewallPolicies + 'static,
13498 {
13499 Self { inner: stub.into() }
13500 }
13501
13502 pub(crate) async fn new(
13503 config: gaxi::options::ClientConfig,
13504 ) -> crate::ClientBuilderResult<Self> {
13505 let inner = Self::build_inner(config).await?;
13506 Ok(Self { inner })
13507 }
13508
13509 async fn build_inner(
13510 conf: gaxi::options::ClientConfig,
13511 ) -> crate::ClientBuilderResult<
13512 std::sync::Arc<dyn super::stub::dynamic::RegionNetworkFirewallPolicies>,
13513 > {
13514 if gaxi::options::tracing_enabled(&conf) {
13515 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13516 }
13517 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13518 }
13519
13520 async fn build_transport(
13521 conf: gaxi::options::ClientConfig,
13522 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkFirewallPolicies> {
13523 super::transport::RegionNetworkFirewallPolicies::new(conf).await
13524 }
13525
13526 async fn build_with_tracing(
13527 conf: gaxi::options::ClientConfig,
13528 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkFirewallPolicies> {
13529 Self::build_transport(conf)
13530 .await
13531 .map(super::tracing::RegionNetworkFirewallPolicies::new)
13532 }
13533
13534 /// Inserts an association for the specified network firewall policy.
13535 pub fn add_association(
13536 &self,
13537 ) -> super::builder::region_network_firewall_policies::AddAssociation {
13538 super::builder::region_network_firewall_policies::AddAssociation::new(self.inner.clone())
13539 }
13540
13541 /// Inserts a rule into a network firewall policy.
13542 pub fn add_rule(&self) -> super::builder::region_network_firewall_policies::AddRule {
13543 super::builder::region_network_firewall_policies::AddRule::new(self.inner.clone())
13544 }
13545
13546 /// Copies rules to the specified network firewall policy.
13547 pub fn clone_rules(&self) -> super::builder::region_network_firewall_policies::CloneRules {
13548 super::builder::region_network_firewall_policies::CloneRules::new(self.inner.clone())
13549 }
13550
13551 /// Deletes the specified network firewall policy.
13552 pub fn delete(&self) -> super::builder::region_network_firewall_policies::Delete {
13553 super::builder::region_network_firewall_policies::Delete::new(self.inner.clone())
13554 }
13555
13556 /// Returns the specified network firewall policy.
13557 pub fn get(&self) -> super::builder::region_network_firewall_policies::Get {
13558 super::builder::region_network_firewall_policies::Get::new(self.inner.clone())
13559 }
13560
13561 /// Gets an association with the specified name.
13562 pub fn get_association(
13563 &self,
13564 ) -> super::builder::region_network_firewall_policies::GetAssociation {
13565 super::builder::region_network_firewall_policies::GetAssociation::new(self.inner.clone())
13566 }
13567
13568 /// Returns the effective firewalls on a given network.
13569 pub fn get_effective_firewalls(
13570 &self,
13571 ) -> super::builder::region_network_firewall_policies::GetEffectiveFirewalls {
13572 super::builder::region_network_firewall_policies::GetEffectiveFirewalls::new(
13573 self.inner.clone(),
13574 )
13575 }
13576
13577 /// Gets the access control policy for a resource. May be empty if no such
13578 /// policy or resource exists.
13579 pub fn get_iam_policy(&self) -> super::builder::region_network_firewall_policies::GetIamPolicy {
13580 super::builder::region_network_firewall_policies::GetIamPolicy::new(self.inner.clone())
13581 }
13582
13583 /// Gets a rule of the specified priority.
13584 pub fn get_rule(&self) -> super::builder::region_network_firewall_policies::GetRule {
13585 super::builder::region_network_firewall_policies::GetRule::new(self.inner.clone())
13586 }
13587
13588 /// Creates a new network firewall policy in the specified project and region.
13589 pub fn insert(&self) -> super::builder::region_network_firewall_policies::Insert {
13590 super::builder::region_network_firewall_policies::Insert::new(self.inner.clone())
13591 }
13592
13593 /// Lists all the network firewall policies that have been configured
13594 /// for the specified project in the given region.
13595 pub fn list(&self) -> super::builder::region_network_firewall_policies::List {
13596 super::builder::region_network_firewall_policies::List::new(self.inner.clone())
13597 }
13598
13599 /// Patches the specified network firewall policy.
13600 pub fn patch(&self) -> super::builder::region_network_firewall_policies::Patch {
13601 super::builder::region_network_firewall_policies::Patch::new(self.inner.clone())
13602 }
13603
13604 /// Patches a rule of the specified priority.
13605 pub fn patch_rule(&self) -> super::builder::region_network_firewall_policies::PatchRule {
13606 super::builder::region_network_firewall_policies::PatchRule::new(self.inner.clone())
13607 }
13608
13609 /// Removes an association for the specified network firewall policy.
13610 pub fn remove_association(
13611 &self,
13612 ) -> super::builder::region_network_firewall_policies::RemoveAssociation {
13613 super::builder::region_network_firewall_policies::RemoveAssociation::new(self.inner.clone())
13614 }
13615
13616 /// Deletes a rule of the specified priority.
13617 pub fn remove_rule(&self) -> super::builder::region_network_firewall_policies::RemoveRule {
13618 super::builder::region_network_firewall_policies::RemoveRule::new(self.inner.clone())
13619 }
13620
13621 /// Sets the access control policy on the specified resource.
13622 /// Replaces any existing policy.
13623 pub fn set_iam_policy(&self) -> super::builder::region_network_firewall_policies::SetIamPolicy {
13624 super::builder::region_network_firewall_policies::SetIamPolicy::new(self.inner.clone())
13625 }
13626
13627 /// Returns permissions that a caller has on the specified resource.
13628 pub fn test_iam_permissions(
13629 &self,
13630 ) -> super::builder::region_network_firewall_policies::TestIamPermissions {
13631 super::builder::region_network_firewall_policies::TestIamPermissions::new(
13632 self.inner.clone(),
13633 )
13634 }
13635
13636 /// Retrieves the specified region-specific Operations resource.
13637 pub fn get_operation(&self) -> super::builder::region_network_firewall_policies::GetOperation {
13638 super::builder::region_network_firewall_policies::GetOperation::new(self.inner.clone())
13639 }
13640}
13641
13642/// Implements a client for the Google Compute Engine API.
13643///
13644/// # Example
13645/// ```
13646/// # use google_cloud_compute_v1::client::RegionNotificationEndpoints;
13647/// async fn sample(
13648/// ) -> anyhow::Result<()> {
13649/// let client = RegionNotificationEndpoints::builder().build().await?;
13650/// // use `client` to make requests to the Google Compute Engine API.
13651/// Ok(())
13652/// }
13653/// ```
13654///
13655/// # Service Description
13656///
13657/// Service for the `regionNotificationEndpoints` resource.
13658///
13659/// # Configuration
13660///
13661/// To configure `RegionNotificationEndpoints` use the `with_*` methods in the type returned
13662/// by [builder()][RegionNotificationEndpoints::builder]. The default configuration should
13663/// work for most applications. Common configuration changes include
13664///
13665/// * [with_endpoint()]: by default this client uses the global default endpoint
13666/// (`https://compute.googleapis.com`). Applications using regional
13667/// endpoints or running in restricted networks (e.g. a network configured
13668/// with [Private Google Access with VPC Service Controls]) may want to
13669/// override this default.
13670/// * [with_credentials()]: by default this client uses
13671/// [Application Default Credentials]. Applications using custom
13672/// authentication may need to override this default.
13673///
13674/// [with_endpoint()]: super::builder::region_notification_endpoints::ClientBuilder::with_endpoint
13675/// [with_credentials()]: super::builder::region_notification_endpoints::ClientBuilder::with_credentials
13676/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13677/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13678///
13679/// # Pooling and Cloning
13680///
13681/// `RegionNotificationEndpoints` holds a connection pool internally, it is advised to
13682/// create one and reuse it. You do not need to wrap `RegionNotificationEndpoints` in
13683/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13684/// already uses an `Arc` internally.
13685#[cfg(feature = "region-notification-endpoints")]
13686#[cfg_attr(docsrs, doc(cfg(feature = "region-notification-endpoints")))]
13687#[derive(Clone, Debug)]
13688pub struct RegionNotificationEndpoints {
13689 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNotificationEndpoints>,
13690}
13691
13692#[cfg(feature = "region-notification-endpoints")]
13693impl RegionNotificationEndpoints {
13694 /// Returns a builder for [RegionNotificationEndpoints].
13695 ///
13696 /// ```
13697 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13698 /// # use google_cloud_compute_v1::client::RegionNotificationEndpoints;
13699 /// let client = RegionNotificationEndpoints::builder().build().await?;
13700 /// # Ok(()) }
13701 /// ```
13702 pub fn builder() -> super::builder::region_notification_endpoints::ClientBuilder {
13703 crate::new_client_builder(super::builder::region_notification_endpoints::client::Factory)
13704 }
13705
13706 /// Creates a new client from the provided stub.
13707 ///
13708 /// The most common case for calling this function is in tests mocking the
13709 /// client's behavior.
13710 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13711 where
13712 T: super::stub::RegionNotificationEndpoints + 'static,
13713 {
13714 Self { inner: stub.into() }
13715 }
13716
13717 pub(crate) async fn new(
13718 config: gaxi::options::ClientConfig,
13719 ) -> crate::ClientBuilderResult<Self> {
13720 let inner = Self::build_inner(config).await?;
13721 Ok(Self { inner })
13722 }
13723
13724 async fn build_inner(
13725 conf: gaxi::options::ClientConfig,
13726 ) -> crate::ClientBuilderResult<
13727 std::sync::Arc<dyn super::stub::dynamic::RegionNotificationEndpoints>,
13728 > {
13729 if gaxi::options::tracing_enabled(&conf) {
13730 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13731 }
13732 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13733 }
13734
13735 async fn build_transport(
13736 conf: gaxi::options::ClientConfig,
13737 ) -> crate::ClientBuilderResult<impl super::stub::RegionNotificationEndpoints> {
13738 super::transport::RegionNotificationEndpoints::new(conf).await
13739 }
13740
13741 async fn build_with_tracing(
13742 conf: gaxi::options::ClientConfig,
13743 ) -> crate::ClientBuilderResult<impl super::stub::RegionNotificationEndpoints> {
13744 Self::build_transport(conf)
13745 .await
13746 .map(super::tracing::RegionNotificationEndpoints::new)
13747 }
13748
13749 /// Retrieves the list of all NotificationEndpoint resources,
13750 /// regional and global, available to the specified project.
13751 pub fn aggregated_list(&self) -> super::builder::region_notification_endpoints::AggregatedList {
13752 super::builder::region_notification_endpoints::AggregatedList::new(self.inner.clone())
13753 }
13754
13755 /// Deletes the specified NotificationEndpoint in the given region
13756 pub fn delete(&self) -> super::builder::region_notification_endpoints::Delete {
13757 super::builder::region_notification_endpoints::Delete::new(self.inner.clone())
13758 }
13759
13760 /// Returns the specified NotificationEndpoint resource in the given region.
13761 pub fn get(&self) -> super::builder::region_notification_endpoints::Get {
13762 super::builder::region_notification_endpoints::Get::new(self.inner.clone())
13763 }
13764
13765 /// Create a NotificationEndpoint in the specified project in the given region
13766 /// using the parameters that are included in the request.
13767 pub fn insert(&self) -> super::builder::region_notification_endpoints::Insert {
13768 super::builder::region_notification_endpoints::Insert::new(self.inner.clone())
13769 }
13770
13771 /// Lists the NotificationEndpoints for a project in the given region.
13772 pub fn list(&self) -> super::builder::region_notification_endpoints::List {
13773 super::builder::region_notification_endpoints::List::new(self.inner.clone())
13774 }
13775
13776 /// Returns permissions that a caller has on the specified resource.
13777 pub fn test_iam_permissions(
13778 &self,
13779 ) -> super::builder::region_notification_endpoints::TestIamPermissions {
13780 super::builder::region_notification_endpoints::TestIamPermissions::new(self.inner.clone())
13781 }
13782
13783 /// Retrieves the specified region-specific Operations resource.
13784 pub fn get_operation(&self) -> super::builder::region_notification_endpoints::GetOperation {
13785 super::builder::region_notification_endpoints::GetOperation::new(self.inner.clone())
13786 }
13787}
13788
13789/// Implements a client for the Google Compute Engine API.
13790///
13791/// # Example
13792/// ```
13793/// # use google_cloud_compute_v1::client::RegionOperations;
13794/// async fn sample(
13795/// ) -> anyhow::Result<()> {
13796/// let client = RegionOperations::builder().build().await?;
13797/// // use `client` to make requests to the Google Compute Engine API.
13798/// Ok(())
13799/// }
13800/// ```
13801///
13802/// # Service Description
13803///
13804/// Service for the `regionOperations` resource.
13805///
13806/// # Configuration
13807///
13808/// To configure `RegionOperations` use the `with_*` methods in the type returned
13809/// by [builder()][RegionOperations::builder]. The default configuration should
13810/// work for most applications. Common configuration changes include
13811///
13812/// * [with_endpoint()]: by default this client uses the global default endpoint
13813/// (`https://compute.googleapis.com`). Applications using regional
13814/// endpoints or running in restricted networks (e.g. a network configured
13815/// with [Private Google Access with VPC Service Controls]) may want to
13816/// override this default.
13817/// * [with_credentials()]: by default this client uses
13818/// [Application Default Credentials]. Applications using custom
13819/// authentication may need to override this default.
13820///
13821/// [with_endpoint()]: super::builder::region_operations::ClientBuilder::with_endpoint
13822/// [with_credentials()]: super::builder::region_operations::ClientBuilder::with_credentials
13823/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13824/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13825///
13826/// # Pooling and Cloning
13827///
13828/// `RegionOperations` holds a connection pool internally, it is advised to
13829/// create one and reuse it. You do not need to wrap `RegionOperations` in
13830/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13831/// already uses an `Arc` internally.
13832#[cfg(feature = "region-operations")]
13833#[cfg_attr(docsrs, doc(cfg(feature = "region-operations")))]
13834#[derive(Clone, Debug)]
13835pub struct RegionOperations {
13836 inner: std::sync::Arc<dyn super::stub::dynamic::RegionOperations>,
13837}
13838
13839#[cfg(feature = "region-operations")]
13840impl RegionOperations {
13841 /// Returns a builder for [RegionOperations].
13842 ///
13843 /// ```
13844 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13845 /// # use google_cloud_compute_v1::client::RegionOperations;
13846 /// let client = RegionOperations::builder().build().await?;
13847 /// # Ok(()) }
13848 /// ```
13849 pub fn builder() -> super::builder::region_operations::ClientBuilder {
13850 crate::new_client_builder(super::builder::region_operations::client::Factory)
13851 }
13852
13853 /// Creates a new client from the provided stub.
13854 ///
13855 /// The most common case for calling this function is in tests mocking the
13856 /// client's behavior.
13857 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13858 where
13859 T: super::stub::RegionOperations + 'static,
13860 {
13861 Self { inner: stub.into() }
13862 }
13863
13864 pub(crate) async fn new(
13865 config: gaxi::options::ClientConfig,
13866 ) -> crate::ClientBuilderResult<Self> {
13867 let inner = Self::build_inner(config).await?;
13868 Ok(Self { inner })
13869 }
13870
13871 async fn build_inner(
13872 conf: gaxi::options::ClientConfig,
13873 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionOperations>>
13874 {
13875 if gaxi::options::tracing_enabled(&conf) {
13876 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13877 }
13878 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13879 }
13880
13881 async fn build_transport(
13882 conf: gaxi::options::ClientConfig,
13883 ) -> crate::ClientBuilderResult<impl super::stub::RegionOperations> {
13884 super::transport::RegionOperations::new(conf).await
13885 }
13886
13887 async fn build_with_tracing(
13888 conf: gaxi::options::ClientConfig,
13889 ) -> crate::ClientBuilderResult<impl super::stub::RegionOperations> {
13890 Self::build_transport(conf)
13891 .await
13892 .map(super::tracing::RegionOperations::new)
13893 }
13894
13895 /// Deletes the specified region-specific Operations resource.
13896 pub fn delete(&self) -> super::builder::region_operations::Delete {
13897 super::builder::region_operations::Delete::new(self.inner.clone())
13898 }
13899
13900 /// Retrieves the specified region-specific Operations resource.
13901 pub fn get(&self) -> super::builder::region_operations::Get {
13902 super::builder::region_operations::Get::new(self.inner.clone())
13903 }
13904
13905 /// Retrieves a list of Operation resources contained within
13906 /// the specified region.
13907 pub fn list(&self) -> super::builder::region_operations::List {
13908 super::builder::region_operations::List::new(self.inner.clone())
13909 }
13910
13911 /// Waits for the specified Operation resource to return as `DONE`
13912 /// or for the request to approach the 2 minute deadline, and retrieves the
13913 /// specified Operation resource. This method differs from the
13914 /// `GET` method in that it waits for no more than the default
13915 /// deadline (2 minutes) and then returns the current state of the operation,
13916 /// which might be `DONE` or still in progress.
13917 ///
13918 /// This method is called on a best-effort basis. Specifically:
13919 ///
13920 /// ```norust
13921 /// - In uncommon cases, when the server is overloaded, the request might
13922 /// return before the default deadline is reached, or might return after zero
13923 /// seconds.
13924 /// ```
13925 ///
13926 /// - If the default deadline is reached, there is no guarantee that the
13927 /// operation is actually done when the method returns. Be prepared to retry
13928 /// if the operation is not `DONE`.
13929 pub fn wait(&self) -> super::builder::region_operations::Wait {
13930 super::builder::region_operations::Wait::new(self.inner.clone())
13931 }
13932}
13933
13934/// Implements a client for the Google Compute Engine API.
13935///
13936/// # Example
13937/// ```
13938/// # use google_cloud_compute_v1::client::RegionSecurityPolicies;
13939/// async fn sample(
13940/// ) -> anyhow::Result<()> {
13941/// let client = RegionSecurityPolicies::builder().build().await?;
13942/// // use `client` to make requests to the Google Compute Engine API.
13943/// Ok(())
13944/// }
13945/// ```
13946///
13947/// # Service Description
13948///
13949/// Service for the `regionSecurityPolicies` resource.
13950///
13951/// # Configuration
13952///
13953/// To configure `RegionSecurityPolicies` use the `with_*` methods in the type returned
13954/// by [builder()][RegionSecurityPolicies::builder]. The default configuration should
13955/// work for most applications. Common configuration changes include
13956///
13957/// * [with_endpoint()]: by default this client uses the global default endpoint
13958/// (`https://compute.googleapis.com`). Applications using regional
13959/// endpoints or running in restricted networks (e.g. a network configured
13960/// with [Private Google Access with VPC Service Controls]) may want to
13961/// override this default.
13962/// * [with_credentials()]: by default this client uses
13963/// [Application Default Credentials]. Applications using custom
13964/// authentication may need to override this default.
13965///
13966/// [with_endpoint()]: super::builder::region_security_policies::ClientBuilder::with_endpoint
13967/// [with_credentials()]: super::builder::region_security_policies::ClientBuilder::with_credentials
13968/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13969/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13970///
13971/// # Pooling and Cloning
13972///
13973/// `RegionSecurityPolicies` holds a connection pool internally, it is advised to
13974/// create one and reuse it. You do not need to wrap `RegionSecurityPolicies` in
13975/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13976/// already uses an `Arc` internally.
13977#[cfg(feature = "region-security-policies")]
13978#[cfg_attr(docsrs, doc(cfg(feature = "region-security-policies")))]
13979#[derive(Clone, Debug)]
13980pub struct RegionSecurityPolicies {
13981 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSecurityPolicies>,
13982}
13983
13984#[cfg(feature = "region-security-policies")]
13985impl RegionSecurityPolicies {
13986 /// Returns a builder for [RegionSecurityPolicies].
13987 ///
13988 /// ```
13989 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13990 /// # use google_cloud_compute_v1::client::RegionSecurityPolicies;
13991 /// let client = RegionSecurityPolicies::builder().build().await?;
13992 /// # Ok(()) }
13993 /// ```
13994 pub fn builder() -> super::builder::region_security_policies::ClientBuilder {
13995 crate::new_client_builder(super::builder::region_security_policies::client::Factory)
13996 }
13997
13998 /// Creates a new client from the provided stub.
13999 ///
14000 /// The most common case for calling this function is in tests mocking the
14001 /// client's behavior.
14002 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14003 where
14004 T: super::stub::RegionSecurityPolicies + 'static,
14005 {
14006 Self { inner: stub.into() }
14007 }
14008
14009 pub(crate) async fn new(
14010 config: gaxi::options::ClientConfig,
14011 ) -> crate::ClientBuilderResult<Self> {
14012 let inner = Self::build_inner(config).await?;
14013 Ok(Self { inner })
14014 }
14015
14016 async fn build_inner(
14017 conf: gaxi::options::ClientConfig,
14018 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSecurityPolicies>>
14019 {
14020 if gaxi::options::tracing_enabled(&conf) {
14021 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14022 }
14023 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14024 }
14025
14026 async fn build_transport(
14027 conf: gaxi::options::ClientConfig,
14028 ) -> crate::ClientBuilderResult<impl super::stub::RegionSecurityPolicies> {
14029 super::transport::RegionSecurityPolicies::new(conf).await
14030 }
14031
14032 async fn build_with_tracing(
14033 conf: gaxi::options::ClientConfig,
14034 ) -> crate::ClientBuilderResult<impl super::stub::RegionSecurityPolicies> {
14035 Self::build_transport(conf)
14036 .await
14037 .map(super::tracing::RegionSecurityPolicies::new)
14038 }
14039
14040 /// Inserts a rule into a security policy.
14041 pub fn add_rule(&self) -> super::builder::region_security_policies::AddRule {
14042 super::builder::region_security_policies::AddRule::new(self.inner.clone())
14043 }
14044
14045 /// Deletes the specified policy.
14046 pub fn delete(&self) -> super::builder::region_security_policies::Delete {
14047 super::builder::region_security_policies::Delete::new(self.inner.clone())
14048 }
14049
14050 /// List all of the ordered rules present in a single specified policy.
14051 pub fn get(&self) -> super::builder::region_security_policies::Get {
14052 super::builder::region_security_policies::Get::new(self.inner.clone())
14053 }
14054
14055 /// Gets a rule at the specified priority.
14056 pub fn get_rule(&self) -> super::builder::region_security_policies::GetRule {
14057 super::builder::region_security_policies::GetRule::new(self.inner.clone())
14058 }
14059
14060 /// Creates a new policy in the specified project using the data included in
14061 /// the request.
14062 pub fn insert(&self) -> super::builder::region_security_policies::Insert {
14063 super::builder::region_security_policies::Insert::new(self.inner.clone())
14064 }
14065
14066 /// List all the policies that have been configured for the specified project
14067 /// and region.
14068 pub fn list(&self) -> super::builder::region_security_policies::List {
14069 super::builder::region_security_policies::List::new(self.inner.clone())
14070 }
14071
14072 /// Patches the specified policy with the data included in the request. To
14073 /// clear fields in the policy, leave the fields empty and specify them in the
14074 /// updateMask. This cannot be used to be update the rules in the policy.
14075 /// Please use the per rule methods like addRule, patchRule, and removeRule
14076 /// instead.
14077 pub fn patch(&self) -> super::builder::region_security_policies::Patch {
14078 super::builder::region_security_policies::Patch::new(self.inner.clone())
14079 }
14080
14081 /// Patches a rule at the specified priority. To clear fields in the rule,
14082 /// leave the fields empty and specify them in the updateMask.
14083 pub fn patch_rule(&self) -> super::builder::region_security_policies::PatchRule {
14084 super::builder::region_security_policies::PatchRule::new(self.inner.clone())
14085 }
14086
14087 /// Deletes a rule at the specified priority.
14088 pub fn remove_rule(&self) -> super::builder::region_security_policies::RemoveRule {
14089 super::builder::region_security_policies::RemoveRule::new(self.inner.clone())
14090 }
14091
14092 /// Sets the labels on a security policy. To learn more about labels,
14093 /// read the Labeling Resources
14094 /// documentation.
14095 pub fn set_labels(&self) -> super::builder::region_security_policies::SetLabels {
14096 super::builder::region_security_policies::SetLabels::new(self.inner.clone())
14097 }
14098
14099 /// Retrieves the specified region-specific Operations resource.
14100 pub fn get_operation(&self) -> super::builder::region_security_policies::GetOperation {
14101 super::builder::region_security_policies::GetOperation::new(self.inner.clone())
14102 }
14103}
14104
14105/// Implements a client for the Google Compute Engine API.
14106///
14107/// # Example
14108/// ```
14109/// # use google_cloud_compute_v1::client::RegionSnapshotSettings;
14110/// async fn sample(
14111/// ) -> anyhow::Result<()> {
14112/// let client = RegionSnapshotSettings::builder().build().await?;
14113/// // use `client` to make requests to the Google Compute Engine API.
14114/// Ok(())
14115/// }
14116/// ```
14117///
14118/// # Service Description
14119///
14120/// Service for the `regionSnapshotSettings` resource.
14121///
14122/// # Configuration
14123///
14124/// To configure `RegionSnapshotSettings` use the `with_*` methods in the type returned
14125/// by [builder()][RegionSnapshotSettings::builder]. The default configuration should
14126/// work for most applications. Common configuration changes include
14127///
14128/// * [with_endpoint()]: by default this client uses the global default endpoint
14129/// (`https://compute.googleapis.com`). Applications using regional
14130/// endpoints or running in restricted networks (e.g. a network configured
14131/// with [Private Google Access with VPC Service Controls]) may want to
14132/// override this default.
14133/// * [with_credentials()]: by default this client uses
14134/// [Application Default Credentials]. Applications using custom
14135/// authentication may need to override this default.
14136///
14137/// [with_endpoint()]: super::builder::region_snapshot_settings::ClientBuilder::with_endpoint
14138/// [with_credentials()]: super::builder::region_snapshot_settings::ClientBuilder::with_credentials
14139/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14140/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14141///
14142/// # Pooling and Cloning
14143///
14144/// `RegionSnapshotSettings` holds a connection pool internally, it is advised to
14145/// create one and reuse it. You do not need to wrap `RegionSnapshotSettings` in
14146/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14147/// already uses an `Arc` internally.
14148#[cfg(feature = "region-snapshot-settings")]
14149#[cfg_attr(docsrs, doc(cfg(feature = "region-snapshot-settings")))]
14150#[derive(Clone, Debug)]
14151pub struct RegionSnapshotSettings {
14152 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSnapshotSettings>,
14153}
14154
14155#[cfg(feature = "region-snapshot-settings")]
14156impl RegionSnapshotSettings {
14157 /// Returns a builder for [RegionSnapshotSettings].
14158 ///
14159 /// ```
14160 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14161 /// # use google_cloud_compute_v1::client::RegionSnapshotSettings;
14162 /// let client = RegionSnapshotSettings::builder().build().await?;
14163 /// # Ok(()) }
14164 /// ```
14165 pub fn builder() -> super::builder::region_snapshot_settings::ClientBuilder {
14166 crate::new_client_builder(super::builder::region_snapshot_settings::client::Factory)
14167 }
14168
14169 /// Creates a new client from the provided stub.
14170 ///
14171 /// The most common case for calling this function is in tests mocking the
14172 /// client's behavior.
14173 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14174 where
14175 T: super::stub::RegionSnapshotSettings + 'static,
14176 {
14177 Self { inner: stub.into() }
14178 }
14179
14180 pub(crate) async fn new(
14181 config: gaxi::options::ClientConfig,
14182 ) -> crate::ClientBuilderResult<Self> {
14183 let inner = Self::build_inner(config).await?;
14184 Ok(Self { inner })
14185 }
14186
14187 async fn build_inner(
14188 conf: gaxi::options::ClientConfig,
14189 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSnapshotSettings>>
14190 {
14191 if gaxi::options::tracing_enabled(&conf) {
14192 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14193 }
14194 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14195 }
14196
14197 async fn build_transport(
14198 conf: gaxi::options::ClientConfig,
14199 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshotSettings> {
14200 super::transport::RegionSnapshotSettings::new(conf).await
14201 }
14202
14203 async fn build_with_tracing(
14204 conf: gaxi::options::ClientConfig,
14205 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshotSettings> {
14206 Self::build_transport(conf)
14207 .await
14208 .map(super::tracing::RegionSnapshotSettings::new)
14209 }
14210
14211 /// Get region snapshot settings.
14212 pub fn get(&self) -> super::builder::region_snapshot_settings::Get {
14213 super::builder::region_snapshot_settings::Get::new(self.inner.clone())
14214 }
14215
14216 /// Patch region snapshot settings.
14217 pub fn patch(&self) -> super::builder::region_snapshot_settings::Patch {
14218 super::builder::region_snapshot_settings::Patch::new(self.inner.clone())
14219 }
14220
14221 /// Retrieves the specified region-specific Operations resource.
14222 pub fn get_operation(&self) -> super::builder::region_snapshot_settings::GetOperation {
14223 super::builder::region_snapshot_settings::GetOperation::new(self.inner.clone())
14224 }
14225}
14226
14227/// Implements a client for the Google Compute Engine API.
14228///
14229/// # Example
14230/// ```
14231/// # use google_cloud_compute_v1::client::RegionSnapshots;
14232/// async fn sample(
14233/// ) -> anyhow::Result<()> {
14234/// let client = RegionSnapshots::builder().build().await?;
14235/// // use `client` to make requests to the Google Compute Engine API.
14236/// Ok(())
14237/// }
14238/// ```
14239///
14240/// # Service Description
14241///
14242/// Service for the `regionSnapshots` resource.
14243///
14244/// # Configuration
14245///
14246/// To configure `RegionSnapshots` use the `with_*` methods in the type returned
14247/// by [builder()][RegionSnapshots::builder]. The default configuration should
14248/// work for most applications. Common configuration changes include
14249///
14250/// * [with_endpoint()]: by default this client uses the global default endpoint
14251/// (`https://compute.googleapis.com`). Applications using regional
14252/// endpoints or running in restricted networks (e.g. a network configured
14253/// with [Private Google Access with VPC Service Controls]) may want to
14254/// override this default.
14255/// * [with_credentials()]: by default this client uses
14256/// [Application Default Credentials]. Applications using custom
14257/// authentication may need to override this default.
14258///
14259/// [with_endpoint()]: super::builder::region_snapshots::ClientBuilder::with_endpoint
14260/// [with_credentials()]: super::builder::region_snapshots::ClientBuilder::with_credentials
14261/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14262/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14263///
14264/// # Pooling and Cloning
14265///
14266/// `RegionSnapshots` holds a connection pool internally, it is advised to
14267/// create one and reuse it. You do not need to wrap `RegionSnapshots` in
14268/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14269/// already uses an `Arc` internally.
14270#[cfg(feature = "region-snapshots")]
14271#[cfg_attr(docsrs, doc(cfg(feature = "region-snapshots")))]
14272#[derive(Clone, Debug)]
14273pub struct RegionSnapshots {
14274 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSnapshots>,
14275}
14276
14277#[cfg(feature = "region-snapshots")]
14278impl RegionSnapshots {
14279 /// Returns a builder for [RegionSnapshots].
14280 ///
14281 /// ```
14282 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14283 /// # use google_cloud_compute_v1::client::RegionSnapshots;
14284 /// let client = RegionSnapshots::builder().build().await?;
14285 /// # Ok(()) }
14286 /// ```
14287 pub fn builder() -> super::builder::region_snapshots::ClientBuilder {
14288 crate::new_client_builder(super::builder::region_snapshots::client::Factory)
14289 }
14290
14291 /// Creates a new client from the provided stub.
14292 ///
14293 /// The most common case for calling this function is in tests mocking the
14294 /// client's behavior.
14295 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14296 where
14297 T: super::stub::RegionSnapshots + 'static,
14298 {
14299 Self { inner: stub.into() }
14300 }
14301
14302 pub(crate) async fn new(
14303 config: gaxi::options::ClientConfig,
14304 ) -> crate::ClientBuilderResult<Self> {
14305 let inner = Self::build_inner(config).await?;
14306 Ok(Self { inner })
14307 }
14308
14309 async fn build_inner(
14310 conf: gaxi::options::ClientConfig,
14311 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSnapshots>> {
14312 if gaxi::options::tracing_enabled(&conf) {
14313 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14314 }
14315 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14316 }
14317
14318 async fn build_transport(
14319 conf: gaxi::options::ClientConfig,
14320 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshots> {
14321 super::transport::RegionSnapshots::new(conf).await
14322 }
14323
14324 async fn build_with_tracing(
14325 conf: gaxi::options::ClientConfig,
14326 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshots> {
14327 Self::build_transport(conf)
14328 .await
14329 .map(super::tracing::RegionSnapshots::new)
14330 }
14331
14332 /// Deletes the specified Snapshot resource. Keep in mind that deleting
14333 /// a single snapshot might not necessarily delete all the data on that
14334 /// snapshot. If any data on the snapshot that is marked for deletion is
14335 /// needed for subsequent snapshots, the data will be moved to the next
14336 /// corresponding snapshot.
14337 ///
14338 /// For more information, seeDeleting
14339 /// snapshots.
14340 pub fn delete(&self) -> super::builder::region_snapshots::Delete {
14341 super::builder::region_snapshots::Delete::new(self.inner.clone())
14342 }
14343
14344 /// Returns the specified Snapshot resource.
14345 pub fn get(&self) -> super::builder::region_snapshots::Get {
14346 super::builder::region_snapshots::Get::new(self.inner.clone())
14347 }
14348
14349 /// Gets the access control policy for a resource. May be empty if no such
14350 /// policy or resource exists.
14351 pub fn get_iam_policy(&self) -> super::builder::region_snapshots::GetIamPolicy {
14352 super::builder::region_snapshots::GetIamPolicy::new(self.inner.clone())
14353 }
14354
14355 /// Creates a snapshot in the specified region using the data included
14356 /// in the request.
14357 pub fn insert(&self) -> super::builder::region_snapshots::Insert {
14358 super::builder::region_snapshots::Insert::new(self.inner.clone())
14359 }
14360
14361 /// Retrieves the list of Snapshot resources contained within
14362 /// the specified region.
14363 pub fn list(&self) -> super::builder::region_snapshots::List {
14364 super::builder::region_snapshots::List::new(self.inner.clone())
14365 }
14366
14367 /// Sets the access control policy on the specified resource.
14368 /// Replaces any existing policy.
14369 pub fn set_iam_policy(&self) -> super::builder::region_snapshots::SetIamPolicy {
14370 super::builder::region_snapshots::SetIamPolicy::new(self.inner.clone())
14371 }
14372
14373 /// Sets the labels on a regional snapshot. To learn more about labels, read
14374 /// the Labeling Resources
14375 /// documentation.
14376 pub fn set_labels(&self) -> super::builder::region_snapshots::SetLabels {
14377 super::builder::region_snapshots::SetLabels::new(self.inner.clone())
14378 }
14379
14380 /// Returns permissions that a caller has on the specified resource.
14381 pub fn test_iam_permissions(&self) -> super::builder::region_snapshots::TestIamPermissions {
14382 super::builder::region_snapshots::TestIamPermissions::new(self.inner.clone())
14383 }
14384
14385 /// Rotates the customer-managed
14386 /// encryption key to the latest version for the specified snapshot.
14387 pub fn update_kms_key(&self) -> super::builder::region_snapshots::UpdateKmsKey {
14388 super::builder::region_snapshots::UpdateKmsKey::new(self.inner.clone())
14389 }
14390
14391 /// Retrieves the specified region-specific Operations resource.
14392 pub fn get_operation(&self) -> super::builder::region_snapshots::GetOperation {
14393 super::builder::region_snapshots::GetOperation::new(self.inner.clone())
14394 }
14395}
14396
14397/// Implements a client for the Google Compute Engine API.
14398///
14399/// # Example
14400/// ```
14401/// # use google_cloud_compute_v1::client::RegionSslCertificates;
14402/// async fn sample(
14403/// ) -> anyhow::Result<()> {
14404/// let client = RegionSslCertificates::builder().build().await?;
14405/// // use `client` to make requests to the Google Compute Engine API.
14406/// Ok(())
14407/// }
14408/// ```
14409///
14410/// # Service Description
14411///
14412/// Service for the `regionSslCertificates` resource.
14413///
14414/// # Configuration
14415///
14416/// To configure `RegionSslCertificates` use the `with_*` methods in the type returned
14417/// by [builder()][RegionSslCertificates::builder]. The default configuration should
14418/// work for most applications. Common configuration changes include
14419///
14420/// * [with_endpoint()]: by default this client uses the global default endpoint
14421/// (`https://compute.googleapis.com`). Applications using regional
14422/// endpoints or running in restricted networks (e.g. a network configured
14423/// with [Private Google Access with VPC Service Controls]) may want to
14424/// override this default.
14425/// * [with_credentials()]: by default this client uses
14426/// [Application Default Credentials]. Applications using custom
14427/// authentication may need to override this default.
14428///
14429/// [with_endpoint()]: super::builder::region_ssl_certificates::ClientBuilder::with_endpoint
14430/// [with_credentials()]: super::builder::region_ssl_certificates::ClientBuilder::with_credentials
14431/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14432/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14433///
14434/// # Pooling and Cloning
14435///
14436/// `RegionSslCertificates` holds a connection pool internally, it is advised to
14437/// create one and reuse it. You do not need to wrap `RegionSslCertificates` in
14438/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14439/// already uses an `Arc` internally.
14440#[cfg(feature = "region-ssl-certificates")]
14441#[cfg_attr(docsrs, doc(cfg(feature = "region-ssl-certificates")))]
14442#[derive(Clone, Debug)]
14443pub struct RegionSslCertificates {
14444 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSslCertificates>,
14445}
14446
14447#[cfg(feature = "region-ssl-certificates")]
14448impl RegionSslCertificates {
14449 /// Returns a builder for [RegionSslCertificates].
14450 ///
14451 /// ```
14452 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14453 /// # use google_cloud_compute_v1::client::RegionSslCertificates;
14454 /// let client = RegionSslCertificates::builder().build().await?;
14455 /// # Ok(()) }
14456 /// ```
14457 pub fn builder() -> super::builder::region_ssl_certificates::ClientBuilder {
14458 crate::new_client_builder(super::builder::region_ssl_certificates::client::Factory)
14459 }
14460
14461 /// Creates a new client from the provided stub.
14462 ///
14463 /// The most common case for calling this function is in tests mocking the
14464 /// client's behavior.
14465 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14466 where
14467 T: super::stub::RegionSslCertificates + 'static,
14468 {
14469 Self { inner: stub.into() }
14470 }
14471
14472 pub(crate) async fn new(
14473 config: gaxi::options::ClientConfig,
14474 ) -> crate::ClientBuilderResult<Self> {
14475 let inner = Self::build_inner(config).await?;
14476 Ok(Self { inner })
14477 }
14478
14479 async fn build_inner(
14480 conf: gaxi::options::ClientConfig,
14481 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSslCertificates>>
14482 {
14483 if gaxi::options::tracing_enabled(&conf) {
14484 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14485 }
14486 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14487 }
14488
14489 async fn build_transport(
14490 conf: gaxi::options::ClientConfig,
14491 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslCertificates> {
14492 super::transport::RegionSslCertificates::new(conf).await
14493 }
14494
14495 async fn build_with_tracing(
14496 conf: gaxi::options::ClientConfig,
14497 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslCertificates> {
14498 Self::build_transport(conf)
14499 .await
14500 .map(super::tracing::RegionSslCertificates::new)
14501 }
14502
14503 /// Deletes the specified SslCertificate resource in the region.
14504 pub fn delete(&self) -> super::builder::region_ssl_certificates::Delete {
14505 super::builder::region_ssl_certificates::Delete::new(self.inner.clone())
14506 }
14507
14508 /// Returns the specified SslCertificate resource in the specified region. Get
14509 /// a list of available SSL certificates by making a list()
14510 /// request.
14511 pub fn get(&self) -> super::builder::region_ssl_certificates::Get {
14512 super::builder::region_ssl_certificates::Get::new(self.inner.clone())
14513 }
14514
14515 /// Creates a SslCertificate resource in the specified project and region using
14516 /// the data included in the request
14517 pub fn insert(&self) -> super::builder::region_ssl_certificates::Insert {
14518 super::builder::region_ssl_certificates::Insert::new(self.inner.clone())
14519 }
14520
14521 /// Retrieves the list of SslCertificate resources available to the specified
14522 /// project in the specified region.
14523 pub fn list(&self) -> super::builder::region_ssl_certificates::List {
14524 super::builder::region_ssl_certificates::List::new(self.inner.clone())
14525 }
14526
14527 /// Retrieves the specified region-specific Operations resource.
14528 pub fn get_operation(&self) -> super::builder::region_ssl_certificates::GetOperation {
14529 super::builder::region_ssl_certificates::GetOperation::new(self.inner.clone())
14530 }
14531}
14532
14533/// Implements a client for the Google Compute Engine API.
14534///
14535/// # Example
14536/// ```
14537/// # use google_cloud_compute_v1::client::RegionSslPolicies;
14538/// async fn sample(
14539/// ) -> anyhow::Result<()> {
14540/// let client = RegionSslPolicies::builder().build().await?;
14541/// // use `client` to make requests to the Google Compute Engine API.
14542/// Ok(())
14543/// }
14544/// ```
14545///
14546/// # Service Description
14547///
14548/// Service for the `regionSslPolicies` resource.
14549///
14550/// # Configuration
14551///
14552/// To configure `RegionSslPolicies` use the `with_*` methods in the type returned
14553/// by [builder()][RegionSslPolicies::builder]. The default configuration should
14554/// work for most applications. Common configuration changes include
14555///
14556/// * [with_endpoint()]: by default this client uses the global default endpoint
14557/// (`https://compute.googleapis.com`). Applications using regional
14558/// endpoints or running in restricted networks (e.g. a network configured
14559/// with [Private Google Access with VPC Service Controls]) may want to
14560/// override this default.
14561/// * [with_credentials()]: by default this client uses
14562/// [Application Default Credentials]. Applications using custom
14563/// authentication may need to override this default.
14564///
14565/// [with_endpoint()]: super::builder::region_ssl_policies::ClientBuilder::with_endpoint
14566/// [with_credentials()]: super::builder::region_ssl_policies::ClientBuilder::with_credentials
14567/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14568/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14569///
14570/// # Pooling and Cloning
14571///
14572/// `RegionSslPolicies` holds a connection pool internally, it is advised to
14573/// create one and reuse it. You do not need to wrap `RegionSslPolicies` in
14574/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14575/// already uses an `Arc` internally.
14576#[cfg(feature = "region-ssl-policies")]
14577#[cfg_attr(docsrs, doc(cfg(feature = "region-ssl-policies")))]
14578#[derive(Clone, Debug)]
14579pub struct RegionSslPolicies {
14580 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSslPolicies>,
14581}
14582
14583#[cfg(feature = "region-ssl-policies")]
14584impl RegionSslPolicies {
14585 /// Returns a builder for [RegionSslPolicies].
14586 ///
14587 /// ```
14588 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14589 /// # use google_cloud_compute_v1::client::RegionSslPolicies;
14590 /// let client = RegionSslPolicies::builder().build().await?;
14591 /// # Ok(()) }
14592 /// ```
14593 pub fn builder() -> super::builder::region_ssl_policies::ClientBuilder {
14594 crate::new_client_builder(super::builder::region_ssl_policies::client::Factory)
14595 }
14596
14597 /// Creates a new client from the provided stub.
14598 ///
14599 /// The most common case for calling this function is in tests mocking the
14600 /// client's behavior.
14601 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14602 where
14603 T: super::stub::RegionSslPolicies + 'static,
14604 {
14605 Self { inner: stub.into() }
14606 }
14607
14608 pub(crate) async fn new(
14609 config: gaxi::options::ClientConfig,
14610 ) -> crate::ClientBuilderResult<Self> {
14611 let inner = Self::build_inner(config).await?;
14612 Ok(Self { inner })
14613 }
14614
14615 async fn build_inner(
14616 conf: gaxi::options::ClientConfig,
14617 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSslPolicies>>
14618 {
14619 if gaxi::options::tracing_enabled(&conf) {
14620 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14621 }
14622 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14623 }
14624
14625 async fn build_transport(
14626 conf: gaxi::options::ClientConfig,
14627 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslPolicies> {
14628 super::transport::RegionSslPolicies::new(conf).await
14629 }
14630
14631 async fn build_with_tracing(
14632 conf: gaxi::options::ClientConfig,
14633 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslPolicies> {
14634 Self::build_transport(conf)
14635 .await
14636 .map(super::tracing::RegionSslPolicies::new)
14637 }
14638
14639 /// Deletes the specified SSL policy. The SSL policy resource can be deleted
14640 /// only if it is not in use by any TargetHttpsProxy or TargetSslProxy
14641 /// resources.
14642 pub fn delete(&self) -> super::builder::region_ssl_policies::Delete {
14643 super::builder::region_ssl_policies::Delete::new(self.inner.clone())
14644 }
14645
14646 /// Lists all of the ordered rules present in a single specified policy.
14647 pub fn get(&self) -> super::builder::region_ssl_policies::Get {
14648 super::builder::region_ssl_policies::Get::new(self.inner.clone())
14649 }
14650
14651 /// Creates a new policy in the specified project and region using the data
14652 /// included in the request.
14653 pub fn insert(&self) -> super::builder::region_ssl_policies::Insert {
14654 super::builder::region_ssl_policies::Insert::new(self.inner.clone())
14655 }
14656
14657 /// Lists all the SSL policies that have been configured for the specified
14658 /// project and region.
14659 pub fn list(&self) -> super::builder::region_ssl_policies::List {
14660 super::builder::region_ssl_policies::List::new(self.inner.clone())
14661 }
14662
14663 /// Lists all features that can be specified in the SSL policy when using
14664 /// custom profile.
14665 pub fn list_available_features(
14666 &self,
14667 ) -> super::builder::region_ssl_policies::ListAvailableFeatures {
14668 super::builder::region_ssl_policies::ListAvailableFeatures::new(self.inner.clone())
14669 }
14670
14671 /// Patches the specified SSL policy with the data included in the request.
14672 pub fn patch(&self) -> super::builder::region_ssl_policies::Patch {
14673 super::builder::region_ssl_policies::Patch::new(self.inner.clone())
14674 }
14675
14676 /// Retrieves the specified region-specific Operations resource.
14677 pub fn get_operation(&self) -> super::builder::region_ssl_policies::GetOperation {
14678 super::builder::region_ssl_policies::GetOperation::new(self.inner.clone())
14679 }
14680}
14681
14682/// Implements a client for the Google Compute Engine API.
14683///
14684/// # Example
14685/// ```
14686/// # use google_cloud_compute_v1::client::RegionTargetHttpProxies;
14687/// async fn sample(
14688/// ) -> anyhow::Result<()> {
14689/// let client = RegionTargetHttpProxies::builder().build().await?;
14690/// // use `client` to make requests to the Google Compute Engine API.
14691/// Ok(())
14692/// }
14693/// ```
14694///
14695/// # Service Description
14696///
14697/// Service for the `regionTargetHttpProxies` resource.
14698///
14699/// # Configuration
14700///
14701/// To configure `RegionTargetHttpProxies` use the `with_*` methods in the type returned
14702/// by [builder()][RegionTargetHttpProxies::builder]. The default configuration should
14703/// work for most applications. Common configuration changes include
14704///
14705/// * [with_endpoint()]: by default this client uses the global default endpoint
14706/// (`https://compute.googleapis.com`). Applications using regional
14707/// endpoints or running in restricted networks (e.g. a network configured
14708/// with [Private Google Access with VPC Service Controls]) may want to
14709/// override this default.
14710/// * [with_credentials()]: by default this client uses
14711/// [Application Default Credentials]. Applications using custom
14712/// authentication may need to override this default.
14713///
14714/// [with_endpoint()]: super::builder::region_target_http_proxies::ClientBuilder::with_endpoint
14715/// [with_credentials()]: super::builder::region_target_http_proxies::ClientBuilder::with_credentials
14716/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14717/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14718///
14719/// # Pooling and Cloning
14720///
14721/// `RegionTargetHttpProxies` holds a connection pool internally, it is advised to
14722/// create one and reuse it. You do not need to wrap `RegionTargetHttpProxies` in
14723/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14724/// already uses an `Arc` internally.
14725#[cfg(feature = "region-target-http-proxies")]
14726#[cfg_attr(docsrs, doc(cfg(feature = "region-target-http-proxies")))]
14727#[derive(Clone, Debug)]
14728pub struct RegionTargetHttpProxies {
14729 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpProxies>,
14730}
14731
14732#[cfg(feature = "region-target-http-proxies")]
14733impl RegionTargetHttpProxies {
14734 /// Returns a builder for [RegionTargetHttpProxies].
14735 ///
14736 /// ```
14737 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14738 /// # use google_cloud_compute_v1::client::RegionTargetHttpProxies;
14739 /// let client = RegionTargetHttpProxies::builder().build().await?;
14740 /// # Ok(()) }
14741 /// ```
14742 pub fn builder() -> super::builder::region_target_http_proxies::ClientBuilder {
14743 crate::new_client_builder(super::builder::region_target_http_proxies::client::Factory)
14744 }
14745
14746 /// Creates a new client from the provided stub.
14747 ///
14748 /// The most common case for calling this function is in tests mocking the
14749 /// client's behavior.
14750 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14751 where
14752 T: super::stub::RegionTargetHttpProxies + 'static,
14753 {
14754 Self { inner: stub.into() }
14755 }
14756
14757 pub(crate) async fn new(
14758 config: gaxi::options::ClientConfig,
14759 ) -> crate::ClientBuilderResult<Self> {
14760 let inner = Self::build_inner(config).await?;
14761 Ok(Self { inner })
14762 }
14763
14764 async fn build_inner(
14765 conf: gaxi::options::ClientConfig,
14766 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpProxies>>
14767 {
14768 if gaxi::options::tracing_enabled(&conf) {
14769 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14770 }
14771 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14772 }
14773
14774 async fn build_transport(
14775 conf: gaxi::options::ClientConfig,
14776 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpProxies> {
14777 super::transport::RegionTargetHttpProxies::new(conf).await
14778 }
14779
14780 async fn build_with_tracing(
14781 conf: gaxi::options::ClientConfig,
14782 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpProxies> {
14783 Self::build_transport(conf)
14784 .await
14785 .map(super::tracing::RegionTargetHttpProxies::new)
14786 }
14787
14788 /// Deletes the specified TargetHttpProxy resource.
14789 pub fn delete(&self) -> super::builder::region_target_http_proxies::Delete {
14790 super::builder::region_target_http_proxies::Delete::new(self.inner.clone())
14791 }
14792
14793 /// Returns the specified TargetHttpProxy resource in the specified region.
14794 pub fn get(&self) -> super::builder::region_target_http_proxies::Get {
14795 super::builder::region_target_http_proxies::Get::new(self.inner.clone())
14796 }
14797
14798 /// Creates a TargetHttpProxy resource in the specified project and region
14799 /// using the data included in the request.
14800 pub fn insert(&self) -> super::builder::region_target_http_proxies::Insert {
14801 super::builder::region_target_http_proxies::Insert::new(self.inner.clone())
14802 }
14803
14804 /// Retrieves the list of TargetHttpProxy resources available
14805 /// to the specified project in the specified region.
14806 pub fn list(&self) -> super::builder::region_target_http_proxies::List {
14807 super::builder::region_target_http_proxies::List::new(self.inner.clone())
14808 }
14809
14810 /// Changes the URL map for TargetHttpProxy.
14811 pub fn set_url_map(&self) -> super::builder::region_target_http_proxies::SetUrlMap {
14812 super::builder::region_target_http_proxies::SetUrlMap::new(self.inner.clone())
14813 }
14814
14815 /// Retrieves the specified region-specific Operations resource.
14816 pub fn get_operation(&self) -> super::builder::region_target_http_proxies::GetOperation {
14817 super::builder::region_target_http_proxies::GetOperation::new(self.inner.clone())
14818 }
14819}
14820
14821/// Implements a client for the Google Compute Engine API.
14822///
14823/// # Example
14824/// ```
14825/// # use google_cloud_compute_v1::client::RegionTargetHttpsProxies;
14826/// async fn sample(
14827/// ) -> anyhow::Result<()> {
14828/// let client = RegionTargetHttpsProxies::builder().build().await?;
14829/// // use `client` to make requests to the Google Compute Engine API.
14830/// Ok(())
14831/// }
14832/// ```
14833///
14834/// # Service Description
14835///
14836/// Service for the `regionTargetHttpsProxies` resource.
14837///
14838/// # Configuration
14839///
14840/// To configure `RegionTargetHttpsProxies` use the `with_*` methods in the type returned
14841/// by [builder()][RegionTargetHttpsProxies::builder]. The default configuration should
14842/// work for most applications. Common configuration changes include
14843///
14844/// * [with_endpoint()]: by default this client uses the global default endpoint
14845/// (`https://compute.googleapis.com`). Applications using regional
14846/// endpoints or running in restricted networks (e.g. a network configured
14847/// with [Private Google Access with VPC Service Controls]) may want to
14848/// override this default.
14849/// * [with_credentials()]: by default this client uses
14850/// [Application Default Credentials]. Applications using custom
14851/// authentication may need to override this default.
14852///
14853/// [with_endpoint()]: super::builder::region_target_https_proxies::ClientBuilder::with_endpoint
14854/// [with_credentials()]: super::builder::region_target_https_proxies::ClientBuilder::with_credentials
14855/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14856/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14857///
14858/// # Pooling and Cloning
14859///
14860/// `RegionTargetHttpsProxies` holds a connection pool internally, it is advised to
14861/// create one and reuse it. You do not need to wrap `RegionTargetHttpsProxies` in
14862/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14863/// already uses an `Arc` internally.
14864#[cfg(feature = "region-target-https-proxies")]
14865#[cfg_attr(docsrs, doc(cfg(feature = "region-target-https-proxies")))]
14866#[derive(Clone, Debug)]
14867pub struct RegionTargetHttpsProxies {
14868 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpsProxies>,
14869}
14870
14871#[cfg(feature = "region-target-https-proxies")]
14872impl RegionTargetHttpsProxies {
14873 /// Returns a builder for [RegionTargetHttpsProxies].
14874 ///
14875 /// ```
14876 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14877 /// # use google_cloud_compute_v1::client::RegionTargetHttpsProxies;
14878 /// let client = RegionTargetHttpsProxies::builder().build().await?;
14879 /// # Ok(()) }
14880 /// ```
14881 pub fn builder() -> super::builder::region_target_https_proxies::ClientBuilder {
14882 crate::new_client_builder(super::builder::region_target_https_proxies::client::Factory)
14883 }
14884
14885 /// Creates a new client from the provided stub.
14886 ///
14887 /// The most common case for calling this function is in tests mocking the
14888 /// client's behavior.
14889 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14890 where
14891 T: super::stub::RegionTargetHttpsProxies + 'static,
14892 {
14893 Self { inner: stub.into() }
14894 }
14895
14896 pub(crate) async fn new(
14897 config: gaxi::options::ClientConfig,
14898 ) -> crate::ClientBuilderResult<Self> {
14899 let inner = Self::build_inner(config).await?;
14900 Ok(Self { inner })
14901 }
14902
14903 async fn build_inner(
14904 conf: gaxi::options::ClientConfig,
14905 ) -> crate::ClientBuilderResult<
14906 std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpsProxies>,
14907 > {
14908 if gaxi::options::tracing_enabled(&conf) {
14909 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14910 }
14911 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14912 }
14913
14914 async fn build_transport(
14915 conf: gaxi::options::ClientConfig,
14916 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpsProxies> {
14917 super::transport::RegionTargetHttpsProxies::new(conf).await
14918 }
14919
14920 async fn build_with_tracing(
14921 conf: gaxi::options::ClientConfig,
14922 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpsProxies> {
14923 Self::build_transport(conf)
14924 .await
14925 .map(super::tracing::RegionTargetHttpsProxies::new)
14926 }
14927
14928 /// Deletes the specified TargetHttpsProxy resource.
14929 pub fn delete(&self) -> super::builder::region_target_https_proxies::Delete {
14930 super::builder::region_target_https_proxies::Delete::new(self.inner.clone())
14931 }
14932
14933 /// Returns the specified TargetHttpsProxy resource in the specified region.
14934 pub fn get(&self) -> super::builder::region_target_https_proxies::Get {
14935 super::builder::region_target_https_proxies::Get::new(self.inner.clone())
14936 }
14937
14938 /// Creates a TargetHttpsProxy resource in the specified project and region
14939 /// using the data included in the request.
14940 pub fn insert(&self) -> super::builder::region_target_https_proxies::Insert {
14941 super::builder::region_target_https_proxies::Insert::new(self.inner.clone())
14942 }
14943
14944 /// Retrieves the list of TargetHttpsProxy resources available
14945 /// to the specified project in the specified region.
14946 pub fn list(&self) -> super::builder::region_target_https_proxies::List {
14947 super::builder::region_target_https_proxies::List::new(self.inner.clone())
14948 }
14949
14950 /// Patches the specified regional TargetHttpsProxy resource with the data
14951 /// included in the request. This method supports PATCH
14952 /// semantics and usesJSON merge
14953 /// patch format and processing rules.
14954 pub fn patch(&self) -> super::builder::region_target_https_proxies::Patch {
14955 super::builder::region_target_https_proxies::Patch::new(self.inner.clone())
14956 }
14957
14958 /// Replaces SslCertificates for TargetHttpsProxy.
14959 pub fn set_ssl_certificates(
14960 &self,
14961 ) -> super::builder::region_target_https_proxies::SetSslCertificates {
14962 super::builder::region_target_https_proxies::SetSslCertificates::new(self.inner.clone())
14963 }
14964
14965 /// Changes the URL map for TargetHttpsProxy.
14966 pub fn set_url_map(&self) -> super::builder::region_target_https_proxies::SetUrlMap {
14967 super::builder::region_target_https_proxies::SetUrlMap::new(self.inner.clone())
14968 }
14969
14970 /// Retrieves the specified region-specific Operations resource.
14971 pub fn get_operation(&self) -> super::builder::region_target_https_proxies::GetOperation {
14972 super::builder::region_target_https_proxies::GetOperation::new(self.inner.clone())
14973 }
14974}
14975
14976/// Implements a client for the Google Compute Engine API.
14977///
14978/// # Example
14979/// ```
14980/// # use google_cloud_compute_v1::client::RegionTargetTcpProxies;
14981/// async fn sample(
14982/// ) -> anyhow::Result<()> {
14983/// let client = RegionTargetTcpProxies::builder().build().await?;
14984/// // use `client` to make requests to the Google Compute Engine API.
14985/// Ok(())
14986/// }
14987/// ```
14988///
14989/// # Service Description
14990///
14991/// Service for the `regionTargetTcpProxies` resource.
14992///
14993/// # Configuration
14994///
14995/// To configure `RegionTargetTcpProxies` use the `with_*` methods in the type returned
14996/// by [builder()][RegionTargetTcpProxies::builder]. The default configuration should
14997/// work for most applications. Common configuration changes include
14998///
14999/// * [with_endpoint()]: by default this client uses the global default endpoint
15000/// (`https://compute.googleapis.com`). Applications using regional
15001/// endpoints or running in restricted networks (e.g. a network configured
15002/// with [Private Google Access with VPC Service Controls]) may want to
15003/// override this default.
15004/// * [with_credentials()]: by default this client uses
15005/// [Application Default Credentials]. Applications using custom
15006/// authentication may need to override this default.
15007///
15008/// [with_endpoint()]: super::builder::region_target_tcp_proxies::ClientBuilder::with_endpoint
15009/// [with_credentials()]: super::builder::region_target_tcp_proxies::ClientBuilder::with_credentials
15010/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15011/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15012///
15013/// # Pooling and Cloning
15014///
15015/// `RegionTargetTcpProxies` holds a connection pool internally, it is advised to
15016/// create one and reuse it. You do not need to wrap `RegionTargetTcpProxies` in
15017/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15018/// already uses an `Arc` internally.
15019#[cfg(feature = "region-target-tcp-proxies")]
15020#[cfg_attr(docsrs, doc(cfg(feature = "region-target-tcp-proxies")))]
15021#[derive(Clone, Debug)]
15022pub struct RegionTargetTcpProxies {
15023 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetTcpProxies>,
15024}
15025
15026#[cfg(feature = "region-target-tcp-proxies")]
15027impl RegionTargetTcpProxies {
15028 /// Returns a builder for [RegionTargetTcpProxies].
15029 ///
15030 /// ```
15031 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15032 /// # use google_cloud_compute_v1::client::RegionTargetTcpProxies;
15033 /// let client = RegionTargetTcpProxies::builder().build().await?;
15034 /// # Ok(()) }
15035 /// ```
15036 pub fn builder() -> super::builder::region_target_tcp_proxies::ClientBuilder {
15037 crate::new_client_builder(super::builder::region_target_tcp_proxies::client::Factory)
15038 }
15039
15040 /// Creates a new client from the provided stub.
15041 ///
15042 /// The most common case for calling this function is in tests mocking the
15043 /// client's behavior.
15044 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15045 where
15046 T: super::stub::RegionTargetTcpProxies + 'static,
15047 {
15048 Self { inner: stub.into() }
15049 }
15050
15051 pub(crate) async fn new(
15052 config: gaxi::options::ClientConfig,
15053 ) -> crate::ClientBuilderResult<Self> {
15054 let inner = Self::build_inner(config).await?;
15055 Ok(Self { inner })
15056 }
15057
15058 async fn build_inner(
15059 conf: gaxi::options::ClientConfig,
15060 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionTargetTcpProxies>>
15061 {
15062 if gaxi::options::tracing_enabled(&conf) {
15063 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15064 }
15065 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15066 }
15067
15068 async fn build_transport(
15069 conf: gaxi::options::ClientConfig,
15070 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetTcpProxies> {
15071 super::transport::RegionTargetTcpProxies::new(conf).await
15072 }
15073
15074 async fn build_with_tracing(
15075 conf: gaxi::options::ClientConfig,
15076 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetTcpProxies> {
15077 Self::build_transport(conf)
15078 .await
15079 .map(super::tracing::RegionTargetTcpProxies::new)
15080 }
15081
15082 /// Deletes the specified TargetTcpProxy resource.
15083 pub fn delete(&self) -> super::builder::region_target_tcp_proxies::Delete {
15084 super::builder::region_target_tcp_proxies::Delete::new(self.inner.clone())
15085 }
15086
15087 /// Returns the specified TargetTcpProxy resource.
15088 pub fn get(&self) -> super::builder::region_target_tcp_proxies::Get {
15089 super::builder::region_target_tcp_proxies::Get::new(self.inner.clone())
15090 }
15091
15092 /// Creates a TargetTcpProxy resource in the specified project and region using
15093 /// the data included in the request.
15094 pub fn insert(&self) -> super::builder::region_target_tcp_proxies::Insert {
15095 super::builder::region_target_tcp_proxies::Insert::new(self.inner.clone())
15096 }
15097
15098 /// Retrieves a list of TargetTcpProxy resources
15099 /// available to the specified project in a given region.
15100 pub fn list(&self) -> super::builder::region_target_tcp_proxies::List {
15101 super::builder::region_target_tcp_proxies::List::new(self.inner.clone())
15102 }
15103
15104 /// Retrieves the specified region-specific Operations resource.
15105 pub fn get_operation(&self) -> super::builder::region_target_tcp_proxies::GetOperation {
15106 super::builder::region_target_tcp_proxies::GetOperation::new(self.inner.clone())
15107 }
15108}
15109
15110/// Implements a client for the Google Compute Engine API.
15111///
15112/// # Example
15113/// ```
15114/// # use google_cloud_compute_v1::client::RegionUrlMaps;
15115/// async fn sample(
15116/// ) -> anyhow::Result<()> {
15117/// let client = RegionUrlMaps::builder().build().await?;
15118/// // use `client` to make requests to the Google Compute Engine API.
15119/// Ok(())
15120/// }
15121/// ```
15122///
15123/// # Service Description
15124///
15125/// Service for the `regionUrlMaps` resource.
15126///
15127/// # Configuration
15128///
15129/// To configure `RegionUrlMaps` use the `with_*` methods in the type returned
15130/// by [builder()][RegionUrlMaps::builder]. The default configuration should
15131/// work for most applications. Common configuration changes include
15132///
15133/// * [with_endpoint()]: by default this client uses the global default endpoint
15134/// (`https://compute.googleapis.com`). Applications using regional
15135/// endpoints or running in restricted networks (e.g. a network configured
15136/// with [Private Google Access with VPC Service Controls]) may want to
15137/// override this default.
15138/// * [with_credentials()]: by default this client uses
15139/// [Application Default Credentials]. Applications using custom
15140/// authentication may need to override this default.
15141///
15142/// [with_endpoint()]: super::builder::region_url_maps::ClientBuilder::with_endpoint
15143/// [with_credentials()]: super::builder::region_url_maps::ClientBuilder::with_credentials
15144/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15145/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15146///
15147/// # Pooling and Cloning
15148///
15149/// `RegionUrlMaps` holds a connection pool internally, it is advised to
15150/// create one and reuse it. You do not need to wrap `RegionUrlMaps` in
15151/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15152/// already uses an `Arc` internally.
15153#[cfg(feature = "region-url-maps")]
15154#[cfg_attr(docsrs, doc(cfg(feature = "region-url-maps")))]
15155#[derive(Clone, Debug)]
15156pub struct RegionUrlMaps {
15157 inner: std::sync::Arc<dyn super::stub::dynamic::RegionUrlMaps>,
15158}
15159
15160#[cfg(feature = "region-url-maps")]
15161impl RegionUrlMaps {
15162 /// Returns a builder for [RegionUrlMaps].
15163 ///
15164 /// ```
15165 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15166 /// # use google_cloud_compute_v1::client::RegionUrlMaps;
15167 /// let client = RegionUrlMaps::builder().build().await?;
15168 /// # Ok(()) }
15169 /// ```
15170 pub fn builder() -> super::builder::region_url_maps::ClientBuilder {
15171 crate::new_client_builder(super::builder::region_url_maps::client::Factory)
15172 }
15173
15174 /// Creates a new client from the provided stub.
15175 ///
15176 /// The most common case for calling this function is in tests mocking the
15177 /// client's behavior.
15178 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15179 where
15180 T: super::stub::RegionUrlMaps + 'static,
15181 {
15182 Self { inner: stub.into() }
15183 }
15184
15185 pub(crate) async fn new(
15186 config: gaxi::options::ClientConfig,
15187 ) -> crate::ClientBuilderResult<Self> {
15188 let inner = Self::build_inner(config).await?;
15189 Ok(Self { inner })
15190 }
15191
15192 async fn build_inner(
15193 conf: gaxi::options::ClientConfig,
15194 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionUrlMaps>> {
15195 if gaxi::options::tracing_enabled(&conf) {
15196 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15197 }
15198 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15199 }
15200
15201 async fn build_transport(
15202 conf: gaxi::options::ClientConfig,
15203 ) -> crate::ClientBuilderResult<impl super::stub::RegionUrlMaps> {
15204 super::transport::RegionUrlMaps::new(conf).await
15205 }
15206
15207 async fn build_with_tracing(
15208 conf: gaxi::options::ClientConfig,
15209 ) -> crate::ClientBuilderResult<impl super::stub::RegionUrlMaps> {
15210 Self::build_transport(conf)
15211 .await
15212 .map(super::tracing::RegionUrlMaps::new)
15213 }
15214
15215 /// Deletes the specified UrlMap resource.
15216 pub fn delete(&self) -> super::builder::region_url_maps::Delete {
15217 super::builder::region_url_maps::Delete::new(self.inner.clone())
15218 }
15219
15220 /// Returns the specified UrlMap resource.
15221 pub fn get(&self) -> super::builder::region_url_maps::Get {
15222 super::builder::region_url_maps::Get::new(self.inner.clone())
15223 }
15224
15225 /// Creates a UrlMap resource in the specified project using
15226 /// the data included in the request.
15227 pub fn insert(&self) -> super::builder::region_url_maps::Insert {
15228 super::builder::region_url_maps::Insert::new(self.inner.clone())
15229 }
15230
15231 /// Retrieves the list of UrlMap resources available to the specified
15232 /// project in the specified region.
15233 pub fn list(&self) -> super::builder::region_url_maps::List {
15234 super::builder::region_url_maps::List::new(self.inner.clone())
15235 }
15236
15237 /// Patches the specified UrlMap resource with the data included in the
15238 /// request. This method supportsPATCH
15239 /// semantics and usesJSON merge
15240 /// patch format and processing rules.
15241 pub fn patch(&self) -> super::builder::region_url_maps::Patch {
15242 super::builder::region_url_maps::Patch::new(self.inner.clone())
15243 }
15244
15245 /// Updates the specified UrlMap resource with the data included in the
15246 /// request.
15247 pub fn update(&self) -> super::builder::region_url_maps::Update {
15248 super::builder::region_url_maps::Update::new(self.inner.clone())
15249 }
15250
15251 /// Runs static validation for the UrlMap. In particular, the tests of the
15252 /// provided UrlMap will be run. Calling this method does NOT create the
15253 /// UrlMap.
15254 pub fn validate(&self) -> super::builder::region_url_maps::Validate {
15255 super::builder::region_url_maps::Validate::new(self.inner.clone())
15256 }
15257
15258 /// Retrieves the specified region-specific Operations resource.
15259 pub fn get_operation(&self) -> super::builder::region_url_maps::GetOperation {
15260 super::builder::region_url_maps::GetOperation::new(self.inner.clone())
15261 }
15262}
15263
15264/// Implements a client for the Google Compute Engine API.
15265///
15266/// # Example
15267/// ```
15268/// # use google_cloud_compute_v1::client::RegionZones;
15269/// async fn sample(
15270/// ) -> anyhow::Result<()> {
15271/// let client = RegionZones::builder().build().await?;
15272/// // use `client` to make requests to the Google Compute Engine API.
15273/// Ok(())
15274/// }
15275/// ```
15276///
15277/// # Service Description
15278///
15279/// Service for the `regionZones` resource.
15280///
15281/// # Configuration
15282///
15283/// To configure `RegionZones` use the `with_*` methods in the type returned
15284/// by [builder()][RegionZones::builder]. The default configuration should
15285/// work for most applications. Common configuration changes include
15286///
15287/// * [with_endpoint()]: by default this client uses the global default endpoint
15288/// (`https://compute.googleapis.com`). Applications using regional
15289/// endpoints or running in restricted networks (e.g. a network configured
15290/// with [Private Google Access with VPC Service Controls]) may want to
15291/// override this default.
15292/// * [with_credentials()]: by default this client uses
15293/// [Application Default Credentials]. Applications using custom
15294/// authentication may need to override this default.
15295///
15296/// [with_endpoint()]: super::builder::region_zones::ClientBuilder::with_endpoint
15297/// [with_credentials()]: super::builder::region_zones::ClientBuilder::with_credentials
15298/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15299/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15300///
15301/// # Pooling and Cloning
15302///
15303/// `RegionZones` holds a connection pool internally, it is advised to
15304/// create one and reuse it. You do not need to wrap `RegionZones` in
15305/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15306/// already uses an `Arc` internally.
15307#[cfg(feature = "region-zones")]
15308#[cfg_attr(docsrs, doc(cfg(feature = "region-zones")))]
15309#[derive(Clone, Debug)]
15310pub struct RegionZones {
15311 inner: std::sync::Arc<dyn super::stub::dynamic::RegionZones>,
15312}
15313
15314#[cfg(feature = "region-zones")]
15315impl RegionZones {
15316 /// Returns a builder for [RegionZones].
15317 ///
15318 /// ```
15319 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15320 /// # use google_cloud_compute_v1::client::RegionZones;
15321 /// let client = RegionZones::builder().build().await?;
15322 /// # Ok(()) }
15323 /// ```
15324 pub fn builder() -> super::builder::region_zones::ClientBuilder {
15325 crate::new_client_builder(super::builder::region_zones::client::Factory)
15326 }
15327
15328 /// Creates a new client from the provided stub.
15329 ///
15330 /// The most common case for calling this function is in tests mocking the
15331 /// client's behavior.
15332 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15333 where
15334 T: super::stub::RegionZones + 'static,
15335 {
15336 Self { inner: stub.into() }
15337 }
15338
15339 pub(crate) async fn new(
15340 config: gaxi::options::ClientConfig,
15341 ) -> crate::ClientBuilderResult<Self> {
15342 let inner = Self::build_inner(config).await?;
15343 Ok(Self { inner })
15344 }
15345
15346 async fn build_inner(
15347 conf: gaxi::options::ClientConfig,
15348 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionZones>> {
15349 if gaxi::options::tracing_enabled(&conf) {
15350 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15351 }
15352 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15353 }
15354
15355 async fn build_transport(
15356 conf: gaxi::options::ClientConfig,
15357 ) -> crate::ClientBuilderResult<impl super::stub::RegionZones> {
15358 super::transport::RegionZones::new(conf).await
15359 }
15360
15361 async fn build_with_tracing(
15362 conf: gaxi::options::ClientConfig,
15363 ) -> crate::ClientBuilderResult<impl super::stub::RegionZones> {
15364 Self::build_transport(conf)
15365 .await
15366 .map(super::tracing::RegionZones::new)
15367 }
15368
15369 /// Retrieves the list of Zone resources under the specific region available to
15370 /// the specified project.
15371 pub fn list(&self) -> super::builder::region_zones::List {
15372 super::builder::region_zones::List::new(self.inner.clone())
15373 }
15374}
15375
15376/// Implements a client for the Google Compute Engine API.
15377///
15378/// # Example
15379/// ```
15380/// # use google_cloud_compute_v1::client::Regions;
15381/// async fn sample(
15382/// ) -> anyhow::Result<()> {
15383/// let client = Regions::builder().build().await?;
15384/// // use `client` to make requests to the Google Compute Engine API.
15385/// Ok(())
15386/// }
15387/// ```
15388///
15389/// # Service Description
15390///
15391/// Service for the `regions` resource.
15392///
15393/// # Configuration
15394///
15395/// To configure `Regions` use the `with_*` methods in the type returned
15396/// by [builder()][Regions::builder]. The default configuration should
15397/// work for most applications. Common configuration changes include
15398///
15399/// * [with_endpoint()]: by default this client uses the global default endpoint
15400/// (`https://compute.googleapis.com`). Applications using regional
15401/// endpoints or running in restricted networks (e.g. a network configured
15402/// with [Private Google Access with VPC Service Controls]) may want to
15403/// override this default.
15404/// * [with_credentials()]: by default this client uses
15405/// [Application Default Credentials]. Applications using custom
15406/// authentication may need to override this default.
15407///
15408/// [with_endpoint()]: super::builder::regions::ClientBuilder::with_endpoint
15409/// [with_credentials()]: super::builder::regions::ClientBuilder::with_credentials
15410/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15411/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15412///
15413/// # Pooling and Cloning
15414///
15415/// `Regions` holds a connection pool internally, it is advised to
15416/// create one and reuse it. You do not need to wrap `Regions` in
15417/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15418/// already uses an `Arc` internally.
15419#[cfg(feature = "regions")]
15420#[cfg_attr(docsrs, doc(cfg(feature = "regions")))]
15421#[derive(Clone, Debug)]
15422pub struct Regions {
15423 inner: std::sync::Arc<dyn super::stub::dynamic::Regions>,
15424}
15425
15426#[cfg(feature = "regions")]
15427impl Regions {
15428 /// Returns a builder for [Regions].
15429 ///
15430 /// ```
15431 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15432 /// # use google_cloud_compute_v1::client::Regions;
15433 /// let client = Regions::builder().build().await?;
15434 /// # Ok(()) }
15435 /// ```
15436 pub fn builder() -> super::builder::regions::ClientBuilder {
15437 crate::new_client_builder(super::builder::regions::client::Factory)
15438 }
15439
15440 /// Creates a new client from the provided stub.
15441 ///
15442 /// The most common case for calling this function is in tests mocking the
15443 /// client's behavior.
15444 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15445 where
15446 T: super::stub::Regions + 'static,
15447 {
15448 Self { inner: stub.into() }
15449 }
15450
15451 pub(crate) async fn new(
15452 config: gaxi::options::ClientConfig,
15453 ) -> crate::ClientBuilderResult<Self> {
15454 let inner = Self::build_inner(config).await?;
15455 Ok(Self { inner })
15456 }
15457
15458 async fn build_inner(
15459 conf: gaxi::options::ClientConfig,
15460 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Regions>> {
15461 if gaxi::options::tracing_enabled(&conf) {
15462 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15463 }
15464 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15465 }
15466
15467 async fn build_transport(
15468 conf: gaxi::options::ClientConfig,
15469 ) -> crate::ClientBuilderResult<impl super::stub::Regions> {
15470 super::transport::Regions::new(conf).await
15471 }
15472
15473 async fn build_with_tracing(
15474 conf: gaxi::options::ClientConfig,
15475 ) -> crate::ClientBuilderResult<impl super::stub::Regions> {
15476 Self::build_transport(conf)
15477 .await
15478 .map(super::tracing::Regions::new)
15479 }
15480
15481 /// Returns the specified Region resource.
15482 ///
15483 /// To decrease latency for this method, you can optionally omit any unneeded
15484 /// information from the response by using a field mask. This practice is
15485 /// especially recommended for unused quota information (the `quotas` field).
15486 /// To exclude one or more fields, set your request's `fields` query parameter
15487 /// to only include the fields you need. For example, to only include the `id`
15488 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
15489 /// your request.
15490 ///
15491 /// This method fails if the quota information is unavailable for the region
15492 /// and if the organization policy constraint
15493 /// compute.requireBasicQuotaInResponse is enforced. This
15494 /// constraint, when enforced, disables the fail-open behaviour when quota
15495 /// information (the `items.quotas` field) is unavailable for the region.
15496 /// It is recommended to use the default setting
15497 /// for the constraint unless your application requires the fail-closed
15498 /// behaviour for this method.
15499 pub fn get(&self) -> super::builder::regions::Get {
15500 super::builder::regions::Get::new(self.inner.clone())
15501 }
15502
15503 /// Retrieves the list of region resources available to the specified project.
15504 ///
15505 /// To decrease latency for this method, you can optionally omit any unneeded
15506 /// information from the response by using a field mask. This practice is
15507 /// especially recommended for unused quota information
15508 /// (the `items.quotas` field).
15509 /// To exclude one or more fields, set your request's `fields` query parameter
15510 /// to only include the fields you need. For example, to only include the `id`
15511 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
15512 /// your request.
15513 ///
15514 /// This method fails if the quota information is unavailable for the region
15515 /// and if the organization policy constraint
15516 /// compute.requireBasicQuotaInResponse is enforced. This
15517 /// constraint, when enforced, disables the fail-open behaviour when quota
15518 /// information (the `items.quotas` field) is unavailable for the region.
15519 /// It is recommended to use the default setting
15520 /// for the constraint unless your application requires the fail-closed
15521 /// behaviour for this method.
15522 pub fn list(&self) -> super::builder::regions::List {
15523 super::builder::regions::List::new(self.inner.clone())
15524 }
15525}
15526
15527/// Implements a client for the Google Compute Engine API.
15528///
15529/// # Example
15530/// ```
15531/// # use google_cloud_compute_v1::client::ReservationBlocks;
15532/// async fn sample(
15533/// ) -> anyhow::Result<()> {
15534/// let client = ReservationBlocks::builder().build().await?;
15535/// // use `client` to make requests to the Google Compute Engine API.
15536/// Ok(())
15537/// }
15538/// ```
15539///
15540/// # Service Description
15541///
15542/// Service for the `reservationBlocks` resource.
15543///
15544/// # Configuration
15545///
15546/// To configure `ReservationBlocks` use the `with_*` methods in the type returned
15547/// by [builder()][ReservationBlocks::builder]. The default configuration should
15548/// work for most applications. Common configuration changes include
15549///
15550/// * [with_endpoint()]: by default this client uses the global default endpoint
15551/// (`https://compute.googleapis.com`). Applications using regional
15552/// endpoints or running in restricted networks (e.g. a network configured
15553/// with [Private Google Access with VPC Service Controls]) may want to
15554/// override this default.
15555/// * [with_credentials()]: by default this client uses
15556/// [Application Default Credentials]. Applications using custom
15557/// authentication may need to override this default.
15558///
15559/// [with_endpoint()]: super::builder::reservation_blocks::ClientBuilder::with_endpoint
15560/// [with_credentials()]: super::builder::reservation_blocks::ClientBuilder::with_credentials
15561/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15562/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15563///
15564/// # Pooling and Cloning
15565///
15566/// `ReservationBlocks` holds a connection pool internally, it is advised to
15567/// create one and reuse it. You do not need to wrap `ReservationBlocks` in
15568/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15569/// already uses an `Arc` internally.
15570#[cfg(feature = "reservation-blocks")]
15571#[cfg_attr(docsrs, doc(cfg(feature = "reservation-blocks")))]
15572#[derive(Clone, Debug)]
15573pub struct ReservationBlocks {
15574 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationBlocks>,
15575}
15576
15577#[cfg(feature = "reservation-blocks")]
15578impl ReservationBlocks {
15579 /// Returns a builder for [ReservationBlocks].
15580 ///
15581 /// ```
15582 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15583 /// # use google_cloud_compute_v1::client::ReservationBlocks;
15584 /// let client = ReservationBlocks::builder().build().await?;
15585 /// # Ok(()) }
15586 /// ```
15587 pub fn builder() -> super::builder::reservation_blocks::ClientBuilder {
15588 crate::new_client_builder(super::builder::reservation_blocks::client::Factory)
15589 }
15590
15591 /// Creates a new client from the provided stub.
15592 ///
15593 /// The most common case for calling this function is in tests mocking the
15594 /// client's behavior.
15595 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15596 where
15597 T: super::stub::ReservationBlocks + 'static,
15598 {
15599 Self { inner: stub.into() }
15600 }
15601
15602 pub(crate) async fn new(
15603 config: gaxi::options::ClientConfig,
15604 ) -> crate::ClientBuilderResult<Self> {
15605 let inner = Self::build_inner(config).await?;
15606 Ok(Self { inner })
15607 }
15608
15609 async fn build_inner(
15610 conf: gaxi::options::ClientConfig,
15611 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReservationBlocks>>
15612 {
15613 if gaxi::options::tracing_enabled(&conf) {
15614 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15615 }
15616 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15617 }
15618
15619 async fn build_transport(
15620 conf: gaxi::options::ClientConfig,
15621 ) -> crate::ClientBuilderResult<impl super::stub::ReservationBlocks> {
15622 super::transport::ReservationBlocks::new(conf).await
15623 }
15624
15625 async fn build_with_tracing(
15626 conf: gaxi::options::ClientConfig,
15627 ) -> crate::ClientBuilderResult<impl super::stub::ReservationBlocks> {
15628 Self::build_transport(conf)
15629 .await
15630 .map(super::tracing::ReservationBlocks::new)
15631 }
15632
15633 /// Retrieves information about the specified reservation block.
15634 pub fn get(&self) -> super::builder::reservation_blocks::Get {
15635 super::builder::reservation_blocks::Get::new(self.inner.clone())
15636 }
15637
15638 /// Gets the access control policy for a resource. May be empty if no such
15639 /// policy or resource exists.
15640 pub fn get_iam_policy(&self) -> super::builder::reservation_blocks::GetIamPolicy {
15641 super::builder::reservation_blocks::GetIamPolicy::new(self.inner.clone())
15642 }
15643
15644 /// Retrieves a list of reservation blocks under a single reservation.
15645 pub fn list(&self) -> super::builder::reservation_blocks::List {
15646 super::builder::reservation_blocks::List::new(self.inner.clone())
15647 }
15648
15649 /// Allows customers to perform maintenance on a reservation block
15650 pub fn perform_maintenance(&self) -> super::builder::reservation_blocks::PerformMaintenance {
15651 super::builder::reservation_blocks::PerformMaintenance::new(self.inner.clone())
15652 }
15653
15654 /// Sets the access control policy on the specified resource.
15655 /// Replaces any existing policy.
15656 pub fn set_iam_policy(&self) -> super::builder::reservation_blocks::SetIamPolicy {
15657 super::builder::reservation_blocks::SetIamPolicy::new(self.inner.clone())
15658 }
15659
15660 /// Returns permissions that a caller has on the specified resource.
15661 pub fn test_iam_permissions(&self) -> super::builder::reservation_blocks::TestIamPermissions {
15662 super::builder::reservation_blocks::TestIamPermissions::new(self.inner.clone())
15663 }
15664
15665 /// Retrieves the specified zone-specific Operations resource.
15666 pub fn get_operation(&self) -> super::builder::reservation_blocks::GetOperation {
15667 super::builder::reservation_blocks::GetOperation::new(self.inner.clone())
15668 }
15669}
15670
15671/// Implements a client for the Google Compute Engine API.
15672///
15673/// # Example
15674/// ```
15675/// # use google_cloud_compute_v1::client::ReservationSlots;
15676/// async fn sample(
15677/// ) -> anyhow::Result<()> {
15678/// let client = ReservationSlots::builder().build().await?;
15679/// // use `client` to make requests to the Google Compute Engine API.
15680/// Ok(())
15681/// }
15682/// ```
15683///
15684/// # Service Description
15685///
15686/// Service for the `reservationSlots` resource.
15687///
15688/// # Configuration
15689///
15690/// To configure `ReservationSlots` use the `with_*` methods in the type returned
15691/// by [builder()][ReservationSlots::builder]. The default configuration should
15692/// work for most applications. Common configuration changes include
15693///
15694/// * [with_endpoint()]: by default this client uses the global default endpoint
15695/// (`https://compute.googleapis.com`). Applications using regional
15696/// endpoints or running in restricted networks (e.g. a network configured
15697/// with [Private Google Access with VPC Service Controls]) may want to
15698/// override this default.
15699/// * [with_credentials()]: by default this client uses
15700/// [Application Default Credentials]. Applications using custom
15701/// authentication may need to override this default.
15702///
15703/// [with_endpoint()]: super::builder::reservation_slots::ClientBuilder::with_endpoint
15704/// [with_credentials()]: super::builder::reservation_slots::ClientBuilder::with_credentials
15705/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15706/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15707///
15708/// # Pooling and Cloning
15709///
15710/// `ReservationSlots` holds a connection pool internally, it is advised to
15711/// create one and reuse it. You do not need to wrap `ReservationSlots` in
15712/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15713/// already uses an `Arc` internally.
15714#[cfg(feature = "reservation-slots")]
15715#[cfg_attr(docsrs, doc(cfg(feature = "reservation-slots")))]
15716#[derive(Clone, Debug)]
15717pub struct ReservationSlots {
15718 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationSlots>,
15719}
15720
15721#[cfg(feature = "reservation-slots")]
15722impl ReservationSlots {
15723 /// Returns a builder for [ReservationSlots].
15724 ///
15725 /// ```
15726 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15727 /// # use google_cloud_compute_v1::client::ReservationSlots;
15728 /// let client = ReservationSlots::builder().build().await?;
15729 /// # Ok(()) }
15730 /// ```
15731 pub fn builder() -> super::builder::reservation_slots::ClientBuilder {
15732 crate::new_client_builder(super::builder::reservation_slots::client::Factory)
15733 }
15734
15735 /// Creates a new client from the provided stub.
15736 ///
15737 /// The most common case for calling this function is in tests mocking the
15738 /// client's behavior.
15739 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15740 where
15741 T: super::stub::ReservationSlots + 'static,
15742 {
15743 Self { inner: stub.into() }
15744 }
15745
15746 pub(crate) async fn new(
15747 config: gaxi::options::ClientConfig,
15748 ) -> crate::ClientBuilderResult<Self> {
15749 let inner = Self::build_inner(config).await?;
15750 Ok(Self { inner })
15751 }
15752
15753 async fn build_inner(
15754 conf: gaxi::options::ClientConfig,
15755 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReservationSlots>>
15756 {
15757 if gaxi::options::tracing_enabled(&conf) {
15758 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15759 }
15760 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15761 }
15762
15763 async fn build_transport(
15764 conf: gaxi::options::ClientConfig,
15765 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSlots> {
15766 super::transport::ReservationSlots::new(conf).await
15767 }
15768
15769 async fn build_with_tracing(
15770 conf: gaxi::options::ClientConfig,
15771 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSlots> {
15772 Self::build_transport(conf)
15773 .await
15774 .map(super::tracing::ReservationSlots::new)
15775 }
15776
15777 /// Retrieves information about the specified reservation slot.
15778 pub fn get(&self) -> super::builder::reservation_slots::Get {
15779 super::builder::reservation_slots::Get::new(self.inner.clone())
15780 }
15781
15782 /// Allows customers to get SBOM versions of a reservation slot.
15783 pub fn get_version(&self) -> super::builder::reservation_slots::GetVersion {
15784 super::builder::reservation_slots::GetVersion::new(self.inner.clone())
15785 }
15786
15787 /// Retrieves a list of reservation slots under a single reservation.
15788 pub fn list(&self) -> super::builder::reservation_slots::List {
15789 super::builder::reservation_slots::List::new(self.inner.clone())
15790 }
15791
15792 /// Update a reservation slot in the specified sub-block.
15793 pub fn update(&self) -> super::builder::reservation_slots::Update {
15794 super::builder::reservation_slots::Update::new(self.inner.clone())
15795 }
15796
15797 /// Retrieves the specified zone-specific Operations resource.
15798 pub fn get_operation(&self) -> super::builder::reservation_slots::GetOperation {
15799 super::builder::reservation_slots::GetOperation::new(self.inner.clone())
15800 }
15801}
15802
15803/// Implements a client for the Google Compute Engine API.
15804///
15805/// # Example
15806/// ```
15807/// # use google_cloud_compute_v1::client::ReservationSubBlocks;
15808/// async fn sample(
15809/// ) -> anyhow::Result<()> {
15810/// let client = ReservationSubBlocks::builder().build().await?;
15811/// // use `client` to make requests to the Google Compute Engine API.
15812/// Ok(())
15813/// }
15814/// ```
15815///
15816/// # Service Description
15817///
15818/// Service for the `reservationSubBlocks` resource.
15819///
15820/// # Configuration
15821///
15822/// To configure `ReservationSubBlocks` use the `with_*` methods in the type returned
15823/// by [builder()][ReservationSubBlocks::builder]. The default configuration should
15824/// work for most applications. Common configuration changes include
15825///
15826/// * [with_endpoint()]: by default this client uses the global default endpoint
15827/// (`https://compute.googleapis.com`). Applications using regional
15828/// endpoints or running in restricted networks (e.g. a network configured
15829/// with [Private Google Access with VPC Service Controls]) may want to
15830/// override this default.
15831/// * [with_credentials()]: by default this client uses
15832/// [Application Default Credentials]. Applications using custom
15833/// authentication may need to override this default.
15834///
15835/// [with_endpoint()]: super::builder::reservation_sub_blocks::ClientBuilder::with_endpoint
15836/// [with_credentials()]: super::builder::reservation_sub_blocks::ClientBuilder::with_credentials
15837/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15838/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15839///
15840/// # Pooling and Cloning
15841///
15842/// `ReservationSubBlocks` holds a connection pool internally, it is advised to
15843/// create one and reuse it. You do not need to wrap `ReservationSubBlocks` in
15844/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15845/// already uses an `Arc` internally.
15846#[cfg(feature = "reservation-sub-blocks")]
15847#[cfg_attr(docsrs, doc(cfg(feature = "reservation-sub-blocks")))]
15848#[derive(Clone, Debug)]
15849pub struct ReservationSubBlocks {
15850 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationSubBlocks>,
15851}
15852
15853#[cfg(feature = "reservation-sub-blocks")]
15854impl ReservationSubBlocks {
15855 /// Returns a builder for [ReservationSubBlocks].
15856 ///
15857 /// ```
15858 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15859 /// # use google_cloud_compute_v1::client::ReservationSubBlocks;
15860 /// let client = ReservationSubBlocks::builder().build().await?;
15861 /// # Ok(()) }
15862 /// ```
15863 pub fn builder() -> super::builder::reservation_sub_blocks::ClientBuilder {
15864 crate::new_client_builder(super::builder::reservation_sub_blocks::client::Factory)
15865 }
15866
15867 /// Creates a new client from the provided stub.
15868 ///
15869 /// The most common case for calling this function is in tests mocking the
15870 /// client's behavior.
15871 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15872 where
15873 T: super::stub::ReservationSubBlocks + 'static,
15874 {
15875 Self { inner: stub.into() }
15876 }
15877
15878 pub(crate) async fn new(
15879 config: gaxi::options::ClientConfig,
15880 ) -> crate::ClientBuilderResult<Self> {
15881 let inner = Self::build_inner(config).await?;
15882 Ok(Self { inner })
15883 }
15884
15885 async fn build_inner(
15886 conf: gaxi::options::ClientConfig,
15887 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReservationSubBlocks>>
15888 {
15889 if gaxi::options::tracing_enabled(&conf) {
15890 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15891 }
15892 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15893 }
15894
15895 async fn build_transport(
15896 conf: gaxi::options::ClientConfig,
15897 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSubBlocks> {
15898 super::transport::ReservationSubBlocks::new(conf).await
15899 }
15900
15901 async fn build_with_tracing(
15902 conf: gaxi::options::ClientConfig,
15903 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSubBlocks> {
15904 Self::build_transport(conf)
15905 .await
15906 .map(super::tracing::ReservationSubBlocks::new)
15907 }
15908
15909 /// Retrieves information about the specified reservation subBlock.
15910 pub fn get(&self) -> super::builder::reservation_sub_blocks::Get {
15911 super::builder::reservation_sub_blocks::Get::new(self.inner.clone())
15912 }
15913
15914 /// Gets the access control policy for a resource. May be empty if no such
15915 /// policy or resource exists.
15916 pub fn get_iam_policy(&self) -> super::builder::reservation_sub_blocks::GetIamPolicy {
15917 super::builder::reservation_sub_blocks::GetIamPolicy::new(self.inner.clone())
15918 }
15919
15920 /// Allows customers to get SBOM versions of a reservation subBlock.
15921 pub fn get_version(&self) -> super::builder::reservation_sub_blocks::GetVersion {
15922 super::builder::reservation_sub_blocks::GetVersion::new(self.inner.clone())
15923 }
15924
15925 /// Retrieves a list of reservation subBlocks under a single reservation.
15926 pub fn list(&self) -> super::builder::reservation_sub_blocks::List {
15927 super::builder::reservation_sub_blocks::List::new(self.inner.clone())
15928 }
15929
15930 /// Allows customers to perform maintenance on a reservation subBlock
15931 pub fn perform_maintenance(
15932 &self,
15933 ) -> super::builder::reservation_sub_blocks::PerformMaintenance {
15934 super::builder::reservation_sub_blocks::PerformMaintenance::new(self.inner.clone())
15935 }
15936
15937 /// Allows customers to report a faulty subBlock.
15938 pub fn report_faulty(&self) -> super::builder::reservation_sub_blocks::ReportFaulty {
15939 super::builder::reservation_sub_blocks::ReportFaulty::new(self.inner.clone())
15940 }
15941
15942 /// Sets the access control policy on the specified resource.
15943 /// Replaces any existing policy.
15944 pub fn set_iam_policy(&self) -> super::builder::reservation_sub_blocks::SetIamPolicy {
15945 super::builder::reservation_sub_blocks::SetIamPolicy::new(self.inner.clone())
15946 }
15947
15948 /// Returns permissions that a caller has on the specified resource.
15949 pub fn test_iam_permissions(
15950 &self,
15951 ) -> super::builder::reservation_sub_blocks::TestIamPermissions {
15952 super::builder::reservation_sub_blocks::TestIamPermissions::new(self.inner.clone())
15953 }
15954
15955 /// Retrieves the specified zone-specific Operations resource.
15956 pub fn get_operation(&self) -> super::builder::reservation_sub_blocks::GetOperation {
15957 super::builder::reservation_sub_blocks::GetOperation::new(self.inner.clone())
15958 }
15959}
15960
15961/// Implements a client for the Google Compute Engine API.
15962///
15963/// # Example
15964/// ```
15965/// # use google_cloud_compute_v1::client::Reservations;
15966/// async fn sample(
15967/// ) -> anyhow::Result<()> {
15968/// let client = Reservations::builder().build().await?;
15969/// // use `client` to make requests to the Google Compute Engine API.
15970/// Ok(())
15971/// }
15972/// ```
15973///
15974/// # Service Description
15975///
15976/// Service for the `reservations` resource.
15977///
15978/// # Configuration
15979///
15980/// To configure `Reservations` use the `with_*` methods in the type returned
15981/// by [builder()][Reservations::builder]. The default configuration should
15982/// work for most applications. Common configuration changes include
15983///
15984/// * [with_endpoint()]: by default this client uses the global default endpoint
15985/// (`https://compute.googleapis.com`). Applications using regional
15986/// endpoints or running in restricted networks (e.g. a network configured
15987/// with [Private Google Access with VPC Service Controls]) may want to
15988/// override this default.
15989/// * [with_credentials()]: by default this client uses
15990/// [Application Default Credentials]. Applications using custom
15991/// authentication may need to override this default.
15992///
15993/// [with_endpoint()]: super::builder::reservations::ClientBuilder::with_endpoint
15994/// [with_credentials()]: super::builder::reservations::ClientBuilder::with_credentials
15995/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15996/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15997///
15998/// # Pooling and Cloning
15999///
16000/// `Reservations` holds a connection pool internally, it is advised to
16001/// create one and reuse it. You do not need to wrap `Reservations` in
16002/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16003/// already uses an `Arc` internally.
16004#[cfg(feature = "reservations")]
16005#[cfg_attr(docsrs, doc(cfg(feature = "reservations")))]
16006#[derive(Clone, Debug)]
16007pub struct Reservations {
16008 inner: std::sync::Arc<dyn super::stub::dynamic::Reservations>,
16009}
16010
16011#[cfg(feature = "reservations")]
16012impl Reservations {
16013 /// Returns a builder for [Reservations].
16014 ///
16015 /// ```
16016 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16017 /// # use google_cloud_compute_v1::client::Reservations;
16018 /// let client = Reservations::builder().build().await?;
16019 /// # Ok(()) }
16020 /// ```
16021 pub fn builder() -> super::builder::reservations::ClientBuilder {
16022 crate::new_client_builder(super::builder::reservations::client::Factory)
16023 }
16024
16025 /// Creates a new client from the provided stub.
16026 ///
16027 /// The most common case for calling this function is in tests mocking the
16028 /// client's behavior.
16029 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16030 where
16031 T: super::stub::Reservations + 'static,
16032 {
16033 Self { inner: stub.into() }
16034 }
16035
16036 pub(crate) async fn new(
16037 config: gaxi::options::ClientConfig,
16038 ) -> crate::ClientBuilderResult<Self> {
16039 let inner = Self::build_inner(config).await?;
16040 Ok(Self { inner })
16041 }
16042
16043 async fn build_inner(
16044 conf: gaxi::options::ClientConfig,
16045 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Reservations>> {
16046 if gaxi::options::tracing_enabled(&conf) {
16047 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16048 }
16049 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16050 }
16051
16052 async fn build_transport(
16053 conf: gaxi::options::ClientConfig,
16054 ) -> crate::ClientBuilderResult<impl super::stub::Reservations> {
16055 super::transport::Reservations::new(conf).await
16056 }
16057
16058 async fn build_with_tracing(
16059 conf: gaxi::options::ClientConfig,
16060 ) -> crate::ClientBuilderResult<impl super::stub::Reservations> {
16061 Self::build_transport(conf)
16062 .await
16063 .map(super::tracing::Reservations::new)
16064 }
16065
16066 /// Retrieves an aggregated list of reservations.
16067 ///
16068 /// To prevent failure, it is recommended that you set the
16069 /// `returnPartialSuccess` parameter to `true`.
16070 pub fn aggregated_list(&self) -> super::builder::reservations::AggregatedList {
16071 super::builder::reservations::AggregatedList::new(self.inner.clone())
16072 }
16073
16074 /// Deletes the specified reservation.
16075 pub fn delete(&self) -> super::builder::reservations::Delete {
16076 super::builder::reservations::Delete::new(self.inner.clone())
16077 }
16078
16079 /// Retrieves information about the specified reservation.
16080 pub fn get(&self) -> super::builder::reservations::Get {
16081 super::builder::reservations::Get::new(self.inner.clone())
16082 }
16083
16084 /// Gets the access control policy for a resource. May be empty if no such
16085 /// policy or resource exists.
16086 pub fn get_iam_policy(&self) -> super::builder::reservations::GetIamPolicy {
16087 super::builder::reservations::GetIamPolicy::new(self.inner.clone())
16088 }
16089
16090 /// Creates a new reservation. For more information, readReserving zonal
16091 /// resources.
16092 pub fn insert(&self) -> super::builder::reservations::Insert {
16093 super::builder::reservations::Insert::new(self.inner.clone())
16094 }
16095
16096 /// A list of all the reservations that have been configured for the
16097 /// specified project in specified zone.
16098 pub fn list(&self) -> super::builder::reservations::List {
16099 super::builder::reservations::List::new(self.inner.clone())
16100 }
16101
16102 /// Perform maintenance on an extended reservation
16103 pub fn perform_maintenance(&self) -> super::builder::reservations::PerformMaintenance {
16104 super::builder::reservations::PerformMaintenance::new(self.inner.clone())
16105 }
16106
16107 /// Resizes the reservation (applicable to standalone reservations only). For
16108 /// more information, readModifying
16109 /// reservations.
16110 pub fn resize(&self) -> super::builder::reservations::Resize {
16111 super::builder::reservations::Resize::new(self.inner.clone())
16112 }
16113
16114 /// Sets the access control policy on the specified resource.
16115 /// Replaces any existing policy.
16116 pub fn set_iam_policy(&self) -> super::builder::reservations::SetIamPolicy {
16117 super::builder::reservations::SetIamPolicy::new(self.inner.clone())
16118 }
16119
16120 /// Returns permissions that a caller has on the specified resource.
16121 pub fn test_iam_permissions(&self) -> super::builder::reservations::TestIamPermissions {
16122 super::builder::reservations::TestIamPermissions::new(self.inner.clone())
16123 }
16124
16125 /// Update share settings of the reservation.
16126 pub fn update(&self) -> super::builder::reservations::Update {
16127 super::builder::reservations::Update::new(self.inner.clone())
16128 }
16129
16130 /// Retrieves the specified zone-specific Operations resource.
16131 pub fn get_operation(&self) -> super::builder::reservations::GetOperation {
16132 super::builder::reservations::GetOperation::new(self.inner.clone())
16133 }
16134}
16135
16136/// Implements a client for the Google Compute Engine API.
16137///
16138/// # Example
16139/// ```
16140/// # use google_cloud_compute_v1::client::ResourcePolicies;
16141/// async fn sample(
16142/// ) -> anyhow::Result<()> {
16143/// let client = ResourcePolicies::builder().build().await?;
16144/// // use `client` to make requests to the Google Compute Engine API.
16145/// Ok(())
16146/// }
16147/// ```
16148///
16149/// # Service Description
16150///
16151/// Service for the `resourcePolicies` resource.
16152///
16153/// # Configuration
16154///
16155/// To configure `ResourcePolicies` use the `with_*` methods in the type returned
16156/// by [builder()][ResourcePolicies::builder]. The default configuration should
16157/// work for most applications. Common configuration changes include
16158///
16159/// * [with_endpoint()]: by default this client uses the global default endpoint
16160/// (`https://compute.googleapis.com`). Applications using regional
16161/// endpoints or running in restricted networks (e.g. a network configured
16162/// with [Private Google Access with VPC Service Controls]) may want to
16163/// override this default.
16164/// * [with_credentials()]: by default this client uses
16165/// [Application Default Credentials]. Applications using custom
16166/// authentication may need to override this default.
16167///
16168/// [with_endpoint()]: super::builder::resource_policies::ClientBuilder::with_endpoint
16169/// [with_credentials()]: super::builder::resource_policies::ClientBuilder::with_credentials
16170/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16171/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16172///
16173/// # Pooling and Cloning
16174///
16175/// `ResourcePolicies` holds a connection pool internally, it is advised to
16176/// create one and reuse it. You do not need to wrap `ResourcePolicies` in
16177/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16178/// already uses an `Arc` internally.
16179#[cfg(feature = "resource-policies")]
16180#[cfg_attr(docsrs, doc(cfg(feature = "resource-policies")))]
16181#[derive(Clone, Debug)]
16182pub struct ResourcePolicies {
16183 inner: std::sync::Arc<dyn super::stub::dynamic::ResourcePolicies>,
16184}
16185
16186#[cfg(feature = "resource-policies")]
16187impl ResourcePolicies {
16188 /// Returns a builder for [ResourcePolicies].
16189 ///
16190 /// ```
16191 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16192 /// # use google_cloud_compute_v1::client::ResourcePolicies;
16193 /// let client = ResourcePolicies::builder().build().await?;
16194 /// # Ok(()) }
16195 /// ```
16196 pub fn builder() -> super::builder::resource_policies::ClientBuilder {
16197 crate::new_client_builder(super::builder::resource_policies::client::Factory)
16198 }
16199
16200 /// Creates a new client from the provided stub.
16201 ///
16202 /// The most common case for calling this function is in tests mocking the
16203 /// client's behavior.
16204 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16205 where
16206 T: super::stub::ResourcePolicies + 'static,
16207 {
16208 Self { inner: stub.into() }
16209 }
16210
16211 pub(crate) async fn new(
16212 config: gaxi::options::ClientConfig,
16213 ) -> crate::ClientBuilderResult<Self> {
16214 let inner = Self::build_inner(config).await?;
16215 Ok(Self { inner })
16216 }
16217
16218 async fn build_inner(
16219 conf: gaxi::options::ClientConfig,
16220 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ResourcePolicies>>
16221 {
16222 if gaxi::options::tracing_enabled(&conf) {
16223 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16224 }
16225 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16226 }
16227
16228 async fn build_transport(
16229 conf: gaxi::options::ClientConfig,
16230 ) -> crate::ClientBuilderResult<impl super::stub::ResourcePolicies> {
16231 super::transport::ResourcePolicies::new(conf).await
16232 }
16233
16234 async fn build_with_tracing(
16235 conf: gaxi::options::ClientConfig,
16236 ) -> crate::ClientBuilderResult<impl super::stub::ResourcePolicies> {
16237 Self::build_transport(conf)
16238 .await
16239 .map(super::tracing::ResourcePolicies::new)
16240 }
16241
16242 /// Retrieves an aggregated list of resource policies.
16243 ///
16244 /// To prevent failure, Google recommends that you set the
16245 /// `returnPartialSuccess` parameter to `true`.
16246 pub fn aggregated_list(&self) -> super::builder::resource_policies::AggregatedList {
16247 super::builder::resource_policies::AggregatedList::new(self.inner.clone())
16248 }
16249
16250 /// Deletes the specified resource policy.
16251 pub fn delete(&self) -> super::builder::resource_policies::Delete {
16252 super::builder::resource_policies::Delete::new(self.inner.clone())
16253 }
16254
16255 /// Retrieves all information of the specified resource policy.
16256 pub fn get(&self) -> super::builder::resource_policies::Get {
16257 super::builder::resource_policies::Get::new(self.inner.clone())
16258 }
16259
16260 /// Gets the access control policy for a resource. May be empty if no such
16261 /// policy or resource exists.
16262 pub fn get_iam_policy(&self) -> super::builder::resource_policies::GetIamPolicy {
16263 super::builder::resource_policies::GetIamPolicy::new(self.inner.clone())
16264 }
16265
16266 /// Creates a new resource policy.
16267 pub fn insert(&self) -> super::builder::resource_policies::Insert {
16268 super::builder::resource_policies::Insert::new(self.inner.clone())
16269 }
16270
16271 /// A list all the resource policies that have been configured for the
16272 /// specified project in specified region.
16273 pub fn list(&self) -> super::builder::resource_policies::List {
16274 super::builder::resource_policies::List::new(self.inner.clone())
16275 }
16276
16277 /// Modify the specified resource policy.
16278 pub fn patch(&self) -> super::builder::resource_policies::Patch {
16279 super::builder::resource_policies::Patch::new(self.inner.clone())
16280 }
16281
16282 /// Sets the access control policy on the specified resource.
16283 /// Replaces any existing policy.
16284 pub fn set_iam_policy(&self) -> super::builder::resource_policies::SetIamPolicy {
16285 super::builder::resource_policies::SetIamPolicy::new(self.inner.clone())
16286 }
16287
16288 /// Returns permissions that a caller has on the specified resource.
16289 pub fn test_iam_permissions(&self) -> super::builder::resource_policies::TestIamPermissions {
16290 super::builder::resource_policies::TestIamPermissions::new(self.inner.clone())
16291 }
16292
16293 /// Retrieves the specified region-specific Operations resource.
16294 pub fn get_operation(&self) -> super::builder::resource_policies::GetOperation {
16295 super::builder::resource_policies::GetOperation::new(self.inner.clone())
16296 }
16297}
16298
16299/// Implements a client for the Google Compute Engine API.
16300///
16301/// # Example
16302/// ```
16303/// # use google_cloud_compute_v1::client::RolloutPlans;
16304/// async fn sample(
16305/// ) -> anyhow::Result<()> {
16306/// let client = RolloutPlans::builder().build().await?;
16307/// // use `client` to make requests to the Google Compute Engine API.
16308/// Ok(())
16309/// }
16310/// ```
16311///
16312/// # Service Description
16313///
16314/// Service for the `rolloutPlans` resource.
16315///
16316/// # Configuration
16317///
16318/// To configure `RolloutPlans` use the `with_*` methods in the type returned
16319/// by [builder()][RolloutPlans::builder]. The default configuration should
16320/// work for most applications. Common configuration changes include
16321///
16322/// * [with_endpoint()]: by default this client uses the global default endpoint
16323/// (`https://compute.googleapis.com`). Applications using regional
16324/// endpoints or running in restricted networks (e.g. a network configured
16325/// with [Private Google Access with VPC Service Controls]) may want to
16326/// override this default.
16327/// * [with_credentials()]: by default this client uses
16328/// [Application Default Credentials]. Applications using custom
16329/// authentication may need to override this default.
16330///
16331/// [with_endpoint()]: super::builder::rollout_plans::ClientBuilder::with_endpoint
16332/// [with_credentials()]: super::builder::rollout_plans::ClientBuilder::with_credentials
16333/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16334/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16335///
16336/// # Pooling and Cloning
16337///
16338/// `RolloutPlans` holds a connection pool internally, it is advised to
16339/// create one and reuse it. You do not need to wrap `RolloutPlans` in
16340/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16341/// already uses an `Arc` internally.
16342#[cfg(feature = "rollout-plans")]
16343#[cfg_attr(docsrs, doc(cfg(feature = "rollout-plans")))]
16344#[derive(Clone, Debug)]
16345pub struct RolloutPlans {
16346 inner: std::sync::Arc<dyn super::stub::dynamic::RolloutPlans>,
16347}
16348
16349#[cfg(feature = "rollout-plans")]
16350impl RolloutPlans {
16351 /// Returns a builder for [RolloutPlans].
16352 ///
16353 /// ```
16354 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16355 /// # use google_cloud_compute_v1::client::RolloutPlans;
16356 /// let client = RolloutPlans::builder().build().await?;
16357 /// # Ok(()) }
16358 /// ```
16359 pub fn builder() -> super::builder::rollout_plans::ClientBuilder {
16360 crate::new_client_builder(super::builder::rollout_plans::client::Factory)
16361 }
16362
16363 /// Creates a new client from the provided stub.
16364 ///
16365 /// The most common case for calling this function is in tests mocking the
16366 /// client's behavior.
16367 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16368 where
16369 T: super::stub::RolloutPlans + 'static,
16370 {
16371 Self { inner: stub.into() }
16372 }
16373
16374 pub(crate) async fn new(
16375 config: gaxi::options::ClientConfig,
16376 ) -> crate::ClientBuilderResult<Self> {
16377 let inner = Self::build_inner(config).await?;
16378 Ok(Self { inner })
16379 }
16380
16381 async fn build_inner(
16382 conf: gaxi::options::ClientConfig,
16383 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RolloutPlans>> {
16384 if gaxi::options::tracing_enabled(&conf) {
16385 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16386 }
16387 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16388 }
16389
16390 async fn build_transport(
16391 conf: gaxi::options::ClientConfig,
16392 ) -> crate::ClientBuilderResult<impl super::stub::RolloutPlans> {
16393 super::transport::RolloutPlans::new(conf).await
16394 }
16395
16396 async fn build_with_tracing(
16397 conf: gaxi::options::ClientConfig,
16398 ) -> crate::ClientBuilderResult<impl super::stub::RolloutPlans> {
16399 Self::build_transport(conf)
16400 .await
16401 .map(super::tracing::RolloutPlans::new)
16402 }
16403
16404 /// Deletes a RolloutPlan.
16405 pub fn delete(&self) -> super::builder::rollout_plans::Delete {
16406 super::builder::rollout_plans::Delete::new(self.inner.clone())
16407 }
16408
16409 /// Gets details of a single project-scoped RolloutPlan.
16410 pub fn get(&self) -> super::builder::rollout_plans::Get {
16411 super::builder::rollout_plans::Get::new(self.inner.clone())
16412 }
16413
16414 /// Creates a new RolloutPlan in a given project and location.
16415 pub fn insert(&self) -> super::builder::rollout_plans::Insert {
16416 super::builder::rollout_plans::Insert::new(self.inner.clone())
16417 }
16418
16419 /// Lists RolloutPlans in a given project and location.
16420 pub fn list(&self) -> super::builder::rollout_plans::List {
16421 super::builder::rollout_plans::List::new(self.inner.clone())
16422 }
16423
16424 /// Retrieves the specified Operations resource.
16425 pub fn get_operation(&self) -> super::builder::rollout_plans::GetOperation {
16426 super::builder::rollout_plans::GetOperation::new(self.inner.clone())
16427 }
16428}
16429
16430/// Implements a client for the Google Compute Engine API.
16431///
16432/// # Example
16433/// ```
16434/// # use google_cloud_compute_v1::client::Rollouts;
16435/// async fn sample(
16436/// ) -> anyhow::Result<()> {
16437/// let client = Rollouts::builder().build().await?;
16438/// // use `client` to make requests to the Google Compute Engine API.
16439/// Ok(())
16440/// }
16441/// ```
16442///
16443/// # Service Description
16444///
16445/// Service for the `rollouts` resource.
16446///
16447/// # Configuration
16448///
16449/// To configure `Rollouts` use the `with_*` methods in the type returned
16450/// by [builder()][Rollouts::builder]. The default configuration should
16451/// work for most applications. Common configuration changes include
16452///
16453/// * [with_endpoint()]: by default this client uses the global default endpoint
16454/// (`https://compute.googleapis.com`). Applications using regional
16455/// endpoints or running in restricted networks (e.g. a network configured
16456/// with [Private Google Access with VPC Service Controls]) may want to
16457/// override this default.
16458/// * [with_credentials()]: by default this client uses
16459/// [Application Default Credentials]. Applications using custom
16460/// authentication may need to override this default.
16461///
16462/// [with_endpoint()]: super::builder::rollouts::ClientBuilder::with_endpoint
16463/// [with_credentials()]: super::builder::rollouts::ClientBuilder::with_credentials
16464/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16465/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16466///
16467/// # Pooling and Cloning
16468///
16469/// `Rollouts` holds a connection pool internally, it is advised to
16470/// create one and reuse it. You do not need to wrap `Rollouts` in
16471/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16472/// already uses an `Arc` internally.
16473#[cfg(feature = "rollouts")]
16474#[cfg_attr(docsrs, doc(cfg(feature = "rollouts")))]
16475#[derive(Clone, Debug)]
16476pub struct Rollouts {
16477 inner: std::sync::Arc<dyn super::stub::dynamic::Rollouts>,
16478}
16479
16480#[cfg(feature = "rollouts")]
16481impl Rollouts {
16482 /// Returns a builder for [Rollouts].
16483 ///
16484 /// ```
16485 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16486 /// # use google_cloud_compute_v1::client::Rollouts;
16487 /// let client = Rollouts::builder().build().await?;
16488 /// # Ok(()) }
16489 /// ```
16490 pub fn builder() -> super::builder::rollouts::ClientBuilder {
16491 crate::new_client_builder(super::builder::rollouts::client::Factory)
16492 }
16493
16494 /// Creates a new client from the provided stub.
16495 ///
16496 /// The most common case for calling this function is in tests mocking the
16497 /// client's behavior.
16498 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16499 where
16500 T: super::stub::Rollouts + 'static,
16501 {
16502 Self { inner: stub.into() }
16503 }
16504
16505 pub(crate) async fn new(
16506 config: gaxi::options::ClientConfig,
16507 ) -> crate::ClientBuilderResult<Self> {
16508 let inner = Self::build_inner(config).await?;
16509 Ok(Self { inner })
16510 }
16511
16512 async fn build_inner(
16513 conf: gaxi::options::ClientConfig,
16514 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Rollouts>> {
16515 if gaxi::options::tracing_enabled(&conf) {
16516 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16517 }
16518 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16519 }
16520
16521 async fn build_transport(
16522 conf: gaxi::options::ClientConfig,
16523 ) -> crate::ClientBuilderResult<impl super::stub::Rollouts> {
16524 super::transport::Rollouts::new(conf).await
16525 }
16526
16527 async fn build_with_tracing(
16528 conf: gaxi::options::ClientConfig,
16529 ) -> crate::ClientBuilderResult<impl super::stub::Rollouts> {
16530 Self::build_transport(conf)
16531 .await
16532 .map(super::tracing::Rollouts::new)
16533 }
16534
16535 /// Advances a Rollout to the next wave, or completes it if no waves remain.
16536 pub fn advance(&self) -> super::builder::rollouts::Advance {
16537 super::builder::rollouts::Advance::new(self.inner.clone())
16538 }
16539
16540 /// Cancels a Rollout.
16541 pub fn cancel(&self) -> super::builder::rollouts::Cancel {
16542 super::builder::rollouts::Cancel::new(self.inner.clone())
16543 }
16544
16545 /// Deletes a Rollout.
16546 pub fn delete(&self) -> super::builder::rollouts::Delete {
16547 super::builder::rollouts::Delete::new(self.inner.clone())
16548 }
16549
16550 /// Gets details of a single project-scoped Rollout.
16551 pub fn get(&self) -> super::builder::rollouts::Get {
16552 super::builder::rollouts::Get::new(self.inner.clone())
16553 }
16554
16555 /// Lists Rollouts in a given project and location.
16556 pub fn list(&self) -> super::builder::rollouts::List {
16557 super::builder::rollouts::List::new(self.inner.clone())
16558 }
16559
16560 /// Pauses a Rollout.
16561 pub fn pause(&self) -> super::builder::rollouts::Pause {
16562 super::builder::rollouts::Pause::new(self.inner.clone())
16563 }
16564
16565 /// Resumes a Rollout.
16566 pub fn resume(&self) -> super::builder::rollouts::Resume {
16567 super::builder::rollouts::Resume::new(self.inner.clone())
16568 }
16569
16570 /// Retrieves the specified Operations resource.
16571 pub fn get_operation(&self) -> super::builder::rollouts::GetOperation {
16572 super::builder::rollouts::GetOperation::new(self.inner.clone())
16573 }
16574}
16575
16576/// Implements a client for the Google Compute Engine API.
16577///
16578/// # Example
16579/// ```
16580/// # use google_cloud_compute_v1::client::Routers;
16581/// async fn sample(
16582/// ) -> anyhow::Result<()> {
16583/// let client = Routers::builder().build().await?;
16584/// // use `client` to make requests to the Google Compute Engine API.
16585/// Ok(())
16586/// }
16587/// ```
16588///
16589/// # Service Description
16590///
16591/// Service for the `routers` resource.
16592///
16593/// # Configuration
16594///
16595/// To configure `Routers` use the `with_*` methods in the type returned
16596/// by [builder()][Routers::builder]. The default configuration should
16597/// work for most applications. Common configuration changes include
16598///
16599/// * [with_endpoint()]: by default this client uses the global default endpoint
16600/// (`https://compute.googleapis.com`). Applications using regional
16601/// endpoints or running in restricted networks (e.g. a network configured
16602/// with [Private Google Access with VPC Service Controls]) may want to
16603/// override this default.
16604/// * [with_credentials()]: by default this client uses
16605/// [Application Default Credentials]. Applications using custom
16606/// authentication may need to override this default.
16607///
16608/// [with_endpoint()]: super::builder::routers::ClientBuilder::with_endpoint
16609/// [with_credentials()]: super::builder::routers::ClientBuilder::with_credentials
16610/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16611/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16612///
16613/// # Pooling and Cloning
16614///
16615/// `Routers` holds a connection pool internally, it is advised to
16616/// create one and reuse it. You do not need to wrap `Routers` in
16617/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16618/// already uses an `Arc` internally.
16619#[cfg(feature = "routers")]
16620#[cfg_attr(docsrs, doc(cfg(feature = "routers")))]
16621#[derive(Clone, Debug)]
16622pub struct Routers {
16623 inner: std::sync::Arc<dyn super::stub::dynamic::Routers>,
16624}
16625
16626#[cfg(feature = "routers")]
16627impl Routers {
16628 /// Returns a builder for [Routers].
16629 ///
16630 /// ```
16631 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16632 /// # use google_cloud_compute_v1::client::Routers;
16633 /// let client = Routers::builder().build().await?;
16634 /// # Ok(()) }
16635 /// ```
16636 pub fn builder() -> super::builder::routers::ClientBuilder {
16637 crate::new_client_builder(super::builder::routers::client::Factory)
16638 }
16639
16640 /// Creates a new client from the provided stub.
16641 ///
16642 /// The most common case for calling this function is in tests mocking the
16643 /// client's behavior.
16644 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16645 where
16646 T: super::stub::Routers + 'static,
16647 {
16648 Self { inner: stub.into() }
16649 }
16650
16651 pub(crate) async fn new(
16652 config: gaxi::options::ClientConfig,
16653 ) -> crate::ClientBuilderResult<Self> {
16654 let inner = Self::build_inner(config).await?;
16655 Ok(Self { inner })
16656 }
16657
16658 async fn build_inner(
16659 conf: gaxi::options::ClientConfig,
16660 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Routers>> {
16661 if gaxi::options::tracing_enabled(&conf) {
16662 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16663 }
16664 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16665 }
16666
16667 async fn build_transport(
16668 conf: gaxi::options::ClientConfig,
16669 ) -> crate::ClientBuilderResult<impl super::stub::Routers> {
16670 super::transport::Routers::new(conf).await
16671 }
16672
16673 async fn build_with_tracing(
16674 conf: gaxi::options::ClientConfig,
16675 ) -> crate::ClientBuilderResult<impl super::stub::Routers> {
16676 Self::build_transport(conf)
16677 .await
16678 .map(super::tracing::Routers::new)
16679 }
16680
16681 /// Retrieves an aggregated list of routers.
16682 ///
16683 /// To prevent failure, Google recommends that you set the
16684 /// `returnPartialSuccess` parameter to `true`.
16685 pub fn aggregated_list(&self) -> super::builder::routers::AggregatedList {
16686 super::builder::routers::AggregatedList::new(self.inner.clone())
16687 }
16688
16689 /// Deletes the specified Router resource.
16690 pub fn delete(&self) -> super::builder::routers::Delete {
16691 super::builder::routers::Delete::new(self.inner.clone())
16692 }
16693
16694 /// Deletes Route Policy
16695 pub fn delete_route_policy(&self) -> super::builder::routers::DeleteRoutePolicy {
16696 super::builder::routers::DeleteRoutePolicy::new(self.inner.clone())
16697 }
16698
16699 /// Returns the specified Router resource.
16700 pub fn get(&self) -> super::builder::routers::Get {
16701 super::builder::routers::Get::new(self.inner.clone())
16702 }
16703
16704 /// Retrieves runtime NAT IP information.
16705 pub fn get_nat_ip_info(&self) -> super::builder::routers::GetNatIpInfo {
16706 super::builder::routers::GetNatIpInfo::new(self.inner.clone())
16707 }
16708
16709 /// Retrieves runtime Nat mapping information of VM endpoints.
16710 pub fn get_nat_mapping_info(&self) -> super::builder::routers::GetNatMappingInfo {
16711 super::builder::routers::GetNatMappingInfo::new(self.inner.clone())
16712 }
16713
16714 /// Returns specified Route Policy
16715 pub fn get_route_policy(&self) -> super::builder::routers::GetRoutePolicy {
16716 super::builder::routers::GetRoutePolicy::new(self.inner.clone())
16717 }
16718
16719 /// Retrieves runtime information of the specified router.
16720 pub fn get_router_status(&self) -> super::builder::routers::GetRouterStatus {
16721 super::builder::routers::GetRouterStatus::new(self.inner.clone())
16722 }
16723
16724 /// Creates a Router resource in the specified project and region using
16725 /// the data included in the request.
16726 pub fn insert(&self) -> super::builder::routers::Insert {
16727 super::builder::routers::Insert::new(self.inner.clone())
16728 }
16729
16730 /// Retrieves a list of Router resources available to the specified project.
16731 pub fn list(&self) -> super::builder::routers::List {
16732 super::builder::routers::List::new(self.inner.clone())
16733 }
16734
16735 /// Retrieves a list of router bgp routes available to the specified project.
16736 pub fn list_bgp_routes(&self) -> super::builder::routers::ListBgpRoutes {
16737 super::builder::routers::ListBgpRoutes::new(self.inner.clone())
16738 }
16739
16740 /// Retrieves a list of router route policy subresources available to the
16741 /// specified project.
16742 pub fn list_route_policies(&self) -> super::builder::routers::ListRoutePolicies {
16743 super::builder::routers::ListRoutePolicies::new(self.inner.clone())
16744 }
16745
16746 /// Patches the specified Router resource with the data included in the
16747 /// request. This method supportsPATCH
16748 /// semantics and usesJSON merge
16749 /// patch format and processing rules.
16750 pub fn patch(&self) -> super::builder::routers::Patch {
16751 super::builder::routers::Patch::new(self.inner.clone())
16752 }
16753
16754 /// Patches Route Policy
16755 pub fn patch_route_policy(&self) -> super::builder::routers::PatchRoutePolicy {
16756 super::builder::routers::PatchRoutePolicy::new(self.inner.clone())
16757 }
16758
16759 /// Preview fields auto-generated during router create andupdate operations.
16760 /// Calling this method does NOT create or update the router.
16761 pub fn preview(&self) -> super::builder::routers::Preview {
16762 super::builder::routers::Preview::new(self.inner.clone())
16763 }
16764
16765 /// Updates the specified Router resource with the data included in the
16766 /// request. This method conforms toPUT semantics, which requests that the state of the
16767 /// target resource be created or replaced with the state defined by the
16768 /// representation enclosed in the request message payload.
16769 pub fn update(&self) -> super::builder::routers::Update {
16770 super::builder::routers::Update::new(self.inner.clone())
16771 }
16772
16773 /// Updates or creates new Route Policy
16774 pub fn update_route_policy(&self) -> super::builder::routers::UpdateRoutePolicy {
16775 super::builder::routers::UpdateRoutePolicy::new(self.inner.clone())
16776 }
16777
16778 /// Retrieves the specified region-specific Operations resource.
16779 pub fn get_operation(&self) -> super::builder::routers::GetOperation {
16780 super::builder::routers::GetOperation::new(self.inner.clone())
16781 }
16782}
16783
16784/// Implements a client for the Google Compute Engine API.
16785///
16786/// # Example
16787/// ```
16788/// # use google_cloud_compute_v1::client::Routes;
16789/// async fn sample(
16790/// ) -> anyhow::Result<()> {
16791/// let client = Routes::builder().build().await?;
16792/// // use `client` to make requests to the Google Compute Engine API.
16793/// Ok(())
16794/// }
16795/// ```
16796///
16797/// # Service Description
16798///
16799/// Service for the `routes` resource.
16800///
16801/// # Configuration
16802///
16803/// To configure `Routes` use the `with_*` methods in the type returned
16804/// by [builder()][Routes::builder]. The default configuration should
16805/// work for most applications. Common configuration changes include
16806///
16807/// * [with_endpoint()]: by default this client uses the global default endpoint
16808/// (`https://compute.googleapis.com`). Applications using regional
16809/// endpoints or running in restricted networks (e.g. a network configured
16810/// with [Private Google Access with VPC Service Controls]) may want to
16811/// override this default.
16812/// * [with_credentials()]: by default this client uses
16813/// [Application Default Credentials]. Applications using custom
16814/// authentication may need to override this default.
16815///
16816/// [with_endpoint()]: super::builder::routes::ClientBuilder::with_endpoint
16817/// [with_credentials()]: super::builder::routes::ClientBuilder::with_credentials
16818/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16819/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16820///
16821/// # Pooling and Cloning
16822///
16823/// `Routes` holds a connection pool internally, it is advised to
16824/// create one and reuse it. You do not need to wrap `Routes` in
16825/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16826/// already uses an `Arc` internally.
16827#[cfg(feature = "routes")]
16828#[cfg_attr(docsrs, doc(cfg(feature = "routes")))]
16829#[derive(Clone, Debug)]
16830pub struct Routes {
16831 inner: std::sync::Arc<dyn super::stub::dynamic::Routes>,
16832}
16833
16834#[cfg(feature = "routes")]
16835impl Routes {
16836 /// Returns a builder for [Routes].
16837 ///
16838 /// ```
16839 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16840 /// # use google_cloud_compute_v1::client::Routes;
16841 /// let client = Routes::builder().build().await?;
16842 /// # Ok(()) }
16843 /// ```
16844 pub fn builder() -> super::builder::routes::ClientBuilder {
16845 crate::new_client_builder(super::builder::routes::client::Factory)
16846 }
16847
16848 /// Creates a new client from the provided stub.
16849 ///
16850 /// The most common case for calling this function is in tests mocking the
16851 /// client's behavior.
16852 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16853 where
16854 T: super::stub::Routes + 'static,
16855 {
16856 Self { inner: stub.into() }
16857 }
16858
16859 pub(crate) async fn new(
16860 config: gaxi::options::ClientConfig,
16861 ) -> crate::ClientBuilderResult<Self> {
16862 let inner = Self::build_inner(config).await?;
16863 Ok(Self { inner })
16864 }
16865
16866 async fn build_inner(
16867 conf: gaxi::options::ClientConfig,
16868 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Routes>> {
16869 if gaxi::options::tracing_enabled(&conf) {
16870 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16871 }
16872 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16873 }
16874
16875 async fn build_transport(
16876 conf: gaxi::options::ClientConfig,
16877 ) -> crate::ClientBuilderResult<impl super::stub::Routes> {
16878 super::transport::Routes::new(conf).await
16879 }
16880
16881 async fn build_with_tracing(
16882 conf: gaxi::options::ClientConfig,
16883 ) -> crate::ClientBuilderResult<impl super::stub::Routes> {
16884 Self::build_transport(conf)
16885 .await
16886 .map(super::tracing::Routes::new)
16887 }
16888
16889 /// Deletes the specified Route resource.
16890 pub fn delete(&self) -> super::builder::routes::Delete {
16891 super::builder::routes::Delete::new(self.inner.clone())
16892 }
16893
16894 /// Returns the specified Route resource.
16895 pub fn get(&self) -> super::builder::routes::Get {
16896 super::builder::routes::Get::new(self.inner.clone())
16897 }
16898
16899 /// Creates a Route resource in the specified project using the data included
16900 /// in the request.
16901 pub fn insert(&self) -> super::builder::routes::Insert {
16902 super::builder::routes::Insert::new(self.inner.clone())
16903 }
16904
16905 /// Retrieves the list of Route resources available to the specified project.
16906 pub fn list(&self) -> super::builder::routes::List {
16907 super::builder::routes::List::new(self.inner.clone())
16908 }
16909
16910 /// Returns permissions that a caller has on the specified resource.
16911 pub fn test_iam_permissions(&self) -> super::builder::routes::TestIamPermissions {
16912 super::builder::routes::TestIamPermissions::new(self.inner.clone())
16913 }
16914
16915 /// Retrieves the specified Operations resource.
16916 pub fn get_operation(&self) -> super::builder::routes::GetOperation {
16917 super::builder::routes::GetOperation::new(self.inner.clone())
16918 }
16919}
16920
16921/// Implements a client for the Google Compute Engine API.
16922///
16923/// # Example
16924/// ```
16925/// # use google_cloud_compute_v1::client::SecurityPolicies;
16926/// async fn sample(
16927/// ) -> anyhow::Result<()> {
16928/// let client = SecurityPolicies::builder().build().await?;
16929/// // use `client` to make requests to the Google Compute Engine API.
16930/// Ok(())
16931/// }
16932/// ```
16933///
16934/// # Service Description
16935///
16936/// Service for the `securityPolicies` resource.
16937///
16938/// # Configuration
16939///
16940/// To configure `SecurityPolicies` use the `with_*` methods in the type returned
16941/// by [builder()][SecurityPolicies::builder]. The default configuration should
16942/// work for most applications. Common configuration changes include
16943///
16944/// * [with_endpoint()]: by default this client uses the global default endpoint
16945/// (`https://compute.googleapis.com`). Applications using regional
16946/// endpoints or running in restricted networks (e.g. a network configured
16947/// with [Private Google Access with VPC Service Controls]) may want to
16948/// override this default.
16949/// * [with_credentials()]: by default this client uses
16950/// [Application Default Credentials]. Applications using custom
16951/// authentication may need to override this default.
16952///
16953/// [with_endpoint()]: super::builder::security_policies::ClientBuilder::with_endpoint
16954/// [with_credentials()]: super::builder::security_policies::ClientBuilder::with_credentials
16955/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16956/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16957///
16958/// # Pooling and Cloning
16959///
16960/// `SecurityPolicies` holds a connection pool internally, it is advised to
16961/// create one and reuse it. You do not need to wrap `SecurityPolicies` in
16962/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16963/// already uses an `Arc` internally.
16964#[cfg(feature = "security-policies")]
16965#[cfg_attr(docsrs, doc(cfg(feature = "security-policies")))]
16966#[derive(Clone, Debug)]
16967pub struct SecurityPolicies {
16968 inner: std::sync::Arc<dyn super::stub::dynamic::SecurityPolicies>,
16969}
16970
16971#[cfg(feature = "security-policies")]
16972impl SecurityPolicies {
16973 /// Returns a builder for [SecurityPolicies].
16974 ///
16975 /// ```
16976 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16977 /// # use google_cloud_compute_v1::client::SecurityPolicies;
16978 /// let client = SecurityPolicies::builder().build().await?;
16979 /// # Ok(()) }
16980 /// ```
16981 pub fn builder() -> super::builder::security_policies::ClientBuilder {
16982 crate::new_client_builder(super::builder::security_policies::client::Factory)
16983 }
16984
16985 /// Creates a new client from the provided stub.
16986 ///
16987 /// The most common case for calling this function is in tests mocking the
16988 /// client's behavior.
16989 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16990 where
16991 T: super::stub::SecurityPolicies + 'static,
16992 {
16993 Self { inner: stub.into() }
16994 }
16995
16996 pub(crate) async fn new(
16997 config: gaxi::options::ClientConfig,
16998 ) -> crate::ClientBuilderResult<Self> {
16999 let inner = Self::build_inner(config).await?;
17000 Ok(Self { inner })
17001 }
17002
17003 async fn build_inner(
17004 conf: gaxi::options::ClientConfig,
17005 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SecurityPolicies>>
17006 {
17007 if gaxi::options::tracing_enabled(&conf) {
17008 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17009 }
17010 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17011 }
17012
17013 async fn build_transport(
17014 conf: gaxi::options::ClientConfig,
17015 ) -> crate::ClientBuilderResult<impl super::stub::SecurityPolicies> {
17016 super::transport::SecurityPolicies::new(conf).await
17017 }
17018
17019 async fn build_with_tracing(
17020 conf: gaxi::options::ClientConfig,
17021 ) -> crate::ClientBuilderResult<impl super::stub::SecurityPolicies> {
17022 Self::build_transport(conf)
17023 .await
17024 .map(super::tracing::SecurityPolicies::new)
17025 }
17026
17027 /// Inserts a rule into a security policy.
17028 pub fn add_rule(&self) -> super::builder::security_policies::AddRule {
17029 super::builder::security_policies::AddRule::new(self.inner.clone())
17030 }
17031
17032 /// Retrieves the list of all SecurityPolicy resources, regional and global,
17033 /// available to the specified project.
17034 ///
17035 /// To prevent failure, Google recommends that you set the
17036 /// `returnPartialSuccess` parameter to `true`.
17037 pub fn aggregated_list(&self) -> super::builder::security_policies::AggregatedList {
17038 super::builder::security_policies::AggregatedList::new(self.inner.clone())
17039 }
17040
17041 /// Deletes the specified policy.
17042 pub fn delete(&self) -> super::builder::security_policies::Delete {
17043 super::builder::security_policies::Delete::new(self.inner.clone())
17044 }
17045
17046 /// List all of the ordered rules present in a single specified policy.
17047 pub fn get(&self) -> super::builder::security_policies::Get {
17048 super::builder::security_policies::Get::new(self.inner.clone())
17049 }
17050
17051 /// Gets a rule at the specified priority.
17052 pub fn get_rule(&self) -> super::builder::security_policies::GetRule {
17053 super::builder::security_policies::GetRule::new(self.inner.clone())
17054 }
17055
17056 /// Creates a new policy in the specified project using the data included in
17057 /// the request.
17058 pub fn insert(&self) -> super::builder::security_policies::Insert {
17059 super::builder::security_policies::Insert::new(self.inner.clone())
17060 }
17061
17062 /// List all the policies that have been configured for the specified project.
17063 pub fn list(&self) -> super::builder::security_policies::List {
17064 super::builder::security_policies::List::new(self.inner.clone())
17065 }
17066
17067 /// Gets the current list of preconfigured Web Application Firewall (WAF)
17068 /// expressions.
17069 pub fn list_preconfigured_expression_sets(
17070 &self,
17071 ) -> super::builder::security_policies::ListPreconfiguredExpressionSets {
17072 super::builder::security_policies::ListPreconfiguredExpressionSets::new(self.inner.clone())
17073 }
17074
17075 /// Patches the specified policy with the data included in the request. To
17076 /// clear fields in the policy, leave the fields empty and specify them in the
17077 /// updateMask. This cannot be used to be update the rules in the policy.
17078 /// Please use the per rule methods like addRule, patchRule, and removeRule
17079 /// instead.
17080 pub fn patch(&self) -> super::builder::security_policies::Patch {
17081 super::builder::security_policies::Patch::new(self.inner.clone())
17082 }
17083
17084 /// Patches a rule at the specified priority. To clear fields in the rule,
17085 /// leave the fields empty and specify them in the updateMask.
17086 pub fn patch_rule(&self) -> super::builder::security_policies::PatchRule {
17087 super::builder::security_policies::PatchRule::new(self.inner.clone())
17088 }
17089
17090 /// Deletes a rule at the specified priority.
17091 pub fn remove_rule(&self) -> super::builder::security_policies::RemoveRule {
17092 super::builder::security_policies::RemoveRule::new(self.inner.clone())
17093 }
17094
17095 /// Sets the labels on a security policy. To learn more about labels,
17096 /// read the Labeling Resources
17097 /// documentation.
17098 pub fn set_labels(&self) -> super::builder::security_policies::SetLabels {
17099 super::builder::security_policies::SetLabels::new(self.inner.clone())
17100 }
17101
17102 /// Retrieves the specified Operations resource.
17103 pub fn get_operation(&self) -> super::builder::security_policies::GetOperation {
17104 super::builder::security_policies::GetOperation::new(self.inner.clone())
17105 }
17106}
17107
17108/// Implements a client for the Google Compute Engine API.
17109///
17110/// # Example
17111/// ```
17112/// # use google_cloud_compute_v1::client::ServiceAttachments;
17113/// async fn sample(
17114/// ) -> anyhow::Result<()> {
17115/// let client = ServiceAttachments::builder().build().await?;
17116/// // use `client` to make requests to the Google Compute Engine API.
17117/// Ok(())
17118/// }
17119/// ```
17120///
17121/// # Service Description
17122///
17123/// Service for the `serviceAttachments` resource.
17124///
17125/// # Configuration
17126///
17127/// To configure `ServiceAttachments` use the `with_*` methods in the type returned
17128/// by [builder()][ServiceAttachments::builder]. The default configuration should
17129/// work for most applications. Common configuration changes include
17130///
17131/// * [with_endpoint()]: by default this client uses the global default endpoint
17132/// (`https://compute.googleapis.com`). Applications using regional
17133/// endpoints or running in restricted networks (e.g. a network configured
17134/// with [Private Google Access with VPC Service Controls]) may want to
17135/// override this default.
17136/// * [with_credentials()]: by default this client uses
17137/// [Application Default Credentials]. Applications using custom
17138/// authentication may need to override this default.
17139///
17140/// [with_endpoint()]: super::builder::service_attachments::ClientBuilder::with_endpoint
17141/// [with_credentials()]: super::builder::service_attachments::ClientBuilder::with_credentials
17142/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17143/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17144///
17145/// # Pooling and Cloning
17146///
17147/// `ServiceAttachments` holds a connection pool internally, it is advised to
17148/// create one and reuse it. You do not need to wrap `ServiceAttachments` in
17149/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17150/// already uses an `Arc` internally.
17151#[cfg(feature = "service-attachments")]
17152#[cfg_attr(docsrs, doc(cfg(feature = "service-attachments")))]
17153#[derive(Clone, Debug)]
17154pub struct ServiceAttachments {
17155 inner: std::sync::Arc<dyn super::stub::dynamic::ServiceAttachments>,
17156}
17157
17158#[cfg(feature = "service-attachments")]
17159impl ServiceAttachments {
17160 /// Returns a builder for [ServiceAttachments].
17161 ///
17162 /// ```
17163 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17164 /// # use google_cloud_compute_v1::client::ServiceAttachments;
17165 /// let client = ServiceAttachments::builder().build().await?;
17166 /// # Ok(()) }
17167 /// ```
17168 pub fn builder() -> super::builder::service_attachments::ClientBuilder {
17169 crate::new_client_builder(super::builder::service_attachments::client::Factory)
17170 }
17171
17172 /// Creates a new client from the provided stub.
17173 ///
17174 /// The most common case for calling this function is in tests mocking the
17175 /// client's behavior.
17176 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17177 where
17178 T: super::stub::ServiceAttachments + 'static,
17179 {
17180 Self { inner: stub.into() }
17181 }
17182
17183 pub(crate) async fn new(
17184 config: gaxi::options::ClientConfig,
17185 ) -> crate::ClientBuilderResult<Self> {
17186 let inner = Self::build_inner(config).await?;
17187 Ok(Self { inner })
17188 }
17189
17190 async fn build_inner(
17191 conf: gaxi::options::ClientConfig,
17192 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ServiceAttachments>>
17193 {
17194 if gaxi::options::tracing_enabled(&conf) {
17195 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17196 }
17197 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17198 }
17199
17200 async fn build_transport(
17201 conf: gaxi::options::ClientConfig,
17202 ) -> crate::ClientBuilderResult<impl super::stub::ServiceAttachments> {
17203 super::transport::ServiceAttachments::new(conf).await
17204 }
17205
17206 async fn build_with_tracing(
17207 conf: gaxi::options::ClientConfig,
17208 ) -> crate::ClientBuilderResult<impl super::stub::ServiceAttachments> {
17209 Self::build_transport(conf)
17210 .await
17211 .map(super::tracing::ServiceAttachments::new)
17212 }
17213
17214 /// Retrieves the list of all ServiceAttachment resources,
17215 /// regional and global, available to the specified project.
17216 ///
17217 /// To prevent failure, Google recommends that you set the
17218 /// `returnPartialSuccess` parameter to `true`.
17219 pub fn aggregated_list(&self) -> super::builder::service_attachments::AggregatedList {
17220 super::builder::service_attachments::AggregatedList::new(self.inner.clone())
17221 }
17222
17223 /// Deletes the specified ServiceAttachment in the given scope
17224 pub fn delete(&self) -> super::builder::service_attachments::Delete {
17225 super::builder::service_attachments::Delete::new(self.inner.clone())
17226 }
17227
17228 /// Returns the specified ServiceAttachment resource in the given scope.
17229 pub fn get(&self) -> super::builder::service_attachments::Get {
17230 super::builder::service_attachments::Get::new(self.inner.clone())
17231 }
17232
17233 /// Gets the access control policy for a resource. May be empty if no such
17234 /// policy or resource exists.
17235 pub fn get_iam_policy(&self) -> super::builder::service_attachments::GetIamPolicy {
17236 super::builder::service_attachments::GetIamPolicy::new(self.inner.clone())
17237 }
17238
17239 /// Creates a ServiceAttachment in the specified project in the given scope
17240 /// using the parameters that are included in the request.
17241 pub fn insert(&self) -> super::builder::service_attachments::Insert {
17242 super::builder::service_attachments::Insert::new(self.inner.clone())
17243 }
17244
17245 /// Lists the ServiceAttachments for a project in the given scope.
17246 pub fn list(&self) -> super::builder::service_attachments::List {
17247 super::builder::service_attachments::List::new(self.inner.clone())
17248 }
17249
17250 /// Patches the specified ServiceAttachment resource with the data included in
17251 /// the request. This method supports PATCH
17252 /// semantics and usesJSON merge
17253 /// patch format and processing rules.
17254 pub fn patch(&self) -> super::builder::service_attachments::Patch {
17255 super::builder::service_attachments::Patch::new(self.inner.clone())
17256 }
17257
17258 /// Sets the access control policy on the specified resource.
17259 /// Replaces any existing policy.
17260 pub fn set_iam_policy(&self) -> super::builder::service_attachments::SetIamPolicy {
17261 super::builder::service_attachments::SetIamPolicy::new(self.inner.clone())
17262 }
17263
17264 /// Returns permissions that a caller has on the specified resource.
17265 pub fn test_iam_permissions(&self) -> super::builder::service_attachments::TestIamPermissions {
17266 super::builder::service_attachments::TestIamPermissions::new(self.inner.clone())
17267 }
17268
17269 /// Retrieves the specified region-specific Operations resource.
17270 pub fn get_operation(&self) -> super::builder::service_attachments::GetOperation {
17271 super::builder::service_attachments::GetOperation::new(self.inner.clone())
17272 }
17273}
17274
17275/// Implements a client for the Google Compute Engine API.
17276///
17277/// # Example
17278/// ```
17279/// # use google_cloud_compute_v1::client::SnapshotSettings;
17280/// async fn sample(
17281/// ) -> anyhow::Result<()> {
17282/// let client = SnapshotSettings::builder().build().await?;
17283/// // use `client` to make requests to the Google Compute Engine API.
17284/// Ok(())
17285/// }
17286/// ```
17287///
17288/// # Service Description
17289///
17290/// Service for the `snapshotSettings` resource.
17291///
17292/// # Configuration
17293///
17294/// To configure `SnapshotSettings` use the `with_*` methods in the type returned
17295/// by [builder()][SnapshotSettings::builder]. The default configuration should
17296/// work for most applications. Common configuration changes include
17297///
17298/// * [with_endpoint()]: by default this client uses the global default endpoint
17299/// (`https://compute.googleapis.com`). Applications using regional
17300/// endpoints or running in restricted networks (e.g. a network configured
17301/// with [Private Google Access with VPC Service Controls]) may want to
17302/// override this default.
17303/// * [with_credentials()]: by default this client uses
17304/// [Application Default Credentials]. Applications using custom
17305/// authentication may need to override this default.
17306///
17307/// [with_endpoint()]: super::builder::snapshot_settings::ClientBuilder::with_endpoint
17308/// [with_credentials()]: super::builder::snapshot_settings::ClientBuilder::with_credentials
17309/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17310/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17311///
17312/// # Pooling and Cloning
17313///
17314/// `SnapshotSettings` holds a connection pool internally, it is advised to
17315/// create one and reuse it. You do not need to wrap `SnapshotSettings` in
17316/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17317/// already uses an `Arc` internally.
17318#[cfg(feature = "snapshot-settings")]
17319#[cfg_attr(docsrs, doc(cfg(feature = "snapshot-settings")))]
17320#[derive(Clone, Debug)]
17321pub struct SnapshotSettings {
17322 inner: std::sync::Arc<dyn super::stub::dynamic::SnapshotSettings>,
17323}
17324
17325#[cfg(feature = "snapshot-settings")]
17326impl SnapshotSettings {
17327 /// Returns a builder for [SnapshotSettings].
17328 ///
17329 /// ```
17330 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17331 /// # use google_cloud_compute_v1::client::SnapshotSettings;
17332 /// let client = SnapshotSettings::builder().build().await?;
17333 /// # Ok(()) }
17334 /// ```
17335 pub fn builder() -> super::builder::snapshot_settings::ClientBuilder {
17336 crate::new_client_builder(super::builder::snapshot_settings::client::Factory)
17337 }
17338
17339 /// Creates a new client from the provided stub.
17340 ///
17341 /// The most common case for calling this function is in tests mocking the
17342 /// client's behavior.
17343 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17344 where
17345 T: super::stub::SnapshotSettings + 'static,
17346 {
17347 Self { inner: stub.into() }
17348 }
17349
17350 pub(crate) async fn new(
17351 config: gaxi::options::ClientConfig,
17352 ) -> crate::ClientBuilderResult<Self> {
17353 let inner = Self::build_inner(config).await?;
17354 Ok(Self { inner })
17355 }
17356
17357 async fn build_inner(
17358 conf: gaxi::options::ClientConfig,
17359 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SnapshotSettings>>
17360 {
17361 if gaxi::options::tracing_enabled(&conf) {
17362 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17363 }
17364 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17365 }
17366
17367 async fn build_transport(
17368 conf: gaxi::options::ClientConfig,
17369 ) -> crate::ClientBuilderResult<impl super::stub::SnapshotSettings> {
17370 super::transport::SnapshotSettings::new(conf).await
17371 }
17372
17373 async fn build_with_tracing(
17374 conf: gaxi::options::ClientConfig,
17375 ) -> crate::ClientBuilderResult<impl super::stub::SnapshotSettings> {
17376 Self::build_transport(conf)
17377 .await
17378 .map(super::tracing::SnapshotSettings::new)
17379 }
17380
17381 /// Get snapshot settings.
17382 pub fn get(&self) -> super::builder::snapshot_settings::Get {
17383 super::builder::snapshot_settings::Get::new(self.inner.clone())
17384 }
17385
17386 /// Patch snapshot settings.
17387 pub fn patch(&self) -> super::builder::snapshot_settings::Patch {
17388 super::builder::snapshot_settings::Patch::new(self.inner.clone())
17389 }
17390
17391 /// Retrieves the specified Operations resource.
17392 pub fn get_operation(&self) -> super::builder::snapshot_settings::GetOperation {
17393 super::builder::snapshot_settings::GetOperation::new(self.inner.clone())
17394 }
17395}
17396
17397/// Implements a client for the Google Compute Engine API.
17398///
17399/// # Example
17400/// ```
17401/// # use google_cloud_compute_v1::client::Snapshots;
17402/// async fn sample(
17403/// ) -> anyhow::Result<()> {
17404/// let client = Snapshots::builder().build().await?;
17405/// // use `client` to make requests to the Google Compute Engine API.
17406/// Ok(())
17407/// }
17408/// ```
17409///
17410/// # Service Description
17411///
17412/// Service for the `snapshots` resource.
17413///
17414/// # Configuration
17415///
17416/// To configure `Snapshots` use the `with_*` methods in the type returned
17417/// by [builder()][Snapshots::builder]. The default configuration should
17418/// work for most applications. Common configuration changes include
17419///
17420/// * [with_endpoint()]: by default this client uses the global default endpoint
17421/// (`https://compute.googleapis.com`). Applications using regional
17422/// endpoints or running in restricted networks (e.g. a network configured
17423/// with [Private Google Access with VPC Service Controls]) may want to
17424/// override this default.
17425/// * [with_credentials()]: by default this client uses
17426/// [Application Default Credentials]. Applications using custom
17427/// authentication may need to override this default.
17428///
17429/// [with_endpoint()]: super::builder::snapshots::ClientBuilder::with_endpoint
17430/// [with_credentials()]: super::builder::snapshots::ClientBuilder::with_credentials
17431/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17432/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17433///
17434/// # Pooling and Cloning
17435///
17436/// `Snapshots` holds a connection pool internally, it is advised to
17437/// create one and reuse it. You do not need to wrap `Snapshots` in
17438/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17439/// already uses an `Arc` internally.
17440#[cfg(feature = "snapshots")]
17441#[cfg_attr(docsrs, doc(cfg(feature = "snapshots")))]
17442#[derive(Clone, Debug)]
17443pub struct Snapshots {
17444 inner: std::sync::Arc<dyn super::stub::dynamic::Snapshots>,
17445}
17446
17447#[cfg(feature = "snapshots")]
17448impl Snapshots {
17449 /// Returns a builder for [Snapshots].
17450 ///
17451 /// ```
17452 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17453 /// # use google_cloud_compute_v1::client::Snapshots;
17454 /// let client = Snapshots::builder().build().await?;
17455 /// # Ok(()) }
17456 /// ```
17457 pub fn builder() -> super::builder::snapshots::ClientBuilder {
17458 crate::new_client_builder(super::builder::snapshots::client::Factory)
17459 }
17460
17461 /// Creates a new client from the provided stub.
17462 ///
17463 /// The most common case for calling this function is in tests mocking the
17464 /// client's behavior.
17465 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17466 where
17467 T: super::stub::Snapshots + 'static,
17468 {
17469 Self { inner: stub.into() }
17470 }
17471
17472 pub(crate) async fn new(
17473 config: gaxi::options::ClientConfig,
17474 ) -> crate::ClientBuilderResult<Self> {
17475 let inner = Self::build_inner(config).await?;
17476 Ok(Self { inner })
17477 }
17478
17479 async fn build_inner(
17480 conf: gaxi::options::ClientConfig,
17481 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Snapshots>> {
17482 if gaxi::options::tracing_enabled(&conf) {
17483 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17484 }
17485 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17486 }
17487
17488 async fn build_transport(
17489 conf: gaxi::options::ClientConfig,
17490 ) -> crate::ClientBuilderResult<impl super::stub::Snapshots> {
17491 super::transport::Snapshots::new(conf).await
17492 }
17493
17494 async fn build_with_tracing(
17495 conf: gaxi::options::ClientConfig,
17496 ) -> crate::ClientBuilderResult<impl super::stub::Snapshots> {
17497 Self::build_transport(conf)
17498 .await
17499 .map(super::tracing::Snapshots::new)
17500 }
17501
17502 /// Deletes the specified Snapshot resource. Keep in mind that deleting
17503 /// a single snapshot might not necessarily delete all the data on that
17504 /// snapshot. If any data on the snapshot that is marked for deletion is
17505 /// needed for subsequent snapshots, the data will be moved to the next
17506 /// corresponding snapshot.
17507 ///
17508 /// For more information, seeDeleting
17509 /// snapshots.
17510 pub fn delete(&self) -> super::builder::snapshots::Delete {
17511 super::builder::snapshots::Delete::new(self.inner.clone())
17512 }
17513
17514 /// Returns the specified Snapshot resource.
17515 pub fn get(&self) -> super::builder::snapshots::Get {
17516 super::builder::snapshots::Get::new(self.inner.clone())
17517 }
17518
17519 /// Gets the access control policy for a resource. May be empty if no such
17520 /// policy or resource exists.
17521 pub fn get_iam_policy(&self) -> super::builder::snapshots::GetIamPolicy {
17522 super::builder::snapshots::GetIamPolicy::new(self.inner.clone())
17523 }
17524
17525 /// Creates a snapshot in the specified project using the data included
17526 /// in the request. For regular snapshot creation, consider using this method
17527 /// instead of disks.createSnapshot,
17528 /// as this method supports more features, such as creating snapshots in a
17529 /// project different from the source disk project.
17530 pub fn insert(&self) -> super::builder::snapshots::Insert {
17531 super::builder::snapshots::Insert::new(self.inner.clone())
17532 }
17533
17534 /// Retrieves the list of Snapshot resources contained within
17535 /// the specified project.
17536 pub fn list(&self) -> super::builder::snapshots::List {
17537 super::builder::snapshots::List::new(self.inner.clone())
17538 }
17539
17540 /// Sets the access control policy on the specified resource.
17541 /// Replaces any existing policy.
17542 pub fn set_iam_policy(&self) -> super::builder::snapshots::SetIamPolicy {
17543 super::builder::snapshots::SetIamPolicy::new(self.inner.clone())
17544 }
17545
17546 /// Sets the labels on a snapshot. To learn more about labels, read theLabeling
17547 /// Resources documentation.
17548 pub fn set_labels(&self) -> super::builder::snapshots::SetLabels {
17549 super::builder::snapshots::SetLabels::new(self.inner.clone())
17550 }
17551
17552 /// Returns permissions that a caller has on the specified resource.
17553 pub fn test_iam_permissions(&self) -> super::builder::snapshots::TestIamPermissions {
17554 super::builder::snapshots::TestIamPermissions::new(self.inner.clone())
17555 }
17556
17557 /// Rotates the customer-managed
17558 /// encryption key to the latest version for the specified snapshot.
17559 pub fn update_kms_key(&self) -> super::builder::snapshots::UpdateKmsKey {
17560 super::builder::snapshots::UpdateKmsKey::new(self.inner.clone())
17561 }
17562
17563 /// Retrieves the specified Operations resource.
17564 pub fn get_operation(&self) -> super::builder::snapshots::GetOperation {
17565 super::builder::snapshots::GetOperation::new(self.inner.clone())
17566 }
17567}
17568
17569/// Implements a client for the Google Compute Engine API.
17570///
17571/// # Example
17572/// ```
17573/// # use google_cloud_compute_v1::client::SslCertificates;
17574/// async fn sample(
17575/// ) -> anyhow::Result<()> {
17576/// let client = SslCertificates::builder().build().await?;
17577/// // use `client` to make requests to the Google Compute Engine API.
17578/// Ok(())
17579/// }
17580/// ```
17581///
17582/// # Service Description
17583///
17584/// Service for the `sslCertificates` resource.
17585///
17586/// # Configuration
17587///
17588/// To configure `SslCertificates` use the `with_*` methods in the type returned
17589/// by [builder()][SslCertificates::builder]. The default configuration should
17590/// work for most applications. Common configuration changes include
17591///
17592/// * [with_endpoint()]: by default this client uses the global default endpoint
17593/// (`https://compute.googleapis.com`). Applications using regional
17594/// endpoints or running in restricted networks (e.g. a network configured
17595/// with [Private Google Access with VPC Service Controls]) may want to
17596/// override this default.
17597/// * [with_credentials()]: by default this client uses
17598/// [Application Default Credentials]. Applications using custom
17599/// authentication may need to override this default.
17600///
17601/// [with_endpoint()]: super::builder::ssl_certificates::ClientBuilder::with_endpoint
17602/// [with_credentials()]: super::builder::ssl_certificates::ClientBuilder::with_credentials
17603/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17604/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17605///
17606/// # Pooling and Cloning
17607///
17608/// `SslCertificates` holds a connection pool internally, it is advised to
17609/// create one and reuse it. You do not need to wrap `SslCertificates` in
17610/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17611/// already uses an `Arc` internally.
17612#[cfg(feature = "ssl-certificates")]
17613#[cfg_attr(docsrs, doc(cfg(feature = "ssl-certificates")))]
17614#[derive(Clone, Debug)]
17615pub struct SslCertificates {
17616 inner: std::sync::Arc<dyn super::stub::dynamic::SslCertificates>,
17617}
17618
17619#[cfg(feature = "ssl-certificates")]
17620impl SslCertificates {
17621 /// Returns a builder for [SslCertificates].
17622 ///
17623 /// ```
17624 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17625 /// # use google_cloud_compute_v1::client::SslCertificates;
17626 /// let client = SslCertificates::builder().build().await?;
17627 /// # Ok(()) }
17628 /// ```
17629 pub fn builder() -> super::builder::ssl_certificates::ClientBuilder {
17630 crate::new_client_builder(super::builder::ssl_certificates::client::Factory)
17631 }
17632
17633 /// Creates a new client from the provided stub.
17634 ///
17635 /// The most common case for calling this function is in tests mocking the
17636 /// client's behavior.
17637 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17638 where
17639 T: super::stub::SslCertificates + 'static,
17640 {
17641 Self { inner: stub.into() }
17642 }
17643
17644 pub(crate) async fn new(
17645 config: gaxi::options::ClientConfig,
17646 ) -> crate::ClientBuilderResult<Self> {
17647 let inner = Self::build_inner(config).await?;
17648 Ok(Self { inner })
17649 }
17650
17651 async fn build_inner(
17652 conf: gaxi::options::ClientConfig,
17653 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SslCertificates>> {
17654 if gaxi::options::tracing_enabled(&conf) {
17655 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17656 }
17657 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17658 }
17659
17660 async fn build_transport(
17661 conf: gaxi::options::ClientConfig,
17662 ) -> crate::ClientBuilderResult<impl super::stub::SslCertificates> {
17663 super::transport::SslCertificates::new(conf).await
17664 }
17665
17666 async fn build_with_tracing(
17667 conf: gaxi::options::ClientConfig,
17668 ) -> crate::ClientBuilderResult<impl super::stub::SslCertificates> {
17669 Self::build_transport(conf)
17670 .await
17671 .map(super::tracing::SslCertificates::new)
17672 }
17673
17674 /// Retrieves the list of all SslCertificate resources, regional and global,
17675 /// available to the specified project.
17676 ///
17677 /// To prevent failure, Google recommends that you set the
17678 /// `returnPartialSuccess` parameter to `true`.
17679 pub fn aggregated_list(&self) -> super::builder::ssl_certificates::AggregatedList {
17680 super::builder::ssl_certificates::AggregatedList::new(self.inner.clone())
17681 }
17682
17683 /// Deletes the specified SslCertificate resource.
17684 pub fn delete(&self) -> super::builder::ssl_certificates::Delete {
17685 super::builder::ssl_certificates::Delete::new(self.inner.clone())
17686 }
17687
17688 /// Returns the specified SslCertificate resource.
17689 pub fn get(&self) -> super::builder::ssl_certificates::Get {
17690 super::builder::ssl_certificates::Get::new(self.inner.clone())
17691 }
17692
17693 /// Creates a SslCertificate resource in the specified project using the data
17694 /// included in the request.
17695 pub fn insert(&self) -> super::builder::ssl_certificates::Insert {
17696 super::builder::ssl_certificates::Insert::new(self.inner.clone())
17697 }
17698
17699 /// Retrieves the list of SslCertificate resources available to the specified
17700 /// project.
17701 pub fn list(&self) -> super::builder::ssl_certificates::List {
17702 super::builder::ssl_certificates::List::new(self.inner.clone())
17703 }
17704
17705 /// Retrieves the specified Operations resource.
17706 pub fn get_operation(&self) -> super::builder::ssl_certificates::GetOperation {
17707 super::builder::ssl_certificates::GetOperation::new(self.inner.clone())
17708 }
17709}
17710
17711/// Implements a client for the Google Compute Engine API.
17712///
17713/// # Example
17714/// ```
17715/// # use google_cloud_compute_v1::client::SslPolicies;
17716/// async fn sample(
17717/// ) -> anyhow::Result<()> {
17718/// let client = SslPolicies::builder().build().await?;
17719/// // use `client` to make requests to the Google Compute Engine API.
17720/// Ok(())
17721/// }
17722/// ```
17723///
17724/// # Service Description
17725///
17726/// Service for the `sslPolicies` resource.
17727///
17728/// # Configuration
17729///
17730/// To configure `SslPolicies` use the `with_*` methods in the type returned
17731/// by [builder()][SslPolicies::builder]. The default configuration should
17732/// work for most applications. Common configuration changes include
17733///
17734/// * [with_endpoint()]: by default this client uses the global default endpoint
17735/// (`https://compute.googleapis.com`). Applications using regional
17736/// endpoints or running in restricted networks (e.g. a network configured
17737/// with [Private Google Access with VPC Service Controls]) may want to
17738/// override this default.
17739/// * [with_credentials()]: by default this client uses
17740/// [Application Default Credentials]. Applications using custom
17741/// authentication may need to override this default.
17742///
17743/// [with_endpoint()]: super::builder::ssl_policies::ClientBuilder::with_endpoint
17744/// [with_credentials()]: super::builder::ssl_policies::ClientBuilder::with_credentials
17745/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17746/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17747///
17748/// # Pooling and Cloning
17749///
17750/// `SslPolicies` holds a connection pool internally, it is advised to
17751/// create one and reuse it. You do not need to wrap `SslPolicies` in
17752/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17753/// already uses an `Arc` internally.
17754#[cfg(feature = "ssl-policies")]
17755#[cfg_attr(docsrs, doc(cfg(feature = "ssl-policies")))]
17756#[derive(Clone, Debug)]
17757pub struct SslPolicies {
17758 inner: std::sync::Arc<dyn super::stub::dynamic::SslPolicies>,
17759}
17760
17761#[cfg(feature = "ssl-policies")]
17762impl SslPolicies {
17763 /// Returns a builder for [SslPolicies].
17764 ///
17765 /// ```
17766 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17767 /// # use google_cloud_compute_v1::client::SslPolicies;
17768 /// let client = SslPolicies::builder().build().await?;
17769 /// # Ok(()) }
17770 /// ```
17771 pub fn builder() -> super::builder::ssl_policies::ClientBuilder {
17772 crate::new_client_builder(super::builder::ssl_policies::client::Factory)
17773 }
17774
17775 /// Creates a new client from the provided stub.
17776 ///
17777 /// The most common case for calling this function is in tests mocking the
17778 /// client's behavior.
17779 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17780 where
17781 T: super::stub::SslPolicies + 'static,
17782 {
17783 Self { inner: stub.into() }
17784 }
17785
17786 pub(crate) async fn new(
17787 config: gaxi::options::ClientConfig,
17788 ) -> crate::ClientBuilderResult<Self> {
17789 let inner = Self::build_inner(config).await?;
17790 Ok(Self { inner })
17791 }
17792
17793 async fn build_inner(
17794 conf: gaxi::options::ClientConfig,
17795 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SslPolicies>> {
17796 if gaxi::options::tracing_enabled(&conf) {
17797 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17798 }
17799 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17800 }
17801
17802 async fn build_transport(
17803 conf: gaxi::options::ClientConfig,
17804 ) -> crate::ClientBuilderResult<impl super::stub::SslPolicies> {
17805 super::transport::SslPolicies::new(conf).await
17806 }
17807
17808 async fn build_with_tracing(
17809 conf: gaxi::options::ClientConfig,
17810 ) -> crate::ClientBuilderResult<impl super::stub::SslPolicies> {
17811 Self::build_transport(conf)
17812 .await
17813 .map(super::tracing::SslPolicies::new)
17814 }
17815
17816 /// Retrieves the list of all SslPolicy resources, regional and global,
17817 /// available to the specified project.
17818 ///
17819 /// To prevent failure, Google recommends that you set the
17820 /// `returnPartialSuccess` parameter to `true`.
17821 pub fn aggregated_list(&self) -> super::builder::ssl_policies::AggregatedList {
17822 super::builder::ssl_policies::AggregatedList::new(self.inner.clone())
17823 }
17824
17825 /// Deletes the specified SSL policy. The SSL policy resource can be deleted
17826 /// only if it is not in use by any TargetHttpsProxy or TargetSslProxy
17827 /// resources.
17828 pub fn delete(&self) -> super::builder::ssl_policies::Delete {
17829 super::builder::ssl_policies::Delete::new(self.inner.clone())
17830 }
17831
17832 /// Lists all of the ordered rules present in a single specified policy.
17833 pub fn get(&self) -> super::builder::ssl_policies::Get {
17834 super::builder::ssl_policies::Get::new(self.inner.clone())
17835 }
17836
17837 /// Returns the specified SSL policy resource.
17838 pub fn insert(&self) -> super::builder::ssl_policies::Insert {
17839 super::builder::ssl_policies::Insert::new(self.inner.clone())
17840 }
17841
17842 /// Lists all the SSL policies that have been configured for the specified
17843 /// project.
17844 pub fn list(&self) -> super::builder::ssl_policies::List {
17845 super::builder::ssl_policies::List::new(self.inner.clone())
17846 }
17847
17848 /// Lists all features that can be specified in the SSL policy when using
17849 /// custom profile.
17850 pub fn list_available_features(&self) -> super::builder::ssl_policies::ListAvailableFeatures {
17851 super::builder::ssl_policies::ListAvailableFeatures::new(self.inner.clone())
17852 }
17853
17854 /// Patches the specified SSL policy with the data included in the request.
17855 pub fn patch(&self) -> super::builder::ssl_policies::Patch {
17856 super::builder::ssl_policies::Patch::new(self.inner.clone())
17857 }
17858
17859 /// Retrieves the specified Operations resource.
17860 pub fn get_operation(&self) -> super::builder::ssl_policies::GetOperation {
17861 super::builder::ssl_policies::GetOperation::new(self.inner.clone())
17862 }
17863}
17864
17865/// Implements a client for the Google Compute Engine API.
17866///
17867/// # Example
17868/// ```
17869/// # use google_cloud_compute_v1::client::StoragePoolTypes;
17870/// async fn sample(
17871/// ) -> anyhow::Result<()> {
17872/// let client = StoragePoolTypes::builder().build().await?;
17873/// // use `client` to make requests to the Google Compute Engine API.
17874/// Ok(())
17875/// }
17876/// ```
17877///
17878/// # Service Description
17879///
17880/// Service for the `storagePoolTypes` resource.
17881///
17882/// # Configuration
17883///
17884/// To configure `StoragePoolTypes` use the `with_*` methods in the type returned
17885/// by [builder()][StoragePoolTypes::builder]. The default configuration should
17886/// work for most applications. Common configuration changes include
17887///
17888/// * [with_endpoint()]: by default this client uses the global default endpoint
17889/// (`https://compute.googleapis.com`). Applications using regional
17890/// endpoints or running in restricted networks (e.g. a network configured
17891/// with [Private Google Access with VPC Service Controls]) may want to
17892/// override this default.
17893/// * [with_credentials()]: by default this client uses
17894/// [Application Default Credentials]. Applications using custom
17895/// authentication may need to override this default.
17896///
17897/// [with_endpoint()]: super::builder::storage_pool_types::ClientBuilder::with_endpoint
17898/// [with_credentials()]: super::builder::storage_pool_types::ClientBuilder::with_credentials
17899/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17900/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17901///
17902/// # Pooling and Cloning
17903///
17904/// `StoragePoolTypes` holds a connection pool internally, it is advised to
17905/// create one and reuse it. You do not need to wrap `StoragePoolTypes` in
17906/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17907/// already uses an `Arc` internally.
17908#[cfg(feature = "storage-pool-types")]
17909#[cfg_attr(docsrs, doc(cfg(feature = "storage-pool-types")))]
17910#[derive(Clone, Debug)]
17911pub struct StoragePoolTypes {
17912 inner: std::sync::Arc<dyn super::stub::dynamic::StoragePoolTypes>,
17913}
17914
17915#[cfg(feature = "storage-pool-types")]
17916impl StoragePoolTypes {
17917 /// Returns a builder for [StoragePoolTypes].
17918 ///
17919 /// ```
17920 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17921 /// # use google_cloud_compute_v1::client::StoragePoolTypes;
17922 /// let client = StoragePoolTypes::builder().build().await?;
17923 /// # Ok(()) }
17924 /// ```
17925 pub fn builder() -> super::builder::storage_pool_types::ClientBuilder {
17926 crate::new_client_builder(super::builder::storage_pool_types::client::Factory)
17927 }
17928
17929 /// Creates a new client from the provided stub.
17930 ///
17931 /// The most common case for calling this function is in tests mocking the
17932 /// client's behavior.
17933 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17934 where
17935 T: super::stub::StoragePoolTypes + 'static,
17936 {
17937 Self { inner: stub.into() }
17938 }
17939
17940 pub(crate) async fn new(
17941 config: gaxi::options::ClientConfig,
17942 ) -> crate::ClientBuilderResult<Self> {
17943 let inner = Self::build_inner(config).await?;
17944 Ok(Self { inner })
17945 }
17946
17947 async fn build_inner(
17948 conf: gaxi::options::ClientConfig,
17949 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::StoragePoolTypes>>
17950 {
17951 if gaxi::options::tracing_enabled(&conf) {
17952 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17953 }
17954 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17955 }
17956
17957 async fn build_transport(
17958 conf: gaxi::options::ClientConfig,
17959 ) -> crate::ClientBuilderResult<impl super::stub::StoragePoolTypes> {
17960 super::transport::StoragePoolTypes::new(conf).await
17961 }
17962
17963 async fn build_with_tracing(
17964 conf: gaxi::options::ClientConfig,
17965 ) -> crate::ClientBuilderResult<impl super::stub::StoragePoolTypes> {
17966 Self::build_transport(conf)
17967 .await
17968 .map(super::tracing::StoragePoolTypes::new)
17969 }
17970
17971 /// Retrieves an aggregated list of storage pool types.
17972 ///
17973 /// To prevent failure, Google recommends that you set the
17974 /// `returnPartialSuccess` parameter to `true`.
17975 pub fn aggregated_list(&self) -> super::builder::storage_pool_types::AggregatedList {
17976 super::builder::storage_pool_types::AggregatedList::new(self.inner.clone())
17977 }
17978
17979 /// Returns the specified storage pool type.
17980 pub fn get(&self) -> super::builder::storage_pool_types::Get {
17981 super::builder::storage_pool_types::Get::new(self.inner.clone())
17982 }
17983
17984 /// Retrieves a list of storage pool types available to the specified
17985 /// project.
17986 pub fn list(&self) -> super::builder::storage_pool_types::List {
17987 super::builder::storage_pool_types::List::new(self.inner.clone())
17988 }
17989}
17990
17991/// Implements a client for the Google Compute Engine API.
17992///
17993/// # Example
17994/// ```
17995/// # use google_cloud_compute_v1::client::StoragePools;
17996/// async fn sample(
17997/// ) -> anyhow::Result<()> {
17998/// let client = StoragePools::builder().build().await?;
17999/// // use `client` to make requests to the Google Compute Engine API.
18000/// Ok(())
18001/// }
18002/// ```
18003///
18004/// # Service Description
18005///
18006/// Service for the `storagePools` resource.
18007///
18008/// # Configuration
18009///
18010/// To configure `StoragePools` use the `with_*` methods in the type returned
18011/// by [builder()][StoragePools::builder]. The default configuration should
18012/// work for most applications. Common configuration changes include
18013///
18014/// * [with_endpoint()]: by default this client uses the global default endpoint
18015/// (`https://compute.googleapis.com`). Applications using regional
18016/// endpoints or running in restricted networks (e.g. a network configured
18017/// with [Private Google Access with VPC Service Controls]) may want to
18018/// override this default.
18019/// * [with_credentials()]: by default this client uses
18020/// [Application Default Credentials]. Applications using custom
18021/// authentication may need to override this default.
18022///
18023/// [with_endpoint()]: super::builder::storage_pools::ClientBuilder::with_endpoint
18024/// [with_credentials()]: super::builder::storage_pools::ClientBuilder::with_credentials
18025/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18026/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18027///
18028/// # Pooling and Cloning
18029///
18030/// `StoragePools` holds a connection pool internally, it is advised to
18031/// create one and reuse it. You do not need to wrap `StoragePools` in
18032/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18033/// already uses an `Arc` internally.
18034#[cfg(feature = "storage-pools")]
18035#[cfg_attr(docsrs, doc(cfg(feature = "storage-pools")))]
18036#[derive(Clone, Debug)]
18037pub struct StoragePools {
18038 inner: std::sync::Arc<dyn super::stub::dynamic::StoragePools>,
18039}
18040
18041#[cfg(feature = "storage-pools")]
18042impl StoragePools {
18043 /// Returns a builder for [StoragePools].
18044 ///
18045 /// ```
18046 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18047 /// # use google_cloud_compute_v1::client::StoragePools;
18048 /// let client = StoragePools::builder().build().await?;
18049 /// # Ok(()) }
18050 /// ```
18051 pub fn builder() -> super::builder::storage_pools::ClientBuilder {
18052 crate::new_client_builder(super::builder::storage_pools::client::Factory)
18053 }
18054
18055 /// Creates a new client from the provided stub.
18056 ///
18057 /// The most common case for calling this function is in tests mocking the
18058 /// client's behavior.
18059 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18060 where
18061 T: super::stub::StoragePools + 'static,
18062 {
18063 Self { inner: stub.into() }
18064 }
18065
18066 pub(crate) async fn new(
18067 config: gaxi::options::ClientConfig,
18068 ) -> crate::ClientBuilderResult<Self> {
18069 let inner = Self::build_inner(config).await?;
18070 Ok(Self { inner })
18071 }
18072
18073 async fn build_inner(
18074 conf: gaxi::options::ClientConfig,
18075 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::StoragePools>> {
18076 if gaxi::options::tracing_enabled(&conf) {
18077 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18078 }
18079 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18080 }
18081
18082 async fn build_transport(
18083 conf: gaxi::options::ClientConfig,
18084 ) -> crate::ClientBuilderResult<impl super::stub::StoragePools> {
18085 super::transport::StoragePools::new(conf).await
18086 }
18087
18088 async fn build_with_tracing(
18089 conf: gaxi::options::ClientConfig,
18090 ) -> crate::ClientBuilderResult<impl super::stub::StoragePools> {
18091 Self::build_transport(conf)
18092 .await
18093 .map(super::tracing::StoragePools::new)
18094 }
18095
18096 /// Retrieves an aggregated list of storage pools.
18097 ///
18098 /// To prevent failure, Google recommends that you set the
18099 /// `returnPartialSuccess` parameter to `true`.
18100 pub fn aggregated_list(&self) -> super::builder::storage_pools::AggregatedList {
18101 super::builder::storage_pools::AggregatedList::new(self.inner.clone())
18102 }
18103
18104 /// Deletes the specified storage pool. Deleting a storagePool
18105 /// removes its data permanently and is irreversible. However, deleting a
18106 /// storagePool does not delete any snapshots previously
18107 /// made from the storagePool. You must separately delete
18108 /// snapshots.
18109 pub fn delete(&self) -> super::builder::storage_pools::Delete {
18110 super::builder::storage_pools::Delete::new(self.inner.clone())
18111 }
18112
18113 /// Returns a specified storage pool. Gets a list of available
18114 /// storage pools by making a list() request.
18115 pub fn get(&self) -> super::builder::storage_pools::Get {
18116 super::builder::storage_pools::Get::new(self.inner.clone())
18117 }
18118
18119 /// Gets the access control policy for a resource. May be empty if no such
18120 /// policy or resource exists.
18121 pub fn get_iam_policy(&self) -> super::builder::storage_pools::GetIamPolicy {
18122 super::builder::storage_pools::GetIamPolicy::new(self.inner.clone())
18123 }
18124
18125 /// Creates a storage pool in the specified project using the data
18126 /// in the request.
18127 pub fn insert(&self) -> super::builder::storage_pools::Insert {
18128 super::builder::storage_pools::Insert::new(self.inner.clone())
18129 }
18130
18131 /// Retrieves a list of storage pools contained within
18132 /// the specified zone.
18133 pub fn list(&self) -> super::builder::storage_pools::List {
18134 super::builder::storage_pools::List::new(self.inner.clone())
18135 }
18136
18137 /// Lists the disks in a specified storage pool.
18138 pub fn list_disks(&self) -> super::builder::storage_pools::ListDisks {
18139 super::builder::storage_pools::ListDisks::new(self.inner.clone())
18140 }
18141
18142 /// Sets the access control policy on the specified resource.
18143 /// Replaces any existing policy.
18144 pub fn set_iam_policy(&self) -> super::builder::storage_pools::SetIamPolicy {
18145 super::builder::storage_pools::SetIamPolicy::new(self.inner.clone())
18146 }
18147
18148 /// Returns permissions that a caller has on the specified resource.
18149 pub fn test_iam_permissions(&self) -> super::builder::storage_pools::TestIamPermissions {
18150 super::builder::storage_pools::TestIamPermissions::new(self.inner.clone())
18151 }
18152
18153 /// Updates the specified storagePool with the data included in the request.
18154 /// The update is performed only on selected fields included as part
18155 /// of update-mask. Only the following fields can be modified:
18156 /// pool_provisioned_capacity_gb, pool_provisioned_iops and
18157 /// pool_provisioned_throughput.
18158 pub fn update(&self) -> super::builder::storage_pools::Update {
18159 super::builder::storage_pools::Update::new(self.inner.clone())
18160 }
18161
18162 /// Retrieves the specified zone-specific Operations resource.
18163 pub fn get_operation(&self) -> super::builder::storage_pools::GetOperation {
18164 super::builder::storage_pools::GetOperation::new(self.inner.clone())
18165 }
18166}
18167
18168/// Implements a client for the Google Compute Engine API.
18169///
18170/// # Example
18171/// ```
18172/// # use google_cloud_compute_v1::client::Subnetworks;
18173/// async fn sample(
18174/// ) -> anyhow::Result<()> {
18175/// let client = Subnetworks::builder().build().await?;
18176/// // use `client` to make requests to the Google Compute Engine API.
18177/// Ok(())
18178/// }
18179/// ```
18180///
18181/// # Service Description
18182///
18183/// Service for the `subnetworks` resource.
18184///
18185/// # Configuration
18186///
18187/// To configure `Subnetworks` use the `with_*` methods in the type returned
18188/// by [builder()][Subnetworks::builder]. The default configuration should
18189/// work for most applications. Common configuration changes include
18190///
18191/// * [with_endpoint()]: by default this client uses the global default endpoint
18192/// (`https://compute.googleapis.com`). Applications using regional
18193/// endpoints or running in restricted networks (e.g. a network configured
18194/// with [Private Google Access with VPC Service Controls]) may want to
18195/// override this default.
18196/// * [with_credentials()]: by default this client uses
18197/// [Application Default Credentials]. Applications using custom
18198/// authentication may need to override this default.
18199///
18200/// [with_endpoint()]: super::builder::subnetworks::ClientBuilder::with_endpoint
18201/// [with_credentials()]: super::builder::subnetworks::ClientBuilder::with_credentials
18202/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18203/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18204///
18205/// # Pooling and Cloning
18206///
18207/// `Subnetworks` holds a connection pool internally, it is advised to
18208/// create one and reuse it. You do not need to wrap `Subnetworks` in
18209/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18210/// already uses an `Arc` internally.
18211#[cfg(feature = "subnetworks")]
18212#[cfg_attr(docsrs, doc(cfg(feature = "subnetworks")))]
18213#[derive(Clone, Debug)]
18214pub struct Subnetworks {
18215 inner: std::sync::Arc<dyn super::stub::dynamic::Subnetworks>,
18216}
18217
18218#[cfg(feature = "subnetworks")]
18219impl Subnetworks {
18220 /// Returns a builder for [Subnetworks].
18221 ///
18222 /// ```
18223 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18224 /// # use google_cloud_compute_v1::client::Subnetworks;
18225 /// let client = Subnetworks::builder().build().await?;
18226 /// # Ok(()) }
18227 /// ```
18228 pub fn builder() -> super::builder::subnetworks::ClientBuilder {
18229 crate::new_client_builder(super::builder::subnetworks::client::Factory)
18230 }
18231
18232 /// Creates a new client from the provided stub.
18233 ///
18234 /// The most common case for calling this function is in tests mocking the
18235 /// client's behavior.
18236 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18237 where
18238 T: super::stub::Subnetworks + 'static,
18239 {
18240 Self { inner: stub.into() }
18241 }
18242
18243 pub(crate) async fn new(
18244 config: gaxi::options::ClientConfig,
18245 ) -> crate::ClientBuilderResult<Self> {
18246 let inner = Self::build_inner(config).await?;
18247 Ok(Self { inner })
18248 }
18249
18250 async fn build_inner(
18251 conf: gaxi::options::ClientConfig,
18252 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Subnetworks>> {
18253 if gaxi::options::tracing_enabled(&conf) {
18254 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18255 }
18256 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18257 }
18258
18259 async fn build_transport(
18260 conf: gaxi::options::ClientConfig,
18261 ) -> crate::ClientBuilderResult<impl super::stub::Subnetworks> {
18262 super::transport::Subnetworks::new(conf).await
18263 }
18264
18265 async fn build_with_tracing(
18266 conf: gaxi::options::ClientConfig,
18267 ) -> crate::ClientBuilderResult<impl super::stub::Subnetworks> {
18268 Self::build_transport(conf)
18269 .await
18270 .map(super::tracing::Subnetworks::new)
18271 }
18272
18273 /// Retrieves an aggregated list of subnetworks.
18274 ///
18275 /// To prevent failure, Google recommends that you set the
18276 /// `returnPartialSuccess` parameter to `true`.
18277 pub fn aggregated_list(&self) -> super::builder::subnetworks::AggregatedList {
18278 super::builder::subnetworks::AggregatedList::new(self.inner.clone())
18279 }
18280
18281 /// Deletes the specified subnetwork.
18282 pub fn delete(&self) -> super::builder::subnetworks::Delete {
18283 super::builder::subnetworks::Delete::new(self.inner.clone())
18284 }
18285
18286 /// Expands the IP CIDR range of the subnetwork to a specified value.
18287 pub fn expand_ip_cidr_range(&self) -> super::builder::subnetworks::ExpandIpCidrRange {
18288 super::builder::subnetworks::ExpandIpCidrRange::new(self.inner.clone())
18289 }
18290
18291 /// Returns the specified subnetwork.
18292 pub fn get(&self) -> super::builder::subnetworks::Get {
18293 super::builder::subnetworks::Get::new(self.inner.clone())
18294 }
18295
18296 /// Gets the access control policy for a resource. May be empty if no such
18297 /// policy or resource exists.
18298 pub fn get_iam_policy(&self) -> super::builder::subnetworks::GetIamPolicy {
18299 super::builder::subnetworks::GetIamPolicy::new(self.inner.clone())
18300 }
18301
18302 /// Creates a subnetwork in the specified project using the data
18303 /// included in the request.
18304 pub fn insert(&self) -> super::builder::subnetworks::Insert {
18305 super::builder::subnetworks::Insert::new(self.inner.clone())
18306 }
18307
18308 /// Retrieves a list of subnetworks available to the specified
18309 /// project.
18310 pub fn list(&self) -> super::builder::subnetworks::List {
18311 super::builder::subnetworks::List::new(self.inner.clone())
18312 }
18313
18314 /// Retrieves an aggregated list of all usable subnetworks in the project.
18315 pub fn list_usable(&self) -> super::builder::subnetworks::ListUsable {
18316 super::builder::subnetworks::ListUsable::new(self.inner.clone())
18317 }
18318
18319 /// Patches the specified subnetwork with the data included in the request.
18320 /// Only certain fields can be updated with a patch request
18321 /// as indicated in the field descriptions.
18322 /// You must specify the current fingerprint of the
18323 /// subnetwork resource being patched.
18324 pub fn patch(&self) -> super::builder::subnetworks::Patch {
18325 super::builder::subnetworks::Patch::new(self.inner.clone())
18326 }
18327
18328 /// Sets the access control policy on the specified resource.
18329 /// Replaces any existing policy.
18330 pub fn set_iam_policy(&self) -> super::builder::subnetworks::SetIamPolicy {
18331 super::builder::subnetworks::SetIamPolicy::new(self.inner.clone())
18332 }
18333
18334 /// Set whether VMs in this subnet can access Google services without assigning
18335 /// external IP addresses through Private Google Access.
18336 pub fn set_private_ip_google_access(
18337 &self,
18338 ) -> super::builder::subnetworks::SetPrivateIpGoogleAccess {
18339 super::builder::subnetworks::SetPrivateIpGoogleAccess::new(self.inner.clone())
18340 }
18341
18342 /// Returns permissions that a caller has on the specified resource.
18343 pub fn test_iam_permissions(&self) -> super::builder::subnetworks::TestIamPermissions {
18344 super::builder::subnetworks::TestIamPermissions::new(self.inner.clone())
18345 }
18346
18347 /// Retrieves the specified region-specific Operations resource.
18348 pub fn get_operation(&self) -> super::builder::subnetworks::GetOperation {
18349 super::builder::subnetworks::GetOperation::new(self.inner.clone())
18350 }
18351}
18352
18353/// Implements a client for the Google Compute Engine API.
18354///
18355/// # Example
18356/// ```
18357/// # use google_cloud_compute_v1::client::TargetGrpcProxies;
18358/// async fn sample(
18359/// ) -> anyhow::Result<()> {
18360/// let client = TargetGrpcProxies::builder().build().await?;
18361/// // use `client` to make requests to the Google Compute Engine API.
18362/// Ok(())
18363/// }
18364/// ```
18365///
18366/// # Service Description
18367///
18368/// Service for the `targetGrpcProxies` resource.
18369///
18370/// # Configuration
18371///
18372/// To configure `TargetGrpcProxies` use the `with_*` methods in the type returned
18373/// by [builder()][TargetGrpcProxies::builder]. The default configuration should
18374/// work for most applications. Common configuration changes include
18375///
18376/// * [with_endpoint()]: by default this client uses the global default endpoint
18377/// (`https://compute.googleapis.com`). Applications using regional
18378/// endpoints or running in restricted networks (e.g. a network configured
18379/// with [Private Google Access with VPC Service Controls]) may want to
18380/// override this default.
18381/// * [with_credentials()]: by default this client uses
18382/// [Application Default Credentials]. Applications using custom
18383/// authentication may need to override this default.
18384///
18385/// [with_endpoint()]: super::builder::target_grpc_proxies::ClientBuilder::with_endpoint
18386/// [with_credentials()]: super::builder::target_grpc_proxies::ClientBuilder::with_credentials
18387/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18388/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18389///
18390/// # Pooling and Cloning
18391///
18392/// `TargetGrpcProxies` holds a connection pool internally, it is advised to
18393/// create one and reuse it. You do not need to wrap `TargetGrpcProxies` in
18394/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18395/// already uses an `Arc` internally.
18396#[cfg(feature = "target-grpc-proxies")]
18397#[cfg_attr(docsrs, doc(cfg(feature = "target-grpc-proxies")))]
18398#[derive(Clone, Debug)]
18399pub struct TargetGrpcProxies {
18400 inner: std::sync::Arc<dyn super::stub::dynamic::TargetGrpcProxies>,
18401}
18402
18403#[cfg(feature = "target-grpc-proxies")]
18404impl TargetGrpcProxies {
18405 /// Returns a builder for [TargetGrpcProxies].
18406 ///
18407 /// ```
18408 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18409 /// # use google_cloud_compute_v1::client::TargetGrpcProxies;
18410 /// let client = TargetGrpcProxies::builder().build().await?;
18411 /// # Ok(()) }
18412 /// ```
18413 pub fn builder() -> super::builder::target_grpc_proxies::ClientBuilder {
18414 crate::new_client_builder(super::builder::target_grpc_proxies::client::Factory)
18415 }
18416
18417 /// Creates a new client from the provided stub.
18418 ///
18419 /// The most common case for calling this function is in tests mocking the
18420 /// client's behavior.
18421 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18422 where
18423 T: super::stub::TargetGrpcProxies + 'static,
18424 {
18425 Self { inner: stub.into() }
18426 }
18427
18428 pub(crate) async fn new(
18429 config: gaxi::options::ClientConfig,
18430 ) -> crate::ClientBuilderResult<Self> {
18431 let inner = Self::build_inner(config).await?;
18432 Ok(Self { inner })
18433 }
18434
18435 async fn build_inner(
18436 conf: gaxi::options::ClientConfig,
18437 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetGrpcProxies>>
18438 {
18439 if gaxi::options::tracing_enabled(&conf) {
18440 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18441 }
18442 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18443 }
18444
18445 async fn build_transport(
18446 conf: gaxi::options::ClientConfig,
18447 ) -> crate::ClientBuilderResult<impl super::stub::TargetGrpcProxies> {
18448 super::transport::TargetGrpcProxies::new(conf).await
18449 }
18450
18451 async fn build_with_tracing(
18452 conf: gaxi::options::ClientConfig,
18453 ) -> crate::ClientBuilderResult<impl super::stub::TargetGrpcProxies> {
18454 Self::build_transport(conf)
18455 .await
18456 .map(super::tracing::TargetGrpcProxies::new)
18457 }
18458
18459 /// Deletes the specified TargetGrpcProxy in the given scope
18460 pub fn delete(&self) -> super::builder::target_grpc_proxies::Delete {
18461 super::builder::target_grpc_proxies::Delete::new(self.inner.clone())
18462 }
18463
18464 /// Returns the specified TargetGrpcProxy resource in the given scope.
18465 pub fn get(&self) -> super::builder::target_grpc_proxies::Get {
18466 super::builder::target_grpc_proxies::Get::new(self.inner.clone())
18467 }
18468
18469 /// Creates a TargetGrpcProxy in the specified project in the given scope
18470 /// using the parameters that are included in the request.
18471 pub fn insert(&self) -> super::builder::target_grpc_proxies::Insert {
18472 super::builder::target_grpc_proxies::Insert::new(self.inner.clone())
18473 }
18474
18475 /// Lists the TargetGrpcProxies for a project in the given scope.
18476 pub fn list(&self) -> super::builder::target_grpc_proxies::List {
18477 super::builder::target_grpc_proxies::List::new(self.inner.clone())
18478 }
18479
18480 /// Patches the specified TargetGrpcProxy resource with the data included in
18481 /// the request. This method supports PATCH
18482 /// semantics and usesJSON merge
18483 /// patch format and processing rules.
18484 pub fn patch(&self) -> super::builder::target_grpc_proxies::Patch {
18485 super::builder::target_grpc_proxies::Patch::new(self.inner.clone())
18486 }
18487
18488 /// Retrieves the specified Operations resource.
18489 pub fn get_operation(&self) -> super::builder::target_grpc_proxies::GetOperation {
18490 super::builder::target_grpc_proxies::GetOperation::new(self.inner.clone())
18491 }
18492}
18493
18494/// Implements a client for the Google Compute Engine API.
18495///
18496/// # Example
18497/// ```
18498/// # use google_cloud_compute_v1::client::TargetHttpProxies;
18499/// async fn sample(
18500/// ) -> anyhow::Result<()> {
18501/// let client = TargetHttpProxies::builder().build().await?;
18502/// // use `client` to make requests to the Google Compute Engine API.
18503/// Ok(())
18504/// }
18505/// ```
18506///
18507/// # Service Description
18508///
18509/// Service for the `targetHttpProxies` resource.
18510///
18511/// # Configuration
18512///
18513/// To configure `TargetHttpProxies` use the `with_*` methods in the type returned
18514/// by [builder()][TargetHttpProxies::builder]. The default configuration should
18515/// work for most applications. Common configuration changes include
18516///
18517/// * [with_endpoint()]: by default this client uses the global default endpoint
18518/// (`https://compute.googleapis.com`). Applications using regional
18519/// endpoints or running in restricted networks (e.g. a network configured
18520/// with [Private Google Access with VPC Service Controls]) may want to
18521/// override this default.
18522/// * [with_credentials()]: by default this client uses
18523/// [Application Default Credentials]. Applications using custom
18524/// authentication may need to override this default.
18525///
18526/// [with_endpoint()]: super::builder::target_http_proxies::ClientBuilder::with_endpoint
18527/// [with_credentials()]: super::builder::target_http_proxies::ClientBuilder::with_credentials
18528/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18529/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18530///
18531/// # Pooling and Cloning
18532///
18533/// `TargetHttpProxies` holds a connection pool internally, it is advised to
18534/// create one and reuse it. You do not need to wrap `TargetHttpProxies` in
18535/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18536/// already uses an `Arc` internally.
18537#[cfg(feature = "target-http-proxies")]
18538#[cfg_attr(docsrs, doc(cfg(feature = "target-http-proxies")))]
18539#[derive(Clone, Debug)]
18540pub struct TargetHttpProxies {
18541 inner: std::sync::Arc<dyn super::stub::dynamic::TargetHttpProxies>,
18542}
18543
18544#[cfg(feature = "target-http-proxies")]
18545impl TargetHttpProxies {
18546 /// Returns a builder for [TargetHttpProxies].
18547 ///
18548 /// ```
18549 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18550 /// # use google_cloud_compute_v1::client::TargetHttpProxies;
18551 /// let client = TargetHttpProxies::builder().build().await?;
18552 /// # Ok(()) }
18553 /// ```
18554 pub fn builder() -> super::builder::target_http_proxies::ClientBuilder {
18555 crate::new_client_builder(super::builder::target_http_proxies::client::Factory)
18556 }
18557
18558 /// Creates a new client from the provided stub.
18559 ///
18560 /// The most common case for calling this function is in tests mocking the
18561 /// client's behavior.
18562 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18563 where
18564 T: super::stub::TargetHttpProxies + 'static,
18565 {
18566 Self { inner: stub.into() }
18567 }
18568
18569 pub(crate) async fn new(
18570 config: gaxi::options::ClientConfig,
18571 ) -> crate::ClientBuilderResult<Self> {
18572 let inner = Self::build_inner(config).await?;
18573 Ok(Self { inner })
18574 }
18575
18576 async fn build_inner(
18577 conf: gaxi::options::ClientConfig,
18578 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetHttpProxies>>
18579 {
18580 if gaxi::options::tracing_enabled(&conf) {
18581 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18582 }
18583 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18584 }
18585
18586 async fn build_transport(
18587 conf: gaxi::options::ClientConfig,
18588 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpProxies> {
18589 super::transport::TargetHttpProxies::new(conf).await
18590 }
18591
18592 async fn build_with_tracing(
18593 conf: gaxi::options::ClientConfig,
18594 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpProxies> {
18595 Self::build_transport(conf)
18596 .await
18597 .map(super::tracing::TargetHttpProxies::new)
18598 }
18599
18600 /// Retrieves the list of all TargetHttpProxy resources, regional and global,
18601 /// available to the specified project.
18602 ///
18603 /// To prevent failure, Google recommends that you set the
18604 /// `returnPartialSuccess` parameter to `true`.
18605 pub fn aggregated_list(&self) -> super::builder::target_http_proxies::AggregatedList {
18606 super::builder::target_http_proxies::AggregatedList::new(self.inner.clone())
18607 }
18608
18609 /// Deletes the specified TargetHttpProxy resource.
18610 pub fn delete(&self) -> super::builder::target_http_proxies::Delete {
18611 super::builder::target_http_proxies::Delete::new(self.inner.clone())
18612 }
18613
18614 /// Returns the specified TargetHttpProxy resource.
18615 pub fn get(&self) -> super::builder::target_http_proxies::Get {
18616 super::builder::target_http_proxies::Get::new(self.inner.clone())
18617 }
18618
18619 /// Creates a TargetHttpProxy resource in the specified
18620 /// project using the data included in the request.
18621 pub fn insert(&self) -> super::builder::target_http_proxies::Insert {
18622 super::builder::target_http_proxies::Insert::new(self.inner.clone())
18623 }
18624
18625 /// Retrieves the list of TargetHttpProxy resources available
18626 /// to the specified project.
18627 pub fn list(&self) -> super::builder::target_http_proxies::List {
18628 super::builder::target_http_proxies::List::new(self.inner.clone())
18629 }
18630
18631 /// Patches the specified TargetHttpProxy resource with the data included in
18632 /// the request. This method supports PATCH
18633 /// semantics and usesJSON merge
18634 /// patch format and processing rules.
18635 pub fn patch(&self) -> super::builder::target_http_proxies::Patch {
18636 super::builder::target_http_proxies::Patch::new(self.inner.clone())
18637 }
18638
18639 /// Changes the URL map for TargetHttpProxy.
18640 pub fn set_url_map(&self) -> super::builder::target_http_proxies::SetUrlMap {
18641 super::builder::target_http_proxies::SetUrlMap::new(self.inner.clone())
18642 }
18643
18644 /// Retrieves the specified Operations resource.
18645 pub fn get_operation(&self) -> super::builder::target_http_proxies::GetOperation {
18646 super::builder::target_http_proxies::GetOperation::new(self.inner.clone())
18647 }
18648}
18649
18650/// Implements a client for the Google Compute Engine API.
18651///
18652/// # Example
18653/// ```
18654/// # use google_cloud_compute_v1::client::TargetHttpsProxies;
18655/// async fn sample(
18656/// ) -> anyhow::Result<()> {
18657/// let client = TargetHttpsProxies::builder().build().await?;
18658/// // use `client` to make requests to the Google Compute Engine API.
18659/// Ok(())
18660/// }
18661/// ```
18662///
18663/// # Service Description
18664///
18665/// Service for the `targetHttpsProxies` resource.
18666///
18667/// # Configuration
18668///
18669/// To configure `TargetHttpsProxies` use the `with_*` methods in the type returned
18670/// by [builder()][TargetHttpsProxies::builder]. The default configuration should
18671/// work for most applications. Common configuration changes include
18672///
18673/// * [with_endpoint()]: by default this client uses the global default endpoint
18674/// (`https://compute.googleapis.com`). Applications using regional
18675/// endpoints or running in restricted networks (e.g. a network configured
18676/// with [Private Google Access with VPC Service Controls]) may want to
18677/// override this default.
18678/// * [with_credentials()]: by default this client uses
18679/// [Application Default Credentials]. Applications using custom
18680/// authentication may need to override this default.
18681///
18682/// [with_endpoint()]: super::builder::target_https_proxies::ClientBuilder::with_endpoint
18683/// [with_credentials()]: super::builder::target_https_proxies::ClientBuilder::with_credentials
18684/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18685/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18686///
18687/// # Pooling and Cloning
18688///
18689/// `TargetHttpsProxies` holds a connection pool internally, it is advised to
18690/// create one and reuse it. You do not need to wrap `TargetHttpsProxies` in
18691/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18692/// already uses an `Arc` internally.
18693#[cfg(feature = "target-https-proxies")]
18694#[cfg_attr(docsrs, doc(cfg(feature = "target-https-proxies")))]
18695#[derive(Clone, Debug)]
18696pub struct TargetHttpsProxies {
18697 inner: std::sync::Arc<dyn super::stub::dynamic::TargetHttpsProxies>,
18698}
18699
18700#[cfg(feature = "target-https-proxies")]
18701impl TargetHttpsProxies {
18702 /// Returns a builder for [TargetHttpsProxies].
18703 ///
18704 /// ```
18705 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18706 /// # use google_cloud_compute_v1::client::TargetHttpsProxies;
18707 /// let client = TargetHttpsProxies::builder().build().await?;
18708 /// # Ok(()) }
18709 /// ```
18710 pub fn builder() -> super::builder::target_https_proxies::ClientBuilder {
18711 crate::new_client_builder(super::builder::target_https_proxies::client::Factory)
18712 }
18713
18714 /// Creates a new client from the provided stub.
18715 ///
18716 /// The most common case for calling this function is in tests mocking the
18717 /// client's behavior.
18718 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18719 where
18720 T: super::stub::TargetHttpsProxies + 'static,
18721 {
18722 Self { inner: stub.into() }
18723 }
18724
18725 pub(crate) async fn new(
18726 config: gaxi::options::ClientConfig,
18727 ) -> crate::ClientBuilderResult<Self> {
18728 let inner = Self::build_inner(config).await?;
18729 Ok(Self { inner })
18730 }
18731
18732 async fn build_inner(
18733 conf: gaxi::options::ClientConfig,
18734 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetHttpsProxies>>
18735 {
18736 if gaxi::options::tracing_enabled(&conf) {
18737 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18738 }
18739 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18740 }
18741
18742 async fn build_transport(
18743 conf: gaxi::options::ClientConfig,
18744 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpsProxies> {
18745 super::transport::TargetHttpsProxies::new(conf).await
18746 }
18747
18748 async fn build_with_tracing(
18749 conf: gaxi::options::ClientConfig,
18750 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpsProxies> {
18751 Self::build_transport(conf)
18752 .await
18753 .map(super::tracing::TargetHttpsProxies::new)
18754 }
18755
18756 /// Retrieves the list of all TargetHttpsProxy resources, regional and global,
18757 /// available to the specified project.
18758 ///
18759 /// To prevent failure, Google recommends that you set the
18760 /// `returnPartialSuccess` parameter to `true`.
18761 pub fn aggregated_list(&self) -> super::builder::target_https_proxies::AggregatedList {
18762 super::builder::target_https_proxies::AggregatedList::new(self.inner.clone())
18763 }
18764
18765 /// Deletes the specified TargetHttpsProxy resource.
18766 pub fn delete(&self) -> super::builder::target_https_proxies::Delete {
18767 super::builder::target_https_proxies::Delete::new(self.inner.clone())
18768 }
18769
18770 /// Returns the specified TargetHttpsProxy resource.
18771 pub fn get(&self) -> super::builder::target_https_proxies::Get {
18772 super::builder::target_https_proxies::Get::new(self.inner.clone())
18773 }
18774
18775 /// Creates a TargetHttpsProxy resource in the specified
18776 /// project using the data included in the request.
18777 pub fn insert(&self) -> super::builder::target_https_proxies::Insert {
18778 super::builder::target_https_proxies::Insert::new(self.inner.clone())
18779 }
18780
18781 /// Retrieves the list of TargetHttpsProxy resources
18782 /// available to the specified project.
18783 pub fn list(&self) -> super::builder::target_https_proxies::List {
18784 super::builder::target_https_proxies::List::new(self.inner.clone())
18785 }
18786
18787 /// Patches the specified TargetHttpsProxy resource with the data included in
18788 /// the request. This method supports PATCH
18789 /// semantics and usesJSON merge
18790 /// patch format and processing rules.
18791 pub fn patch(&self) -> super::builder::target_https_proxies::Patch {
18792 super::builder::target_https_proxies::Patch::new(self.inner.clone())
18793 }
18794
18795 /// Changes the Certificate Map for TargetHttpsProxy.
18796 pub fn set_certificate_map(&self) -> super::builder::target_https_proxies::SetCertificateMap {
18797 super::builder::target_https_proxies::SetCertificateMap::new(self.inner.clone())
18798 }
18799
18800 /// Sets the QUIC override policy for TargetHttpsProxy.
18801 pub fn set_quic_override(&self) -> super::builder::target_https_proxies::SetQuicOverride {
18802 super::builder::target_https_proxies::SetQuicOverride::new(self.inner.clone())
18803 }
18804
18805 /// Replaces SslCertificates for TargetHttpsProxy.
18806 pub fn set_ssl_certificates(&self) -> super::builder::target_https_proxies::SetSslCertificates {
18807 super::builder::target_https_proxies::SetSslCertificates::new(self.inner.clone())
18808 }
18809
18810 /// Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the
18811 /// server-side support for SSL features. This affects connections between
18812 /// clients and the HTTPS proxy load balancer. They do not affect the
18813 /// connection between the load balancer and the backends.
18814 pub fn set_ssl_policy(&self) -> super::builder::target_https_proxies::SetSslPolicy {
18815 super::builder::target_https_proxies::SetSslPolicy::new(self.inner.clone())
18816 }
18817
18818 /// Changes the URL map for TargetHttpsProxy.
18819 pub fn set_url_map(&self) -> super::builder::target_https_proxies::SetUrlMap {
18820 super::builder::target_https_proxies::SetUrlMap::new(self.inner.clone())
18821 }
18822
18823 /// Retrieves the specified Operations resource.
18824 pub fn get_operation(&self) -> super::builder::target_https_proxies::GetOperation {
18825 super::builder::target_https_proxies::GetOperation::new(self.inner.clone())
18826 }
18827}
18828
18829/// Implements a client for the Google Compute Engine API.
18830///
18831/// # Example
18832/// ```
18833/// # use google_cloud_compute_v1::client::TargetInstances;
18834/// async fn sample(
18835/// ) -> anyhow::Result<()> {
18836/// let client = TargetInstances::builder().build().await?;
18837/// // use `client` to make requests to the Google Compute Engine API.
18838/// Ok(())
18839/// }
18840/// ```
18841///
18842/// # Service Description
18843///
18844/// Service for the `targetInstances` resource.
18845///
18846/// # Configuration
18847///
18848/// To configure `TargetInstances` use the `with_*` methods in the type returned
18849/// by [builder()][TargetInstances::builder]. The default configuration should
18850/// work for most applications. Common configuration changes include
18851///
18852/// * [with_endpoint()]: by default this client uses the global default endpoint
18853/// (`https://compute.googleapis.com`). Applications using regional
18854/// endpoints or running in restricted networks (e.g. a network configured
18855/// with [Private Google Access with VPC Service Controls]) may want to
18856/// override this default.
18857/// * [with_credentials()]: by default this client uses
18858/// [Application Default Credentials]. Applications using custom
18859/// authentication may need to override this default.
18860///
18861/// [with_endpoint()]: super::builder::target_instances::ClientBuilder::with_endpoint
18862/// [with_credentials()]: super::builder::target_instances::ClientBuilder::with_credentials
18863/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18864/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18865///
18866/// # Pooling and Cloning
18867///
18868/// `TargetInstances` holds a connection pool internally, it is advised to
18869/// create one and reuse it. You do not need to wrap `TargetInstances` in
18870/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18871/// already uses an `Arc` internally.
18872#[cfg(feature = "target-instances")]
18873#[cfg_attr(docsrs, doc(cfg(feature = "target-instances")))]
18874#[derive(Clone, Debug)]
18875pub struct TargetInstances {
18876 inner: std::sync::Arc<dyn super::stub::dynamic::TargetInstances>,
18877}
18878
18879#[cfg(feature = "target-instances")]
18880impl TargetInstances {
18881 /// Returns a builder for [TargetInstances].
18882 ///
18883 /// ```
18884 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18885 /// # use google_cloud_compute_v1::client::TargetInstances;
18886 /// let client = TargetInstances::builder().build().await?;
18887 /// # Ok(()) }
18888 /// ```
18889 pub fn builder() -> super::builder::target_instances::ClientBuilder {
18890 crate::new_client_builder(super::builder::target_instances::client::Factory)
18891 }
18892
18893 /// Creates a new client from the provided stub.
18894 ///
18895 /// The most common case for calling this function is in tests mocking the
18896 /// client's behavior.
18897 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18898 where
18899 T: super::stub::TargetInstances + 'static,
18900 {
18901 Self { inner: stub.into() }
18902 }
18903
18904 pub(crate) async fn new(
18905 config: gaxi::options::ClientConfig,
18906 ) -> crate::ClientBuilderResult<Self> {
18907 let inner = Self::build_inner(config).await?;
18908 Ok(Self { inner })
18909 }
18910
18911 async fn build_inner(
18912 conf: gaxi::options::ClientConfig,
18913 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetInstances>> {
18914 if gaxi::options::tracing_enabled(&conf) {
18915 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18916 }
18917 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18918 }
18919
18920 async fn build_transport(
18921 conf: gaxi::options::ClientConfig,
18922 ) -> crate::ClientBuilderResult<impl super::stub::TargetInstances> {
18923 super::transport::TargetInstances::new(conf).await
18924 }
18925
18926 async fn build_with_tracing(
18927 conf: gaxi::options::ClientConfig,
18928 ) -> crate::ClientBuilderResult<impl super::stub::TargetInstances> {
18929 Self::build_transport(conf)
18930 .await
18931 .map(super::tracing::TargetInstances::new)
18932 }
18933
18934 /// Retrieves an aggregated list of target instances.
18935 ///
18936 /// To prevent failure, Google recommends that you set the
18937 /// `returnPartialSuccess` parameter to `true`.
18938 pub fn aggregated_list(&self) -> super::builder::target_instances::AggregatedList {
18939 super::builder::target_instances::AggregatedList::new(self.inner.clone())
18940 }
18941
18942 /// Deletes the specified TargetInstance resource.
18943 pub fn delete(&self) -> super::builder::target_instances::Delete {
18944 super::builder::target_instances::Delete::new(self.inner.clone())
18945 }
18946
18947 /// Returns the specified TargetInstance resource.
18948 pub fn get(&self) -> super::builder::target_instances::Get {
18949 super::builder::target_instances::Get::new(self.inner.clone())
18950 }
18951
18952 /// Creates a TargetInstance resource in the specified project and zone using
18953 /// the data included in the request.
18954 pub fn insert(&self) -> super::builder::target_instances::Insert {
18955 super::builder::target_instances::Insert::new(self.inner.clone())
18956 }
18957
18958 /// Retrieves a list of TargetInstance resources available to the specified
18959 /// project and zone.
18960 pub fn list(&self) -> super::builder::target_instances::List {
18961 super::builder::target_instances::List::new(self.inner.clone())
18962 }
18963
18964 /// Sets the Google Cloud Armor security policy for the specified target
18965 /// instance. For more information, seeGoogle
18966 /// Cloud Armor Overview
18967 pub fn set_security_policy(&self) -> super::builder::target_instances::SetSecurityPolicy {
18968 super::builder::target_instances::SetSecurityPolicy::new(self.inner.clone())
18969 }
18970
18971 /// Returns permissions that a caller has on the specified resource.
18972 pub fn test_iam_permissions(&self) -> super::builder::target_instances::TestIamPermissions {
18973 super::builder::target_instances::TestIamPermissions::new(self.inner.clone())
18974 }
18975
18976 /// Retrieves the specified zone-specific Operations resource.
18977 pub fn get_operation(&self) -> super::builder::target_instances::GetOperation {
18978 super::builder::target_instances::GetOperation::new(self.inner.clone())
18979 }
18980}
18981
18982/// Implements a client for the Google Compute Engine API.
18983///
18984/// # Example
18985/// ```
18986/// # use google_cloud_compute_v1::client::TargetPools;
18987/// async fn sample(
18988/// ) -> anyhow::Result<()> {
18989/// let client = TargetPools::builder().build().await?;
18990/// // use `client` to make requests to the Google Compute Engine API.
18991/// Ok(())
18992/// }
18993/// ```
18994///
18995/// # Service Description
18996///
18997/// Service for the `targetPools` resource.
18998///
18999/// # Configuration
19000///
19001/// To configure `TargetPools` use the `with_*` methods in the type returned
19002/// by [builder()][TargetPools::builder]. The default configuration should
19003/// work for most applications. Common configuration changes include
19004///
19005/// * [with_endpoint()]: by default this client uses the global default endpoint
19006/// (`https://compute.googleapis.com`). Applications using regional
19007/// endpoints or running in restricted networks (e.g. a network configured
19008/// with [Private Google Access with VPC Service Controls]) may want to
19009/// override this default.
19010/// * [with_credentials()]: by default this client uses
19011/// [Application Default Credentials]. Applications using custom
19012/// authentication may need to override this default.
19013///
19014/// [with_endpoint()]: super::builder::target_pools::ClientBuilder::with_endpoint
19015/// [with_credentials()]: super::builder::target_pools::ClientBuilder::with_credentials
19016/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19017/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19018///
19019/// # Pooling and Cloning
19020///
19021/// `TargetPools` holds a connection pool internally, it is advised to
19022/// create one and reuse it. You do not need to wrap `TargetPools` in
19023/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19024/// already uses an `Arc` internally.
19025#[cfg(feature = "target-pools")]
19026#[cfg_attr(docsrs, doc(cfg(feature = "target-pools")))]
19027#[derive(Clone, Debug)]
19028pub struct TargetPools {
19029 inner: std::sync::Arc<dyn super::stub::dynamic::TargetPools>,
19030}
19031
19032#[cfg(feature = "target-pools")]
19033impl TargetPools {
19034 /// Returns a builder for [TargetPools].
19035 ///
19036 /// ```
19037 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19038 /// # use google_cloud_compute_v1::client::TargetPools;
19039 /// let client = TargetPools::builder().build().await?;
19040 /// # Ok(()) }
19041 /// ```
19042 pub fn builder() -> super::builder::target_pools::ClientBuilder {
19043 crate::new_client_builder(super::builder::target_pools::client::Factory)
19044 }
19045
19046 /// Creates a new client from the provided stub.
19047 ///
19048 /// The most common case for calling this function is in tests mocking the
19049 /// client's behavior.
19050 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19051 where
19052 T: super::stub::TargetPools + 'static,
19053 {
19054 Self { inner: stub.into() }
19055 }
19056
19057 pub(crate) async fn new(
19058 config: gaxi::options::ClientConfig,
19059 ) -> crate::ClientBuilderResult<Self> {
19060 let inner = Self::build_inner(config).await?;
19061 Ok(Self { inner })
19062 }
19063
19064 async fn build_inner(
19065 conf: gaxi::options::ClientConfig,
19066 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetPools>> {
19067 if gaxi::options::tracing_enabled(&conf) {
19068 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19069 }
19070 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19071 }
19072
19073 async fn build_transport(
19074 conf: gaxi::options::ClientConfig,
19075 ) -> crate::ClientBuilderResult<impl super::stub::TargetPools> {
19076 super::transport::TargetPools::new(conf).await
19077 }
19078
19079 async fn build_with_tracing(
19080 conf: gaxi::options::ClientConfig,
19081 ) -> crate::ClientBuilderResult<impl super::stub::TargetPools> {
19082 Self::build_transport(conf)
19083 .await
19084 .map(super::tracing::TargetPools::new)
19085 }
19086
19087 /// Adds health check URLs to a target pool.
19088 pub fn add_health_check(&self) -> super::builder::target_pools::AddHealthCheck {
19089 super::builder::target_pools::AddHealthCheck::new(self.inner.clone())
19090 }
19091
19092 /// Adds an instance to a target pool.
19093 pub fn add_instance(&self) -> super::builder::target_pools::AddInstance {
19094 super::builder::target_pools::AddInstance::new(self.inner.clone())
19095 }
19096
19097 /// Retrieves an aggregated list of target pools.
19098 ///
19099 /// To prevent failure, Google recommends that you set the
19100 /// `returnPartialSuccess` parameter to `true`.
19101 pub fn aggregated_list(&self) -> super::builder::target_pools::AggregatedList {
19102 super::builder::target_pools::AggregatedList::new(self.inner.clone())
19103 }
19104
19105 /// Deletes the specified target pool.
19106 pub fn delete(&self) -> super::builder::target_pools::Delete {
19107 super::builder::target_pools::Delete::new(self.inner.clone())
19108 }
19109
19110 /// Returns the specified target pool.
19111 pub fn get(&self) -> super::builder::target_pools::Get {
19112 super::builder::target_pools::Get::new(self.inner.clone())
19113 }
19114
19115 /// Gets the most recent health check results for each IP for the
19116 /// instance that is referenced by the given target pool.
19117 pub fn get_health(&self) -> super::builder::target_pools::GetHealth {
19118 super::builder::target_pools::GetHealth::new(self.inner.clone())
19119 }
19120
19121 /// Creates a target pool in the specified project and region using
19122 /// the data included in the request.
19123 pub fn insert(&self) -> super::builder::target_pools::Insert {
19124 super::builder::target_pools::Insert::new(self.inner.clone())
19125 }
19126
19127 /// Retrieves a list of target pools available to the specified
19128 /// project and region.
19129 pub fn list(&self) -> super::builder::target_pools::List {
19130 super::builder::target_pools::List::new(self.inner.clone())
19131 }
19132
19133 /// Removes health check URL from a target pool.
19134 pub fn remove_health_check(&self) -> super::builder::target_pools::RemoveHealthCheck {
19135 super::builder::target_pools::RemoveHealthCheck::new(self.inner.clone())
19136 }
19137
19138 /// Removes instance URL from a target pool.
19139 pub fn remove_instance(&self) -> super::builder::target_pools::RemoveInstance {
19140 super::builder::target_pools::RemoveInstance::new(self.inner.clone())
19141 }
19142
19143 /// Changes a backup target pool's configurations.
19144 pub fn set_backup(&self) -> super::builder::target_pools::SetBackup {
19145 super::builder::target_pools::SetBackup::new(self.inner.clone())
19146 }
19147
19148 /// Sets the Google Cloud Armor security policy for the specified target pool.
19149 /// For more information, seeGoogle
19150 /// Cloud Armor Overview
19151 pub fn set_security_policy(&self) -> super::builder::target_pools::SetSecurityPolicy {
19152 super::builder::target_pools::SetSecurityPolicy::new(self.inner.clone())
19153 }
19154
19155 /// Returns permissions that a caller has on the specified resource.
19156 pub fn test_iam_permissions(&self) -> super::builder::target_pools::TestIamPermissions {
19157 super::builder::target_pools::TestIamPermissions::new(self.inner.clone())
19158 }
19159
19160 /// Retrieves the specified region-specific Operations resource.
19161 pub fn get_operation(&self) -> super::builder::target_pools::GetOperation {
19162 super::builder::target_pools::GetOperation::new(self.inner.clone())
19163 }
19164}
19165
19166/// Implements a client for the Google Compute Engine API.
19167///
19168/// # Example
19169/// ```
19170/// # use google_cloud_compute_v1::client::TargetSslProxies;
19171/// async fn sample(
19172/// ) -> anyhow::Result<()> {
19173/// let client = TargetSslProxies::builder().build().await?;
19174/// // use `client` to make requests to the Google Compute Engine API.
19175/// Ok(())
19176/// }
19177/// ```
19178///
19179/// # Service Description
19180///
19181/// Service for the `targetSslProxies` resource.
19182///
19183/// # Configuration
19184///
19185/// To configure `TargetSslProxies` use the `with_*` methods in the type returned
19186/// by [builder()][TargetSslProxies::builder]. The default configuration should
19187/// work for most applications. Common configuration changes include
19188///
19189/// * [with_endpoint()]: by default this client uses the global default endpoint
19190/// (`https://compute.googleapis.com`). Applications using regional
19191/// endpoints or running in restricted networks (e.g. a network configured
19192/// with [Private Google Access with VPC Service Controls]) may want to
19193/// override this default.
19194/// * [with_credentials()]: by default this client uses
19195/// [Application Default Credentials]. Applications using custom
19196/// authentication may need to override this default.
19197///
19198/// [with_endpoint()]: super::builder::target_ssl_proxies::ClientBuilder::with_endpoint
19199/// [with_credentials()]: super::builder::target_ssl_proxies::ClientBuilder::with_credentials
19200/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19201/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19202///
19203/// # Pooling and Cloning
19204///
19205/// `TargetSslProxies` holds a connection pool internally, it is advised to
19206/// create one and reuse it. You do not need to wrap `TargetSslProxies` in
19207/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19208/// already uses an `Arc` internally.
19209#[cfg(feature = "target-ssl-proxies")]
19210#[cfg_attr(docsrs, doc(cfg(feature = "target-ssl-proxies")))]
19211#[derive(Clone, Debug)]
19212pub struct TargetSslProxies {
19213 inner: std::sync::Arc<dyn super::stub::dynamic::TargetSslProxies>,
19214}
19215
19216#[cfg(feature = "target-ssl-proxies")]
19217impl TargetSslProxies {
19218 /// Returns a builder for [TargetSslProxies].
19219 ///
19220 /// ```
19221 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19222 /// # use google_cloud_compute_v1::client::TargetSslProxies;
19223 /// let client = TargetSslProxies::builder().build().await?;
19224 /// # Ok(()) }
19225 /// ```
19226 pub fn builder() -> super::builder::target_ssl_proxies::ClientBuilder {
19227 crate::new_client_builder(super::builder::target_ssl_proxies::client::Factory)
19228 }
19229
19230 /// Creates a new client from the provided stub.
19231 ///
19232 /// The most common case for calling this function is in tests mocking the
19233 /// client's behavior.
19234 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19235 where
19236 T: super::stub::TargetSslProxies + 'static,
19237 {
19238 Self { inner: stub.into() }
19239 }
19240
19241 pub(crate) async fn new(
19242 config: gaxi::options::ClientConfig,
19243 ) -> crate::ClientBuilderResult<Self> {
19244 let inner = Self::build_inner(config).await?;
19245 Ok(Self { inner })
19246 }
19247
19248 async fn build_inner(
19249 conf: gaxi::options::ClientConfig,
19250 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetSslProxies>>
19251 {
19252 if gaxi::options::tracing_enabled(&conf) {
19253 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19254 }
19255 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19256 }
19257
19258 async fn build_transport(
19259 conf: gaxi::options::ClientConfig,
19260 ) -> crate::ClientBuilderResult<impl super::stub::TargetSslProxies> {
19261 super::transport::TargetSslProxies::new(conf).await
19262 }
19263
19264 async fn build_with_tracing(
19265 conf: gaxi::options::ClientConfig,
19266 ) -> crate::ClientBuilderResult<impl super::stub::TargetSslProxies> {
19267 Self::build_transport(conf)
19268 .await
19269 .map(super::tracing::TargetSslProxies::new)
19270 }
19271
19272 /// Deletes the specified TargetSslProxy resource.
19273 pub fn delete(&self) -> super::builder::target_ssl_proxies::Delete {
19274 super::builder::target_ssl_proxies::Delete::new(self.inner.clone())
19275 }
19276
19277 /// Returns the specified TargetSslProxy resource.
19278 pub fn get(&self) -> super::builder::target_ssl_proxies::Get {
19279 super::builder::target_ssl_proxies::Get::new(self.inner.clone())
19280 }
19281
19282 /// Creates a TargetSslProxy resource in the specified project using
19283 /// the data included in the request.
19284 pub fn insert(&self) -> super::builder::target_ssl_proxies::Insert {
19285 super::builder::target_ssl_proxies::Insert::new(self.inner.clone())
19286 }
19287
19288 /// Retrieves the list of TargetSslProxy resources
19289 /// available to the specified project.
19290 pub fn list(&self) -> super::builder::target_ssl_proxies::List {
19291 super::builder::target_ssl_proxies::List::new(self.inner.clone())
19292 }
19293
19294 /// Changes the BackendService for TargetSslProxy.
19295 pub fn set_backend_service(&self) -> super::builder::target_ssl_proxies::SetBackendService {
19296 super::builder::target_ssl_proxies::SetBackendService::new(self.inner.clone())
19297 }
19298
19299 /// Changes the Certificate Map for TargetSslProxy.
19300 pub fn set_certificate_map(&self) -> super::builder::target_ssl_proxies::SetCertificateMap {
19301 super::builder::target_ssl_proxies::SetCertificateMap::new(self.inner.clone())
19302 }
19303
19304 /// Changes the ProxyHeaderType for TargetSslProxy.
19305 pub fn set_proxy_header(&self) -> super::builder::target_ssl_proxies::SetProxyHeader {
19306 super::builder::target_ssl_proxies::SetProxyHeader::new(self.inner.clone())
19307 }
19308
19309 /// Changes SslCertificates for TargetSslProxy.
19310 pub fn set_ssl_certificates(&self) -> super::builder::target_ssl_proxies::SetSslCertificates {
19311 super::builder::target_ssl_proxies::SetSslCertificates::new(self.inner.clone())
19312 }
19313
19314 /// Sets the SSL policy for TargetSslProxy. The SSL policy specifies the
19315 /// server-side support for SSL features. This affects connections between
19316 /// clients and the load balancer. They do not affect the
19317 /// connection between the load balancer and the backends.
19318 pub fn set_ssl_policy(&self) -> super::builder::target_ssl_proxies::SetSslPolicy {
19319 super::builder::target_ssl_proxies::SetSslPolicy::new(self.inner.clone())
19320 }
19321
19322 /// Returns permissions that a caller has on the specified resource.
19323 pub fn test_iam_permissions(&self) -> super::builder::target_ssl_proxies::TestIamPermissions {
19324 super::builder::target_ssl_proxies::TestIamPermissions::new(self.inner.clone())
19325 }
19326
19327 /// Retrieves the specified Operations resource.
19328 pub fn get_operation(&self) -> super::builder::target_ssl_proxies::GetOperation {
19329 super::builder::target_ssl_proxies::GetOperation::new(self.inner.clone())
19330 }
19331}
19332
19333/// Implements a client for the Google Compute Engine API.
19334///
19335/// # Example
19336/// ```
19337/// # use google_cloud_compute_v1::client::TargetTcpProxies;
19338/// async fn sample(
19339/// ) -> anyhow::Result<()> {
19340/// let client = TargetTcpProxies::builder().build().await?;
19341/// // use `client` to make requests to the Google Compute Engine API.
19342/// Ok(())
19343/// }
19344/// ```
19345///
19346/// # Service Description
19347///
19348/// Service for the `targetTcpProxies` resource.
19349///
19350/// # Configuration
19351///
19352/// To configure `TargetTcpProxies` use the `with_*` methods in the type returned
19353/// by [builder()][TargetTcpProxies::builder]. The default configuration should
19354/// work for most applications. Common configuration changes include
19355///
19356/// * [with_endpoint()]: by default this client uses the global default endpoint
19357/// (`https://compute.googleapis.com`). Applications using regional
19358/// endpoints or running in restricted networks (e.g. a network configured
19359/// with [Private Google Access with VPC Service Controls]) may want to
19360/// override this default.
19361/// * [with_credentials()]: by default this client uses
19362/// [Application Default Credentials]. Applications using custom
19363/// authentication may need to override this default.
19364///
19365/// [with_endpoint()]: super::builder::target_tcp_proxies::ClientBuilder::with_endpoint
19366/// [with_credentials()]: super::builder::target_tcp_proxies::ClientBuilder::with_credentials
19367/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19368/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19369///
19370/// # Pooling and Cloning
19371///
19372/// `TargetTcpProxies` holds a connection pool internally, it is advised to
19373/// create one and reuse it. You do not need to wrap `TargetTcpProxies` in
19374/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19375/// already uses an `Arc` internally.
19376#[cfg(feature = "target-tcp-proxies")]
19377#[cfg_attr(docsrs, doc(cfg(feature = "target-tcp-proxies")))]
19378#[derive(Clone, Debug)]
19379pub struct TargetTcpProxies {
19380 inner: std::sync::Arc<dyn super::stub::dynamic::TargetTcpProxies>,
19381}
19382
19383#[cfg(feature = "target-tcp-proxies")]
19384impl TargetTcpProxies {
19385 /// Returns a builder for [TargetTcpProxies].
19386 ///
19387 /// ```
19388 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19389 /// # use google_cloud_compute_v1::client::TargetTcpProxies;
19390 /// let client = TargetTcpProxies::builder().build().await?;
19391 /// # Ok(()) }
19392 /// ```
19393 pub fn builder() -> super::builder::target_tcp_proxies::ClientBuilder {
19394 crate::new_client_builder(super::builder::target_tcp_proxies::client::Factory)
19395 }
19396
19397 /// Creates a new client from the provided stub.
19398 ///
19399 /// The most common case for calling this function is in tests mocking the
19400 /// client's behavior.
19401 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19402 where
19403 T: super::stub::TargetTcpProxies + 'static,
19404 {
19405 Self { inner: stub.into() }
19406 }
19407
19408 pub(crate) async fn new(
19409 config: gaxi::options::ClientConfig,
19410 ) -> crate::ClientBuilderResult<Self> {
19411 let inner = Self::build_inner(config).await?;
19412 Ok(Self { inner })
19413 }
19414
19415 async fn build_inner(
19416 conf: gaxi::options::ClientConfig,
19417 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetTcpProxies>>
19418 {
19419 if gaxi::options::tracing_enabled(&conf) {
19420 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19421 }
19422 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19423 }
19424
19425 async fn build_transport(
19426 conf: gaxi::options::ClientConfig,
19427 ) -> crate::ClientBuilderResult<impl super::stub::TargetTcpProxies> {
19428 super::transport::TargetTcpProxies::new(conf).await
19429 }
19430
19431 async fn build_with_tracing(
19432 conf: gaxi::options::ClientConfig,
19433 ) -> crate::ClientBuilderResult<impl super::stub::TargetTcpProxies> {
19434 Self::build_transport(conf)
19435 .await
19436 .map(super::tracing::TargetTcpProxies::new)
19437 }
19438
19439 /// Retrieves the list of all TargetTcpProxy resources, regional and global,
19440 /// available to the specified project.
19441 ///
19442 /// To prevent failure, Google recommends that you set the
19443 /// `returnPartialSuccess` parameter to `true`.
19444 pub fn aggregated_list(&self) -> super::builder::target_tcp_proxies::AggregatedList {
19445 super::builder::target_tcp_proxies::AggregatedList::new(self.inner.clone())
19446 }
19447
19448 /// Deletes the specified TargetTcpProxy resource.
19449 pub fn delete(&self) -> super::builder::target_tcp_proxies::Delete {
19450 super::builder::target_tcp_proxies::Delete::new(self.inner.clone())
19451 }
19452
19453 /// Returns the specified TargetTcpProxy resource.
19454 pub fn get(&self) -> super::builder::target_tcp_proxies::Get {
19455 super::builder::target_tcp_proxies::Get::new(self.inner.clone())
19456 }
19457
19458 /// Creates a TargetTcpProxy resource in the specified project using
19459 /// the data included in the request.
19460 pub fn insert(&self) -> super::builder::target_tcp_proxies::Insert {
19461 super::builder::target_tcp_proxies::Insert::new(self.inner.clone())
19462 }
19463
19464 /// Retrieves the list of TargetTcpProxy resources
19465 /// available to the specified project.
19466 pub fn list(&self) -> super::builder::target_tcp_proxies::List {
19467 super::builder::target_tcp_proxies::List::new(self.inner.clone())
19468 }
19469
19470 /// Changes the BackendService for TargetTcpProxy.
19471 pub fn set_backend_service(&self) -> super::builder::target_tcp_proxies::SetBackendService {
19472 super::builder::target_tcp_proxies::SetBackendService::new(self.inner.clone())
19473 }
19474
19475 /// Changes the ProxyHeaderType for TargetTcpProxy.
19476 pub fn set_proxy_header(&self) -> super::builder::target_tcp_proxies::SetProxyHeader {
19477 super::builder::target_tcp_proxies::SetProxyHeader::new(self.inner.clone())
19478 }
19479
19480 /// Returns permissions that a caller has on the specified resource.
19481 pub fn test_iam_permissions(&self) -> super::builder::target_tcp_proxies::TestIamPermissions {
19482 super::builder::target_tcp_proxies::TestIamPermissions::new(self.inner.clone())
19483 }
19484
19485 /// Retrieves the specified Operations resource.
19486 pub fn get_operation(&self) -> super::builder::target_tcp_proxies::GetOperation {
19487 super::builder::target_tcp_proxies::GetOperation::new(self.inner.clone())
19488 }
19489}
19490
19491/// Implements a client for the Google Compute Engine API.
19492///
19493/// # Example
19494/// ```
19495/// # use google_cloud_compute_v1::client::TargetVpnGateways;
19496/// async fn sample(
19497/// ) -> anyhow::Result<()> {
19498/// let client = TargetVpnGateways::builder().build().await?;
19499/// // use `client` to make requests to the Google Compute Engine API.
19500/// Ok(())
19501/// }
19502/// ```
19503///
19504/// # Service Description
19505///
19506/// Service for the `targetVpnGateways` resource.
19507///
19508/// # Configuration
19509///
19510/// To configure `TargetVpnGateways` use the `with_*` methods in the type returned
19511/// by [builder()][TargetVpnGateways::builder]. The default configuration should
19512/// work for most applications. Common configuration changes include
19513///
19514/// * [with_endpoint()]: by default this client uses the global default endpoint
19515/// (`https://compute.googleapis.com`). Applications using regional
19516/// endpoints or running in restricted networks (e.g. a network configured
19517/// with [Private Google Access with VPC Service Controls]) may want to
19518/// override this default.
19519/// * [with_credentials()]: by default this client uses
19520/// [Application Default Credentials]. Applications using custom
19521/// authentication may need to override this default.
19522///
19523/// [with_endpoint()]: super::builder::target_vpn_gateways::ClientBuilder::with_endpoint
19524/// [with_credentials()]: super::builder::target_vpn_gateways::ClientBuilder::with_credentials
19525/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19526/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19527///
19528/// # Pooling and Cloning
19529///
19530/// `TargetVpnGateways` holds a connection pool internally, it is advised to
19531/// create one and reuse it. You do not need to wrap `TargetVpnGateways` in
19532/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19533/// already uses an `Arc` internally.
19534#[cfg(feature = "target-vpn-gateways")]
19535#[cfg_attr(docsrs, doc(cfg(feature = "target-vpn-gateways")))]
19536#[derive(Clone, Debug)]
19537pub struct TargetVpnGateways {
19538 inner: std::sync::Arc<dyn super::stub::dynamic::TargetVpnGateways>,
19539}
19540
19541#[cfg(feature = "target-vpn-gateways")]
19542impl TargetVpnGateways {
19543 /// Returns a builder for [TargetVpnGateways].
19544 ///
19545 /// ```
19546 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19547 /// # use google_cloud_compute_v1::client::TargetVpnGateways;
19548 /// let client = TargetVpnGateways::builder().build().await?;
19549 /// # Ok(()) }
19550 /// ```
19551 pub fn builder() -> super::builder::target_vpn_gateways::ClientBuilder {
19552 crate::new_client_builder(super::builder::target_vpn_gateways::client::Factory)
19553 }
19554
19555 /// Creates a new client from the provided stub.
19556 ///
19557 /// The most common case for calling this function is in tests mocking the
19558 /// client's behavior.
19559 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19560 where
19561 T: super::stub::TargetVpnGateways + 'static,
19562 {
19563 Self { inner: stub.into() }
19564 }
19565
19566 pub(crate) async fn new(
19567 config: gaxi::options::ClientConfig,
19568 ) -> crate::ClientBuilderResult<Self> {
19569 let inner = Self::build_inner(config).await?;
19570 Ok(Self { inner })
19571 }
19572
19573 async fn build_inner(
19574 conf: gaxi::options::ClientConfig,
19575 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetVpnGateways>>
19576 {
19577 if gaxi::options::tracing_enabled(&conf) {
19578 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19579 }
19580 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19581 }
19582
19583 async fn build_transport(
19584 conf: gaxi::options::ClientConfig,
19585 ) -> crate::ClientBuilderResult<impl super::stub::TargetVpnGateways> {
19586 super::transport::TargetVpnGateways::new(conf).await
19587 }
19588
19589 async fn build_with_tracing(
19590 conf: gaxi::options::ClientConfig,
19591 ) -> crate::ClientBuilderResult<impl super::stub::TargetVpnGateways> {
19592 Self::build_transport(conf)
19593 .await
19594 .map(super::tracing::TargetVpnGateways::new)
19595 }
19596
19597 /// Retrieves an aggregated list of target VPN gateways.
19598 ///
19599 /// To prevent failure, Google recommends that you set the
19600 /// `returnPartialSuccess` parameter to `true`.
19601 pub fn aggregated_list(&self) -> super::builder::target_vpn_gateways::AggregatedList {
19602 super::builder::target_vpn_gateways::AggregatedList::new(self.inner.clone())
19603 }
19604
19605 /// Deletes the specified target VPN gateway.
19606 pub fn delete(&self) -> super::builder::target_vpn_gateways::Delete {
19607 super::builder::target_vpn_gateways::Delete::new(self.inner.clone())
19608 }
19609
19610 /// Returns the specified target VPN gateway.
19611 pub fn get(&self) -> super::builder::target_vpn_gateways::Get {
19612 super::builder::target_vpn_gateways::Get::new(self.inner.clone())
19613 }
19614
19615 /// Creates a target VPN gateway in the specified project and region using
19616 /// the data included in the request.
19617 pub fn insert(&self) -> super::builder::target_vpn_gateways::Insert {
19618 super::builder::target_vpn_gateways::Insert::new(self.inner.clone())
19619 }
19620
19621 /// Retrieves a list of target VPN gateways available to the specified
19622 /// project and region.
19623 pub fn list(&self) -> super::builder::target_vpn_gateways::List {
19624 super::builder::target_vpn_gateways::List::new(self.inner.clone())
19625 }
19626
19627 /// Sets the labels on a TargetVpnGateway. To learn more about labels, read theLabeling
19628 /// Resources documentation.
19629 pub fn set_labels(&self) -> super::builder::target_vpn_gateways::SetLabels {
19630 super::builder::target_vpn_gateways::SetLabels::new(self.inner.clone())
19631 }
19632
19633 /// Retrieves the specified region-specific Operations resource.
19634 pub fn get_operation(&self) -> super::builder::target_vpn_gateways::GetOperation {
19635 super::builder::target_vpn_gateways::GetOperation::new(self.inner.clone())
19636 }
19637}
19638
19639/// Implements a client for the Google Compute Engine API.
19640///
19641/// # Example
19642/// ```
19643/// # use google_cloud_compute_v1::client::UrlMaps;
19644/// async fn sample(
19645/// ) -> anyhow::Result<()> {
19646/// let client = UrlMaps::builder().build().await?;
19647/// // use `client` to make requests to the Google Compute Engine API.
19648/// Ok(())
19649/// }
19650/// ```
19651///
19652/// # Service Description
19653///
19654/// Service for the `urlMaps` resource.
19655///
19656/// # Configuration
19657///
19658/// To configure `UrlMaps` use the `with_*` methods in the type returned
19659/// by [builder()][UrlMaps::builder]. The default configuration should
19660/// work for most applications. Common configuration changes include
19661///
19662/// * [with_endpoint()]: by default this client uses the global default endpoint
19663/// (`https://compute.googleapis.com`). Applications using regional
19664/// endpoints or running in restricted networks (e.g. a network configured
19665/// with [Private Google Access with VPC Service Controls]) may want to
19666/// override this default.
19667/// * [with_credentials()]: by default this client uses
19668/// [Application Default Credentials]. Applications using custom
19669/// authentication may need to override this default.
19670///
19671/// [with_endpoint()]: super::builder::url_maps::ClientBuilder::with_endpoint
19672/// [with_credentials()]: super::builder::url_maps::ClientBuilder::with_credentials
19673/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19674/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19675///
19676/// # Pooling and Cloning
19677///
19678/// `UrlMaps` holds a connection pool internally, it is advised to
19679/// create one and reuse it. You do not need to wrap `UrlMaps` in
19680/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19681/// already uses an `Arc` internally.
19682#[cfg(feature = "url-maps")]
19683#[cfg_attr(docsrs, doc(cfg(feature = "url-maps")))]
19684#[derive(Clone, Debug)]
19685pub struct UrlMaps {
19686 inner: std::sync::Arc<dyn super::stub::dynamic::UrlMaps>,
19687}
19688
19689#[cfg(feature = "url-maps")]
19690impl UrlMaps {
19691 /// Returns a builder for [UrlMaps].
19692 ///
19693 /// ```
19694 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19695 /// # use google_cloud_compute_v1::client::UrlMaps;
19696 /// let client = UrlMaps::builder().build().await?;
19697 /// # Ok(()) }
19698 /// ```
19699 pub fn builder() -> super::builder::url_maps::ClientBuilder {
19700 crate::new_client_builder(super::builder::url_maps::client::Factory)
19701 }
19702
19703 /// Creates a new client from the provided stub.
19704 ///
19705 /// The most common case for calling this function is in tests mocking the
19706 /// client's behavior.
19707 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19708 where
19709 T: super::stub::UrlMaps + 'static,
19710 {
19711 Self { inner: stub.into() }
19712 }
19713
19714 pub(crate) async fn new(
19715 config: gaxi::options::ClientConfig,
19716 ) -> crate::ClientBuilderResult<Self> {
19717 let inner = Self::build_inner(config).await?;
19718 Ok(Self { inner })
19719 }
19720
19721 async fn build_inner(
19722 conf: gaxi::options::ClientConfig,
19723 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::UrlMaps>> {
19724 if gaxi::options::tracing_enabled(&conf) {
19725 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19726 }
19727 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19728 }
19729
19730 async fn build_transport(
19731 conf: gaxi::options::ClientConfig,
19732 ) -> crate::ClientBuilderResult<impl super::stub::UrlMaps> {
19733 super::transport::UrlMaps::new(conf).await
19734 }
19735
19736 async fn build_with_tracing(
19737 conf: gaxi::options::ClientConfig,
19738 ) -> crate::ClientBuilderResult<impl super::stub::UrlMaps> {
19739 Self::build_transport(conf)
19740 .await
19741 .map(super::tracing::UrlMaps::new)
19742 }
19743
19744 /// Retrieves the list of all UrlMap resources, regional and global,
19745 /// available to the specified project.
19746 ///
19747 /// To prevent failure, Google recommends that you set the
19748 /// `returnPartialSuccess` parameter to `true`.
19749 pub fn aggregated_list(&self) -> super::builder::url_maps::AggregatedList {
19750 super::builder::url_maps::AggregatedList::new(self.inner.clone())
19751 }
19752
19753 /// Deletes the specified UrlMap resource.
19754 pub fn delete(&self) -> super::builder::url_maps::Delete {
19755 super::builder::url_maps::Delete::new(self.inner.clone())
19756 }
19757
19758 /// Returns the specified UrlMap resource.
19759 pub fn get(&self) -> super::builder::url_maps::Get {
19760 super::builder::url_maps::Get::new(self.inner.clone())
19761 }
19762
19763 /// Creates a UrlMap resource in the specified project using
19764 /// the data included in the request.
19765 pub fn insert(&self) -> super::builder::url_maps::Insert {
19766 super::builder::url_maps::Insert::new(self.inner.clone())
19767 }
19768
19769 /// Initiates a cache invalidation operation, invalidating the specified path,
19770 /// scoped to the specified UrlMap.
19771 ///
19772 /// For more information, see [Invalidating cached
19773 /// content](/cdn/docs/invalidating-cached-content).
19774 pub fn invalidate_cache(&self) -> super::builder::url_maps::InvalidateCache {
19775 super::builder::url_maps::InvalidateCache::new(self.inner.clone())
19776 }
19777
19778 /// Retrieves the list of UrlMap resources available to the specified
19779 /// project.
19780 pub fn list(&self) -> super::builder::url_maps::List {
19781 super::builder::url_maps::List::new(self.inner.clone())
19782 }
19783
19784 /// Patches the specified UrlMap resource with the data included in the
19785 /// request. This method supportsPATCH
19786 /// semantics and uses theJSON merge
19787 /// patch format and processing rules.
19788 pub fn patch(&self) -> super::builder::url_maps::Patch {
19789 super::builder::url_maps::Patch::new(self.inner.clone())
19790 }
19791
19792 /// Returns permissions that a caller has on the specified resource.
19793 pub fn test_iam_permissions(&self) -> super::builder::url_maps::TestIamPermissions {
19794 super::builder::url_maps::TestIamPermissions::new(self.inner.clone())
19795 }
19796
19797 /// Updates the specified UrlMap resource with the data included in the
19798 /// request.
19799 pub fn update(&self) -> super::builder::url_maps::Update {
19800 super::builder::url_maps::Update::new(self.inner.clone())
19801 }
19802
19803 /// Runs static validation for the UrlMap. In particular, the tests of the
19804 /// provided UrlMap will be run. Calling this method does NOT create the
19805 /// UrlMap.
19806 pub fn validate(&self) -> super::builder::url_maps::Validate {
19807 super::builder::url_maps::Validate::new(self.inner.clone())
19808 }
19809
19810 /// Retrieves the specified Operations resource.
19811 pub fn get_operation(&self) -> super::builder::url_maps::GetOperation {
19812 super::builder::url_maps::GetOperation::new(self.inner.clone())
19813 }
19814}
19815
19816/// Implements a client for the Google Compute Engine API.
19817///
19818/// # Example
19819/// ```
19820/// # use google_cloud_compute_v1::client::VpnGateways;
19821/// async fn sample(
19822/// ) -> anyhow::Result<()> {
19823/// let client = VpnGateways::builder().build().await?;
19824/// // use `client` to make requests to the Google Compute Engine API.
19825/// Ok(())
19826/// }
19827/// ```
19828///
19829/// # Service Description
19830///
19831/// Service for the `vpnGateways` resource.
19832///
19833/// # Configuration
19834///
19835/// To configure `VpnGateways` use the `with_*` methods in the type returned
19836/// by [builder()][VpnGateways::builder]. The default configuration should
19837/// work for most applications. Common configuration changes include
19838///
19839/// * [with_endpoint()]: by default this client uses the global default endpoint
19840/// (`https://compute.googleapis.com`). Applications using regional
19841/// endpoints or running in restricted networks (e.g. a network configured
19842/// with [Private Google Access with VPC Service Controls]) may want to
19843/// override this default.
19844/// * [with_credentials()]: by default this client uses
19845/// [Application Default Credentials]. Applications using custom
19846/// authentication may need to override this default.
19847///
19848/// [with_endpoint()]: super::builder::vpn_gateways::ClientBuilder::with_endpoint
19849/// [with_credentials()]: super::builder::vpn_gateways::ClientBuilder::with_credentials
19850/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19851/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19852///
19853/// # Pooling and Cloning
19854///
19855/// `VpnGateways` holds a connection pool internally, it is advised to
19856/// create one and reuse it. You do not need to wrap `VpnGateways` in
19857/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19858/// already uses an `Arc` internally.
19859#[cfg(feature = "vpn-gateways")]
19860#[cfg_attr(docsrs, doc(cfg(feature = "vpn-gateways")))]
19861#[derive(Clone, Debug)]
19862pub struct VpnGateways {
19863 inner: std::sync::Arc<dyn super::stub::dynamic::VpnGateways>,
19864}
19865
19866#[cfg(feature = "vpn-gateways")]
19867impl VpnGateways {
19868 /// Returns a builder for [VpnGateways].
19869 ///
19870 /// ```
19871 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19872 /// # use google_cloud_compute_v1::client::VpnGateways;
19873 /// let client = VpnGateways::builder().build().await?;
19874 /// # Ok(()) }
19875 /// ```
19876 pub fn builder() -> super::builder::vpn_gateways::ClientBuilder {
19877 crate::new_client_builder(super::builder::vpn_gateways::client::Factory)
19878 }
19879
19880 /// Creates a new client from the provided stub.
19881 ///
19882 /// The most common case for calling this function is in tests mocking the
19883 /// client's behavior.
19884 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19885 where
19886 T: super::stub::VpnGateways + 'static,
19887 {
19888 Self { inner: stub.into() }
19889 }
19890
19891 pub(crate) async fn new(
19892 config: gaxi::options::ClientConfig,
19893 ) -> crate::ClientBuilderResult<Self> {
19894 let inner = Self::build_inner(config).await?;
19895 Ok(Self { inner })
19896 }
19897
19898 async fn build_inner(
19899 conf: gaxi::options::ClientConfig,
19900 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VpnGateways>> {
19901 if gaxi::options::tracing_enabled(&conf) {
19902 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19903 }
19904 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19905 }
19906
19907 async fn build_transport(
19908 conf: gaxi::options::ClientConfig,
19909 ) -> crate::ClientBuilderResult<impl super::stub::VpnGateways> {
19910 super::transport::VpnGateways::new(conf).await
19911 }
19912
19913 async fn build_with_tracing(
19914 conf: gaxi::options::ClientConfig,
19915 ) -> crate::ClientBuilderResult<impl super::stub::VpnGateways> {
19916 Self::build_transport(conf)
19917 .await
19918 .map(super::tracing::VpnGateways::new)
19919 }
19920
19921 /// Retrieves an aggregated list of VPN gateways.
19922 ///
19923 /// To prevent failure, Google recommends that you set the
19924 /// `returnPartialSuccess` parameter to `true`.
19925 pub fn aggregated_list(&self) -> super::builder::vpn_gateways::AggregatedList {
19926 super::builder::vpn_gateways::AggregatedList::new(self.inner.clone())
19927 }
19928
19929 /// Deletes the specified VPN gateway.
19930 pub fn delete(&self) -> super::builder::vpn_gateways::Delete {
19931 super::builder::vpn_gateways::Delete::new(self.inner.clone())
19932 }
19933
19934 /// Returns the specified VPN gateway.
19935 pub fn get(&self) -> super::builder::vpn_gateways::Get {
19936 super::builder::vpn_gateways::Get::new(self.inner.clone())
19937 }
19938
19939 /// Returns the status for the specified VPN gateway.
19940 pub fn get_status(&self) -> super::builder::vpn_gateways::GetStatus {
19941 super::builder::vpn_gateways::GetStatus::new(self.inner.clone())
19942 }
19943
19944 /// Creates a VPN gateway in the specified project and region using
19945 /// the data included in the request.
19946 pub fn insert(&self) -> super::builder::vpn_gateways::Insert {
19947 super::builder::vpn_gateways::Insert::new(self.inner.clone())
19948 }
19949
19950 /// Retrieves a list of VPN gateways available to the specified
19951 /// project and region.
19952 pub fn list(&self) -> super::builder::vpn_gateways::List {
19953 super::builder::vpn_gateways::List::new(self.inner.clone())
19954 }
19955
19956 /// Sets the labels on a VpnGateway. To learn more about labels, read theLabeling
19957 /// Resources documentation.
19958 pub fn set_labels(&self) -> super::builder::vpn_gateways::SetLabels {
19959 super::builder::vpn_gateways::SetLabels::new(self.inner.clone())
19960 }
19961
19962 /// Returns permissions that a caller has on the specified resource.
19963 pub fn test_iam_permissions(&self) -> super::builder::vpn_gateways::TestIamPermissions {
19964 super::builder::vpn_gateways::TestIamPermissions::new(self.inner.clone())
19965 }
19966
19967 /// Retrieves the specified region-specific Operations resource.
19968 pub fn get_operation(&self) -> super::builder::vpn_gateways::GetOperation {
19969 super::builder::vpn_gateways::GetOperation::new(self.inner.clone())
19970 }
19971}
19972
19973/// Implements a client for the Google Compute Engine API.
19974///
19975/// # Example
19976/// ```
19977/// # use google_cloud_compute_v1::client::VpnTunnels;
19978/// async fn sample(
19979/// ) -> anyhow::Result<()> {
19980/// let client = VpnTunnels::builder().build().await?;
19981/// // use `client` to make requests to the Google Compute Engine API.
19982/// Ok(())
19983/// }
19984/// ```
19985///
19986/// # Service Description
19987///
19988/// Service for the `vpnTunnels` resource.
19989///
19990/// # Configuration
19991///
19992/// To configure `VpnTunnels` use the `with_*` methods in the type returned
19993/// by [builder()][VpnTunnels::builder]. The default configuration should
19994/// work for most applications. Common configuration changes include
19995///
19996/// * [with_endpoint()]: by default this client uses the global default endpoint
19997/// (`https://compute.googleapis.com`). Applications using regional
19998/// endpoints or running in restricted networks (e.g. a network configured
19999/// with [Private Google Access with VPC Service Controls]) may want to
20000/// override this default.
20001/// * [with_credentials()]: by default this client uses
20002/// [Application Default Credentials]. Applications using custom
20003/// authentication may need to override this default.
20004///
20005/// [with_endpoint()]: super::builder::vpn_tunnels::ClientBuilder::with_endpoint
20006/// [with_credentials()]: super::builder::vpn_tunnels::ClientBuilder::with_credentials
20007/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20008/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20009///
20010/// # Pooling and Cloning
20011///
20012/// `VpnTunnels` holds a connection pool internally, it is advised to
20013/// create one and reuse it. You do not need to wrap `VpnTunnels` in
20014/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20015/// already uses an `Arc` internally.
20016#[cfg(feature = "vpn-tunnels")]
20017#[cfg_attr(docsrs, doc(cfg(feature = "vpn-tunnels")))]
20018#[derive(Clone, Debug)]
20019pub struct VpnTunnels {
20020 inner: std::sync::Arc<dyn super::stub::dynamic::VpnTunnels>,
20021}
20022
20023#[cfg(feature = "vpn-tunnels")]
20024impl VpnTunnels {
20025 /// Returns a builder for [VpnTunnels].
20026 ///
20027 /// ```
20028 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20029 /// # use google_cloud_compute_v1::client::VpnTunnels;
20030 /// let client = VpnTunnels::builder().build().await?;
20031 /// # Ok(()) }
20032 /// ```
20033 pub fn builder() -> super::builder::vpn_tunnels::ClientBuilder {
20034 crate::new_client_builder(super::builder::vpn_tunnels::client::Factory)
20035 }
20036
20037 /// Creates a new client from the provided stub.
20038 ///
20039 /// The most common case for calling this function is in tests mocking the
20040 /// client's behavior.
20041 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20042 where
20043 T: super::stub::VpnTunnels + 'static,
20044 {
20045 Self { inner: stub.into() }
20046 }
20047
20048 pub(crate) async fn new(
20049 config: gaxi::options::ClientConfig,
20050 ) -> crate::ClientBuilderResult<Self> {
20051 let inner = Self::build_inner(config).await?;
20052 Ok(Self { inner })
20053 }
20054
20055 async fn build_inner(
20056 conf: gaxi::options::ClientConfig,
20057 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VpnTunnels>> {
20058 if gaxi::options::tracing_enabled(&conf) {
20059 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20060 }
20061 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20062 }
20063
20064 async fn build_transport(
20065 conf: gaxi::options::ClientConfig,
20066 ) -> crate::ClientBuilderResult<impl super::stub::VpnTunnels> {
20067 super::transport::VpnTunnels::new(conf).await
20068 }
20069
20070 async fn build_with_tracing(
20071 conf: gaxi::options::ClientConfig,
20072 ) -> crate::ClientBuilderResult<impl super::stub::VpnTunnels> {
20073 Self::build_transport(conf)
20074 .await
20075 .map(super::tracing::VpnTunnels::new)
20076 }
20077
20078 /// Retrieves an aggregated list of VPN tunnels.
20079 ///
20080 /// To prevent failure, Google recommends that you set the
20081 /// `returnPartialSuccess` parameter to `true`.
20082 pub fn aggregated_list(&self) -> super::builder::vpn_tunnels::AggregatedList {
20083 super::builder::vpn_tunnels::AggregatedList::new(self.inner.clone())
20084 }
20085
20086 /// Deletes the specified VpnTunnel resource.
20087 pub fn delete(&self) -> super::builder::vpn_tunnels::Delete {
20088 super::builder::vpn_tunnels::Delete::new(self.inner.clone())
20089 }
20090
20091 /// Returns the specified VpnTunnel resource.
20092 pub fn get(&self) -> super::builder::vpn_tunnels::Get {
20093 super::builder::vpn_tunnels::Get::new(self.inner.clone())
20094 }
20095
20096 /// Creates a VpnTunnel resource in the specified project and region using
20097 /// the data included in the request.
20098 pub fn insert(&self) -> super::builder::vpn_tunnels::Insert {
20099 super::builder::vpn_tunnels::Insert::new(self.inner.clone())
20100 }
20101
20102 /// Retrieves a list of VpnTunnel resources contained in the specified
20103 /// project and region.
20104 pub fn list(&self) -> super::builder::vpn_tunnels::List {
20105 super::builder::vpn_tunnels::List::new(self.inner.clone())
20106 }
20107
20108 /// Sets the labels on a VpnTunnel. To learn more about labels, read theLabeling
20109 /// Resources documentation.
20110 pub fn set_labels(&self) -> super::builder::vpn_tunnels::SetLabels {
20111 super::builder::vpn_tunnels::SetLabels::new(self.inner.clone())
20112 }
20113
20114 /// Retrieves the specified region-specific Operations resource.
20115 pub fn get_operation(&self) -> super::builder::vpn_tunnels::GetOperation {
20116 super::builder::vpn_tunnels::GetOperation::new(self.inner.clone())
20117 }
20118}
20119
20120/// Implements a client for the Google Compute Engine API.
20121///
20122/// # Example
20123/// ```
20124/// # use google_cloud_compute_v1::client::WireGroups;
20125/// async fn sample(
20126/// ) -> anyhow::Result<()> {
20127/// let client = WireGroups::builder().build().await?;
20128/// // use `client` to make requests to the Google Compute Engine API.
20129/// Ok(())
20130/// }
20131/// ```
20132///
20133/// # Service Description
20134///
20135/// Service for the `wireGroups` resource.
20136///
20137/// # Configuration
20138///
20139/// To configure `WireGroups` use the `with_*` methods in the type returned
20140/// by [builder()][WireGroups::builder]. The default configuration should
20141/// work for most applications. Common configuration changes include
20142///
20143/// * [with_endpoint()]: by default this client uses the global default endpoint
20144/// (`https://compute.googleapis.com`). Applications using regional
20145/// endpoints or running in restricted networks (e.g. a network configured
20146/// with [Private Google Access with VPC Service Controls]) may want to
20147/// override this default.
20148/// * [with_credentials()]: by default this client uses
20149/// [Application Default Credentials]. Applications using custom
20150/// authentication may need to override this default.
20151///
20152/// [with_endpoint()]: super::builder::wire_groups::ClientBuilder::with_endpoint
20153/// [with_credentials()]: super::builder::wire_groups::ClientBuilder::with_credentials
20154/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20155/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20156///
20157/// # Pooling and Cloning
20158///
20159/// `WireGroups` holds a connection pool internally, it is advised to
20160/// create one and reuse it. You do not need to wrap `WireGroups` in
20161/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20162/// already uses an `Arc` internally.
20163#[cfg(feature = "wire-groups")]
20164#[cfg_attr(docsrs, doc(cfg(feature = "wire-groups")))]
20165#[derive(Clone, Debug)]
20166pub struct WireGroups {
20167 inner: std::sync::Arc<dyn super::stub::dynamic::WireGroups>,
20168}
20169
20170#[cfg(feature = "wire-groups")]
20171impl WireGroups {
20172 /// Returns a builder for [WireGroups].
20173 ///
20174 /// ```
20175 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20176 /// # use google_cloud_compute_v1::client::WireGroups;
20177 /// let client = WireGroups::builder().build().await?;
20178 /// # Ok(()) }
20179 /// ```
20180 pub fn builder() -> super::builder::wire_groups::ClientBuilder {
20181 crate::new_client_builder(super::builder::wire_groups::client::Factory)
20182 }
20183
20184 /// Creates a new client from the provided stub.
20185 ///
20186 /// The most common case for calling this function is in tests mocking the
20187 /// client's behavior.
20188 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20189 where
20190 T: super::stub::WireGroups + 'static,
20191 {
20192 Self { inner: stub.into() }
20193 }
20194
20195 pub(crate) async fn new(
20196 config: gaxi::options::ClientConfig,
20197 ) -> crate::ClientBuilderResult<Self> {
20198 let inner = Self::build_inner(config).await?;
20199 Ok(Self { inner })
20200 }
20201
20202 async fn build_inner(
20203 conf: gaxi::options::ClientConfig,
20204 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::WireGroups>> {
20205 if gaxi::options::tracing_enabled(&conf) {
20206 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20207 }
20208 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20209 }
20210
20211 async fn build_transport(
20212 conf: gaxi::options::ClientConfig,
20213 ) -> crate::ClientBuilderResult<impl super::stub::WireGroups> {
20214 super::transport::WireGroups::new(conf).await
20215 }
20216
20217 async fn build_with_tracing(
20218 conf: gaxi::options::ClientConfig,
20219 ) -> crate::ClientBuilderResult<impl super::stub::WireGroups> {
20220 Self::build_transport(conf)
20221 .await
20222 .map(super::tracing::WireGroups::new)
20223 }
20224
20225 /// Deletes the specified wire group in the given scope.
20226 pub fn delete(&self) -> super::builder::wire_groups::Delete {
20227 super::builder::wire_groups::Delete::new(self.inner.clone())
20228 }
20229
20230 /// Gets the specified wire group resource in the given scope.
20231 pub fn get(&self) -> super::builder::wire_groups::Get {
20232 super::builder::wire_groups::Get::new(self.inner.clone())
20233 }
20234
20235 /// Creates a wire group in the specified project in the given scope
20236 /// using the parameters that are included in the request.
20237 pub fn insert(&self) -> super::builder::wire_groups::Insert {
20238 super::builder::wire_groups::Insert::new(self.inner.clone())
20239 }
20240
20241 /// Lists the wire groups for a project in the given scope.
20242 pub fn list(&self) -> super::builder::wire_groups::List {
20243 super::builder::wire_groups::List::new(self.inner.clone())
20244 }
20245
20246 /// Updates the specified wire group resource with the data included in the
20247 /// request. This method supportsPATCH
20248 /// semantics and usesJSON merge
20249 /// patch format and processing rules.
20250 pub fn patch(&self) -> super::builder::wire_groups::Patch {
20251 super::builder::wire_groups::Patch::new(self.inner.clone())
20252 }
20253
20254 /// Retrieves the specified Operations resource.
20255 pub fn get_operation(&self) -> super::builder::wire_groups::GetOperation {
20256 super::builder::wire_groups::GetOperation::new(self.inner.clone())
20257 }
20258}
20259
20260/// Implements a client for the Google Compute Engine API.
20261///
20262/// # Example
20263/// ```
20264/// # use google_cloud_compute_v1::client::ZoneOperations;
20265/// async fn sample(
20266/// ) -> anyhow::Result<()> {
20267/// let client = ZoneOperations::builder().build().await?;
20268/// // use `client` to make requests to the Google Compute Engine API.
20269/// Ok(())
20270/// }
20271/// ```
20272///
20273/// # Service Description
20274///
20275/// Service for the `zoneOperations` resource.
20276///
20277/// # Configuration
20278///
20279/// To configure `ZoneOperations` use the `with_*` methods in the type returned
20280/// by [builder()][ZoneOperations::builder]. The default configuration should
20281/// work for most applications. Common configuration changes include
20282///
20283/// * [with_endpoint()]: by default this client uses the global default endpoint
20284/// (`https://compute.googleapis.com`). Applications using regional
20285/// endpoints or running in restricted networks (e.g. a network configured
20286/// with [Private Google Access with VPC Service Controls]) may want to
20287/// override this default.
20288/// * [with_credentials()]: by default this client uses
20289/// [Application Default Credentials]. Applications using custom
20290/// authentication may need to override this default.
20291///
20292/// [with_endpoint()]: super::builder::zone_operations::ClientBuilder::with_endpoint
20293/// [with_credentials()]: super::builder::zone_operations::ClientBuilder::with_credentials
20294/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20295/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20296///
20297/// # Pooling and Cloning
20298///
20299/// `ZoneOperations` holds a connection pool internally, it is advised to
20300/// create one and reuse it. You do not need to wrap `ZoneOperations` in
20301/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20302/// already uses an `Arc` internally.
20303#[cfg(feature = "zone-operations")]
20304#[cfg_attr(docsrs, doc(cfg(feature = "zone-operations")))]
20305#[derive(Clone, Debug)]
20306pub struct ZoneOperations {
20307 inner: std::sync::Arc<dyn super::stub::dynamic::ZoneOperations>,
20308}
20309
20310#[cfg(feature = "zone-operations")]
20311impl ZoneOperations {
20312 /// Returns a builder for [ZoneOperations].
20313 ///
20314 /// ```
20315 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20316 /// # use google_cloud_compute_v1::client::ZoneOperations;
20317 /// let client = ZoneOperations::builder().build().await?;
20318 /// # Ok(()) }
20319 /// ```
20320 pub fn builder() -> super::builder::zone_operations::ClientBuilder {
20321 crate::new_client_builder(super::builder::zone_operations::client::Factory)
20322 }
20323
20324 /// Creates a new client from the provided stub.
20325 ///
20326 /// The most common case for calling this function is in tests mocking the
20327 /// client's behavior.
20328 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20329 where
20330 T: super::stub::ZoneOperations + 'static,
20331 {
20332 Self { inner: stub.into() }
20333 }
20334
20335 pub(crate) async fn new(
20336 config: gaxi::options::ClientConfig,
20337 ) -> crate::ClientBuilderResult<Self> {
20338 let inner = Self::build_inner(config).await?;
20339 Ok(Self { inner })
20340 }
20341
20342 async fn build_inner(
20343 conf: gaxi::options::ClientConfig,
20344 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ZoneOperations>> {
20345 if gaxi::options::tracing_enabled(&conf) {
20346 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20347 }
20348 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20349 }
20350
20351 async fn build_transport(
20352 conf: gaxi::options::ClientConfig,
20353 ) -> crate::ClientBuilderResult<impl super::stub::ZoneOperations> {
20354 super::transport::ZoneOperations::new(conf).await
20355 }
20356
20357 async fn build_with_tracing(
20358 conf: gaxi::options::ClientConfig,
20359 ) -> crate::ClientBuilderResult<impl super::stub::ZoneOperations> {
20360 Self::build_transport(conf)
20361 .await
20362 .map(super::tracing::ZoneOperations::new)
20363 }
20364
20365 /// Deletes the specified zone-specific Operations resource.
20366 pub fn delete(&self) -> super::builder::zone_operations::Delete {
20367 super::builder::zone_operations::Delete::new(self.inner.clone())
20368 }
20369
20370 /// Retrieves the specified zone-specific Operations resource.
20371 pub fn get(&self) -> super::builder::zone_operations::Get {
20372 super::builder::zone_operations::Get::new(self.inner.clone())
20373 }
20374
20375 /// Retrieves a list of Operation resources contained within
20376 /// the specified zone.
20377 pub fn list(&self) -> super::builder::zone_operations::List {
20378 super::builder::zone_operations::List::new(self.inner.clone())
20379 }
20380
20381 /// Waits for the specified Operation resource to return as `DONE`
20382 /// or for the request to approach the 2 minute deadline, and retrieves the
20383 /// specified Operation resource. This method waits for no more than the
20384 /// 2 minutes and then returns the current state of the
20385 /// operation, which might be `DONE` or still in progress.
20386 ///
20387 /// This method is called on a best-effort basis. Specifically:
20388 ///
20389 /// ```norust
20390 /// - In uncommon cases, when the server is overloaded, the request might
20391 /// return before the default deadline is reached, or might return after zero
20392 /// seconds.
20393 /// ```
20394 ///
20395 /// - If the default deadline is reached, there is no guarantee that the
20396 /// operation is actually done when the method returns. Be prepared to retry
20397 /// if the operation is not `DONE`.
20398 pub fn wait(&self) -> super::builder::zone_operations::Wait {
20399 super::builder::zone_operations::Wait::new(self.inner.clone())
20400 }
20401}
20402
20403/// Implements a client for the Google Compute Engine API.
20404///
20405/// # Example
20406/// ```
20407/// # use google_cloud_compute_v1::client::ZoneVmExtensionPolicies;
20408/// async fn sample(
20409/// ) -> anyhow::Result<()> {
20410/// let client = ZoneVmExtensionPolicies::builder().build().await?;
20411/// // use `client` to make requests to the Google Compute Engine API.
20412/// Ok(())
20413/// }
20414/// ```
20415///
20416/// # Service Description
20417///
20418/// Service for the `zoneVmExtensionPolicies` resource.
20419///
20420/// # Configuration
20421///
20422/// To configure `ZoneVmExtensionPolicies` use the `with_*` methods in the type returned
20423/// by [builder()][ZoneVmExtensionPolicies::builder]. The default configuration should
20424/// work for most applications. Common configuration changes include
20425///
20426/// * [with_endpoint()]: by default this client uses the global default endpoint
20427/// (`https://compute.googleapis.com`). Applications using regional
20428/// endpoints or running in restricted networks (e.g. a network configured
20429/// with [Private Google Access with VPC Service Controls]) may want to
20430/// override this default.
20431/// * [with_credentials()]: by default this client uses
20432/// [Application Default Credentials]. Applications using custom
20433/// authentication may need to override this default.
20434///
20435/// [with_endpoint()]: super::builder::zone_vm_extension_policies::ClientBuilder::with_endpoint
20436/// [with_credentials()]: super::builder::zone_vm_extension_policies::ClientBuilder::with_credentials
20437/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20438/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20439///
20440/// # Pooling and Cloning
20441///
20442/// `ZoneVmExtensionPolicies` holds a connection pool internally, it is advised to
20443/// create one and reuse it. You do not need to wrap `ZoneVmExtensionPolicies` in
20444/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20445/// already uses an `Arc` internally.
20446#[cfg(feature = "zone-vm-extension-policies")]
20447#[cfg_attr(docsrs, doc(cfg(feature = "zone-vm-extension-policies")))]
20448#[derive(Clone, Debug)]
20449pub struct ZoneVmExtensionPolicies {
20450 inner: std::sync::Arc<dyn super::stub::dynamic::ZoneVmExtensionPolicies>,
20451}
20452
20453#[cfg(feature = "zone-vm-extension-policies")]
20454impl ZoneVmExtensionPolicies {
20455 /// Returns a builder for [ZoneVmExtensionPolicies].
20456 ///
20457 /// ```
20458 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20459 /// # use google_cloud_compute_v1::client::ZoneVmExtensionPolicies;
20460 /// let client = ZoneVmExtensionPolicies::builder().build().await?;
20461 /// # Ok(()) }
20462 /// ```
20463 pub fn builder() -> super::builder::zone_vm_extension_policies::ClientBuilder {
20464 crate::new_client_builder(super::builder::zone_vm_extension_policies::client::Factory)
20465 }
20466
20467 /// Creates a new client from the provided stub.
20468 ///
20469 /// The most common case for calling this function is in tests mocking the
20470 /// client's behavior.
20471 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20472 where
20473 T: super::stub::ZoneVmExtensionPolicies + 'static,
20474 {
20475 Self { inner: stub.into() }
20476 }
20477
20478 pub(crate) async fn new(
20479 config: gaxi::options::ClientConfig,
20480 ) -> crate::ClientBuilderResult<Self> {
20481 let inner = Self::build_inner(config).await?;
20482 Ok(Self { inner })
20483 }
20484
20485 async fn build_inner(
20486 conf: gaxi::options::ClientConfig,
20487 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ZoneVmExtensionPolicies>>
20488 {
20489 if gaxi::options::tracing_enabled(&conf) {
20490 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20491 }
20492 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20493 }
20494
20495 async fn build_transport(
20496 conf: gaxi::options::ClientConfig,
20497 ) -> crate::ClientBuilderResult<impl super::stub::ZoneVmExtensionPolicies> {
20498 super::transport::ZoneVmExtensionPolicies::new(conf).await
20499 }
20500
20501 async fn build_with_tracing(
20502 conf: gaxi::options::ClientConfig,
20503 ) -> crate::ClientBuilderResult<impl super::stub::ZoneVmExtensionPolicies> {
20504 Self::build_transport(conf)
20505 .await
20506 .map(super::tracing::ZoneVmExtensionPolicies::new)
20507 }
20508
20509 /// Deletes a specified zone VM extension policy within a project.
20510 pub fn delete(&self) -> super::builder::zone_vm_extension_policies::Delete {
20511 super::builder::zone_vm_extension_policies::Delete::new(self.inner.clone())
20512 }
20513
20514 /// Retrieves details of a specific zone VM extension policy within a project.
20515 pub fn get(&self) -> super::builder::zone_vm_extension_policies::Get {
20516 super::builder::zone_vm_extension_policies::Get::new(self.inner.clone())
20517 }
20518
20519 /// Creates a new zone-level VM extension policy within a project.
20520 pub fn insert(&self) -> super::builder::zone_vm_extension_policies::Insert {
20521 super::builder::zone_vm_extension_policies::Insert::new(self.inner.clone())
20522 }
20523
20524 /// Lists all VM extension policies within a specific zone for a project.
20525 pub fn list(&self) -> super::builder::zone_vm_extension_policies::List {
20526 super::builder::zone_vm_extension_policies::List::new(self.inner.clone())
20527 }
20528
20529 /// Modifies an existing zone VM extension policy within a project.
20530 pub fn update(&self) -> super::builder::zone_vm_extension_policies::Update {
20531 super::builder::zone_vm_extension_policies::Update::new(self.inner.clone())
20532 }
20533
20534 /// Retrieves the specified zone-specific Operations resource.
20535 pub fn get_operation(&self) -> super::builder::zone_vm_extension_policies::GetOperation {
20536 super::builder::zone_vm_extension_policies::GetOperation::new(self.inner.clone())
20537 }
20538}
20539
20540/// Implements a client for the Google Compute Engine API.
20541///
20542/// # Example
20543/// ```
20544/// # use google_cloud_compute_v1::client::Zones;
20545/// async fn sample(
20546/// ) -> anyhow::Result<()> {
20547/// let client = Zones::builder().build().await?;
20548/// // use `client` to make requests to the Google Compute Engine API.
20549/// Ok(())
20550/// }
20551/// ```
20552///
20553/// # Service Description
20554///
20555/// Service for the `zones` resource.
20556///
20557/// # Configuration
20558///
20559/// To configure `Zones` use the `with_*` methods in the type returned
20560/// by [builder()][Zones::builder]. The default configuration should
20561/// work for most applications. Common configuration changes include
20562///
20563/// * [with_endpoint()]: by default this client uses the global default endpoint
20564/// (`https://compute.googleapis.com`). Applications using regional
20565/// endpoints or running in restricted networks (e.g. a network configured
20566/// with [Private Google Access with VPC Service Controls]) may want to
20567/// override this default.
20568/// * [with_credentials()]: by default this client uses
20569/// [Application Default Credentials]. Applications using custom
20570/// authentication may need to override this default.
20571///
20572/// [with_endpoint()]: super::builder::zones::ClientBuilder::with_endpoint
20573/// [with_credentials()]: super::builder::zones::ClientBuilder::with_credentials
20574/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20575/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20576///
20577/// # Pooling and Cloning
20578///
20579/// `Zones` holds a connection pool internally, it is advised to
20580/// create one and reuse it. You do not need to wrap `Zones` in
20581/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20582/// already uses an `Arc` internally.
20583#[cfg(feature = "zones")]
20584#[cfg_attr(docsrs, doc(cfg(feature = "zones")))]
20585#[derive(Clone, Debug)]
20586pub struct Zones {
20587 inner: std::sync::Arc<dyn super::stub::dynamic::Zones>,
20588}
20589
20590#[cfg(feature = "zones")]
20591impl Zones {
20592 /// Returns a builder for [Zones].
20593 ///
20594 /// ```
20595 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20596 /// # use google_cloud_compute_v1::client::Zones;
20597 /// let client = Zones::builder().build().await?;
20598 /// # Ok(()) }
20599 /// ```
20600 pub fn builder() -> super::builder::zones::ClientBuilder {
20601 crate::new_client_builder(super::builder::zones::client::Factory)
20602 }
20603
20604 /// Creates a new client from the provided stub.
20605 ///
20606 /// The most common case for calling this function is in tests mocking the
20607 /// client's behavior.
20608 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20609 where
20610 T: super::stub::Zones + 'static,
20611 {
20612 Self { inner: stub.into() }
20613 }
20614
20615 pub(crate) async fn new(
20616 config: gaxi::options::ClientConfig,
20617 ) -> crate::ClientBuilderResult<Self> {
20618 let inner = Self::build_inner(config).await?;
20619 Ok(Self { inner })
20620 }
20621
20622 async fn build_inner(
20623 conf: gaxi::options::ClientConfig,
20624 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Zones>> {
20625 if gaxi::options::tracing_enabled(&conf) {
20626 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20627 }
20628 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20629 }
20630
20631 async fn build_transport(
20632 conf: gaxi::options::ClientConfig,
20633 ) -> crate::ClientBuilderResult<impl super::stub::Zones> {
20634 super::transport::Zones::new(conf).await
20635 }
20636
20637 async fn build_with_tracing(
20638 conf: gaxi::options::ClientConfig,
20639 ) -> crate::ClientBuilderResult<impl super::stub::Zones> {
20640 Self::build_transport(conf)
20641 .await
20642 .map(super::tracing::Zones::new)
20643 }
20644
20645 /// Returns the specified Zone resource.
20646 pub fn get(&self) -> super::builder::zones::Get {
20647 super::builder::zones::Get::new(self.inner.clone())
20648 }
20649
20650 /// Retrieves the list of Zone resources available to the specified project.
20651 pub fn list(&self) -> super::builder::zones::List {
20652 super::builder::zones::List::new(self.inner.clone())
20653 }
20654}