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::redundant_explicit_links)]
19
20/// Implements a client for the Google Compute Engine API.
21///
22/// # Example
23/// ```
24/// # use google_cloud_compute_v1::client::AcceleratorTypes;
25/// async fn sample(
26/// ) -> anyhow::Result<()> {
27/// let client = AcceleratorTypes::builder().build().await?;
28/// // use `client` to make requests to the Google Compute Engine API.
29/// Ok(())
30/// }
31/// ```
32///
33/// # Service Description
34///
35/// Service for the `acceleratorTypes` resource.
36///
37/// # Configuration
38///
39/// To configure `AcceleratorTypes` use the `with_*` methods in the type returned
40/// by [builder()][AcceleratorTypes::builder]. The default configuration should
41/// work for most applications. Common configuration changes include
42///
43/// * [with_endpoint()]: by default this client uses the global default endpoint
44/// (`https://compute.googleapis.com`). Applications using regional
45/// endpoints or running in restricted networks (e.g. a network configured
46/// with [Private Google Access with VPC Service Controls]) may want to
47/// override this default.
48/// * [with_credentials()]: by default this client uses
49/// [Application Default Credentials]. Applications using custom
50/// authentication may need to override this default.
51///
52/// [with_endpoint()]: super::builder::accelerator_types::ClientBuilder::with_endpoint
53/// [with_credentials()]: super::builder::accelerator_types::ClientBuilder::with_credentials
54/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
55/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
56///
57/// # Pooling and Cloning
58///
59/// `AcceleratorTypes` holds a connection pool internally, it is advised to
60/// create one and reuse it. You do not need to wrap `AcceleratorTypes` in
61/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
62/// already uses an `Arc` internally.
63#[cfg(feature = "accelerator-types")]
64#[cfg_attr(docsrs, doc(cfg(feature = "accelerator-types")))]
65#[derive(Clone, Debug)]
66pub struct AcceleratorTypes {
67 inner: std::sync::Arc<dyn super::stub::dynamic::AcceleratorTypes>,
68}
69
70#[cfg(feature = "accelerator-types")]
71impl AcceleratorTypes {
72 /// Returns a builder for [AcceleratorTypes].
73 ///
74 /// ```
75 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
76 /// # use google_cloud_compute_v1::client::AcceleratorTypes;
77 /// let client = AcceleratorTypes::builder().build().await?;
78 /// # Ok(()) }
79 /// ```
80 pub fn builder() -> super::builder::accelerator_types::ClientBuilder {
81 crate::new_client_builder(super::builder::accelerator_types::client::Factory)
82 }
83
84 /// Creates a new client from the provided stub.
85 ///
86 /// The most common case for calling this function is in tests mocking the
87 /// client's behavior.
88 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
89 where
90 T: super::stub::AcceleratorTypes + 'static,
91 {
92 Self { inner: stub.into() }
93 }
94
95 pub(crate) async fn new(
96 config: gaxi::options::ClientConfig,
97 ) -> crate::ClientBuilderResult<Self> {
98 let inner = Self::build_inner(config).await?;
99 Ok(Self { inner })
100 }
101
102 async fn build_inner(
103 conf: gaxi::options::ClientConfig,
104 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AcceleratorTypes>>
105 {
106 if gaxi::options::tracing_enabled(&conf) {
107 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
108 }
109 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
110 }
111
112 async fn build_transport(
113 conf: gaxi::options::ClientConfig,
114 ) -> crate::ClientBuilderResult<impl super::stub::AcceleratorTypes> {
115 super::transport::AcceleratorTypes::new(conf).await
116 }
117
118 async fn build_with_tracing(
119 conf: gaxi::options::ClientConfig,
120 ) -> crate::ClientBuilderResult<impl super::stub::AcceleratorTypes> {
121 Self::build_transport(conf)
122 .await
123 .map(super::tracing::AcceleratorTypes::new)
124 }
125
126 /// Retrieves an aggregated list of accelerator types.
127 ///
128 /// To prevent failure, it is recommended that you set the
129 /// `returnPartialSuccess` parameter to `true`.
130 pub fn aggregated_list(&self) -> super::builder::accelerator_types::AggregatedList {
131 super::builder::accelerator_types::AggregatedList::new(self.inner.clone())
132 }
133
134 /// Returns the specified accelerator type.
135 pub fn get(&self) -> super::builder::accelerator_types::Get {
136 super::builder::accelerator_types::Get::new(self.inner.clone())
137 }
138
139 /// Retrieves a list of accelerator types that are available to the specified
140 /// project.
141 pub fn list(&self) -> super::builder::accelerator_types::List {
142 super::builder::accelerator_types::List::new(self.inner.clone())
143 }
144}
145
146/// Implements a client for the Google Compute Engine API.
147///
148/// # Example
149/// ```
150/// # use google_cloud_compute_v1::client::Addresses;
151/// async fn sample(
152/// ) -> anyhow::Result<()> {
153/// let client = Addresses::builder().build().await?;
154/// // use `client` to make requests to the Google Compute Engine API.
155/// Ok(())
156/// }
157/// ```
158///
159/// # Service Description
160///
161/// Service for the `addresses` resource.
162///
163/// # Configuration
164///
165/// To configure `Addresses` use the `with_*` methods in the type returned
166/// by [builder()][Addresses::builder]. The default configuration should
167/// work for most applications. Common configuration changes include
168///
169/// * [with_endpoint()]: by default this client uses the global default endpoint
170/// (`https://compute.googleapis.com`). Applications using regional
171/// endpoints or running in restricted networks (e.g. a network configured
172/// with [Private Google Access with VPC Service Controls]) may want to
173/// override this default.
174/// * [with_credentials()]: by default this client uses
175/// [Application Default Credentials]. Applications using custom
176/// authentication may need to override this default.
177///
178/// [with_endpoint()]: super::builder::addresses::ClientBuilder::with_endpoint
179/// [with_credentials()]: super::builder::addresses::ClientBuilder::with_credentials
180/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
181/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
182///
183/// # Pooling and Cloning
184///
185/// `Addresses` holds a connection pool internally, it is advised to
186/// create one and reuse it. You do not need to wrap `Addresses` in
187/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
188/// already uses an `Arc` internally.
189#[cfg(feature = "addresses")]
190#[cfg_attr(docsrs, doc(cfg(feature = "addresses")))]
191#[derive(Clone, Debug)]
192pub struct Addresses {
193 inner: std::sync::Arc<dyn super::stub::dynamic::Addresses>,
194}
195
196#[cfg(feature = "addresses")]
197impl Addresses {
198 /// Returns a builder for [Addresses].
199 ///
200 /// ```
201 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
202 /// # use google_cloud_compute_v1::client::Addresses;
203 /// let client = Addresses::builder().build().await?;
204 /// # Ok(()) }
205 /// ```
206 pub fn builder() -> super::builder::addresses::ClientBuilder {
207 crate::new_client_builder(super::builder::addresses::client::Factory)
208 }
209
210 /// Creates a new client from the provided stub.
211 ///
212 /// The most common case for calling this function is in tests mocking the
213 /// client's behavior.
214 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
215 where
216 T: super::stub::Addresses + 'static,
217 {
218 Self { inner: stub.into() }
219 }
220
221 pub(crate) async fn new(
222 config: gaxi::options::ClientConfig,
223 ) -> crate::ClientBuilderResult<Self> {
224 let inner = Self::build_inner(config).await?;
225 Ok(Self { inner })
226 }
227
228 async fn build_inner(
229 conf: gaxi::options::ClientConfig,
230 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Addresses>> {
231 if gaxi::options::tracing_enabled(&conf) {
232 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
233 }
234 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
235 }
236
237 async fn build_transport(
238 conf: gaxi::options::ClientConfig,
239 ) -> crate::ClientBuilderResult<impl super::stub::Addresses> {
240 super::transport::Addresses::new(conf).await
241 }
242
243 async fn build_with_tracing(
244 conf: gaxi::options::ClientConfig,
245 ) -> crate::ClientBuilderResult<impl super::stub::Addresses> {
246 Self::build_transport(conf)
247 .await
248 .map(super::tracing::Addresses::new)
249 }
250
251 /// Retrieves an aggregated list of addresses.
252 ///
253 /// To prevent failure, it is recommended that you set the
254 /// `returnPartialSuccess` parameter to `true`.
255 pub fn aggregated_list(&self) -> super::builder::addresses::AggregatedList {
256 super::builder::addresses::AggregatedList::new(self.inner.clone())
257 }
258
259 /// Deletes the specified address resource.
260 pub fn delete(&self) -> super::builder::addresses::Delete {
261 super::builder::addresses::Delete::new(self.inner.clone())
262 }
263
264 /// Returns the specified address resource.
265 pub fn get(&self) -> super::builder::addresses::Get {
266 super::builder::addresses::Get::new(self.inner.clone())
267 }
268
269 /// Creates an address resource in the specified project by using the data
270 /// included in the request.
271 pub fn insert(&self) -> super::builder::addresses::Insert {
272 super::builder::addresses::Insert::new(self.inner.clone())
273 }
274
275 /// Retrieves a list of addresses contained within
276 /// the specified region.
277 pub fn list(&self) -> super::builder::addresses::List {
278 super::builder::addresses::List::new(self.inner.clone())
279 }
280
281 /// Moves the specified address resource.
282 pub fn r#move(&self) -> super::builder::addresses::Move {
283 super::builder::addresses::Move::new(self.inner.clone())
284 }
285
286 /// Sets the labels on an Address. To learn more about labels, read theLabeling
287 /// Resources documentation.
288 pub fn set_labels(&self) -> super::builder::addresses::SetLabels {
289 super::builder::addresses::SetLabels::new(self.inner.clone())
290 }
291
292 /// Returns permissions that a caller has on the specified resource.
293 pub fn test_iam_permissions(&self) -> super::builder::addresses::TestIamPermissions {
294 super::builder::addresses::TestIamPermissions::new(self.inner.clone())
295 }
296
297 /// Retrieves the specified region-specific Operations resource.
298 pub fn get_operation(&self) -> super::builder::addresses::GetOperation {
299 super::builder::addresses::GetOperation::new(self.inner.clone())
300 }
301}
302
303/// Implements a client for the Google Compute Engine API.
304///
305/// # Example
306/// ```
307/// # use google_cloud_compute_v1::client::Advice;
308/// async fn sample(
309/// ) -> anyhow::Result<()> {
310/// let client = Advice::builder().build().await?;
311/// // use `client` to make requests to the Google Compute Engine API.
312/// Ok(())
313/// }
314/// ```
315///
316/// # Service Description
317///
318/// Service for the `advice` resource.
319///
320/// # Configuration
321///
322/// To configure `Advice` use the `with_*` methods in the type returned
323/// by [builder()][Advice::builder]. The default configuration should
324/// work for most applications. Common configuration changes include
325///
326/// * [with_endpoint()]: by default this client uses the global default endpoint
327/// (`https://compute.googleapis.com`). Applications using regional
328/// endpoints or running in restricted networks (e.g. a network configured
329/// with [Private Google Access with VPC Service Controls]) may want to
330/// override this default.
331/// * [with_credentials()]: by default this client uses
332/// [Application Default Credentials]. Applications using custom
333/// authentication may need to override this default.
334///
335/// [with_endpoint()]: super::builder::advice::ClientBuilder::with_endpoint
336/// [with_credentials()]: super::builder::advice::ClientBuilder::with_credentials
337/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
338/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
339///
340/// # Pooling and Cloning
341///
342/// `Advice` holds a connection pool internally, it is advised to
343/// create one and reuse it. You do not need to wrap `Advice` in
344/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
345/// already uses an `Arc` internally.
346#[cfg(feature = "advice")]
347#[cfg_attr(docsrs, doc(cfg(feature = "advice")))]
348#[derive(Clone, Debug)]
349pub struct Advice {
350 inner: std::sync::Arc<dyn super::stub::dynamic::Advice>,
351}
352
353#[cfg(feature = "advice")]
354impl Advice {
355 /// Returns a builder for [Advice].
356 ///
357 /// ```
358 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
359 /// # use google_cloud_compute_v1::client::Advice;
360 /// let client = Advice::builder().build().await?;
361 /// # Ok(()) }
362 /// ```
363 pub fn builder() -> super::builder::advice::ClientBuilder {
364 crate::new_client_builder(super::builder::advice::client::Factory)
365 }
366
367 /// Creates a new client from the provided stub.
368 ///
369 /// The most common case for calling this function is in tests mocking the
370 /// client's behavior.
371 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
372 where
373 T: super::stub::Advice + 'static,
374 {
375 Self { inner: stub.into() }
376 }
377
378 pub(crate) async fn new(
379 config: gaxi::options::ClientConfig,
380 ) -> crate::ClientBuilderResult<Self> {
381 let inner = Self::build_inner(config).await?;
382 Ok(Self { inner })
383 }
384
385 async fn build_inner(
386 conf: gaxi::options::ClientConfig,
387 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Advice>> {
388 if gaxi::options::tracing_enabled(&conf) {
389 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
390 }
391 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
392 }
393
394 async fn build_transport(
395 conf: gaxi::options::ClientConfig,
396 ) -> crate::ClientBuilderResult<impl super::stub::Advice> {
397 super::transport::Advice::new(conf).await
398 }
399
400 async fn build_with_tracing(
401 conf: gaxi::options::ClientConfig,
402 ) -> crate::ClientBuilderResult<impl super::stub::Advice> {
403 Self::build_transport(conf)
404 .await
405 .map(super::tracing::Advice::new)
406 }
407
408 /// Advise how, where and when to create the requested amount of instances
409 /// with specified accelerators, within the specified time and location limits.
410 /// The method recommends creating future reservations for the requested
411 /// resources.
412 pub fn calendar_mode(&self) -> super::builder::advice::CalendarMode {
413 super::builder::advice::CalendarMode::new(self.inner.clone())
414 }
415}
416
417/// Implements a client for the Google Compute Engine API.
418///
419/// # Example
420/// ```
421/// # use google_cloud_compute_v1::client::Autoscalers;
422/// async fn sample(
423/// ) -> anyhow::Result<()> {
424/// let client = Autoscalers::builder().build().await?;
425/// // use `client` to make requests to the Google Compute Engine API.
426/// Ok(())
427/// }
428/// ```
429///
430/// # Service Description
431///
432/// Service for the `autoscalers` resource.
433///
434/// # Configuration
435///
436/// To configure `Autoscalers` use the `with_*` methods in the type returned
437/// by [builder()][Autoscalers::builder]. The default configuration should
438/// work for most applications. Common configuration changes include
439///
440/// * [with_endpoint()]: by default this client uses the global default endpoint
441/// (`https://compute.googleapis.com`). Applications using regional
442/// endpoints or running in restricted networks (e.g. a network configured
443/// with [Private Google Access with VPC Service Controls]) may want to
444/// override this default.
445/// * [with_credentials()]: by default this client uses
446/// [Application Default Credentials]. Applications using custom
447/// authentication may need to override this default.
448///
449/// [with_endpoint()]: super::builder::autoscalers::ClientBuilder::with_endpoint
450/// [with_credentials()]: super::builder::autoscalers::ClientBuilder::with_credentials
451/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
452/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
453///
454/// # Pooling and Cloning
455///
456/// `Autoscalers` holds a connection pool internally, it is advised to
457/// create one and reuse it. You do not need to wrap `Autoscalers` in
458/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
459/// already uses an `Arc` internally.
460#[cfg(feature = "autoscalers")]
461#[cfg_attr(docsrs, doc(cfg(feature = "autoscalers")))]
462#[derive(Clone, Debug)]
463pub struct Autoscalers {
464 inner: std::sync::Arc<dyn super::stub::dynamic::Autoscalers>,
465}
466
467#[cfg(feature = "autoscalers")]
468impl Autoscalers {
469 /// Returns a builder for [Autoscalers].
470 ///
471 /// ```
472 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
473 /// # use google_cloud_compute_v1::client::Autoscalers;
474 /// let client = Autoscalers::builder().build().await?;
475 /// # Ok(()) }
476 /// ```
477 pub fn builder() -> super::builder::autoscalers::ClientBuilder {
478 crate::new_client_builder(super::builder::autoscalers::client::Factory)
479 }
480
481 /// Creates a new client from the provided stub.
482 ///
483 /// The most common case for calling this function is in tests mocking the
484 /// client's behavior.
485 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
486 where
487 T: super::stub::Autoscalers + 'static,
488 {
489 Self { inner: stub.into() }
490 }
491
492 pub(crate) async fn new(
493 config: gaxi::options::ClientConfig,
494 ) -> crate::ClientBuilderResult<Self> {
495 let inner = Self::build_inner(config).await?;
496 Ok(Self { inner })
497 }
498
499 async fn build_inner(
500 conf: gaxi::options::ClientConfig,
501 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Autoscalers>> {
502 if gaxi::options::tracing_enabled(&conf) {
503 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
504 }
505 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
506 }
507
508 async fn build_transport(
509 conf: gaxi::options::ClientConfig,
510 ) -> crate::ClientBuilderResult<impl super::stub::Autoscalers> {
511 super::transport::Autoscalers::new(conf).await
512 }
513
514 async fn build_with_tracing(
515 conf: gaxi::options::ClientConfig,
516 ) -> crate::ClientBuilderResult<impl super::stub::Autoscalers> {
517 Self::build_transport(conf)
518 .await
519 .map(super::tracing::Autoscalers::new)
520 }
521
522 /// Retrieves an aggregated list of autoscalers.
523 ///
524 /// To prevent failure, it is recommended that you set the
525 /// `returnPartialSuccess` parameter to `true`.
526 pub fn aggregated_list(&self) -> super::builder::autoscalers::AggregatedList {
527 super::builder::autoscalers::AggregatedList::new(self.inner.clone())
528 }
529
530 /// Deletes the specified autoscaler.
531 pub fn delete(&self) -> super::builder::autoscalers::Delete {
532 super::builder::autoscalers::Delete::new(self.inner.clone())
533 }
534
535 /// Returns the specified autoscaler resource.
536 pub fn get(&self) -> super::builder::autoscalers::Get {
537 super::builder::autoscalers::Get::new(self.inner.clone())
538 }
539
540 /// Creates an autoscaler in the specified project using the data
541 /// included in the request.
542 pub fn insert(&self) -> super::builder::autoscalers::Insert {
543 super::builder::autoscalers::Insert::new(self.inner.clone())
544 }
545
546 /// Retrieves a list of autoscalers contained within
547 /// the specified zone.
548 pub fn list(&self) -> super::builder::autoscalers::List {
549 super::builder::autoscalers::List::new(self.inner.clone())
550 }
551
552 /// Updates an autoscaler in the specified project using the data
553 /// included in the request. This method supportsPATCH
554 /// semantics and uses theJSON merge
555 /// patch format and processing rules.
556 pub fn patch(&self) -> super::builder::autoscalers::Patch {
557 super::builder::autoscalers::Patch::new(self.inner.clone())
558 }
559
560 /// Returns permissions that a caller has on the specified resource.
561 pub fn test_iam_permissions(&self) -> super::builder::autoscalers::TestIamPermissions {
562 super::builder::autoscalers::TestIamPermissions::new(self.inner.clone())
563 }
564
565 /// Updates an autoscaler in the specified project using the data
566 /// included in the request.
567 pub fn update(&self) -> super::builder::autoscalers::Update {
568 super::builder::autoscalers::Update::new(self.inner.clone())
569 }
570
571 /// Retrieves the specified zone-specific Operations resource.
572 pub fn get_operation(&self) -> super::builder::autoscalers::GetOperation {
573 super::builder::autoscalers::GetOperation::new(self.inner.clone())
574 }
575}
576
577/// Implements a client for the Google Compute Engine API.
578///
579/// # Example
580/// ```
581/// # use google_cloud_compute_v1::client::BackendBuckets;
582/// async fn sample(
583/// ) -> anyhow::Result<()> {
584/// let client = BackendBuckets::builder().build().await?;
585/// // use `client` to make requests to the Google Compute Engine API.
586/// Ok(())
587/// }
588/// ```
589///
590/// # Service Description
591///
592/// Service for the `backendBuckets` resource.
593///
594/// # Configuration
595///
596/// To configure `BackendBuckets` use the `with_*` methods in the type returned
597/// by [builder()][BackendBuckets::builder]. The default configuration should
598/// work for most applications. Common configuration changes include
599///
600/// * [with_endpoint()]: by default this client uses the global default endpoint
601/// (`https://compute.googleapis.com`). Applications using regional
602/// endpoints or running in restricted networks (e.g. a network configured
603/// with [Private Google Access with VPC Service Controls]) may want to
604/// override this default.
605/// * [with_credentials()]: by default this client uses
606/// [Application Default Credentials]. Applications using custom
607/// authentication may need to override this default.
608///
609/// [with_endpoint()]: super::builder::backend_buckets::ClientBuilder::with_endpoint
610/// [with_credentials()]: super::builder::backend_buckets::ClientBuilder::with_credentials
611/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
612/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
613///
614/// # Pooling and Cloning
615///
616/// `BackendBuckets` holds a connection pool internally, it is advised to
617/// create one and reuse it. You do not need to wrap `BackendBuckets` in
618/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
619/// already uses an `Arc` internally.
620#[cfg(feature = "backend-buckets")]
621#[cfg_attr(docsrs, doc(cfg(feature = "backend-buckets")))]
622#[derive(Clone, Debug)]
623pub struct BackendBuckets {
624 inner: std::sync::Arc<dyn super::stub::dynamic::BackendBuckets>,
625}
626
627#[cfg(feature = "backend-buckets")]
628impl BackendBuckets {
629 /// Returns a builder for [BackendBuckets].
630 ///
631 /// ```
632 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
633 /// # use google_cloud_compute_v1::client::BackendBuckets;
634 /// let client = BackendBuckets::builder().build().await?;
635 /// # Ok(()) }
636 /// ```
637 pub fn builder() -> super::builder::backend_buckets::ClientBuilder {
638 crate::new_client_builder(super::builder::backend_buckets::client::Factory)
639 }
640
641 /// Creates a new client from the provided stub.
642 ///
643 /// The most common case for calling this function is in tests mocking the
644 /// client's behavior.
645 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
646 where
647 T: super::stub::BackendBuckets + 'static,
648 {
649 Self { inner: stub.into() }
650 }
651
652 pub(crate) async fn new(
653 config: gaxi::options::ClientConfig,
654 ) -> crate::ClientBuilderResult<Self> {
655 let inner = Self::build_inner(config).await?;
656 Ok(Self { inner })
657 }
658
659 async fn build_inner(
660 conf: gaxi::options::ClientConfig,
661 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::BackendBuckets>> {
662 if gaxi::options::tracing_enabled(&conf) {
663 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
664 }
665 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
666 }
667
668 async fn build_transport(
669 conf: gaxi::options::ClientConfig,
670 ) -> crate::ClientBuilderResult<impl super::stub::BackendBuckets> {
671 super::transport::BackendBuckets::new(conf).await
672 }
673
674 async fn build_with_tracing(
675 conf: gaxi::options::ClientConfig,
676 ) -> crate::ClientBuilderResult<impl super::stub::BackendBuckets> {
677 Self::build_transport(conf)
678 .await
679 .map(super::tracing::BackendBuckets::new)
680 }
681
682 /// Adds a key for validating requests with signed URLs for this backend
683 /// bucket.
684 pub fn add_signed_url_key(&self) -> super::builder::backend_buckets::AddSignedUrlKey {
685 super::builder::backend_buckets::AddSignedUrlKey::new(self.inner.clone())
686 }
687
688 /// Retrieves the list of all BackendBucket resources, regional and global,
689 /// available to the specified project.
690 ///
691 /// To prevent failure, it is recommended that you set the
692 /// `returnPartialSuccess` parameter to `true`.
693 pub fn aggregated_list(&self) -> super::builder::backend_buckets::AggregatedList {
694 super::builder::backend_buckets::AggregatedList::new(self.inner.clone())
695 }
696
697 /// Deletes the specified BackendBucket resource.
698 pub fn delete(&self) -> super::builder::backend_buckets::Delete {
699 super::builder::backend_buckets::Delete::new(self.inner.clone())
700 }
701
702 /// Deletes a key for validating requests with signed URLs for this backend
703 /// bucket.
704 pub fn delete_signed_url_key(&self) -> super::builder::backend_buckets::DeleteSignedUrlKey {
705 super::builder::backend_buckets::DeleteSignedUrlKey::new(self.inner.clone())
706 }
707
708 /// Returns the specified BackendBucket resource.
709 pub fn get(&self) -> super::builder::backend_buckets::Get {
710 super::builder::backend_buckets::Get::new(self.inner.clone())
711 }
712
713 /// Gets the access control policy for a resource. May be empty if no such
714 /// policy or resource exists.
715 pub fn get_iam_policy(&self) -> super::builder::backend_buckets::GetIamPolicy {
716 super::builder::backend_buckets::GetIamPolicy::new(self.inner.clone())
717 }
718
719 /// Creates a BackendBucket resource in the specified project using
720 /// the data included in the request.
721 pub fn insert(&self) -> super::builder::backend_buckets::Insert {
722 super::builder::backend_buckets::Insert::new(self.inner.clone())
723 }
724
725 /// Retrieves the list of BackendBucket resources available to the specified
726 /// project.
727 pub fn list(&self) -> super::builder::backend_buckets::List {
728 super::builder::backend_buckets::List::new(self.inner.clone())
729 }
730
731 /// Retrieves a list of all usable backend buckets in the specified project.
732 pub fn list_usable(&self) -> super::builder::backend_buckets::ListUsable {
733 super::builder::backend_buckets::ListUsable::new(self.inner.clone())
734 }
735
736 /// Updates the specified BackendBucket resource with the data included in the
737 /// request. This method supportsPATCH
738 /// semantics and uses theJSON merge
739 /// patch format and processing rules.
740 pub fn patch(&self) -> super::builder::backend_buckets::Patch {
741 super::builder::backend_buckets::Patch::new(self.inner.clone())
742 }
743
744 /// Sets the edge security policy for the specified backend bucket.
745 pub fn set_edge_security_policy(
746 &self,
747 ) -> super::builder::backend_buckets::SetEdgeSecurityPolicy {
748 super::builder::backend_buckets::SetEdgeSecurityPolicy::new(self.inner.clone())
749 }
750
751 /// Sets the access control policy on the specified resource.
752 /// Replaces any existing policy.
753 pub fn set_iam_policy(&self) -> super::builder::backend_buckets::SetIamPolicy {
754 super::builder::backend_buckets::SetIamPolicy::new(self.inner.clone())
755 }
756
757 /// Returns permissions that a caller has on the specified resource.
758 pub fn test_iam_permissions(&self) -> super::builder::backend_buckets::TestIamPermissions {
759 super::builder::backend_buckets::TestIamPermissions::new(self.inner.clone())
760 }
761
762 /// Updates the specified BackendBucket resource with the data included in the
763 /// request.
764 pub fn update(&self) -> super::builder::backend_buckets::Update {
765 super::builder::backend_buckets::Update::new(self.inner.clone())
766 }
767
768 /// Retrieves the specified Operations resource.
769 pub fn get_operation(&self) -> super::builder::backend_buckets::GetOperation {
770 super::builder::backend_buckets::GetOperation::new(self.inner.clone())
771 }
772}
773
774/// Implements a client for the Google Compute Engine API.
775///
776/// # Example
777/// ```
778/// # use google_cloud_compute_v1::client::BackendServices;
779/// async fn sample(
780/// ) -> anyhow::Result<()> {
781/// let client = BackendServices::builder().build().await?;
782/// // use `client` to make requests to the Google Compute Engine API.
783/// Ok(())
784/// }
785/// ```
786///
787/// # Service Description
788///
789/// Service for the `backendServices` resource.
790///
791/// # Configuration
792///
793/// To configure `BackendServices` use the `with_*` methods in the type returned
794/// by [builder()][BackendServices::builder]. The default configuration should
795/// work for most applications. Common configuration changes include
796///
797/// * [with_endpoint()]: by default this client uses the global default endpoint
798/// (`https://compute.googleapis.com`). Applications using regional
799/// endpoints or running in restricted networks (e.g. a network configured
800/// with [Private Google Access with VPC Service Controls]) may want to
801/// override this default.
802/// * [with_credentials()]: by default this client uses
803/// [Application Default Credentials]. Applications using custom
804/// authentication may need to override this default.
805///
806/// [with_endpoint()]: super::builder::backend_services::ClientBuilder::with_endpoint
807/// [with_credentials()]: super::builder::backend_services::ClientBuilder::with_credentials
808/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
809/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
810///
811/// # Pooling and Cloning
812///
813/// `BackendServices` holds a connection pool internally, it is advised to
814/// create one and reuse it. You do not need to wrap `BackendServices` in
815/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
816/// already uses an `Arc` internally.
817#[cfg(feature = "backend-services")]
818#[cfg_attr(docsrs, doc(cfg(feature = "backend-services")))]
819#[derive(Clone, Debug)]
820pub struct BackendServices {
821 inner: std::sync::Arc<dyn super::stub::dynamic::BackendServices>,
822}
823
824#[cfg(feature = "backend-services")]
825impl BackendServices {
826 /// Returns a builder for [BackendServices].
827 ///
828 /// ```
829 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
830 /// # use google_cloud_compute_v1::client::BackendServices;
831 /// let client = BackendServices::builder().build().await?;
832 /// # Ok(()) }
833 /// ```
834 pub fn builder() -> super::builder::backend_services::ClientBuilder {
835 crate::new_client_builder(super::builder::backend_services::client::Factory)
836 }
837
838 /// Creates a new client from the provided stub.
839 ///
840 /// The most common case for calling this function is in tests mocking the
841 /// client's behavior.
842 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
843 where
844 T: super::stub::BackendServices + 'static,
845 {
846 Self { inner: stub.into() }
847 }
848
849 pub(crate) async fn new(
850 config: gaxi::options::ClientConfig,
851 ) -> crate::ClientBuilderResult<Self> {
852 let inner = Self::build_inner(config).await?;
853 Ok(Self { inner })
854 }
855
856 async fn build_inner(
857 conf: gaxi::options::ClientConfig,
858 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::BackendServices>> {
859 if gaxi::options::tracing_enabled(&conf) {
860 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
861 }
862 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
863 }
864
865 async fn build_transport(
866 conf: gaxi::options::ClientConfig,
867 ) -> crate::ClientBuilderResult<impl super::stub::BackendServices> {
868 super::transport::BackendServices::new(conf).await
869 }
870
871 async fn build_with_tracing(
872 conf: gaxi::options::ClientConfig,
873 ) -> crate::ClientBuilderResult<impl super::stub::BackendServices> {
874 Self::build_transport(conf)
875 .await
876 .map(super::tracing::BackendServices::new)
877 }
878
879 /// Adds a key for validating requests with signed URLs for this backend
880 /// service.
881 pub fn add_signed_url_key(&self) -> super::builder::backend_services::AddSignedUrlKey {
882 super::builder::backend_services::AddSignedUrlKey::new(self.inner.clone())
883 }
884
885 /// Retrieves the list of all BackendService resources, regional and global,
886 /// available to the specified project.
887 ///
888 /// To prevent failure, it is recommended that you set the
889 /// `returnPartialSuccess` parameter to `true`.
890 pub fn aggregated_list(&self) -> super::builder::backend_services::AggregatedList {
891 super::builder::backend_services::AggregatedList::new(self.inner.clone())
892 }
893
894 /// Deletes the specified BackendService resource.
895 pub fn delete(&self) -> super::builder::backend_services::Delete {
896 super::builder::backend_services::Delete::new(self.inner.clone())
897 }
898
899 /// Deletes a key for validating requests with signed URLs for this backend
900 /// service.
901 pub fn delete_signed_url_key(&self) -> super::builder::backend_services::DeleteSignedUrlKey {
902 super::builder::backend_services::DeleteSignedUrlKey::new(self.inner.clone())
903 }
904
905 /// Returns the specified BackendService resource.
906 pub fn get(&self) -> super::builder::backend_services::Get {
907 super::builder::backend_services::Get::new(self.inner.clone())
908 }
909
910 /// Returns effective security policies applied to this backend service.
911 pub fn get_effective_security_policies(
912 &self,
913 ) -> super::builder::backend_services::GetEffectiveSecurityPolicies {
914 super::builder::backend_services::GetEffectiveSecurityPolicies::new(self.inner.clone())
915 }
916
917 /// Gets the most recent health check results for this
918 /// BackendService.
919 ///
920 /// Example request body:
921 ///
922 /// {
923 /// "group": "/zones/us-east1-b/instanceGroups/lb-backend-example"
924 /// }
925 pub fn get_health(&self) -> super::builder::backend_services::GetHealth {
926 super::builder::backend_services::GetHealth::new(self.inner.clone())
927 }
928
929 /// Gets the access control policy for a resource. May be empty if no such
930 /// policy or resource exists.
931 pub fn get_iam_policy(&self) -> super::builder::backend_services::GetIamPolicy {
932 super::builder::backend_services::GetIamPolicy::new(self.inner.clone())
933 }
934
935 /// Creates a BackendService resource in the specified project using
936 /// the data included in the request. For more information, see
937 /// Backend services overview.
938 pub fn insert(&self) -> super::builder::backend_services::Insert {
939 super::builder::backend_services::Insert::new(self.inner.clone())
940 }
941
942 /// Retrieves the list of BackendService resources available to the specified
943 /// project.
944 pub fn list(&self) -> super::builder::backend_services::List {
945 super::builder::backend_services::List::new(self.inner.clone())
946 }
947
948 /// Retrieves a list of all usable backend services in the specified project.
949 pub fn list_usable(&self) -> super::builder::backend_services::ListUsable {
950 super::builder::backend_services::ListUsable::new(self.inner.clone())
951 }
952
953 /// Patches the specified BackendService resource with the data included in the
954 /// request. For more information, see
955 /// Backend services overview. This method
956 /// supports PATCH semantics and uses the JSON merge
957 /// patch format and processing rules.
958 pub fn patch(&self) -> super::builder::backend_services::Patch {
959 super::builder::backend_services::Patch::new(self.inner.clone())
960 }
961
962 /// Sets the edge security policy for the specified backend service.
963 pub fn set_edge_security_policy(
964 &self,
965 ) -> super::builder::backend_services::SetEdgeSecurityPolicy {
966 super::builder::backend_services::SetEdgeSecurityPolicy::new(self.inner.clone())
967 }
968
969 /// Sets the access control policy on the specified resource.
970 /// Replaces any existing policy.
971 pub fn set_iam_policy(&self) -> super::builder::backend_services::SetIamPolicy {
972 super::builder::backend_services::SetIamPolicy::new(self.inner.clone())
973 }
974
975 /// Sets the Google Cloud Armor security policy for the specified backend
976 /// service. For more information, seeGoogle
977 /// Cloud Armor Overview
978 pub fn set_security_policy(&self) -> super::builder::backend_services::SetSecurityPolicy {
979 super::builder::backend_services::SetSecurityPolicy::new(self.inner.clone())
980 }
981
982 /// Returns permissions that a caller has on the specified resource.
983 pub fn test_iam_permissions(&self) -> super::builder::backend_services::TestIamPermissions {
984 super::builder::backend_services::TestIamPermissions::new(self.inner.clone())
985 }
986
987 /// Updates the specified BackendService resource with the data included in the
988 /// request. For more information, seeBackend
989 /// services overview.
990 pub fn update(&self) -> super::builder::backend_services::Update {
991 super::builder::backend_services::Update::new(self.inner.clone())
992 }
993
994 /// Retrieves the specified Operations resource.
995 pub fn get_operation(&self) -> super::builder::backend_services::GetOperation {
996 super::builder::backend_services::GetOperation::new(self.inner.clone())
997 }
998}
999
1000/// Implements a client for the Google Compute Engine API.
1001///
1002/// # Example
1003/// ```
1004/// # use google_cloud_compute_v1::client::CrossSiteNetworks;
1005/// async fn sample(
1006/// ) -> anyhow::Result<()> {
1007/// let client = CrossSiteNetworks::builder().build().await?;
1008/// // use `client` to make requests to the Google Compute Engine API.
1009/// Ok(())
1010/// }
1011/// ```
1012///
1013/// # Service Description
1014///
1015/// Service for the `crossSiteNetworks` resource.
1016///
1017/// # Configuration
1018///
1019/// To configure `CrossSiteNetworks` use the `with_*` methods in the type returned
1020/// by [builder()][CrossSiteNetworks::builder]. The default configuration should
1021/// work for most applications. Common configuration changes include
1022///
1023/// * [with_endpoint()]: by default this client uses the global default endpoint
1024/// (`https://compute.googleapis.com`). Applications using regional
1025/// endpoints or running in restricted networks (e.g. a network configured
1026/// with [Private Google Access with VPC Service Controls]) may want to
1027/// override this default.
1028/// * [with_credentials()]: by default this client uses
1029/// [Application Default Credentials]. Applications using custom
1030/// authentication may need to override this default.
1031///
1032/// [with_endpoint()]: super::builder::cross_site_networks::ClientBuilder::with_endpoint
1033/// [with_credentials()]: super::builder::cross_site_networks::ClientBuilder::with_credentials
1034/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1035/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1036///
1037/// # Pooling and Cloning
1038///
1039/// `CrossSiteNetworks` holds a connection pool internally, it is advised to
1040/// create one and reuse it. You do not need to wrap `CrossSiteNetworks` in
1041/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1042/// already uses an `Arc` internally.
1043#[cfg(feature = "cross-site-networks")]
1044#[cfg_attr(docsrs, doc(cfg(feature = "cross-site-networks")))]
1045#[derive(Clone, Debug)]
1046pub struct CrossSiteNetworks {
1047 inner: std::sync::Arc<dyn super::stub::dynamic::CrossSiteNetworks>,
1048}
1049
1050#[cfg(feature = "cross-site-networks")]
1051impl CrossSiteNetworks {
1052 /// Returns a builder for [CrossSiteNetworks].
1053 ///
1054 /// ```
1055 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1056 /// # use google_cloud_compute_v1::client::CrossSiteNetworks;
1057 /// let client = CrossSiteNetworks::builder().build().await?;
1058 /// # Ok(()) }
1059 /// ```
1060 pub fn builder() -> super::builder::cross_site_networks::ClientBuilder {
1061 crate::new_client_builder(super::builder::cross_site_networks::client::Factory)
1062 }
1063
1064 /// Creates a new client from the provided stub.
1065 ///
1066 /// The most common case for calling this function is in tests mocking the
1067 /// client's behavior.
1068 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1069 where
1070 T: super::stub::CrossSiteNetworks + 'static,
1071 {
1072 Self { inner: stub.into() }
1073 }
1074
1075 pub(crate) async fn new(
1076 config: gaxi::options::ClientConfig,
1077 ) -> crate::ClientBuilderResult<Self> {
1078 let inner = Self::build_inner(config).await?;
1079 Ok(Self { inner })
1080 }
1081
1082 async fn build_inner(
1083 conf: gaxi::options::ClientConfig,
1084 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::CrossSiteNetworks>>
1085 {
1086 if gaxi::options::tracing_enabled(&conf) {
1087 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1088 }
1089 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1090 }
1091
1092 async fn build_transport(
1093 conf: gaxi::options::ClientConfig,
1094 ) -> crate::ClientBuilderResult<impl super::stub::CrossSiteNetworks> {
1095 super::transport::CrossSiteNetworks::new(conf).await
1096 }
1097
1098 async fn build_with_tracing(
1099 conf: gaxi::options::ClientConfig,
1100 ) -> crate::ClientBuilderResult<impl super::stub::CrossSiteNetworks> {
1101 Self::build_transport(conf)
1102 .await
1103 .map(super::tracing::CrossSiteNetworks::new)
1104 }
1105
1106 /// Deletes the specified cross-site network in the given scope.
1107 pub fn delete(&self) -> super::builder::cross_site_networks::Delete {
1108 super::builder::cross_site_networks::Delete::new(self.inner.clone())
1109 }
1110
1111 /// Returns the specified cross-site network in the given scope.
1112 pub fn get(&self) -> super::builder::cross_site_networks::Get {
1113 super::builder::cross_site_networks::Get::new(self.inner.clone())
1114 }
1115
1116 /// Creates a cross-site network in the specified project in the given scope
1117 /// using the parameters that are included in the request.
1118 pub fn insert(&self) -> super::builder::cross_site_networks::Insert {
1119 super::builder::cross_site_networks::Insert::new(self.inner.clone())
1120 }
1121
1122 /// Lists the cross-site networks for a project in the given scope.
1123 pub fn list(&self) -> super::builder::cross_site_networks::List {
1124 super::builder::cross_site_networks::List::new(self.inner.clone())
1125 }
1126
1127 /// Updates the specified cross-site network with the data included in
1128 /// the request. This method supportsPATCH
1129 /// semantics and uses theJSON merge
1130 /// patch format and processing rules.
1131 pub fn patch(&self) -> super::builder::cross_site_networks::Patch {
1132 super::builder::cross_site_networks::Patch::new(self.inner.clone())
1133 }
1134
1135 /// Retrieves the specified Operations resource.
1136 pub fn get_operation(&self) -> super::builder::cross_site_networks::GetOperation {
1137 super::builder::cross_site_networks::GetOperation::new(self.inner.clone())
1138 }
1139}
1140
1141/// Implements a client for the Google Compute Engine API.
1142///
1143/// # Example
1144/// ```
1145/// # use google_cloud_compute_v1::client::DiskTypes;
1146/// async fn sample(
1147/// ) -> anyhow::Result<()> {
1148/// let client = DiskTypes::builder().build().await?;
1149/// // use `client` to make requests to the Google Compute Engine API.
1150/// Ok(())
1151/// }
1152/// ```
1153///
1154/// # Service Description
1155///
1156/// Service for the `diskTypes` resource.
1157///
1158/// # Configuration
1159///
1160/// To configure `DiskTypes` use the `with_*` methods in the type returned
1161/// by [builder()][DiskTypes::builder]. The default configuration should
1162/// work for most applications. Common configuration changes include
1163///
1164/// * [with_endpoint()]: by default this client uses the global default endpoint
1165/// (`https://compute.googleapis.com`). Applications using regional
1166/// endpoints or running in restricted networks (e.g. a network configured
1167/// with [Private Google Access with VPC Service Controls]) may want to
1168/// override this default.
1169/// * [with_credentials()]: by default this client uses
1170/// [Application Default Credentials]. Applications using custom
1171/// authentication may need to override this default.
1172///
1173/// [with_endpoint()]: super::builder::disk_types::ClientBuilder::with_endpoint
1174/// [with_credentials()]: super::builder::disk_types::ClientBuilder::with_credentials
1175/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1176/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1177///
1178/// # Pooling and Cloning
1179///
1180/// `DiskTypes` holds a connection pool internally, it is advised to
1181/// create one and reuse it. You do not need to wrap `DiskTypes` in
1182/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1183/// already uses an `Arc` internally.
1184#[cfg(feature = "disk-types")]
1185#[cfg_attr(docsrs, doc(cfg(feature = "disk-types")))]
1186#[derive(Clone, Debug)]
1187pub struct DiskTypes {
1188 inner: std::sync::Arc<dyn super::stub::dynamic::DiskTypes>,
1189}
1190
1191#[cfg(feature = "disk-types")]
1192impl DiskTypes {
1193 /// Returns a builder for [DiskTypes].
1194 ///
1195 /// ```
1196 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1197 /// # use google_cloud_compute_v1::client::DiskTypes;
1198 /// let client = DiskTypes::builder().build().await?;
1199 /// # Ok(()) }
1200 /// ```
1201 pub fn builder() -> super::builder::disk_types::ClientBuilder {
1202 crate::new_client_builder(super::builder::disk_types::client::Factory)
1203 }
1204
1205 /// Creates a new client from the provided stub.
1206 ///
1207 /// The most common case for calling this function is in tests mocking the
1208 /// client's behavior.
1209 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1210 where
1211 T: super::stub::DiskTypes + 'static,
1212 {
1213 Self { inner: stub.into() }
1214 }
1215
1216 pub(crate) async fn new(
1217 config: gaxi::options::ClientConfig,
1218 ) -> crate::ClientBuilderResult<Self> {
1219 let inner = Self::build_inner(config).await?;
1220 Ok(Self { inner })
1221 }
1222
1223 async fn build_inner(
1224 conf: gaxi::options::ClientConfig,
1225 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DiskTypes>> {
1226 if gaxi::options::tracing_enabled(&conf) {
1227 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1228 }
1229 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1230 }
1231
1232 async fn build_transport(
1233 conf: gaxi::options::ClientConfig,
1234 ) -> crate::ClientBuilderResult<impl super::stub::DiskTypes> {
1235 super::transport::DiskTypes::new(conf).await
1236 }
1237
1238 async fn build_with_tracing(
1239 conf: gaxi::options::ClientConfig,
1240 ) -> crate::ClientBuilderResult<impl super::stub::DiskTypes> {
1241 Self::build_transport(conf)
1242 .await
1243 .map(super::tracing::DiskTypes::new)
1244 }
1245
1246 /// Retrieves an aggregated list of disk types.
1247 ///
1248 /// To prevent failure, it is recommended that you set the
1249 /// `returnPartialSuccess` parameter to `true`.
1250 pub fn aggregated_list(&self) -> super::builder::disk_types::AggregatedList {
1251 super::builder::disk_types::AggregatedList::new(self.inner.clone())
1252 }
1253
1254 /// Returns the specified disk type.
1255 pub fn get(&self) -> super::builder::disk_types::Get {
1256 super::builder::disk_types::Get::new(self.inner.clone())
1257 }
1258
1259 /// Retrieves a list of disk types available to the specified
1260 /// project.
1261 pub fn list(&self) -> super::builder::disk_types::List {
1262 super::builder::disk_types::List::new(self.inner.clone())
1263 }
1264}
1265
1266/// Implements a client for the Google Compute Engine API.
1267///
1268/// # Example
1269/// ```
1270/// # use google_cloud_compute_v1::client::Disks;
1271/// async fn sample(
1272/// ) -> anyhow::Result<()> {
1273/// let client = Disks::builder().build().await?;
1274/// // use `client` to make requests to the Google Compute Engine API.
1275/// Ok(())
1276/// }
1277/// ```
1278///
1279/// # Service Description
1280///
1281/// Service for the `disks` resource.
1282///
1283/// # Configuration
1284///
1285/// To configure `Disks` use the `with_*` methods in the type returned
1286/// by [builder()][Disks::builder]. The default configuration should
1287/// work for most applications. Common configuration changes include
1288///
1289/// * [with_endpoint()]: by default this client uses the global default endpoint
1290/// (`https://compute.googleapis.com`). Applications using regional
1291/// endpoints or running in restricted networks (e.g. a network configured
1292/// with [Private Google Access with VPC Service Controls]) may want to
1293/// override this default.
1294/// * [with_credentials()]: by default this client uses
1295/// [Application Default Credentials]. Applications using custom
1296/// authentication may need to override this default.
1297///
1298/// [with_endpoint()]: super::builder::disks::ClientBuilder::with_endpoint
1299/// [with_credentials()]: super::builder::disks::ClientBuilder::with_credentials
1300/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1301/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1302///
1303/// # Pooling and Cloning
1304///
1305/// `Disks` holds a connection pool internally, it is advised to
1306/// create one and reuse it. You do not need to wrap `Disks` in
1307/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1308/// already uses an `Arc` internally.
1309#[cfg(feature = "disks")]
1310#[cfg_attr(docsrs, doc(cfg(feature = "disks")))]
1311#[derive(Clone, Debug)]
1312pub struct Disks {
1313 inner: std::sync::Arc<dyn super::stub::dynamic::Disks>,
1314}
1315
1316#[cfg(feature = "disks")]
1317impl Disks {
1318 /// Returns a builder for [Disks].
1319 ///
1320 /// ```
1321 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1322 /// # use google_cloud_compute_v1::client::Disks;
1323 /// let client = Disks::builder().build().await?;
1324 /// # Ok(()) }
1325 /// ```
1326 pub fn builder() -> super::builder::disks::ClientBuilder {
1327 crate::new_client_builder(super::builder::disks::client::Factory)
1328 }
1329
1330 /// Creates a new client from the provided stub.
1331 ///
1332 /// The most common case for calling this function is in tests mocking the
1333 /// client's behavior.
1334 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1335 where
1336 T: super::stub::Disks + 'static,
1337 {
1338 Self { inner: stub.into() }
1339 }
1340
1341 pub(crate) async fn new(
1342 config: gaxi::options::ClientConfig,
1343 ) -> crate::ClientBuilderResult<Self> {
1344 let inner = Self::build_inner(config).await?;
1345 Ok(Self { inner })
1346 }
1347
1348 async fn build_inner(
1349 conf: gaxi::options::ClientConfig,
1350 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Disks>> {
1351 if gaxi::options::tracing_enabled(&conf) {
1352 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1353 }
1354 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1355 }
1356
1357 async fn build_transport(
1358 conf: gaxi::options::ClientConfig,
1359 ) -> crate::ClientBuilderResult<impl super::stub::Disks> {
1360 super::transport::Disks::new(conf).await
1361 }
1362
1363 async fn build_with_tracing(
1364 conf: gaxi::options::ClientConfig,
1365 ) -> crate::ClientBuilderResult<impl super::stub::Disks> {
1366 Self::build_transport(conf)
1367 .await
1368 .map(super::tracing::Disks::new)
1369 }
1370
1371 /// Adds existing resource policies to a disk. You can only add one
1372 /// policy which will be applied to this disk for scheduling snapshot
1373 /// creation.
1374 pub fn add_resource_policies(&self) -> super::builder::disks::AddResourcePolicies {
1375 super::builder::disks::AddResourcePolicies::new(self.inner.clone())
1376 }
1377
1378 /// Retrieves an aggregated list of persistent disks.
1379 ///
1380 /// To prevent failure, it is recommended that you set the
1381 /// `returnPartialSuccess` parameter to `true`.
1382 pub fn aggregated_list(&self) -> super::builder::disks::AggregatedList {
1383 super::builder::disks::AggregatedList::new(self.inner.clone())
1384 }
1385
1386 /// Bulk create a set of disks.
1387 pub fn bulk_insert(&self) -> super::builder::disks::BulkInsert {
1388 super::builder::disks::BulkInsert::new(self.inner.clone())
1389 }
1390
1391 /// Sets the labels on many disks at once. To learn more about labels, read theLabeling
1392 /// Resources documentation.
1393 pub fn bulk_set_labels(&self) -> super::builder::disks::BulkSetLabels {
1394 super::builder::disks::BulkSetLabels::new(self.inner.clone())
1395 }
1396
1397 /// Creates a snapshot of a specified persistent disk. For regular snapshot
1398 /// creation, consider using snapshots.insert
1399 /// instead, as that method supports more features, such as creating snapshots
1400 /// in a project different from the source disk project.
1401 pub fn create_snapshot(&self) -> super::builder::disks::CreateSnapshot {
1402 super::builder::disks::CreateSnapshot::new(self.inner.clone())
1403 }
1404
1405 /// Deletes the specified persistent disk. Deleting a disk removes its data
1406 /// permanently and is irreversible. However, deleting a disk does not
1407 /// delete any snapshots
1408 /// previously made from the disk. You must separatelydelete
1409 /// snapshots.
1410 pub fn delete(&self) -> super::builder::disks::Delete {
1411 super::builder::disks::Delete::new(self.inner.clone())
1412 }
1413
1414 /// Returns the specified persistent disk.
1415 pub fn get(&self) -> super::builder::disks::Get {
1416 super::builder::disks::Get::new(self.inner.clone())
1417 }
1418
1419 /// Gets the access control policy for a resource. May be empty if no such
1420 /// policy or resource exists.
1421 pub fn get_iam_policy(&self) -> super::builder::disks::GetIamPolicy {
1422 super::builder::disks::GetIamPolicy::new(self.inner.clone())
1423 }
1424
1425 /// Creates a persistent disk in the specified project using the data
1426 /// in the request. You can create a disk from a source
1427 /// (sourceImage, sourceSnapshot, orsourceDisk) or create an empty 500 GB data disk by
1428 /// omitting all properties. You can also create a disk that is larger than
1429 /// the default size by specifying the sizeGb property.
1430 pub fn insert(&self) -> super::builder::disks::Insert {
1431 super::builder::disks::Insert::new(self.inner.clone())
1432 }
1433
1434 /// Retrieves a list of persistent disks contained within
1435 /// the specified zone.
1436 pub fn list(&self) -> super::builder::disks::List {
1437 super::builder::disks::List::new(self.inner.clone())
1438 }
1439
1440 /// Removes resource policies from a disk.
1441 pub fn remove_resource_policies(&self) -> super::builder::disks::RemoveResourcePolicies {
1442 super::builder::disks::RemoveResourcePolicies::new(self.inner.clone())
1443 }
1444
1445 /// Resizes the specified persistent disk.
1446 /// You can only increase the size of the disk.
1447 pub fn resize(&self) -> super::builder::disks::Resize {
1448 super::builder::disks::Resize::new(self.inner.clone())
1449 }
1450
1451 /// Sets the access control policy on the specified resource.
1452 /// Replaces any existing policy.
1453 pub fn set_iam_policy(&self) -> super::builder::disks::SetIamPolicy {
1454 super::builder::disks::SetIamPolicy::new(self.inner.clone())
1455 }
1456
1457 /// Sets the labels on a disk. To learn more about labels, read theLabeling
1458 /// Resources documentation.
1459 pub fn set_labels(&self) -> super::builder::disks::SetLabels {
1460 super::builder::disks::SetLabels::new(self.inner.clone())
1461 }
1462
1463 /// Starts asynchronous replication.
1464 /// Must be invoked on the primary disk.
1465 pub fn start_async_replication(&self) -> super::builder::disks::StartAsyncReplication {
1466 super::builder::disks::StartAsyncReplication::new(self.inner.clone())
1467 }
1468
1469 /// Stops asynchronous replication.
1470 /// Can be invoked either on the primary or on the secondary disk.
1471 pub fn stop_async_replication(&self) -> super::builder::disks::StopAsyncReplication {
1472 super::builder::disks::StopAsyncReplication::new(self.inner.clone())
1473 }
1474
1475 /// Stops asynchronous replication for a consistency group of disks.
1476 /// Can be invoked either in the primary or secondary scope.
1477 pub fn stop_group_async_replication(&self) -> super::builder::disks::StopGroupAsyncReplication {
1478 super::builder::disks::StopGroupAsyncReplication::new(self.inner.clone())
1479 }
1480
1481 /// Returns permissions that a caller has on the specified resource.
1482 pub fn test_iam_permissions(&self) -> super::builder::disks::TestIamPermissions {
1483 super::builder::disks::TestIamPermissions::new(self.inner.clone())
1484 }
1485
1486 /// Updates the specified disk with the data included in the request.
1487 /// The update is performed only on selected fields included as part
1488 /// of update-mask.
1489 pub fn update(&self) -> super::builder::disks::Update {
1490 super::builder::disks::Update::new(self.inner.clone())
1491 }
1492
1493 /// Rotates the customer-managed
1494 /// encryption key to the latest version for the specified persistent disk.
1495 pub fn update_kms_key(&self) -> super::builder::disks::UpdateKmsKey {
1496 super::builder::disks::UpdateKmsKey::new(self.inner.clone())
1497 }
1498
1499 /// Retrieves the specified zone-specific Operations resource.
1500 pub fn get_operation(&self) -> super::builder::disks::GetOperation {
1501 super::builder::disks::GetOperation::new(self.inner.clone())
1502 }
1503}
1504
1505/// Implements a client for the Google Compute Engine API.
1506///
1507/// # Example
1508/// ```
1509/// # use google_cloud_compute_v1::client::ExternalVpnGateways;
1510/// async fn sample(
1511/// ) -> anyhow::Result<()> {
1512/// let client = ExternalVpnGateways::builder().build().await?;
1513/// // use `client` to make requests to the Google Compute Engine API.
1514/// Ok(())
1515/// }
1516/// ```
1517///
1518/// # Service Description
1519///
1520/// Service for the `externalVpnGateways` resource.
1521///
1522/// # Configuration
1523///
1524/// To configure `ExternalVpnGateways` use the `with_*` methods in the type returned
1525/// by [builder()][ExternalVpnGateways::builder]. The default configuration should
1526/// work for most applications. Common configuration changes include
1527///
1528/// * [with_endpoint()]: by default this client uses the global default endpoint
1529/// (`https://compute.googleapis.com`). Applications using regional
1530/// endpoints or running in restricted networks (e.g. a network configured
1531/// with [Private Google Access with VPC Service Controls]) may want to
1532/// override this default.
1533/// * [with_credentials()]: by default this client uses
1534/// [Application Default Credentials]. Applications using custom
1535/// authentication may need to override this default.
1536///
1537/// [with_endpoint()]: super::builder::external_vpn_gateways::ClientBuilder::with_endpoint
1538/// [with_credentials()]: super::builder::external_vpn_gateways::ClientBuilder::with_credentials
1539/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1540/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1541///
1542/// # Pooling and Cloning
1543///
1544/// `ExternalVpnGateways` holds a connection pool internally, it is advised to
1545/// create one and reuse it. You do not need to wrap `ExternalVpnGateways` in
1546/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1547/// already uses an `Arc` internally.
1548#[cfg(feature = "external-vpn-gateways")]
1549#[cfg_attr(docsrs, doc(cfg(feature = "external-vpn-gateways")))]
1550#[derive(Clone, Debug)]
1551pub struct ExternalVpnGateways {
1552 inner: std::sync::Arc<dyn super::stub::dynamic::ExternalVpnGateways>,
1553}
1554
1555#[cfg(feature = "external-vpn-gateways")]
1556impl ExternalVpnGateways {
1557 /// Returns a builder for [ExternalVpnGateways].
1558 ///
1559 /// ```
1560 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1561 /// # use google_cloud_compute_v1::client::ExternalVpnGateways;
1562 /// let client = ExternalVpnGateways::builder().build().await?;
1563 /// # Ok(()) }
1564 /// ```
1565 pub fn builder() -> super::builder::external_vpn_gateways::ClientBuilder {
1566 crate::new_client_builder(super::builder::external_vpn_gateways::client::Factory)
1567 }
1568
1569 /// Creates a new client from the provided stub.
1570 ///
1571 /// The most common case for calling this function is in tests mocking the
1572 /// client's behavior.
1573 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1574 where
1575 T: super::stub::ExternalVpnGateways + 'static,
1576 {
1577 Self { inner: stub.into() }
1578 }
1579
1580 pub(crate) async fn new(
1581 config: gaxi::options::ClientConfig,
1582 ) -> crate::ClientBuilderResult<Self> {
1583 let inner = Self::build_inner(config).await?;
1584 Ok(Self { inner })
1585 }
1586
1587 async fn build_inner(
1588 conf: gaxi::options::ClientConfig,
1589 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ExternalVpnGateways>>
1590 {
1591 if gaxi::options::tracing_enabled(&conf) {
1592 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1593 }
1594 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1595 }
1596
1597 async fn build_transport(
1598 conf: gaxi::options::ClientConfig,
1599 ) -> crate::ClientBuilderResult<impl super::stub::ExternalVpnGateways> {
1600 super::transport::ExternalVpnGateways::new(conf).await
1601 }
1602
1603 async fn build_with_tracing(
1604 conf: gaxi::options::ClientConfig,
1605 ) -> crate::ClientBuilderResult<impl super::stub::ExternalVpnGateways> {
1606 Self::build_transport(conf)
1607 .await
1608 .map(super::tracing::ExternalVpnGateways::new)
1609 }
1610
1611 /// Deletes the specified externalVpnGateway.
1612 pub fn delete(&self) -> super::builder::external_vpn_gateways::Delete {
1613 super::builder::external_vpn_gateways::Delete::new(self.inner.clone())
1614 }
1615
1616 /// Returns the specified externalVpnGateway. Get a list of available
1617 /// externalVpnGateways by making a list() request.
1618 pub fn get(&self) -> super::builder::external_vpn_gateways::Get {
1619 super::builder::external_vpn_gateways::Get::new(self.inner.clone())
1620 }
1621
1622 /// Creates a ExternalVpnGateway in the specified project using
1623 /// the data included in the request.
1624 pub fn insert(&self) -> super::builder::external_vpn_gateways::Insert {
1625 super::builder::external_vpn_gateways::Insert::new(self.inner.clone())
1626 }
1627
1628 /// Retrieves the list of ExternalVpnGateway available to the specified
1629 /// project.
1630 pub fn list(&self) -> super::builder::external_vpn_gateways::List {
1631 super::builder::external_vpn_gateways::List::new(self.inner.clone())
1632 }
1633
1634 /// Sets the labels on an ExternalVpnGateway. To learn more about labels,
1635 /// read the Labeling
1636 /// Resources documentation.
1637 pub fn set_labels(&self) -> super::builder::external_vpn_gateways::SetLabels {
1638 super::builder::external_vpn_gateways::SetLabels::new(self.inner.clone())
1639 }
1640
1641 /// Returns permissions that a caller has on the specified resource.
1642 pub fn test_iam_permissions(
1643 &self,
1644 ) -> super::builder::external_vpn_gateways::TestIamPermissions {
1645 super::builder::external_vpn_gateways::TestIamPermissions::new(self.inner.clone())
1646 }
1647
1648 /// Retrieves the specified Operations resource.
1649 pub fn get_operation(&self) -> super::builder::external_vpn_gateways::GetOperation {
1650 super::builder::external_vpn_gateways::GetOperation::new(self.inner.clone())
1651 }
1652}
1653
1654/// Implements a client for the Google Compute Engine API.
1655///
1656/// # Example
1657/// ```
1658/// # use google_cloud_compute_v1::client::FirewallPolicies;
1659/// async fn sample(
1660/// ) -> anyhow::Result<()> {
1661/// let client = FirewallPolicies::builder().build().await?;
1662/// // use `client` to make requests to the Google Compute Engine API.
1663/// Ok(())
1664/// }
1665/// ```
1666///
1667/// # Service Description
1668///
1669/// Service for the `firewallPolicies` resource.
1670///
1671/// # Configuration
1672///
1673/// To configure `FirewallPolicies` use the `with_*` methods in the type returned
1674/// by [builder()][FirewallPolicies::builder]. The default configuration should
1675/// work for most applications. Common configuration changes include
1676///
1677/// * [with_endpoint()]: by default this client uses the global default endpoint
1678/// (`https://compute.googleapis.com`). Applications using regional
1679/// endpoints or running in restricted networks (e.g. a network configured
1680/// with [Private Google Access with VPC Service Controls]) may want to
1681/// override this default.
1682/// * [with_credentials()]: by default this client uses
1683/// [Application Default Credentials]. Applications using custom
1684/// authentication may need to override this default.
1685///
1686/// [with_endpoint()]: super::builder::firewall_policies::ClientBuilder::with_endpoint
1687/// [with_credentials()]: super::builder::firewall_policies::ClientBuilder::with_credentials
1688/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1689/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1690///
1691/// # Pooling and Cloning
1692///
1693/// `FirewallPolicies` holds a connection pool internally, it is advised to
1694/// create one and reuse it. You do not need to wrap `FirewallPolicies` in
1695/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1696/// already uses an `Arc` internally.
1697#[cfg(feature = "firewall-policies")]
1698#[cfg_attr(docsrs, doc(cfg(feature = "firewall-policies")))]
1699#[derive(Clone, Debug)]
1700pub struct FirewallPolicies {
1701 inner: std::sync::Arc<dyn super::stub::dynamic::FirewallPolicies>,
1702}
1703
1704#[cfg(feature = "firewall-policies")]
1705impl FirewallPolicies {
1706 /// Returns a builder for [FirewallPolicies].
1707 ///
1708 /// ```
1709 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1710 /// # use google_cloud_compute_v1::client::FirewallPolicies;
1711 /// let client = FirewallPolicies::builder().build().await?;
1712 /// # Ok(()) }
1713 /// ```
1714 pub fn builder() -> super::builder::firewall_policies::ClientBuilder {
1715 crate::new_client_builder(super::builder::firewall_policies::client::Factory)
1716 }
1717
1718 /// Creates a new client from the provided stub.
1719 ///
1720 /// The most common case for calling this function is in tests mocking the
1721 /// client's behavior.
1722 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1723 where
1724 T: super::stub::FirewallPolicies + 'static,
1725 {
1726 Self { inner: stub.into() }
1727 }
1728
1729 pub(crate) async fn new(
1730 config: gaxi::options::ClientConfig,
1731 ) -> crate::ClientBuilderResult<Self> {
1732 let inner = Self::build_inner(config).await?;
1733 Ok(Self { inner })
1734 }
1735
1736 async fn build_inner(
1737 conf: gaxi::options::ClientConfig,
1738 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FirewallPolicies>>
1739 {
1740 if gaxi::options::tracing_enabled(&conf) {
1741 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1742 }
1743 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1744 }
1745
1746 async fn build_transport(
1747 conf: gaxi::options::ClientConfig,
1748 ) -> crate::ClientBuilderResult<impl super::stub::FirewallPolicies> {
1749 super::transport::FirewallPolicies::new(conf).await
1750 }
1751
1752 async fn build_with_tracing(
1753 conf: gaxi::options::ClientConfig,
1754 ) -> crate::ClientBuilderResult<impl super::stub::FirewallPolicies> {
1755 Self::build_transport(conf)
1756 .await
1757 .map(super::tracing::FirewallPolicies::new)
1758 }
1759
1760 /// Inserts an association for the specified firewall policy.
1761 pub fn add_association(&self) -> super::builder::firewall_policies::AddAssociation {
1762 super::builder::firewall_policies::AddAssociation::new(self.inner.clone())
1763 }
1764
1765 /// Inserts a rule into a firewall policy.
1766 pub fn add_rule(&self) -> super::builder::firewall_policies::AddRule {
1767 super::builder::firewall_policies::AddRule::new(self.inner.clone())
1768 }
1769
1770 /// Copies rules to the specified firewall policy.
1771 pub fn clone_rules(&self) -> super::builder::firewall_policies::CloneRules {
1772 super::builder::firewall_policies::CloneRules::new(self.inner.clone())
1773 }
1774
1775 /// Deletes the specified policy.
1776 pub fn delete(&self) -> super::builder::firewall_policies::Delete {
1777 super::builder::firewall_policies::Delete::new(self.inner.clone())
1778 }
1779
1780 /// Returns the specified firewall policy.
1781 pub fn get(&self) -> super::builder::firewall_policies::Get {
1782 super::builder::firewall_policies::Get::new(self.inner.clone())
1783 }
1784
1785 /// Gets an association with the specified name.
1786 pub fn get_association(&self) -> super::builder::firewall_policies::GetAssociation {
1787 super::builder::firewall_policies::GetAssociation::new(self.inner.clone())
1788 }
1789
1790 /// Gets the access control policy for a resource. May be empty if no such
1791 /// policy or resource exists.
1792 pub fn get_iam_policy(&self) -> super::builder::firewall_policies::GetIamPolicy {
1793 super::builder::firewall_policies::GetIamPolicy::new(self.inner.clone())
1794 }
1795
1796 /// Gets a rule of the specified priority.
1797 pub fn get_rule(&self) -> super::builder::firewall_policies::GetRule {
1798 super::builder::firewall_policies::GetRule::new(self.inner.clone())
1799 }
1800
1801 /// Creates a new policy in the specified project using the data included in
1802 /// the request.
1803 pub fn insert(&self) -> super::builder::firewall_policies::Insert {
1804 super::builder::firewall_policies::Insert::new(self.inner.clone())
1805 }
1806
1807 /// Lists all the policies that have been configured for the specified
1808 /// folder or organization.
1809 pub fn list(&self) -> super::builder::firewall_policies::List {
1810 super::builder::firewall_policies::List::new(self.inner.clone())
1811 }
1812
1813 /// Lists associations of a specified target, i.e., organization or folder.
1814 pub fn list_associations(&self) -> super::builder::firewall_policies::ListAssociations {
1815 super::builder::firewall_policies::ListAssociations::new(self.inner.clone())
1816 }
1817
1818 /// Moves the specified firewall policy.
1819 pub fn r#move(&self) -> super::builder::firewall_policies::Move {
1820 super::builder::firewall_policies::Move::new(self.inner.clone())
1821 }
1822
1823 /// Patches the specified policy with the data included in the request.
1824 pub fn patch(&self) -> super::builder::firewall_policies::Patch {
1825 super::builder::firewall_policies::Patch::new(self.inner.clone())
1826 }
1827
1828 /// Patches a rule of the specified priority.
1829 pub fn patch_rule(&self) -> super::builder::firewall_policies::PatchRule {
1830 super::builder::firewall_policies::PatchRule::new(self.inner.clone())
1831 }
1832
1833 /// Removes an association for the specified firewall policy.
1834 pub fn remove_association(&self) -> super::builder::firewall_policies::RemoveAssociation {
1835 super::builder::firewall_policies::RemoveAssociation::new(self.inner.clone())
1836 }
1837
1838 /// Deletes a rule of the specified priority.
1839 pub fn remove_rule(&self) -> super::builder::firewall_policies::RemoveRule {
1840 super::builder::firewall_policies::RemoveRule::new(self.inner.clone())
1841 }
1842
1843 /// Sets the access control policy on the specified resource.
1844 /// Replaces any existing policy.
1845 pub fn set_iam_policy(&self) -> super::builder::firewall_policies::SetIamPolicy {
1846 super::builder::firewall_policies::SetIamPolicy::new(self.inner.clone())
1847 }
1848
1849 /// Returns permissions that a caller has on the specified resource.
1850 pub fn test_iam_permissions(&self) -> super::builder::firewall_policies::TestIamPermissions {
1851 super::builder::firewall_policies::TestIamPermissions::new(self.inner.clone())
1852 }
1853
1854 /// Retrieves the specified Operations resource. Gets a list of operations
1855 /// by making a `list()` request.
1856 pub fn get_operation(&self) -> super::builder::firewall_policies::GetOperation {
1857 super::builder::firewall_policies::GetOperation::new(self.inner.clone())
1858 }
1859}
1860
1861/// Implements a client for the Google Compute Engine API.
1862///
1863/// # Example
1864/// ```
1865/// # use google_cloud_compute_v1::client::Firewalls;
1866/// async fn sample(
1867/// ) -> anyhow::Result<()> {
1868/// let client = Firewalls::builder().build().await?;
1869/// // use `client` to make requests to the Google Compute Engine API.
1870/// Ok(())
1871/// }
1872/// ```
1873///
1874/// # Service Description
1875///
1876/// Service for the `firewalls` resource.
1877///
1878/// # Configuration
1879///
1880/// To configure `Firewalls` use the `with_*` methods in the type returned
1881/// by [builder()][Firewalls::builder]. The default configuration should
1882/// work for most applications. Common configuration changes include
1883///
1884/// * [with_endpoint()]: by default this client uses the global default endpoint
1885/// (`https://compute.googleapis.com`). Applications using regional
1886/// endpoints or running in restricted networks (e.g. a network configured
1887/// with [Private Google Access with VPC Service Controls]) may want to
1888/// override this default.
1889/// * [with_credentials()]: by default this client uses
1890/// [Application Default Credentials]. Applications using custom
1891/// authentication may need to override this default.
1892///
1893/// [with_endpoint()]: super::builder::firewalls::ClientBuilder::with_endpoint
1894/// [with_credentials()]: super::builder::firewalls::ClientBuilder::with_credentials
1895/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1896/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1897///
1898/// # Pooling and Cloning
1899///
1900/// `Firewalls` holds a connection pool internally, it is advised to
1901/// create one and reuse it. You do not need to wrap `Firewalls` in
1902/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1903/// already uses an `Arc` internally.
1904#[cfg(feature = "firewalls")]
1905#[cfg_attr(docsrs, doc(cfg(feature = "firewalls")))]
1906#[derive(Clone, Debug)]
1907pub struct Firewalls {
1908 inner: std::sync::Arc<dyn super::stub::dynamic::Firewalls>,
1909}
1910
1911#[cfg(feature = "firewalls")]
1912impl Firewalls {
1913 /// Returns a builder for [Firewalls].
1914 ///
1915 /// ```
1916 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1917 /// # use google_cloud_compute_v1::client::Firewalls;
1918 /// let client = Firewalls::builder().build().await?;
1919 /// # Ok(()) }
1920 /// ```
1921 pub fn builder() -> super::builder::firewalls::ClientBuilder {
1922 crate::new_client_builder(super::builder::firewalls::client::Factory)
1923 }
1924
1925 /// Creates a new client from the provided stub.
1926 ///
1927 /// The most common case for calling this function is in tests mocking the
1928 /// client's behavior.
1929 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1930 where
1931 T: super::stub::Firewalls + 'static,
1932 {
1933 Self { inner: stub.into() }
1934 }
1935
1936 pub(crate) async fn new(
1937 config: gaxi::options::ClientConfig,
1938 ) -> crate::ClientBuilderResult<Self> {
1939 let inner = Self::build_inner(config).await?;
1940 Ok(Self { inner })
1941 }
1942
1943 async fn build_inner(
1944 conf: gaxi::options::ClientConfig,
1945 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Firewalls>> {
1946 if gaxi::options::tracing_enabled(&conf) {
1947 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1948 }
1949 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1950 }
1951
1952 async fn build_transport(
1953 conf: gaxi::options::ClientConfig,
1954 ) -> crate::ClientBuilderResult<impl super::stub::Firewalls> {
1955 super::transport::Firewalls::new(conf).await
1956 }
1957
1958 async fn build_with_tracing(
1959 conf: gaxi::options::ClientConfig,
1960 ) -> crate::ClientBuilderResult<impl super::stub::Firewalls> {
1961 Self::build_transport(conf)
1962 .await
1963 .map(super::tracing::Firewalls::new)
1964 }
1965
1966 /// Deletes the specified firewall.
1967 pub fn delete(&self) -> super::builder::firewalls::Delete {
1968 super::builder::firewalls::Delete::new(self.inner.clone())
1969 }
1970
1971 /// Returns the specified firewall.
1972 pub fn get(&self) -> super::builder::firewalls::Get {
1973 super::builder::firewalls::Get::new(self.inner.clone())
1974 }
1975
1976 /// Creates a firewall rule in the specified project using the data
1977 /// included in the request.
1978 pub fn insert(&self) -> super::builder::firewalls::Insert {
1979 super::builder::firewalls::Insert::new(self.inner.clone())
1980 }
1981
1982 /// Retrieves the list of firewall rules available to the specified
1983 /// project.
1984 pub fn list(&self) -> super::builder::firewalls::List {
1985 super::builder::firewalls::List::new(self.inner.clone())
1986 }
1987
1988 /// Updates the specified firewall rule with the data included in the
1989 /// request. This method supportsPATCH
1990 /// semantics and uses theJSON merge
1991 /// patch format and processing rules.
1992 pub fn patch(&self) -> super::builder::firewalls::Patch {
1993 super::builder::firewalls::Patch::new(self.inner.clone())
1994 }
1995
1996 /// Returns permissions that a caller has on the specified resource.
1997 pub fn test_iam_permissions(&self) -> super::builder::firewalls::TestIamPermissions {
1998 super::builder::firewalls::TestIamPermissions::new(self.inner.clone())
1999 }
2000
2001 /// Updates the specified firewall rule with the data included in the
2002 /// request.
2003 /// Note that all fields will be updated if using PUT, even fields that are not
2004 /// specified. To update individual fields, please use PATCH instead.
2005 pub fn update(&self) -> super::builder::firewalls::Update {
2006 super::builder::firewalls::Update::new(self.inner.clone())
2007 }
2008
2009 /// Retrieves the specified Operations resource.
2010 pub fn get_operation(&self) -> super::builder::firewalls::GetOperation {
2011 super::builder::firewalls::GetOperation::new(self.inner.clone())
2012 }
2013}
2014
2015/// Implements a client for the Google Compute Engine API.
2016///
2017/// # Example
2018/// ```
2019/// # use google_cloud_compute_v1::client::ForwardingRules;
2020/// async fn sample(
2021/// ) -> anyhow::Result<()> {
2022/// let client = ForwardingRules::builder().build().await?;
2023/// // use `client` to make requests to the Google Compute Engine API.
2024/// Ok(())
2025/// }
2026/// ```
2027///
2028/// # Service Description
2029///
2030/// Service for the `forwardingRules` resource.
2031///
2032/// # Configuration
2033///
2034/// To configure `ForwardingRules` use the `with_*` methods in the type returned
2035/// by [builder()][ForwardingRules::builder]. The default configuration should
2036/// work for most applications. Common configuration changes include
2037///
2038/// * [with_endpoint()]: by default this client uses the global default endpoint
2039/// (`https://compute.googleapis.com`). Applications using regional
2040/// endpoints or running in restricted networks (e.g. a network configured
2041/// with [Private Google Access with VPC Service Controls]) may want to
2042/// override this default.
2043/// * [with_credentials()]: by default this client uses
2044/// [Application Default Credentials]. Applications using custom
2045/// authentication may need to override this default.
2046///
2047/// [with_endpoint()]: super::builder::forwarding_rules::ClientBuilder::with_endpoint
2048/// [with_credentials()]: super::builder::forwarding_rules::ClientBuilder::with_credentials
2049/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2050/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2051///
2052/// # Pooling and Cloning
2053///
2054/// `ForwardingRules` holds a connection pool internally, it is advised to
2055/// create one and reuse it. You do not need to wrap `ForwardingRules` in
2056/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2057/// already uses an `Arc` internally.
2058#[cfg(feature = "forwarding-rules")]
2059#[cfg_attr(docsrs, doc(cfg(feature = "forwarding-rules")))]
2060#[derive(Clone, Debug)]
2061pub struct ForwardingRules {
2062 inner: std::sync::Arc<dyn super::stub::dynamic::ForwardingRules>,
2063}
2064
2065#[cfg(feature = "forwarding-rules")]
2066impl ForwardingRules {
2067 /// Returns a builder for [ForwardingRules].
2068 ///
2069 /// ```
2070 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2071 /// # use google_cloud_compute_v1::client::ForwardingRules;
2072 /// let client = ForwardingRules::builder().build().await?;
2073 /// # Ok(()) }
2074 /// ```
2075 pub fn builder() -> super::builder::forwarding_rules::ClientBuilder {
2076 crate::new_client_builder(super::builder::forwarding_rules::client::Factory)
2077 }
2078
2079 /// Creates a new client from the provided stub.
2080 ///
2081 /// The most common case for calling this function is in tests mocking the
2082 /// client's behavior.
2083 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2084 where
2085 T: super::stub::ForwardingRules + 'static,
2086 {
2087 Self { inner: stub.into() }
2088 }
2089
2090 pub(crate) async fn new(
2091 config: gaxi::options::ClientConfig,
2092 ) -> crate::ClientBuilderResult<Self> {
2093 let inner = Self::build_inner(config).await?;
2094 Ok(Self { inner })
2095 }
2096
2097 async fn build_inner(
2098 conf: gaxi::options::ClientConfig,
2099 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ForwardingRules>> {
2100 if gaxi::options::tracing_enabled(&conf) {
2101 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2102 }
2103 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2104 }
2105
2106 async fn build_transport(
2107 conf: gaxi::options::ClientConfig,
2108 ) -> crate::ClientBuilderResult<impl super::stub::ForwardingRules> {
2109 super::transport::ForwardingRules::new(conf).await
2110 }
2111
2112 async fn build_with_tracing(
2113 conf: gaxi::options::ClientConfig,
2114 ) -> crate::ClientBuilderResult<impl super::stub::ForwardingRules> {
2115 Self::build_transport(conf)
2116 .await
2117 .map(super::tracing::ForwardingRules::new)
2118 }
2119
2120 /// Retrieves an aggregated list of forwarding rules.
2121 ///
2122 /// To prevent failure, it is recommended that you set the
2123 /// `returnPartialSuccess` parameter to `true`.
2124 pub fn aggregated_list(&self) -> super::builder::forwarding_rules::AggregatedList {
2125 super::builder::forwarding_rules::AggregatedList::new(self.inner.clone())
2126 }
2127
2128 /// Deletes the specified ForwardingRule resource.
2129 pub fn delete(&self) -> super::builder::forwarding_rules::Delete {
2130 super::builder::forwarding_rules::Delete::new(self.inner.clone())
2131 }
2132
2133 /// Returns the specified ForwardingRule resource.
2134 pub fn get(&self) -> super::builder::forwarding_rules::Get {
2135 super::builder::forwarding_rules::Get::new(self.inner.clone())
2136 }
2137
2138 /// Creates a ForwardingRule resource in the specified project and region using
2139 /// the data included in the request.
2140 pub fn insert(&self) -> super::builder::forwarding_rules::Insert {
2141 super::builder::forwarding_rules::Insert::new(self.inner.clone())
2142 }
2143
2144 /// Retrieves a list of ForwardingRule resources available to the specified
2145 /// project and region.
2146 pub fn list(&self) -> super::builder::forwarding_rules::List {
2147 super::builder::forwarding_rules::List::new(self.inner.clone())
2148 }
2149
2150 /// Updates the specified forwarding rule with the data included in the
2151 /// request. This method supportsPATCH
2152 /// semantics and uses theJSON merge
2153 /// patch format and processing rules. Currently, you can only
2154 /// patch the network_tier field.
2155 pub fn patch(&self) -> super::builder::forwarding_rules::Patch {
2156 super::builder::forwarding_rules::Patch::new(self.inner.clone())
2157 }
2158
2159 /// Sets the labels on the specified resource. To learn more about labels,
2160 /// read the
2161 /// Labeling Resources documentation.
2162 pub fn set_labels(&self) -> super::builder::forwarding_rules::SetLabels {
2163 super::builder::forwarding_rules::SetLabels::new(self.inner.clone())
2164 }
2165
2166 /// Changes target URL for forwarding rule. The new target should be of the
2167 /// same type as the old target.
2168 pub fn set_target(&self) -> super::builder::forwarding_rules::SetTarget {
2169 super::builder::forwarding_rules::SetTarget::new(self.inner.clone())
2170 }
2171
2172 /// Retrieves the specified region-specific Operations resource.
2173 pub fn get_operation(&self) -> super::builder::forwarding_rules::GetOperation {
2174 super::builder::forwarding_rules::GetOperation::new(self.inner.clone())
2175 }
2176}
2177
2178/// Implements a client for the Google Compute Engine API.
2179///
2180/// # Example
2181/// ```
2182/// # use google_cloud_compute_v1::client::FutureReservations;
2183/// async fn sample(
2184/// ) -> anyhow::Result<()> {
2185/// let client = FutureReservations::builder().build().await?;
2186/// // use `client` to make requests to the Google Compute Engine API.
2187/// Ok(())
2188/// }
2189/// ```
2190///
2191/// # Service Description
2192///
2193/// Service for the `futureReservations` resource.
2194///
2195/// # Configuration
2196///
2197/// To configure `FutureReservations` use the `with_*` methods in the type returned
2198/// by [builder()][FutureReservations::builder]. The default configuration should
2199/// work for most applications. Common configuration changes include
2200///
2201/// * [with_endpoint()]: by default this client uses the global default endpoint
2202/// (`https://compute.googleapis.com`). Applications using regional
2203/// endpoints or running in restricted networks (e.g. a network configured
2204/// with [Private Google Access with VPC Service Controls]) may want to
2205/// override this default.
2206/// * [with_credentials()]: by default this client uses
2207/// [Application Default Credentials]. Applications using custom
2208/// authentication may need to override this default.
2209///
2210/// [with_endpoint()]: super::builder::future_reservations::ClientBuilder::with_endpoint
2211/// [with_credentials()]: super::builder::future_reservations::ClientBuilder::with_credentials
2212/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2213/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2214///
2215/// # Pooling and Cloning
2216///
2217/// `FutureReservations` holds a connection pool internally, it is advised to
2218/// create one and reuse it. You do not need to wrap `FutureReservations` in
2219/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2220/// already uses an `Arc` internally.
2221#[cfg(feature = "future-reservations")]
2222#[cfg_attr(docsrs, doc(cfg(feature = "future-reservations")))]
2223#[derive(Clone, Debug)]
2224pub struct FutureReservations {
2225 inner: std::sync::Arc<dyn super::stub::dynamic::FutureReservations>,
2226}
2227
2228#[cfg(feature = "future-reservations")]
2229impl FutureReservations {
2230 /// Returns a builder for [FutureReservations].
2231 ///
2232 /// ```
2233 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2234 /// # use google_cloud_compute_v1::client::FutureReservations;
2235 /// let client = FutureReservations::builder().build().await?;
2236 /// # Ok(()) }
2237 /// ```
2238 pub fn builder() -> super::builder::future_reservations::ClientBuilder {
2239 crate::new_client_builder(super::builder::future_reservations::client::Factory)
2240 }
2241
2242 /// Creates a new client from the provided stub.
2243 ///
2244 /// The most common case for calling this function is in tests mocking the
2245 /// client's behavior.
2246 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2247 where
2248 T: super::stub::FutureReservations + 'static,
2249 {
2250 Self { inner: stub.into() }
2251 }
2252
2253 pub(crate) async fn new(
2254 config: gaxi::options::ClientConfig,
2255 ) -> crate::ClientBuilderResult<Self> {
2256 let inner = Self::build_inner(config).await?;
2257 Ok(Self { inner })
2258 }
2259
2260 async fn build_inner(
2261 conf: gaxi::options::ClientConfig,
2262 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::FutureReservations>>
2263 {
2264 if gaxi::options::tracing_enabled(&conf) {
2265 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2266 }
2267 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2268 }
2269
2270 async fn build_transport(
2271 conf: gaxi::options::ClientConfig,
2272 ) -> crate::ClientBuilderResult<impl super::stub::FutureReservations> {
2273 super::transport::FutureReservations::new(conf).await
2274 }
2275
2276 async fn build_with_tracing(
2277 conf: gaxi::options::ClientConfig,
2278 ) -> crate::ClientBuilderResult<impl super::stub::FutureReservations> {
2279 Self::build_transport(conf)
2280 .await
2281 .map(super::tracing::FutureReservations::new)
2282 }
2283
2284 /// Retrieves an aggregated list of future reservations.
2285 ///
2286 /// To prevent failure, it is recommended that you set the
2287 /// `returnPartialSuccess` parameter to `true`.
2288 pub fn aggregated_list(&self) -> super::builder::future_reservations::AggregatedList {
2289 super::builder::future_reservations::AggregatedList::new(self.inner.clone())
2290 }
2291
2292 /// Cancel the specified future reservation.
2293 pub fn cancel(&self) -> super::builder::future_reservations::Cancel {
2294 super::builder::future_reservations::Cancel::new(self.inner.clone())
2295 }
2296
2297 /// Deletes the specified future reservation.
2298 pub fn delete(&self) -> super::builder::future_reservations::Delete {
2299 super::builder::future_reservations::Delete::new(self.inner.clone())
2300 }
2301
2302 /// Retrieves information about the specified future reservation.
2303 pub fn get(&self) -> super::builder::future_reservations::Get {
2304 super::builder::future_reservations::Get::new(self.inner.clone())
2305 }
2306
2307 /// Creates a new Future Reservation.
2308 pub fn insert(&self) -> super::builder::future_reservations::Insert {
2309 super::builder::future_reservations::Insert::new(self.inner.clone())
2310 }
2311
2312 /// A list of all the future reservations that have been configured for the
2313 /// specified project in specified zone.
2314 pub fn list(&self) -> super::builder::future_reservations::List {
2315 super::builder::future_reservations::List::new(self.inner.clone())
2316 }
2317
2318 /// Updates the specified future reservation.
2319 pub fn update(&self) -> super::builder::future_reservations::Update {
2320 super::builder::future_reservations::Update::new(self.inner.clone())
2321 }
2322
2323 /// Retrieves the specified zone-specific Operations resource.
2324 pub fn get_operation(&self) -> super::builder::future_reservations::GetOperation {
2325 super::builder::future_reservations::GetOperation::new(self.inner.clone())
2326 }
2327}
2328
2329/// Implements a client for the Google Compute Engine API.
2330///
2331/// # Example
2332/// ```
2333/// # use google_cloud_compute_v1::client::GlobalAddresses;
2334/// async fn sample(
2335/// ) -> anyhow::Result<()> {
2336/// let client = GlobalAddresses::builder().build().await?;
2337/// // use `client` to make requests to the Google Compute Engine API.
2338/// Ok(())
2339/// }
2340/// ```
2341///
2342/// # Service Description
2343///
2344/// Service for the `globalAddresses` resource.
2345///
2346/// # Configuration
2347///
2348/// To configure `GlobalAddresses` use the `with_*` methods in the type returned
2349/// by [builder()][GlobalAddresses::builder]. The default configuration should
2350/// work for most applications. Common configuration changes include
2351///
2352/// * [with_endpoint()]: by default this client uses the global default endpoint
2353/// (`https://compute.googleapis.com`). Applications using regional
2354/// endpoints or running in restricted networks (e.g. a network configured
2355/// with [Private Google Access with VPC Service Controls]) may want to
2356/// override this default.
2357/// * [with_credentials()]: by default this client uses
2358/// [Application Default Credentials]. Applications using custom
2359/// authentication may need to override this default.
2360///
2361/// [with_endpoint()]: super::builder::global_addresses::ClientBuilder::with_endpoint
2362/// [with_credentials()]: super::builder::global_addresses::ClientBuilder::with_credentials
2363/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2364/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2365///
2366/// # Pooling and Cloning
2367///
2368/// `GlobalAddresses` holds a connection pool internally, it is advised to
2369/// create one and reuse it. You do not need to wrap `GlobalAddresses` in
2370/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2371/// already uses an `Arc` internally.
2372#[cfg(feature = "global-addresses")]
2373#[cfg_attr(docsrs, doc(cfg(feature = "global-addresses")))]
2374#[derive(Clone, Debug)]
2375pub struct GlobalAddresses {
2376 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalAddresses>,
2377}
2378
2379#[cfg(feature = "global-addresses")]
2380impl GlobalAddresses {
2381 /// Returns a builder for [GlobalAddresses].
2382 ///
2383 /// ```
2384 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2385 /// # use google_cloud_compute_v1::client::GlobalAddresses;
2386 /// let client = GlobalAddresses::builder().build().await?;
2387 /// # Ok(()) }
2388 /// ```
2389 pub fn builder() -> super::builder::global_addresses::ClientBuilder {
2390 crate::new_client_builder(super::builder::global_addresses::client::Factory)
2391 }
2392
2393 /// Creates a new client from the provided stub.
2394 ///
2395 /// The most common case for calling this function is in tests mocking the
2396 /// client's behavior.
2397 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2398 where
2399 T: super::stub::GlobalAddresses + 'static,
2400 {
2401 Self { inner: stub.into() }
2402 }
2403
2404 pub(crate) async fn new(
2405 config: gaxi::options::ClientConfig,
2406 ) -> crate::ClientBuilderResult<Self> {
2407 let inner = Self::build_inner(config).await?;
2408 Ok(Self { inner })
2409 }
2410
2411 async fn build_inner(
2412 conf: gaxi::options::ClientConfig,
2413 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GlobalAddresses>> {
2414 if gaxi::options::tracing_enabled(&conf) {
2415 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2416 }
2417 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2418 }
2419
2420 async fn build_transport(
2421 conf: gaxi::options::ClientConfig,
2422 ) -> crate::ClientBuilderResult<impl super::stub::GlobalAddresses> {
2423 super::transport::GlobalAddresses::new(conf).await
2424 }
2425
2426 async fn build_with_tracing(
2427 conf: gaxi::options::ClientConfig,
2428 ) -> crate::ClientBuilderResult<impl super::stub::GlobalAddresses> {
2429 Self::build_transport(conf)
2430 .await
2431 .map(super::tracing::GlobalAddresses::new)
2432 }
2433
2434 /// Deletes the specified address resource.
2435 pub fn delete(&self) -> super::builder::global_addresses::Delete {
2436 super::builder::global_addresses::Delete::new(self.inner.clone())
2437 }
2438
2439 /// Returns the specified address resource.
2440 pub fn get(&self) -> super::builder::global_addresses::Get {
2441 super::builder::global_addresses::Get::new(self.inner.clone())
2442 }
2443
2444 /// Creates an address resource in the specified project by using the data
2445 /// included in the request.
2446 pub fn insert(&self) -> super::builder::global_addresses::Insert {
2447 super::builder::global_addresses::Insert::new(self.inner.clone())
2448 }
2449
2450 /// Retrieves a list of global addresses.
2451 pub fn list(&self) -> super::builder::global_addresses::List {
2452 super::builder::global_addresses::List::new(self.inner.clone())
2453 }
2454
2455 /// Moves the specified address resource from one project to another project.
2456 pub fn r#move(&self) -> super::builder::global_addresses::Move {
2457 super::builder::global_addresses::Move::new(self.inner.clone())
2458 }
2459
2460 /// Sets the labels on a GlobalAddress. To learn more about labels, read theLabeling
2461 /// Resources documentation.
2462 pub fn set_labels(&self) -> super::builder::global_addresses::SetLabels {
2463 super::builder::global_addresses::SetLabels::new(self.inner.clone())
2464 }
2465
2466 /// Returns permissions that a caller has on the specified resource.
2467 pub fn test_iam_permissions(&self) -> super::builder::global_addresses::TestIamPermissions {
2468 super::builder::global_addresses::TestIamPermissions::new(self.inner.clone())
2469 }
2470
2471 /// Retrieves the specified Operations resource.
2472 pub fn get_operation(&self) -> super::builder::global_addresses::GetOperation {
2473 super::builder::global_addresses::GetOperation::new(self.inner.clone())
2474 }
2475}
2476
2477/// Implements a client for the Google Compute Engine API.
2478///
2479/// # Example
2480/// ```
2481/// # use google_cloud_compute_v1::client::GlobalForwardingRules;
2482/// async fn sample(
2483/// ) -> anyhow::Result<()> {
2484/// let client = GlobalForwardingRules::builder().build().await?;
2485/// // use `client` to make requests to the Google Compute Engine API.
2486/// Ok(())
2487/// }
2488/// ```
2489///
2490/// # Service Description
2491///
2492/// Service for the `globalForwardingRules` resource.
2493///
2494/// # Configuration
2495///
2496/// To configure `GlobalForwardingRules` use the `with_*` methods in the type returned
2497/// by [builder()][GlobalForwardingRules::builder]. The default configuration should
2498/// work for most applications. Common configuration changes include
2499///
2500/// * [with_endpoint()]: by default this client uses the global default endpoint
2501/// (`https://compute.googleapis.com`). Applications using regional
2502/// endpoints or running in restricted networks (e.g. a network configured
2503/// with [Private Google Access with VPC Service Controls]) may want to
2504/// override this default.
2505/// * [with_credentials()]: by default this client uses
2506/// [Application Default Credentials]. Applications using custom
2507/// authentication may need to override this default.
2508///
2509/// [with_endpoint()]: super::builder::global_forwarding_rules::ClientBuilder::with_endpoint
2510/// [with_credentials()]: super::builder::global_forwarding_rules::ClientBuilder::with_credentials
2511/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2512/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2513///
2514/// # Pooling and Cloning
2515///
2516/// `GlobalForwardingRules` holds a connection pool internally, it is advised to
2517/// create one and reuse it. You do not need to wrap `GlobalForwardingRules` in
2518/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2519/// already uses an `Arc` internally.
2520#[cfg(feature = "global-forwarding-rules")]
2521#[cfg_attr(docsrs, doc(cfg(feature = "global-forwarding-rules")))]
2522#[derive(Clone, Debug)]
2523pub struct GlobalForwardingRules {
2524 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalForwardingRules>,
2525}
2526
2527#[cfg(feature = "global-forwarding-rules")]
2528impl GlobalForwardingRules {
2529 /// Returns a builder for [GlobalForwardingRules].
2530 ///
2531 /// ```
2532 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2533 /// # use google_cloud_compute_v1::client::GlobalForwardingRules;
2534 /// let client = GlobalForwardingRules::builder().build().await?;
2535 /// # Ok(()) }
2536 /// ```
2537 pub fn builder() -> super::builder::global_forwarding_rules::ClientBuilder {
2538 crate::new_client_builder(super::builder::global_forwarding_rules::client::Factory)
2539 }
2540
2541 /// Creates a new client from the provided stub.
2542 ///
2543 /// The most common case for calling this function is in tests mocking the
2544 /// client's behavior.
2545 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2546 where
2547 T: super::stub::GlobalForwardingRules + 'static,
2548 {
2549 Self { inner: stub.into() }
2550 }
2551
2552 pub(crate) async fn new(
2553 config: gaxi::options::ClientConfig,
2554 ) -> crate::ClientBuilderResult<Self> {
2555 let inner = Self::build_inner(config).await?;
2556 Ok(Self { inner })
2557 }
2558
2559 async fn build_inner(
2560 conf: gaxi::options::ClientConfig,
2561 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GlobalForwardingRules>>
2562 {
2563 if gaxi::options::tracing_enabled(&conf) {
2564 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2565 }
2566 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2567 }
2568
2569 async fn build_transport(
2570 conf: gaxi::options::ClientConfig,
2571 ) -> crate::ClientBuilderResult<impl super::stub::GlobalForwardingRules> {
2572 super::transport::GlobalForwardingRules::new(conf).await
2573 }
2574
2575 async fn build_with_tracing(
2576 conf: gaxi::options::ClientConfig,
2577 ) -> crate::ClientBuilderResult<impl super::stub::GlobalForwardingRules> {
2578 Self::build_transport(conf)
2579 .await
2580 .map(super::tracing::GlobalForwardingRules::new)
2581 }
2582
2583 /// Deletes the specified GlobalForwardingRule resource.
2584 pub fn delete(&self) -> super::builder::global_forwarding_rules::Delete {
2585 super::builder::global_forwarding_rules::Delete::new(self.inner.clone())
2586 }
2587
2588 /// Returns the specified GlobalForwardingRule resource. Gets a list of
2589 /// available forwarding rules by making a list() request.
2590 pub fn get(&self) -> super::builder::global_forwarding_rules::Get {
2591 super::builder::global_forwarding_rules::Get::new(self.inner.clone())
2592 }
2593
2594 /// Creates a GlobalForwardingRule resource in the specified project using
2595 /// the data included in the request.
2596 pub fn insert(&self) -> super::builder::global_forwarding_rules::Insert {
2597 super::builder::global_forwarding_rules::Insert::new(self.inner.clone())
2598 }
2599
2600 /// Retrieves a list of GlobalForwardingRule resources available to the
2601 /// specified project.
2602 pub fn list(&self) -> super::builder::global_forwarding_rules::List {
2603 super::builder::global_forwarding_rules::List::new(self.inner.clone())
2604 }
2605
2606 /// Updates the specified forwarding rule with the data included in the
2607 /// request. This method supportsPATCH
2608 /// semantics and uses theJSON merge
2609 /// patch format and processing rules. Currently, you can only
2610 /// patch the network_tier field.
2611 pub fn patch(&self) -> super::builder::global_forwarding_rules::Patch {
2612 super::builder::global_forwarding_rules::Patch::new(self.inner.clone())
2613 }
2614
2615 /// Sets the labels on the specified resource. To learn more about labels,
2616 /// read the
2617 /// Labeling resources documentation.
2618 pub fn set_labels(&self) -> super::builder::global_forwarding_rules::SetLabels {
2619 super::builder::global_forwarding_rules::SetLabels::new(self.inner.clone())
2620 }
2621
2622 /// Changes target URL for the GlobalForwardingRule resource. The new target
2623 /// should be of the same type as the old target.
2624 pub fn set_target(&self) -> super::builder::global_forwarding_rules::SetTarget {
2625 super::builder::global_forwarding_rules::SetTarget::new(self.inner.clone())
2626 }
2627
2628 /// Retrieves the specified Operations resource.
2629 pub fn get_operation(&self) -> super::builder::global_forwarding_rules::GetOperation {
2630 super::builder::global_forwarding_rules::GetOperation::new(self.inner.clone())
2631 }
2632}
2633
2634/// Implements a client for the Google Compute Engine API.
2635///
2636/// # Example
2637/// ```
2638/// # use google_cloud_compute_v1::client::GlobalNetworkEndpointGroups;
2639/// async fn sample(
2640/// ) -> anyhow::Result<()> {
2641/// let client = GlobalNetworkEndpointGroups::builder().build().await?;
2642/// // use `client` to make requests to the Google Compute Engine API.
2643/// Ok(())
2644/// }
2645/// ```
2646///
2647/// # Service Description
2648///
2649/// Service for the `globalNetworkEndpointGroups` resource.
2650///
2651/// # Configuration
2652///
2653/// To configure `GlobalNetworkEndpointGroups` use the `with_*` methods in the type returned
2654/// by [builder()][GlobalNetworkEndpointGroups::builder]. The default configuration should
2655/// work for most applications. Common configuration changes include
2656///
2657/// * [with_endpoint()]: by default this client uses the global default endpoint
2658/// (`https://compute.googleapis.com`). Applications using regional
2659/// endpoints or running in restricted networks (e.g. a network configured
2660/// with [Private Google Access with VPC Service Controls]) may want to
2661/// override this default.
2662/// * [with_credentials()]: by default this client uses
2663/// [Application Default Credentials]. Applications using custom
2664/// authentication may need to override this default.
2665///
2666/// [with_endpoint()]: super::builder::global_network_endpoint_groups::ClientBuilder::with_endpoint
2667/// [with_credentials()]: super::builder::global_network_endpoint_groups::ClientBuilder::with_credentials
2668/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2669/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2670///
2671/// # Pooling and Cloning
2672///
2673/// `GlobalNetworkEndpointGroups` holds a connection pool internally, it is advised to
2674/// create one and reuse it. You do not need to wrap `GlobalNetworkEndpointGroups` in
2675/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2676/// already uses an `Arc` internally.
2677#[cfg(feature = "global-network-endpoint-groups")]
2678#[cfg_attr(docsrs, doc(cfg(feature = "global-network-endpoint-groups")))]
2679#[derive(Clone, Debug)]
2680pub struct GlobalNetworkEndpointGroups {
2681 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalNetworkEndpointGroups>,
2682}
2683
2684#[cfg(feature = "global-network-endpoint-groups")]
2685impl GlobalNetworkEndpointGroups {
2686 /// Returns a builder for [GlobalNetworkEndpointGroups].
2687 ///
2688 /// ```
2689 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2690 /// # use google_cloud_compute_v1::client::GlobalNetworkEndpointGroups;
2691 /// let client = GlobalNetworkEndpointGroups::builder().build().await?;
2692 /// # Ok(()) }
2693 /// ```
2694 pub fn builder() -> super::builder::global_network_endpoint_groups::ClientBuilder {
2695 crate::new_client_builder(super::builder::global_network_endpoint_groups::client::Factory)
2696 }
2697
2698 /// Creates a new client from the provided stub.
2699 ///
2700 /// The most common case for calling this function is in tests mocking the
2701 /// client's behavior.
2702 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2703 where
2704 T: super::stub::GlobalNetworkEndpointGroups + 'static,
2705 {
2706 Self { inner: stub.into() }
2707 }
2708
2709 pub(crate) async fn new(
2710 config: gaxi::options::ClientConfig,
2711 ) -> crate::ClientBuilderResult<Self> {
2712 let inner = Self::build_inner(config).await?;
2713 Ok(Self { inner })
2714 }
2715
2716 async fn build_inner(
2717 conf: gaxi::options::ClientConfig,
2718 ) -> crate::ClientBuilderResult<
2719 std::sync::Arc<dyn super::stub::dynamic::GlobalNetworkEndpointGroups>,
2720 > {
2721 if gaxi::options::tracing_enabled(&conf) {
2722 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2723 }
2724 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2725 }
2726
2727 async fn build_transport(
2728 conf: gaxi::options::ClientConfig,
2729 ) -> crate::ClientBuilderResult<impl super::stub::GlobalNetworkEndpointGroups> {
2730 super::transport::GlobalNetworkEndpointGroups::new(conf).await
2731 }
2732
2733 async fn build_with_tracing(
2734 conf: gaxi::options::ClientConfig,
2735 ) -> crate::ClientBuilderResult<impl super::stub::GlobalNetworkEndpointGroups> {
2736 Self::build_transport(conf)
2737 .await
2738 .map(super::tracing::GlobalNetworkEndpointGroups::new)
2739 }
2740
2741 /// Attach a network endpoint to the specified network endpoint group.
2742 pub fn attach_network_endpoints(
2743 &self,
2744 ) -> super::builder::global_network_endpoint_groups::AttachNetworkEndpoints {
2745 super::builder::global_network_endpoint_groups::AttachNetworkEndpoints::new(
2746 self.inner.clone(),
2747 )
2748 }
2749
2750 /// Deletes the specified network endpoint group.Note that the NEG cannot be
2751 /// deleted if there are backend services referencing it.
2752 pub fn delete(&self) -> super::builder::global_network_endpoint_groups::Delete {
2753 super::builder::global_network_endpoint_groups::Delete::new(self.inner.clone())
2754 }
2755
2756 /// Detach the network endpoint from the specified network endpoint group.
2757 pub fn detach_network_endpoints(
2758 &self,
2759 ) -> super::builder::global_network_endpoint_groups::DetachNetworkEndpoints {
2760 super::builder::global_network_endpoint_groups::DetachNetworkEndpoints::new(
2761 self.inner.clone(),
2762 )
2763 }
2764
2765 /// Returns the specified network endpoint group.
2766 pub fn get(&self) -> super::builder::global_network_endpoint_groups::Get {
2767 super::builder::global_network_endpoint_groups::Get::new(self.inner.clone())
2768 }
2769
2770 /// Creates a network endpoint group in the specified project using the
2771 /// parameters that are included in the request.
2772 ///
2773 /// Note: Use the following APIs to manage network endpoint groups:
2774 ///
2775 /// - To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
2776 /// NEGs): zonal
2777 /// API
2778 /// - To manage NEGs with regional scope (such as regional internet NEGs,
2779 /// serverless NEGs, Private Service Connect NEGs): regional
2780 /// API
2781 /// - To manage NEGs with global scope (such as global internet NEGs):global
2782 /// API
2783 pub fn insert(&self) -> super::builder::global_network_endpoint_groups::Insert {
2784 super::builder::global_network_endpoint_groups::Insert::new(self.inner.clone())
2785 }
2786
2787 /// Retrieves the list of network endpoint groups that are located in the
2788 /// specified project.
2789 pub fn list(&self) -> super::builder::global_network_endpoint_groups::List {
2790 super::builder::global_network_endpoint_groups::List::new(self.inner.clone())
2791 }
2792
2793 /// Lists the network endpoints in the specified network endpoint group.
2794 pub fn list_network_endpoints(
2795 &self,
2796 ) -> super::builder::global_network_endpoint_groups::ListNetworkEndpoints {
2797 super::builder::global_network_endpoint_groups::ListNetworkEndpoints::new(
2798 self.inner.clone(),
2799 )
2800 }
2801
2802 /// Retrieves the specified Operations resource.
2803 pub fn get_operation(&self) -> super::builder::global_network_endpoint_groups::GetOperation {
2804 super::builder::global_network_endpoint_groups::GetOperation::new(self.inner.clone())
2805 }
2806}
2807
2808/// Implements a client for the Google Compute Engine API.
2809///
2810/// # Example
2811/// ```
2812/// # use google_cloud_compute_v1::client::GlobalOperations;
2813/// async fn sample(
2814/// ) -> anyhow::Result<()> {
2815/// let client = GlobalOperations::builder().build().await?;
2816/// // use `client` to make requests to the Google Compute Engine API.
2817/// Ok(())
2818/// }
2819/// ```
2820///
2821/// # Service Description
2822///
2823/// Service for the `globalOperations` resource.
2824///
2825/// # Configuration
2826///
2827/// To configure `GlobalOperations` use the `with_*` methods in the type returned
2828/// by [builder()][GlobalOperations::builder]. The default configuration should
2829/// work for most applications. Common configuration changes include
2830///
2831/// * [with_endpoint()]: by default this client uses the global default endpoint
2832/// (`https://compute.googleapis.com`). Applications using regional
2833/// endpoints or running in restricted networks (e.g. a network configured
2834/// with [Private Google Access with VPC Service Controls]) may want to
2835/// override this default.
2836/// * [with_credentials()]: by default this client uses
2837/// [Application Default Credentials]. Applications using custom
2838/// authentication may need to override this default.
2839///
2840/// [with_endpoint()]: super::builder::global_operations::ClientBuilder::with_endpoint
2841/// [with_credentials()]: super::builder::global_operations::ClientBuilder::with_credentials
2842/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2843/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2844///
2845/// # Pooling and Cloning
2846///
2847/// `GlobalOperations` holds a connection pool internally, it is advised to
2848/// create one and reuse it. You do not need to wrap `GlobalOperations` in
2849/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2850/// already uses an `Arc` internally.
2851#[cfg(feature = "global-operations")]
2852#[cfg_attr(docsrs, doc(cfg(feature = "global-operations")))]
2853#[derive(Clone, Debug)]
2854pub struct GlobalOperations {
2855 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalOperations>,
2856}
2857
2858#[cfg(feature = "global-operations")]
2859impl GlobalOperations {
2860 /// Returns a builder for [GlobalOperations].
2861 ///
2862 /// ```
2863 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2864 /// # use google_cloud_compute_v1::client::GlobalOperations;
2865 /// let client = GlobalOperations::builder().build().await?;
2866 /// # Ok(()) }
2867 /// ```
2868 pub fn builder() -> super::builder::global_operations::ClientBuilder {
2869 crate::new_client_builder(super::builder::global_operations::client::Factory)
2870 }
2871
2872 /// Creates a new client from the provided stub.
2873 ///
2874 /// The most common case for calling this function is in tests mocking the
2875 /// client's behavior.
2876 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2877 where
2878 T: super::stub::GlobalOperations + 'static,
2879 {
2880 Self { inner: stub.into() }
2881 }
2882
2883 pub(crate) async fn new(
2884 config: gaxi::options::ClientConfig,
2885 ) -> crate::ClientBuilderResult<Self> {
2886 let inner = Self::build_inner(config).await?;
2887 Ok(Self { inner })
2888 }
2889
2890 async fn build_inner(
2891 conf: gaxi::options::ClientConfig,
2892 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::GlobalOperations>>
2893 {
2894 if gaxi::options::tracing_enabled(&conf) {
2895 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2896 }
2897 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2898 }
2899
2900 async fn build_transport(
2901 conf: gaxi::options::ClientConfig,
2902 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOperations> {
2903 super::transport::GlobalOperations::new(conf).await
2904 }
2905
2906 async fn build_with_tracing(
2907 conf: gaxi::options::ClientConfig,
2908 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOperations> {
2909 Self::build_transport(conf)
2910 .await
2911 .map(super::tracing::GlobalOperations::new)
2912 }
2913
2914 /// Retrieves an aggregated list of all operations.
2915 ///
2916 /// To prevent failure, Google recommends that you set the
2917 /// `returnPartialSuccess` parameter to `true`.
2918 pub fn aggregated_list(&self) -> super::builder::global_operations::AggregatedList {
2919 super::builder::global_operations::AggregatedList::new(self.inner.clone())
2920 }
2921
2922 /// Deletes the specified Operations resource.
2923 pub fn delete(&self) -> super::builder::global_operations::Delete {
2924 super::builder::global_operations::Delete::new(self.inner.clone())
2925 }
2926
2927 /// Retrieves the specified Operations resource.
2928 pub fn get(&self) -> super::builder::global_operations::Get {
2929 super::builder::global_operations::Get::new(self.inner.clone())
2930 }
2931
2932 /// Retrieves a list of Operation resources contained within the specified
2933 /// project.
2934 pub fn list(&self) -> super::builder::global_operations::List {
2935 super::builder::global_operations::List::new(self.inner.clone())
2936 }
2937
2938 /// Waits for the specified Operation resource to return as `DONE`
2939 /// or for the request to approach the 2 minute deadline, and retrieves the
2940 /// specified Operation resource. This method differs from the
2941 /// `GET` method in that it waits for no more than the default
2942 /// deadline (2 minutes) and then returns the current state of the operation,
2943 /// which might be `DONE` or still in progress.
2944 ///
2945 /// This method is called on a best-effort basis. Specifically:
2946 ///
2947 /// ```norust
2948 /// - In uncommon cases, when the server is overloaded, the request might
2949 /// return before the default deadline is reached, or might return after zero
2950 /// seconds.
2951 /// ```
2952 ///
2953 /// - If the default deadline is reached, there is no guarantee that the
2954 /// operation is actually done when the method returns. Be prepared to retry
2955 /// if the operation is not `DONE`.
2956 pub fn wait(&self) -> super::builder::global_operations::Wait {
2957 super::builder::global_operations::Wait::new(self.inner.clone())
2958 }
2959}
2960
2961/// Implements a client for the Google Compute Engine API.
2962///
2963/// # Example
2964/// ```
2965/// # use google_cloud_compute_v1::client::GlobalOrganizationOperations;
2966/// async fn sample(
2967/// ) -> anyhow::Result<()> {
2968/// let client = GlobalOrganizationOperations::builder().build().await?;
2969/// // use `client` to make requests to the Google Compute Engine API.
2970/// Ok(())
2971/// }
2972/// ```
2973///
2974/// # Service Description
2975///
2976/// Service for the `globalOrganizationOperations` resource.
2977///
2978/// # Configuration
2979///
2980/// To configure `GlobalOrganizationOperations` use the `with_*` methods in the type returned
2981/// by [builder()][GlobalOrganizationOperations::builder]. The default configuration should
2982/// work for most applications. Common configuration changes include
2983///
2984/// * [with_endpoint()]: by default this client uses the global default endpoint
2985/// (`https://compute.googleapis.com`). Applications using regional
2986/// endpoints or running in restricted networks (e.g. a network configured
2987/// with [Private Google Access with VPC Service Controls]) may want to
2988/// override this default.
2989/// * [with_credentials()]: by default this client uses
2990/// [Application Default Credentials]. Applications using custom
2991/// authentication may need to override this default.
2992///
2993/// [with_endpoint()]: super::builder::global_organization_operations::ClientBuilder::with_endpoint
2994/// [with_credentials()]: super::builder::global_organization_operations::ClientBuilder::with_credentials
2995/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2996/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2997///
2998/// # Pooling and Cloning
2999///
3000/// `GlobalOrganizationOperations` holds a connection pool internally, it is advised to
3001/// create one and reuse it. You do not need to wrap `GlobalOrganizationOperations` in
3002/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3003/// already uses an `Arc` internally.
3004#[cfg(feature = "global-organization-operations")]
3005#[cfg_attr(docsrs, doc(cfg(feature = "global-organization-operations")))]
3006#[derive(Clone, Debug)]
3007pub struct GlobalOrganizationOperations {
3008 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalOrganizationOperations>,
3009}
3010
3011#[cfg(feature = "global-organization-operations")]
3012impl GlobalOrganizationOperations {
3013 /// Returns a builder for [GlobalOrganizationOperations].
3014 ///
3015 /// ```
3016 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3017 /// # use google_cloud_compute_v1::client::GlobalOrganizationOperations;
3018 /// let client = GlobalOrganizationOperations::builder().build().await?;
3019 /// # Ok(()) }
3020 /// ```
3021 pub fn builder() -> super::builder::global_organization_operations::ClientBuilder {
3022 crate::new_client_builder(super::builder::global_organization_operations::client::Factory)
3023 }
3024
3025 /// Creates a new client from the provided stub.
3026 ///
3027 /// The most common case for calling this function is in tests mocking the
3028 /// client's behavior.
3029 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3030 where
3031 T: super::stub::GlobalOrganizationOperations + 'static,
3032 {
3033 Self { inner: stub.into() }
3034 }
3035
3036 pub(crate) async fn new(
3037 config: gaxi::options::ClientConfig,
3038 ) -> crate::ClientBuilderResult<Self> {
3039 let inner = Self::build_inner(config).await?;
3040 Ok(Self { inner })
3041 }
3042
3043 async fn build_inner(
3044 conf: gaxi::options::ClientConfig,
3045 ) -> crate::ClientBuilderResult<
3046 std::sync::Arc<dyn super::stub::dynamic::GlobalOrganizationOperations>,
3047 > {
3048 if gaxi::options::tracing_enabled(&conf) {
3049 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3050 }
3051 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3052 }
3053
3054 async fn build_transport(
3055 conf: gaxi::options::ClientConfig,
3056 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOrganizationOperations> {
3057 super::transport::GlobalOrganizationOperations::new(conf).await
3058 }
3059
3060 async fn build_with_tracing(
3061 conf: gaxi::options::ClientConfig,
3062 ) -> crate::ClientBuilderResult<impl super::stub::GlobalOrganizationOperations> {
3063 Self::build_transport(conf)
3064 .await
3065 .map(super::tracing::GlobalOrganizationOperations::new)
3066 }
3067
3068 /// Deletes the specified Operations resource.
3069 pub fn delete(&self) -> super::builder::global_organization_operations::Delete {
3070 super::builder::global_organization_operations::Delete::new(self.inner.clone())
3071 }
3072
3073 /// Retrieves the specified Operations resource. Gets a list of operations
3074 /// by making a `list()` request.
3075 pub fn get(&self) -> super::builder::global_organization_operations::Get {
3076 super::builder::global_organization_operations::Get::new(self.inner.clone())
3077 }
3078
3079 /// Retrieves a list of Operation resources contained within the specified
3080 /// organization.
3081 pub fn list(&self) -> super::builder::global_organization_operations::List {
3082 super::builder::global_organization_operations::List::new(self.inner.clone())
3083 }
3084}
3085
3086/// Implements a client for the Google Compute Engine API.
3087///
3088/// # Example
3089/// ```
3090/// # use google_cloud_compute_v1::client::GlobalPublicDelegatedPrefixes;
3091/// async fn sample(
3092/// ) -> anyhow::Result<()> {
3093/// let client = GlobalPublicDelegatedPrefixes::builder().build().await?;
3094/// // use `client` to make requests to the Google Compute Engine API.
3095/// Ok(())
3096/// }
3097/// ```
3098///
3099/// # Service Description
3100///
3101/// Service for the `globalPublicDelegatedPrefixes` resource.
3102///
3103/// # Configuration
3104///
3105/// To configure `GlobalPublicDelegatedPrefixes` use the `with_*` methods in the type returned
3106/// by [builder()][GlobalPublicDelegatedPrefixes::builder]. The default configuration should
3107/// work for most applications. Common configuration changes include
3108///
3109/// * [with_endpoint()]: by default this client uses the global default endpoint
3110/// (`https://compute.googleapis.com`). Applications using regional
3111/// endpoints or running in restricted networks (e.g. a network configured
3112/// with [Private Google Access with VPC Service Controls]) may want to
3113/// override this default.
3114/// * [with_credentials()]: by default this client uses
3115/// [Application Default Credentials]. Applications using custom
3116/// authentication may need to override this default.
3117///
3118/// [with_endpoint()]: super::builder::global_public_delegated_prefixes::ClientBuilder::with_endpoint
3119/// [with_credentials()]: super::builder::global_public_delegated_prefixes::ClientBuilder::with_credentials
3120/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3121/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3122///
3123/// # Pooling and Cloning
3124///
3125/// `GlobalPublicDelegatedPrefixes` holds a connection pool internally, it is advised to
3126/// create one and reuse it. You do not need to wrap `GlobalPublicDelegatedPrefixes` in
3127/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3128/// already uses an `Arc` internally.
3129#[cfg(feature = "global-public-delegated-prefixes")]
3130#[cfg_attr(docsrs, doc(cfg(feature = "global-public-delegated-prefixes")))]
3131#[derive(Clone, Debug)]
3132pub struct GlobalPublicDelegatedPrefixes {
3133 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalPublicDelegatedPrefixes>,
3134}
3135
3136#[cfg(feature = "global-public-delegated-prefixes")]
3137impl GlobalPublicDelegatedPrefixes {
3138 /// Returns a builder for [GlobalPublicDelegatedPrefixes].
3139 ///
3140 /// ```
3141 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3142 /// # use google_cloud_compute_v1::client::GlobalPublicDelegatedPrefixes;
3143 /// let client = GlobalPublicDelegatedPrefixes::builder().build().await?;
3144 /// # Ok(()) }
3145 /// ```
3146 pub fn builder() -> super::builder::global_public_delegated_prefixes::ClientBuilder {
3147 crate::new_client_builder(super::builder::global_public_delegated_prefixes::client::Factory)
3148 }
3149
3150 /// Creates a new client from the provided stub.
3151 ///
3152 /// The most common case for calling this function is in tests mocking the
3153 /// client's behavior.
3154 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3155 where
3156 T: super::stub::GlobalPublicDelegatedPrefixes + 'static,
3157 {
3158 Self { inner: stub.into() }
3159 }
3160
3161 pub(crate) async fn new(
3162 config: gaxi::options::ClientConfig,
3163 ) -> crate::ClientBuilderResult<Self> {
3164 let inner = Self::build_inner(config).await?;
3165 Ok(Self { inner })
3166 }
3167
3168 async fn build_inner(
3169 conf: gaxi::options::ClientConfig,
3170 ) -> crate::ClientBuilderResult<
3171 std::sync::Arc<dyn super::stub::dynamic::GlobalPublicDelegatedPrefixes>,
3172 > {
3173 if gaxi::options::tracing_enabled(&conf) {
3174 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3175 }
3176 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3177 }
3178
3179 async fn build_transport(
3180 conf: gaxi::options::ClientConfig,
3181 ) -> crate::ClientBuilderResult<impl super::stub::GlobalPublicDelegatedPrefixes> {
3182 super::transport::GlobalPublicDelegatedPrefixes::new(conf).await
3183 }
3184
3185 async fn build_with_tracing(
3186 conf: gaxi::options::ClientConfig,
3187 ) -> crate::ClientBuilderResult<impl super::stub::GlobalPublicDelegatedPrefixes> {
3188 Self::build_transport(conf)
3189 .await
3190 .map(super::tracing::GlobalPublicDelegatedPrefixes::new)
3191 }
3192
3193 /// Deletes the specified global PublicDelegatedPrefix.
3194 pub fn delete(&self) -> super::builder::global_public_delegated_prefixes::Delete {
3195 super::builder::global_public_delegated_prefixes::Delete::new(self.inner.clone())
3196 }
3197
3198 /// Returns the specified global PublicDelegatedPrefix resource.
3199 pub fn get(&self) -> super::builder::global_public_delegated_prefixes::Get {
3200 super::builder::global_public_delegated_prefixes::Get::new(self.inner.clone())
3201 }
3202
3203 /// Creates a global PublicDelegatedPrefix in the specified project using the
3204 /// parameters that are included in the request.
3205 pub fn insert(&self) -> super::builder::global_public_delegated_prefixes::Insert {
3206 super::builder::global_public_delegated_prefixes::Insert::new(self.inner.clone())
3207 }
3208
3209 /// Lists the global PublicDelegatedPrefixes for a project.
3210 pub fn list(&self) -> super::builder::global_public_delegated_prefixes::List {
3211 super::builder::global_public_delegated_prefixes::List::new(self.inner.clone())
3212 }
3213
3214 /// Patches the specified global PublicDelegatedPrefix resource with the data
3215 /// included in the request. This method supportsPATCH
3216 /// semantics and usesJSON merge
3217 /// patch format and processing rules.
3218 pub fn patch(&self) -> super::builder::global_public_delegated_prefixes::Patch {
3219 super::builder::global_public_delegated_prefixes::Patch::new(self.inner.clone())
3220 }
3221
3222 /// Retrieves the specified Operations resource.
3223 pub fn get_operation(&self) -> super::builder::global_public_delegated_prefixes::GetOperation {
3224 super::builder::global_public_delegated_prefixes::GetOperation::new(self.inner.clone())
3225 }
3226}
3227
3228/// Implements a client for the Google Compute Engine API.
3229///
3230/// # Example
3231/// ```
3232/// # use google_cloud_compute_v1::client::GlobalVmExtensionPolicies;
3233/// async fn sample(
3234/// ) -> anyhow::Result<()> {
3235/// let client = GlobalVmExtensionPolicies::builder().build().await?;
3236/// // use `client` to make requests to the Google Compute Engine API.
3237/// Ok(())
3238/// }
3239/// ```
3240///
3241/// # Service Description
3242///
3243/// Service for the `globalVmExtensionPolicies` resource.
3244///
3245/// # Configuration
3246///
3247/// To configure `GlobalVmExtensionPolicies` use the `with_*` methods in the type returned
3248/// by [builder()][GlobalVmExtensionPolicies::builder]. The default configuration should
3249/// work for most applications. Common configuration changes include
3250///
3251/// * [with_endpoint()]: by default this client uses the global default endpoint
3252/// (`https://compute.googleapis.com`). Applications using regional
3253/// endpoints or running in restricted networks (e.g. a network configured
3254/// with [Private Google Access with VPC Service Controls]) may want to
3255/// override this default.
3256/// * [with_credentials()]: by default this client uses
3257/// [Application Default Credentials]. Applications using custom
3258/// authentication may need to override this default.
3259///
3260/// [with_endpoint()]: super::builder::global_vm_extension_policies::ClientBuilder::with_endpoint
3261/// [with_credentials()]: super::builder::global_vm_extension_policies::ClientBuilder::with_credentials
3262/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3263/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3264///
3265/// # Pooling and Cloning
3266///
3267/// `GlobalVmExtensionPolicies` holds a connection pool internally, it is advised to
3268/// create one and reuse it. You do not need to wrap `GlobalVmExtensionPolicies` in
3269/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3270/// already uses an `Arc` internally.
3271#[cfg(feature = "global-vm-extension-policies")]
3272#[cfg_attr(docsrs, doc(cfg(feature = "global-vm-extension-policies")))]
3273#[derive(Clone, Debug)]
3274pub struct GlobalVmExtensionPolicies {
3275 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalVmExtensionPolicies>,
3276}
3277
3278#[cfg(feature = "global-vm-extension-policies")]
3279impl GlobalVmExtensionPolicies {
3280 /// Returns a builder for [GlobalVmExtensionPolicies].
3281 ///
3282 /// ```
3283 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3284 /// # use google_cloud_compute_v1::client::GlobalVmExtensionPolicies;
3285 /// let client = GlobalVmExtensionPolicies::builder().build().await?;
3286 /// # Ok(()) }
3287 /// ```
3288 pub fn builder() -> super::builder::global_vm_extension_policies::ClientBuilder {
3289 crate::new_client_builder(super::builder::global_vm_extension_policies::client::Factory)
3290 }
3291
3292 /// Creates a new client from the provided stub.
3293 ///
3294 /// The most common case for calling this function is in tests mocking the
3295 /// client's behavior.
3296 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3297 where
3298 T: super::stub::GlobalVmExtensionPolicies + 'static,
3299 {
3300 Self { inner: stub.into() }
3301 }
3302
3303 pub(crate) async fn new(
3304 config: gaxi::options::ClientConfig,
3305 ) -> crate::ClientBuilderResult<Self> {
3306 let inner = Self::build_inner(config).await?;
3307 Ok(Self { inner })
3308 }
3309
3310 async fn build_inner(
3311 conf: gaxi::options::ClientConfig,
3312 ) -> crate::ClientBuilderResult<
3313 std::sync::Arc<dyn super::stub::dynamic::GlobalVmExtensionPolicies>,
3314 > {
3315 if gaxi::options::tracing_enabled(&conf) {
3316 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3317 }
3318 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3319 }
3320
3321 async fn build_transport(
3322 conf: gaxi::options::ClientConfig,
3323 ) -> crate::ClientBuilderResult<impl super::stub::GlobalVmExtensionPolicies> {
3324 super::transport::GlobalVmExtensionPolicies::new(conf).await
3325 }
3326
3327 async fn build_with_tracing(
3328 conf: gaxi::options::ClientConfig,
3329 ) -> crate::ClientBuilderResult<impl super::stub::GlobalVmExtensionPolicies> {
3330 Self::build_transport(conf)
3331 .await
3332 .map(super::tracing::GlobalVmExtensionPolicies::new)
3333 }
3334
3335 /// Retrieves the list of all VM Extension Policy resources
3336 /// available to the specified project.
3337 ///
3338 /// To prevent failure, it's recommended that you set the
3339 /// `returnPartialSuccess` parameter to `true`.
3340 pub fn aggregated_list(&self) -> super::builder::global_vm_extension_policies::AggregatedList {
3341 super::builder::global_vm_extension_policies::AggregatedList::new(self.inner.clone())
3342 }
3343
3344 /// Purge scoped resources (zonal policies) from a global VM extension
3345 /// policy, and then delete the global VM extension policy. Purge of the scoped
3346 /// resources is a pre-condition of the global VM extension policy deletion.
3347 /// The deletion of the global VM extension policy happens after the purge
3348 /// rollout is done, so it's not a part of the LRO. It's an automatic process
3349 /// that triggers in the backend.
3350 pub fn delete(&self) -> super::builder::global_vm_extension_policies::Delete {
3351 super::builder::global_vm_extension_policies::Delete::new(self.inner.clone())
3352 }
3353
3354 /// Gets details of a global VM extension policy.
3355 pub fn get(&self) -> super::builder::global_vm_extension_policies::Get {
3356 super::builder::global_vm_extension_policies::Get::new(self.inner.clone())
3357 }
3358
3359 /// Creates a new project level GlobalVmExtensionPolicy.
3360 pub fn insert(&self) -> super::builder::global_vm_extension_policies::Insert {
3361 super::builder::global_vm_extension_policies::Insert::new(self.inner.clone())
3362 }
3363
3364 /// Lists global VM extension policies.
3365 pub fn list(&self) -> super::builder::global_vm_extension_policies::List {
3366 super::builder::global_vm_extension_policies::List::new(self.inner.clone())
3367 }
3368
3369 /// Updates a global VM extension policy.
3370 pub fn update(&self) -> super::builder::global_vm_extension_policies::Update {
3371 super::builder::global_vm_extension_policies::Update::new(self.inner.clone())
3372 }
3373
3374 /// Retrieves the specified Operations resource.
3375 pub fn get_operation(&self) -> super::builder::global_vm_extension_policies::GetOperation {
3376 super::builder::global_vm_extension_policies::GetOperation::new(self.inner.clone())
3377 }
3378}
3379
3380/// Implements a client for the Google Compute Engine API.
3381///
3382/// # Example
3383/// ```
3384/// # use google_cloud_compute_v1::client::HealthChecks;
3385/// async fn sample(
3386/// ) -> anyhow::Result<()> {
3387/// let client = HealthChecks::builder().build().await?;
3388/// // use `client` to make requests to the Google Compute Engine API.
3389/// Ok(())
3390/// }
3391/// ```
3392///
3393/// # Service Description
3394///
3395/// Service for the `healthChecks` resource.
3396///
3397/// # Configuration
3398///
3399/// To configure `HealthChecks` use the `with_*` methods in the type returned
3400/// by [builder()][HealthChecks::builder]. The default configuration should
3401/// work for most applications. Common configuration changes include
3402///
3403/// * [with_endpoint()]: by default this client uses the global default endpoint
3404/// (`https://compute.googleapis.com`). Applications using regional
3405/// endpoints or running in restricted networks (e.g. a network configured
3406/// with [Private Google Access with VPC Service Controls]) may want to
3407/// override this default.
3408/// * [with_credentials()]: by default this client uses
3409/// [Application Default Credentials]. Applications using custom
3410/// authentication may need to override this default.
3411///
3412/// [with_endpoint()]: super::builder::health_checks::ClientBuilder::with_endpoint
3413/// [with_credentials()]: super::builder::health_checks::ClientBuilder::with_credentials
3414/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3415/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3416///
3417/// # Pooling and Cloning
3418///
3419/// `HealthChecks` holds a connection pool internally, it is advised to
3420/// create one and reuse it. You do not need to wrap `HealthChecks` in
3421/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3422/// already uses an `Arc` internally.
3423#[cfg(feature = "health-checks")]
3424#[cfg_attr(docsrs, doc(cfg(feature = "health-checks")))]
3425#[derive(Clone, Debug)]
3426pub struct HealthChecks {
3427 inner: std::sync::Arc<dyn super::stub::dynamic::HealthChecks>,
3428}
3429
3430#[cfg(feature = "health-checks")]
3431impl HealthChecks {
3432 /// Returns a builder for [HealthChecks].
3433 ///
3434 /// ```
3435 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3436 /// # use google_cloud_compute_v1::client::HealthChecks;
3437 /// let client = HealthChecks::builder().build().await?;
3438 /// # Ok(()) }
3439 /// ```
3440 pub fn builder() -> super::builder::health_checks::ClientBuilder {
3441 crate::new_client_builder(super::builder::health_checks::client::Factory)
3442 }
3443
3444 /// Creates a new client from the provided stub.
3445 ///
3446 /// The most common case for calling this function is in tests mocking the
3447 /// client's behavior.
3448 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3449 where
3450 T: super::stub::HealthChecks + 'static,
3451 {
3452 Self { inner: stub.into() }
3453 }
3454
3455 pub(crate) async fn new(
3456 config: gaxi::options::ClientConfig,
3457 ) -> crate::ClientBuilderResult<Self> {
3458 let inner = Self::build_inner(config).await?;
3459 Ok(Self { inner })
3460 }
3461
3462 async fn build_inner(
3463 conf: gaxi::options::ClientConfig,
3464 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HealthChecks>> {
3465 if gaxi::options::tracing_enabled(&conf) {
3466 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3467 }
3468 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3469 }
3470
3471 async fn build_transport(
3472 conf: gaxi::options::ClientConfig,
3473 ) -> crate::ClientBuilderResult<impl super::stub::HealthChecks> {
3474 super::transport::HealthChecks::new(conf).await
3475 }
3476
3477 async fn build_with_tracing(
3478 conf: gaxi::options::ClientConfig,
3479 ) -> crate::ClientBuilderResult<impl super::stub::HealthChecks> {
3480 Self::build_transport(conf)
3481 .await
3482 .map(super::tracing::HealthChecks::new)
3483 }
3484
3485 /// Retrieves the list of all HealthCheck resources, regional and global,
3486 /// available to the specified project.
3487 ///
3488 /// To prevent failure, Google recommends that you set the
3489 /// `returnPartialSuccess` parameter to `true`.
3490 pub fn aggregated_list(&self) -> super::builder::health_checks::AggregatedList {
3491 super::builder::health_checks::AggregatedList::new(self.inner.clone())
3492 }
3493
3494 /// Deletes the specified HealthCheck resource.
3495 pub fn delete(&self) -> super::builder::health_checks::Delete {
3496 super::builder::health_checks::Delete::new(self.inner.clone())
3497 }
3498
3499 /// Returns the specified HealthCheck resource.
3500 pub fn get(&self) -> super::builder::health_checks::Get {
3501 super::builder::health_checks::Get::new(self.inner.clone())
3502 }
3503
3504 /// Creates a HealthCheck resource in the specified project using the data
3505 /// included in the request.
3506 pub fn insert(&self) -> super::builder::health_checks::Insert {
3507 super::builder::health_checks::Insert::new(self.inner.clone())
3508 }
3509
3510 /// Retrieves the list of HealthCheck resources available to the specified
3511 /// project.
3512 pub fn list(&self) -> super::builder::health_checks::List {
3513 super::builder::health_checks::List::new(self.inner.clone())
3514 }
3515
3516 /// Updates a HealthCheck resource in the specified project using the data
3517 /// included in the request. This method supportsPATCH
3518 /// semantics and uses theJSON merge
3519 /// patch format and processing rules.
3520 pub fn patch(&self) -> super::builder::health_checks::Patch {
3521 super::builder::health_checks::Patch::new(self.inner.clone())
3522 }
3523
3524 /// Returns permissions that a caller has on the specified resource.
3525 pub fn test_iam_permissions(&self) -> super::builder::health_checks::TestIamPermissions {
3526 super::builder::health_checks::TestIamPermissions::new(self.inner.clone())
3527 }
3528
3529 /// Updates a HealthCheck resource in the specified project using the data
3530 /// included in the request.
3531 pub fn update(&self) -> super::builder::health_checks::Update {
3532 super::builder::health_checks::Update::new(self.inner.clone())
3533 }
3534
3535 /// Retrieves the specified Operations resource.
3536 pub fn get_operation(&self) -> super::builder::health_checks::GetOperation {
3537 super::builder::health_checks::GetOperation::new(self.inner.clone())
3538 }
3539}
3540
3541/// Implements a client for the Google Compute Engine API.
3542///
3543/// # Example
3544/// ```
3545/// # use google_cloud_compute_v1::client::HttpHealthChecks;
3546/// async fn sample(
3547/// ) -> anyhow::Result<()> {
3548/// let client = HttpHealthChecks::builder().build().await?;
3549/// // use `client` to make requests to the Google Compute Engine API.
3550/// Ok(())
3551/// }
3552/// ```
3553///
3554/// # Service Description
3555///
3556/// Service for the `httpHealthChecks` resource.
3557///
3558/// # Configuration
3559///
3560/// To configure `HttpHealthChecks` use the `with_*` methods in the type returned
3561/// by [builder()][HttpHealthChecks::builder]. The default configuration should
3562/// work for most applications. Common configuration changes include
3563///
3564/// * [with_endpoint()]: by default this client uses the global default endpoint
3565/// (`https://compute.googleapis.com`). Applications using regional
3566/// endpoints or running in restricted networks (e.g. a network configured
3567/// with [Private Google Access with VPC Service Controls]) may want to
3568/// override this default.
3569/// * [with_credentials()]: by default this client uses
3570/// [Application Default Credentials]. Applications using custom
3571/// authentication may need to override this default.
3572///
3573/// [with_endpoint()]: super::builder::http_health_checks::ClientBuilder::with_endpoint
3574/// [with_credentials()]: super::builder::http_health_checks::ClientBuilder::with_credentials
3575/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3576/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3577///
3578/// # Pooling and Cloning
3579///
3580/// `HttpHealthChecks` holds a connection pool internally, it is advised to
3581/// create one and reuse it. You do not need to wrap `HttpHealthChecks` in
3582/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3583/// already uses an `Arc` internally.
3584#[cfg(feature = "http-health-checks")]
3585#[cfg_attr(docsrs, doc(cfg(feature = "http-health-checks")))]
3586#[derive(Clone, Debug)]
3587pub struct HttpHealthChecks {
3588 inner: std::sync::Arc<dyn super::stub::dynamic::HttpHealthChecks>,
3589}
3590
3591#[cfg(feature = "http-health-checks")]
3592impl HttpHealthChecks {
3593 /// Returns a builder for [HttpHealthChecks].
3594 ///
3595 /// ```
3596 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3597 /// # use google_cloud_compute_v1::client::HttpHealthChecks;
3598 /// let client = HttpHealthChecks::builder().build().await?;
3599 /// # Ok(()) }
3600 /// ```
3601 pub fn builder() -> super::builder::http_health_checks::ClientBuilder {
3602 crate::new_client_builder(super::builder::http_health_checks::client::Factory)
3603 }
3604
3605 /// Creates a new client from the provided stub.
3606 ///
3607 /// The most common case for calling this function is in tests mocking the
3608 /// client's behavior.
3609 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3610 where
3611 T: super::stub::HttpHealthChecks + 'static,
3612 {
3613 Self { inner: stub.into() }
3614 }
3615
3616 pub(crate) async fn new(
3617 config: gaxi::options::ClientConfig,
3618 ) -> crate::ClientBuilderResult<Self> {
3619 let inner = Self::build_inner(config).await?;
3620 Ok(Self { inner })
3621 }
3622
3623 async fn build_inner(
3624 conf: gaxi::options::ClientConfig,
3625 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HttpHealthChecks>>
3626 {
3627 if gaxi::options::tracing_enabled(&conf) {
3628 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3629 }
3630 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3631 }
3632
3633 async fn build_transport(
3634 conf: gaxi::options::ClientConfig,
3635 ) -> crate::ClientBuilderResult<impl super::stub::HttpHealthChecks> {
3636 super::transport::HttpHealthChecks::new(conf).await
3637 }
3638
3639 async fn build_with_tracing(
3640 conf: gaxi::options::ClientConfig,
3641 ) -> crate::ClientBuilderResult<impl super::stub::HttpHealthChecks> {
3642 Self::build_transport(conf)
3643 .await
3644 .map(super::tracing::HttpHealthChecks::new)
3645 }
3646
3647 /// Deletes the specified HttpHealthCheck resource.
3648 pub fn delete(&self) -> super::builder::http_health_checks::Delete {
3649 super::builder::http_health_checks::Delete::new(self.inner.clone())
3650 }
3651
3652 /// Returns the specified HttpHealthCheck resource.
3653 pub fn get(&self) -> super::builder::http_health_checks::Get {
3654 super::builder::http_health_checks::Get::new(self.inner.clone())
3655 }
3656
3657 /// Creates a HttpHealthCheck resource in the specified project using the data
3658 /// included in the request.
3659 pub fn insert(&self) -> super::builder::http_health_checks::Insert {
3660 super::builder::http_health_checks::Insert::new(self.inner.clone())
3661 }
3662
3663 /// Retrieves the list of HttpHealthCheck resources available to the specified
3664 /// project.
3665 pub fn list(&self) -> super::builder::http_health_checks::List {
3666 super::builder::http_health_checks::List::new(self.inner.clone())
3667 }
3668
3669 /// Updates a HttpHealthCheck resource in the specified project using the data
3670 /// included in the request. This method supportsPATCH
3671 /// semantics and uses theJSON merge
3672 /// patch format and processing rules.
3673 pub fn patch(&self) -> super::builder::http_health_checks::Patch {
3674 super::builder::http_health_checks::Patch::new(self.inner.clone())
3675 }
3676
3677 /// Returns permissions that a caller has on the specified resource.
3678 pub fn test_iam_permissions(&self) -> super::builder::http_health_checks::TestIamPermissions {
3679 super::builder::http_health_checks::TestIamPermissions::new(self.inner.clone())
3680 }
3681
3682 /// Updates a HttpHealthCheck resource in the specified project using the data
3683 /// included in the request.
3684 pub fn update(&self) -> super::builder::http_health_checks::Update {
3685 super::builder::http_health_checks::Update::new(self.inner.clone())
3686 }
3687
3688 /// Retrieves the specified Operations resource.
3689 pub fn get_operation(&self) -> super::builder::http_health_checks::GetOperation {
3690 super::builder::http_health_checks::GetOperation::new(self.inner.clone())
3691 }
3692}
3693
3694/// Implements a client for the Google Compute Engine API.
3695///
3696/// # Example
3697/// ```
3698/// # use google_cloud_compute_v1::client::HttpsHealthChecks;
3699/// async fn sample(
3700/// ) -> anyhow::Result<()> {
3701/// let client = HttpsHealthChecks::builder().build().await?;
3702/// // use `client` to make requests to the Google Compute Engine API.
3703/// Ok(())
3704/// }
3705/// ```
3706///
3707/// # Service Description
3708///
3709/// Service for the `httpsHealthChecks` resource.
3710///
3711/// # Configuration
3712///
3713/// To configure `HttpsHealthChecks` use the `with_*` methods in the type returned
3714/// by [builder()][HttpsHealthChecks::builder]. The default configuration should
3715/// work for most applications. Common configuration changes include
3716///
3717/// * [with_endpoint()]: by default this client uses the global default endpoint
3718/// (`https://compute.googleapis.com`). Applications using regional
3719/// endpoints or running in restricted networks (e.g. a network configured
3720/// with [Private Google Access with VPC Service Controls]) may want to
3721/// override this default.
3722/// * [with_credentials()]: by default this client uses
3723/// [Application Default Credentials]. Applications using custom
3724/// authentication may need to override this default.
3725///
3726/// [with_endpoint()]: super::builder::https_health_checks::ClientBuilder::with_endpoint
3727/// [with_credentials()]: super::builder::https_health_checks::ClientBuilder::with_credentials
3728/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3729/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3730///
3731/// # Pooling and Cloning
3732///
3733/// `HttpsHealthChecks` holds a connection pool internally, it is advised to
3734/// create one and reuse it. You do not need to wrap `HttpsHealthChecks` in
3735/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3736/// already uses an `Arc` internally.
3737#[cfg(feature = "https-health-checks")]
3738#[cfg_attr(docsrs, doc(cfg(feature = "https-health-checks")))]
3739#[derive(Clone, Debug)]
3740pub struct HttpsHealthChecks {
3741 inner: std::sync::Arc<dyn super::stub::dynamic::HttpsHealthChecks>,
3742}
3743
3744#[cfg(feature = "https-health-checks")]
3745impl HttpsHealthChecks {
3746 /// Returns a builder for [HttpsHealthChecks].
3747 ///
3748 /// ```
3749 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3750 /// # use google_cloud_compute_v1::client::HttpsHealthChecks;
3751 /// let client = HttpsHealthChecks::builder().build().await?;
3752 /// # Ok(()) }
3753 /// ```
3754 pub fn builder() -> super::builder::https_health_checks::ClientBuilder {
3755 crate::new_client_builder(super::builder::https_health_checks::client::Factory)
3756 }
3757
3758 /// Creates a new client from the provided stub.
3759 ///
3760 /// The most common case for calling this function is in tests mocking the
3761 /// client's behavior.
3762 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3763 where
3764 T: super::stub::HttpsHealthChecks + 'static,
3765 {
3766 Self { inner: stub.into() }
3767 }
3768
3769 pub(crate) async fn new(
3770 config: gaxi::options::ClientConfig,
3771 ) -> crate::ClientBuilderResult<Self> {
3772 let inner = Self::build_inner(config).await?;
3773 Ok(Self { inner })
3774 }
3775
3776 async fn build_inner(
3777 conf: gaxi::options::ClientConfig,
3778 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::HttpsHealthChecks>>
3779 {
3780 if gaxi::options::tracing_enabled(&conf) {
3781 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3782 }
3783 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3784 }
3785
3786 async fn build_transport(
3787 conf: gaxi::options::ClientConfig,
3788 ) -> crate::ClientBuilderResult<impl super::stub::HttpsHealthChecks> {
3789 super::transport::HttpsHealthChecks::new(conf).await
3790 }
3791
3792 async fn build_with_tracing(
3793 conf: gaxi::options::ClientConfig,
3794 ) -> crate::ClientBuilderResult<impl super::stub::HttpsHealthChecks> {
3795 Self::build_transport(conf)
3796 .await
3797 .map(super::tracing::HttpsHealthChecks::new)
3798 }
3799
3800 /// Deletes the specified HttpsHealthCheck resource.
3801 pub fn delete(&self) -> super::builder::https_health_checks::Delete {
3802 super::builder::https_health_checks::Delete::new(self.inner.clone())
3803 }
3804
3805 /// Returns the specified HttpsHealthCheck resource.
3806 pub fn get(&self) -> super::builder::https_health_checks::Get {
3807 super::builder::https_health_checks::Get::new(self.inner.clone())
3808 }
3809
3810 /// Creates a HttpsHealthCheck resource in the specified project using the data
3811 /// included in the request.
3812 pub fn insert(&self) -> super::builder::https_health_checks::Insert {
3813 super::builder::https_health_checks::Insert::new(self.inner.clone())
3814 }
3815
3816 /// Retrieves the list of HttpsHealthCheck resources available to the specified
3817 /// project.
3818 pub fn list(&self) -> super::builder::https_health_checks::List {
3819 super::builder::https_health_checks::List::new(self.inner.clone())
3820 }
3821
3822 /// Updates a HttpsHealthCheck resource in the specified project using the data
3823 /// included in the request. This method supportsPATCH
3824 /// semantics and uses theJSON merge
3825 /// patch format and processing rules.
3826 pub fn patch(&self) -> super::builder::https_health_checks::Patch {
3827 super::builder::https_health_checks::Patch::new(self.inner.clone())
3828 }
3829
3830 /// Returns permissions that a caller has on the specified resource.
3831 pub fn test_iam_permissions(&self) -> super::builder::https_health_checks::TestIamPermissions {
3832 super::builder::https_health_checks::TestIamPermissions::new(self.inner.clone())
3833 }
3834
3835 /// Updates a HttpsHealthCheck resource in the specified project using the data
3836 /// included in the request.
3837 pub fn update(&self) -> super::builder::https_health_checks::Update {
3838 super::builder::https_health_checks::Update::new(self.inner.clone())
3839 }
3840
3841 /// Retrieves the specified Operations resource.
3842 pub fn get_operation(&self) -> super::builder::https_health_checks::GetOperation {
3843 super::builder::https_health_checks::GetOperation::new(self.inner.clone())
3844 }
3845}
3846
3847/// Implements a client for the Google Compute Engine API.
3848///
3849/// # Example
3850/// ```
3851/// # use google_cloud_compute_v1::client::ImageFamilyViews;
3852/// async fn sample(
3853/// ) -> anyhow::Result<()> {
3854/// let client = ImageFamilyViews::builder().build().await?;
3855/// // use `client` to make requests to the Google Compute Engine API.
3856/// Ok(())
3857/// }
3858/// ```
3859///
3860/// # Service Description
3861///
3862/// Service for the `imageFamilyViews` resource.
3863///
3864/// # Configuration
3865///
3866/// To configure `ImageFamilyViews` use the `with_*` methods in the type returned
3867/// by [builder()][ImageFamilyViews::builder]. The default configuration should
3868/// work for most applications. Common configuration changes include
3869///
3870/// * [with_endpoint()]: by default this client uses the global default endpoint
3871/// (`https://compute.googleapis.com`). Applications using regional
3872/// endpoints or running in restricted networks (e.g. a network configured
3873/// with [Private Google Access with VPC Service Controls]) may want to
3874/// override this default.
3875/// * [with_credentials()]: by default this client uses
3876/// [Application Default Credentials]. Applications using custom
3877/// authentication may need to override this default.
3878///
3879/// [with_endpoint()]: super::builder::image_family_views::ClientBuilder::with_endpoint
3880/// [with_credentials()]: super::builder::image_family_views::ClientBuilder::with_credentials
3881/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3882/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3883///
3884/// # Pooling and Cloning
3885///
3886/// `ImageFamilyViews` holds a connection pool internally, it is advised to
3887/// create one and reuse it. You do not need to wrap `ImageFamilyViews` in
3888/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3889/// already uses an `Arc` internally.
3890#[cfg(feature = "image-family-views")]
3891#[cfg_attr(docsrs, doc(cfg(feature = "image-family-views")))]
3892#[derive(Clone, Debug)]
3893pub struct ImageFamilyViews {
3894 inner: std::sync::Arc<dyn super::stub::dynamic::ImageFamilyViews>,
3895}
3896
3897#[cfg(feature = "image-family-views")]
3898impl ImageFamilyViews {
3899 /// Returns a builder for [ImageFamilyViews].
3900 ///
3901 /// ```
3902 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3903 /// # use google_cloud_compute_v1::client::ImageFamilyViews;
3904 /// let client = ImageFamilyViews::builder().build().await?;
3905 /// # Ok(()) }
3906 /// ```
3907 pub fn builder() -> super::builder::image_family_views::ClientBuilder {
3908 crate::new_client_builder(super::builder::image_family_views::client::Factory)
3909 }
3910
3911 /// Creates a new client from the provided stub.
3912 ///
3913 /// The most common case for calling this function is in tests mocking the
3914 /// client's behavior.
3915 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3916 where
3917 T: super::stub::ImageFamilyViews + 'static,
3918 {
3919 Self { inner: stub.into() }
3920 }
3921
3922 pub(crate) async fn new(
3923 config: gaxi::options::ClientConfig,
3924 ) -> crate::ClientBuilderResult<Self> {
3925 let inner = Self::build_inner(config).await?;
3926 Ok(Self { inner })
3927 }
3928
3929 async fn build_inner(
3930 conf: gaxi::options::ClientConfig,
3931 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ImageFamilyViews>>
3932 {
3933 if gaxi::options::tracing_enabled(&conf) {
3934 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3935 }
3936 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3937 }
3938
3939 async fn build_transport(
3940 conf: gaxi::options::ClientConfig,
3941 ) -> crate::ClientBuilderResult<impl super::stub::ImageFamilyViews> {
3942 super::transport::ImageFamilyViews::new(conf).await
3943 }
3944
3945 async fn build_with_tracing(
3946 conf: gaxi::options::ClientConfig,
3947 ) -> crate::ClientBuilderResult<impl super::stub::ImageFamilyViews> {
3948 Self::build_transport(conf)
3949 .await
3950 .map(super::tracing::ImageFamilyViews::new)
3951 }
3952
3953 /// Returns the latest image that is part of an image family, is not
3954 /// deprecated and is rolled out in the specified zone.
3955 pub fn get(&self) -> super::builder::image_family_views::Get {
3956 super::builder::image_family_views::Get::new(self.inner.clone())
3957 }
3958}
3959
3960/// Implements a client for the Google Compute Engine API.
3961///
3962/// # Example
3963/// ```
3964/// # use google_cloud_compute_v1::client::Images;
3965/// async fn sample(
3966/// ) -> anyhow::Result<()> {
3967/// let client = Images::builder().build().await?;
3968/// // use `client` to make requests to the Google Compute Engine API.
3969/// Ok(())
3970/// }
3971/// ```
3972///
3973/// # Service Description
3974///
3975/// Service for the `images` resource.
3976///
3977/// # Configuration
3978///
3979/// To configure `Images` use the `with_*` methods in the type returned
3980/// by [builder()][Images::builder]. The default configuration should
3981/// work for most applications. Common configuration changes include
3982///
3983/// * [with_endpoint()]: by default this client uses the global default endpoint
3984/// (`https://compute.googleapis.com`). Applications using regional
3985/// endpoints or running in restricted networks (e.g. a network configured
3986/// with [Private Google Access with VPC Service Controls]) may want to
3987/// override this default.
3988/// * [with_credentials()]: by default this client uses
3989/// [Application Default Credentials]. Applications using custom
3990/// authentication may need to override this default.
3991///
3992/// [with_endpoint()]: super::builder::images::ClientBuilder::with_endpoint
3993/// [with_credentials()]: super::builder::images::ClientBuilder::with_credentials
3994/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3995/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3996///
3997/// # Pooling and Cloning
3998///
3999/// `Images` holds a connection pool internally, it is advised to
4000/// create one and reuse it. You do not need to wrap `Images` in
4001/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4002/// already uses an `Arc` internally.
4003#[cfg(feature = "images")]
4004#[cfg_attr(docsrs, doc(cfg(feature = "images")))]
4005#[derive(Clone, Debug)]
4006pub struct Images {
4007 inner: std::sync::Arc<dyn super::stub::dynamic::Images>,
4008}
4009
4010#[cfg(feature = "images")]
4011impl Images {
4012 /// Returns a builder for [Images].
4013 ///
4014 /// ```
4015 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4016 /// # use google_cloud_compute_v1::client::Images;
4017 /// let client = Images::builder().build().await?;
4018 /// # Ok(()) }
4019 /// ```
4020 pub fn builder() -> super::builder::images::ClientBuilder {
4021 crate::new_client_builder(super::builder::images::client::Factory)
4022 }
4023
4024 /// Creates a new client from the provided stub.
4025 ///
4026 /// The most common case for calling this function is in tests mocking the
4027 /// client's behavior.
4028 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4029 where
4030 T: super::stub::Images + 'static,
4031 {
4032 Self { inner: stub.into() }
4033 }
4034
4035 pub(crate) async fn new(
4036 config: gaxi::options::ClientConfig,
4037 ) -> crate::ClientBuilderResult<Self> {
4038 let inner = Self::build_inner(config).await?;
4039 Ok(Self { inner })
4040 }
4041
4042 async fn build_inner(
4043 conf: gaxi::options::ClientConfig,
4044 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Images>> {
4045 if gaxi::options::tracing_enabled(&conf) {
4046 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4047 }
4048 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4049 }
4050
4051 async fn build_transport(
4052 conf: gaxi::options::ClientConfig,
4053 ) -> crate::ClientBuilderResult<impl super::stub::Images> {
4054 super::transport::Images::new(conf).await
4055 }
4056
4057 async fn build_with_tracing(
4058 conf: gaxi::options::ClientConfig,
4059 ) -> crate::ClientBuilderResult<impl super::stub::Images> {
4060 Self::build_transport(conf)
4061 .await
4062 .map(super::tracing::Images::new)
4063 }
4064
4065 /// Deletes the specified image.
4066 pub fn delete(&self) -> super::builder::images::Delete {
4067 super::builder::images::Delete::new(self.inner.clone())
4068 }
4069
4070 /// Sets the deprecation status of an image.
4071 ///
4072 /// If an empty request body is given, clears the deprecation status instead.
4073 pub fn deprecate(&self) -> super::builder::images::Deprecate {
4074 super::builder::images::Deprecate::new(self.inner.clone())
4075 }
4076
4077 /// Returns the specified image.
4078 pub fn get(&self) -> super::builder::images::Get {
4079 super::builder::images::Get::new(self.inner.clone())
4080 }
4081
4082 /// Returns the latest image that is part of an image family and is not
4083 /// deprecated. For more information on image families, seePublic
4084 /// image families documentation.
4085 pub fn get_from_family(&self) -> super::builder::images::GetFromFamily {
4086 super::builder::images::GetFromFamily::new(self.inner.clone())
4087 }
4088
4089 /// Gets the access control policy for a resource. May be empty if no such
4090 /// policy or resource exists.
4091 pub fn get_iam_policy(&self) -> super::builder::images::GetIamPolicy {
4092 super::builder::images::GetIamPolicy::new(self.inner.clone())
4093 }
4094
4095 /// Creates an image in the specified project using the data included
4096 /// in the request.
4097 pub fn insert(&self) -> super::builder::images::Insert {
4098 super::builder::images::Insert::new(self.inner.clone())
4099 }
4100
4101 /// Retrieves the list of custom images
4102 /// available to the specified project. Custom images are images you
4103 /// create that belong to your project. This method does not
4104 /// get any images that belong to other projects, including publicly-available
4105 /// images, like Debian 8. If you want to get a list of publicly-available
4106 /// images, use this method to make a request to the respective image project,
4107 /// such as debian-cloud or windows-cloud.
4108 pub fn list(&self) -> super::builder::images::List {
4109 super::builder::images::List::new(self.inner.clone())
4110 }
4111
4112 /// Patches the specified image with the data included in the request.
4113 /// Only the following fields can be modified: family, description,
4114 /// deprecation status.
4115 pub fn patch(&self) -> super::builder::images::Patch {
4116 super::builder::images::Patch::new(self.inner.clone())
4117 }
4118
4119 /// Sets the access control policy on the specified resource.
4120 /// Replaces any existing policy.
4121 pub fn set_iam_policy(&self) -> super::builder::images::SetIamPolicy {
4122 super::builder::images::SetIamPolicy::new(self.inner.clone())
4123 }
4124
4125 /// Sets the labels on an image. To learn more about labels, read theLabeling
4126 /// Resources documentation.
4127 pub fn set_labels(&self) -> super::builder::images::SetLabels {
4128 super::builder::images::SetLabels::new(self.inner.clone())
4129 }
4130
4131 /// Returns permissions that a caller has on the specified resource.
4132 pub fn test_iam_permissions(&self) -> super::builder::images::TestIamPermissions {
4133 super::builder::images::TestIamPermissions::new(self.inner.clone())
4134 }
4135
4136 /// Retrieves the specified Operations resource.
4137 pub fn get_operation(&self) -> super::builder::images::GetOperation {
4138 super::builder::images::GetOperation::new(self.inner.clone())
4139 }
4140}
4141
4142/// Implements a client for the Google Compute Engine API.
4143///
4144/// # Example
4145/// ```
4146/// # use google_cloud_compute_v1::client::InstanceGroupManagerResizeRequests;
4147/// async fn sample(
4148/// ) -> anyhow::Result<()> {
4149/// let client = InstanceGroupManagerResizeRequests::builder().build().await?;
4150/// // use `client` to make requests to the Google Compute Engine API.
4151/// Ok(())
4152/// }
4153/// ```
4154///
4155/// # Service Description
4156///
4157/// Service for the `instanceGroupManagerResizeRequests` resource.
4158///
4159/// # Configuration
4160///
4161/// To configure `InstanceGroupManagerResizeRequests` use the `with_*` methods in the type returned
4162/// by [builder()][InstanceGroupManagerResizeRequests::builder]. The default configuration should
4163/// work for most applications. Common configuration changes include
4164///
4165/// * [with_endpoint()]: by default this client uses the global default endpoint
4166/// (`https://compute.googleapis.com`). Applications using regional
4167/// endpoints or running in restricted networks (e.g. a network configured
4168/// with [Private Google Access with VPC Service Controls]) may want to
4169/// override this default.
4170/// * [with_credentials()]: by default this client uses
4171/// [Application Default Credentials]. Applications using custom
4172/// authentication may need to override this default.
4173///
4174/// [with_endpoint()]: super::builder::instance_group_manager_resize_requests::ClientBuilder::with_endpoint
4175/// [with_credentials()]: super::builder::instance_group_manager_resize_requests::ClientBuilder::with_credentials
4176/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4177/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4178///
4179/// # Pooling and Cloning
4180///
4181/// `InstanceGroupManagerResizeRequests` holds a connection pool internally, it is advised to
4182/// create one and reuse it. You do not need to wrap `InstanceGroupManagerResizeRequests` in
4183/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4184/// already uses an `Arc` internally.
4185#[cfg(feature = "instance-group-manager-resize-requests")]
4186#[cfg_attr(docsrs, doc(cfg(feature = "instance-group-manager-resize-requests")))]
4187#[derive(Clone, Debug)]
4188pub struct InstanceGroupManagerResizeRequests {
4189 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagerResizeRequests>,
4190}
4191
4192#[cfg(feature = "instance-group-manager-resize-requests")]
4193impl InstanceGroupManagerResizeRequests {
4194 /// Returns a builder for [InstanceGroupManagerResizeRequests].
4195 ///
4196 /// ```
4197 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4198 /// # use google_cloud_compute_v1::client::InstanceGroupManagerResizeRequests;
4199 /// let client = InstanceGroupManagerResizeRequests::builder().build().await?;
4200 /// # Ok(()) }
4201 /// ```
4202 pub fn builder() -> super::builder::instance_group_manager_resize_requests::ClientBuilder {
4203 crate::new_client_builder(
4204 super::builder::instance_group_manager_resize_requests::client::Factory,
4205 )
4206 }
4207
4208 /// Creates a new client from the provided stub.
4209 ///
4210 /// The most common case for calling this function is in tests mocking the
4211 /// client's behavior.
4212 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4213 where
4214 T: super::stub::InstanceGroupManagerResizeRequests + 'static,
4215 {
4216 Self { inner: stub.into() }
4217 }
4218
4219 pub(crate) async fn new(
4220 config: gaxi::options::ClientConfig,
4221 ) -> crate::ClientBuilderResult<Self> {
4222 let inner = Self::build_inner(config).await?;
4223 Ok(Self { inner })
4224 }
4225
4226 async fn build_inner(
4227 conf: gaxi::options::ClientConfig,
4228 ) -> crate::ClientBuilderResult<
4229 std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagerResizeRequests>,
4230 > {
4231 if gaxi::options::tracing_enabled(&conf) {
4232 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4233 }
4234 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4235 }
4236
4237 async fn build_transport(
4238 conf: gaxi::options::ClientConfig,
4239 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagerResizeRequests> {
4240 super::transport::InstanceGroupManagerResizeRequests::new(conf).await
4241 }
4242
4243 async fn build_with_tracing(
4244 conf: gaxi::options::ClientConfig,
4245 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagerResizeRequests> {
4246 Self::build_transport(conf)
4247 .await
4248 .map(super::tracing::InstanceGroupManagerResizeRequests::new)
4249 }
4250
4251 /// Cancels the specified resize request and removes it from the queue.
4252 /// Cancelled resize request does no longer wait for the resources to be
4253 /// provisioned. Cancel is only possible for requests that are accepted in the
4254 /// queue.
4255 pub fn cancel(&self) -> super::builder::instance_group_manager_resize_requests::Cancel {
4256 super::builder::instance_group_manager_resize_requests::Cancel::new(self.inner.clone())
4257 }
4258
4259 /// Deletes the specified, inactive resize request. Requests that are still
4260 /// active cannot be deleted. Deleting request does not delete instances that
4261 /// were provisioned previously.
4262 pub fn delete(&self) -> super::builder::instance_group_manager_resize_requests::Delete {
4263 super::builder::instance_group_manager_resize_requests::Delete::new(self.inner.clone())
4264 }
4265
4266 /// Returns all of the details about the specified resize request.
4267 pub fn get(&self) -> super::builder::instance_group_manager_resize_requests::Get {
4268 super::builder::instance_group_manager_resize_requests::Get::new(self.inner.clone())
4269 }
4270
4271 /// Creates a new resize request that starts provisioning VMs immediately
4272 /// or queues VM creation.
4273 pub fn insert(&self) -> super::builder::instance_group_manager_resize_requests::Insert {
4274 super::builder::instance_group_manager_resize_requests::Insert::new(self.inner.clone())
4275 }
4276
4277 /// Retrieves a list of resize requests that are contained in the
4278 /// managed instance group.
4279 pub fn list(&self) -> super::builder::instance_group_manager_resize_requests::List {
4280 super::builder::instance_group_manager_resize_requests::List::new(self.inner.clone())
4281 }
4282
4283 /// Retrieves the specified zone-specific Operations resource.
4284 pub fn get_operation(
4285 &self,
4286 ) -> super::builder::instance_group_manager_resize_requests::GetOperation {
4287 super::builder::instance_group_manager_resize_requests::GetOperation::new(
4288 self.inner.clone(),
4289 )
4290 }
4291}
4292
4293/// Implements a client for the Google Compute Engine API.
4294///
4295/// # Example
4296/// ```
4297/// # use google_cloud_compute_v1::client::InstanceGroupManagers;
4298/// async fn sample(
4299/// ) -> anyhow::Result<()> {
4300/// let client = InstanceGroupManagers::builder().build().await?;
4301/// // use `client` to make requests to the Google Compute Engine API.
4302/// Ok(())
4303/// }
4304/// ```
4305///
4306/// # Service Description
4307///
4308/// Service for the `instanceGroupManagers` resource.
4309///
4310/// # Configuration
4311///
4312/// To configure `InstanceGroupManagers` use the `with_*` methods in the type returned
4313/// by [builder()][InstanceGroupManagers::builder]. The default configuration should
4314/// work for most applications. Common configuration changes include
4315///
4316/// * [with_endpoint()]: by default this client uses the global default endpoint
4317/// (`https://compute.googleapis.com`). Applications using regional
4318/// endpoints or running in restricted networks (e.g. a network configured
4319/// with [Private Google Access with VPC Service Controls]) may want to
4320/// override this default.
4321/// * [with_credentials()]: by default this client uses
4322/// [Application Default Credentials]. Applications using custom
4323/// authentication may need to override this default.
4324///
4325/// [with_endpoint()]: super::builder::instance_group_managers::ClientBuilder::with_endpoint
4326/// [with_credentials()]: super::builder::instance_group_managers::ClientBuilder::with_credentials
4327/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4328/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4329///
4330/// # Pooling and Cloning
4331///
4332/// `InstanceGroupManagers` holds a connection pool internally, it is advised to
4333/// create one and reuse it. You do not need to wrap `InstanceGroupManagers` in
4334/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4335/// already uses an `Arc` internally.
4336#[cfg(feature = "instance-group-managers")]
4337#[cfg_attr(docsrs, doc(cfg(feature = "instance-group-managers")))]
4338#[derive(Clone, Debug)]
4339pub struct InstanceGroupManagers {
4340 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagers>,
4341}
4342
4343#[cfg(feature = "instance-group-managers")]
4344impl InstanceGroupManagers {
4345 /// Returns a builder for [InstanceGroupManagers].
4346 ///
4347 /// ```
4348 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4349 /// # use google_cloud_compute_v1::client::InstanceGroupManagers;
4350 /// let client = InstanceGroupManagers::builder().build().await?;
4351 /// # Ok(()) }
4352 /// ```
4353 pub fn builder() -> super::builder::instance_group_managers::ClientBuilder {
4354 crate::new_client_builder(super::builder::instance_group_managers::client::Factory)
4355 }
4356
4357 /// Creates a new client from the provided stub.
4358 ///
4359 /// The most common case for calling this function is in tests mocking the
4360 /// client's behavior.
4361 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4362 where
4363 T: super::stub::InstanceGroupManagers + 'static,
4364 {
4365 Self { inner: stub.into() }
4366 }
4367
4368 pub(crate) async fn new(
4369 config: gaxi::options::ClientConfig,
4370 ) -> crate::ClientBuilderResult<Self> {
4371 let inner = Self::build_inner(config).await?;
4372 Ok(Self { inner })
4373 }
4374
4375 async fn build_inner(
4376 conf: gaxi::options::ClientConfig,
4377 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagers>>
4378 {
4379 if gaxi::options::tracing_enabled(&conf) {
4380 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4381 }
4382 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4383 }
4384
4385 async fn build_transport(
4386 conf: gaxi::options::ClientConfig,
4387 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagers> {
4388 super::transport::InstanceGroupManagers::new(conf).await
4389 }
4390
4391 async fn build_with_tracing(
4392 conf: gaxi::options::ClientConfig,
4393 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroupManagers> {
4394 Self::build_transport(conf)
4395 .await
4396 .map(super::tracing::InstanceGroupManagers::new)
4397 }
4398
4399 /// Flags the specified instances to be removed from the
4400 /// managed instance group. Abandoning an instance does not delete the
4401 /// instance, but it does remove the instance from any target pools that are
4402 /// applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
4403 /// number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
4404 /// not yet been removed from the group. You must separately verify the
4405 /// status of the abandoning action with thelistmanagedinstances
4406 /// method.
4407 ///
4408 /// If the group is part of a backend
4409 /// service that has enabled
4410 /// connection draining, it can take up to 60 seconds after the connection
4411 /// draining duration has elapsed before the VM instance is removed or deleted.
4412 ///
4413 /// You can specify a maximum of 1000 instances with this method per request.
4414 pub fn abandon_instances(&self) -> super::builder::instance_group_managers::AbandonInstances {
4415 super::builder::instance_group_managers::AbandonInstances::new(self.inner.clone())
4416 }
4417
4418 /// Retrieves the list of managed instance groups and groups them by zone.
4419 ///
4420 /// To prevent failure, Google recommends that you set the
4421 /// `returnPartialSuccess` parameter to `true`.
4422 pub fn aggregated_list(&self) -> super::builder::instance_group_managers::AggregatedList {
4423 super::builder::instance_group_managers::AggregatedList::new(self.inner.clone())
4424 }
4425
4426 /// Applies changes to selected instances on the managed instance group.
4427 /// This method can be used to apply new overrides and/or new versions.
4428 pub fn apply_updates_to_instances(
4429 &self,
4430 ) -> super::builder::instance_group_managers::ApplyUpdatesToInstances {
4431 super::builder::instance_group_managers::ApplyUpdatesToInstances::new(self.inner.clone())
4432 }
4433
4434 /// Creates instances with per-instance configurations in this managed instance
4435 /// group. Instances are created using the current instance template. Thecreate instances operation is marked DONE if thecreateInstances request is successful. The underlying actions
4436 /// take additional time. You must separately verify the status of thecreating or actions with the listmanagedinstances
4437 /// method.
4438 pub fn create_instances(&self) -> super::builder::instance_group_managers::CreateInstances {
4439 super::builder::instance_group_managers::CreateInstances::new(self.inner.clone())
4440 }
4441
4442 /// Deletes the specified managed instance group and all of the instances
4443 /// in that group. Note that the instance group must not belong to a
4444 /// backend service. Read
4445 /// Deleting an instance group for more information.
4446 pub fn delete(&self) -> super::builder::instance_group_managers::Delete {
4447 super::builder::instance_group_managers::Delete::new(self.inner.clone())
4448 }
4449
4450 /// Flags the specified instances in the managed instance group for immediate
4451 /// deletion. The instances are also removed from any target
4452 /// pools of which they were a member. This method reduces thetargetSize of the managed instance group by the number of
4453 /// instances that you delete. This operation is marked as DONE
4454 /// when the action is scheduled even if the instances are still being deleted.
4455 /// You must separately verify the status of the deleting action
4456 /// with thelistmanagedinstances
4457 /// method.
4458 ///
4459 /// If the group is part of a backend
4460 /// service that has enabled
4461 /// connection draining, it can take up to 60 seconds after the connection
4462 /// draining duration has elapsed before the VM instance is removed or deleted.
4463 ///
4464 /// You can specify a maximum of 1000 instances with this method per request.
4465 pub fn delete_instances(&self) -> super::builder::instance_group_managers::DeleteInstances {
4466 super::builder::instance_group_managers::DeleteInstances::new(self.inner.clone())
4467 }
4468
4469 /// Deletes selected per-instance configurations for the managed instance
4470 /// group.
4471 pub fn delete_per_instance_configs(
4472 &self,
4473 ) -> super::builder::instance_group_managers::DeletePerInstanceConfigs {
4474 super::builder::instance_group_managers::DeletePerInstanceConfigs::new(self.inner.clone())
4475 }
4476
4477 /// Returns all of the details about the specified managed instance group.
4478 pub fn get(&self) -> super::builder::instance_group_managers::Get {
4479 super::builder::instance_group_managers::Get::new(self.inner.clone())
4480 }
4481
4482 /// Creates a managed instance group using the information that you specify
4483 /// in the request. After the group is created, instances in the group are
4484 /// created using the specified instance template.
4485 /// This operation is marked as DONE when the group is created
4486 /// even if the instances in the group have not yet been created. You
4487 /// must separately verify the status of the individual instances with thelistmanagedinstances
4488 /// method.
4489 ///
4490 /// A managed instance group can have up to 1000 VM instances per group. Please
4491 /// contact Cloud Support if you need an increase in
4492 /// this limit.
4493 pub fn insert(&self) -> super::builder::instance_group_managers::Insert {
4494 super::builder::instance_group_managers::Insert::new(self.inner.clone())
4495 }
4496
4497 /// Retrieves a list of managed instance groups that are contained within the
4498 /// specified project and zone.
4499 pub fn list(&self) -> super::builder::instance_group_managers::List {
4500 super::builder::instance_group_managers::List::new(self.inner.clone())
4501 }
4502
4503 /// Lists all errors thrown by actions on instances for a given managed
4504 /// instance group. The filter and orderBy query
4505 /// parameters are not supported.
4506 pub fn list_errors(&self) -> super::builder::instance_group_managers::ListErrors {
4507 super::builder::instance_group_managers::ListErrors::new(self.inner.clone())
4508 }
4509
4510 /// Lists all of the instances in the managed instance group. Each instance
4511 /// in the list has a currentAction, which indicates the action
4512 /// that the managed instance group is performing on the instance. For example,
4513 /// if the group is still creating an instance, the currentAction
4514 /// is CREATING. If a previous action failed, the
4515 /// list displays the errors for that failed action. The orderBy
4516 /// query parameter is not supported. The `pageToken` query parameter is
4517 /// supported only if the group's `listManagedInstancesResults` field is set
4518 /// to `PAGINATED`.
4519 pub fn list_managed_instances(
4520 &self,
4521 ) -> super::builder::instance_group_managers::ListManagedInstances {
4522 super::builder::instance_group_managers::ListManagedInstances::new(self.inner.clone())
4523 }
4524
4525 /// Lists all of the per-instance configurations defined for the managed
4526 /// instance group. The orderBy query parameter is not supported.
4527 pub fn list_per_instance_configs(
4528 &self,
4529 ) -> super::builder::instance_group_managers::ListPerInstanceConfigs {
4530 super::builder::instance_group_managers::ListPerInstanceConfigs::new(self.inner.clone())
4531 }
4532
4533 /// Updates a managed instance group using the information that you specify
4534 /// in the request.
4535 /// This operation is marked as DONE when the group is patched
4536 /// even if the instances in the group are still in the process of being
4537 /// patched. You must separately verify the status of the individual instances
4538 /// with thelistManagedInstances
4539 /// method. This method supportsPATCH
4540 /// semantics and uses theJSON merge
4541 /// patch format and processing rules.
4542 ///
4543 /// If you update your group to specify a new template or instance
4544 /// configuration, it's possible that your intended specification for each VM
4545 /// in the group is different from the current state of that VM. To learn how
4546 /// to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
4547 /// a MIG.
4548 pub fn patch(&self) -> super::builder::instance_group_managers::Patch {
4549 super::builder::instance_group_managers::Patch::new(self.inner.clone())
4550 }
4551
4552 /// Inserts or patches per-instance configurations for the managed instance
4553 /// group. perInstanceConfig.name serves as a key used to
4554 /// distinguish whether to perform insert or patch.
4555 pub fn patch_per_instance_configs(
4556 &self,
4557 ) -> super::builder::instance_group_managers::PatchPerInstanceConfigs {
4558 super::builder::instance_group_managers::PatchPerInstanceConfigs::new(self.inner.clone())
4559 }
4560
4561 /// Flags the specified VM instances in the managed instance group to be
4562 /// immediately recreated. Each instance is recreated using the group's current
4563 /// configuration. This operation is marked as DONE when the flag
4564 /// is set even if the instances have not yet been recreated. You must
4565 /// separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
4566 /// the status of managed instances.
4567 ///
4568 /// If the group is part of a backend
4569 /// service that has enabled
4570 /// connection draining, it can take up to 60 seconds after the connection
4571 /// draining duration has elapsed before the VM instance is removed or deleted.
4572 ///
4573 /// You can specify a maximum of 1000 instances with this method per request.
4574 pub fn recreate_instances(&self) -> super::builder::instance_group_managers::RecreateInstances {
4575 super::builder::instance_group_managers::RecreateInstances::new(self.inner.clone())
4576 }
4577
4578 /// Resizes the managed instance group. If you increase the size, the group
4579 /// creates new instances using the current instance template. If you decrease
4580 /// the size, the group deletes instances. The resize operation is markedDONE when the resize actions are scheduled even if the group
4581 /// has not yet added or deleted any instances. You must separately
4582 /// verify the status of the creating or deleting
4583 /// actions with thelistmanagedinstances
4584 /// method.
4585 ///
4586 /// When resizing down, the instance group arbitrarily chooses the order in
4587 /// which VMs are deleted. The group takes into account some VM attributes when
4588 /// making the selection including:
4589 ///
4590 /// + The status of the VM instance.
4591 /// + The health of the VM instance.
4592 /// + The instance template version the VM is based on.
4593 /// + For regional managed instance groups, the location of the VM instance.
4594 ///
4595 /// This list is subject to change.
4596 ///
4597 /// If the group is part of a backend
4598 /// service that has enabled
4599 /// connection draining, it can take up to 60 seconds after the connection
4600 /// draining duration has elapsed before the VM instance is removed or deleted.
4601 pub fn resize(&self) -> super::builder::instance_group_managers::Resize {
4602 super::builder::instance_group_managers::Resize::new(self.inner.clone())
4603 }
4604
4605 /// Flags the specified instances in the managed instance group to be
4606 /// resumed. This method increases thetargetSize and decreases the targetSuspendedSize
4607 /// of the managed instance group by the number of instances that you resume.
4608 /// The resumeInstances operation is marked DONE if
4609 /// the resumeInstances request is successful. The underlying
4610 /// actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
4611 /// method.
4612 ///
4613 /// In this request, you can only specify instances that are suspended. For
4614 /// example, if an instance was previously suspended using the suspendInstances
4615 /// method, it can be resumed using the resumeInstances method.
4616 ///
4617 /// If a health check is attached to the managed instance group, the specified
4618 /// instances will be verified as healthy after they are resumed.
4619 ///
4620 /// You can specify a maximum of 1000 instances with this method per request.
4621 pub fn resume_instances(&self) -> super::builder::instance_group_managers::ResumeInstances {
4622 super::builder::instance_group_managers::ResumeInstances::new(self.inner.clone())
4623 }
4624
4625 /// Specifies the instance template to use when creating new instances in this
4626 /// group. The templates for existing instances in the group do not change
4627 /// unless you run recreateInstances, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE.
4628 pub fn set_instance_template(
4629 &self,
4630 ) -> super::builder::instance_group_managers::SetInstanceTemplate {
4631 super::builder::instance_group_managers::SetInstanceTemplate::new(self.inner.clone())
4632 }
4633
4634 /// Modifies the target pools to which all instances in this managed instance
4635 /// group are assigned. The target pools automatically apply to all of the
4636 /// instances in the managed instance group. This operation is markedDONE when you make the request even if the instances have not
4637 /// yet been added to their target pools. The change might take some time to
4638 /// apply to all of the instances in the group depending on the size of the
4639 /// group.
4640 pub fn set_target_pools(&self) -> super::builder::instance_group_managers::SetTargetPools {
4641 super::builder::instance_group_managers::SetTargetPools::new(self.inner.clone())
4642 }
4643
4644 /// Flags the specified instances in the managed instance group to be
4645 /// started. This method increases thetargetSize and decreases the targetStoppedSize
4646 /// of the managed instance group by the number of instances that you start.
4647 /// The startInstances operation is marked DONE if
4648 /// the startInstances request is successful. The underlying
4649 /// actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
4650 /// method.
4651 ///
4652 /// In this request, you can only specify instances that are stopped. For
4653 /// example, if an instance was previously stopped using the stopInstances
4654 /// method, it can be started using the startInstances method.
4655 ///
4656 /// If a health check is attached to the managed instance group, the specified
4657 /// instances will be verified as healthy after they are started.
4658 ///
4659 /// You can specify a maximum of 1000 instances with this method per request.
4660 pub fn start_instances(&self) -> super::builder::instance_group_managers::StartInstances {
4661 super::builder::instance_group_managers::StartInstances::new(self.inner.clone())
4662 }
4663
4664 /// Flags the specified instances in the managed instance group to be
4665 /// immediately stopped. You can only specify instances that are running in
4666 /// this request. This method reduces thetargetSize and increases the targetStoppedSize
4667 /// of the managed instance group by the number of instances that you stop.
4668 /// The stopInstances operation is marked DONE if
4669 /// the stopInstances request is successful. The underlying
4670 /// actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
4671 /// method.
4672 ///
4673 /// If the standbyPolicy.initialDelaySec field is set, the group
4674 /// delays stopping the instances until initialDelaySec have
4675 /// passed from instance.creationTimestamp (that is, when the
4676 /// instance was created). This delay gives your application time to
4677 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
4678 /// will be zero delay.
4679 ///
4680 /// If the group is part of a backend
4681 /// service that has enabled
4682 /// connection draining, it can take up to 60 seconds after the connection
4683 /// draining duration has elapsed before the VM instance is stopped.
4684 ///
4685 /// Stopped instances can be started using the startInstances
4686 /// method.
4687 ///
4688 /// You can specify a maximum of 1000 instances with this method per request.
4689 pub fn stop_instances(&self) -> super::builder::instance_group_managers::StopInstances {
4690 super::builder::instance_group_managers::StopInstances::new(self.inner.clone())
4691 }
4692
4693 /// Flags the specified instances in the managed instance group to be
4694 /// immediately suspended. You can only specify instances that are running in
4695 /// this request. This method reduces thetargetSize and increases the targetSuspendedSize
4696 /// of the managed instance group by the number of instances that you suspend.
4697 /// The suspendInstances operation is marked DONE if
4698 /// the suspendInstances request is successful. The underlying
4699 /// actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
4700 /// method.
4701 ///
4702 /// If the standbyPolicy.initialDelaySec field is set, the group
4703 /// delays suspension of the instances until initialDelaySec have
4704 /// passed from instance.creationTimestamp (that is, when the
4705 /// instance was created). This delay gives your application time to
4706 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
4707 /// will be zero delay.
4708 ///
4709 /// If the group is part of a backend
4710 /// service that has enabled
4711 /// connection draining, it can take up to 60 seconds after the connection
4712 /// draining duration has elapsed before the VM instance is suspended.
4713 ///
4714 /// Suspended instances can be resumed using the resumeInstances
4715 /// method.
4716 ///
4717 /// You can specify a maximum of 1000 instances with this method per request.
4718 pub fn suspend_instances(&self) -> super::builder::instance_group_managers::SuspendInstances {
4719 super::builder::instance_group_managers::SuspendInstances::new(self.inner.clone())
4720 }
4721
4722 /// Inserts or updates per-instance configurations for the managed instance
4723 /// group. perInstanceConfig.name serves as a key used to
4724 /// distinguish whether to perform insert or patch.
4725 pub fn update_per_instance_configs(
4726 &self,
4727 ) -> super::builder::instance_group_managers::UpdatePerInstanceConfigs {
4728 super::builder::instance_group_managers::UpdatePerInstanceConfigs::new(self.inner.clone())
4729 }
4730
4731 /// Retrieves the specified zone-specific Operations resource.
4732 pub fn get_operation(&self) -> super::builder::instance_group_managers::GetOperation {
4733 super::builder::instance_group_managers::GetOperation::new(self.inner.clone())
4734 }
4735}
4736
4737/// Implements a client for the Google Compute Engine API.
4738///
4739/// # Example
4740/// ```
4741/// # use google_cloud_compute_v1::client::InstanceGroups;
4742/// async fn sample(
4743/// ) -> anyhow::Result<()> {
4744/// let client = InstanceGroups::builder().build().await?;
4745/// // use `client` to make requests to the Google Compute Engine API.
4746/// Ok(())
4747/// }
4748/// ```
4749///
4750/// # Service Description
4751///
4752/// Service for the `instanceGroups` resource.
4753///
4754/// # Configuration
4755///
4756/// To configure `InstanceGroups` use the `with_*` methods in the type returned
4757/// by [builder()][InstanceGroups::builder]. The default configuration should
4758/// work for most applications. Common configuration changes include
4759///
4760/// * [with_endpoint()]: by default this client uses the global default endpoint
4761/// (`https://compute.googleapis.com`). Applications using regional
4762/// endpoints or running in restricted networks (e.g. a network configured
4763/// with [Private Google Access with VPC Service Controls]) may want to
4764/// override this default.
4765/// * [with_credentials()]: by default this client uses
4766/// [Application Default Credentials]. Applications using custom
4767/// authentication may need to override this default.
4768///
4769/// [with_endpoint()]: super::builder::instance_groups::ClientBuilder::with_endpoint
4770/// [with_credentials()]: super::builder::instance_groups::ClientBuilder::with_credentials
4771/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4772/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4773///
4774/// # Pooling and Cloning
4775///
4776/// `InstanceGroups` holds a connection pool internally, it is advised to
4777/// create one and reuse it. You do not need to wrap `InstanceGroups` in
4778/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4779/// already uses an `Arc` internally.
4780#[cfg(feature = "instance-groups")]
4781#[cfg_attr(docsrs, doc(cfg(feature = "instance-groups")))]
4782#[derive(Clone, Debug)]
4783pub struct InstanceGroups {
4784 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroups>,
4785}
4786
4787#[cfg(feature = "instance-groups")]
4788impl InstanceGroups {
4789 /// Returns a builder for [InstanceGroups].
4790 ///
4791 /// ```
4792 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4793 /// # use google_cloud_compute_v1::client::InstanceGroups;
4794 /// let client = InstanceGroups::builder().build().await?;
4795 /// # Ok(()) }
4796 /// ```
4797 pub fn builder() -> super::builder::instance_groups::ClientBuilder {
4798 crate::new_client_builder(super::builder::instance_groups::client::Factory)
4799 }
4800
4801 /// Creates a new client from the provided stub.
4802 ///
4803 /// The most common case for calling this function is in tests mocking the
4804 /// client's behavior.
4805 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4806 where
4807 T: super::stub::InstanceGroups + 'static,
4808 {
4809 Self { inner: stub.into() }
4810 }
4811
4812 pub(crate) async fn new(
4813 config: gaxi::options::ClientConfig,
4814 ) -> crate::ClientBuilderResult<Self> {
4815 let inner = Self::build_inner(config).await?;
4816 Ok(Self { inner })
4817 }
4818
4819 async fn build_inner(
4820 conf: gaxi::options::ClientConfig,
4821 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceGroups>> {
4822 if gaxi::options::tracing_enabled(&conf) {
4823 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4824 }
4825 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4826 }
4827
4828 async fn build_transport(
4829 conf: gaxi::options::ClientConfig,
4830 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroups> {
4831 super::transport::InstanceGroups::new(conf).await
4832 }
4833
4834 async fn build_with_tracing(
4835 conf: gaxi::options::ClientConfig,
4836 ) -> crate::ClientBuilderResult<impl super::stub::InstanceGroups> {
4837 Self::build_transport(conf)
4838 .await
4839 .map(super::tracing::InstanceGroups::new)
4840 }
4841
4842 /// Adds a list of instances to the specified instance group. All of the
4843 /// instances in the instance group must be in the same network/subnetwork.
4844 /// Read
4845 /// Adding instances for more information.
4846 pub fn add_instances(&self) -> super::builder::instance_groups::AddInstances {
4847 super::builder::instance_groups::AddInstances::new(self.inner.clone())
4848 }
4849
4850 /// Retrieves the list of instance groups and sorts them by zone.
4851 ///
4852 /// To prevent failure, Google recommends that you set the
4853 /// `returnPartialSuccess` parameter to `true`.
4854 pub fn aggregated_list(&self) -> super::builder::instance_groups::AggregatedList {
4855 super::builder::instance_groups::AggregatedList::new(self.inner.clone())
4856 }
4857
4858 /// Deletes the specified instance group. The instances in the group are not
4859 /// deleted. Note that instance group must not belong to a backend service.
4860 /// Read
4861 /// Deleting an instance group for more information.
4862 pub fn delete(&self) -> super::builder::instance_groups::Delete {
4863 super::builder::instance_groups::Delete::new(self.inner.clone())
4864 }
4865
4866 /// Returns the specified zonal instance group. Get a list of available zonal
4867 /// instance groups by making a list() request.
4868 ///
4869 /// For managed instance groups, use theinstanceGroupManagers
4870 /// or regionInstanceGroupManagers
4871 /// methods instead.
4872 pub fn get(&self) -> super::builder::instance_groups::Get {
4873 super::builder::instance_groups::Get::new(self.inner.clone())
4874 }
4875
4876 /// Creates an instance group in the specified project using the
4877 /// parameters that are included in the request.
4878 pub fn insert(&self) -> super::builder::instance_groups::Insert {
4879 super::builder::instance_groups::Insert::new(self.inner.clone())
4880 }
4881
4882 /// Retrieves the list of zonal instance group resources contained within the
4883 /// specified zone.
4884 ///
4885 /// For managed instance groups, use theinstanceGroupManagers
4886 /// or regionInstanceGroupManagers
4887 /// methods instead.
4888 pub fn list(&self) -> super::builder::instance_groups::List {
4889 super::builder::instance_groups::List::new(self.inner.clone())
4890 }
4891
4892 /// Lists the instances in the specified instance group.
4893 /// The orderBy query parameter is not supported.
4894 /// The filter query parameter is supported, but only for
4895 /// expressions that use `eq` (equal) or `ne` (not equal) operators.
4896 pub fn list_instances(&self) -> super::builder::instance_groups::ListInstances {
4897 super::builder::instance_groups::ListInstances::new(self.inner.clone())
4898 }
4899
4900 /// Removes one or more instances from the specified instance group, but does
4901 /// not delete those instances.
4902 ///
4903 /// If the group is part of a backend
4904 /// service that has enabled
4905 /// connection draining, it can take up to 60 seconds after the connection
4906 /// draining duration before the VM instance is removed or deleted.
4907 pub fn remove_instances(&self) -> super::builder::instance_groups::RemoveInstances {
4908 super::builder::instance_groups::RemoveInstances::new(self.inner.clone())
4909 }
4910
4911 /// Sets the named ports for the specified instance group.
4912 pub fn set_named_ports(&self) -> super::builder::instance_groups::SetNamedPorts {
4913 super::builder::instance_groups::SetNamedPorts::new(self.inner.clone())
4914 }
4915
4916 /// Returns permissions that a caller has on the specified resource.
4917 pub fn test_iam_permissions(&self) -> super::builder::instance_groups::TestIamPermissions {
4918 super::builder::instance_groups::TestIamPermissions::new(self.inner.clone())
4919 }
4920
4921 /// Retrieves the specified zone-specific Operations resource.
4922 pub fn get_operation(&self) -> super::builder::instance_groups::GetOperation {
4923 super::builder::instance_groups::GetOperation::new(self.inner.clone())
4924 }
4925}
4926
4927/// Implements a client for the Google Compute Engine API.
4928///
4929/// # Example
4930/// ```
4931/// # use google_cloud_compute_v1::client::InstanceSettings;
4932/// async fn sample(
4933/// ) -> anyhow::Result<()> {
4934/// let client = InstanceSettings::builder().build().await?;
4935/// // use `client` to make requests to the Google Compute Engine API.
4936/// Ok(())
4937/// }
4938/// ```
4939///
4940/// # Service Description
4941///
4942/// Service for the `instanceSettings` resource.
4943///
4944/// # Configuration
4945///
4946/// To configure `InstanceSettings` use the `with_*` methods in the type returned
4947/// by [builder()][InstanceSettings::builder]. The default configuration should
4948/// work for most applications. Common configuration changes include
4949///
4950/// * [with_endpoint()]: by default this client uses the global default endpoint
4951/// (`https://compute.googleapis.com`). Applications using regional
4952/// endpoints or running in restricted networks (e.g. a network configured
4953/// with [Private Google Access with VPC Service Controls]) may want to
4954/// override this default.
4955/// * [with_credentials()]: by default this client uses
4956/// [Application Default Credentials]. Applications using custom
4957/// authentication may need to override this default.
4958///
4959/// [with_endpoint()]: super::builder::instance_settings::ClientBuilder::with_endpoint
4960/// [with_credentials()]: super::builder::instance_settings::ClientBuilder::with_credentials
4961/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4962/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4963///
4964/// # Pooling and Cloning
4965///
4966/// `InstanceSettings` holds a connection pool internally, it is advised to
4967/// create one and reuse it. You do not need to wrap `InstanceSettings` in
4968/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4969/// already uses an `Arc` internally.
4970#[cfg(feature = "instance-settings")]
4971#[cfg_attr(docsrs, doc(cfg(feature = "instance-settings")))]
4972#[derive(Clone, Debug)]
4973pub struct InstanceSettings {
4974 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceSettings>,
4975}
4976
4977#[cfg(feature = "instance-settings")]
4978impl InstanceSettings {
4979 /// Returns a builder for [InstanceSettings].
4980 ///
4981 /// ```
4982 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
4983 /// # use google_cloud_compute_v1::client::InstanceSettings;
4984 /// let client = InstanceSettings::builder().build().await?;
4985 /// # Ok(()) }
4986 /// ```
4987 pub fn builder() -> super::builder::instance_settings::ClientBuilder {
4988 crate::new_client_builder(super::builder::instance_settings::client::Factory)
4989 }
4990
4991 /// Creates a new client from the provided stub.
4992 ///
4993 /// The most common case for calling this function is in tests mocking the
4994 /// client's behavior.
4995 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
4996 where
4997 T: super::stub::InstanceSettings + 'static,
4998 {
4999 Self { inner: stub.into() }
5000 }
5001
5002 pub(crate) async fn new(
5003 config: gaxi::options::ClientConfig,
5004 ) -> crate::ClientBuilderResult<Self> {
5005 let inner = Self::build_inner(config).await?;
5006 Ok(Self { inner })
5007 }
5008
5009 async fn build_inner(
5010 conf: gaxi::options::ClientConfig,
5011 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceSettings>>
5012 {
5013 if gaxi::options::tracing_enabled(&conf) {
5014 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5015 }
5016 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5017 }
5018
5019 async fn build_transport(
5020 conf: gaxi::options::ClientConfig,
5021 ) -> crate::ClientBuilderResult<impl super::stub::InstanceSettings> {
5022 super::transport::InstanceSettings::new(conf).await
5023 }
5024
5025 async fn build_with_tracing(
5026 conf: gaxi::options::ClientConfig,
5027 ) -> crate::ClientBuilderResult<impl super::stub::InstanceSettings> {
5028 Self::build_transport(conf)
5029 .await
5030 .map(super::tracing::InstanceSettings::new)
5031 }
5032
5033 /// Get Instance settings.
5034 pub fn get(&self) -> super::builder::instance_settings::Get {
5035 super::builder::instance_settings::Get::new(self.inner.clone())
5036 }
5037
5038 /// Patch Instance settings
5039 pub fn patch(&self) -> super::builder::instance_settings::Patch {
5040 super::builder::instance_settings::Patch::new(self.inner.clone())
5041 }
5042
5043 /// Retrieves the specified zone-specific Operations resource.
5044 pub fn get_operation(&self) -> super::builder::instance_settings::GetOperation {
5045 super::builder::instance_settings::GetOperation::new(self.inner.clone())
5046 }
5047}
5048
5049/// Implements a client for the Google Compute Engine API.
5050///
5051/// # Example
5052/// ```
5053/// # use google_cloud_compute_v1::client::InstanceTemplates;
5054/// async fn sample(
5055/// ) -> anyhow::Result<()> {
5056/// let client = InstanceTemplates::builder().build().await?;
5057/// // use `client` to make requests to the Google Compute Engine API.
5058/// Ok(())
5059/// }
5060/// ```
5061///
5062/// # Service Description
5063///
5064/// Service for the `instanceTemplates` resource.
5065///
5066/// # Configuration
5067///
5068/// To configure `InstanceTemplates` use the `with_*` methods in the type returned
5069/// by [builder()][InstanceTemplates::builder]. The default configuration should
5070/// work for most applications. Common configuration changes include
5071///
5072/// * [with_endpoint()]: by default this client uses the global default endpoint
5073/// (`https://compute.googleapis.com`). Applications using regional
5074/// endpoints or running in restricted networks (e.g. a network configured
5075/// with [Private Google Access with VPC Service Controls]) may want to
5076/// override this default.
5077/// * [with_credentials()]: by default this client uses
5078/// [Application Default Credentials]. Applications using custom
5079/// authentication may need to override this default.
5080///
5081/// [with_endpoint()]: super::builder::instance_templates::ClientBuilder::with_endpoint
5082/// [with_credentials()]: super::builder::instance_templates::ClientBuilder::with_credentials
5083/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5084/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5085///
5086/// # Pooling and Cloning
5087///
5088/// `InstanceTemplates` holds a connection pool internally, it is advised to
5089/// create one and reuse it. You do not need to wrap `InstanceTemplates` in
5090/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5091/// already uses an `Arc` internally.
5092#[cfg(feature = "instance-templates")]
5093#[cfg_attr(docsrs, doc(cfg(feature = "instance-templates")))]
5094#[derive(Clone, Debug)]
5095pub struct InstanceTemplates {
5096 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceTemplates>,
5097}
5098
5099#[cfg(feature = "instance-templates")]
5100impl InstanceTemplates {
5101 /// Returns a builder for [InstanceTemplates].
5102 ///
5103 /// ```
5104 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5105 /// # use google_cloud_compute_v1::client::InstanceTemplates;
5106 /// let client = InstanceTemplates::builder().build().await?;
5107 /// # Ok(()) }
5108 /// ```
5109 pub fn builder() -> super::builder::instance_templates::ClientBuilder {
5110 crate::new_client_builder(super::builder::instance_templates::client::Factory)
5111 }
5112
5113 /// Creates a new client from the provided stub.
5114 ///
5115 /// The most common case for calling this function is in tests mocking the
5116 /// client's behavior.
5117 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5118 where
5119 T: super::stub::InstanceTemplates + 'static,
5120 {
5121 Self { inner: stub.into() }
5122 }
5123
5124 pub(crate) async fn new(
5125 config: gaxi::options::ClientConfig,
5126 ) -> crate::ClientBuilderResult<Self> {
5127 let inner = Self::build_inner(config).await?;
5128 Ok(Self { inner })
5129 }
5130
5131 async fn build_inner(
5132 conf: gaxi::options::ClientConfig,
5133 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstanceTemplates>>
5134 {
5135 if gaxi::options::tracing_enabled(&conf) {
5136 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5137 }
5138 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5139 }
5140
5141 async fn build_transport(
5142 conf: gaxi::options::ClientConfig,
5143 ) -> crate::ClientBuilderResult<impl super::stub::InstanceTemplates> {
5144 super::transport::InstanceTemplates::new(conf).await
5145 }
5146
5147 async fn build_with_tracing(
5148 conf: gaxi::options::ClientConfig,
5149 ) -> crate::ClientBuilderResult<impl super::stub::InstanceTemplates> {
5150 Self::build_transport(conf)
5151 .await
5152 .map(super::tracing::InstanceTemplates::new)
5153 }
5154
5155 /// Retrieves the list of all InstanceTemplates resources, regional and global,
5156 /// available to the specified project.
5157 ///
5158 /// To prevent failure, Google recommends that you set the
5159 /// `returnPartialSuccess` parameter to `true`.
5160 pub fn aggregated_list(&self) -> super::builder::instance_templates::AggregatedList {
5161 super::builder::instance_templates::AggregatedList::new(self.inner.clone())
5162 }
5163
5164 /// Deletes the specified instance template. Deleting an instance template is
5165 /// permanent and cannot be undone. It is not possible to delete templates
5166 /// that are already in use by a managed instance group.
5167 pub fn delete(&self) -> super::builder::instance_templates::Delete {
5168 super::builder::instance_templates::Delete::new(self.inner.clone())
5169 }
5170
5171 /// Returns the specified instance template.
5172 pub fn get(&self) -> super::builder::instance_templates::Get {
5173 super::builder::instance_templates::Get::new(self.inner.clone())
5174 }
5175
5176 /// Gets the access control policy for a resource. May be empty if no such
5177 /// policy or resource exists.
5178 pub fn get_iam_policy(&self) -> super::builder::instance_templates::GetIamPolicy {
5179 super::builder::instance_templates::GetIamPolicy::new(self.inner.clone())
5180 }
5181
5182 /// Creates an instance template in the specified project using the
5183 /// data that is included in the request. If you are creating a new template to
5184 /// update an existing instance group, your new instance template must use the
5185 /// same network or, if applicable, the same subnetwork as the original
5186 /// template.
5187 pub fn insert(&self) -> super::builder::instance_templates::Insert {
5188 super::builder::instance_templates::Insert::new(self.inner.clone())
5189 }
5190
5191 /// Retrieves a list of instance templates that are contained within
5192 /// the specified project.
5193 pub fn list(&self) -> super::builder::instance_templates::List {
5194 super::builder::instance_templates::List::new(self.inner.clone())
5195 }
5196
5197 /// Sets the access control policy on the specified resource.
5198 /// Replaces any existing policy.
5199 pub fn set_iam_policy(&self) -> super::builder::instance_templates::SetIamPolicy {
5200 super::builder::instance_templates::SetIamPolicy::new(self.inner.clone())
5201 }
5202
5203 /// Returns permissions that a caller has on the specified resource.
5204 pub fn test_iam_permissions(&self) -> super::builder::instance_templates::TestIamPermissions {
5205 super::builder::instance_templates::TestIamPermissions::new(self.inner.clone())
5206 }
5207
5208 /// Retrieves the specified Operations resource.
5209 pub fn get_operation(&self) -> super::builder::instance_templates::GetOperation {
5210 super::builder::instance_templates::GetOperation::new(self.inner.clone())
5211 }
5212}
5213
5214/// Implements a client for the Google Compute Engine API.
5215///
5216/// # Example
5217/// ```
5218/// # use google_cloud_compute_v1::client::Instances;
5219/// async fn sample(
5220/// ) -> anyhow::Result<()> {
5221/// let client = Instances::builder().build().await?;
5222/// // use `client` to make requests to the Google Compute Engine API.
5223/// Ok(())
5224/// }
5225/// ```
5226///
5227/// # Service Description
5228///
5229/// Service for the `instances` resource.
5230///
5231/// # Configuration
5232///
5233/// To configure `Instances` use the `with_*` methods in the type returned
5234/// by [builder()][Instances::builder]. The default configuration should
5235/// work for most applications. Common configuration changes include
5236///
5237/// * [with_endpoint()]: by default this client uses the global default endpoint
5238/// (`https://compute.googleapis.com`). Applications using regional
5239/// endpoints or running in restricted networks (e.g. a network configured
5240/// with [Private Google Access with VPC Service Controls]) may want to
5241/// override this default.
5242/// * [with_credentials()]: by default this client uses
5243/// [Application Default Credentials]. Applications using custom
5244/// authentication may need to override this default.
5245///
5246/// [with_endpoint()]: super::builder::instances::ClientBuilder::with_endpoint
5247/// [with_credentials()]: super::builder::instances::ClientBuilder::with_credentials
5248/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5249/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5250///
5251/// # Pooling and Cloning
5252///
5253/// `Instances` holds a connection pool internally, it is advised to
5254/// create one and reuse it. You do not need to wrap `Instances` in
5255/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5256/// already uses an `Arc` internally.
5257#[cfg(feature = "instances")]
5258#[cfg_attr(docsrs, doc(cfg(feature = "instances")))]
5259#[derive(Clone, Debug)]
5260pub struct Instances {
5261 inner: std::sync::Arc<dyn super::stub::dynamic::Instances>,
5262}
5263
5264#[cfg(feature = "instances")]
5265impl Instances {
5266 /// Returns a builder for [Instances].
5267 ///
5268 /// ```
5269 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5270 /// # use google_cloud_compute_v1::client::Instances;
5271 /// let client = Instances::builder().build().await?;
5272 /// # Ok(()) }
5273 /// ```
5274 pub fn builder() -> super::builder::instances::ClientBuilder {
5275 crate::new_client_builder(super::builder::instances::client::Factory)
5276 }
5277
5278 /// Creates a new client from the provided stub.
5279 ///
5280 /// The most common case for calling this function is in tests mocking the
5281 /// client's behavior.
5282 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5283 where
5284 T: super::stub::Instances + 'static,
5285 {
5286 Self { inner: stub.into() }
5287 }
5288
5289 pub(crate) async fn new(
5290 config: gaxi::options::ClientConfig,
5291 ) -> crate::ClientBuilderResult<Self> {
5292 let inner = Self::build_inner(config).await?;
5293 Ok(Self { inner })
5294 }
5295
5296 async fn build_inner(
5297 conf: gaxi::options::ClientConfig,
5298 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Instances>> {
5299 if gaxi::options::tracing_enabled(&conf) {
5300 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5301 }
5302 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5303 }
5304
5305 async fn build_transport(
5306 conf: gaxi::options::ClientConfig,
5307 ) -> crate::ClientBuilderResult<impl super::stub::Instances> {
5308 super::transport::Instances::new(conf).await
5309 }
5310
5311 async fn build_with_tracing(
5312 conf: gaxi::options::ClientConfig,
5313 ) -> crate::ClientBuilderResult<impl super::stub::Instances> {
5314 Self::build_transport(conf)
5315 .await
5316 .map(super::tracing::Instances::new)
5317 }
5318
5319 /// Adds an access config to an instance's network interface.
5320 pub fn add_access_config(&self) -> super::builder::instances::AddAccessConfig {
5321 super::builder::instances::AddAccessConfig::new(self.inner.clone())
5322 }
5323
5324 /// Adds one dynamic network interface to an active instance.
5325 pub fn add_network_interface(&self) -> super::builder::instances::AddNetworkInterface {
5326 super::builder::instances::AddNetworkInterface::new(self.inner.clone())
5327 }
5328
5329 /// Adds existing resource policies to an instance. You can only add one
5330 /// policy right now which will be applied to this instance for scheduling live
5331 /// migrations.
5332 pub fn add_resource_policies(&self) -> super::builder::instances::AddResourcePolicies {
5333 super::builder::instances::AddResourcePolicies::new(self.inner.clone())
5334 }
5335
5336 /// Retrieves an aggregated list of all of the instances in your project
5337 /// across all regions and zones.
5338 ///
5339 /// The performance of this method degrades when a filter is specified on a
5340 /// project that has a very large number of instances.
5341 ///
5342 /// To prevent failure, Google recommends that you set the
5343 /// `returnPartialSuccess` parameter to `true`.
5344 pub fn aggregated_list(&self) -> super::builder::instances::AggregatedList {
5345 super::builder::instances::AggregatedList::new(self.inner.clone())
5346 }
5347
5348 /// Attaches an existing Disk resource to an instance. You must first
5349 /// create the disk before you can attach it. It is not possible to create
5350 /// and attach a disk at the same time. For more information, readAdding a
5351 /// persistent disk to your instance.
5352 pub fn attach_disk(&self) -> super::builder::instances::AttachDisk {
5353 super::builder::instances::AttachDisk::new(self.inner.clone())
5354 }
5355
5356 /// Creates multiple instances. Count specifies the number of instances to
5357 /// create. For more information, seeAbout bulk
5358 /// creation of VMs.
5359 pub fn bulk_insert(&self) -> super::builder::instances::BulkInsert {
5360 super::builder::instances::BulkInsert::new(self.inner.clone())
5361 }
5362
5363 /// Deletes the specified Instance resource. For more information, seeDeleting
5364 /// an instance.
5365 pub fn delete(&self) -> super::builder::instances::Delete {
5366 super::builder::instances::Delete::new(self.inner.clone())
5367 }
5368
5369 /// Deletes an access config from an instance's network interface.
5370 pub fn delete_access_config(&self) -> super::builder::instances::DeleteAccessConfig {
5371 super::builder::instances::DeleteAccessConfig::new(self.inner.clone())
5372 }
5373
5374 /// Deletes one dynamic network interface from an active instance.
5375 /// InstancesDeleteNetworkInterfaceRequest indicates:
5376 ///
5377 /// - instance from which to delete, using project+zone+resource_id fields;
5378 /// - dynamic network interface to be deleted, using network_interface_name
5379 /// field;
5380 pub fn delete_network_interface(&self) -> super::builder::instances::DeleteNetworkInterface {
5381 super::builder::instances::DeleteNetworkInterface::new(self.inner.clone())
5382 }
5383
5384 /// Detaches a disk from an instance.
5385 pub fn detach_disk(&self) -> super::builder::instances::DetachDisk {
5386 super::builder::instances::DetachDisk::new(self.inner.clone())
5387 }
5388
5389 /// Returns the specified Instance resource.
5390 pub fn get(&self) -> super::builder::instances::Get {
5391 super::builder::instances::Get::new(self.inner.clone())
5392 }
5393
5394 /// Returns effective firewalls applied to an interface of the instance.
5395 pub fn get_effective_firewalls(&self) -> super::builder::instances::GetEffectiveFirewalls {
5396 super::builder::instances::GetEffectiveFirewalls::new(self.inner.clone())
5397 }
5398
5399 /// Returns the specified guest attributes entry.
5400 pub fn get_guest_attributes(&self) -> super::builder::instances::GetGuestAttributes {
5401 super::builder::instances::GetGuestAttributes::new(self.inner.clone())
5402 }
5403
5404 /// Gets the access control policy for a resource. May be empty if no such
5405 /// policy or resource exists.
5406 pub fn get_iam_policy(&self) -> super::builder::instances::GetIamPolicy {
5407 super::builder::instances::GetIamPolicy::new(self.inner.clone())
5408 }
5409
5410 /// Returns the screenshot from the specified instance.
5411 pub fn get_screenshot(&self) -> super::builder::instances::GetScreenshot {
5412 super::builder::instances::GetScreenshot::new(self.inner.clone())
5413 }
5414
5415 /// Returns the last 1 MB of serial port output from the specified instance.
5416 pub fn get_serial_port_output(&self) -> super::builder::instances::GetSerialPortOutput {
5417 super::builder::instances::GetSerialPortOutput::new(self.inner.clone())
5418 }
5419
5420 /// Returns the Shielded Instance Identity of an instance
5421 pub fn get_shielded_instance_identity(
5422 &self,
5423 ) -> super::builder::instances::GetShieldedInstanceIdentity {
5424 super::builder::instances::GetShieldedInstanceIdentity::new(self.inner.clone())
5425 }
5426
5427 /// Creates an instance resource in the specified project using the data
5428 /// included in the request.
5429 pub fn insert(&self) -> super::builder::instances::Insert {
5430 super::builder::instances::Insert::new(self.inner.clone())
5431 }
5432
5433 /// Retrieves the list of instances contained within
5434 /// the specified zone.
5435 pub fn list(&self) -> super::builder::instances::List {
5436 super::builder::instances::List::new(self.inner.clone())
5437 }
5438
5439 /// Retrieves a list of resources that refer to the VM instance specified in
5440 /// the request. For example, if the VM instance is part of a managed or
5441 /// unmanaged instance group, the referrers list includes the instance group.
5442 /// For more information, readViewing
5443 /// referrers to VM instances.
5444 pub fn list_referrers(&self) -> super::builder::instances::ListReferrers {
5445 super::builder::instances::ListReferrers::new(self.inner.clone())
5446 }
5447
5448 /// Perform a manual maintenance on the instance.
5449 pub fn perform_maintenance(&self) -> super::builder::instances::PerformMaintenance {
5450 super::builder::instances::PerformMaintenance::new(self.inner.clone())
5451 }
5452
5453 /// Removes resource policies from an instance.
5454 pub fn remove_resource_policies(&self) -> super::builder::instances::RemoveResourcePolicies {
5455 super::builder::instances::RemoveResourcePolicies::new(self.inner.clone())
5456 }
5457
5458 /// Mark the host as faulty and try to restart the instance on a new host.
5459 pub fn report_host_as_faulty(&self) -> super::builder::instances::ReportHostAsFaulty {
5460 super::builder::instances::ReportHostAsFaulty::new(self.inner.clone())
5461 }
5462
5463 /// Performs a reset on the instance. This is a hard reset. The VM
5464 /// does not do a graceful shutdown. For more information, seeResetting
5465 /// an instance.
5466 pub fn reset(&self) -> super::builder::instances::Reset {
5467 super::builder::instances::Reset::new(self.inner.clone())
5468 }
5469
5470 /// Resumes an instance that was suspended using theinstances().suspend
5471 /// method.
5472 pub fn resume(&self) -> super::builder::instances::Resume {
5473 super::builder::instances::Resume::new(self.inner.clone())
5474 }
5475
5476 /// Sends diagnostic interrupt to the instance.
5477 pub fn send_diagnostic_interrupt(&self) -> super::builder::instances::SendDiagnosticInterrupt {
5478 super::builder::instances::SendDiagnosticInterrupt::new(self.inner.clone())
5479 }
5480
5481 /// Sets deletion protection on the instance.
5482 pub fn set_deletion_protection(&self) -> super::builder::instances::SetDeletionProtection {
5483 super::builder::instances::SetDeletionProtection::new(self.inner.clone())
5484 }
5485
5486 /// Sets the auto-delete flag for a disk attached to an instance.
5487 pub fn set_disk_auto_delete(&self) -> super::builder::instances::SetDiskAutoDelete {
5488 super::builder::instances::SetDiskAutoDelete::new(self.inner.clone())
5489 }
5490
5491 /// Sets the access control policy on the specified resource.
5492 /// Replaces any existing policy.
5493 pub fn set_iam_policy(&self) -> super::builder::instances::SetIamPolicy {
5494 super::builder::instances::SetIamPolicy::new(self.inner.clone())
5495 }
5496
5497 /// Sets labels on an instance. To learn more about labels, read theLabeling
5498 /// Resources documentation.
5499 pub fn set_labels(&self) -> super::builder::instances::SetLabels {
5500 super::builder::instances::SetLabels::new(self.inner.clone())
5501 }
5502
5503 /// Changes the number and/or type of accelerator for a stopped instance to the
5504 /// values specified in the request.
5505 pub fn set_machine_resources(&self) -> super::builder::instances::SetMachineResources {
5506 super::builder::instances::SetMachineResources::new(self.inner.clone())
5507 }
5508
5509 /// Changes the machine type for a stopped instance to the machine
5510 /// type specified in the request.
5511 pub fn set_machine_type(&self) -> super::builder::instances::SetMachineType {
5512 super::builder::instances::SetMachineType::new(self.inner.clone())
5513 }
5514
5515 /// Sets metadata for the specified instance to the data included
5516 /// in the request.
5517 pub fn set_metadata(&self) -> super::builder::instances::SetMetadata {
5518 super::builder::instances::SetMetadata::new(self.inner.clone())
5519 }
5520
5521 /// Changes the minimum CPU platform that this instance should use.
5522 /// This method can only
5523 /// be called on a stopped instance. For more information, readSpecifying a
5524 /// Minimum CPU Platform.
5525 pub fn set_min_cpu_platform(&self) -> super::builder::instances::SetMinCpuPlatform {
5526 super::builder::instances::SetMinCpuPlatform::new(self.inner.clone())
5527 }
5528
5529 /// Sets name of an instance.
5530 pub fn set_name(&self) -> super::builder::instances::SetName {
5531 super::builder::instances::SetName::new(self.inner.clone())
5532 }
5533
5534 /// Sets an instance's scheduling options. You can only call this method on astopped instance,
5535 /// that is, a VM instance that is in a `TERMINATED` state. SeeInstance Life
5536 /// Cycle for more information on the possible instance states.
5537 /// For more information about setting scheduling options for a VM, seeSet
5538 /// VM host maintenance policy.
5539 pub fn set_scheduling(&self) -> super::builder::instances::SetScheduling {
5540 super::builder::instances::SetScheduling::new(self.inner.clone())
5541 }
5542
5543 /// Sets the Google Cloud Armor security policy for the specified instance.
5544 /// For more information, seeGoogle
5545 /// Cloud Armor Overview
5546 pub fn set_security_policy(&self) -> super::builder::instances::SetSecurityPolicy {
5547 super::builder::instances::SetSecurityPolicy::new(self.inner.clone())
5548 }
5549
5550 /// Sets the service account on the instance. For more information,
5551 /// readChanging
5552 /// the service account and access scopes for an instance.
5553 pub fn set_service_account(&self) -> super::builder::instances::SetServiceAccount {
5554 super::builder::instances::SetServiceAccount::new(self.inner.clone())
5555 }
5556
5557 /// Sets the Shielded Instance integrity policy for an instance. You can
5558 /// only use this method on a running instance. This method
5559 /// supports PATCH semantics and uses the JSON merge
5560 /// patch format and processing rules.
5561 pub fn set_shielded_instance_integrity_policy(
5562 &self,
5563 ) -> super::builder::instances::SetShieldedInstanceIntegrityPolicy {
5564 super::builder::instances::SetShieldedInstanceIntegrityPolicy::new(self.inner.clone())
5565 }
5566
5567 /// Sets network tags
5568 /// for the specified instance to the data included in the request.
5569 pub fn set_tags(&self) -> super::builder::instances::SetTags {
5570 super::builder::instances::SetTags::new(self.inner.clone())
5571 }
5572
5573 /// Simulates a host maintenance event on a VM. For more information, see
5574 /// Simulate a host maintenance event.
5575 pub fn simulate_maintenance_event(
5576 &self,
5577 ) -> super::builder::instances::SimulateMaintenanceEvent {
5578 super::builder::instances::SimulateMaintenanceEvent::new(self.inner.clone())
5579 }
5580
5581 /// Starts an instance that was stopped using theinstances().stop
5582 /// method. For more information, seeRestart an
5583 /// instance.
5584 pub fn start(&self) -> super::builder::instances::Start {
5585 super::builder::instances::Start::new(self.inner.clone())
5586 }
5587
5588 /// Starts an instance that was stopped using theinstances().stop
5589 /// method. For more information, seeRestart an
5590 /// instance.
5591 pub fn start_with_encryption_key(&self) -> super::builder::instances::StartWithEncryptionKey {
5592 super::builder::instances::StartWithEncryptionKey::new(self.inner.clone())
5593 }
5594
5595 /// Stops a running instance, shutting it down cleanly, and allows
5596 /// you to restart the instance at a later time. Stopped instances do not incur
5597 /// VM usage charges while they are stopped. However, resources that the VM is
5598 /// using, such as persistent disks and static IP addresses, will continue to
5599 /// be charged until they are deleted. For more information, seeStopping
5600 /// an instance.
5601 pub fn stop(&self) -> super::builder::instances::Stop {
5602 super::builder::instances::Stop::new(self.inner.clone())
5603 }
5604
5605 /// This method suspends a running instance, saving its state to persistent
5606 /// storage, and allows you to resume the instance at a later time. Suspended
5607 /// instances have no compute costs (cores or RAM), and incur only storage
5608 /// charges for the saved VM memory and localSSD data. Any charged resources
5609 /// the virtual machine was using, such as persistent disks and static IP
5610 /// addresses, will continue to be charged while the instance is suspended.
5611 /// For more information, see
5612 /// Suspending and resuming an instance.
5613 pub fn suspend(&self) -> super::builder::instances::Suspend {
5614 super::builder::instances::Suspend::new(self.inner.clone())
5615 }
5616
5617 /// Returns permissions that a caller has on the specified resource.
5618 pub fn test_iam_permissions(&self) -> super::builder::instances::TestIamPermissions {
5619 super::builder::instances::TestIamPermissions::new(self.inner.clone())
5620 }
5621
5622 /// Updates an instance only if the necessary resources are available. This
5623 /// method can update only a specific set of instance properties. See
5624 /// Updating a running instance for a list of updatable instance
5625 /// properties.
5626 pub fn update(&self) -> super::builder::instances::Update {
5627 super::builder::instances::Update::new(self.inner.clone())
5628 }
5629
5630 /// Updates the specified access config from an instance's network interface
5631 /// with the data included in the request. This method supportsPATCH
5632 /// semantics and uses theJSON merge
5633 /// patch format and processing rules.
5634 pub fn update_access_config(&self) -> super::builder::instances::UpdateAccessConfig {
5635 super::builder::instances::UpdateAccessConfig::new(self.inner.clone())
5636 }
5637
5638 /// Updates the Display config for a VM instance. You can
5639 /// only use this method on a stopped VM instance. This method supportsPATCH
5640 /// semantics and uses theJSON merge
5641 /// patch format and processing rules.
5642 pub fn update_display_device(&self) -> super::builder::instances::UpdateDisplayDevice {
5643 super::builder::instances::UpdateDisplayDevice::new(self.inner.clone())
5644 }
5645
5646 /// Updates an instance's network interface. This method can only update an
5647 /// interface's alias IP range and attached network. See Modifying
5648 /// alias IP ranges for an existing instance for instructions on
5649 /// changing alias IP ranges. See Migrating
5650 /// a VM between networks for instructions on migrating an interface.
5651 /// This method follows PATCH semantics.
5652 pub fn update_network_interface(&self) -> super::builder::instances::UpdateNetworkInterface {
5653 super::builder::instances::UpdateNetworkInterface::new(self.inner.clone())
5654 }
5655
5656 /// Updates the Shielded Instance config for an instance. You can
5657 /// only use this method on a stopped instance. This method supportsPATCH
5658 /// semantics and uses theJSON merge
5659 /// patch format and processing rules.
5660 pub fn update_shielded_instance_config(
5661 &self,
5662 ) -> super::builder::instances::UpdateShieldedInstanceConfig {
5663 super::builder::instances::UpdateShieldedInstanceConfig::new(self.inner.clone())
5664 }
5665
5666 /// Retrieves the specified zone-specific Operations resource.
5667 pub fn get_operation(&self) -> super::builder::instances::GetOperation {
5668 super::builder::instances::GetOperation::new(self.inner.clone())
5669 }
5670}
5671
5672/// Implements a client for the Google Compute Engine API.
5673///
5674/// # Example
5675/// ```
5676/// # use google_cloud_compute_v1::client::InstantSnapshotGroups;
5677/// async fn sample(
5678/// ) -> anyhow::Result<()> {
5679/// let client = InstantSnapshotGroups::builder().build().await?;
5680/// // use `client` to make requests to the Google Compute Engine API.
5681/// Ok(())
5682/// }
5683/// ```
5684///
5685/// # Service Description
5686///
5687/// Service for the `instantSnapshotGroups` resource.
5688///
5689/// # Configuration
5690///
5691/// To configure `InstantSnapshotGroups` use the `with_*` methods in the type returned
5692/// by [builder()][InstantSnapshotGroups::builder]. The default configuration should
5693/// work for most applications. Common configuration changes include
5694///
5695/// * [with_endpoint()]: by default this client uses the global default endpoint
5696/// (`https://compute.googleapis.com`). Applications using regional
5697/// endpoints or running in restricted networks (e.g. a network configured
5698/// with [Private Google Access with VPC Service Controls]) may want to
5699/// override this default.
5700/// * [with_credentials()]: by default this client uses
5701/// [Application Default Credentials]. Applications using custom
5702/// authentication may need to override this default.
5703///
5704/// [with_endpoint()]: super::builder::instant_snapshot_groups::ClientBuilder::with_endpoint
5705/// [with_credentials()]: super::builder::instant_snapshot_groups::ClientBuilder::with_credentials
5706/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5707/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5708///
5709/// # Pooling and Cloning
5710///
5711/// `InstantSnapshotGroups` holds a connection pool internally, it is advised to
5712/// create one and reuse it. You do not need to wrap `InstantSnapshotGroups` in
5713/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5714/// already uses an `Arc` internally.
5715#[cfg(feature = "instant-snapshot-groups")]
5716#[cfg_attr(docsrs, doc(cfg(feature = "instant-snapshot-groups")))]
5717#[derive(Clone, Debug)]
5718pub struct InstantSnapshotGroups {
5719 inner: std::sync::Arc<dyn super::stub::dynamic::InstantSnapshotGroups>,
5720}
5721
5722#[cfg(feature = "instant-snapshot-groups")]
5723impl InstantSnapshotGroups {
5724 /// Returns a builder for [InstantSnapshotGroups].
5725 ///
5726 /// ```
5727 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5728 /// # use google_cloud_compute_v1::client::InstantSnapshotGroups;
5729 /// let client = InstantSnapshotGroups::builder().build().await?;
5730 /// # Ok(()) }
5731 /// ```
5732 pub fn builder() -> super::builder::instant_snapshot_groups::ClientBuilder {
5733 crate::new_client_builder(super::builder::instant_snapshot_groups::client::Factory)
5734 }
5735
5736 /// Creates a new client from the provided stub.
5737 ///
5738 /// The most common case for calling this function is in tests mocking the
5739 /// client's behavior.
5740 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5741 where
5742 T: super::stub::InstantSnapshotGroups + 'static,
5743 {
5744 Self { inner: stub.into() }
5745 }
5746
5747 pub(crate) async fn new(
5748 config: gaxi::options::ClientConfig,
5749 ) -> crate::ClientBuilderResult<Self> {
5750 let inner = Self::build_inner(config).await?;
5751 Ok(Self { inner })
5752 }
5753
5754 async fn build_inner(
5755 conf: gaxi::options::ClientConfig,
5756 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstantSnapshotGroups>>
5757 {
5758 if gaxi::options::tracing_enabled(&conf) {
5759 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5760 }
5761 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5762 }
5763
5764 async fn build_transport(
5765 conf: gaxi::options::ClientConfig,
5766 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshotGroups> {
5767 super::transport::InstantSnapshotGroups::new(conf).await
5768 }
5769
5770 async fn build_with_tracing(
5771 conf: gaxi::options::ClientConfig,
5772 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshotGroups> {
5773 Self::build_transport(conf)
5774 .await
5775 .map(super::tracing::InstantSnapshotGroups::new)
5776 }
5777
5778 /// deletes a Zonal InstantSnapshotGroup resource
5779 pub fn delete(&self) -> super::builder::instant_snapshot_groups::Delete {
5780 super::builder::instant_snapshot_groups::Delete::new(self.inner.clone())
5781 }
5782
5783 /// returns the specified InstantSnapshotGroup resource in the specified zone.
5784 pub fn get(&self) -> super::builder::instant_snapshot_groups::Get {
5785 super::builder::instant_snapshot_groups::Get::new(self.inner.clone())
5786 }
5787
5788 /// Gets the access control policy for a resource. May be empty if no such
5789 /// policy or resource exists.
5790 pub fn get_iam_policy(&self) -> super::builder::instant_snapshot_groups::GetIamPolicy {
5791 super::builder::instant_snapshot_groups::GetIamPolicy::new(self.inner.clone())
5792 }
5793
5794 /// inserts a Zonal InstantSnapshotGroup resource
5795 pub fn insert(&self) -> super::builder::instant_snapshot_groups::Insert {
5796 super::builder::instant_snapshot_groups::Insert::new(self.inner.clone())
5797 }
5798
5799 /// retrieves the list of InstantSnapshotGroup resources contained within
5800 /// the specified zone.
5801 pub fn list(&self) -> super::builder::instant_snapshot_groups::List {
5802 super::builder::instant_snapshot_groups::List::new(self.inner.clone())
5803 }
5804
5805 /// Sets the access control policy on the specified resource.
5806 /// Replaces any existing policy.
5807 pub fn set_iam_policy(&self) -> super::builder::instant_snapshot_groups::SetIamPolicy {
5808 super::builder::instant_snapshot_groups::SetIamPolicy::new(self.inner.clone())
5809 }
5810
5811 /// Returns permissions that a caller has on the specified resource.
5812 pub fn test_iam_permissions(
5813 &self,
5814 ) -> super::builder::instant_snapshot_groups::TestIamPermissions {
5815 super::builder::instant_snapshot_groups::TestIamPermissions::new(self.inner.clone())
5816 }
5817
5818 /// Retrieves the specified zone-specific Operations resource.
5819 pub fn get_operation(&self) -> super::builder::instant_snapshot_groups::GetOperation {
5820 super::builder::instant_snapshot_groups::GetOperation::new(self.inner.clone())
5821 }
5822}
5823
5824/// Implements a client for the Google Compute Engine API.
5825///
5826/// # Example
5827/// ```
5828/// # use google_cloud_compute_v1::client::InstantSnapshots;
5829/// async fn sample(
5830/// ) -> anyhow::Result<()> {
5831/// let client = InstantSnapshots::builder().build().await?;
5832/// // use `client` to make requests to the Google Compute Engine API.
5833/// Ok(())
5834/// }
5835/// ```
5836///
5837/// # Service Description
5838///
5839/// Service for the `instantSnapshots` resource.
5840///
5841/// # Configuration
5842///
5843/// To configure `InstantSnapshots` use the `with_*` methods in the type returned
5844/// by [builder()][InstantSnapshots::builder]. The default configuration should
5845/// work for most applications. Common configuration changes include
5846///
5847/// * [with_endpoint()]: by default this client uses the global default endpoint
5848/// (`https://compute.googleapis.com`). Applications using regional
5849/// endpoints or running in restricted networks (e.g. a network configured
5850/// with [Private Google Access with VPC Service Controls]) may want to
5851/// override this default.
5852/// * [with_credentials()]: by default this client uses
5853/// [Application Default Credentials]. Applications using custom
5854/// authentication may need to override this default.
5855///
5856/// [with_endpoint()]: super::builder::instant_snapshots::ClientBuilder::with_endpoint
5857/// [with_credentials()]: super::builder::instant_snapshots::ClientBuilder::with_credentials
5858/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5859/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5860///
5861/// # Pooling and Cloning
5862///
5863/// `InstantSnapshots` holds a connection pool internally, it is advised to
5864/// create one and reuse it. You do not need to wrap `InstantSnapshots` in
5865/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5866/// already uses an `Arc` internally.
5867#[cfg(feature = "instant-snapshots")]
5868#[cfg_attr(docsrs, doc(cfg(feature = "instant-snapshots")))]
5869#[derive(Clone, Debug)]
5870pub struct InstantSnapshots {
5871 inner: std::sync::Arc<dyn super::stub::dynamic::InstantSnapshots>,
5872}
5873
5874#[cfg(feature = "instant-snapshots")]
5875impl InstantSnapshots {
5876 /// Returns a builder for [InstantSnapshots].
5877 ///
5878 /// ```
5879 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
5880 /// # use google_cloud_compute_v1::client::InstantSnapshots;
5881 /// let client = InstantSnapshots::builder().build().await?;
5882 /// # Ok(()) }
5883 /// ```
5884 pub fn builder() -> super::builder::instant_snapshots::ClientBuilder {
5885 crate::new_client_builder(super::builder::instant_snapshots::client::Factory)
5886 }
5887
5888 /// Creates a new client from the provided stub.
5889 ///
5890 /// The most common case for calling this function is in tests mocking the
5891 /// client's behavior.
5892 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
5893 where
5894 T: super::stub::InstantSnapshots + 'static,
5895 {
5896 Self { inner: stub.into() }
5897 }
5898
5899 pub(crate) async fn new(
5900 config: gaxi::options::ClientConfig,
5901 ) -> crate::ClientBuilderResult<Self> {
5902 let inner = Self::build_inner(config).await?;
5903 Ok(Self { inner })
5904 }
5905
5906 async fn build_inner(
5907 conf: gaxi::options::ClientConfig,
5908 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InstantSnapshots>>
5909 {
5910 if gaxi::options::tracing_enabled(&conf) {
5911 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5912 }
5913 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5914 }
5915
5916 async fn build_transport(
5917 conf: gaxi::options::ClientConfig,
5918 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshots> {
5919 super::transport::InstantSnapshots::new(conf).await
5920 }
5921
5922 async fn build_with_tracing(
5923 conf: gaxi::options::ClientConfig,
5924 ) -> crate::ClientBuilderResult<impl super::stub::InstantSnapshots> {
5925 Self::build_transport(conf)
5926 .await
5927 .map(super::tracing::InstantSnapshots::new)
5928 }
5929
5930 /// Retrieves an aggregated list of instantSnapshots.
5931 ///
5932 /// To prevent failure, Google recommends that you set the
5933 /// `returnPartialSuccess` parameter to `true`.
5934 pub fn aggregated_list(&self) -> super::builder::instant_snapshots::AggregatedList {
5935 super::builder::instant_snapshots::AggregatedList::new(self.inner.clone())
5936 }
5937
5938 /// Deletes the specified InstantSnapshot resource. Keep in mind that deleting
5939 /// a single instantSnapshot might not necessarily delete all the data on that
5940 /// instantSnapshot. If any data on the instantSnapshot that is marked for
5941 /// deletion is needed for subsequent instantSnapshots, the data will be moved
5942 /// to the next corresponding instantSnapshot.
5943 ///
5944 /// For more information, seeDeleting
5945 /// instantSnapshots.
5946 pub fn delete(&self) -> super::builder::instant_snapshots::Delete {
5947 super::builder::instant_snapshots::Delete::new(self.inner.clone())
5948 }
5949
5950 /// Returns the specified InstantSnapshot resource in the specified zone.
5951 pub fn get(&self) -> super::builder::instant_snapshots::Get {
5952 super::builder::instant_snapshots::Get::new(self.inner.clone())
5953 }
5954
5955 /// Gets the access control policy for a resource. May be empty if no such
5956 /// policy or resource exists.
5957 pub fn get_iam_policy(&self) -> super::builder::instant_snapshots::GetIamPolicy {
5958 super::builder::instant_snapshots::GetIamPolicy::new(self.inner.clone())
5959 }
5960
5961 /// Creates an instant snapshot in the specified zone.
5962 pub fn insert(&self) -> super::builder::instant_snapshots::Insert {
5963 super::builder::instant_snapshots::Insert::new(self.inner.clone())
5964 }
5965
5966 /// Retrieves the list of InstantSnapshot resources contained within
5967 /// the specified zone.
5968 pub fn list(&self) -> super::builder::instant_snapshots::List {
5969 super::builder::instant_snapshots::List::new(self.inner.clone())
5970 }
5971
5972 /// Sets the access control policy on the specified resource.
5973 /// Replaces any existing policy.
5974 pub fn set_iam_policy(&self) -> super::builder::instant_snapshots::SetIamPolicy {
5975 super::builder::instant_snapshots::SetIamPolicy::new(self.inner.clone())
5976 }
5977
5978 /// Sets the labels on a instantSnapshot in the given zone. To learn more about
5979 /// labels, read the Labeling
5980 /// Resources documentation.
5981 pub fn set_labels(&self) -> super::builder::instant_snapshots::SetLabels {
5982 super::builder::instant_snapshots::SetLabels::new(self.inner.clone())
5983 }
5984
5985 /// Returns permissions that a caller has on the specified resource.
5986 pub fn test_iam_permissions(&self) -> super::builder::instant_snapshots::TestIamPermissions {
5987 super::builder::instant_snapshots::TestIamPermissions::new(self.inner.clone())
5988 }
5989
5990 /// Retrieves the specified zone-specific Operations resource.
5991 pub fn get_operation(&self) -> super::builder::instant_snapshots::GetOperation {
5992 super::builder::instant_snapshots::GetOperation::new(self.inner.clone())
5993 }
5994}
5995
5996/// Implements a client for the Google Compute Engine API.
5997///
5998/// # Example
5999/// ```
6000/// # use google_cloud_compute_v1::client::InterconnectAttachmentGroups;
6001/// async fn sample(
6002/// ) -> anyhow::Result<()> {
6003/// let client = InterconnectAttachmentGroups::builder().build().await?;
6004/// // use `client` to make requests to the Google Compute Engine API.
6005/// Ok(())
6006/// }
6007/// ```
6008///
6009/// # Service Description
6010///
6011/// Service for the `interconnectAttachmentGroups` resource.
6012///
6013/// # Configuration
6014///
6015/// To configure `InterconnectAttachmentGroups` use the `with_*` methods in the type returned
6016/// by [builder()][InterconnectAttachmentGroups::builder]. The default configuration should
6017/// work for most applications. Common configuration changes include
6018///
6019/// * [with_endpoint()]: by default this client uses the global default endpoint
6020/// (`https://compute.googleapis.com`). Applications using regional
6021/// endpoints or running in restricted networks (e.g. a network configured
6022/// with [Private Google Access with VPC Service Controls]) may want to
6023/// override this default.
6024/// * [with_credentials()]: by default this client uses
6025/// [Application Default Credentials]. Applications using custom
6026/// authentication may need to override this default.
6027///
6028/// [with_endpoint()]: super::builder::interconnect_attachment_groups::ClientBuilder::with_endpoint
6029/// [with_credentials()]: super::builder::interconnect_attachment_groups::ClientBuilder::with_credentials
6030/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6031/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6032///
6033/// # Pooling and Cloning
6034///
6035/// `InterconnectAttachmentGroups` holds a connection pool internally, it is advised to
6036/// create one and reuse it. You do not need to wrap `InterconnectAttachmentGroups` in
6037/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6038/// already uses an `Arc` internally.
6039#[cfg(feature = "interconnect-attachment-groups")]
6040#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-attachment-groups")))]
6041#[derive(Clone, Debug)]
6042pub struct InterconnectAttachmentGroups {
6043 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachmentGroups>,
6044}
6045
6046#[cfg(feature = "interconnect-attachment-groups")]
6047impl InterconnectAttachmentGroups {
6048 /// Returns a builder for [InterconnectAttachmentGroups].
6049 ///
6050 /// ```
6051 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6052 /// # use google_cloud_compute_v1::client::InterconnectAttachmentGroups;
6053 /// let client = InterconnectAttachmentGroups::builder().build().await?;
6054 /// # Ok(()) }
6055 /// ```
6056 pub fn builder() -> super::builder::interconnect_attachment_groups::ClientBuilder {
6057 crate::new_client_builder(super::builder::interconnect_attachment_groups::client::Factory)
6058 }
6059
6060 /// Creates a new client from the provided stub.
6061 ///
6062 /// The most common case for calling this function is in tests mocking the
6063 /// client's behavior.
6064 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6065 where
6066 T: super::stub::InterconnectAttachmentGroups + 'static,
6067 {
6068 Self { inner: stub.into() }
6069 }
6070
6071 pub(crate) async fn new(
6072 config: gaxi::options::ClientConfig,
6073 ) -> crate::ClientBuilderResult<Self> {
6074 let inner = Self::build_inner(config).await?;
6075 Ok(Self { inner })
6076 }
6077
6078 async fn build_inner(
6079 conf: gaxi::options::ClientConfig,
6080 ) -> crate::ClientBuilderResult<
6081 std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachmentGroups>,
6082 > {
6083 if gaxi::options::tracing_enabled(&conf) {
6084 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6085 }
6086 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6087 }
6088
6089 async fn build_transport(
6090 conf: gaxi::options::ClientConfig,
6091 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachmentGroups> {
6092 super::transport::InterconnectAttachmentGroups::new(conf).await
6093 }
6094
6095 async fn build_with_tracing(
6096 conf: gaxi::options::ClientConfig,
6097 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachmentGroups> {
6098 Self::build_transport(conf)
6099 .await
6100 .map(super::tracing::InterconnectAttachmentGroups::new)
6101 }
6102
6103 /// Deletes the specified InterconnectAttachmentGroup in the given scope
6104 pub fn delete(&self) -> super::builder::interconnect_attachment_groups::Delete {
6105 super::builder::interconnect_attachment_groups::Delete::new(self.inner.clone())
6106 }
6107
6108 /// Returns the specified InterconnectAttachmentGroup resource in the given
6109 /// scope.
6110 pub fn get(&self) -> super::builder::interconnect_attachment_groups::Get {
6111 super::builder::interconnect_attachment_groups::Get::new(self.inner.clone())
6112 }
6113
6114 /// Gets the access control policy for a resource. May be empty if no such
6115 /// policy or resource exists.
6116 pub fn get_iam_policy(&self) -> super::builder::interconnect_attachment_groups::GetIamPolicy {
6117 super::builder::interconnect_attachment_groups::GetIamPolicy::new(self.inner.clone())
6118 }
6119
6120 /// Returns the InterconnectAttachmentStatuses for the specified
6121 /// InterconnectAttachmentGroup resource.
6122 pub fn get_operational_status(
6123 &self,
6124 ) -> super::builder::interconnect_attachment_groups::GetOperationalStatus {
6125 super::builder::interconnect_attachment_groups::GetOperationalStatus::new(
6126 self.inner.clone(),
6127 )
6128 }
6129
6130 /// Creates a InterconnectAttachmentGroup in the specified project in the given
6131 /// scope using the parameters that are included in the request.
6132 pub fn insert(&self) -> super::builder::interconnect_attachment_groups::Insert {
6133 super::builder::interconnect_attachment_groups::Insert::new(self.inner.clone())
6134 }
6135
6136 /// Lists the InterconnectAttachmentGroups for a project in the given scope.
6137 pub fn list(&self) -> super::builder::interconnect_attachment_groups::List {
6138 super::builder::interconnect_attachment_groups::List::new(self.inner.clone())
6139 }
6140
6141 /// Patches the specified InterconnectAttachmentGroup resource with the data
6142 /// included in the request. This method supports PATCH
6143 /// semantics and usesJSON merge
6144 /// patch format and processing rules.
6145 pub fn patch(&self) -> super::builder::interconnect_attachment_groups::Patch {
6146 super::builder::interconnect_attachment_groups::Patch::new(self.inner.clone())
6147 }
6148
6149 /// Sets the access control policy on the specified resource.
6150 /// Replaces any existing policy.
6151 pub fn set_iam_policy(&self) -> super::builder::interconnect_attachment_groups::SetIamPolicy {
6152 super::builder::interconnect_attachment_groups::SetIamPolicy::new(self.inner.clone())
6153 }
6154
6155 /// Returns permissions that a caller has on the specified resource.
6156 pub fn test_iam_permissions(
6157 &self,
6158 ) -> super::builder::interconnect_attachment_groups::TestIamPermissions {
6159 super::builder::interconnect_attachment_groups::TestIamPermissions::new(self.inner.clone())
6160 }
6161
6162 /// Retrieves the specified Operations resource.
6163 pub fn get_operation(&self) -> super::builder::interconnect_attachment_groups::GetOperation {
6164 super::builder::interconnect_attachment_groups::GetOperation::new(self.inner.clone())
6165 }
6166}
6167
6168/// Implements a client for the Google Compute Engine API.
6169///
6170/// # Example
6171/// ```
6172/// # use google_cloud_compute_v1::client::InterconnectAttachments;
6173/// async fn sample(
6174/// ) -> anyhow::Result<()> {
6175/// let client = InterconnectAttachments::builder().build().await?;
6176/// // use `client` to make requests to the Google Compute Engine API.
6177/// Ok(())
6178/// }
6179/// ```
6180///
6181/// # Service Description
6182///
6183/// Service for the `interconnectAttachments` resource.
6184///
6185/// # Configuration
6186///
6187/// To configure `InterconnectAttachments` use the `with_*` methods in the type returned
6188/// by [builder()][InterconnectAttachments::builder]. The default configuration should
6189/// work for most applications. Common configuration changes include
6190///
6191/// * [with_endpoint()]: by default this client uses the global default endpoint
6192/// (`https://compute.googleapis.com`). Applications using regional
6193/// endpoints or running in restricted networks (e.g. a network configured
6194/// with [Private Google Access with VPC Service Controls]) may want to
6195/// override this default.
6196/// * [with_credentials()]: by default this client uses
6197/// [Application Default Credentials]. Applications using custom
6198/// authentication may need to override this default.
6199///
6200/// [with_endpoint()]: super::builder::interconnect_attachments::ClientBuilder::with_endpoint
6201/// [with_credentials()]: super::builder::interconnect_attachments::ClientBuilder::with_credentials
6202/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6203/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6204///
6205/// # Pooling and Cloning
6206///
6207/// `InterconnectAttachments` holds a connection pool internally, it is advised to
6208/// create one and reuse it. You do not need to wrap `InterconnectAttachments` in
6209/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6210/// already uses an `Arc` internally.
6211#[cfg(feature = "interconnect-attachments")]
6212#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-attachments")))]
6213#[derive(Clone, Debug)]
6214pub struct InterconnectAttachments {
6215 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachments>,
6216}
6217
6218#[cfg(feature = "interconnect-attachments")]
6219impl InterconnectAttachments {
6220 /// Returns a builder for [InterconnectAttachments].
6221 ///
6222 /// ```
6223 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6224 /// # use google_cloud_compute_v1::client::InterconnectAttachments;
6225 /// let client = InterconnectAttachments::builder().build().await?;
6226 /// # Ok(()) }
6227 /// ```
6228 pub fn builder() -> super::builder::interconnect_attachments::ClientBuilder {
6229 crate::new_client_builder(super::builder::interconnect_attachments::client::Factory)
6230 }
6231
6232 /// Creates a new client from the provided stub.
6233 ///
6234 /// The most common case for calling this function is in tests mocking the
6235 /// client's behavior.
6236 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6237 where
6238 T: super::stub::InterconnectAttachments + 'static,
6239 {
6240 Self { inner: stub.into() }
6241 }
6242
6243 pub(crate) async fn new(
6244 config: gaxi::options::ClientConfig,
6245 ) -> crate::ClientBuilderResult<Self> {
6246 let inner = Self::build_inner(config).await?;
6247 Ok(Self { inner })
6248 }
6249
6250 async fn build_inner(
6251 conf: gaxi::options::ClientConfig,
6252 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachments>>
6253 {
6254 if gaxi::options::tracing_enabled(&conf) {
6255 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6256 }
6257 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6258 }
6259
6260 async fn build_transport(
6261 conf: gaxi::options::ClientConfig,
6262 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachments> {
6263 super::transport::InterconnectAttachments::new(conf).await
6264 }
6265
6266 async fn build_with_tracing(
6267 conf: gaxi::options::ClientConfig,
6268 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectAttachments> {
6269 Self::build_transport(conf)
6270 .await
6271 .map(super::tracing::InterconnectAttachments::new)
6272 }
6273
6274 /// Retrieves an aggregated list of interconnect attachments.
6275 ///
6276 /// To prevent failure, Google recommends that you set the
6277 /// `returnPartialSuccess` parameter to `true`.
6278 pub fn aggregated_list(&self) -> super::builder::interconnect_attachments::AggregatedList {
6279 super::builder::interconnect_attachments::AggregatedList::new(self.inner.clone())
6280 }
6281
6282 /// Deletes the specified interconnect attachment.
6283 pub fn delete(&self) -> super::builder::interconnect_attachments::Delete {
6284 super::builder::interconnect_attachments::Delete::new(self.inner.clone())
6285 }
6286
6287 /// Returns the specified interconnect attachment.
6288 pub fn get(&self) -> super::builder::interconnect_attachments::Get {
6289 super::builder::interconnect_attachments::Get::new(self.inner.clone())
6290 }
6291
6292 /// Creates an InterconnectAttachment in the specified project using the data
6293 /// included in the request.
6294 pub fn insert(&self) -> super::builder::interconnect_attachments::Insert {
6295 super::builder::interconnect_attachments::Insert::new(self.inner.clone())
6296 }
6297
6298 /// Retrieves the list of interconnect attachments contained within
6299 /// the specified region.
6300 pub fn list(&self) -> super::builder::interconnect_attachments::List {
6301 super::builder::interconnect_attachments::List::new(self.inner.clone())
6302 }
6303
6304 /// Updates the specified interconnect attachment with the data included in the
6305 /// request. This method supportsPATCH
6306 /// semantics and uses theJSON merge
6307 /// patch format and processing rules.
6308 pub fn patch(&self) -> super::builder::interconnect_attachments::Patch {
6309 super::builder::interconnect_attachments::Patch::new(self.inner.clone())
6310 }
6311
6312 /// Sets the labels on an InterconnectAttachment. To learn more about labels,
6313 /// read the Labeling
6314 /// Resources documentation.
6315 pub fn set_labels(&self) -> super::builder::interconnect_attachments::SetLabels {
6316 super::builder::interconnect_attachments::SetLabels::new(self.inner.clone())
6317 }
6318
6319 /// Retrieves the specified region-specific Operations resource.
6320 pub fn get_operation(&self) -> super::builder::interconnect_attachments::GetOperation {
6321 super::builder::interconnect_attachments::GetOperation::new(self.inner.clone())
6322 }
6323}
6324
6325/// Implements a client for the Google Compute Engine API.
6326///
6327/// # Example
6328/// ```
6329/// # use google_cloud_compute_v1::client::InterconnectGroups;
6330/// async fn sample(
6331/// ) -> anyhow::Result<()> {
6332/// let client = InterconnectGroups::builder().build().await?;
6333/// // use `client` to make requests to the Google Compute Engine API.
6334/// Ok(())
6335/// }
6336/// ```
6337///
6338/// # Service Description
6339///
6340/// Service for the `interconnectGroups` resource.
6341///
6342/// # Configuration
6343///
6344/// To configure `InterconnectGroups` use the `with_*` methods in the type returned
6345/// by [builder()][InterconnectGroups::builder]. The default configuration should
6346/// work for most applications. Common configuration changes include
6347///
6348/// * [with_endpoint()]: by default this client uses the global default endpoint
6349/// (`https://compute.googleapis.com`). Applications using regional
6350/// endpoints or running in restricted networks (e.g. a network configured
6351/// with [Private Google Access with VPC Service Controls]) may want to
6352/// override this default.
6353/// * [with_credentials()]: by default this client uses
6354/// [Application Default Credentials]. Applications using custom
6355/// authentication may need to override this default.
6356///
6357/// [with_endpoint()]: super::builder::interconnect_groups::ClientBuilder::with_endpoint
6358/// [with_credentials()]: super::builder::interconnect_groups::ClientBuilder::with_credentials
6359/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6360/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6361///
6362/// # Pooling and Cloning
6363///
6364/// `InterconnectGroups` holds a connection pool internally, it is advised to
6365/// create one and reuse it. You do not need to wrap `InterconnectGroups` in
6366/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6367/// already uses an `Arc` internally.
6368#[cfg(feature = "interconnect-groups")]
6369#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-groups")))]
6370#[derive(Clone, Debug)]
6371pub struct InterconnectGroups {
6372 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectGroups>,
6373}
6374
6375#[cfg(feature = "interconnect-groups")]
6376impl InterconnectGroups {
6377 /// Returns a builder for [InterconnectGroups].
6378 ///
6379 /// ```
6380 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6381 /// # use google_cloud_compute_v1::client::InterconnectGroups;
6382 /// let client = InterconnectGroups::builder().build().await?;
6383 /// # Ok(()) }
6384 /// ```
6385 pub fn builder() -> super::builder::interconnect_groups::ClientBuilder {
6386 crate::new_client_builder(super::builder::interconnect_groups::client::Factory)
6387 }
6388
6389 /// Creates a new client from the provided stub.
6390 ///
6391 /// The most common case for calling this function is in tests mocking the
6392 /// client's behavior.
6393 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6394 where
6395 T: super::stub::InterconnectGroups + 'static,
6396 {
6397 Self { inner: stub.into() }
6398 }
6399
6400 pub(crate) async fn new(
6401 config: gaxi::options::ClientConfig,
6402 ) -> crate::ClientBuilderResult<Self> {
6403 let inner = Self::build_inner(config).await?;
6404 Ok(Self { inner })
6405 }
6406
6407 async fn build_inner(
6408 conf: gaxi::options::ClientConfig,
6409 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InterconnectGroups>>
6410 {
6411 if gaxi::options::tracing_enabled(&conf) {
6412 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6413 }
6414 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6415 }
6416
6417 async fn build_transport(
6418 conf: gaxi::options::ClientConfig,
6419 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectGroups> {
6420 super::transport::InterconnectGroups::new(conf).await
6421 }
6422
6423 async fn build_with_tracing(
6424 conf: gaxi::options::ClientConfig,
6425 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectGroups> {
6426 Self::build_transport(conf)
6427 .await
6428 .map(super::tracing::InterconnectGroups::new)
6429 }
6430
6431 /// Create Interconnects with redundancy by creating them in a specified
6432 /// interconnect group.
6433 pub fn create_members(&self) -> super::builder::interconnect_groups::CreateMembers {
6434 super::builder::interconnect_groups::CreateMembers::new(self.inner.clone())
6435 }
6436
6437 /// Deletes the specified InterconnectGroup in the given scope
6438 pub fn delete(&self) -> super::builder::interconnect_groups::Delete {
6439 super::builder::interconnect_groups::Delete::new(self.inner.clone())
6440 }
6441
6442 /// Returns the specified InterconnectGroup resource in the given scope.
6443 pub fn get(&self) -> super::builder::interconnect_groups::Get {
6444 super::builder::interconnect_groups::Get::new(self.inner.clone())
6445 }
6446
6447 /// Gets the access control policy for a resource. May be empty if no such
6448 /// policy or resource exists.
6449 pub fn get_iam_policy(&self) -> super::builder::interconnect_groups::GetIamPolicy {
6450 super::builder::interconnect_groups::GetIamPolicy::new(self.inner.clone())
6451 }
6452
6453 /// Returns the interconnectStatuses for the specified
6454 /// InterconnectGroup.
6455 pub fn get_operational_status(
6456 &self,
6457 ) -> super::builder::interconnect_groups::GetOperationalStatus {
6458 super::builder::interconnect_groups::GetOperationalStatus::new(self.inner.clone())
6459 }
6460
6461 /// Creates a InterconnectGroup in the specified project in the given scope
6462 /// using the parameters that are included in the request.
6463 pub fn insert(&self) -> super::builder::interconnect_groups::Insert {
6464 super::builder::interconnect_groups::Insert::new(self.inner.clone())
6465 }
6466
6467 /// Lists the InterconnectGroups for a project in the given scope.
6468 pub fn list(&self) -> super::builder::interconnect_groups::List {
6469 super::builder::interconnect_groups::List::new(self.inner.clone())
6470 }
6471
6472 /// Patches the specified InterconnectGroup resource with the data included in
6473 /// the request. This method supports PATCH
6474 /// semantics and usesJSON merge
6475 /// patch format and processing rules.
6476 pub fn patch(&self) -> super::builder::interconnect_groups::Patch {
6477 super::builder::interconnect_groups::Patch::new(self.inner.clone())
6478 }
6479
6480 /// Sets the access control policy on the specified resource.
6481 /// Replaces any existing policy.
6482 pub fn set_iam_policy(&self) -> super::builder::interconnect_groups::SetIamPolicy {
6483 super::builder::interconnect_groups::SetIamPolicy::new(self.inner.clone())
6484 }
6485
6486 /// Returns permissions that a caller has on the specified resource.
6487 pub fn test_iam_permissions(&self) -> super::builder::interconnect_groups::TestIamPermissions {
6488 super::builder::interconnect_groups::TestIamPermissions::new(self.inner.clone())
6489 }
6490
6491 /// Retrieves the specified Operations resource.
6492 pub fn get_operation(&self) -> super::builder::interconnect_groups::GetOperation {
6493 super::builder::interconnect_groups::GetOperation::new(self.inner.clone())
6494 }
6495}
6496
6497/// Implements a client for the Google Compute Engine API.
6498///
6499/// # Example
6500/// ```
6501/// # use google_cloud_compute_v1::client::InterconnectLocations;
6502/// async fn sample(
6503/// ) -> anyhow::Result<()> {
6504/// let client = InterconnectLocations::builder().build().await?;
6505/// // use `client` to make requests to the Google Compute Engine API.
6506/// Ok(())
6507/// }
6508/// ```
6509///
6510/// # Service Description
6511///
6512/// Service for the `interconnectLocations` resource.
6513///
6514/// # Configuration
6515///
6516/// To configure `InterconnectLocations` use the `with_*` methods in the type returned
6517/// by [builder()][InterconnectLocations::builder]. The default configuration should
6518/// work for most applications. Common configuration changes include
6519///
6520/// * [with_endpoint()]: by default this client uses the global default endpoint
6521/// (`https://compute.googleapis.com`). Applications using regional
6522/// endpoints or running in restricted networks (e.g. a network configured
6523/// with [Private Google Access with VPC Service Controls]) may want to
6524/// override this default.
6525/// * [with_credentials()]: by default this client uses
6526/// [Application Default Credentials]. Applications using custom
6527/// authentication may need to override this default.
6528///
6529/// [with_endpoint()]: super::builder::interconnect_locations::ClientBuilder::with_endpoint
6530/// [with_credentials()]: super::builder::interconnect_locations::ClientBuilder::with_credentials
6531/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6532/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6533///
6534/// # Pooling and Cloning
6535///
6536/// `InterconnectLocations` holds a connection pool internally, it is advised to
6537/// create one and reuse it. You do not need to wrap `InterconnectLocations` in
6538/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6539/// already uses an `Arc` internally.
6540#[cfg(feature = "interconnect-locations")]
6541#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-locations")))]
6542#[derive(Clone, Debug)]
6543pub struct InterconnectLocations {
6544 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectLocations>,
6545}
6546
6547#[cfg(feature = "interconnect-locations")]
6548impl InterconnectLocations {
6549 /// Returns a builder for [InterconnectLocations].
6550 ///
6551 /// ```
6552 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6553 /// # use google_cloud_compute_v1::client::InterconnectLocations;
6554 /// let client = InterconnectLocations::builder().build().await?;
6555 /// # Ok(()) }
6556 /// ```
6557 pub fn builder() -> super::builder::interconnect_locations::ClientBuilder {
6558 crate::new_client_builder(super::builder::interconnect_locations::client::Factory)
6559 }
6560
6561 /// Creates a new client from the provided stub.
6562 ///
6563 /// The most common case for calling this function is in tests mocking the
6564 /// client's behavior.
6565 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6566 where
6567 T: super::stub::InterconnectLocations + 'static,
6568 {
6569 Self { inner: stub.into() }
6570 }
6571
6572 pub(crate) async fn new(
6573 config: gaxi::options::ClientConfig,
6574 ) -> crate::ClientBuilderResult<Self> {
6575 let inner = Self::build_inner(config).await?;
6576 Ok(Self { inner })
6577 }
6578
6579 async fn build_inner(
6580 conf: gaxi::options::ClientConfig,
6581 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::InterconnectLocations>>
6582 {
6583 if gaxi::options::tracing_enabled(&conf) {
6584 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6585 }
6586 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6587 }
6588
6589 async fn build_transport(
6590 conf: gaxi::options::ClientConfig,
6591 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectLocations> {
6592 super::transport::InterconnectLocations::new(conf).await
6593 }
6594
6595 async fn build_with_tracing(
6596 conf: gaxi::options::ClientConfig,
6597 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectLocations> {
6598 Self::build_transport(conf)
6599 .await
6600 .map(super::tracing::InterconnectLocations::new)
6601 }
6602
6603 /// Returns the details for the specified interconnect location. Gets a list of
6604 /// available interconnect locations by making a list() request.
6605 pub fn get(&self) -> super::builder::interconnect_locations::Get {
6606 super::builder::interconnect_locations::Get::new(self.inner.clone())
6607 }
6608
6609 /// Retrieves the list of interconnect locations available to the specified
6610 /// project.
6611 pub fn list(&self) -> super::builder::interconnect_locations::List {
6612 super::builder::interconnect_locations::List::new(self.inner.clone())
6613 }
6614}
6615
6616/// Implements a client for the Google Compute Engine API.
6617///
6618/// # Example
6619/// ```
6620/// # use google_cloud_compute_v1::client::InterconnectRemoteLocations;
6621/// async fn sample(
6622/// ) -> anyhow::Result<()> {
6623/// let client = InterconnectRemoteLocations::builder().build().await?;
6624/// // use `client` to make requests to the Google Compute Engine API.
6625/// Ok(())
6626/// }
6627/// ```
6628///
6629/// # Service Description
6630///
6631/// Service for the `interconnectRemoteLocations` resource.
6632///
6633/// # Configuration
6634///
6635/// To configure `InterconnectRemoteLocations` use the `with_*` methods in the type returned
6636/// by [builder()][InterconnectRemoteLocations::builder]. The default configuration should
6637/// work for most applications. Common configuration changes include
6638///
6639/// * [with_endpoint()]: by default this client uses the global default endpoint
6640/// (`https://compute.googleapis.com`). Applications using regional
6641/// endpoints or running in restricted networks (e.g. a network configured
6642/// with [Private Google Access with VPC Service Controls]) may want to
6643/// override this default.
6644/// * [with_credentials()]: by default this client uses
6645/// [Application Default Credentials]. Applications using custom
6646/// authentication may need to override this default.
6647///
6648/// [with_endpoint()]: super::builder::interconnect_remote_locations::ClientBuilder::with_endpoint
6649/// [with_credentials()]: super::builder::interconnect_remote_locations::ClientBuilder::with_credentials
6650/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6651/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6652///
6653/// # Pooling and Cloning
6654///
6655/// `InterconnectRemoteLocations` holds a connection pool internally, it is advised to
6656/// create one and reuse it. You do not need to wrap `InterconnectRemoteLocations` in
6657/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6658/// already uses an `Arc` internally.
6659#[cfg(feature = "interconnect-remote-locations")]
6660#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-remote-locations")))]
6661#[derive(Clone, Debug)]
6662pub struct InterconnectRemoteLocations {
6663 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectRemoteLocations>,
6664}
6665
6666#[cfg(feature = "interconnect-remote-locations")]
6667impl InterconnectRemoteLocations {
6668 /// Returns a builder for [InterconnectRemoteLocations].
6669 ///
6670 /// ```
6671 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6672 /// # use google_cloud_compute_v1::client::InterconnectRemoteLocations;
6673 /// let client = InterconnectRemoteLocations::builder().build().await?;
6674 /// # Ok(()) }
6675 /// ```
6676 pub fn builder() -> super::builder::interconnect_remote_locations::ClientBuilder {
6677 crate::new_client_builder(super::builder::interconnect_remote_locations::client::Factory)
6678 }
6679
6680 /// Creates a new client from the provided stub.
6681 ///
6682 /// The most common case for calling this function is in tests mocking the
6683 /// client's behavior.
6684 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6685 where
6686 T: super::stub::InterconnectRemoteLocations + 'static,
6687 {
6688 Self { inner: stub.into() }
6689 }
6690
6691 pub(crate) async fn new(
6692 config: gaxi::options::ClientConfig,
6693 ) -> crate::ClientBuilderResult<Self> {
6694 let inner = Self::build_inner(config).await?;
6695 Ok(Self { inner })
6696 }
6697
6698 async fn build_inner(
6699 conf: gaxi::options::ClientConfig,
6700 ) -> crate::ClientBuilderResult<
6701 std::sync::Arc<dyn super::stub::dynamic::InterconnectRemoteLocations>,
6702 > {
6703 if gaxi::options::tracing_enabled(&conf) {
6704 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6705 }
6706 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6707 }
6708
6709 async fn build_transport(
6710 conf: gaxi::options::ClientConfig,
6711 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectRemoteLocations> {
6712 super::transport::InterconnectRemoteLocations::new(conf).await
6713 }
6714
6715 async fn build_with_tracing(
6716 conf: gaxi::options::ClientConfig,
6717 ) -> crate::ClientBuilderResult<impl super::stub::InterconnectRemoteLocations> {
6718 Self::build_transport(conf)
6719 .await
6720 .map(super::tracing::InterconnectRemoteLocations::new)
6721 }
6722
6723 /// Returns the details for the specified interconnect remote location. Gets a
6724 /// list of available interconnect remote locations by making alist() request.
6725 pub fn get(&self) -> super::builder::interconnect_remote_locations::Get {
6726 super::builder::interconnect_remote_locations::Get::new(self.inner.clone())
6727 }
6728
6729 /// Retrieves the list of interconnect remote locations available to the
6730 /// specified project.
6731 pub fn list(&self) -> super::builder::interconnect_remote_locations::List {
6732 super::builder::interconnect_remote_locations::List::new(self.inner.clone())
6733 }
6734}
6735
6736/// Implements a client for the Google Compute Engine API.
6737///
6738/// # Example
6739/// ```
6740/// # use google_cloud_compute_v1::client::Interconnects;
6741/// async fn sample(
6742/// ) -> anyhow::Result<()> {
6743/// let client = Interconnects::builder().build().await?;
6744/// // use `client` to make requests to the Google Compute Engine API.
6745/// Ok(())
6746/// }
6747/// ```
6748///
6749/// # Service Description
6750///
6751/// Service for the `interconnects` resource.
6752///
6753/// # Configuration
6754///
6755/// To configure `Interconnects` use the `with_*` methods in the type returned
6756/// by [builder()][Interconnects::builder]. The default configuration should
6757/// work for most applications. Common configuration changes include
6758///
6759/// * [with_endpoint()]: by default this client uses the global default endpoint
6760/// (`https://compute.googleapis.com`). Applications using regional
6761/// endpoints or running in restricted networks (e.g. a network configured
6762/// with [Private Google Access with VPC Service Controls]) may want to
6763/// override this default.
6764/// * [with_credentials()]: by default this client uses
6765/// [Application Default Credentials]. Applications using custom
6766/// authentication may need to override this default.
6767///
6768/// [with_endpoint()]: super::builder::interconnects::ClientBuilder::with_endpoint
6769/// [with_credentials()]: super::builder::interconnects::ClientBuilder::with_credentials
6770/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6771/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6772///
6773/// # Pooling and Cloning
6774///
6775/// `Interconnects` holds a connection pool internally, it is advised to
6776/// create one and reuse it. You do not need to wrap `Interconnects` in
6777/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6778/// already uses an `Arc` internally.
6779#[cfg(feature = "interconnects")]
6780#[cfg_attr(docsrs, doc(cfg(feature = "interconnects")))]
6781#[derive(Clone, Debug)]
6782pub struct Interconnects {
6783 inner: std::sync::Arc<dyn super::stub::dynamic::Interconnects>,
6784}
6785
6786#[cfg(feature = "interconnects")]
6787impl Interconnects {
6788 /// Returns a builder for [Interconnects].
6789 ///
6790 /// ```
6791 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6792 /// # use google_cloud_compute_v1::client::Interconnects;
6793 /// let client = Interconnects::builder().build().await?;
6794 /// # Ok(()) }
6795 /// ```
6796 pub fn builder() -> super::builder::interconnects::ClientBuilder {
6797 crate::new_client_builder(super::builder::interconnects::client::Factory)
6798 }
6799
6800 /// Creates a new client from the provided stub.
6801 ///
6802 /// The most common case for calling this function is in tests mocking the
6803 /// client's behavior.
6804 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6805 where
6806 T: super::stub::Interconnects + 'static,
6807 {
6808 Self { inner: stub.into() }
6809 }
6810
6811 pub(crate) async fn new(
6812 config: gaxi::options::ClientConfig,
6813 ) -> crate::ClientBuilderResult<Self> {
6814 let inner = Self::build_inner(config).await?;
6815 Ok(Self { inner })
6816 }
6817
6818 async fn build_inner(
6819 conf: gaxi::options::ClientConfig,
6820 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Interconnects>> {
6821 if gaxi::options::tracing_enabled(&conf) {
6822 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6823 }
6824 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6825 }
6826
6827 async fn build_transport(
6828 conf: gaxi::options::ClientConfig,
6829 ) -> crate::ClientBuilderResult<impl super::stub::Interconnects> {
6830 super::transport::Interconnects::new(conf).await
6831 }
6832
6833 async fn build_with_tracing(
6834 conf: gaxi::options::ClientConfig,
6835 ) -> crate::ClientBuilderResult<impl super::stub::Interconnects> {
6836 Self::build_transport(conf)
6837 .await
6838 .map(super::tracing::Interconnects::new)
6839 }
6840
6841 /// Deletes the specified Interconnect.
6842 pub fn delete(&self) -> super::builder::interconnects::Delete {
6843 super::builder::interconnects::Delete::new(self.inner.clone())
6844 }
6845
6846 /// Returns the specified Interconnect. Get a list of available Interconnects
6847 /// by making a list() request.
6848 pub fn get(&self) -> super::builder::interconnects::Get {
6849 super::builder::interconnects::Get::new(self.inner.clone())
6850 }
6851
6852 /// Returns the interconnectDiagnostics for the specified
6853 /// Interconnect.
6854 ///
6855 /// In the event of a
6856 /// global outage, do not use this API to make decisions about where to
6857 /// redirect your network traffic.
6858 ///
6859 /// Unlike a VLAN attachment, which is regional, a Cloud Interconnect
6860 /// connection is a global resource. A global outage can prevent this
6861 /// API from functioning properly.
6862 pub fn get_diagnostics(&self) -> super::builder::interconnects::GetDiagnostics {
6863 super::builder::interconnects::GetDiagnostics::new(self.inner.clone())
6864 }
6865
6866 /// Returns the interconnectMacsecConfig for the specified
6867 /// Interconnect.
6868 pub fn get_macsec_config(&self) -> super::builder::interconnects::GetMacsecConfig {
6869 super::builder::interconnects::GetMacsecConfig::new(self.inner.clone())
6870 }
6871
6872 /// Creates an Interconnect in the specified project using
6873 /// the data included in the request.
6874 pub fn insert(&self) -> super::builder::interconnects::Insert {
6875 super::builder::interconnects::Insert::new(self.inner.clone())
6876 }
6877
6878 /// Retrieves the list of Interconnects available to the specified project.
6879 pub fn list(&self) -> super::builder::interconnects::List {
6880 super::builder::interconnects::List::new(self.inner.clone())
6881 }
6882
6883 /// Updates the specified Interconnect with the data included in the request.
6884 /// This method supportsPATCH
6885 /// semantics and uses theJSON merge
6886 /// patch format and processing rules.
6887 pub fn patch(&self) -> super::builder::interconnects::Patch {
6888 super::builder::interconnects::Patch::new(self.inner.clone())
6889 }
6890
6891 /// Sets the labels on an Interconnect. To learn more about labels,
6892 /// read the Labeling
6893 /// Resources documentation.
6894 pub fn set_labels(&self) -> super::builder::interconnects::SetLabels {
6895 super::builder::interconnects::SetLabels::new(self.inner.clone())
6896 }
6897
6898 /// Retrieves the specified Operations resource.
6899 pub fn get_operation(&self) -> super::builder::interconnects::GetOperation {
6900 super::builder::interconnects::GetOperation::new(self.inner.clone())
6901 }
6902}
6903
6904/// Implements a client for the Google Compute Engine API.
6905///
6906/// # Example
6907/// ```
6908/// # use google_cloud_compute_v1::client::LicenseCodes;
6909/// async fn sample(
6910/// ) -> anyhow::Result<()> {
6911/// let client = LicenseCodes::builder().build().await?;
6912/// // use `client` to make requests to the Google Compute Engine API.
6913/// Ok(())
6914/// }
6915/// ```
6916///
6917/// # Service Description
6918///
6919/// Service for the `licenseCodes` resource.
6920///
6921/// # Configuration
6922///
6923/// To configure `LicenseCodes` use the `with_*` methods in the type returned
6924/// by [builder()][LicenseCodes::builder]. The default configuration should
6925/// work for most applications. Common configuration changes include
6926///
6927/// * [with_endpoint()]: by default this client uses the global default endpoint
6928/// (`https://compute.googleapis.com`). Applications using regional
6929/// endpoints or running in restricted networks (e.g. a network configured
6930/// with [Private Google Access with VPC Service Controls]) may want to
6931/// override this default.
6932/// * [with_credentials()]: by default this client uses
6933/// [Application Default Credentials]. Applications using custom
6934/// authentication may need to override this default.
6935///
6936/// [with_endpoint()]: super::builder::license_codes::ClientBuilder::with_endpoint
6937/// [with_credentials()]: super::builder::license_codes::ClientBuilder::with_credentials
6938/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6939/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6940///
6941/// # Pooling and Cloning
6942///
6943/// `LicenseCodes` holds a connection pool internally, it is advised to
6944/// create one and reuse it. You do not need to wrap `LicenseCodes` in
6945/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6946/// already uses an `Arc` internally.
6947#[cfg(feature = "license-codes")]
6948#[cfg_attr(docsrs, doc(cfg(feature = "license-codes")))]
6949#[derive(Clone, Debug)]
6950pub struct LicenseCodes {
6951 inner: std::sync::Arc<dyn super::stub::dynamic::LicenseCodes>,
6952}
6953
6954#[cfg(feature = "license-codes")]
6955impl LicenseCodes {
6956 /// Returns a builder for [LicenseCodes].
6957 ///
6958 /// ```
6959 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
6960 /// # use google_cloud_compute_v1::client::LicenseCodes;
6961 /// let client = LicenseCodes::builder().build().await?;
6962 /// # Ok(()) }
6963 /// ```
6964 pub fn builder() -> super::builder::license_codes::ClientBuilder {
6965 crate::new_client_builder(super::builder::license_codes::client::Factory)
6966 }
6967
6968 /// Creates a new client from the provided stub.
6969 ///
6970 /// The most common case for calling this function is in tests mocking the
6971 /// client's behavior.
6972 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
6973 where
6974 T: super::stub::LicenseCodes + 'static,
6975 {
6976 Self { inner: stub.into() }
6977 }
6978
6979 pub(crate) async fn new(
6980 config: gaxi::options::ClientConfig,
6981 ) -> crate::ClientBuilderResult<Self> {
6982 let inner = Self::build_inner(config).await?;
6983 Ok(Self { inner })
6984 }
6985
6986 async fn build_inner(
6987 conf: gaxi::options::ClientConfig,
6988 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::LicenseCodes>> {
6989 if gaxi::options::tracing_enabled(&conf) {
6990 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6991 }
6992 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6993 }
6994
6995 async fn build_transport(
6996 conf: gaxi::options::ClientConfig,
6997 ) -> crate::ClientBuilderResult<impl super::stub::LicenseCodes> {
6998 super::transport::LicenseCodes::new(conf).await
6999 }
7000
7001 async fn build_with_tracing(
7002 conf: gaxi::options::ClientConfig,
7003 ) -> crate::ClientBuilderResult<impl super::stub::LicenseCodes> {
7004 Self::build_transport(conf)
7005 .await
7006 .map(super::tracing::LicenseCodes::new)
7007 }
7008
7009 /// Return a specified license code. License codes are mirrored across
7010 /// all projects that have permissions to read the License Code.
7011 /// *Caution* This resource is intended
7012 /// for use only by third-party partners who are creatingCloud Marketplace
7013 /// images.
7014 pub fn get(&self) -> super::builder::license_codes::Get {
7015 super::builder::license_codes::Get::new(self.inner.clone())
7016 }
7017
7018 /// Gets the access control policy for a resource. May be empty if no such
7019 /// policy or resource exists.
7020 /// *Caution* This resource is intended
7021 /// for use only by third-party partners who are creatingCloud Marketplace
7022 /// images.
7023 pub fn get_iam_policy(&self) -> super::builder::license_codes::GetIamPolicy {
7024 super::builder::license_codes::GetIamPolicy::new(self.inner.clone())
7025 }
7026
7027 /// Sets the access control policy on the specified resource.
7028 /// Replaces any existing policy.
7029 /// *Caution* This resource is intended
7030 /// for use only by third-party partners who are creatingCloud Marketplace
7031 /// images.
7032 pub fn set_iam_policy(&self) -> super::builder::license_codes::SetIamPolicy {
7033 super::builder::license_codes::SetIamPolicy::new(self.inner.clone())
7034 }
7035
7036 /// Returns permissions that a caller has on the specified resource.
7037 /// *Caution* This resource is intended
7038 /// for use only by third-party partners who are creatingCloud Marketplace
7039 /// images.
7040 pub fn test_iam_permissions(&self) -> super::builder::license_codes::TestIamPermissions {
7041 super::builder::license_codes::TestIamPermissions::new(self.inner.clone())
7042 }
7043}
7044
7045/// Implements a client for the Google Compute Engine API.
7046///
7047/// # Example
7048/// ```
7049/// # use google_cloud_compute_v1::client::Licenses;
7050/// async fn sample(
7051/// ) -> anyhow::Result<()> {
7052/// let client = Licenses::builder().build().await?;
7053/// // use `client` to make requests to the Google Compute Engine API.
7054/// Ok(())
7055/// }
7056/// ```
7057///
7058/// # Service Description
7059///
7060/// Service for the `licenses` resource.
7061///
7062/// # Configuration
7063///
7064/// To configure `Licenses` use the `with_*` methods in the type returned
7065/// by [builder()][Licenses::builder]. The default configuration should
7066/// work for most applications. Common configuration changes include
7067///
7068/// * [with_endpoint()]: by default this client uses the global default endpoint
7069/// (`https://compute.googleapis.com`). Applications using regional
7070/// endpoints or running in restricted networks (e.g. a network configured
7071/// with [Private Google Access with VPC Service Controls]) may want to
7072/// override this default.
7073/// * [with_credentials()]: by default this client uses
7074/// [Application Default Credentials]. Applications using custom
7075/// authentication may need to override this default.
7076///
7077/// [with_endpoint()]: super::builder::licenses::ClientBuilder::with_endpoint
7078/// [with_credentials()]: super::builder::licenses::ClientBuilder::with_credentials
7079/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7080/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7081///
7082/// # Pooling and Cloning
7083///
7084/// `Licenses` holds a connection pool internally, it is advised to
7085/// create one and reuse it. You do not need to wrap `Licenses` in
7086/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7087/// already uses an `Arc` internally.
7088#[cfg(feature = "licenses")]
7089#[cfg_attr(docsrs, doc(cfg(feature = "licenses")))]
7090#[derive(Clone, Debug)]
7091pub struct Licenses {
7092 inner: std::sync::Arc<dyn super::stub::dynamic::Licenses>,
7093}
7094
7095#[cfg(feature = "licenses")]
7096impl Licenses {
7097 /// Returns a builder for [Licenses].
7098 ///
7099 /// ```
7100 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7101 /// # use google_cloud_compute_v1::client::Licenses;
7102 /// let client = Licenses::builder().build().await?;
7103 /// # Ok(()) }
7104 /// ```
7105 pub fn builder() -> super::builder::licenses::ClientBuilder {
7106 crate::new_client_builder(super::builder::licenses::client::Factory)
7107 }
7108
7109 /// Creates a new client from the provided stub.
7110 ///
7111 /// The most common case for calling this function is in tests mocking the
7112 /// client's behavior.
7113 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7114 where
7115 T: super::stub::Licenses + 'static,
7116 {
7117 Self { inner: stub.into() }
7118 }
7119
7120 pub(crate) async fn new(
7121 config: gaxi::options::ClientConfig,
7122 ) -> crate::ClientBuilderResult<Self> {
7123 let inner = Self::build_inner(config).await?;
7124 Ok(Self { inner })
7125 }
7126
7127 async fn build_inner(
7128 conf: gaxi::options::ClientConfig,
7129 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Licenses>> {
7130 if gaxi::options::tracing_enabled(&conf) {
7131 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7132 }
7133 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7134 }
7135
7136 async fn build_transport(
7137 conf: gaxi::options::ClientConfig,
7138 ) -> crate::ClientBuilderResult<impl super::stub::Licenses> {
7139 super::transport::Licenses::new(conf).await
7140 }
7141
7142 async fn build_with_tracing(
7143 conf: gaxi::options::ClientConfig,
7144 ) -> crate::ClientBuilderResult<impl super::stub::Licenses> {
7145 Self::build_transport(conf)
7146 .await
7147 .map(super::tracing::Licenses::new)
7148 }
7149
7150 /// Deletes the specified license.
7151 /// *Caution* This resource is intended
7152 /// for use only by third-party partners who are creatingCloud Marketplace
7153 /// images.
7154 pub fn delete(&self) -> super::builder::licenses::Delete {
7155 super::builder::licenses::Delete::new(self.inner.clone())
7156 }
7157
7158 /// Returns the specified License resource.
7159 /// *Caution* This resource is intended
7160 /// for use only by third-party partners who are creatingCloud Marketplace
7161 /// images.
7162 pub fn get(&self) -> super::builder::licenses::Get {
7163 super::builder::licenses::Get::new(self.inner.clone())
7164 }
7165
7166 /// Gets the access control policy for a resource. May be empty if no such
7167 /// policy or resource exists.
7168 /// *Caution* This resource is intended
7169 /// for use only by third-party partners who are creatingCloud Marketplace
7170 /// images.
7171 pub fn get_iam_policy(&self) -> super::builder::licenses::GetIamPolicy {
7172 super::builder::licenses::GetIamPolicy::new(self.inner.clone())
7173 }
7174
7175 /// Create a License resource in the specified project.
7176 /// *Caution* This resource is intended
7177 /// for use only by third-party partners who are creatingCloud Marketplace
7178 /// images.
7179 pub fn insert(&self) -> super::builder::licenses::Insert {
7180 super::builder::licenses::Insert::new(self.inner.clone())
7181 }
7182
7183 /// Retrieves the list of licenses
7184 /// available in the specified project. This method does not
7185 /// get any licenses that belong to other projects, including licenses attached
7186 /// to publicly-available images, like Debian 9. If you want to get a list of
7187 /// publicly-available licenses, use this method to make a request to the
7188 /// respective image project, such as debian-cloud orwindows-cloud.
7189 /// *Caution* This resource is intended
7190 /// for use only by third-party partners who are creatingCloud Marketplace
7191 /// images.
7192 pub fn list(&self) -> super::builder::licenses::List {
7193 super::builder::licenses::List::new(self.inner.clone())
7194 }
7195
7196 /// Sets the access control policy on the specified resource.
7197 /// Replaces any existing policy.
7198 /// *Caution* This resource is intended
7199 /// for use only by third-party partners who are creatingCloud Marketplace
7200 /// images.
7201 pub fn set_iam_policy(&self) -> super::builder::licenses::SetIamPolicy {
7202 super::builder::licenses::SetIamPolicy::new(self.inner.clone())
7203 }
7204
7205 /// Returns permissions that a caller has on the specified resource.
7206 /// *Caution* This resource is intended
7207 /// for use only by third-party partners who are creatingCloud Marketplace
7208 /// images.
7209 pub fn test_iam_permissions(&self) -> super::builder::licenses::TestIamPermissions {
7210 super::builder::licenses::TestIamPermissions::new(self.inner.clone())
7211 }
7212
7213 /// Updates a License resource in the specified project.
7214 /// *Caution* This resource is intended
7215 /// for use only by third-party partners who are creatingCloud Marketplace
7216 /// images.
7217 pub fn update(&self) -> super::builder::licenses::Update {
7218 super::builder::licenses::Update::new(self.inner.clone())
7219 }
7220
7221 /// Retrieves the specified Operations resource.
7222 pub fn get_operation(&self) -> super::builder::licenses::GetOperation {
7223 super::builder::licenses::GetOperation::new(self.inner.clone())
7224 }
7225}
7226
7227/// Implements a client for the Google Compute Engine API.
7228///
7229/// # Example
7230/// ```
7231/// # use google_cloud_compute_v1::client::MachineImages;
7232/// async fn sample(
7233/// ) -> anyhow::Result<()> {
7234/// let client = MachineImages::builder().build().await?;
7235/// // use `client` to make requests to the Google Compute Engine API.
7236/// Ok(())
7237/// }
7238/// ```
7239///
7240/// # Service Description
7241///
7242/// Service for the `machineImages` resource.
7243///
7244/// # Configuration
7245///
7246/// To configure `MachineImages` use the `with_*` methods in the type returned
7247/// by [builder()][MachineImages::builder]. The default configuration should
7248/// work for most applications. Common configuration changes include
7249///
7250/// * [with_endpoint()]: by default this client uses the global default endpoint
7251/// (`https://compute.googleapis.com`). Applications using regional
7252/// endpoints or running in restricted networks (e.g. a network configured
7253/// with [Private Google Access with VPC Service Controls]) may want to
7254/// override this default.
7255/// * [with_credentials()]: by default this client uses
7256/// [Application Default Credentials]. Applications using custom
7257/// authentication may need to override this default.
7258///
7259/// [with_endpoint()]: super::builder::machine_images::ClientBuilder::with_endpoint
7260/// [with_credentials()]: super::builder::machine_images::ClientBuilder::with_credentials
7261/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7262/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7263///
7264/// # Pooling and Cloning
7265///
7266/// `MachineImages` holds a connection pool internally, it is advised to
7267/// create one and reuse it. You do not need to wrap `MachineImages` in
7268/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7269/// already uses an `Arc` internally.
7270#[cfg(feature = "machine-images")]
7271#[cfg_attr(docsrs, doc(cfg(feature = "machine-images")))]
7272#[derive(Clone, Debug)]
7273pub struct MachineImages {
7274 inner: std::sync::Arc<dyn super::stub::dynamic::MachineImages>,
7275}
7276
7277#[cfg(feature = "machine-images")]
7278impl MachineImages {
7279 /// Returns a builder for [MachineImages].
7280 ///
7281 /// ```
7282 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7283 /// # use google_cloud_compute_v1::client::MachineImages;
7284 /// let client = MachineImages::builder().build().await?;
7285 /// # Ok(()) }
7286 /// ```
7287 pub fn builder() -> super::builder::machine_images::ClientBuilder {
7288 crate::new_client_builder(super::builder::machine_images::client::Factory)
7289 }
7290
7291 /// Creates a new client from the provided stub.
7292 ///
7293 /// The most common case for calling this function is in tests mocking the
7294 /// client's behavior.
7295 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7296 where
7297 T: super::stub::MachineImages + 'static,
7298 {
7299 Self { inner: stub.into() }
7300 }
7301
7302 pub(crate) async fn new(
7303 config: gaxi::options::ClientConfig,
7304 ) -> crate::ClientBuilderResult<Self> {
7305 let inner = Self::build_inner(config).await?;
7306 Ok(Self { inner })
7307 }
7308
7309 async fn build_inner(
7310 conf: gaxi::options::ClientConfig,
7311 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MachineImages>> {
7312 if gaxi::options::tracing_enabled(&conf) {
7313 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7314 }
7315 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7316 }
7317
7318 async fn build_transport(
7319 conf: gaxi::options::ClientConfig,
7320 ) -> crate::ClientBuilderResult<impl super::stub::MachineImages> {
7321 super::transport::MachineImages::new(conf).await
7322 }
7323
7324 async fn build_with_tracing(
7325 conf: gaxi::options::ClientConfig,
7326 ) -> crate::ClientBuilderResult<impl super::stub::MachineImages> {
7327 Self::build_transport(conf)
7328 .await
7329 .map(super::tracing::MachineImages::new)
7330 }
7331
7332 /// Deletes the specified machine image. Deleting a machine image is permanent
7333 /// and cannot be undone.
7334 pub fn delete(&self) -> super::builder::machine_images::Delete {
7335 super::builder::machine_images::Delete::new(self.inner.clone())
7336 }
7337
7338 /// Returns the specified machine image.
7339 pub fn get(&self) -> super::builder::machine_images::Get {
7340 super::builder::machine_images::Get::new(self.inner.clone())
7341 }
7342
7343 /// Gets the access control policy for a resource. May be empty if no such
7344 /// policy or resource exists.
7345 pub fn get_iam_policy(&self) -> super::builder::machine_images::GetIamPolicy {
7346 super::builder::machine_images::GetIamPolicy::new(self.inner.clone())
7347 }
7348
7349 /// Creates a machine image in the specified project using the
7350 /// data that is included in the request. If you are creating a new machine
7351 /// image to update an existing instance, your new machine image should use the
7352 /// same network or, if applicable, the same subnetwork as the original
7353 /// instance.
7354 pub fn insert(&self) -> super::builder::machine_images::Insert {
7355 super::builder::machine_images::Insert::new(self.inner.clone())
7356 }
7357
7358 /// Retrieves a list of machine images that are contained within
7359 /// the specified project.
7360 pub fn list(&self) -> super::builder::machine_images::List {
7361 super::builder::machine_images::List::new(self.inner.clone())
7362 }
7363
7364 /// Sets the access control policy on the specified resource.
7365 /// Replaces any existing policy.
7366 pub fn set_iam_policy(&self) -> super::builder::machine_images::SetIamPolicy {
7367 super::builder::machine_images::SetIamPolicy::new(self.inner.clone())
7368 }
7369
7370 /// Sets the labels on a machine image. To learn more about labels, read theLabeling
7371 /// Resources documentation.
7372 pub fn set_labels(&self) -> super::builder::machine_images::SetLabels {
7373 super::builder::machine_images::SetLabels::new(self.inner.clone())
7374 }
7375
7376 /// Returns permissions that a caller has on the specified resource.
7377 pub fn test_iam_permissions(&self) -> super::builder::machine_images::TestIamPermissions {
7378 super::builder::machine_images::TestIamPermissions::new(self.inner.clone())
7379 }
7380
7381 /// Retrieves the specified Operations resource.
7382 pub fn get_operation(&self) -> super::builder::machine_images::GetOperation {
7383 super::builder::machine_images::GetOperation::new(self.inner.clone())
7384 }
7385}
7386
7387/// Implements a client for the Google Compute Engine API.
7388///
7389/// # Example
7390/// ```
7391/// # use google_cloud_compute_v1::client::MachineTypes;
7392/// async fn sample(
7393/// ) -> anyhow::Result<()> {
7394/// let client = MachineTypes::builder().build().await?;
7395/// // use `client` to make requests to the Google Compute Engine API.
7396/// Ok(())
7397/// }
7398/// ```
7399///
7400/// # Service Description
7401///
7402/// Service for the `machineTypes` resource.
7403///
7404/// # Configuration
7405///
7406/// To configure `MachineTypes` use the `with_*` methods in the type returned
7407/// by [builder()][MachineTypes::builder]. The default configuration should
7408/// work for most applications. Common configuration changes include
7409///
7410/// * [with_endpoint()]: by default this client uses the global default endpoint
7411/// (`https://compute.googleapis.com`). Applications using regional
7412/// endpoints or running in restricted networks (e.g. a network configured
7413/// with [Private Google Access with VPC Service Controls]) may want to
7414/// override this default.
7415/// * [with_credentials()]: by default this client uses
7416/// [Application Default Credentials]. Applications using custom
7417/// authentication may need to override this default.
7418///
7419/// [with_endpoint()]: super::builder::machine_types::ClientBuilder::with_endpoint
7420/// [with_credentials()]: super::builder::machine_types::ClientBuilder::with_credentials
7421/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7422/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7423///
7424/// # Pooling and Cloning
7425///
7426/// `MachineTypes` holds a connection pool internally, it is advised to
7427/// create one and reuse it. You do not need to wrap `MachineTypes` in
7428/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7429/// already uses an `Arc` internally.
7430#[cfg(feature = "machine-types")]
7431#[cfg_attr(docsrs, doc(cfg(feature = "machine-types")))]
7432#[derive(Clone, Debug)]
7433pub struct MachineTypes {
7434 inner: std::sync::Arc<dyn super::stub::dynamic::MachineTypes>,
7435}
7436
7437#[cfg(feature = "machine-types")]
7438impl MachineTypes {
7439 /// Returns a builder for [MachineTypes].
7440 ///
7441 /// ```
7442 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7443 /// # use google_cloud_compute_v1::client::MachineTypes;
7444 /// let client = MachineTypes::builder().build().await?;
7445 /// # Ok(()) }
7446 /// ```
7447 pub fn builder() -> super::builder::machine_types::ClientBuilder {
7448 crate::new_client_builder(super::builder::machine_types::client::Factory)
7449 }
7450
7451 /// Creates a new client from the provided stub.
7452 ///
7453 /// The most common case for calling this function is in tests mocking the
7454 /// client's behavior.
7455 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7456 where
7457 T: super::stub::MachineTypes + 'static,
7458 {
7459 Self { inner: stub.into() }
7460 }
7461
7462 pub(crate) async fn new(
7463 config: gaxi::options::ClientConfig,
7464 ) -> crate::ClientBuilderResult<Self> {
7465 let inner = Self::build_inner(config).await?;
7466 Ok(Self { inner })
7467 }
7468
7469 async fn build_inner(
7470 conf: gaxi::options::ClientConfig,
7471 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::MachineTypes>> {
7472 if gaxi::options::tracing_enabled(&conf) {
7473 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7474 }
7475 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7476 }
7477
7478 async fn build_transport(
7479 conf: gaxi::options::ClientConfig,
7480 ) -> crate::ClientBuilderResult<impl super::stub::MachineTypes> {
7481 super::transport::MachineTypes::new(conf).await
7482 }
7483
7484 async fn build_with_tracing(
7485 conf: gaxi::options::ClientConfig,
7486 ) -> crate::ClientBuilderResult<impl super::stub::MachineTypes> {
7487 Self::build_transport(conf)
7488 .await
7489 .map(super::tracing::MachineTypes::new)
7490 }
7491
7492 /// Retrieves an aggregated list of machine types.
7493 ///
7494 /// To prevent failure, Google recommends that you set the
7495 /// `returnPartialSuccess` parameter to `true`.
7496 pub fn aggregated_list(&self) -> super::builder::machine_types::AggregatedList {
7497 super::builder::machine_types::AggregatedList::new(self.inner.clone())
7498 }
7499
7500 /// Returns the specified machine type.
7501 pub fn get(&self) -> super::builder::machine_types::Get {
7502 super::builder::machine_types::Get::new(self.inner.clone())
7503 }
7504
7505 /// Retrieves a list of machine types available to the specified
7506 /// project.
7507 pub fn list(&self) -> super::builder::machine_types::List {
7508 super::builder::machine_types::List::new(self.inner.clone())
7509 }
7510}
7511
7512/// Implements a client for the Google Compute Engine API.
7513///
7514/// # Example
7515/// ```
7516/// # use google_cloud_compute_v1::client::NetworkAttachments;
7517/// async fn sample(
7518/// ) -> anyhow::Result<()> {
7519/// let client = NetworkAttachments::builder().build().await?;
7520/// // use `client` to make requests to the Google Compute Engine API.
7521/// Ok(())
7522/// }
7523/// ```
7524///
7525/// # Service Description
7526///
7527/// Service for the `networkAttachments` resource.
7528///
7529/// # Configuration
7530///
7531/// To configure `NetworkAttachments` use the `with_*` methods in the type returned
7532/// by [builder()][NetworkAttachments::builder]. The default configuration should
7533/// work for most applications. Common configuration changes include
7534///
7535/// * [with_endpoint()]: by default this client uses the global default endpoint
7536/// (`https://compute.googleapis.com`). Applications using regional
7537/// endpoints or running in restricted networks (e.g. a network configured
7538/// with [Private Google Access with VPC Service Controls]) may want to
7539/// override this default.
7540/// * [with_credentials()]: by default this client uses
7541/// [Application Default Credentials]. Applications using custom
7542/// authentication may need to override this default.
7543///
7544/// [with_endpoint()]: super::builder::network_attachments::ClientBuilder::with_endpoint
7545/// [with_credentials()]: super::builder::network_attachments::ClientBuilder::with_credentials
7546/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7547/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7548///
7549/// # Pooling and Cloning
7550///
7551/// `NetworkAttachments` holds a connection pool internally, it is advised to
7552/// create one and reuse it. You do not need to wrap `NetworkAttachments` in
7553/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7554/// already uses an `Arc` internally.
7555#[cfg(feature = "network-attachments")]
7556#[cfg_attr(docsrs, doc(cfg(feature = "network-attachments")))]
7557#[derive(Clone, Debug)]
7558pub struct NetworkAttachments {
7559 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkAttachments>,
7560}
7561
7562#[cfg(feature = "network-attachments")]
7563impl NetworkAttachments {
7564 /// Returns a builder for [NetworkAttachments].
7565 ///
7566 /// ```
7567 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7568 /// # use google_cloud_compute_v1::client::NetworkAttachments;
7569 /// let client = NetworkAttachments::builder().build().await?;
7570 /// # Ok(()) }
7571 /// ```
7572 pub fn builder() -> super::builder::network_attachments::ClientBuilder {
7573 crate::new_client_builder(super::builder::network_attachments::client::Factory)
7574 }
7575
7576 /// Creates a new client from the provided stub.
7577 ///
7578 /// The most common case for calling this function is in tests mocking the
7579 /// client's behavior.
7580 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7581 where
7582 T: super::stub::NetworkAttachments + 'static,
7583 {
7584 Self { inner: stub.into() }
7585 }
7586
7587 pub(crate) async fn new(
7588 config: gaxi::options::ClientConfig,
7589 ) -> crate::ClientBuilderResult<Self> {
7590 let inner = Self::build_inner(config).await?;
7591 Ok(Self { inner })
7592 }
7593
7594 async fn build_inner(
7595 conf: gaxi::options::ClientConfig,
7596 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkAttachments>>
7597 {
7598 if gaxi::options::tracing_enabled(&conf) {
7599 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7600 }
7601 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7602 }
7603
7604 async fn build_transport(
7605 conf: gaxi::options::ClientConfig,
7606 ) -> crate::ClientBuilderResult<impl super::stub::NetworkAttachments> {
7607 super::transport::NetworkAttachments::new(conf).await
7608 }
7609
7610 async fn build_with_tracing(
7611 conf: gaxi::options::ClientConfig,
7612 ) -> crate::ClientBuilderResult<impl super::stub::NetworkAttachments> {
7613 Self::build_transport(conf)
7614 .await
7615 .map(super::tracing::NetworkAttachments::new)
7616 }
7617
7618 /// Retrieves the list of all NetworkAttachment resources,
7619 /// regional and global, available to the specified project.
7620 ///
7621 /// To prevent failure, Google recommends that you set the
7622 /// `returnPartialSuccess` parameter to `true`.
7623 pub fn aggregated_list(&self) -> super::builder::network_attachments::AggregatedList {
7624 super::builder::network_attachments::AggregatedList::new(self.inner.clone())
7625 }
7626
7627 /// Deletes the specified NetworkAttachment in the given scope
7628 pub fn delete(&self) -> super::builder::network_attachments::Delete {
7629 super::builder::network_attachments::Delete::new(self.inner.clone())
7630 }
7631
7632 /// Returns the specified NetworkAttachment resource in the given scope.
7633 pub fn get(&self) -> super::builder::network_attachments::Get {
7634 super::builder::network_attachments::Get::new(self.inner.clone())
7635 }
7636
7637 /// Gets the access control policy for a resource. May be empty if no such
7638 /// policy or resource exists.
7639 pub fn get_iam_policy(&self) -> super::builder::network_attachments::GetIamPolicy {
7640 super::builder::network_attachments::GetIamPolicy::new(self.inner.clone())
7641 }
7642
7643 /// Creates a NetworkAttachment in the specified project in the given scope
7644 /// using the parameters that are included in the request.
7645 pub fn insert(&self) -> super::builder::network_attachments::Insert {
7646 super::builder::network_attachments::Insert::new(self.inner.clone())
7647 }
7648
7649 /// Lists the NetworkAttachments for a project in the given scope.
7650 pub fn list(&self) -> super::builder::network_attachments::List {
7651 super::builder::network_attachments::List::new(self.inner.clone())
7652 }
7653
7654 /// Patches the specified NetworkAttachment resource with the data included in
7655 /// the request. This method supports PATCH
7656 /// semantics and usesJSON merge
7657 /// patch format and processing rules.
7658 pub fn patch(&self) -> super::builder::network_attachments::Patch {
7659 super::builder::network_attachments::Patch::new(self.inner.clone())
7660 }
7661
7662 /// Sets the access control policy on the specified resource.
7663 /// Replaces any existing policy.
7664 pub fn set_iam_policy(&self) -> super::builder::network_attachments::SetIamPolicy {
7665 super::builder::network_attachments::SetIamPolicy::new(self.inner.clone())
7666 }
7667
7668 /// Returns permissions that a caller has on the specified resource.
7669 pub fn test_iam_permissions(&self) -> super::builder::network_attachments::TestIamPermissions {
7670 super::builder::network_attachments::TestIamPermissions::new(self.inner.clone())
7671 }
7672
7673 /// Retrieves the specified region-specific Operations resource.
7674 pub fn get_operation(&self) -> super::builder::network_attachments::GetOperation {
7675 super::builder::network_attachments::GetOperation::new(self.inner.clone())
7676 }
7677}
7678
7679/// Implements a client for the Google Compute Engine API.
7680///
7681/// # Example
7682/// ```
7683/// # use google_cloud_compute_v1::client::NetworkEdgeSecurityServices;
7684/// async fn sample(
7685/// ) -> anyhow::Result<()> {
7686/// let client = NetworkEdgeSecurityServices::builder().build().await?;
7687/// // use `client` to make requests to the Google Compute Engine API.
7688/// Ok(())
7689/// }
7690/// ```
7691///
7692/// # Service Description
7693///
7694/// Service for the `networkEdgeSecurityServices` resource.
7695///
7696/// # Configuration
7697///
7698/// To configure `NetworkEdgeSecurityServices` use the `with_*` methods in the type returned
7699/// by [builder()][NetworkEdgeSecurityServices::builder]. The default configuration should
7700/// work for most applications. Common configuration changes include
7701///
7702/// * [with_endpoint()]: by default this client uses the global default endpoint
7703/// (`https://compute.googleapis.com`). Applications using regional
7704/// endpoints or running in restricted networks (e.g. a network configured
7705/// with [Private Google Access with VPC Service Controls]) may want to
7706/// override this default.
7707/// * [with_credentials()]: by default this client uses
7708/// [Application Default Credentials]. Applications using custom
7709/// authentication may need to override this default.
7710///
7711/// [with_endpoint()]: super::builder::network_edge_security_services::ClientBuilder::with_endpoint
7712/// [with_credentials()]: super::builder::network_edge_security_services::ClientBuilder::with_credentials
7713/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7714/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7715///
7716/// # Pooling and Cloning
7717///
7718/// `NetworkEdgeSecurityServices` holds a connection pool internally, it is advised to
7719/// create one and reuse it. You do not need to wrap `NetworkEdgeSecurityServices` in
7720/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7721/// already uses an `Arc` internally.
7722#[cfg(feature = "network-edge-security-services")]
7723#[cfg_attr(docsrs, doc(cfg(feature = "network-edge-security-services")))]
7724#[derive(Clone, Debug)]
7725pub struct NetworkEdgeSecurityServices {
7726 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkEdgeSecurityServices>,
7727}
7728
7729#[cfg(feature = "network-edge-security-services")]
7730impl NetworkEdgeSecurityServices {
7731 /// Returns a builder for [NetworkEdgeSecurityServices].
7732 ///
7733 /// ```
7734 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7735 /// # use google_cloud_compute_v1::client::NetworkEdgeSecurityServices;
7736 /// let client = NetworkEdgeSecurityServices::builder().build().await?;
7737 /// # Ok(()) }
7738 /// ```
7739 pub fn builder() -> super::builder::network_edge_security_services::ClientBuilder {
7740 crate::new_client_builder(super::builder::network_edge_security_services::client::Factory)
7741 }
7742
7743 /// Creates a new client from the provided stub.
7744 ///
7745 /// The most common case for calling this function is in tests mocking the
7746 /// client's behavior.
7747 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7748 where
7749 T: super::stub::NetworkEdgeSecurityServices + 'static,
7750 {
7751 Self { inner: stub.into() }
7752 }
7753
7754 pub(crate) async fn new(
7755 config: gaxi::options::ClientConfig,
7756 ) -> crate::ClientBuilderResult<Self> {
7757 let inner = Self::build_inner(config).await?;
7758 Ok(Self { inner })
7759 }
7760
7761 async fn build_inner(
7762 conf: gaxi::options::ClientConfig,
7763 ) -> crate::ClientBuilderResult<
7764 std::sync::Arc<dyn super::stub::dynamic::NetworkEdgeSecurityServices>,
7765 > {
7766 if gaxi::options::tracing_enabled(&conf) {
7767 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7768 }
7769 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7770 }
7771
7772 async fn build_transport(
7773 conf: gaxi::options::ClientConfig,
7774 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEdgeSecurityServices> {
7775 super::transport::NetworkEdgeSecurityServices::new(conf).await
7776 }
7777
7778 async fn build_with_tracing(
7779 conf: gaxi::options::ClientConfig,
7780 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEdgeSecurityServices> {
7781 Self::build_transport(conf)
7782 .await
7783 .map(super::tracing::NetworkEdgeSecurityServices::new)
7784 }
7785
7786 /// Retrieves the list of all NetworkEdgeSecurityService resources available to
7787 /// the specified project.
7788 ///
7789 /// To prevent failure, Google recommends that you set the
7790 /// `returnPartialSuccess` parameter to `true`.
7791 pub fn aggregated_list(
7792 &self,
7793 ) -> super::builder::network_edge_security_services::AggregatedList {
7794 super::builder::network_edge_security_services::AggregatedList::new(self.inner.clone())
7795 }
7796
7797 /// Deletes the specified service.
7798 pub fn delete(&self) -> super::builder::network_edge_security_services::Delete {
7799 super::builder::network_edge_security_services::Delete::new(self.inner.clone())
7800 }
7801
7802 /// Gets a specified NetworkEdgeSecurityService.
7803 pub fn get(&self) -> super::builder::network_edge_security_services::Get {
7804 super::builder::network_edge_security_services::Get::new(self.inner.clone())
7805 }
7806
7807 /// Creates a new service in the specified project using the data included in
7808 /// the request.
7809 pub fn insert(&self) -> super::builder::network_edge_security_services::Insert {
7810 super::builder::network_edge_security_services::Insert::new(self.inner.clone())
7811 }
7812
7813 /// Patches the specified policy with the data included in the request.
7814 pub fn patch(&self) -> super::builder::network_edge_security_services::Patch {
7815 super::builder::network_edge_security_services::Patch::new(self.inner.clone())
7816 }
7817
7818 /// Retrieves the specified region-specific Operations resource.
7819 pub fn get_operation(&self) -> super::builder::network_edge_security_services::GetOperation {
7820 super::builder::network_edge_security_services::GetOperation::new(self.inner.clone())
7821 }
7822}
7823
7824/// Implements a client for the Google Compute Engine API.
7825///
7826/// # Example
7827/// ```
7828/// # use google_cloud_compute_v1::client::NetworkEndpointGroups;
7829/// async fn sample(
7830/// ) -> anyhow::Result<()> {
7831/// let client = NetworkEndpointGroups::builder().build().await?;
7832/// // use `client` to make requests to the Google Compute Engine API.
7833/// Ok(())
7834/// }
7835/// ```
7836///
7837/// # Service Description
7838///
7839/// Service for the `networkEndpointGroups` resource.
7840///
7841/// # Configuration
7842///
7843/// To configure `NetworkEndpointGroups` use the `with_*` methods in the type returned
7844/// by [builder()][NetworkEndpointGroups::builder]. The default configuration should
7845/// work for most applications. Common configuration changes include
7846///
7847/// * [with_endpoint()]: by default this client uses the global default endpoint
7848/// (`https://compute.googleapis.com`). Applications using regional
7849/// endpoints or running in restricted networks (e.g. a network configured
7850/// with [Private Google Access with VPC Service Controls]) may want to
7851/// override this default.
7852/// * [with_credentials()]: by default this client uses
7853/// [Application Default Credentials]. Applications using custom
7854/// authentication may need to override this default.
7855///
7856/// [with_endpoint()]: super::builder::network_endpoint_groups::ClientBuilder::with_endpoint
7857/// [with_credentials()]: super::builder::network_endpoint_groups::ClientBuilder::with_credentials
7858/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7859/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7860///
7861/// # Pooling and Cloning
7862///
7863/// `NetworkEndpointGroups` holds a connection pool internally, it is advised to
7864/// create one and reuse it. You do not need to wrap `NetworkEndpointGroups` in
7865/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7866/// already uses an `Arc` internally.
7867#[cfg(feature = "network-endpoint-groups")]
7868#[cfg_attr(docsrs, doc(cfg(feature = "network-endpoint-groups")))]
7869#[derive(Clone, Debug)]
7870pub struct NetworkEndpointGroups {
7871 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkEndpointGroups>,
7872}
7873
7874#[cfg(feature = "network-endpoint-groups")]
7875impl NetworkEndpointGroups {
7876 /// Returns a builder for [NetworkEndpointGroups].
7877 ///
7878 /// ```
7879 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
7880 /// # use google_cloud_compute_v1::client::NetworkEndpointGroups;
7881 /// let client = NetworkEndpointGroups::builder().build().await?;
7882 /// # Ok(()) }
7883 /// ```
7884 pub fn builder() -> super::builder::network_endpoint_groups::ClientBuilder {
7885 crate::new_client_builder(super::builder::network_endpoint_groups::client::Factory)
7886 }
7887
7888 /// Creates a new client from the provided stub.
7889 ///
7890 /// The most common case for calling this function is in tests mocking the
7891 /// client's behavior.
7892 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
7893 where
7894 T: super::stub::NetworkEndpointGroups + 'static,
7895 {
7896 Self { inner: stub.into() }
7897 }
7898
7899 pub(crate) async fn new(
7900 config: gaxi::options::ClientConfig,
7901 ) -> crate::ClientBuilderResult<Self> {
7902 let inner = Self::build_inner(config).await?;
7903 Ok(Self { inner })
7904 }
7905
7906 async fn build_inner(
7907 conf: gaxi::options::ClientConfig,
7908 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkEndpointGroups>>
7909 {
7910 if gaxi::options::tracing_enabled(&conf) {
7911 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7912 }
7913 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7914 }
7915
7916 async fn build_transport(
7917 conf: gaxi::options::ClientConfig,
7918 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEndpointGroups> {
7919 super::transport::NetworkEndpointGroups::new(conf).await
7920 }
7921
7922 async fn build_with_tracing(
7923 conf: gaxi::options::ClientConfig,
7924 ) -> crate::ClientBuilderResult<impl super::stub::NetworkEndpointGroups> {
7925 Self::build_transport(conf)
7926 .await
7927 .map(super::tracing::NetworkEndpointGroups::new)
7928 }
7929
7930 /// Retrieves the list of network endpoint groups and sorts them by zone.
7931 ///
7932 /// To prevent failure, Google recommends that you set the
7933 /// `returnPartialSuccess` parameter to `true`.
7934 pub fn aggregated_list(&self) -> super::builder::network_endpoint_groups::AggregatedList {
7935 super::builder::network_endpoint_groups::AggregatedList::new(self.inner.clone())
7936 }
7937
7938 /// Attach a list of network endpoints to the specified network endpoint group.
7939 pub fn attach_network_endpoints(
7940 &self,
7941 ) -> super::builder::network_endpoint_groups::AttachNetworkEndpoints {
7942 super::builder::network_endpoint_groups::AttachNetworkEndpoints::new(self.inner.clone())
7943 }
7944
7945 /// Deletes the specified network endpoint group. The network endpoints in the
7946 /// NEG and the VM instances they belong to are not terminated when the NEG is
7947 /// deleted. Note that the NEG cannot be deleted if there are backend services
7948 /// referencing it.
7949 pub fn delete(&self) -> super::builder::network_endpoint_groups::Delete {
7950 super::builder::network_endpoint_groups::Delete::new(self.inner.clone())
7951 }
7952
7953 /// Detach a list of network endpoints from the specified network endpoint
7954 /// group.
7955 pub fn detach_network_endpoints(
7956 &self,
7957 ) -> super::builder::network_endpoint_groups::DetachNetworkEndpoints {
7958 super::builder::network_endpoint_groups::DetachNetworkEndpoints::new(self.inner.clone())
7959 }
7960
7961 /// Returns the specified network endpoint group.
7962 pub fn get(&self) -> super::builder::network_endpoint_groups::Get {
7963 super::builder::network_endpoint_groups::Get::new(self.inner.clone())
7964 }
7965
7966 /// Creates a network endpoint group in the specified project using the
7967 /// parameters that are included in the request.
7968 ///
7969 /// Note: Use the following APIs to manage network endpoint groups:
7970 ///
7971 /// - To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
7972 /// NEGs): zonal
7973 /// API
7974 /// - To manage NEGs with regional scope (such as regional internet NEGs,
7975 /// serverless NEGs, Private Service Connect NEGs): regional
7976 /// API
7977 /// - To manage NEGs with global scope (such as global internet NEGs):global
7978 /// API
7979 pub fn insert(&self) -> super::builder::network_endpoint_groups::Insert {
7980 super::builder::network_endpoint_groups::Insert::new(self.inner.clone())
7981 }
7982
7983 /// Retrieves the list of network endpoint groups that are located in the
7984 /// specified project and zone.
7985 pub fn list(&self) -> super::builder::network_endpoint_groups::List {
7986 super::builder::network_endpoint_groups::List::new(self.inner.clone())
7987 }
7988
7989 /// Lists the network endpoints in the specified network endpoint group.
7990 pub fn list_network_endpoints(
7991 &self,
7992 ) -> super::builder::network_endpoint_groups::ListNetworkEndpoints {
7993 super::builder::network_endpoint_groups::ListNetworkEndpoints::new(self.inner.clone())
7994 }
7995
7996 /// Returns permissions that a caller has on the specified resource.
7997 pub fn test_iam_permissions(
7998 &self,
7999 ) -> super::builder::network_endpoint_groups::TestIamPermissions {
8000 super::builder::network_endpoint_groups::TestIamPermissions::new(self.inner.clone())
8001 }
8002
8003 /// Retrieves the specified zone-specific Operations resource.
8004 pub fn get_operation(&self) -> super::builder::network_endpoint_groups::GetOperation {
8005 super::builder::network_endpoint_groups::GetOperation::new(self.inner.clone())
8006 }
8007}
8008
8009/// Implements a client for the Google Compute Engine API.
8010///
8011/// # Example
8012/// ```
8013/// # use google_cloud_compute_v1::client::NetworkFirewallPolicies;
8014/// async fn sample(
8015/// ) -> anyhow::Result<()> {
8016/// let client = NetworkFirewallPolicies::builder().build().await?;
8017/// // use `client` to make requests to the Google Compute Engine API.
8018/// Ok(())
8019/// }
8020/// ```
8021///
8022/// # Service Description
8023///
8024/// Service for the `networkFirewallPolicies` resource.
8025///
8026/// # Configuration
8027///
8028/// To configure `NetworkFirewallPolicies` use the `with_*` methods in the type returned
8029/// by [builder()][NetworkFirewallPolicies::builder]. The default configuration should
8030/// work for most applications. Common configuration changes include
8031///
8032/// * [with_endpoint()]: by default this client uses the global default endpoint
8033/// (`https://compute.googleapis.com`). Applications using regional
8034/// endpoints or running in restricted networks (e.g. a network configured
8035/// with [Private Google Access with VPC Service Controls]) may want to
8036/// override this default.
8037/// * [with_credentials()]: by default this client uses
8038/// [Application Default Credentials]. Applications using custom
8039/// authentication may need to override this default.
8040///
8041/// [with_endpoint()]: super::builder::network_firewall_policies::ClientBuilder::with_endpoint
8042/// [with_credentials()]: super::builder::network_firewall_policies::ClientBuilder::with_credentials
8043/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8044/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8045///
8046/// # Pooling and Cloning
8047///
8048/// `NetworkFirewallPolicies` holds a connection pool internally, it is advised to
8049/// create one and reuse it. You do not need to wrap `NetworkFirewallPolicies` in
8050/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8051/// already uses an `Arc` internally.
8052#[cfg(feature = "network-firewall-policies")]
8053#[cfg_attr(docsrs, doc(cfg(feature = "network-firewall-policies")))]
8054#[derive(Clone, Debug)]
8055pub struct NetworkFirewallPolicies {
8056 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkFirewallPolicies>,
8057}
8058
8059#[cfg(feature = "network-firewall-policies")]
8060impl NetworkFirewallPolicies {
8061 /// Returns a builder for [NetworkFirewallPolicies].
8062 ///
8063 /// ```
8064 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8065 /// # use google_cloud_compute_v1::client::NetworkFirewallPolicies;
8066 /// let client = NetworkFirewallPolicies::builder().build().await?;
8067 /// # Ok(()) }
8068 /// ```
8069 pub fn builder() -> super::builder::network_firewall_policies::ClientBuilder {
8070 crate::new_client_builder(super::builder::network_firewall_policies::client::Factory)
8071 }
8072
8073 /// Creates a new client from the provided stub.
8074 ///
8075 /// The most common case for calling this function is in tests mocking the
8076 /// client's behavior.
8077 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8078 where
8079 T: super::stub::NetworkFirewallPolicies + 'static,
8080 {
8081 Self { inner: stub.into() }
8082 }
8083
8084 pub(crate) async fn new(
8085 config: gaxi::options::ClientConfig,
8086 ) -> crate::ClientBuilderResult<Self> {
8087 let inner = Self::build_inner(config).await?;
8088 Ok(Self { inner })
8089 }
8090
8091 async fn build_inner(
8092 conf: gaxi::options::ClientConfig,
8093 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkFirewallPolicies>>
8094 {
8095 if gaxi::options::tracing_enabled(&conf) {
8096 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8097 }
8098 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8099 }
8100
8101 async fn build_transport(
8102 conf: gaxi::options::ClientConfig,
8103 ) -> crate::ClientBuilderResult<impl super::stub::NetworkFirewallPolicies> {
8104 super::transport::NetworkFirewallPolicies::new(conf).await
8105 }
8106
8107 async fn build_with_tracing(
8108 conf: gaxi::options::ClientConfig,
8109 ) -> crate::ClientBuilderResult<impl super::stub::NetworkFirewallPolicies> {
8110 Self::build_transport(conf)
8111 .await
8112 .map(super::tracing::NetworkFirewallPolicies::new)
8113 }
8114
8115 /// Inserts an association for the specified firewall policy.
8116 pub fn add_association(&self) -> super::builder::network_firewall_policies::AddAssociation {
8117 super::builder::network_firewall_policies::AddAssociation::new(self.inner.clone())
8118 }
8119
8120 /// Inserts a packet mirroring rule into a firewall policy.
8121 pub fn add_packet_mirroring_rule(
8122 &self,
8123 ) -> super::builder::network_firewall_policies::AddPacketMirroringRule {
8124 super::builder::network_firewall_policies::AddPacketMirroringRule::new(self.inner.clone())
8125 }
8126
8127 /// Inserts a rule into a firewall policy.
8128 pub fn add_rule(&self) -> super::builder::network_firewall_policies::AddRule {
8129 super::builder::network_firewall_policies::AddRule::new(self.inner.clone())
8130 }
8131
8132 /// Retrieves an aggregated list of network firewall policies, listing network
8133 /// firewall policies from all applicable scopes (global and regional) and
8134 /// grouping the results per scope.
8135 ///
8136 /// To prevent failure, it is recommended that you set the
8137 /// `returnPartialSuccess` parameter to `true`.
8138 pub fn aggregated_list(&self) -> super::builder::network_firewall_policies::AggregatedList {
8139 super::builder::network_firewall_policies::AggregatedList::new(self.inner.clone())
8140 }
8141
8142 /// Copies rules to the specified firewall policy.
8143 pub fn clone_rules(&self) -> super::builder::network_firewall_policies::CloneRules {
8144 super::builder::network_firewall_policies::CloneRules::new(self.inner.clone())
8145 }
8146
8147 /// Deletes the specified policy.
8148 pub fn delete(&self) -> super::builder::network_firewall_policies::Delete {
8149 super::builder::network_firewall_policies::Delete::new(self.inner.clone())
8150 }
8151
8152 /// Returns the specified network firewall policy.
8153 pub fn get(&self) -> super::builder::network_firewall_policies::Get {
8154 super::builder::network_firewall_policies::Get::new(self.inner.clone())
8155 }
8156
8157 /// Gets an association with the specified name.
8158 pub fn get_association(&self) -> super::builder::network_firewall_policies::GetAssociation {
8159 super::builder::network_firewall_policies::GetAssociation::new(self.inner.clone())
8160 }
8161
8162 /// Gets the access control policy for a resource. May be empty if no such
8163 /// policy or resource exists.
8164 pub fn get_iam_policy(&self) -> super::builder::network_firewall_policies::GetIamPolicy {
8165 super::builder::network_firewall_policies::GetIamPolicy::new(self.inner.clone())
8166 }
8167
8168 /// Gets a packet mirroring rule of the specified priority.
8169 pub fn get_packet_mirroring_rule(
8170 &self,
8171 ) -> super::builder::network_firewall_policies::GetPacketMirroringRule {
8172 super::builder::network_firewall_policies::GetPacketMirroringRule::new(self.inner.clone())
8173 }
8174
8175 /// Gets a rule of the specified priority.
8176 pub fn get_rule(&self) -> super::builder::network_firewall_policies::GetRule {
8177 super::builder::network_firewall_policies::GetRule::new(self.inner.clone())
8178 }
8179
8180 /// Creates a new policy in the specified project using the data included in
8181 /// the request.
8182 pub fn insert(&self) -> super::builder::network_firewall_policies::Insert {
8183 super::builder::network_firewall_policies::Insert::new(self.inner.clone())
8184 }
8185
8186 /// Lists all the policies that have been configured for the specified project.
8187 pub fn list(&self) -> super::builder::network_firewall_policies::List {
8188 super::builder::network_firewall_policies::List::new(self.inner.clone())
8189 }
8190
8191 /// Patches the specified policy with the data included in the request.
8192 pub fn patch(&self) -> super::builder::network_firewall_policies::Patch {
8193 super::builder::network_firewall_policies::Patch::new(self.inner.clone())
8194 }
8195
8196 /// Patches a packet mirroring rule of the specified priority.
8197 pub fn patch_packet_mirroring_rule(
8198 &self,
8199 ) -> super::builder::network_firewall_policies::PatchPacketMirroringRule {
8200 super::builder::network_firewall_policies::PatchPacketMirroringRule::new(self.inner.clone())
8201 }
8202
8203 /// Patches a rule of the specified priority.
8204 pub fn patch_rule(&self) -> super::builder::network_firewall_policies::PatchRule {
8205 super::builder::network_firewall_policies::PatchRule::new(self.inner.clone())
8206 }
8207
8208 /// Removes an association for the specified firewall policy.
8209 pub fn remove_association(
8210 &self,
8211 ) -> super::builder::network_firewall_policies::RemoveAssociation {
8212 super::builder::network_firewall_policies::RemoveAssociation::new(self.inner.clone())
8213 }
8214
8215 /// Deletes a packet mirroring rule of the specified priority.
8216 pub fn remove_packet_mirroring_rule(
8217 &self,
8218 ) -> super::builder::network_firewall_policies::RemovePacketMirroringRule {
8219 super::builder::network_firewall_policies::RemovePacketMirroringRule::new(
8220 self.inner.clone(),
8221 )
8222 }
8223
8224 /// Deletes a rule of the specified priority.
8225 pub fn remove_rule(&self) -> super::builder::network_firewall_policies::RemoveRule {
8226 super::builder::network_firewall_policies::RemoveRule::new(self.inner.clone())
8227 }
8228
8229 /// Sets the access control policy on the specified resource.
8230 /// Replaces any existing policy.
8231 pub fn set_iam_policy(&self) -> super::builder::network_firewall_policies::SetIamPolicy {
8232 super::builder::network_firewall_policies::SetIamPolicy::new(self.inner.clone())
8233 }
8234
8235 /// Returns permissions that a caller has on the specified resource.
8236 pub fn test_iam_permissions(
8237 &self,
8238 ) -> super::builder::network_firewall_policies::TestIamPermissions {
8239 super::builder::network_firewall_policies::TestIamPermissions::new(self.inner.clone())
8240 }
8241
8242 /// Retrieves the specified Operations resource.
8243 pub fn get_operation(&self) -> super::builder::network_firewall_policies::GetOperation {
8244 super::builder::network_firewall_policies::GetOperation::new(self.inner.clone())
8245 }
8246}
8247
8248/// Implements a client for the Google Compute Engine API.
8249///
8250/// # Example
8251/// ```
8252/// # use google_cloud_compute_v1::client::NetworkProfiles;
8253/// async fn sample(
8254/// ) -> anyhow::Result<()> {
8255/// let client = NetworkProfiles::builder().build().await?;
8256/// // use `client` to make requests to the Google Compute Engine API.
8257/// Ok(())
8258/// }
8259/// ```
8260///
8261/// # Service Description
8262///
8263/// Service for the `networkProfiles` resource.
8264///
8265/// # Configuration
8266///
8267/// To configure `NetworkProfiles` use the `with_*` methods in the type returned
8268/// by [builder()][NetworkProfiles::builder]. The default configuration should
8269/// work for most applications. Common configuration changes include
8270///
8271/// * [with_endpoint()]: by default this client uses the global default endpoint
8272/// (`https://compute.googleapis.com`). Applications using regional
8273/// endpoints or running in restricted networks (e.g. a network configured
8274/// with [Private Google Access with VPC Service Controls]) may want to
8275/// override this default.
8276/// * [with_credentials()]: by default this client uses
8277/// [Application Default Credentials]. Applications using custom
8278/// authentication may need to override this default.
8279///
8280/// [with_endpoint()]: super::builder::network_profiles::ClientBuilder::with_endpoint
8281/// [with_credentials()]: super::builder::network_profiles::ClientBuilder::with_credentials
8282/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8283/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8284///
8285/// # Pooling and Cloning
8286///
8287/// `NetworkProfiles` holds a connection pool internally, it is advised to
8288/// create one and reuse it. You do not need to wrap `NetworkProfiles` in
8289/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8290/// already uses an `Arc` internally.
8291#[cfg(feature = "network-profiles")]
8292#[cfg_attr(docsrs, doc(cfg(feature = "network-profiles")))]
8293#[derive(Clone, Debug)]
8294pub struct NetworkProfiles {
8295 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkProfiles>,
8296}
8297
8298#[cfg(feature = "network-profiles")]
8299impl NetworkProfiles {
8300 /// Returns a builder for [NetworkProfiles].
8301 ///
8302 /// ```
8303 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8304 /// # use google_cloud_compute_v1::client::NetworkProfiles;
8305 /// let client = NetworkProfiles::builder().build().await?;
8306 /// # Ok(()) }
8307 /// ```
8308 pub fn builder() -> super::builder::network_profiles::ClientBuilder {
8309 crate::new_client_builder(super::builder::network_profiles::client::Factory)
8310 }
8311
8312 /// Creates a new client from the provided stub.
8313 ///
8314 /// The most common case for calling this function is in tests mocking the
8315 /// client's behavior.
8316 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8317 where
8318 T: super::stub::NetworkProfiles + 'static,
8319 {
8320 Self { inner: stub.into() }
8321 }
8322
8323 pub(crate) async fn new(
8324 config: gaxi::options::ClientConfig,
8325 ) -> crate::ClientBuilderResult<Self> {
8326 let inner = Self::build_inner(config).await?;
8327 Ok(Self { inner })
8328 }
8329
8330 async fn build_inner(
8331 conf: gaxi::options::ClientConfig,
8332 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NetworkProfiles>> {
8333 if gaxi::options::tracing_enabled(&conf) {
8334 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8335 }
8336 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8337 }
8338
8339 async fn build_transport(
8340 conf: gaxi::options::ClientConfig,
8341 ) -> crate::ClientBuilderResult<impl super::stub::NetworkProfiles> {
8342 super::transport::NetworkProfiles::new(conf).await
8343 }
8344
8345 async fn build_with_tracing(
8346 conf: gaxi::options::ClientConfig,
8347 ) -> crate::ClientBuilderResult<impl super::stub::NetworkProfiles> {
8348 Self::build_transport(conf)
8349 .await
8350 .map(super::tracing::NetworkProfiles::new)
8351 }
8352
8353 /// Returns the specified network profile.
8354 pub fn get(&self) -> super::builder::network_profiles::Get {
8355 super::builder::network_profiles::Get::new(self.inner.clone())
8356 }
8357
8358 /// Retrieves a list of network profiles available to the specified
8359 /// project.
8360 pub fn list(&self) -> super::builder::network_profiles::List {
8361 super::builder::network_profiles::List::new(self.inner.clone())
8362 }
8363}
8364
8365/// Implements a client for the Google Compute Engine API.
8366///
8367/// # Example
8368/// ```
8369/// # use google_cloud_compute_v1::client::Networks;
8370/// async fn sample(
8371/// ) -> anyhow::Result<()> {
8372/// let client = Networks::builder().build().await?;
8373/// // use `client` to make requests to the Google Compute Engine API.
8374/// Ok(())
8375/// }
8376/// ```
8377///
8378/// # Service Description
8379///
8380/// Service for the `networks` resource.
8381///
8382/// # Configuration
8383///
8384/// To configure `Networks` use the `with_*` methods in the type returned
8385/// by [builder()][Networks::builder]. The default configuration should
8386/// work for most applications. Common configuration changes include
8387///
8388/// * [with_endpoint()]: by default this client uses the global default endpoint
8389/// (`https://compute.googleapis.com`). Applications using regional
8390/// endpoints or running in restricted networks (e.g. a network configured
8391/// with [Private Google Access with VPC Service Controls]) may want to
8392/// override this default.
8393/// * [with_credentials()]: by default this client uses
8394/// [Application Default Credentials]. Applications using custom
8395/// authentication may need to override this default.
8396///
8397/// [with_endpoint()]: super::builder::networks::ClientBuilder::with_endpoint
8398/// [with_credentials()]: super::builder::networks::ClientBuilder::with_credentials
8399/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8400/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8401///
8402/// # Pooling and Cloning
8403///
8404/// `Networks` holds a connection pool internally, it is advised to
8405/// create one and reuse it. You do not need to wrap `Networks` in
8406/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8407/// already uses an `Arc` internally.
8408#[cfg(feature = "networks")]
8409#[cfg_attr(docsrs, doc(cfg(feature = "networks")))]
8410#[derive(Clone, Debug)]
8411pub struct Networks {
8412 inner: std::sync::Arc<dyn super::stub::dynamic::Networks>,
8413}
8414
8415#[cfg(feature = "networks")]
8416impl Networks {
8417 /// Returns a builder for [Networks].
8418 ///
8419 /// ```
8420 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8421 /// # use google_cloud_compute_v1::client::Networks;
8422 /// let client = Networks::builder().build().await?;
8423 /// # Ok(()) }
8424 /// ```
8425 pub fn builder() -> super::builder::networks::ClientBuilder {
8426 crate::new_client_builder(super::builder::networks::client::Factory)
8427 }
8428
8429 /// Creates a new client from the provided stub.
8430 ///
8431 /// The most common case for calling this function is in tests mocking the
8432 /// client's behavior.
8433 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8434 where
8435 T: super::stub::Networks + 'static,
8436 {
8437 Self { inner: stub.into() }
8438 }
8439
8440 pub(crate) async fn new(
8441 config: gaxi::options::ClientConfig,
8442 ) -> crate::ClientBuilderResult<Self> {
8443 let inner = Self::build_inner(config).await?;
8444 Ok(Self { inner })
8445 }
8446
8447 async fn build_inner(
8448 conf: gaxi::options::ClientConfig,
8449 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Networks>> {
8450 if gaxi::options::tracing_enabled(&conf) {
8451 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8452 }
8453 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8454 }
8455
8456 async fn build_transport(
8457 conf: gaxi::options::ClientConfig,
8458 ) -> crate::ClientBuilderResult<impl super::stub::Networks> {
8459 super::transport::Networks::new(conf).await
8460 }
8461
8462 async fn build_with_tracing(
8463 conf: gaxi::options::ClientConfig,
8464 ) -> crate::ClientBuilderResult<impl super::stub::Networks> {
8465 Self::build_transport(conf)
8466 .await
8467 .map(super::tracing::Networks::new)
8468 }
8469
8470 /// Adds a peering to the specified network.
8471 pub fn add_peering(&self) -> super::builder::networks::AddPeering {
8472 super::builder::networks::AddPeering::new(self.inner.clone())
8473 }
8474
8475 /// Cancel requests to remove a peering from the specified network. Applicable
8476 /// only for PeeringConnection with update_strategy=CONSENSUS. Cancels a
8477 /// request to remove a peering from the specified network.
8478 pub fn cancel_request_remove_peering(
8479 &self,
8480 ) -> super::builder::networks::CancelRequestRemovePeering {
8481 super::builder::networks::CancelRequestRemovePeering::new(self.inner.clone())
8482 }
8483
8484 /// Deletes the specified network.
8485 pub fn delete(&self) -> super::builder::networks::Delete {
8486 super::builder::networks::Delete::new(self.inner.clone())
8487 }
8488
8489 /// Returns the specified network.
8490 pub fn get(&self) -> super::builder::networks::Get {
8491 super::builder::networks::Get::new(self.inner.clone())
8492 }
8493
8494 /// Returns the effective firewalls on a given network.
8495 pub fn get_effective_firewalls(&self) -> super::builder::networks::GetEffectiveFirewalls {
8496 super::builder::networks::GetEffectiveFirewalls::new(self.inner.clone())
8497 }
8498
8499 /// Creates a network in the specified project using the data included
8500 /// in the request.
8501 pub fn insert(&self) -> super::builder::networks::Insert {
8502 super::builder::networks::Insert::new(self.inner.clone())
8503 }
8504
8505 /// Retrieves the list of networks available to the specified project.
8506 pub fn list(&self) -> super::builder::networks::List {
8507 super::builder::networks::List::new(self.inner.clone())
8508 }
8509
8510 /// Lists the peering routes exchanged over peering connection.
8511 pub fn list_peering_routes(&self) -> super::builder::networks::ListPeeringRoutes {
8512 super::builder::networks::ListPeeringRoutes::new(self.inner.clone())
8513 }
8514
8515 /// Patches the specified network with the data included in the request.
8516 /// Only routingConfig can be modified.
8517 pub fn patch(&self) -> super::builder::networks::Patch {
8518 super::builder::networks::Patch::new(self.inner.clone())
8519 }
8520
8521 /// Removes a peering from the specified network.
8522 pub fn remove_peering(&self) -> super::builder::networks::RemovePeering {
8523 super::builder::networks::RemovePeering::new(self.inner.clone())
8524 }
8525
8526 /// Requests to remove a peering from the specified network. Applicable only
8527 /// for PeeringConnection with update_strategy=CONSENSUS.
8528 pub fn request_remove_peering(&self) -> super::builder::networks::RequestRemovePeering {
8529 super::builder::networks::RequestRemovePeering::new(self.inner.clone())
8530 }
8531
8532 /// Switches the network mode from auto subnet mode to custom subnet mode.
8533 pub fn switch_to_custom_mode(&self) -> super::builder::networks::SwitchToCustomMode {
8534 super::builder::networks::SwitchToCustomMode::new(self.inner.clone())
8535 }
8536
8537 /// Updates the specified network peering with the data included in the
8538 /// request. You can only modify the NetworkPeering.export_custom_routes field
8539 /// and the NetworkPeering.import_custom_routes field.
8540 pub fn update_peering(&self) -> super::builder::networks::UpdatePeering {
8541 super::builder::networks::UpdatePeering::new(self.inner.clone())
8542 }
8543
8544 /// Retrieves the specified Operations resource.
8545 pub fn get_operation(&self) -> super::builder::networks::GetOperation {
8546 super::builder::networks::GetOperation::new(self.inner.clone())
8547 }
8548}
8549
8550/// Implements a client for the Google Compute Engine API.
8551///
8552/// # Example
8553/// ```
8554/// # use google_cloud_compute_v1::client::NodeGroups;
8555/// async fn sample(
8556/// ) -> anyhow::Result<()> {
8557/// let client = NodeGroups::builder().build().await?;
8558/// // use `client` to make requests to the Google Compute Engine API.
8559/// Ok(())
8560/// }
8561/// ```
8562///
8563/// # Service Description
8564///
8565/// Service for the `nodeGroups` resource.
8566///
8567/// # Configuration
8568///
8569/// To configure `NodeGroups` use the `with_*` methods in the type returned
8570/// by [builder()][NodeGroups::builder]. The default configuration should
8571/// work for most applications. Common configuration changes include
8572///
8573/// * [with_endpoint()]: by default this client uses the global default endpoint
8574/// (`https://compute.googleapis.com`). Applications using regional
8575/// endpoints or running in restricted networks (e.g. a network configured
8576/// with [Private Google Access with VPC Service Controls]) may want to
8577/// override this default.
8578/// * [with_credentials()]: by default this client uses
8579/// [Application Default Credentials]. Applications using custom
8580/// authentication may need to override this default.
8581///
8582/// [with_endpoint()]: super::builder::node_groups::ClientBuilder::with_endpoint
8583/// [with_credentials()]: super::builder::node_groups::ClientBuilder::with_credentials
8584/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8585/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8586///
8587/// # Pooling and Cloning
8588///
8589/// `NodeGroups` holds a connection pool internally, it is advised to
8590/// create one and reuse it. You do not need to wrap `NodeGroups` in
8591/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8592/// already uses an `Arc` internally.
8593#[cfg(feature = "node-groups")]
8594#[cfg_attr(docsrs, doc(cfg(feature = "node-groups")))]
8595#[derive(Clone, Debug)]
8596pub struct NodeGroups {
8597 inner: std::sync::Arc<dyn super::stub::dynamic::NodeGroups>,
8598}
8599
8600#[cfg(feature = "node-groups")]
8601impl NodeGroups {
8602 /// Returns a builder for [NodeGroups].
8603 ///
8604 /// ```
8605 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8606 /// # use google_cloud_compute_v1::client::NodeGroups;
8607 /// let client = NodeGroups::builder().build().await?;
8608 /// # Ok(()) }
8609 /// ```
8610 pub fn builder() -> super::builder::node_groups::ClientBuilder {
8611 crate::new_client_builder(super::builder::node_groups::client::Factory)
8612 }
8613
8614 /// Creates a new client from the provided stub.
8615 ///
8616 /// The most common case for calling this function is in tests mocking the
8617 /// client's behavior.
8618 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8619 where
8620 T: super::stub::NodeGroups + 'static,
8621 {
8622 Self { inner: stub.into() }
8623 }
8624
8625 pub(crate) async fn new(
8626 config: gaxi::options::ClientConfig,
8627 ) -> crate::ClientBuilderResult<Self> {
8628 let inner = Self::build_inner(config).await?;
8629 Ok(Self { inner })
8630 }
8631
8632 async fn build_inner(
8633 conf: gaxi::options::ClientConfig,
8634 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeGroups>> {
8635 if gaxi::options::tracing_enabled(&conf) {
8636 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8637 }
8638 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8639 }
8640
8641 async fn build_transport(
8642 conf: gaxi::options::ClientConfig,
8643 ) -> crate::ClientBuilderResult<impl super::stub::NodeGroups> {
8644 super::transport::NodeGroups::new(conf).await
8645 }
8646
8647 async fn build_with_tracing(
8648 conf: gaxi::options::ClientConfig,
8649 ) -> crate::ClientBuilderResult<impl super::stub::NodeGroups> {
8650 Self::build_transport(conf)
8651 .await
8652 .map(super::tracing::NodeGroups::new)
8653 }
8654
8655 /// Adds specified number of nodes to the node group.
8656 pub fn add_nodes(&self) -> super::builder::node_groups::AddNodes {
8657 super::builder::node_groups::AddNodes::new(self.inner.clone())
8658 }
8659
8660 /// Retrieves an aggregated list of node groups.
8661 /// Note: use nodeGroups.listNodes for more details about each group.
8662 ///
8663 /// To prevent failure, Google recommends that you set the
8664 /// `returnPartialSuccess` parameter to `true`.
8665 pub fn aggregated_list(&self) -> super::builder::node_groups::AggregatedList {
8666 super::builder::node_groups::AggregatedList::new(self.inner.clone())
8667 }
8668
8669 /// Deletes the specified NodeGroup resource.
8670 pub fn delete(&self) -> super::builder::node_groups::Delete {
8671 super::builder::node_groups::Delete::new(self.inner.clone())
8672 }
8673
8674 /// Deletes specified nodes from the node group.
8675 pub fn delete_nodes(&self) -> super::builder::node_groups::DeleteNodes {
8676 super::builder::node_groups::DeleteNodes::new(self.inner.clone())
8677 }
8678
8679 /// Returns the specified NodeGroup. Get a list of available NodeGroups
8680 /// by making a list() request.
8681 /// Note: the "nodes" field should not be used. Use nodeGroups.listNodes
8682 /// instead.
8683 pub fn get(&self) -> super::builder::node_groups::Get {
8684 super::builder::node_groups::Get::new(self.inner.clone())
8685 }
8686
8687 /// Gets the access control policy for a resource. May be empty if no such
8688 /// policy or resource exists.
8689 pub fn get_iam_policy(&self) -> super::builder::node_groups::GetIamPolicy {
8690 super::builder::node_groups::GetIamPolicy::new(self.inner.clone())
8691 }
8692
8693 /// Creates a NodeGroup resource in the specified project using the data
8694 /// included in the request.
8695 pub fn insert(&self) -> super::builder::node_groups::Insert {
8696 super::builder::node_groups::Insert::new(self.inner.clone())
8697 }
8698
8699 /// Retrieves a list of node groups available to the specified project.
8700 /// Note: use nodeGroups.listNodes for more details about each group.
8701 pub fn list(&self) -> super::builder::node_groups::List {
8702 super::builder::node_groups::List::new(self.inner.clone())
8703 }
8704
8705 /// Lists nodes in the node group.
8706 pub fn list_nodes(&self) -> super::builder::node_groups::ListNodes {
8707 super::builder::node_groups::ListNodes::new(self.inner.clone())
8708 }
8709
8710 /// Updates the specified node group.
8711 pub fn patch(&self) -> super::builder::node_groups::Patch {
8712 super::builder::node_groups::Patch::new(self.inner.clone())
8713 }
8714
8715 /// Perform maintenance on a subset of nodes in the node group.
8716 pub fn perform_maintenance(&self) -> super::builder::node_groups::PerformMaintenance {
8717 super::builder::node_groups::PerformMaintenance::new(self.inner.clone())
8718 }
8719
8720 /// Sets the access control policy on the specified resource.
8721 /// Replaces any existing policy.
8722 pub fn set_iam_policy(&self) -> super::builder::node_groups::SetIamPolicy {
8723 super::builder::node_groups::SetIamPolicy::new(self.inner.clone())
8724 }
8725
8726 /// Updates the node template of the node group.
8727 pub fn set_node_template(&self) -> super::builder::node_groups::SetNodeTemplate {
8728 super::builder::node_groups::SetNodeTemplate::new(self.inner.clone())
8729 }
8730
8731 /// Simulates maintenance event on specified nodes from the node group.
8732 pub fn simulate_maintenance_event(
8733 &self,
8734 ) -> super::builder::node_groups::SimulateMaintenanceEvent {
8735 super::builder::node_groups::SimulateMaintenanceEvent::new(self.inner.clone())
8736 }
8737
8738 /// Returns permissions that a caller has on the specified resource.
8739 pub fn test_iam_permissions(&self) -> super::builder::node_groups::TestIamPermissions {
8740 super::builder::node_groups::TestIamPermissions::new(self.inner.clone())
8741 }
8742
8743 /// Retrieves the specified zone-specific Operations resource.
8744 pub fn get_operation(&self) -> super::builder::node_groups::GetOperation {
8745 super::builder::node_groups::GetOperation::new(self.inner.clone())
8746 }
8747}
8748
8749/// Implements a client for the Google Compute Engine API.
8750///
8751/// # Example
8752/// ```
8753/// # use google_cloud_compute_v1::client::NodeTemplates;
8754/// async fn sample(
8755/// ) -> anyhow::Result<()> {
8756/// let client = NodeTemplates::builder().build().await?;
8757/// // use `client` to make requests to the Google Compute Engine API.
8758/// Ok(())
8759/// }
8760/// ```
8761///
8762/// # Service Description
8763///
8764/// Service for the `nodeTemplates` resource.
8765///
8766/// # Configuration
8767///
8768/// To configure `NodeTemplates` use the `with_*` methods in the type returned
8769/// by [builder()][NodeTemplates::builder]. The default configuration should
8770/// work for most applications. Common configuration changes include
8771///
8772/// * [with_endpoint()]: by default this client uses the global default endpoint
8773/// (`https://compute.googleapis.com`). Applications using regional
8774/// endpoints or running in restricted networks (e.g. a network configured
8775/// with [Private Google Access with VPC Service Controls]) may want to
8776/// override this default.
8777/// * [with_credentials()]: by default this client uses
8778/// [Application Default Credentials]. Applications using custom
8779/// authentication may need to override this default.
8780///
8781/// [with_endpoint()]: super::builder::node_templates::ClientBuilder::with_endpoint
8782/// [with_credentials()]: super::builder::node_templates::ClientBuilder::with_credentials
8783/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8784/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8785///
8786/// # Pooling and Cloning
8787///
8788/// `NodeTemplates` holds a connection pool internally, it is advised to
8789/// create one and reuse it. You do not need to wrap `NodeTemplates` in
8790/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8791/// already uses an `Arc` internally.
8792#[cfg(feature = "node-templates")]
8793#[cfg_attr(docsrs, doc(cfg(feature = "node-templates")))]
8794#[derive(Clone, Debug)]
8795pub struct NodeTemplates {
8796 inner: std::sync::Arc<dyn super::stub::dynamic::NodeTemplates>,
8797}
8798
8799#[cfg(feature = "node-templates")]
8800impl NodeTemplates {
8801 /// Returns a builder for [NodeTemplates].
8802 ///
8803 /// ```
8804 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8805 /// # use google_cloud_compute_v1::client::NodeTemplates;
8806 /// let client = NodeTemplates::builder().build().await?;
8807 /// # Ok(()) }
8808 /// ```
8809 pub fn builder() -> super::builder::node_templates::ClientBuilder {
8810 crate::new_client_builder(super::builder::node_templates::client::Factory)
8811 }
8812
8813 /// Creates a new client from the provided stub.
8814 ///
8815 /// The most common case for calling this function is in tests mocking the
8816 /// client's behavior.
8817 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8818 where
8819 T: super::stub::NodeTemplates + 'static,
8820 {
8821 Self { inner: stub.into() }
8822 }
8823
8824 pub(crate) async fn new(
8825 config: gaxi::options::ClientConfig,
8826 ) -> crate::ClientBuilderResult<Self> {
8827 let inner = Self::build_inner(config).await?;
8828 Ok(Self { inner })
8829 }
8830
8831 async fn build_inner(
8832 conf: gaxi::options::ClientConfig,
8833 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeTemplates>> {
8834 if gaxi::options::tracing_enabled(&conf) {
8835 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8836 }
8837 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8838 }
8839
8840 async fn build_transport(
8841 conf: gaxi::options::ClientConfig,
8842 ) -> crate::ClientBuilderResult<impl super::stub::NodeTemplates> {
8843 super::transport::NodeTemplates::new(conf).await
8844 }
8845
8846 async fn build_with_tracing(
8847 conf: gaxi::options::ClientConfig,
8848 ) -> crate::ClientBuilderResult<impl super::stub::NodeTemplates> {
8849 Self::build_transport(conf)
8850 .await
8851 .map(super::tracing::NodeTemplates::new)
8852 }
8853
8854 /// Retrieves an aggregated list of node templates.
8855 ///
8856 /// To prevent failure, Google recommends that you set the
8857 /// `returnPartialSuccess` parameter to `true`.
8858 pub fn aggregated_list(&self) -> super::builder::node_templates::AggregatedList {
8859 super::builder::node_templates::AggregatedList::new(self.inner.clone())
8860 }
8861
8862 /// Deletes the specified NodeTemplate resource.
8863 pub fn delete(&self) -> super::builder::node_templates::Delete {
8864 super::builder::node_templates::Delete::new(self.inner.clone())
8865 }
8866
8867 /// Returns the specified node template.
8868 pub fn get(&self) -> super::builder::node_templates::Get {
8869 super::builder::node_templates::Get::new(self.inner.clone())
8870 }
8871
8872 /// Gets the access control policy for a resource. May be empty if no such
8873 /// policy or resource exists.
8874 pub fn get_iam_policy(&self) -> super::builder::node_templates::GetIamPolicy {
8875 super::builder::node_templates::GetIamPolicy::new(self.inner.clone())
8876 }
8877
8878 /// Creates a NodeTemplate resource in the specified project using the data
8879 /// included in the request.
8880 pub fn insert(&self) -> super::builder::node_templates::Insert {
8881 super::builder::node_templates::Insert::new(self.inner.clone())
8882 }
8883
8884 /// Retrieves a list of node templates available to the specified
8885 /// project.
8886 pub fn list(&self) -> super::builder::node_templates::List {
8887 super::builder::node_templates::List::new(self.inner.clone())
8888 }
8889
8890 /// Sets the access control policy on the specified resource.
8891 /// Replaces any existing policy.
8892 pub fn set_iam_policy(&self) -> super::builder::node_templates::SetIamPolicy {
8893 super::builder::node_templates::SetIamPolicy::new(self.inner.clone())
8894 }
8895
8896 /// Returns permissions that a caller has on the specified resource.
8897 pub fn test_iam_permissions(&self) -> super::builder::node_templates::TestIamPermissions {
8898 super::builder::node_templates::TestIamPermissions::new(self.inner.clone())
8899 }
8900
8901 /// Retrieves the specified region-specific Operations resource.
8902 pub fn get_operation(&self) -> super::builder::node_templates::GetOperation {
8903 super::builder::node_templates::GetOperation::new(self.inner.clone())
8904 }
8905}
8906
8907/// Implements a client for the Google Compute Engine API.
8908///
8909/// # Example
8910/// ```
8911/// # use google_cloud_compute_v1::client::NodeTypes;
8912/// async fn sample(
8913/// ) -> anyhow::Result<()> {
8914/// let client = NodeTypes::builder().build().await?;
8915/// // use `client` to make requests to the Google Compute Engine API.
8916/// Ok(())
8917/// }
8918/// ```
8919///
8920/// # Service Description
8921///
8922/// Service for the `nodeTypes` resource.
8923///
8924/// # Configuration
8925///
8926/// To configure `NodeTypes` use the `with_*` methods in the type returned
8927/// by [builder()][NodeTypes::builder]. The default configuration should
8928/// work for most applications. Common configuration changes include
8929///
8930/// * [with_endpoint()]: by default this client uses the global default endpoint
8931/// (`https://compute.googleapis.com`). Applications using regional
8932/// endpoints or running in restricted networks (e.g. a network configured
8933/// with [Private Google Access with VPC Service Controls]) may want to
8934/// override this default.
8935/// * [with_credentials()]: by default this client uses
8936/// [Application Default Credentials]. Applications using custom
8937/// authentication may need to override this default.
8938///
8939/// [with_endpoint()]: super::builder::node_types::ClientBuilder::with_endpoint
8940/// [with_credentials()]: super::builder::node_types::ClientBuilder::with_credentials
8941/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8942/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8943///
8944/// # Pooling and Cloning
8945///
8946/// `NodeTypes` holds a connection pool internally, it is advised to
8947/// create one and reuse it. You do not need to wrap `NodeTypes` in
8948/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8949/// already uses an `Arc` internally.
8950#[cfg(feature = "node-types")]
8951#[cfg_attr(docsrs, doc(cfg(feature = "node-types")))]
8952#[derive(Clone, Debug)]
8953pub struct NodeTypes {
8954 inner: std::sync::Arc<dyn super::stub::dynamic::NodeTypes>,
8955}
8956
8957#[cfg(feature = "node-types")]
8958impl NodeTypes {
8959 /// Returns a builder for [NodeTypes].
8960 ///
8961 /// ```
8962 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
8963 /// # use google_cloud_compute_v1::client::NodeTypes;
8964 /// let client = NodeTypes::builder().build().await?;
8965 /// # Ok(()) }
8966 /// ```
8967 pub fn builder() -> super::builder::node_types::ClientBuilder {
8968 crate::new_client_builder(super::builder::node_types::client::Factory)
8969 }
8970
8971 /// Creates a new client from the provided stub.
8972 ///
8973 /// The most common case for calling this function is in tests mocking the
8974 /// client's behavior.
8975 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
8976 where
8977 T: super::stub::NodeTypes + 'static,
8978 {
8979 Self { inner: stub.into() }
8980 }
8981
8982 pub(crate) async fn new(
8983 config: gaxi::options::ClientConfig,
8984 ) -> crate::ClientBuilderResult<Self> {
8985 let inner = Self::build_inner(config).await?;
8986 Ok(Self { inner })
8987 }
8988
8989 async fn build_inner(
8990 conf: gaxi::options::ClientConfig,
8991 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::NodeTypes>> {
8992 if gaxi::options::tracing_enabled(&conf) {
8993 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8994 }
8995 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8996 }
8997
8998 async fn build_transport(
8999 conf: gaxi::options::ClientConfig,
9000 ) -> crate::ClientBuilderResult<impl super::stub::NodeTypes> {
9001 super::transport::NodeTypes::new(conf).await
9002 }
9003
9004 async fn build_with_tracing(
9005 conf: gaxi::options::ClientConfig,
9006 ) -> crate::ClientBuilderResult<impl super::stub::NodeTypes> {
9007 Self::build_transport(conf)
9008 .await
9009 .map(super::tracing::NodeTypes::new)
9010 }
9011
9012 /// Retrieves an aggregated list of node types.
9013 ///
9014 /// To prevent failure, Google recommends that you set the
9015 /// `returnPartialSuccess` parameter to `true`.
9016 pub fn aggregated_list(&self) -> super::builder::node_types::AggregatedList {
9017 super::builder::node_types::AggregatedList::new(self.inner.clone())
9018 }
9019
9020 /// Returns the specified node type.
9021 pub fn get(&self) -> super::builder::node_types::Get {
9022 super::builder::node_types::Get::new(self.inner.clone())
9023 }
9024
9025 /// Retrieves a list of node types available to the specified
9026 /// project.
9027 pub fn list(&self) -> super::builder::node_types::List {
9028 super::builder::node_types::List::new(self.inner.clone())
9029 }
9030}
9031
9032/// Implements a client for the Google Compute Engine API.
9033///
9034/// # Example
9035/// ```
9036/// # use google_cloud_compute_v1::client::OrganizationSecurityPolicies;
9037/// async fn sample(
9038/// ) -> anyhow::Result<()> {
9039/// let client = OrganizationSecurityPolicies::builder().build().await?;
9040/// // use `client` to make requests to the Google Compute Engine API.
9041/// Ok(())
9042/// }
9043/// ```
9044///
9045/// # Service Description
9046///
9047/// Service for the `organizationSecurityPolicies` resource.
9048///
9049/// # Configuration
9050///
9051/// To configure `OrganizationSecurityPolicies` use the `with_*` methods in the type returned
9052/// by [builder()][OrganizationSecurityPolicies::builder]. The default configuration should
9053/// work for most applications. Common configuration changes include
9054///
9055/// * [with_endpoint()]: by default this client uses the global default endpoint
9056/// (`https://compute.googleapis.com`). Applications using regional
9057/// endpoints or running in restricted networks (e.g. a network configured
9058/// with [Private Google Access with VPC Service Controls]) may want to
9059/// override this default.
9060/// * [with_credentials()]: by default this client uses
9061/// [Application Default Credentials]. Applications using custom
9062/// authentication may need to override this default.
9063///
9064/// [with_endpoint()]: super::builder::organization_security_policies::ClientBuilder::with_endpoint
9065/// [with_credentials()]: super::builder::organization_security_policies::ClientBuilder::with_credentials
9066/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9067/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9068///
9069/// # Pooling and Cloning
9070///
9071/// `OrganizationSecurityPolicies` holds a connection pool internally, it is advised to
9072/// create one and reuse it. You do not need to wrap `OrganizationSecurityPolicies` in
9073/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9074/// already uses an `Arc` internally.
9075#[cfg(feature = "organization-security-policies")]
9076#[cfg_attr(docsrs, doc(cfg(feature = "organization-security-policies")))]
9077#[derive(Clone, Debug)]
9078pub struct OrganizationSecurityPolicies {
9079 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityPolicies>,
9080}
9081
9082#[cfg(feature = "organization-security-policies")]
9083impl OrganizationSecurityPolicies {
9084 /// Returns a builder for [OrganizationSecurityPolicies].
9085 ///
9086 /// ```
9087 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9088 /// # use google_cloud_compute_v1::client::OrganizationSecurityPolicies;
9089 /// let client = OrganizationSecurityPolicies::builder().build().await?;
9090 /// # Ok(()) }
9091 /// ```
9092 pub fn builder() -> super::builder::organization_security_policies::ClientBuilder {
9093 crate::new_client_builder(super::builder::organization_security_policies::client::Factory)
9094 }
9095
9096 /// Creates a new client from the provided stub.
9097 ///
9098 /// The most common case for calling this function is in tests mocking the
9099 /// client's behavior.
9100 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9101 where
9102 T: super::stub::OrganizationSecurityPolicies + 'static,
9103 {
9104 Self { inner: stub.into() }
9105 }
9106
9107 pub(crate) async fn new(
9108 config: gaxi::options::ClientConfig,
9109 ) -> crate::ClientBuilderResult<Self> {
9110 let inner = Self::build_inner(config).await?;
9111 Ok(Self { inner })
9112 }
9113
9114 async fn build_inner(
9115 conf: gaxi::options::ClientConfig,
9116 ) -> crate::ClientBuilderResult<
9117 std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityPolicies>,
9118 > {
9119 if gaxi::options::tracing_enabled(&conf) {
9120 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9121 }
9122 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9123 }
9124
9125 async fn build_transport(
9126 conf: gaxi::options::ClientConfig,
9127 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityPolicies> {
9128 super::transport::OrganizationSecurityPolicies::new(conf).await
9129 }
9130
9131 async fn build_with_tracing(
9132 conf: gaxi::options::ClientConfig,
9133 ) -> crate::ClientBuilderResult<impl super::stub::OrganizationSecurityPolicies> {
9134 Self::build_transport(conf)
9135 .await
9136 .map(super::tracing::OrganizationSecurityPolicies::new)
9137 }
9138
9139 /// Inserts an association for the specified security policy.
9140 ///
9141 /// This has billing implications. Projects in the hierarchy with effective
9142 /// hierarchical security policies will be automatically enrolled into Cloud
9143 /// Armor Enterprise if not already enrolled.
9144 ///
9145 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9146 /// versions of this API were used to modify firewall policies. This usage is
9147 /// now disabled for most organizations. Use firewallPolicies.addAssociation
9148 /// instead.
9149 pub fn add_association(
9150 &self,
9151 ) -> super::builder::organization_security_policies::AddAssociation {
9152 super::builder::organization_security_policies::AddAssociation::new(self.inner.clone())
9153 }
9154
9155 /// Inserts a rule into a security policy.
9156 ///
9157 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9158 /// versions of this API were used to modify firewall policies. This usage is
9159 /// now disabled for most organizations. Use firewallPolicies.addRule instead.
9160 pub fn add_rule(&self) -> super::builder::organization_security_policies::AddRule {
9161 super::builder::organization_security_policies::AddRule::new(self.inner.clone())
9162 }
9163
9164 /// Copies rules to the specified security policy.
9165 ///
9166 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9167 /// versions of this API were used to modify firewall policies. This usage is
9168 /// now disabled for most organizations. Use firewallPolicies.cloneRules
9169 /// instead.
9170 pub fn copy_rules(&self) -> super::builder::organization_security_policies::CopyRules {
9171 super::builder::organization_security_policies::CopyRules::new(self.inner.clone())
9172 }
9173
9174 /// Deletes the specified policy.
9175 ///
9176 /// Use this API to remove Cloud Armor policies. Previously, alpha and beta
9177 /// versions of this API were used to remove firewall policies. This usage is
9178 /// now disabled for most organizations. Use firewallPolicies.delete instead.
9179 pub fn delete(&self) -> super::builder::organization_security_policies::Delete {
9180 super::builder::organization_security_policies::Delete::new(self.inner.clone())
9181 }
9182
9183 /// List all of the ordered rules present in a single specified policy.
9184 ///
9185 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9186 /// versions of this API were used to read firewall policies. This usage is now
9187 /// disabled for most organizations. Use firewallPolicies.get instead.
9188 pub fn get(&self) -> super::builder::organization_security_policies::Get {
9189 super::builder::organization_security_policies::Get::new(self.inner.clone())
9190 }
9191
9192 /// Gets an association with the specified name.
9193 ///
9194 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9195 /// versions of this API were used to read firewall policies. This usage is
9196 /// now disabled for most organizations. Use firewallPolicies.getAssociation
9197 /// instead.
9198 pub fn get_association(
9199 &self,
9200 ) -> super::builder::organization_security_policies::GetAssociation {
9201 super::builder::organization_security_policies::GetAssociation::new(self.inner.clone())
9202 }
9203
9204 /// Gets a rule at the specified priority.
9205 ///
9206 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9207 /// versions of this API were used to read firewall policies. This usage is now
9208 /// disabled for most organizations. Use firewallPolicies.getRule instead.
9209 pub fn get_rule(&self) -> super::builder::organization_security_policies::GetRule {
9210 super::builder::organization_security_policies::GetRule::new(self.inner.clone())
9211 }
9212
9213 /// Creates a new policy in the specified organization using the data included
9214 /// in the request.
9215 ///
9216 /// Use this API to add Cloud Armor policies. Previously, alpha and beta
9217 /// versions of this API were used to add firewall policies. This usage is now
9218 /// disabled for most organizations. Use firewallPolicies.insert instead.
9219 pub fn insert(&self) -> super::builder::organization_security_policies::Insert {
9220 super::builder::organization_security_policies::Insert::new(self.inner.clone())
9221 }
9222
9223 /// List all the policies that have been configured for the specified
9224 /// organization.
9225 ///
9226 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9227 /// versions of this API were used to read firewall policies. This usage is now
9228 /// disabled for most organizations. Use firewallPolicies.list instead.
9229 pub fn list(&self) -> super::builder::organization_security_policies::List {
9230 super::builder::organization_security_policies::List::new(self.inner.clone())
9231 }
9232
9233 /// Lists associations of a specified target, i.e., organization or folder.
9234 ///
9235 /// Use this API to read Cloud Armor policies. Previously, alpha and beta
9236 /// versions of this API were used to read firewall policies. This usage is
9237 /// now disabled for most organizations. Use firewallPolicies.listAssociations
9238 /// instead.
9239 pub fn list_associations(
9240 &self,
9241 ) -> super::builder::organization_security_policies::ListAssociations {
9242 super::builder::organization_security_policies::ListAssociations::new(self.inner.clone())
9243 }
9244
9245 /// Gets the current list of preconfigured Web Application Firewall (WAF)
9246 /// expressions.
9247 pub fn list_preconfigured_expression_sets(
9248 &self,
9249 ) -> super::builder::organization_security_policies::ListPreconfiguredExpressionSets {
9250 super::builder::organization_security_policies::ListPreconfiguredExpressionSets::new(
9251 self.inner.clone(),
9252 )
9253 }
9254
9255 /// Moves the specified security policy.
9256 ///
9257 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9258 /// versions of this API were used to modify firewall policies. This usage is
9259 /// now disabled for most organizations. Use firewallPolicies.move instead.
9260 pub fn r#move(&self) -> super::builder::organization_security_policies::Move {
9261 super::builder::organization_security_policies::Move::new(self.inner.clone())
9262 }
9263
9264 /// Patches the specified policy with the data included in the request.
9265 ///
9266 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9267 /// versions of this API were used to modify firewall policies. This usage is
9268 /// now disabled for most organizations. Use firewallPolicies.patch instead.
9269 pub fn patch(&self) -> super::builder::organization_security_policies::Patch {
9270 super::builder::organization_security_policies::Patch::new(self.inner.clone())
9271 }
9272
9273 /// Patches a rule at the specified priority.
9274 ///
9275 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9276 /// versions of this API were used to modify firewall policies. This usage is
9277 /// now disabled for most organizations. Use firewallPolicies.patchRule
9278 /// instead.
9279 pub fn patch_rule(&self) -> super::builder::organization_security_policies::PatchRule {
9280 super::builder::organization_security_policies::PatchRule::new(self.inner.clone())
9281 }
9282
9283 /// Removes an association for the specified security policy.
9284 ///
9285 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9286 /// versions of this API were used to modify firewall policies. This usage is
9287 /// now disabled for most organizations. Use firewallPolicies.removeAssociation
9288 /// instead.
9289 pub fn remove_association(
9290 &self,
9291 ) -> super::builder::organization_security_policies::RemoveAssociation {
9292 super::builder::organization_security_policies::RemoveAssociation::new(self.inner.clone())
9293 }
9294
9295 /// Deletes a rule at the specified priority.
9296 ///
9297 /// Use this API to modify Cloud Armor policies. Previously, alpha and beta
9298 /// versions of this API were used to modify firewall policies. This usage is
9299 /// now disabled for most organizations. Use firewallPolicies.removeRule
9300 /// instead.
9301 pub fn remove_rule(&self) -> super::builder::organization_security_policies::RemoveRule {
9302 super::builder::organization_security_policies::RemoveRule::new(self.inner.clone())
9303 }
9304
9305 /// Retrieves the specified Operations resource. Gets a list of operations
9306 /// by making a `list()` request.
9307 pub fn get_operation(&self) -> super::builder::organization_security_policies::GetOperation {
9308 super::builder::organization_security_policies::GetOperation::new(self.inner.clone())
9309 }
9310}
9311
9312/// Implements a client for the Google Compute Engine API.
9313///
9314/// # Example
9315/// ```
9316/// # use google_cloud_compute_v1::client::PacketMirrorings;
9317/// async fn sample(
9318/// ) -> anyhow::Result<()> {
9319/// let client = PacketMirrorings::builder().build().await?;
9320/// // use `client` to make requests to the Google Compute Engine API.
9321/// Ok(())
9322/// }
9323/// ```
9324///
9325/// # Service Description
9326///
9327/// Service for the `packetMirrorings` resource.
9328///
9329/// # Configuration
9330///
9331/// To configure `PacketMirrorings` use the `with_*` methods in the type returned
9332/// by [builder()][PacketMirrorings::builder]. The default configuration should
9333/// work for most applications. Common configuration changes include
9334///
9335/// * [with_endpoint()]: by default this client uses the global default endpoint
9336/// (`https://compute.googleapis.com`). Applications using regional
9337/// endpoints or running in restricted networks (e.g. a network configured
9338/// with [Private Google Access with VPC Service Controls]) may want to
9339/// override this default.
9340/// * [with_credentials()]: by default this client uses
9341/// [Application Default Credentials]. Applications using custom
9342/// authentication may need to override this default.
9343///
9344/// [with_endpoint()]: super::builder::packet_mirrorings::ClientBuilder::with_endpoint
9345/// [with_credentials()]: super::builder::packet_mirrorings::ClientBuilder::with_credentials
9346/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9347/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9348///
9349/// # Pooling and Cloning
9350///
9351/// `PacketMirrorings` holds a connection pool internally, it is advised to
9352/// create one and reuse it. You do not need to wrap `PacketMirrorings` in
9353/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9354/// already uses an `Arc` internally.
9355#[cfg(feature = "packet-mirrorings")]
9356#[cfg_attr(docsrs, doc(cfg(feature = "packet-mirrorings")))]
9357#[derive(Clone, Debug)]
9358pub struct PacketMirrorings {
9359 inner: std::sync::Arc<dyn super::stub::dynamic::PacketMirrorings>,
9360}
9361
9362#[cfg(feature = "packet-mirrorings")]
9363impl PacketMirrorings {
9364 /// Returns a builder for [PacketMirrorings].
9365 ///
9366 /// ```
9367 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9368 /// # use google_cloud_compute_v1::client::PacketMirrorings;
9369 /// let client = PacketMirrorings::builder().build().await?;
9370 /// # Ok(()) }
9371 /// ```
9372 pub fn builder() -> super::builder::packet_mirrorings::ClientBuilder {
9373 crate::new_client_builder(super::builder::packet_mirrorings::client::Factory)
9374 }
9375
9376 /// Creates a new client from the provided stub.
9377 ///
9378 /// The most common case for calling this function is in tests mocking the
9379 /// client's behavior.
9380 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9381 where
9382 T: super::stub::PacketMirrorings + 'static,
9383 {
9384 Self { inner: stub.into() }
9385 }
9386
9387 pub(crate) async fn new(
9388 config: gaxi::options::ClientConfig,
9389 ) -> crate::ClientBuilderResult<Self> {
9390 let inner = Self::build_inner(config).await?;
9391 Ok(Self { inner })
9392 }
9393
9394 async fn build_inner(
9395 conf: gaxi::options::ClientConfig,
9396 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PacketMirrorings>>
9397 {
9398 if gaxi::options::tracing_enabled(&conf) {
9399 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9400 }
9401 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9402 }
9403
9404 async fn build_transport(
9405 conf: gaxi::options::ClientConfig,
9406 ) -> crate::ClientBuilderResult<impl super::stub::PacketMirrorings> {
9407 super::transport::PacketMirrorings::new(conf).await
9408 }
9409
9410 async fn build_with_tracing(
9411 conf: gaxi::options::ClientConfig,
9412 ) -> crate::ClientBuilderResult<impl super::stub::PacketMirrorings> {
9413 Self::build_transport(conf)
9414 .await
9415 .map(super::tracing::PacketMirrorings::new)
9416 }
9417
9418 /// Retrieves an aggregated list of packetMirrorings.
9419 ///
9420 /// To prevent failure, Google recommends that you set the
9421 /// `returnPartialSuccess` parameter to `true`.
9422 pub fn aggregated_list(&self) -> super::builder::packet_mirrorings::AggregatedList {
9423 super::builder::packet_mirrorings::AggregatedList::new(self.inner.clone())
9424 }
9425
9426 /// Deletes the specified PacketMirroring resource.
9427 pub fn delete(&self) -> super::builder::packet_mirrorings::Delete {
9428 super::builder::packet_mirrorings::Delete::new(self.inner.clone())
9429 }
9430
9431 /// Returns the specified PacketMirroring resource.
9432 pub fn get(&self) -> super::builder::packet_mirrorings::Get {
9433 super::builder::packet_mirrorings::Get::new(self.inner.clone())
9434 }
9435
9436 /// Creates a PacketMirroring resource in the specified project and region
9437 /// using the data included in the request.
9438 pub fn insert(&self) -> super::builder::packet_mirrorings::Insert {
9439 super::builder::packet_mirrorings::Insert::new(self.inner.clone())
9440 }
9441
9442 /// Retrieves a list of PacketMirroring resources available to the specified
9443 /// project and region.
9444 pub fn list(&self) -> super::builder::packet_mirrorings::List {
9445 super::builder::packet_mirrorings::List::new(self.inner.clone())
9446 }
9447
9448 /// Patches the specified PacketMirroring resource with the data included in
9449 /// the request. This method supportsPATCH
9450 /// semantics and usesJSON merge
9451 /// patch format and processing rules.
9452 pub fn patch(&self) -> super::builder::packet_mirrorings::Patch {
9453 super::builder::packet_mirrorings::Patch::new(self.inner.clone())
9454 }
9455
9456 /// Returns permissions that a caller has on the specified resource.
9457 pub fn test_iam_permissions(&self) -> super::builder::packet_mirrorings::TestIamPermissions {
9458 super::builder::packet_mirrorings::TestIamPermissions::new(self.inner.clone())
9459 }
9460
9461 /// Retrieves the specified region-specific Operations resource.
9462 pub fn get_operation(&self) -> super::builder::packet_mirrorings::GetOperation {
9463 super::builder::packet_mirrorings::GetOperation::new(self.inner.clone())
9464 }
9465}
9466
9467/// Implements a client for the Google Compute Engine API.
9468///
9469/// # Example
9470/// ```
9471/// # use google_cloud_compute_v1::client::PreviewFeatures;
9472/// async fn sample(
9473/// ) -> anyhow::Result<()> {
9474/// let client = PreviewFeatures::builder().build().await?;
9475/// // use `client` to make requests to the Google Compute Engine API.
9476/// Ok(())
9477/// }
9478/// ```
9479///
9480/// # Service Description
9481///
9482/// Service for the `previewFeatures` resource.
9483///
9484/// # Configuration
9485///
9486/// To configure `PreviewFeatures` use the `with_*` methods in the type returned
9487/// by [builder()][PreviewFeatures::builder]. The default configuration should
9488/// work for most applications. Common configuration changes include
9489///
9490/// * [with_endpoint()]: by default this client uses the global default endpoint
9491/// (`https://compute.googleapis.com`). Applications using regional
9492/// endpoints or running in restricted networks (e.g. a network configured
9493/// with [Private Google Access with VPC Service Controls]) may want to
9494/// override this default.
9495/// * [with_credentials()]: by default this client uses
9496/// [Application Default Credentials]. Applications using custom
9497/// authentication may need to override this default.
9498///
9499/// [with_endpoint()]: super::builder::preview_features::ClientBuilder::with_endpoint
9500/// [with_credentials()]: super::builder::preview_features::ClientBuilder::with_credentials
9501/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9502/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9503///
9504/// # Pooling and Cloning
9505///
9506/// `PreviewFeatures` holds a connection pool internally, it is advised to
9507/// create one and reuse it. You do not need to wrap `PreviewFeatures` in
9508/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9509/// already uses an `Arc` internally.
9510#[cfg(feature = "preview-features")]
9511#[cfg_attr(docsrs, doc(cfg(feature = "preview-features")))]
9512#[derive(Clone, Debug)]
9513pub struct PreviewFeatures {
9514 inner: std::sync::Arc<dyn super::stub::dynamic::PreviewFeatures>,
9515}
9516
9517#[cfg(feature = "preview-features")]
9518impl PreviewFeatures {
9519 /// Returns a builder for [PreviewFeatures].
9520 ///
9521 /// ```
9522 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9523 /// # use google_cloud_compute_v1::client::PreviewFeatures;
9524 /// let client = PreviewFeatures::builder().build().await?;
9525 /// # Ok(()) }
9526 /// ```
9527 pub fn builder() -> super::builder::preview_features::ClientBuilder {
9528 crate::new_client_builder(super::builder::preview_features::client::Factory)
9529 }
9530
9531 /// Creates a new client from the provided stub.
9532 ///
9533 /// The most common case for calling this function is in tests mocking the
9534 /// client's behavior.
9535 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9536 where
9537 T: super::stub::PreviewFeatures + 'static,
9538 {
9539 Self { inner: stub.into() }
9540 }
9541
9542 pub(crate) async fn new(
9543 config: gaxi::options::ClientConfig,
9544 ) -> crate::ClientBuilderResult<Self> {
9545 let inner = Self::build_inner(config).await?;
9546 Ok(Self { inner })
9547 }
9548
9549 async fn build_inner(
9550 conf: gaxi::options::ClientConfig,
9551 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PreviewFeatures>> {
9552 if gaxi::options::tracing_enabled(&conf) {
9553 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9554 }
9555 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9556 }
9557
9558 async fn build_transport(
9559 conf: gaxi::options::ClientConfig,
9560 ) -> crate::ClientBuilderResult<impl super::stub::PreviewFeatures> {
9561 super::transport::PreviewFeatures::new(conf).await
9562 }
9563
9564 async fn build_with_tracing(
9565 conf: gaxi::options::ClientConfig,
9566 ) -> crate::ClientBuilderResult<impl super::stub::PreviewFeatures> {
9567 Self::build_transport(conf)
9568 .await
9569 .map(super::tracing::PreviewFeatures::new)
9570 }
9571
9572 /// Returns the details of the given PreviewFeature.
9573 pub fn get(&self) -> super::builder::preview_features::Get {
9574 super::builder::preview_features::Get::new(self.inner.clone())
9575 }
9576
9577 /// Returns the details of the given PreviewFeature.
9578 pub fn list(&self) -> super::builder::preview_features::List {
9579 super::builder::preview_features::List::new(self.inner.clone())
9580 }
9581
9582 /// Patches the given PreviewFeature. This method is used to enable or disable
9583 /// a PreviewFeature.
9584 pub fn update(&self) -> super::builder::preview_features::Update {
9585 super::builder::preview_features::Update::new(self.inner.clone())
9586 }
9587
9588 /// Retrieves the specified Operations resource.
9589 pub fn get_operation(&self) -> super::builder::preview_features::GetOperation {
9590 super::builder::preview_features::GetOperation::new(self.inner.clone())
9591 }
9592}
9593
9594/// Implements a client for the Google Compute Engine API.
9595///
9596/// # Example
9597/// ```
9598/// # use google_cloud_compute_v1::client::Projects;
9599/// async fn sample(
9600/// ) -> anyhow::Result<()> {
9601/// let client = Projects::builder().build().await?;
9602/// // use `client` to make requests to the Google Compute Engine API.
9603/// Ok(())
9604/// }
9605/// ```
9606///
9607/// # Service Description
9608///
9609/// Service for the `projects` resource.
9610///
9611/// # Configuration
9612///
9613/// To configure `Projects` use the `with_*` methods in the type returned
9614/// by [builder()][Projects::builder]. The default configuration should
9615/// work for most applications. Common configuration changes include
9616///
9617/// * [with_endpoint()]: by default this client uses the global default endpoint
9618/// (`https://compute.googleapis.com`). Applications using regional
9619/// endpoints or running in restricted networks (e.g. a network configured
9620/// with [Private Google Access with VPC Service Controls]) may want to
9621/// override this default.
9622/// * [with_credentials()]: by default this client uses
9623/// [Application Default Credentials]. Applications using custom
9624/// authentication may need to override this default.
9625///
9626/// [with_endpoint()]: super::builder::projects::ClientBuilder::with_endpoint
9627/// [with_credentials()]: super::builder::projects::ClientBuilder::with_credentials
9628/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9629/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9630///
9631/// # Pooling and Cloning
9632///
9633/// `Projects` holds a connection pool internally, it is advised to
9634/// create one and reuse it. You do not need to wrap `Projects` in
9635/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9636/// already uses an `Arc` internally.
9637#[cfg(feature = "projects")]
9638#[cfg_attr(docsrs, doc(cfg(feature = "projects")))]
9639#[derive(Clone, Debug)]
9640pub struct Projects {
9641 inner: std::sync::Arc<dyn super::stub::dynamic::Projects>,
9642}
9643
9644#[cfg(feature = "projects")]
9645impl Projects {
9646 /// Returns a builder for [Projects].
9647 ///
9648 /// ```
9649 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9650 /// # use google_cloud_compute_v1::client::Projects;
9651 /// let client = Projects::builder().build().await?;
9652 /// # Ok(()) }
9653 /// ```
9654 pub fn builder() -> super::builder::projects::ClientBuilder {
9655 crate::new_client_builder(super::builder::projects::client::Factory)
9656 }
9657
9658 /// Creates a new client from the provided stub.
9659 ///
9660 /// The most common case for calling this function is in tests mocking the
9661 /// client's behavior.
9662 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9663 where
9664 T: super::stub::Projects + 'static,
9665 {
9666 Self { inner: stub.into() }
9667 }
9668
9669 pub(crate) async fn new(
9670 config: gaxi::options::ClientConfig,
9671 ) -> crate::ClientBuilderResult<Self> {
9672 let inner = Self::build_inner(config).await?;
9673 Ok(Self { inner })
9674 }
9675
9676 async fn build_inner(
9677 conf: gaxi::options::ClientConfig,
9678 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Projects>> {
9679 if gaxi::options::tracing_enabled(&conf) {
9680 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9681 }
9682 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9683 }
9684
9685 async fn build_transport(
9686 conf: gaxi::options::ClientConfig,
9687 ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
9688 super::transport::Projects::new(conf).await
9689 }
9690
9691 async fn build_with_tracing(
9692 conf: gaxi::options::ClientConfig,
9693 ) -> crate::ClientBuilderResult<impl super::stub::Projects> {
9694 Self::build_transport(conf)
9695 .await
9696 .map(super::tracing::Projects::new)
9697 }
9698
9699 /// Disable this project as a shared VPC host project.
9700 pub fn disable_xpn_host(&self) -> super::builder::projects::DisableXpnHost {
9701 super::builder::projects::DisableXpnHost::new(self.inner.clone())
9702 }
9703
9704 /// Disable a service resource (also known as service project) associated with
9705 /// this host project.
9706 pub fn disable_xpn_resource(&self) -> super::builder::projects::DisableXpnResource {
9707 super::builder::projects::DisableXpnResource::new(self.inner.clone())
9708 }
9709
9710 /// Enable this project as a shared VPC host project.
9711 pub fn enable_xpn_host(&self) -> super::builder::projects::EnableXpnHost {
9712 super::builder::projects::EnableXpnHost::new(self.inner.clone())
9713 }
9714
9715 /// Enable service resource (a.k.a service project) for a host project, so that
9716 /// subnets in the host project can be used by instances in the service
9717 /// project.
9718 pub fn enable_xpn_resource(&self) -> super::builder::projects::EnableXpnResource {
9719 super::builder::projects::EnableXpnResource::new(self.inner.clone())
9720 }
9721
9722 /// Returns the specified Project resource.
9723 ///
9724 /// To decrease latency for this method, you can optionally omit any unneeded
9725 /// information from the response by using a field mask. This practice is
9726 /// especially recommended for unused quota information (the `quotas` field).
9727 /// To exclude one or more fields, set your request's `fields` query parameter
9728 /// to only include the fields you need. For example, to only include the `id`
9729 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
9730 /// your request.
9731 pub fn get(&self) -> super::builder::projects::Get {
9732 super::builder::projects::Get::new(self.inner.clone())
9733 }
9734
9735 /// Gets the shared VPC host project that this project links to. May be empty
9736 /// if no link exists.
9737 pub fn get_xpn_host(&self) -> super::builder::projects::GetXpnHost {
9738 super::builder::projects::GetXpnHost::new(self.inner.clone())
9739 }
9740
9741 /// Gets service resources (a.k.a service project) associated with this host
9742 /// project.
9743 pub fn get_xpn_resources(&self) -> super::builder::projects::GetXpnResources {
9744 super::builder::projects::GetXpnResources::new(self.inner.clone())
9745 }
9746
9747 /// Lists all shared VPC host projects visible to the user in an organization.
9748 pub fn list_xpn_hosts(&self) -> super::builder::projects::ListXpnHosts {
9749 super::builder::projects::ListXpnHosts::new(self.inner.clone())
9750 }
9751
9752 /// Moves a persistent disk from one zone to another.
9753 /// *Note*: The moveDisk API will be deprecated on September 29, 2026.
9754 ///
9755 /// Starting September 29, 2025, you can't use the moveDisk API on new
9756 /// projects. To move a disk to a different region or zone, follow the steps in
9757 /// [Change the location of a
9758 /// disk](https://cloud.google.com/compute/docs/disks/migrate-to-hyperdisk#migrate-to-hd).
9759 ///
9760 /// Projects that already use the moveDisk API can continue usage until
9761 /// September 29, 2026.
9762 ///
9763 /// Starting November 1, 2025, API responses will include a warning message in
9764 /// the response body about the upcoming deprecation. You can skip the message
9765 /// to continue using the service without interruption.
9766 #[deprecated]
9767 pub fn move_disk(&self) -> super::builder::projects::MoveDisk {
9768 super::builder::projects::MoveDisk::new(self.inner.clone())
9769 }
9770
9771 /// Moves an instance and its attached persistent disks from one zone to
9772 /// another.
9773 /// *Note*: Moving VMs or disks by using this method might
9774 /// cause unexpected behavior. For more information, see the [known
9775 /// issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior).
9776 /// [Deprecated] This method is deprecated. See [moving instance across
9777 /// zones](/compute/docs/instances/moving-instance-across-zones) instead.
9778 #[deprecated]
9779 pub fn move_instance(&self) -> super::builder::projects::MoveInstance {
9780 super::builder::projects::MoveInstance::new(self.inner.clone())
9781 }
9782
9783 /// Sets the Cloud Armor tier of the project. To set ENTERPRISE or above the
9784 /// billing account of the project must be subscribed to Cloud Armor
9785 /// Enterprise. See Subscribing
9786 /// to Cloud Armor Enterprise for more information.
9787 pub fn set_cloud_armor_tier(&self) -> super::builder::projects::SetCloudArmorTier {
9788 super::builder::projects::SetCloudArmorTier::new(self.inner.clone())
9789 }
9790
9791 /// Sets metadata common to all instances within the specified project using
9792 /// the data included in the request.
9793 pub fn set_common_instance_metadata(
9794 &self,
9795 ) -> super::builder::projects::SetCommonInstanceMetadata {
9796 super::builder::projects::SetCommonInstanceMetadata::new(self.inner.clone())
9797 }
9798
9799 /// Sets the default network tier of the project. The default network tier is
9800 /// used when an address/forwardingRule/instance is created without specifying
9801 /// the network tier field.
9802 pub fn set_default_network_tier(&self) -> super::builder::projects::SetDefaultNetworkTier {
9803 super::builder::projects::SetDefaultNetworkTier::new(self.inner.clone())
9804 }
9805
9806 /// Enables the usage export feature and sets theusage export bucket
9807 /// where reports are stored. If you provide an empty request body using this
9808 /// method, the usage export feature will be disabled.
9809 pub fn set_usage_export_bucket(&self) -> super::builder::projects::SetUsageExportBucket {
9810 super::builder::projects::SetUsageExportBucket::new(self.inner.clone())
9811 }
9812
9813 /// Retrieves the specified Operations resource.
9814 pub fn get_operation(&self) -> super::builder::projects::GetOperation {
9815 super::builder::projects::GetOperation::new(self.inner.clone())
9816 }
9817}
9818
9819/// Implements a client for the Google Compute Engine API.
9820///
9821/// # Example
9822/// ```
9823/// # use google_cloud_compute_v1::client::PublicAdvertisedPrefixes;
9824/// async fn sample(
9825/// ) -> anyhow::Result<()> {
9826/// let client = PublicAdvertisedPrefixes::builder().build().await?;
9827/// // use `client` to make requests to the Google Compute Engine API.
9828/// Ok(())
9829/// }
9830/// ```
9831///
9832/// # Service Description
9833///
9834/// Service for the `publicAdvertisedPrefixes` resource.
9835///
9836/// # Configuration
9837///
9838/// To configure `PublicAdvertisedPrefixes` use the `with_*` methods in the type returned
9839/// by [builder()][PublicAdvertisedPrefixes::builder]. The default configuration should
9840/// work for most applications. Common configuration changes include
9841///
9842/// * [with_endpoint()]: by default this client uses the global default endpoint
9843/// (`https://compute.googleapis.com`). Applications using regional
9844/// endpoints or running in restricted networks (e.g. a network configured
9845/// with [Private Google Access with VPC Service Controls]) may want to
9846/// override this default.
9847/// * [with_credentials()]: by default this client uses
9848/// [Application Default Credentials]. Applications using custom
9849/// authentication may need to override this default.
9850///
9851/// [with_endpoint()]: super::builder::public_advertised_prefixes::ClientBuilder::with_endpoint
9852/// [with_credentials()]: super::builder::public_advertised_prefixes::ClientBuilder::with_credentials
9853/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9854/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9855///
9856/// # Pooling and Cloning
9857///
9858/// `PublicAdvertisedPrefixes` holds a connection pool internally, it is advised to
9859/// create one and reuse it. You do not need to wrap `PublicAdvertisedPrefixes` in
9860/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9861/// already uses an `Arc` internally.
9862#[cfg(feature = "public-advertised-prefixes")]
9863#[cfg_attr(docsrs, doc(cfg(feature = "public-advertised-prefixes")))]
9864#[derive(Clone, Debug)]
9865pub struct PublicAdvertisedPrefixes {
9866 inner: std::sync::Arc<dyn super::stub::dynamic::PublicAdvertisedPrefixes>,
9867}
9868
9869#[cfg(feature = "public-advertised-prefixes")]
9870impl PublicAdvertisedPrefixes {
9871 /// Returns a builder for [PublicAdvertisedPrefixes].
9872 ///
9873 /// ```
9874 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
9875 /// # use google_cloud_compute_v1::client::PublicAdvertisedPrefixes;
9876 /// let client = PublicAdvertisedPrefixes::builder().build().await?;
9877 /// # Ok(()) }
9878 /// ```
9879 pub fn builder() -> super::builder::public_advertised_prefixes::ClientBuilder {
9880 crate::new_client_builder(super::builder::public_advertised_prefixes::client::Factory)
9881 }
9882
9883 /// Creates a new client from the provided stub.
9884 ///
9885 /// The most common case for calling this function is in tests mocking the
9886 /// client's behavior.
9887 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
9888 where
9889 T: super::stub::PublicAdvertisedPrefixes + 'static,
9890 {
9891 Self { inner: stub.into() }
9892 }
9893
9894 pub(crate) async fn new(
9895 config: gaxi::options::ClientConfig,
9896 ) -> crate::ClientBuilderResult<Self> {
9897 let inner = Self::build_inner(config).await?;
9898 Ok(Self { inner })
9899 }
9900
9901 async fn build_inner(
9902 conf: gaxi::options::ClientConfig,
9903 ) -> crate::ClientBuilderResult<
9904 std::sync::Arc<dyn super::stub::dynamic::PublicAdvertisedPrefixes>,
9905 > {
9906 if gaxi::options::tracing_enabled(&conf) {
9907 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9908 }
9909 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9910 }
9911
9912 async fn build_transport(
9913 conf: gaxi::options::ClientConfig,
9914 ) -> crate::ClientBuilderResult<impl super::stub::PublicAdvertisedPrefixes> {
9915 super::transport::PublicAdvertisedPrefixes::new(conf).await
9916 }
9917
9918 async fn build_with_tracing(
9919 conf: gaxi::options::ClientConfig,
9920 ) -> crate::ClientBuilderResult<impl super::stub::PublicAdvertisedPrefixes> {
9921 Self::build_transport(conf)
9922 .await
9923 .map(super::tracing::PublicAdvertisedPrefixes::new)
9924 }
9925
9926 /// Announces the specified PublicAdvertisedPrefix
9927 pub fn announce(&self) -> super::builder::public_advertised_prefixes::Announce {
9928 super::builder::public_advertised_prefixes::Announce::new(self.inner.clone())
9929 }
9930
9931 /// Deletes the specified PublicAdvertisedPrefix
9932 pub fn delete(&self) -> super::builder::public_advertised_prefixes::Delete {
9933 super::builder::public_advertised_prefixes::Delete::new(self.inner.clone())
9934 }
9935
9936 /// Returns the specified PublicAdvertisedPrefix resource.
9937 pub fn get(&self) -> super::builder::public_advertised_prefixes::Get {
9938 super::builder::public_advertised_prefixes::Get::new(self.inner.clone())
9939 }
9940
9941 /// Creates a PublicAdvertisedPrefix in the specified project
9942 /// using the parameters that are included in the request.
9943 pub fn insert(&self) -> super::builder::public_advertised_prefixes::Insert {
9944 super::builder::public_advertised_prefixes::Insert::new(self.inner.clone())
9945 }
9946
9947 /// Lists the PublicAdvertisedPrefixes for a project.
9948 pub fn list(&self) -> super::builder::public_advertised_prefixes::List {
9949 super::builder::public_advertised_prefixes::List::new(self.inner.clone())
9950 }
9951
9952 /// Patches the specified Router resource with the data included in the
9953 /// request. This method supportsPATCH
9954 /// semantics and usesJSON merge
9955 /// patch format and processing rules.
9956 pub fn patch(&self) -> super::builder::public_advertised_prefixes::Patch {
9957 super::builder::public_advertised_prefixes::Patch::new(self.inner.clone())
9958 }
9959
9960 /// Withdraws the specified PublicAdvertisedPrefix
9961 pub fn withdraw(&self) -> super::builder::public_advertised_prefixes::Withdraw {
9962 super::builder::public_advertised_prefixes::Withdraw::new(self.inner.clone())
9963 }
9964
9965 /// Retrieves the specified Operations resource.
9966 pub fn get_operation(&self) -> super::builder::public_advertised_prefixes::GetOperation {
9967 super::builder::public_advertised_prefixes::GetOperation::new(self.inner.clone())
9968 }
9969}
9970
9971/// Implements a client for the Google Compute Engine API.
9972///
9973/// # Example
9974/// ```
9975/// # use google_cloud_compute_v1::client::PublicDelegatedPrefixes;
9976/// async fn sample(
9977/// ) -> anyhow::Result<()> {
9978/// let client = PublicDelegatedPrefixes::builder().build().await?;
9979/// // use `client` to make requests to the Google Compute Engine API.
9980/// Ok(())
9981/// }
9982/// ```
9983///
9984/// # Service Description
9985///
9986/// Service for the `publicDelegatedPrefixes` resource.
9987///
9988/// # Configuration
9989///
9990/// To configure `PublicDelegatedPrefixes` use the `with_*` methods in the type returned
9991/// by [builder()][PublicDelegatedPrefixes::builder]. The default configuration should
9992/// work for most applications. Common configuration changes include
9993///
9994/// * [with_endpoint()]: by default this client uses the global default endpoint
9995/// (`https://compute.googleapis.com`). Applications using regional
9996/// endpoints or running in restricted networks (e.g. a network configured
9997/// with [Private Google Access with VPC Service Controls]) may want to
9998/// override this default.
9999/// * [with_credentials()]: by default this client uses
10000/// [Application Default Credentials]. Applications using custom
10001/// authentication may need to override this default.
10002///
10003/// [with_endpoint()]: super::builder::public_delegated_prefixes::ClientBuilder::with_endpoint
10004/// [with_credentials()]: super::builder::public_delegated_prefixes::ClientBuilder::with_credentials
10005/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10006/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10007///
10008/// # Pooling and Cloning
10009///
10010/// `PublicDelegatedPrefixes` holds a connection pool internally, it is advised to
10011/// create one and reuse it. You do not need to wrap `PublicDelegatedPrefixes` in
10012/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10013/// already uses an `Arc` internally.
10014#[cfg(feature = "public-delegated-prefixes")]
10015#[cfg_attr(docsrs, doc(cfg(feature = "public-delegated-prefixes")))]
10016#[derive(Clone, Debug)]
10017pub struct PublicDelegatedPrefixes {
10018 inner: std::sync::Arc<dyn super::stub::dynamic::PublicDelegatedPrefixes>,
10019}
10020
10021#[cfg(feature = "public-delegated-prefixes")]
10022impl PublicDelegatedPrefixes {
10023 /// Returns a builder for [PublicDelegatedPrefixes].
10024 ///
10025 /// ```
10026 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10027 /// # use google_cloud_compute_v1::client::PublicDelegatedPrefixes;
10028 /// let client = PublicDelegatedPrefixes::builder().build().await?;
10029 /// # Ok(()) }
10030 /// ```
10031 pub fn builder() -> super::builder::public_delegated_prefixes::ClientBuilder {
10032 crate::new_client_builder(super::builder::public_delegated_prefixes::client::Factory)
10033 }
10034
10035 /// Creates a new client from the provided stub.
10036 ///
10037 /// The most common case for calling this function is in tests mocking the
10038 /// client's behavior.
10039 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10040 where
10041 T: super::stub::PublicDelegatedPrefixes + 'static,
10042 {
10043 Self { inner: stub.into() }
10044 }
10045
10046 pub(crate) async fn new(
10047 config: gaxi::options::ClientConfig,
10048 ) -> crate::ClientBuilderResult<Self> {
10049 let inner = Self::build_inner(config).await?;
10050 Ok(Self { inner })
10051 }
10052
10053 async fn build_inner(
10054 conf: gaxi::options::ClientConfig,
10055 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::PublicDelegatedPrefixes>>
10056 {
10057 if gaxi::options::tracing_enabled(&conf) {
10058 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10059 }
10060 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10061 }
10062
10063 async fn build_transport(
10064 conf: gaxi::options::ClientConfig,
10065 ) -> crate::ClientBuilderResult<impl super::stub::PublicDelegatedPrefixes> {
10066 super::transport::PublicDelegatedPrefixes::new(conf).await
10067 }
10068
10069 async fn build_with_tracing(
10070 conf: gaxi::options::ClientConfig,
10071 ) -> crate::ClientBuilderResult<impl super::stub::PublicDelegatedPrefixes> {
10072 Self::build_transport(conf)
10073 .await
10074 .map(super::tracing::PublicDelegatedPrefixes::new)
10075 }
10076
10077 /// Lists all PublicDelegatedPrefix resources owned by the specific project
10078 /// across all scopes.
10079 ///
10080 /// To prevent failure, Google recommends that you set the
10081 /// `returnPartialSuccess` parameter to `true`.
10082 pub fn aggregated_list(&self) -> super::builder::public_delegated_prefixes::AggregatedList {
10083 super::builder::public_delegated_prefixes::AggregatedList::new(self.inner.clone())
10084 }
10085
10086 /// Announces the specified PublicDelegatedPrefix in the given region.
10087 pub fn announce(&self) -> super::builder::public_delegated_prefixes::Announce {
10088 super::builder::public_delegated_prefixes::Announce::new(self.inner.clone())
10089 }
10090
10091 /// Deletes the specified PublicDelegatedPrefix in the given region.
10092 pub fn delete(&self) -> super::builder::public_delegated_prefixes::Delete {
10093 super::builder::public_delegated_prefixes::Delete::new(self.inner.clone())
10094 }
10095
10096 /// Returns the specified PublicDelegatedPrefix resource in the given region.
10097 pub fn get(&self) -> super::builder::public_delegated_prefixes::Get {
10098 super::builder::public_delegated_prefixes::Get::new(self.inner.clone())
10099 }
10100
10101 /// Creates a PublicDelegatedPrefix in the specified project in the given
10102 /// region using the parameters that are included in the request.
10103 pub fn insert(&self) -> super::builder::public_delegated_prefixes::Insert {
10104 super::builder::public_delegated_prefixes::Insert::new(self.inner.clone())
10105 }
10106
10107 /// Lists the PublicDelegatedPrefixes for a project in the given region.
10108 pub fn list(&self) -> super::builder::public_delegated_prefixes::List {
10109 super::builder::public_delegated_prefixes::List::new(self.inner.clone())
10110 }
10111
10112 /// Patches the specified PublicDelegatedPrefix resource with the data included
10113 /// in the request. This method supportsPATCH
10114 /// semantics and usesJSON merge
10115 /// patch format and processing rules.
10116 pub fn patch(&self) -> super::builder::public_delegated_prefixes::Patch {
10117 super::builder::public_delegated_prefixes::Patch::new(self.inner.clone())
10118 }
10119
10120 /// Withdraws the specified PublicDelegatedPrefix in the given region.
10121 pub fn withdraw(&self) -> super::builder::public_delegated_prefixes::Withdraw {
10122 super::builder::public_delegated_prefixes::Withdraw::new(self.inner.clone())
10123 }
10124
10125 /// Retrieves the specified region-specific Operations resource.
10126 pub fn get_operation(&self) -> super::builder::public_delegated_prefixes::GetOperation {
10127 super::builder::public_delegated_prefixes::GetOperation::new(self.inner.clone())
10128 }
10129}
10130
10131/// Implements a client for the Google Compute Engine API.
10132///
10133/// # Example
10134/// ```
10135/// # use google_cloud_compute_v1::client::RegionAutoscalers;
10136/// async fn sample(
10137/// ) -> anyhow::Result<()> {
10138/// let client = RegionAutoscalers::builder().build().await?;
10139/// // use `client` to make requests to the Google Compute Engine API.
10140/// Ok(())
10141/// }
10142/// ```
10143///
10144/// # Service Description
10145///
10146/// Service for the `regionAutoscalers` resource.
10147///
10148/// # Configuration
10149///
10150/// To configure `RegionAutoscalers` use the `with_*` methods in the type returned
10151/// by [builder()][RegionAutoscalers::builder]. The default configuration should
10152/// work for most applications. Common configuration changes include
10153///
10154/// * [with_endpoint()]: by default this client uses the global default endpoint
10155/// (`https://compute.googleapis.com`). Applications using regional
10156/// endpoints or running in restricted networks (e.g. a network configured
10157/// with [Private Google Access with VPC Service Controls]) may want to
10158/// override this default.
10159/// * [with_credentials()]: by default this client uses
10160/// [Application Default Credentials]. Applications using custom
10161/// authentication may need to override this default.
10162///
10163/// [with_endpoint()]: super::builder::region_autoscalers::ClientBuilder::with_endpoint
10164/// [with_credentials()]: super::builder::region_autoscalers::ClientBuilder::with_credentials
10165/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10166/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10167///
10168/// # Pooling and Cloning
10169///
10170/// `RegionAutoscalers` holds a connection pool internally, it is advised to
10171/// create one and reuse it. You do not need to wrap `RegionAutoscalers` in
10172/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10173/// already uses an `Arc` internally.
10174#[cfg(feature = "region-autoscalers")]
10175#[cfg_attr(docsrs, doc(cfg(feature = "region-autoscalers")))]
10176#[derive(Clone, Debug)]
10177pub struct RegionAutoscalers {
10178 inner: std::sync::Arc<dyn super::stub::dynamic::RegionAutoscalers>,
10179}
10180
10181#[cfg(feature = "region-autoscalers")]
10182impl RegionAutoscalers {
10183 /// Returns a builder for [RegionAutoscalers].
10184 ///
10185 /// ```
10186 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10187 /// # use google_cloud_compute_v1::client::RegionAutoscalers;
10188 /// let client = RegionAutoscalers::builder().build().await?;
10189 /// # Ok(()) }
10190 /// ```
10191 pub fn builder() -> super::builder::region_autoscalers::ClientBuilder {
10192 crate::new_client_builder(super::builder::region_autoscalers::client::Factory)
10193 }
10194
10195 /// Creates a new client from the provided stub.
10196 ///
10197 /// The most common case for calling this function is in tests mocking the
10198 /// client's behavior.
10199 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10200 where
10201 T: super::stub::RegionAutoscalers + 'static,
10202 {
10203 Self { inner: stub.into() }
10204 }
10205
10206 pub(crate) async fn new(
10207 config: gaxi::options::ClientConfig,
10208 ) -> crate::ClientBuilderResult<Self> {
10209 let inner = Self::build_inner(config).await?;
10210 Ok(Self { inner })
10211 }
10212
10213 async fn build_inner(
10214 conf: gaxi::options::ClientConfig,
10215 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionAutoscalers>>
10216 {
10217 if gaxi::options::tracing_enabled(&conf) {
10218 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10219 }
10220 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10221 }
10222
10223 async fn build_transport(
10224 conf: gaxi::options::ClientConfig,
10225 ) -> crate::ClientBuilderResult<impl super::stub::RegionAutoscalers> {
10226 super::transport::RegionAutoscalers::new(conf).await
10227 }
10228
10229 async fn build_with_tracing(
10230 conf: gaxi::options::ClientConfig,
10231 ) -> crate::ClientBuilderResult<impl super::stub::RegionAutoscalers> {
10232 Self::build_transport(conf)
10233 .await
10234 .map(super::tracing::RegionAutoscalers::new)
10235 }
10236
10237 /// Deletes the specified autoscaler.
10238 pub fn delete(&self) -> super::builder::region_autoscalers::Delete {
10239 super::builder::region_autoscalers::Delete::new(self.inner.clone())
10240 }
10241
10242 /// Returns the specified autoscaler.
10243 pub fn get(&self) -> super::builder::region_autoscalers::Get {
10244 super::builder::region_autoscalers::Get::new(self.inner.clone())
10245 }
10246
10247 /// Creates an autoscaler in the specified project using
10248 /// the data included in the request.
10249 pub fn insert(&self) -> super::builder::region_autoscalers::Insert {
10250 super::builder::region_autoscalers::Insert::new(self.inner.clone())
10251 }
10252
10253 /// Retrieves a list of autoscalers contained within
10254 /// the specified region.
10255 pub fn list(&self) -> super::builder::region_autoscalers::List {
10256 super::builder::region_autoscalers::List::new(self.inner.clone())
10257 }
10258
10259 /// Updates an autoscaler in the specified project using
10260 /// the data included in the request. This method supportsPATCH
10261 /// semantics and uses theJSON merge
10262 /// patch format and processing rules.
10263 pub fn patch(&self) -> super::builder::region_autoscalers::Patch {
10264 super::builder::region_autoscalers::Patch::new(self.inner.clone())
10265 }
10266
10267 /// Returns permissions that a caller has on the specified resource.
10268 pub fn test_iam_permissions(&self) -> super::builder::region_autoscalers::TestIamPermissions {
10269 super::builder::region_autoscalers::TestIamPermissions::new(self.inner.clone())
10270 }
10271
10272 /// Updates an autoscaler in the specified project using
10273 /// the data included in the request.
10274 pub fn update(&self) -> super::builder::region_autoscalers::Update {
10275 super::builder::region_autoscalers::Update::new(self.inner.clone())
10276 }
10277
10278 /// Retrieves the specified region-specific Operations resource.
10279 pub fn get_operation(&self) -> super::builder::region_autoscalers::GetOperation {
10280 super::builder::region_autoscalers::GetOperation::new(self.inner.clone())
10281 }
10282}
10283
10284/// Implements a client for the Google Compute Engine API.
10285///
10286/// # Example
10287/// ```
10288/// # use google_cloud_compute_v1::client::RegionBackendBuckets;
10289/// async fn sample(
10290/// ) -> anyhow::Result<()> {
10291/// let client = RegionBackendBuckets::builder().build().await?;
10292/// // use `client` to make requests to the Google Compute Engine API.
10293/// Ok(())
10294/// }
10295/// ```
10296///
10297/// # Service Description
10298///
10299/// Service for the `regionBackendBuckets` resource.
10300///
10301/// # Configuration
10302///
10303/// To configure `RegionBackendBuckets` use the `with_*` methods in the type returned
10304/// by [builder()][RegionBackendBuckets::builder]. The default configuration should
10305/// work for most applications. Common configuration changes include
10306///
10307/// * [with_endpoint()]: by default this client uses the global default endpoint
10308/// (`https://compute.googleapis.com`). Applications using regional
10309/// endpoints or running in restricted networks (e.g. a network configured
10310/// with [Private Google Access with VPC Service Controls]) may want to
10311/// override this default.
10312/// * [with_credentials()]: by default this client uses
10313/// [Application Default Credentials]. Applications using custom
10314/// authentication may need to override this default.
10315///
10316/// [with_endpoint()]: super::builder::region_backend_buckets::ClientBuilder::with_endpoint
10317/// [with_credentials()]: super::builder::region_backend_buckets::ClientBuilder::with_credentials
10318/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10319/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10320///
10321/// # Pooling and Cloning
10322///
10323/// `RegionBackendBuckets` holds a connection pool internally, it is advised to
10324/// create one and reuse it. You do not need to wrap `RegionBackendBuckets` in
10325/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10326/// already uses an `Arc` internally.
10327#[cfg(feature = "region-backend-buckets")]
10328#[cfg_attr(docsrs, doc(cfg(feature = "region-backend-buckets")))]
10329#[derive(Clone, Debug)]
10330pub struct RegionBackendBuckets {
10331 inner: std::sync::Arc<dyn super::stub::dynamic::RegionBackendBuckets>,
10332}
10333
10334#[cfg(feature = "region-backend-buckets")]
10335impl RegionBackendBuckets {
10336 /// Returns a builder for [RegionBackendBuckets].
10337 ///
10338 /// ```
10339 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10340 /// # use google_cloud_compute_v1::client::RegionBackendBuckets;
10341 /// let client = RegionBackendBuckets::builder().build().await?;
10342 /// # Ok(()) }
10343 /// ```
10344 pub fn builder() -> super::builder::region_backend_buckets::ClientBuilder {
10345 crate::new_client_builder(super::builder::region_backend_buckets::client::Factory)
10346 }
10347
10348 /// Creates a new client from the provided stub.
10349 ///
10350 /// The most common case for calling this function is in tests mocking the
10351 /// client's behavior.
10352 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10353 where
10354 T: super::stub::RegionBackendBuckets + 'static,
10355 {
10356 Self { inner: stub.into() }
10357 }
10358
10359 pub(crate) async fn new(
10360 config: gaxi::options::ClientConfig,
10361 ) -> crate::ClientBuilderResult<Self> {
10362 let inner = Self::build_inner(config).await?;
10363 Ok(Self { inner })
10364 }
10365
10366 async fn build_inner(
10367 conf: gaxi::options::ClientConfig,
10368 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionBackendBuckets>>
10369 {
10370 if gaxi::options::tracing_enabled(&conf) {
10371 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10372 }
10373 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10374 }
10375
10376 async fn build_transport(
10377 conf: gaxi::options::ClientConfig,
10378 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendBuckets> {
10379 super::transport::RegionBackendBuckets::new(conf).await
10380 }
10381
10382 async fn build_with_tracing(
10383 conf: gaxi::options::ClientConfig,
10384 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendBuckets> {
10385 Self::build_transport(conf)
10386 .await
10387 .map(super::tracing::RegionBackendBuckets::new)
10388 }
10389
10390 /// Deletes the specified regional BackendBucket resource.
10391 pub fn delete(&self) -> super::builder::region_backend_buckets::Delete {
10392 super::builder::region_backend_buckets::Delete::new(self.inner.clone())
10393 }
10394
10395 /// Returns the specified regional BackendBucket resource.
10396 pub fn get(&self) -> super::builder::region_backend_buckets::Get {
10397 super::builder::region_backend_buckets::Get::new(self.inner.clone())
10398 }
10399
10400 /// Gets the access control policy for a resource. May be empty if no such
10401 /// policy or resource exists.
10402 pub fn get_iam_policy(&self) -> super::builder::region_backend_buckets::GetIamPolicy {
10403 super::builder::region_backend_buckets::GetIamPolicy::new(self.inner.clone())
10404 }
10405
10406 /// Creates a RegionBackendBucket in the specified project in the given scope
10407 /// using the parameters that are included in the request.
10408 pub fn insert(&self) -> super::builder::region_backend_buckets::Insert {
10409 super::builder::region_backend_buckets::Insert::new(self.inner.clone())
10410 }
10411
10412 /// Retrieves the list of BackendBucket resources available to the specified
10413 /// project in the given region.
10414 pub fn list(&self) -> super::builder::region_backend_buckets::List {
10415 super::builder::region_backend_buckets::List::new(self.inner.clone())
10416 }
10417
10418 /// Retrieves a list of all usable backend buckets in the specified project in
10419 /// the given region.
10420 pub fn list_usable(&self) -> super::builder::region_backend_buckets::ListUsable {
10421 super::builder::region_backend_buckets::ListUsable::new(self.inner.clone())
10422 }
10423
10424 /// Updates the specified BackendBucket resource with the data included in the
10425 /// request. This method supportsPATCH
10426 /// semantics and uses theJSON merge
10427 /// patch format and processing rules.
10428 pub fn patch(&self) -> super::builder::region_backend_buckets::Patch {
10429 super::builder::region_backend_buckets::Patch::new(self.inner.clone())
10430 }
10431
10432 /// Sets the access control policy on the specified resource.
10433 /// Replaces any existing policy.
10434 pub fn set_iam_policy(&self) -> super::builder::region_backend_buckets::SetIamPolicy {
10435 super::builder::region_backend_buckets::SetIamPolicy::new(self.inner.clone())
10436 }
10437
10438 /// Returns permissions that a caller has on the specified resource.
10439 pub fn test_iam_permissions(
10440 &self,
10441 ) -> super::builder::region_backend_buckets::TestIamPermissions {
10442 super::builder::region_backend_buckets::TestIamPermissions::new(self.inner.clone())
10443 }
10444
10445 /// Retrieves the specified region-specific Operations resource.
10446 pub fn get_operation(&self) -> super::builder::region_backend_buckets::GetOperation {
10447 super::builder::region_backend_buckets::GetOperation::new(self.inner.clone())
10448 }
10449}
10450
10451/// Implements a client for the Google Compute Engine API.
10452///
10453/// # Example
10454/// ```
10455/// # use google_cloud_compute_v1::client::RegionBackendServices;
10456/// async fn sample(
10457/// ) -> anyhow::Result<()> {
10458/// let client = RegionBackendServices::builder().build().await?;
10459/// // use `client` to make requests to the Google Compute Engine API.
10460/// Ok(())
10461/// }
10462/// ```
10463///
10464/// # Service Description
10465///
10466/// Service for the `regionBackendServices` resource.
10467///
10468/// # Configuration
10469///
10470/// To configure `RegionBackendServices` use the `with_*` methods in the type returned
10471/// by [builder()][RegionBackendServices::builder]. The default configuration should
10472/// work for most applications. Common configuration changes include
10473///
10474/// * [with_endpoint()]: by default this client uses the global default endpoint
10475/// (`https://compute.googleapis.com`). Applications using regional
10476/// endpoints or running in restricted networks (e.g. a network configured
10477/// with [Private Google Access with VPC Service Controls]) may want to
10478/// override this default.
10479/// * [with_credentials()]: by default this client uses
10480/// [Application Default Credentials]. Applications using custom
10481/// authentication may need to override this default.
10482///
10483/// [with_endpoint()]: super::builder::region_backend_services::ClientBuilder::with_endpoint
10484/// [with_credentials()]: super::builder::region_backend_services::ClientBuilder::with_credentials
10485/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10486/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10487///
10488/// # Pooling and Cloning
10489///
10490/// `RegionBackendServices` holds a connection pool internally, it is advised to
10491/// create one and reuse it. You do not need to wrap `RegionBackendServices` in
10492/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10493/// already uses an `Arc` internally.
10494#[cfg(feature = "region-backend-services")]
10495#[cfg_attr(docsrs, doc(cfg(feature = "region-backend-services")))]
10496#[derive(Clone, Debug)]
10497pub struct RegionBackendServices {
10498 inner: std::sync::Arc<dyn super::stub::dynamic::RegionBackendServices>,
10499}
10500
10501#[cfg(feature = "region-backend-services")]
10502impl RegionBackendServices {
10503 /// Returns a builder for [RegionBackendServices].
10504 ///
10505 /// ```
10506 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10507 /// # use google_cloud_compute_v1::client::RegionBackendServices;
10508 /// let client = RegionBackendServices::builder().build().await?;
10509 /// # Ok(()) }
10510 /// ```
10511 pub fn builder() -> super::builder::region_backend_services::ClientBuilder {
10512 crate::new_client_builder(super::builder::region_backend_services::client::Factory)
10513 }
10514
10515 /// Creates a new client from the provided stub.
10516 ///
10517 /// The most common case for calling this function is in tests mocking the
10518 /// client's behavior.
10519 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10520 where
10521 T: super::stub::RegionBackendServices + 'static,
10522 {
10523 Self { inner: stub.into() }
10524 }
10525
10526 pub(crate) async fn new(
10527 config: gaxi::options::ClientConfig,
10528 ) -> crate::ClientBuilderResult<Self> {
10529 let inner = Self::build_inner(config).await?;
10530 Ok(Self { inner })
10531 }
10532
10533 async fn build_inner(
10534 conf: gaxi::options::ClientConfig,
10535 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionBackendServices>>
10536 {
10537 if gaxi::options::tracing_enabled(&conf) {
10538 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10539 }
10540 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10541 }
10542
10543 async fn build_transport(
10544 conf: gaxi::options::ClientConfig,
10545 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendServices> {
10546 super::transport::RegionBackendServices::new(conf).await
10547 }
10548
10549 async fn build_with_tracing(
10550 conf: gaxi::options::ClientConfig,
10551 ) -> crate::ClientBuilderResult<impl super::stub::RegionBackendServices> {
10552 Self::build_transport(conf)
10553 .await
10554 .map(super::tracing::RegionBackendServices::new)
10555 }
10556
10557 /// Deletes the specified regional BackendService resource.
10558 pub fn delete(&self) -> super::builder::region_backend_services::Delete {
10559 super::builder::region_backend_services::Delete::new(self.inner.clone())
10560 }
10561
10562 /// Returns the specified regional BackendService resource.
10563 pub fn get(&self) -> super::builder::region_backend_services::Get {
10564 super::builder::region_backend_services::Get::new(self.inner.clone())
10565 }
10566
10567 /// Gets the most recent health check results for this
10568 /// regional BackendService.
10569 pub fn get_health(&self) -> super::builder::region_backend_services::GetHealth {
10570 super::builder::region_backend_services::GetHealth::new(self.inner.clone())
10571 }
10572
10573 /// Gets the access control policy for a resource. May be empty if no such
10574 /// policy or resource exists.
10575 pub fn get_iam_policy(&self) -> super::builder::region_backend_services::GetIamPolicy {
10576 super::builder::region_backend_services::GetIamPolicy::new(self.inner.clone())
10577 }
10578
10579 /// Creates a regional BackendService resource in the specified project using
10580 /// the data included in the request. For more information, see
10581 /// Backend services overview.
10582 pub fn insert(&self) -> super::builder::region_backend_services::Insert {
10583 super::builder::region_backend_services::Insert::new(self.inner.clone())
10584 }
10585
10586 /// Retrieves the list of regional BackendService resources available to the
10587 /// specified project in the given region.
10588 pub fn list(&self) -> super::builder::region_backend_services::List {
10589 super::builder::region_backend_services::List::new(self.inner.clone())
10590 }
10591
10592 /// Retrieves a list of all usable backend services in the specified project in
10593 /// the given region.
10594 pub fn list_usable(&self) -> super::builder::region_backend_services::ListUsable {
10595 super::builder::region_backend_services::ListUsable::new(self.inner.clone())
10596 }
10597
10598 /// Updates the specified regional BackendService resource with the data
10599 /// included in the request. For more information, see
10600 /// Understanding backend services This method
10601 /// supports PATCH semantics and uses the JSON merge
10602 /// patch format and processing rules.
10603 pub fn patch(&self) -> super::builder::region_backend_services::Patch {
10604 super::builder::region_backend_services::Patch::new(self.inner.clone())
10605 }
10606
10607 /// Sets the access control policy on the specified resource.
10608 /// Replaces any existing policy.
10609 pub fn set_iam_policy(&self) -> super::builder::region_backend_services::SetIamPolicy {
10610 super::builder::region_backend_services::SetIamPolicy::new(self.inner.clone())
10611 }
10612
10613 /// Sets the Google Cloud Armor security policy for the specified backend
10614 /// service. For more information, seeGoogle
10615 /// Cloud Armor Overview
10616 pub fn set_security_policy(
10617 &self,
10618 ) -> super::builder::region_backend_services::SetSecurityPolicy {
10619 super::builder::region_backend_services::SetSecurityPolicy::new(self.inner.clone())
10620 }
10621
10622 /// Returns permissions that a caller has on the specified resource.
10623 pub fn test_iam_permissions(
10624 &self,
10625 ) -> super::builder::region_backend_services::TestIamPermissions {
10626 super::builder::region_backend_services::TestIamPermissions::new(self.inner.clone())
10627 }
10628
10629 /// Updates the specified regional BackendService resource with the data
10630 /// included in the request. For more information,
10631 /// see
10632 /// Backend services overview.
10633 pub fn update(&self) -> super::builder::region_backend_services::Update {
10634 super::builder::region_backend_services::Update::new(self.inner.clone())
10635 }
10636
10637 /// Retrieves the specified region-specific Operations resource.
10638 pub fn get_operation(&self) -> super::builder::region_backend_services::GetOperation {
10639 super::builder::region_backend_services::GetOperation::new(self.inner.clone())
10640 }
10641}
10642
10643/// Implements a client for the Google Compute Engine API.
10644///
10645/// # Example
10646/// ```
10647/// # use google_cloud_compute_v1::client::RegionCommitments;
10648/// async fn sample(
10649/// ) -> anyhow::Result<()> {
10650/// let client = RegionCommitments::builder().build().await?;
10651/// // use `client` to make requests to the Google Compute Engine API.
10652/// Ok(())
10653/// }
10654/// ```
10655///
10656/// # Service Description
10657///
10658/// Service for the `regionCommitments` resource.
10659///
10660/// # Configuration
10661///
10662/// To configure `RegionCommitments` use the `with_*` methods in the type returned
10663/// by [builder()][RegionCommitments::builder]. The default configuration should
10664/// work for most applications. Common configuration changes include
10665///
10666/// * [with_endpoint()]: by default this client uses the global default endpoint
10667/// (`https://compute.googleapis.com`). Applications using regional
10668/// endpoints or running in restricted networks (e.g. a network configured
10669/// with [Private Google Access with VPC Service Controls]) may want to
10670/// override this default.
10671/// * [with_credentials()]: by default this client uses
10672/// [Application Default Credentials]. Applications using custom
10673/// authentication may need to override this default.
10674///
10675/// [with_endpoint()]: super::builder::region_commitments::ClientBuilder::with_endpoint
10676/// [with_credentials()]: super::builder::region_commitments::ClientBuilder::with_credentials
10677/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10678/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10679///
10680/// # Pooling and Cloning
10681///
10682/// `RegionCommitments` holds a connection pool internally, it is advised to
10683/// create one and reuse it. You do not need to wrap `RegionCommitments` in
10684/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10685/// already uses an `Arc` internally.
10686#[cfg(feature = "region-commitments")]
10687#[cfg_attr(docsrs, doc(cfg(feature = "region-commitments")))]
10688#[derive(Clone, Debug)]
10689pub struct RegionCommitments {
10690 inner: std::sync::Arc<dyn super::stub::dynamic::RegionCommitments>,
10691}
10692
10693#[cfg(feature = "region-commitments")]
10694impl RegionCommitments {
10695 /// Returns a builder for [RegionCommitments].
10696 ///
10697 /// ```
10698 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10699 /// # use google_cloud_compute_v1::client::RegionCommitments;
10700 /// let client = RegionCommitments::builder().build().await?;
10701 /// # Ok(()) }
10702 /// ```
10703 pub fn builder() -> super::builder::region_commitments::ClientBuilder {
10704 crate::new_client_builder(super::builder::region_commitments::client::Factory)
10705 }
10706
10707 /// Creates a new client from the provided stub.
10708 ///
10709 /// The most common case for calling this function is in tests mocking the
10710 /// client's behavior.
10711 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10712 where
10713 T: super::stub::RegionCommitments + 'static,
10714 {
10715 Self { inner: stub.into() }
10716 }
10717
10718 pub(crate) async fn new(
10719 config: gaxi::options::ClientConfig,
10720 ) -> crate::ClientBuilderResult<Self> {
10721 let inner = Self::build_inner(config).await?;
10722 Ok(Self { inner })
10723 }
10724
10725 async fn build_inner(
10726 conf: gaxi::options::ClientConfig,
10727 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionCommitments>>
10728 {
10729 if gaxi::options::tracing_enabled(&conf) {
10730 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10731 }
10732 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10733 }
10734
10735 async fn build_transport(
10736 conf: gaxi::options::ClientConfig,
10737 ) -> crate::ClientBuilderResult<impl super::stub::RegionCommitments> {
10738 super::transport::RegionCommitments::new(conf).await
10739 }
10740
10741 async fn build_with_tracing(
10742 conf: gaxi::options::ClientConfig,
10743 ) -> crate::ClientBuilderResult<impl super::stub::RegionCommitments> {
10744 Self::build_transport(conf)
10745 .await
10746 .map(super::tracing::RegionCommitments::new)
10747 }
10748
10749 /// Retrieves an aggregated list of commitments by region.
10750 ///
10751 /// To prevent failure, it is recommended that you set the
10752 /// `returnPartialSuccess` parameter to `true`.
10753 pub fn aggregated_list(&self) -> super::builder::region_commitments::AggregatedList {
10754 super::builder::region_commitments::AggregatedList::new(self.inner.clone())
10755 }
10756
10757 /// Returns the specified commitment resource.
10758 pub fn get(&self) -> super::builder::region_commitments::Get {
10759 super::builder::region_commitments::Get::new(self.inner.clone())
10760 }
10761
10762 /// Creates a commitment in the specified project using the data
10763 /// included in the request.
10764 pub fn insert(&self) -> super::builder::region_commitments::Insert {
10765 super::builder::region_commitments::Insert::new(self.inner.clone())
10766 }
10767
10768 /// Retrieves a list of commitments contained within
10769 /// the specified region.
10770 pub fn list(&self) -> super::builder::region_commitments::List {
10771 super::builder::region_commitments::List::new(self.inner.clone())
10772 }
10773
10774 /// Updates the specified commitment with the data included in the request.
10775 /// Update is performed only on selected fields included as part of
10776 /// update-mask. Only the following fields can be updated: auto_renew and plan.
10777 pub fn update(&self) -> super::builder::region_commitments::Update {
10778 super::builder::region_commitments::Update::new(self.inner.clone())
10779 }
10780
10781 /// Retrieves the specified region-specific Operations resource.
10782 pub fn get_operation(&self) -> super::builder::region_commitments::GetOperation {
10783 super::builder::region_commitments::GetOperation::new(self.inner.clone())
10784 }
10785}
10786
10787/// Implements a client for the Google Compute Engine API.
10788///
10789/// # Example
10790/// ```
10791/// # use google_cloud_compute_v1::client::RegionCompositeHealthChecks;
10792/// async fn sample(
10793/// ) -> anyhow::Result<()> {
10794/// let client = RegionCompositeHealthChecks::builder().build().await?;
10795/// // use `client` to make requests to the Google Compute Engine API.
10796/// Ok(())
10797/// }
10798/// ```
10799///
10800/// # Service Description
10801///
10802/// Service for the `regionCompositeHealthChecks` resource.
10803///
10804/// # Configuration
10805///
10806/// To configure `RegionCompositeHealthChecks` use the `with_*` methods in the type returned
10807/// by [builder()][RegionCompositeHealthChecks::builder]. The default configuration should
10808/// work for most applications. Common configuration changes include
10809///
10810/// * [with_endpoint()]: by default this client uses the global default endpoint
10811/// (`https://compute.googleapis.com`). Applications using regional
10812/// endpoints or running in restricted networks (e.g. a network configured
10813/// with [Private Google Access with VPC Service Controls]) may want to
10814/// override this default.
10815/// * [with_credentials()]: by default this client uses
10816/// [Application Default Credentials]. Applications using custom
10817/// authentication may need to override this default.
10818///
10819/// [with_endpoint()]: super::builder::region_composite_health_checks::ClientBuilder::with_endpoint
10820/// [with_credentials()]: super::builder::region_composite_health_checks::ClientBuilder::with_credentials
10821/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10822/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10823///
10824/// # Pooling and Cloning
10825///
10826/// `RegionCompositeHealthChecks` holds a connection pool internally, it is advised to
10827/// create one and reuse it. You do not need to wrap `RegionCompositeHealthChecks` in
10828/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10829/// already uses an `Arc` internally.
10830#[cfg(feature = "region-composite-health-checks")]
10831#[cfg_attr(docsrs, doc(cfg(feature = "region-composite-health-checks")))]
10832#[derive(Clone, Debug)]
10833pub struct RegionCompositeHealthChecks {
10834 inner: std::sync::Arc<dyn super::stub::dynamic::RegionCompositeHealthChecks>,
10835}
10836
10837#[cfg(feature = "region-composite-health-checks")]
10838impl RegionCompositeHealthChecks {
10839 /// Returns a builder for [RegionCompositeHealthChecks].
10840 ///
10841 /// ```
10842 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
10843 /// # use google_cloud_compute_v1::client::RegionCompositeHealthChecks;
10844 /// let client = RegionCompositeHealthChecks::builder().build().await?;
10845 /// # Ok(()) }
10846 /// ```
10847 pub fn builder() -> super::builder::region_composite_health_checks::ClientBuilder {
10848 crate::new_client_builder(super::builder::region_composite_health_checks::client::Factory)
10849 }
10850
10851 /// Creates a new client from the provided stub.
10852 ///
10853 /// The most common case for calling this function is in tests mocking the
10854 /// client's behavior.
10855 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
10856 where
10857 T: super::stub::RegionCompositeHealthChecks + 'static,
10858 {
10859 Self { inner: stub.into() }
10860 }
10861
10862 pub(crate) async fn new(
10863 config: gaxi::options::ClientConfig,
10864 ) -> crate::ClientBuilderResult<Self> {
10865 let inner = Self::build_inner(config).await?;
10866 Ok(Self { inner })
10867 }
10868
10869 async fn build_inner(
10870 conf: gaxi::options::ClientConfig,
10871 ) -> crate::ClientBuilderResult<
10872 std::sync::Arc<dyn super::stub::dynamic::RegionCompositeHealthChecks>,
10873 > {
10874 if gaxi::options::tracing_enabled(&conf) {
10875 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10876 }
10877 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10878 }
10879
10880 async fn build_transport(
10881 conf: gaxi::options::ClientConfig,
10882 ) -> crate::ClientBuilderResult<impl super::stub::RegionCompositeHealthChecks> {
10883 super::transport::RegionCompositeHealthChecks::new(conf).await
10884 }
10885
10886 async fn build_with_tracing(
10887 conf: gaxi::options::ClientConfig,
10888 ) -> crate::ClientBuilderResult<impl super::stub::RegionCompositeHealthChecks> {
10889 Self::build_transport(conf)
10890 .await
10891 .map(super::tracing::RegionCompositeHealthChecks::new)
10892 }
10893
10894 /// Retrieves the list of all CompositeHealthCheck resources (all
10895 /// regional) available to the specified project.
10896 ///
10897 /// To prevent failure, it is recommended that you set the
10898 /// `returnPartialSuccess` parameter to `true`.
10899 pub fn aggregated_list(
10900 &self,
10901 ) -> super::builder::region_composite_health_checks::AggregatedList {
10902 super::builder::region_composite_health_checks::AggregatedList::new(self.inner.clone())
10903 }
10904
10905 /// Deletes the specified CompositeHealthCheck in the given region
10906 pub fn delete(&self) -> super::builder::region_composite_health_checks::Delete {
10907 super::builder::region_composite_health_checks::Delete::new(self.inner.clone())
10908 }
10909
10910 /// Returns the specified CompositeHealthCheck resource in the given region.
10911 pub fn get(&self) -> super::builder::region_composite_health_checks::Get {
10912 super::builder::region_composite_health_checks::Get::new(self.inner.clone())
10913 }
10914
10915 /// Gets the most recent health check results for this
10916 /// regional CompositeHealthCheck.
10917 pub fn get_health(&self) -> super::builder::region_composite_health_checks::GetHealth {
10918 super::builder::region_composite_health_checks::GetHealth::new(self.inner.clone())
10919 }
10920
10921 /// Create a CompositeHealthCheck in the specified project in the given region
10922 /// using the parameters that are included in the request.
10923 pub fn insert(&self) -> super::builder::region_composite_health_checks::Insert {
10924 super::builder::region_composite_health_checks::Insert::new(self.inner.clone())
10925 }
10926
10927 /// Lists the CompositeHealthChecks for a project in the given region.
10928 pub fn list(&self) -> super::builder::region_composite_health_checks::List {
10929 super::builder::region_composite_health_checks::List::new(self.inner.clone())
10930 }
10931
10932 /// Updates the specified regional CompositeHealthCheck resource
10933 /// with the data included in the request. This method supportsPATCH
10934 /// semantics and uses theJSON merge
10935 /// patch format and processing rules.
10936 pub fn patch(&self) -> super::builder::region_composite_health_checks::Patch {
10937 super::builder::region_composite_health_checks::Patch::new(self.inner.clone())
10938 }
10939
10940 /// Returns permissions that a caller has on the specified resource.
10941 pub fn test_iam_permissions(
10942 &self,
10943 ) -> super::builder::region_composite_health_checks::TestIamPermissions {
10944 super::builder::region_composite_health_checks::TestIamPermissions::new(self.inner.clone())
10945 }
10946
10947 /// Retrieves the specified region-specific Operations resource.
10948 pub fn get_operation(&self) -> super::builder::region_composite_health_checks::GetOperation {
10949 super::builder::region_composite_health_checks::GetOperation::new(self.inner.clone())
10950 }
10951}
10952
10953/// Implements a client for the Google Compute Engine API.
10954///
10955/// # Example
10956/// ```
10957/// # use google_cloud_compute_v1::client::RegionDiskTypes;
10958/// async fn sample(
10959/// ) -> anyhow::Result<()> {
10960/// let client = RegionDiskTypes::builder().build().await?;
10961/// // use `client` to make requests to the Google Compute Engine API.
10962/// Ok(())
10963/// }
10964/// ```
10965///
10966/// # Service Description
10967///
10968/// Service for the `regionDiskTypes` resource.
10969///
10970/// # Configuration
10971///
10972/// To configure `RegionDiskTypes` use the `with_*` methods in the type returned
10973/// by [builder()][RegionDiskTypes::builder]. The default configuration should
10974/// work for most applications. Common configuration changes include
10975///
10976/// * [with_endpoint()]: by default this client uses the global default endpoint
10977/// (`https://compute.googleapis.com`). Applications using regional
10978/// endpoints or running in restricted networks (e.g. a network configured
10979/// with [Private Google Access with VPC Service Controls]) may want to
10980/// override this default.
10981/// * [with_credentials()]: by default this client uses
10982/// [Application Default Credentials]. Applications using custom
10983/// authentication may need to override this default.
10984///
10985/// [with_endpoint()]: super::builder::region_disk_types::ClientBuilder::with_endpoint
10986/// [with_credentials()]: super::builder::region_disk_types::ClientBuilder::with_credentials
10987/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10988/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10989///
10990/// # Pooling and Cloning
10991///
10992/// `RegionDiskTypes` holds a connection pool internally, it is advised to
10993/// create one and reuse it. You do not need to wrap `RegionDiskTypes` in
10994/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10995/// already uses an `Arc` internally.
10996#[cfg(feature = "region-disk-types")]
10997#[cfg_attr(docsrs, doc(cfg(feature = "region-disk-types")))]
10998#[derive(Clone, Debug)]
10999pub struct RegionDiskTypes {
11000 inner: std::sync::Arc<dyn super::stub::dynamic::RegionDiskTypes>,
11001}
11002
11003#[cfg(feature = "region-disk-types")]
11004impl RegionDiskTypes {
11005 /// Returns a builder for [RegionDiskTypes].
11006 ///
11007 /// ```
11008 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11009 /// # use google_cloud_compute_v1::client::RegionDiskTypes;
11010 /// let client = RegionDiskTypes::builder().build().await?;
11011 /// # Ok(()) }
11012 /// ```
11013 pub fn builder() -> super::builder::region_disk_types::ClientBuilder {
11014 crate::new_client_builder(super::builder::region_disk_types::client::Factory)
11015 }
11016
11017 /// Creates a new client from the provided stub.
11018 ///
11019 /// The most common case for calling this function is in tests mocking the
11020 /// client's behavior.
11021 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11022 where
11023 T: super::stub::RegionDiskTypes + 'static,
11024 {
11025 Self { inner: stub.into() }
11026 }
11027
11028 pub(crate) async fn new(
11029 config: gaxi::options::ClientConfig,
11030 ) -> crate::ClientBuilderResult<Self> {
11031 let inner = Self::build_inner(config).await?;
11032 Ok(Self { inner })
11033 }
11034
11035 async fn build_inner(
11036 conf: gaxi::options::ClientConfig,
11037 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionDiskTypes>> {
11038 if gaxi::options::tracing_enabled(&conf) {
11039 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11040 }
11041 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11042 }
11043
11044 async fn build_transport(
11045 conf: gaxi::options::ClientConfig,
11046 ) -> crate::ClientBuilderResult<impl super::stub::RegionDiskTypes> {
11047 super::transport::RegionDiskTypes::new(conf).await
11048 }
11049
11050 async fn build_with_tracing(
11051 conf: gaxi::options::ClientConfig,
11052 ) -> crate::ClientBuilderResult<impl super::stub::RegionDiskTypes> {
11053 Self::build_transport(conf)
11054 .await
11055 .map(super::tracing::RegionDiskTypes::new)
11056 }
11057
11058 /// Returns the specified regional disk type.
11059 pub fn get(&self) -> super::builder::region_disk_types::Get {
11060 super::builder::region_disk_types::Get::new(self.inner.clone())
11061 }
11062
11063 /// Retrieves a list of regional disk types available to the specified project.
11064 pub fn list(&self) -> super::builder::region_disk_types::List {
11065 super::builder::region_disk_types::List::new(self.inner.clone())
11066 }
11067}
11068
11069/// Implements a client for the Google Compute Engine API.
11070///
11071/// # Example
11072/// ```
11073/// # use google_cloud_compute_v1::client::RegionDisks;
11074/// async fn sample(
11075/// ) -> anyhow::Result<()> {
11076/// let client = RegionDisks::builder().build().await?;
11077/// // use `client` to make requests to the Google Compute Engine API.
11078/// Ok(())
11079/// }
11080/// ```
11081///
11082/// # Service Description
11083///
11084/// Service for the `regionDisks` resource.
11085///
11086/// # Configuration
11087///
11088/// To configure `RegionDisks` use the `with_*` methods in the type returned
11089/// by [builder()][RegionDisks::builder]. The default configuration should
11090/// work for most applications. Common configuration changes include
11091///
11092/// * [with_endpoint()]: by default this client uses the global default endpoint
11093/// (`https://compute.googleapis.com`). Applications using regional
11094/// endpoints or running in restricted networks (e.g. a network configured
11095/// with [Private Google Access with VPC Service Controls]) may want to
11096/// override this default.
11097/// * [with_credentials()]: by default this client uses
11098/// [Application Default Credentials]. Applications using custom
11099/// authentication may need to override this default.
11100///
11101/// [with_endpoint()]: super::builder::region_disks::ClientBuilder::with_endpoint
11102/// [with_credentials()]: super::builder::region_disks::ClientBuilder::with_credentials
11103/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11104/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11105///
11106/// # Pooling and Cloning
11107///
11108/// `RegionDisks` holds a connection pool internally, it is advised to
11109/// create one and reuse it. You do not need to wrap `RegionDisks` in
11110/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11111/// already uses an `Arc` internally.
11112#[cfg(feature = "region-disks")]
11113#[cfg_attr(docsrs, doc(cfg(feature = "region-disks")))]
11114#[derive(Clone, Debug)]
11115pub struct RegionDisks {
11116 inner: std::sync::Arc<dyn super::stub::dynamic::RegionDisks>,
11117}
11118
11119#[cfg(feature = "region-disks")]
11120impl RegionDisks {
11121 /// Returns a builder for [RegionDisks].
11122 ///
11123 /// ```
11124 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11125 /// # use google_cloud_compute_v1::client::RegionDisks;
11126 /// let client = RegionDisks::builder().build().await?;
11127 /// # Ok(()) }
11128 /// ```
11129 pub fn builder() -> super::builder::region_disks::ClientBuilder {
11130 crate::new_client_builder(super::builder::region_disks::client::Factory)
11131 }
11132
11133 /// Creates a new client from the provided stub.
11134 ///
11135 /// The most common case for calling this function is in tests mocking the
11136 /// client's behavior.
11137 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11138 where
11139 T: super::stub::RegionDisks + 'static,
11140 {
11141 Self { inner: stub.into() }
11142 }
11143
11144 pub(crate) async fn new(
11145 config: gaxi::options::ClientConfig,
11146 ) -> crate::ClientBuilderResult<Self> {
11147 let inner = Self::build_inner(config).await?;
11148 Ok(Self { inner })
11149 }
11150
11151 async fn build_inner(
11152 conf: gaxi::options::ClientConfig,
11153 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionDisks>> {
11154 if gaxi::options::tracing_enabled(&conf) {
11155 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11156 }
11157 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11158 }
11159
11160 async fn build_transport(
11161 conf: gaxi::options::ClientConfig,
11162 ) -> crate::ClientBuilderResult<impl super::stub::RegionDisks> {
11163 super::transport::RegionDisks::new(conf).await
11164 }
11165
11166 async fn build_with_tracing(
11167 conf: gaxi::options::ClientConfig,
11168 ) -> crate::ClientBuilderResult<impl super::stub::RegionDisks> {
11169 Self::build_transport(conf)
11170 .await
11171 .map(super::tracing::RegionDisks::new)
11172 }
11173
11174 /// Adds existing resource policies to a regional disk. You can only add one
11175 /// policy which will be applied to this disk for scheduling snapshot
11176 /// creation.
11177 pub fn add_resource_policies(&self) -> super::builder::region_disks::AddResourcePolicies {
11178 super::builder::region_disks::AddResourcePolicies::new(self.inner.clone())
11179 }
11180
11181 /// Bulk create a set of disks.
11182 pub fn bulk_insert(&self) -> super::builder::region_disks::BulkInsert {
11183 super::builder::region_disks::BulkInsert::new(self.inner.clone())
11184 }
11185
11186 /// Creates a snapshot of a specified persistent disk. For regular snapshot
11187 /// creation, consider using snapshots.insert
11188 /// instead, as that method supports more features, such as creating snapshots
11189 /// in a project different from the source disk project.
11190 pub fn create_snapshot(&self) -> super::builder::region_disks::CreateSnapshot {
11191 super::builder::region_disks::CreateSnapshot::new(self.inner.clone())
11192 }
11193
11194 /// Deletes the specified regional persistent disk. Deleting a regional disk
11195 /// removes all the replicas of its data permanently and is irreversible.
11196 /// However, deleting a disk does not delete anysnapshots
11197 /// previously made from the disk. You must separatelydelete
11198 /// snapshots.
11199 pub fn delete(&self) -> super::builder::region_disks::Delete {
11200 super::builder::region_disks::Delete::new(self.inner.clone())
11201 }
11202
11203 /// Returns a specified regional persistent disk.
11204 pub fn get(&self) -> super::builder::region_disks::Get {
11205 super::builder::region_disks::Get::new(self.inner.clone())
11206 }
11207
11208 /// Gets the access control policy for a resource. May be empty if no such
11209 /// policy or resource exists.
11210 pub fn get_iam_policy(&self) -> super::builder::region_disks::GetIamPolicy {
11211 super::builder::region_disks::GetIamPolicy::new(self.inner.clone())
11212 }
11213
11214 /// Creates a persistent regional disk in the specified project using the data
11215 /// included in the request.
11216 pub fn insert(&self) -> super::builder::region_disks::Insert {
11217 super::builder::region_disks::Insert::new(self.inner.clone())
11218 }
11219
11220 /// Retrieves the list of persistent disks contained within
11221 /// the specified region.
11222 pub fn list(&self) -> super::builder::region_disks::List {
11223 super::builder::region_disks::List::new(self.inner.clone())
11224 }
11225
11226 /// Removes resource policies from a regional disk.
11227 pub fn remove_resource_policies(&self) -> super::builder::region_disks::RemoveResourcePolicies {
11228 super::builder::region_disks::RemoveResourcePolicies::new(self.inner.clone())
11229 }
11230
11231 /// Resizes the specified regional persistent disk.
11232 pub fn resize(&self) -> super::builder::region_disks::Resize {
11233 super::builder::region_disks::Resize::new(self.inner.clone())
11234 }
11235
11236 /// Sets the access control policy on the specified resource.
11237 /// Replaces any existing policy.
11238 pub fn set_iam_policy(&self) -> super::builder::region_disks::SetIamPolicy {
11239 super::builder::region_disks::SetIamPolicy::new(self.inner.clone())
11240 }
11241
11242 /// Sets the labels on the target regional disk.
11243 pub fn set_labels(&self) -> super::builder::region_disks::SetLabels {
11244 super::builder::region_disks::SetLabels::new(self.inner.clone())
11245 }
11246
11247 /// Starts asynchronous replication.
11248 /// Must be invoked on the primary disk.
11249 pub fn start_async_replication(&self) -> super::builder::region_disks::StartAsyncReplication {
11250 super::builder::region_disks::StartAsyncReplication::new(self.inner.clone())
11251 }
11252
11253 /// Stops asynchronous replication.
11254 /// Can be invoked either on the primary or on the secondary disk.
11255 pub fn stop_async_replication(&self) -> super::builder::region_disks::StopAsyncReplication {
11256 super::builder::region_disks::StopAsyncReplication::new(self.inner.clone())
11257 }
11258
11259 /// Stops asynchronous replication for a consistency group of disks.
11260 /// Can be invoked either in the primary or secondary scope.
11261 pub fn stop_group_async_replication(
11262 &self,
11263 ) -> super::builder::region_disks::StopGroupAsyncReplication {
11264 super::builder::region_disks::StopGroupAsyncReplication::new(self.inner.clone())
11265 }
11266
11267 /// Returns permissions that a caller has on the specified resource.
11268 pub fn test_iam_permissions(&self) -> super::builder::region_disks::TestIamPermissions {
11269 super::builder::region_disks::TestIamPermissions::new(self.inner.clone())
11270 }
11271
11272 /// Update the specified disk with the data included in the request. Update is
11273 /// performed only on selected fields included as part of update-mask.
11274 pub fn update(&self) -> super::builder::region_disks::Update {
11275 super::builder::region_disks::Update::new(self.inner.clone())
11276 }
11277
11278 /// Rotates the customer-managed
11279 /// encryption key to the latest version for the specified persistent disk.
11280 pub fn update_kms_key(&self) -> super::builder::region_disks::UpdateKmsKey {
11281 super::builder::region_disks::UpdateKmsKey::new(self.inner.clone())
11282 }
11283
11284 /// Retrieves the specified region-specific Operations resource.
11285 pub fn get_operation(&self) -> super::builder::region_disks::GetOperation {
11286 super::builder::region_disks::GetOperation::new(self.inner.clone())
11287 }
11288}
11289
11290/// Implements a client for the Google Compute Engine API.
11291///
11292/// # Example
11293/// ```
11294/// # use google_cloud_compute_v1::client::RegionHealthAggregationPolicies;
11295/// async fn sample(
11296/// ) -> anyhow::Result<()> {
11297/// let client = RegionHealthAggregationPolicies::builder().build().await?;
11298/// // use `client` to make requests to the Google Compute Engine API.
11299/// Ok(())
11300/// }
11301/// ```
11302///
11303/// # Service Description
11304///
11305/// Service for the `regionHealthAggregationPolicies` resource.
11306///
11307/// # Configuration
11308///
11309/// To configure `RegionHealthAggregationPolicies` use the `with_*` methods in the type returned
11310/// by [builder()][RegionHealthAggregationPolicies::builder]. The default configuration should
11311/// work for most applications. Common configuration changes include
11312///
11313/// * [with_endpoint()]: by default this client uses the global default endpoint
11314/// (`https://compute.googleapis.com`). Applications using regional
11315/// endpoints or running in restricted networks (e.g. a network configured
11316/// with [Private Google Access with VPC Service Controls]) may want to
11317/// override this default.
11318/// * [with_credentials()]: by default this client uses
11319/// [Application Default Credentials]. Applications using custom
11320/// authentication may need to override this default.
11321///
11322/// [with_endpoint()]: super::builder::region_health_aggregation_policies::ClientBuilder::with_endpoint
11323/// [with_credentials()]: super::builder::region_health_aggregation_policies::ClientBuilder::with_credentials
11324/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11325/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11326///
11327/// # Pooling and Cloning
11328///
11329/// `RegionHealthAggregationPolicies` holds a connection pool internally, it is advised to
11330/// create one and reuse it. You do not need to wrap `RegionHealthAggregationPolicies` in
11331/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11332/// already uses an `Arc` internally.
11333#[cfg(feature = "region-health-aggregation-policies")]
11334#[cfg_attr(docsrs, doc(cfg(feature = "region-health-aggregation-policies")))]
11335#[derive(Clone, Debug)]
11336pub struct RegionHealthAggregationPolicies {
11337 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthAggregationPolicies>,
11338}
11339
11340#[cfg(feature = "region-health-aggregation-policies")]
11341impl RegionHealthAggregationPolicies {
11342 /// Returns a builder for [RegionHealthAggregationPolicies].
11343 ///
11344 /// ```
11345 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11346 /// # use google_cloud_compute_v1::client::RegionHealthAggregationPolicies;
11347 /// let client = RegionHealthAggregationPolicies::builder().build().await?;
11348 /// # Ok(()) }
11349 /// ```
11350 pub fn builder() -> super::builder::region_health_aggregation_policies::ClientBuilder {
11351 crate::new_client_builder(
11352 super::builder::region_health_aggregation_policies::client::Factory,
11353 )
11354 }
11355
11356 /// Creates a new client from the provided stub.
11357 ///
11358 /// The most common case for calling this function is in tests mocking the
11359 /// client's behavior.
11360 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11361 where
11362 T: super::stub::RegionHealthAggregationPolicies + 'static,
11363 {
11364 Self { inner: stub.into() }
11365 }
11366
11367 pub(crate) async fn new(
11368 config: gaxi::options::ClientConfig,
11369 ) -> crate::ClientBuilderResult<Self> {
11370 let inner = Self::build_inner(config).await?;
11371 Ok(Self { inner })
11372 }
11373
11374 async fn build_inner(
11375 conf: gaxi::options::ClientConfig,
11376 ) -> crate::ClientBuilderResult<
11377 std::sync::Arc<dyn super::stub::dynamic::RegionHealthAggregationPolicies>,
11378 > {
11379 if gaxi::options::tracing_enabled(&conf) {
11380 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11381 }
11382 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11383 }
11384
11385 async fn build_transport(
11386 conf: gaxi::options::ClientConfig,
11387 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthAggregationPolicies> {
11388 super::transport::RegionHealthAggregationPolicies::new(conf).await
11389 }
11390
11391 async fn build_with_tracing(
11392 conf: gaxi::options::ClientConfig,
11393 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthAggregationPolicies> {
11394 Self::build_transport(conf)
11395 .await
11396 .map(super::tracing::RegionHealthAggregationPolicies::new)
11397 }
11398
11399 /// Retrieves the list of all HealthAggregationPolicy resources,
11400 /// regional and global, available to the specified project.
11401 ///
11402 /// To prevent failure, it is recommended that you set the
11403 /// `returnPartialSuccess` parameter to `true`.
11404 pub fn aggregated_list(
11405 &self,
11406 ) -> super::builder::region_health_aggregation_policies::AggregatedList {
11407 super::builder::region_health_aggregation_policies::AggregatedList::new(self.inner.clone())
11408 }
11409
11410 /// Deletes the specified HealthAggregationPolicy in the given region.
11411 pub fn delete(&self) -> super::builder::region_health_aggregation_policies::Delete {
11412 super::builder::region_health_aggregation_policies::Delete::new(self.inner.clone())
11413 }
11414
11415 /// Returns the specified HealthAggregationPolicy resource in the given region.
11416 pub fn get(&self) -> super::builder::region_health_aggregation_policies::Get {
11417 super::builder::region_health_aggregation_policies::Get::new(self.inner.clone())
11418 }
11419
11420 /// Create a HealthAggregationPolicy in the specified project in the given
11421 /// region using the parameters that are included in the request.
11422 pub fn insert(&self) -> super::builder::region_health_aggregation_policies::Insert {
11423 super::builder::region_health_aggregation_policies::Insert::new(self.inner.clone())
11424 }
11425
11426 /// Lists the HealthAggregationPolicies for a project in the given region.
11427 pub fn list(&self) -> super::builder::region_health_aggregation_policies::List {
11428 super::builder::region_health_aggregation_policies::List::new(self.inner.clone())
11429 }
11430
11431 /// Updates the specified regional HealthAggregationPolicy
11432 /// resource with the data included in the request. This method supportsPATCH
11433 /// semantics and uses theJSON merge
11434 /// patch format and processing rules.
11435 pub fn patch(&self) -> super::builder::region_health_aggregation_policies::Patch {
11436 super::builder::region_health_aggregation_policies::Patch::new(self.inner.clone())
11437 }
11438
11439 /// Returns permissions that a caller has on the specified resource.
11440 pub fn test_iam_permissions(
11441 &self,
11442 ) -> super::builder::region_health_aggregation_policies::TestIamPermissions {
11443 super::builder::region_health_aggregation_policies::TestIamPermissions::new(
11444 self.inner.clone(),
11445 )
11446 }
11447
11448 /// Retrieves the specified region-specific Operations resource.
11449 pub fn get_operation(
11450 &self,
11451 ) -> super::builder::region_health_aggregation_policies::GetOperation {
11452 super::builder::region_health_aggregation_policies::GetOperation::new(self.inner.clone())
11453 }
11454}
11455
11456/// Implements a client for the Google Compute Engine API.
11457///
11458/// # Example
11459/// ```
11460/// # use google_cloud_compute_v1::client::RegionHealthCheckServices;
11461/// async fn sample(
11462/// ) -> anyhow::Result<()> {
11463/// let client = RegionHealthCheckServices::builder().build().await?;
11464/// // use `client` to make requests to the Google Compute Engine API.
11465/// Ok(())
11466/// }
11467/// ```
11468///
11469/// # Service Description
11470///
11471/// Service for the `regionHealthCheckServices` resource.
11472///
11473/// # Configuration
11474///
11475/// To configure `RegionHealthCheckServices` use the `with_*` methods in the type returned
11476/// by [builder()][RegionHealthCheckServices::builder]. The default configuration should
11477/// work for most applications. Common configuration changes include
11478///
11479/// * [with_endpoint()]: by default this client uses the global default endpoint
11480/// (`https://compute.googleapis.com`). Applications using regional
11481/// endpoints or running in restricted networks (e.g. a network configured
11482/// with [Private Google Access with VPC Service Controls]) may want to
11483/// override this default.
11484/// * [with_credentials()]: by default this client uses
11485/// [Application Default Credentials]. Applications using custom
11486/// authentication may need to override this default.
11487///
11488/// [with_endpoint()]: super::builder::region_health_check_services::ClientBuilder::with_endpoint
11489/// [with_credentials()]: super::builder::region_health_check_services::ClientBuilder::with_credentials
11490/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11491/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11492///
11493/// # Pooling and Cloning
11494///
11495/// `RegionHealthCheckServices` holds a connection pool internally, it is advised to
11496/// create one and reuse it. You do not need to wrap `RegionHealthCheckServices` in
11497/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11498/// already uses an `Arc` internally.
11499#[cfg(feature = "region-health-check-services")]
11500#[cfg_attr(docsrs, doc(cfg(feature = "region-health-check-services")))]
11501#[derive(Clone, Debug)]
11502pub struct RegionHealthCheckServices {
11503 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthCheckServices>,
11504}
11505
11506#[cfg(feature = "region-health-check-services")]
11507impl RegionHealthCheckServices {
11508 /// Returns a builder for [RegionHealthCheckServices].
11509 ///
11510 /// ```
11511 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11512 /// # use google_cloud_compute_v1::client::RegionHealthCheckServices;
11513 /// let client = RegionHealthCheckServices::builder().build().await?;
11514 /// # Ok(()) }
11515 /// ```
11516 pub fn builder() -> super::builder::region_health_check_services::ClientBuilder {
11517 crate::new_client_builder(super::builder::region_health_check_services::client::Factory)
11518 }
11519
11520 /// Creates a new client from the provided stub.
11521 ///
11522 /// The most common case for calling this function is in tests mocking the
11523 /// client's behavior.
11524 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11525 where
11526 T: super::stub::RegionHealthCheckServices + 'static,
11527 {
11528 Self { inner: stub.into() }
11529 }
11530
11531 pub(crate) async fn new(
11532 config: gaxi::options::ClientConfig,
11533 ) -> crate::ClientBuilderResult<Self> {
11534 let inner = Self::build_inner(config).await?;
11535 Ok(Self { inner })
11536 }
11537
11538 async fn build_inner(
11539 conf: gaxi::options::ClientConfig,
11540 ) -> crate::ClientBuilderResult<
11541 std::sync::Arc<dyn super::stub::dynamic::RegionHealthCheckServices>,
11542 > {
11543 if gaxi::options::tracing_enabled(&conf) {
11544 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11545 }
11546 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11547 }
11548
11549 async fn build_transport(
11550 conf: gaxi::options::ClientConfig,
11551 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthCheckServices> {
11552 super::transport::RegionHealthCheckServices::new(conf).await
11553 }
11554
11555 async fn build_with_tracing(
11556 conf: gaxi::options::ClientConfig,
11557 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthCheckServices> {
11558 Self::build_transport(conf)
11559 .await
11560 .map(super::tracing::RegionHealthCheckServices::new)
11561 }
11562
11563 /// Retrieves the list of all HealthCheckService resources,
11564 /// regional and global, available to the specified project.
11565 ///
11566 /// To prevent failure, it is recommended that you set the
11567 /// `returnPartialSuccess` parameter to `true`.
11568 pub fn aggregated_list(&self) -> super::builder::region_health_check_services::AggregatedList {
11569 super::builder::region_health_check_services::AggregatedList::new(self.inner.clone())
11570 }
11571
11572 /// Deletes the specified regional HealthCheckService.
11573 pub fn delete(&self) -> super::builder::region_health_check_services::Delete {
11574 super::builder::region_health_check_services::Delete::new(self.inner.clone())
11575 }
11576
11577 /// Returns the specified regional HealthCheckService resource.
11578 pub fn get(&self) -> super::builder::region_health_check_services::Get {
11579 super::builder::region_health_check_services::Get::new(self.inner.clone())
11580 }
11581
11582 /// Creates a regional HealthCheckService resource in the
11583 /// specified project and region using the data included in the request.
11584 pub fn insert(&self) -> super::builder::region_health_check_services::Insert {
11585 super::builder::region_health_check_services::Insert::new(self.inner.clone())
11586 }
11587
11588 /// Lists all the HealthCheckService resources that have been
11589 /// configured for the specified project in the given region.
11590 pub fn list(&self) -> super::builder::region_health_check_services::List {
11591 super::builder::region_health_check_services::List::new(self.inner.clone())
11592 }
11593
11594 /// Updates the specified regional HealthCheckService resource
11595 /// with the data included in the request. This method supportsPATCH
11596 /// semantics and uses theJSON merge
11597 /// patch format and processing rules.
11598 pub fn patch(&self) -> super::builder::region_health_check_services::Patch {
11599 super::builder::region_health_check_services::Patch::new(self.inner.clone())
11600 }
11601
11602 /// Returns permissions that a caller has on the specified resource.
11603 pub fn test_iam_permissions(
11604 &self,
11605 ) -> super::builder::region_health_check_services::TestIamPermissions {
11606 super::builder::region_health_check_services::TestIamPermissions::new(self.inner.clone())
11607 }
11608
11609 /// Retrieves the specified region-specific Operations resource.
11610 pub fn get_operation(&self) -> super::builder::region_health_check_services::GetOperation {
11611 super::builder::region_health_check_services::GetOperation::new(self.inner.clone())
11612 }
11613}
11614
11615/// Implements a client for the Google Compute Engine API.
11616///
11617/// # Example
11618/// ```
11619/// # use google_cloud_compute_v1::client::RegionHealthChecks;
11620/// async fn sample(
11621/// ) -> anyhow::Result<()> {
11622/// let client = RegionHealthChecks::builder().build().await?;
11623/// // use `client` to make requests to the Google Compute Engine API.
11624/// Ok(())
11625/// }
11626/// ```
11627///
11628/// # Service Description
11629///
11630/// Service for the `regionHealthChecks` resource.
11631///
11632/// # Configuration
11633///
11634/// To configure `RegionHealthChecks` use the `with_*` methods in the type returned
11635/// by [builder()][RegionHealthChecks::builder]. The default configuration should
11636/// work for most applications. Common configuration changes include
11637///
11638/// * [with_endpoint()]: by default this client uses the global default endpoint
11639/// (`https://compute.googleapis.com`). Applications using regional
11640/// endpoints or running in restricted networks (e.g. a network configured
11641/// with [Private Google Access with VPC Service Controls]) may want to
11642/// override this default.
11643/// * [with_credentials()]: by default this client uses
11644/// [Application Default Credentials]. Applications using custom
11645/// authentication may need to override this default.
11646///
11647/// [with_endpoint()]: super::builder::region_health_checks::ClientBuilder::with_endpoint
11648/// [with_credentials()]: super::builder::region_health_checks::ClientBuilder::with_credentials
11649/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11650/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11651///
11652/// # Pooling and Cloning
11653///
11654/// `RegionHealthChecks` holds a connection pool internally, it is advised to
11655/// create one and reuse it. You do not need to wrap `RegionHealthChecks` in
11656/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11657/// already uses an `Arc` internally.
11658#[cfg(feature = "region-health-checks")]
11659#[cfg_attr(docsrs, doc(cfg(feature = "region-health-checks")))]
11660#[derive(Clone, Debug)]
11661pub struct RegionHealthChecks {
11662 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthChecks>,
11663}
11664
11665#[cfg(feature = "region-health-checks")]
11666impl RegionHealthChecks {
11667 /// Returns a builder for [RegionHealthChecks].
11668 ///
11669 /// ```
11670 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11671 /// # use google_cloud_compute_v1::client::RegionHealthChecks;
11672 /// let client = RegionHealthChecks::builder().build().await?;
11673 /// # Ok(()) }
11674 /// ```
11675 pub fn builder() -> super::builder::region_health_checks::ClientBuilder {
11676 crate::new_client_builder(super::builder::region_health_checks::client::Factory)
11677 }
11678
11679 /// Creates a new client from the provided stub.
11680 ///
11681 /// The most common case for calling this function is in tests mocking the
11682 /// client's behavior.
11683 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11684 where
11685 T: super::stub::RegionHealthChecks + 'static,
11686 {
11687 Self { inner: stub.into() }
11688 }
11689
11690 pub(crate) async fn new(
11691 config: gaxi::options::ClientConfig,
11692 ) -> crate::ClientBuilderResult<Self> {
11693 let inner = Self::build_inner(config).await?;
11694 Ok(Self { inner })
11695 }
11696
11697 async fn build_inner(
11698 conf: gaxi::options::ClientConfig,
11699 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionHealthChecks>>
11700 {
11701 if gaxi::options::tracing_enabled(&conf) {
11702 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11703 }
11704 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11705 }
11706
11707 async fn build_transport(
11708 conf: gaxi::options::ClientConfig,
11709 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthChecks> {
11710 super::transport::RegionHealthChecks::new(conf).await
11711 }
11712
11713 async fn build_with_tracing(
11714 conf: gaxi::options::ClientConfig,
11715 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthChecks> {
11716 Self::build_transport(conf)
11717 .await
11718 .map(super::tracing::RegionHealthChecks::new)
11719 }
11720
11721 /// Deletes the specified HealthCheck resource.
11722 pub fn delete(&self) -> super::builder::region_health_checks::Delete {
11723 super::builder::region_health_checks::Delete::new(self.inner.clone())
11724 }
11725
11726 /// Returns the specified HealthCheck resource.
11727 pub fn get(&self) -> super::builder::region_health_checks::Get {
11728 super::builder::region_health_checks::Get::new(self.inner.clone())
11729 }
11730
11731 /// Creates a HealthCheck resource in the specified project using the data
11732 /// included in the request.
11733 pub fn insert(&self) -> super::builder::region_health_checks::Insert {
11734 super::builder::region_health_checks::Insert::new(self.inner.clone())
11735 }
11736
11737 /// Retrieves the list of HealthCheck resources available to the specified
11738 /// project.
11739 pub fn list(&self) -> super::builder::region_health_checks::List {
11740 super::builder::region_health_checks::List::new(self.inner.clone())
11741 }
11742
11743 /// Updates a HealthCheck resource in the specified project using the data
11744 /// included in the request. This method supportsPATCH
11745 /// semantics and uses theJSON merge
11746 /// patch format and processing rules.
11747 pub fn patch(&self) -> super::builder::region_health_checks::Patch {
11748 super::builder::region_health_checks::Patch::new(self.inner.clone())
11749 }
11750
11751 /// Returns permissions that a caller has on the specified resource.
11752 pub fn test_iam_permissions(&self) -> super::builder::region_health_checks::TestIamPermissions {
11753 super::builder::region_health_checks::TestIamPermissions::new(self.inner.clone())
11754 }
11755
11756 /// Updates a HealthCheck resource in the specified project using the data
11757 /// included in the request.
11758 pub fn update(&self) -> super::builder::region_health_checks::Update {
11759 super::builder::region_health_checks::Update::new(self.inner.clone())
11760 }
11761
11762 /// Retrieves the specified region-specific Operations resource.
11763 pub fn get_operation(&self) -> super::builder::region_health_checks::GetOperation {
11764 super::builder::region_health_checks::GetOperation::new(self.inner.clone())
11765 }
11766}
11767
11768/// Implements a client for the Google Compute Engine API.
11769///
11770/// # Example
11771/// ```
11772/// # use google_cloud_compute_v1::client::RegionHealthSources;
11773/// async fn sample(
11774/// ) -> anyhow::Result<()> {
11775/// let client = RegionHealthSources::builder().build().await?;
11776/// // use `client` to make requests to the Google Compute Engine API.
11777/// Ok(())
11778/// }
11779/// ```
11780///
11781/// # Service Description
11782///
11783/// Service for the `regionHealthSources` resource.
11784///
11785/// # Configuration
11786///
11787/// To configure `RegionHealthSources` use the `with_*` methods in the type returned
11788/// by [builder()][RegionHealthSources::builder]. The default configuration should
11789/// work for most applications. Common configuration changes include
11790///
11791/// * [with_endpoint()]: by default this client uses the global default endpoint
11792/// (`https://compute.googleapis.com`). Applications using regional
11793/// endpoints or running in restricted networks (e.g. a network configured
11794/// with [Private Google Access with VPC Service Controls]) may want to
11795/// override this default.
11796/// * [with_credentials()]: by default this client uses
11797/// [Application Default Credentials]. Applications using custom
11798/// authentication may need to override this default.
11799///
11800/// [with_endpoint()]: super::builder::region_health_sources::ClientBuilder::with_endpoint
11801/// [with_credentials()]: super::builder::region_health_sources::ClientBuilder::with_credentials
11802/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11803/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11804///
11805/// # Pooling and Cloning
11806///
11807/// `RegionHealthSources` holds a connection pool internally, it is advised to
11808/// create one and reuse it. You do not need to wrap `RegionHealthSources` in
11809/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11810/// already uses an `Arc` internally.
11811#[cfg(feature = "region-health-sources")]
11812#[cfg_attr(docsrs, doc(cfg(feature = "region-health-sources")))]
11813#[derive(Clone, Debug)]
11814pub struct RegionHealthSources {
11815 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthSources>,
11816}
11817
11818#[cfg(feature = "region-health-sources")]
11819impl RegionHealthSources {
11820 /// Returns a builder for [RegionHealthSources].
11821 ///
11822 /// ```
11823 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11824 /// # use google_cloud_compute_v1::client::RegionHealthSources;
11825 /// let client = RegionHealthSources::builder().build().await?;
11826 /// # Ok(()) }
11827 /// ```
11828 pub fn builder() -> super::builder::region_health_sources::ClientBuilder {
11829 crate::new_client_builder(super::builder::region_health_sources::client::Factory)
11830 }
11831
11832 /// Creates a new client from the provided stub.
11833 ///
11834 /// The most common case for calling this function is in tests mocking the
11835 /// client's behavior.
11836 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
11837 where
11838 T: super::stub::RegionHealthSources + 'static,
11839 {
11840 Self { inner: stub.into() }
11841 }
11842
11843 pub(crate) async fn new(
11844 config: gaxi::options::ClientConfig,
11845 ) -> crate::ClientBuilderResult<Self> {
11846 let inner = Self::build_inner(config).await?;
11847 Ok(Self { inner })
11848 }
11849
11850 async fn build_inner(
11851 conf: gaxi::options::ClientConfig,
11852 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionHealthSources>>
11853 {
11854 if gaxi::options::tracing_enabled(&conf) {
11855 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11856 }
11857 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11858 }
11859
11860 async fn build_transport(
11861 conf: gaxi::options::ClientConfig,
11862 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthSources> {
11863 super::transport::RegionHealthSources::new(conf).await
11864 }
11865
11866 async fn build_with_tracing(
11867 conf: gaxi::options::ClientConfig,
11868 ) -> crate::ClientBuilderResult<impl super::stub::RegionHealthSources> {
11869 Self::build_transport(conf)
11870 .await
11871 .map(super::tracing::RegionHealthSources::new)
11872 }
11873
11874 /// Retrieves the list of all HealthSource resources (all
11875 /// regional) available to the specified project.
11876 ///
11877 /// To prevent failure, Google recommends that you set the
11878 /// `returnPartialSuccess` parameter to `true`.
11879 pub fn aggregated_list(&self) -> super::builder::region_health_sources::AggregatedList {
11880 super::builder::region_health_sources::AggregatedList::new(self.inner.clone())
11881 }
11882
11883 /// Deletes the specified HealthSource in the given region
11884 pub fn delete(&self) -> super::builder::region_health_sources::Delete {
11885 super::builder::region_health_sources::Delete::new(self.inner.clone())
11886 }
11887
11888 /// Returns the specified HealthSource resource in the given region.
11889 pub fn get(&self) -> super::builder::region_health_sources::Get {
11890 super::builder::region_health_sources::Get::new(self.inner.clone())
11891 }
11892
11893 /// Gets the most recent health check results for this
11894 /// regional HealthSource.
11895 pub fn get_health(&self) -> super::builder::region_health_sources::GetHealth {
11896 super::builder::region_health_sources::GetHealth::new(self.inner.clone())
11897 }
11898
11899 /// Create a HealthSource in the specified project in the given region
11900 /// using the parameters that are included in the request.
11901 pub fn insert(&self) -> super::builder::region_health_sources::Insert {
11902 super::builder::region_health_sources::Insert::new(self.inner.clone())
11903 }
11904
11905 /// Lists the HealthSources for a project in the given region.
11906 pub fn list(&self) -> super::builder::region_health_sources::List {
11907 super::builder::region_health_sources::List::new(self.inner.clone())
11908 }
11909
11910 /// Updates the specified regional HealthSource resource
11911 /// with the data included in the request. This method supportsPATCH
11912 /// semantics and uses theJSON merge
11913 /// patch format and processing rules.
11914 pub fn patch(&self) -> super::builder::region_health_sources::Patch {
11915 super::builder::region_health_sources::Patch::new(self.inner.clone())
11916 }
11917
11918 /// Returns permissions that a caller has on the specified resource.
11919 pub fn test_iam_permissions(
11920 &self,
11921 ) -> super::builder::region_health_sources::TestIamPermissions {
11922 super::builder::region_health_sources::TestIamPermissions::new(self.inner.clone())
11923 }
11924
11925 /// Retrieves the specified region-specific Operations resource.
11926 pub fn get_operation(&self) -> super::builder::region_health_sources::GetOperation {
11927 super::builder::region_health_sources::GetOperation::new(self.inner.clone())
11928 }
11929}
11930
11931/// Implements a client for the Google Compute Engine API.
11932///
11933/// # Example
11934/// ```
11935/// # use google_cloud_compute_v1::client::RegionInstanceGroupManagerResizeRequests;
11936/// async fn sample(
11937/// ) -> anyhow::Result<()> {
11938/// let client = RegionInstanceGroupManagerResizeRequests::builder().build().await?;
11939/// // use `client` to make requests to the Google Compute Engine API.
11940/// Ok(())
11941/// }
11942/// ```
11943///
11944/// # Service Description
11945///
11946/// Service for the `regionInstanceGroupManagerResizeRequests` resource.
11947///
11948/// # Configuration
11949///
11950/// To configure `RegionInstanceGroupManagerResizeRequests` use the `with_*` methods in the type returned
11951/// by [builder()][RegionInstanceGroupManagerResizeRequests::builder]. The default configuration should
11952/// work for most applications. Common configuration changes include
11953///
11954/// * [with_endpoint()]: by default this client uses the global default endpoint
11955/// (`https://compute.googleapis.com`). Applications using regional
11956/// endpoints or running in restricted networks (e.g. a network configured
11957/// with [Private Google Access with VPC Service Controls]) may want to
11958/// override this default.
11959/// * [with_credentials()]: by default this client uses
11960/// [Application Default Credentials]. Applications using custom
11961/// authentication may need to override this default.
11962///
11963/// [with_endpoint()]: super::builder::region_instance_group_manager_resize_requests::ClientBuilder::with_endpoint
11964/// [with_credentials()]: super::builder::region_instance_group_manager_resize_requests::ClientBuilder::with_credentials
11965/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11966/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11967///
11968/// # Pooling and Cloning
11969///
11970/// `RegionInstanceGroupManagerResizeRequests` holds a connection pool internally, it is advised to
11971/// create one and reuse it. You do not need to wrap `RegionInstanceGroupManagerResizeRequests` in
11972/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11973/// already uses an `Arc` internally.
11974#[cfg(feature = "region-instance-group-manager-resize-requests")]
11975#[cfg_attr(
11976 docsrs,
11977 doc(cfg(feature = "region-instance-group-manager-resize-requests"))
11978)]
11979#[derive(Clone, Debug)]
11980pub struct RegionInstanceGroupManagerResizeRequests {
11981 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagerResizeRequests>,
11982}
11983
11984#[cfg(feature = "region-instance-group-manager-resize-requests")]
11985impl RegionInstanceGroupManagerResizeRequests {
11986 /// Returns a builder for [RegionInstanceGroupManagerResizeRequests].
11987 ///
11988 /// ```
11989 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
11990 /// # use google_cloud_compute_v1::client::RegionInstanceGroupManagerResizeRequests;
11991 /// let client = RegionInstanceGroupManagerResizeRequests::builder().build().await?;
11992 /// # Ok(()) }
11993 /// ```
11994 pub fn builder() -> super::builder::region_instance_group_manager_resize_requests::ClientBuilder
11995 {
11996 crate::new_client_builder(
11997 super::builder::region_instance_group_manager_resize_requests::client::Factory,
11998 )
11999 }
12000
12001 /// Creates a new client from the provided stub.
12002 ///
12003 /// The most common case for calling this function is in tests mocking the
12004 /// client's behavior.
12005 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12006 where
12007 T: super::stub::RegionInstanceGroupManagerResizeRequests + 'static,
12008 {
12009 Self { inner: stub.into() }
12010 }
12011
12012 pub(crate) async fn new(
12013 config: gaxi::options::ClientConfig,
12014 ) -> crate::ClientBuilderResult<Self> {
12015 let inner = Self::build_inner(config).await?;
12016 Ok(Self { inner })
12017 }
12018
12019 async fn build_inner(
12020 conf: gaxi::options::ClientConfig,
12021 ) -> crate::ClientBuilderResult<
12022 std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagerResizeRequests>,
12023 > {
12024 if gaxi::options::tracing_enabled(&conf) {
12025 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12026 }
12027 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12028 }
12029
12030 async fn build_transport(
12031 conf: gaxi::options::ClientConfig,
12032 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagerResizeRequests>
12033 {
12034 super::transport::RegionInstanceGroupManagerResizeRequests::new(conf).await
12035 }
12036
12037 async fn build_with_tracing(
12038 conf: gaxi::options::ClientConfig,
12039 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagerResizeRequests>
12040 {
12041 Self::build_transport(conf)
12042 .await
12043 .map(super::tracing::RegionInstanceGroupManagerResizeRequests::new)
12044 }
12045
12046 /// Cancels the specified resize request.
12047 /// Cancelled resize request no longer waits for the resources to be
12048 /// provisioned. Cancel is only possible for requests that are in accepted
12049 /// state.
12050 pub fn cancel(&self) -> super::builder::region_instance_group_manager_resize_requests::Cancel {
12051 super::builder::region_instance_group_manager_resize_requests::Cancel::new(
12052 self.inner.clone(),
12053 )
12054 }
12055
12056 /// Deletes the specified, inactive resize request. Requests that are still
12057 /// active cannot be deleted. Deleting request does not delete instances that
12058 /// were provisioned previously.
12059 pub fn delete(&self) -> super::builder::region_instance_group_manager_resize_requests::Delete {
12060 super::builder::region_instance_group_manager_resize_requests::Delete::new(
12061 self.inner.clone(),
12062 )
12063 }
12064
12065 /// Returns all of the details about the specified resize request.
12066 pub fn get(&self) -> super::builder::region_instance_group_manager_resize_requests::Get {
12067 super::builder::region_instance_group_manager_resize_requests::Get::new(self.inner.clone())
12068 }
12069
12070 /// Creates a new Resize Request that starts provisioning VMs immediately
12071 /// or queues VM creation.
12072 pub fn insert(&self) -> super::builder::region_instance_group_manager_resize_requests::Insert {
12073 super::builder::region_instance_group_manager_resize_requests::Insert::new(
12074 self.inner.clone(),
12075 )
12076 }
12077
12078 /// Retrieves a list of Resize Requests that are contained in the
12079 /// managed instance group.
12080 pub fn list(&self) -> super::builder::region_instance_group_manager_resize_requests::List {
12081 super::builder::region_instance_group_manager_resize_requests::List::new(self.inner.clone())
12082 }
12083
12084 /// Retrieves the specified region-specific Operations resource.
12085 pub fn get_operation(
12086 &self,
12087 ) -> super::builder::region_instance_group_manager_resize_requests::GetOperation {
12088 super::builder::region_instance_group_manager_resize_requests::GetOperation::new(
12089 self.inner.clone(),
12090 )
12091 }
12092}
12093
12094/// Implements a client for the Google Compute Engine API.
12095///
12096/// # Example
12097/// ```
12098/// # use google_cloud_compute_v1::client::RegionInstanceGroupManagers;
12099/// async fn sample(
12100/// ) -> anyhow::Result<()> {
12101/// let client = RegionInstanceGroupManagers::builder().build().await?;
12102/// // use `client` to make requests to the Google Compute Engine API.
12103/// Ok(())
12104/// }
12105/// ```
12106///
12107/// # Service Description
12108///
12109/// Service for the `regionInstanceGroupManagers` resource.
12110///
12111/// # Configuration
12112///
12113/// To configure `RegionInstanceGroupManagers` use the `with_*` methods in the type returned
12114/// by [builder()][RegionInstanceGroupManagers::builder]. The default configuration should
12115/// work for most applications. Common configuration changes include
12116///
12117/// * [with_endpoint()]: by default this client uses the global default endpoint
12118/// (`https://compute.googleapis.com`). Applications using regional
12119/// endpoints or running in restricted networks (e.g. a network configured
12120/// with [Private Google Access with VPC Service Controls]) may want to
12121/// override this default.
12122/// * [with_credentials()]: by default this client uses
12123/// [Application Default Credentials]. Applications using custom
12124/// authentication may need to override this default.
12125///
12126/// [with_endpoint()]: super::builder::region_instance_group_managers::ClientBuilder::with_endpoint
12127/// [with_credentials()]: super::builder::region_instance_group_managers::ClientBuilder::with_credentials
12128/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12129/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12130///
12131/// # Pooling and Cloning
12132///
12133/// `RegionInstanceGroupManagers` holds a connection pool internally, it is advised to
12134/// create one and reuse it. You do not need to wrap `RegionInstanceGroupManagers` in
12135/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12136/// already uses an `Arc` internally.
12137#[cfg(feature = "region-instance-group-managers")]
12138#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-group-managers")))]
12139#[derive(Clone, Debug)]
12140pub struct RegionInstanceGroupManagers {
12141 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagers>,
12142}
12143
12144#[cfg(feature = "region-instance-group-managers")]
12145impl RegionInstanceGroupManagers {
12146 /// Returns a builder for [RegionInstanceGroupManagers].
12147 ///
12148 /// ```
12149 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12150 /// # use google_cloud_compute_v1::client::RegionInstanceGroupManagers;
12151 /// let client = RegionInstanceGroupManagers::builder().build().await?;
12152 /// # Ok(()) }
12153 /// ```
12154 pub fn builder() -> super::builder::region_instance_group_managers::ClientBuilder {
12155 crate::new_client_builder(super::builder::region_instance_group_managers::client::Factory)
12156 }
12157
12158 /// Creates a new client from the provided stub.
12159 ///
12160 /// The most common case for calling this function is in tests mocking the
12161 /// client's behavior.
12162 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12163 where
12164 T: super::stub::RegionInstanceGroupManagers + 'static,
12165 {
12166 Self { inner: stub.into() }
12167 }
12168
12169 pub(crate) async fn new(
12170 config: gaxi::options::ClientConfig,
12171 ) -> crate::ClientBuilderResult<Self> {
12172 let inner = Self::build_inner(config).await?;
12173 Ok(Self { inner })
12174 }
12175
12176 async fn build_inner(
12177 conf: gaxi::options::ClientConfig,
12178 ) -> crate::ClientBuilderResult<
12179 std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagers>,
12180 > {
12181 if gaxi::options::tracing_enabled(&conf) {
12182 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12183 }
12184 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12185 }
12186
12187 async fn build_transport(
12188 conf: gaxi::options::ClientConfig,
12189 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagers> {
12190 super::transport::RegionInstanceGroupManagers::new(conf).await
12191 }
12192
12193 async fn build_with_tracing(
12194 conf: gaxi::options::ClientConfig,
12195 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroupManagers> {
12196 Self::build_transport(conf)
12197 .await
12198 .map(super::tracing::RegionInstanceGroupManagers::new)
12199 }
12200
12201 /// Flags the specified instances to be immediately removed from the managed
12202 /// instance group. Abandoning an instance does not delete the
12203 /// instance, but it does remove the instance from any target pools that are
12204 /// applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
12205 /// number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
12206 /// not yet been removed from the group. You must separately verify the
12207 /// status of the abandoning action with thelistmanagedinstances
12208 /// method.
12209 ///
12210 /// If the group is part of a backend
12211 /// service that has enabled
12212 /// connection draining, it can take up to 60 seconds after the connection
12213 /// draining duration has elapsed before the VM instance is removed or deleted.
12214 ///
12215 /// You can specify a maximum of 1000 instances with this method per request.
12216 pub fn abandon_instances(
12217 &self,
12218 ) -> super::builder::region_instance_group_managers::AbandonInstances {
12219 super::builder::region_instance_group_managers::AbandonInstances::new(self.inner.clone())
12220 }
12221
12222 /// Apply updates to selected instances the managed instance group.
12223 pub fn apply_updates_to_instances(
12224 &self,
12225 ) -> super::builder::region_instance_group_managers::ApplyUpdatesToInstances {
12226 super::builder::region_instance_group_managers::ApplyUpdatesToInstances::new(
12227 self.inner.clone(),
12228 )
12229 }
12230
12231 /// Creates instances with per-instance configurations in this regional managed
12232 /// instance group. Instances are created using the current instance template.
12233 /// The create instances operation is marked DONE if
12234 /// the createInstances request is successful. The underlying
12235 /// actions take additional time. You must separately verify the status of thecreating or actions with the listmanagedinstances
12236 /// method.
12237 pub fn create_instances(
12238 &self,
12239 ) -> super::builder::region_instance_group_managers::CreateInstances {
12240 super::builder::region_instance_group_managers::CreateInstances::new(self.inner.clone())
12241 }
12242
12243 /// Deletes the specified managed instance group and all of the instances
12244 /// in that group.
12245 pub fn delete(&self) -> super::builder::region_instance_group_managers::Delete {
12246 super::builder::region_instance_group_managers::Delete::new(self.inner.clone())
12247 }
12248
12249 /// Flags the specified instances in the managed instance group to be
12250 /// immediately deleted. The instances are also removed from any target
12251 /// pools of which they were a member. This method reduces thetargetSize of the managed instance group by the number of
12252 /// instances that you delete.
12253 /// The deleteInstances operation is marked DONE if
12254 /// the deleteInstances request is successful. The underlying
12255 /// actions take additional time. You must separately verify the status of thedeleting action with thelistmanagedinstances
12256 /// method.
12257 ///
12258 /// If the group is part of a backend
12259 /// service that has enabled
12260 /// connection draining, it can take up to 60 seconds after the connection
12261 /// draining duration has elapsed before the VM instance is removed or deleted.
12262 ///
12263 /// You can specify a maximum of 1000 instances with this method per request.
12264 pub fn delete_instances(
12265 &self,
12266 ) -> super::builder::region_instance_group_managers::DeleteInstances {
12267 super::builder::region_instance_group_managers::DeleteInstances::new(self.inner.clone())
12268 }
12269
12270 /// Deletes selected per-instance configurations for the managed instance
12271 /// group.
12272 pub fn delete_per_instance_configs(
12273 &self,
12274 ) -> super::builder::region_instance_group_managers::DeletePerInstanceConfigs {
12275 super::builder::region_instance_group_managers::DeletePerInstanceConfigs::new(
12276 self.inner.clone(),
12277 )
12278 }
12279
12280 /// Returns all of the details about the specified managed instance group.
12281 pub fn get(&self) -> super::builder::region_instance_group_managers::Get {
12282 super::builder::region_instance_group_managers::Get::new(self.inner.clone())
12283 }
12284
12285 /// Creates a managed instance group using the information that you specify
12286 /// in the request. After the group is created, instances in the group are
12287 /// created using the specified instance template.
12288 /// This operation is marked as DONE when the group is created
12289 /// even if the instances in the group have not yet been created. You must
12290 /// separately verify the status of the individual instances with thelistmanagedinstances
12291 /// method.
12292 ///
12293 /// A regional managed instance group can contain up to 2000 instances.
12294 pub fn insert(&self) -> super::builder::region_instance_group_managers::Insert {
12295 super::builder::region_instance_group_managers::Insert::new(self.inner.clone())
12296 }
12297
12298 /// Retrieves the list of managed instance groups that are contained
12299 /// within the specified region.
12300 pub fn list(&self) -> super::builder::region_instance_group_managers::List {
12301 super::builder::region_instance_group_managers::List::new(self.inner.clone())
12302 }
12303
12304 /// Lists all errors thrown by actions on instances for a given regional
12305 /// managed instance group. The filter andorderBy query parameters are not supported.
12306 pub fn list_errors(&self) -> super::builder::region_instance_group_managers::ListErrors {
12307 super::builder::region_instance_group_managers::ListErrors::new(self.inner.clone())
12308 }
12309
12310 /// Lists the instances in the managed instance group and instances that are
12311 /// scheduled to be created. The list includes any current actions
12312 /// that the group has scheduled for its instances. The orderBy
12313 /// query parameter is not supported. The `pageToken` query parameter is
12314 /// supported only if the group's `listManagedInstancesResults` field is set
12315 /// to `PAGINATED`.
12316 pub fn list_managed_instances(
12317 &self,
12318 ) -> super::builder::region_instance_group_managers::ListManagedInstances {
12319 super::builder::region_instance_group_managers::ListManagedInstances::new(
12320 self.inner.clone(),
12321 )
12322 }
12323
12324 /// Lists all of the per-instance configurations defined for the managed
12325 /// instance group. The orderBy query parameter is not supported.
12326 pub fn list_per_instance_configs(
12327 &self,
12328 ) -> super::builder::region_instance_group_managers::ListPerInstanceConfigs {
12329 super::builder::region_instance_group_managers::ListPerInstanceConfigs::new(
12330 self.inner.clone(),
12331 )
12332 }
12333
12334 /// Updates a managed instance group using the information that you specify
12335 /// in the request.
12336 /// This operation is marked as DONE when the group is patched
12337 /// even if the instances in the group are still in the process of being
12338 /// patched. You must separately verify the status of the individual instances
12339 /// with the listmanagedinstances
12340 /// method. This method supportsPATCH
12341 /// semantics and uses theJSON merge
12342 /// patch format and processing rules.
12343 ///
12344 /// If you update your group to specify a new template or instance
12345 /// configuration, it's possible that your intended specification for each VM
12346 /// in the group is different from the current state of that VM. To learn how
12347 /// to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
12348 /// a MIG.
12349 pub fn patch(&self) -> super::builder::region_instance_group_managers::Patch {
12350 super::builder::region_instance_group_managers::Patch::new(self.inner.clone())
12351 }
12352
12353 /// Inserts or patches per-instance configurations for the managed instance
12354 /// group. perInstanceConfig.name serves as a key used to
12355 /// distinguish whether to perform insert or patch.
12356 pub fn patch_per_instance_configs(
12357 &self,
12358 ) -> super::builder::region_instance_group_managers::PatchPerInstanceConfigs {
12359 super::builder::region_instance_group_managers::PatchPerInstanceConfigs::new(
12360 self.inner.clone(),
12361 )
12362 }
12363
12364 /// Flags the specified VM instances in the managed instance group to be
12365 /// immediately recreated. Each instance is recreated using the group's current
12366 /// configuration. This operation is marked as DONE when the flag
12367 /// is set even if the instances have not yet been recreated. You must
12368 /// separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
12369 /// the status of managed instances.
12370 ///
12371 /// If the group is part of a backend
12372 /// service that has enabled
12373 /// connection draining, it can take up to 60 seconds after the connection
12374 /// draining duration has elapsed before the VM instance is removed or deleted.
12375 ///
12376 /// You can specify a maximum of 1000 instances with this method per request.
12377 pub fn recreate_instances(
12378 &self,
12379 ) -> super::builder::region_instance_group_managers::RecreateInstances {
12380 super::builder::region_instance_group_managers::RecreateInstances::new(self.inner.clone())
12381 }
12382
12383 /// Changes the intended size of the managed instance group. If you increase
12384 /// the size, the group creates new instances using the current instance
12385 /// template. If you decrease the size, the group deletes one or more
12386 /// instances.
12387 ///
12388 /// The resize operation is marked DONE if theresize request is successful. The underlying actions take
12389 /// additional time. You must separately verify the status of thecreating or deleting actions with thelistmanagedinstances
12390 /// method.
12391 ///
12392 /// If the group is part of a backend
12393 /// service that has enabled
12394 /// connection draining, it can take up to 60 seconds after the connection
12395 /// draining duration has elapsed before the VM instance is removed or deleted.
12396 pub fn resize(&self) -> super::builder::region_instance_group_managers::Resize {
12397 super::builder::region_instance_group_managers::Resize::new(self.inner.clone())
12398 }
12399
12400 /// Flags the specified instances in the managed instance group to be
12401 /// resumed. This method increases thetargetSize and decreases the targetSuspendedSize
12402 /// of the managed instance group by the number of instances that you resume.
12403 /// The resumeInstances operation is marked DONE if
12404 /// the resumeInstances request is successful. The underlying
12405 /// actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
12406 /// method.
12407 ///
12408 /// In this request, you can only specify instances that are suspended. For
12409 /// example, if an instance was previously suspended using the suspendInstances
12410 /// method, it can be resumed using the resumeInstances method.
12411 ///
12412 /// If a health check is attached to the managed instance group, the specified
12413 /// instances will be verified as healthy after they are resumed.
12414 ///
12415 /// You can specify a maximum of 1000 instances with this method per request.
12416 pub fn resume_instances(
12417 &self,
12418 ) -> super::builder::region_instance_group_managers::ResumeInstances {
12419 super::builder::region_instance_group_managers::ResumeInstances::new(self.inner.clone())
12420 }
12421
12422 /// Sets the instance template to use when creating new instances or recreating
12423 /// instances in this group. Existing instances are not affected.
12424 pub fn set_instance_template(
12425 &self,
12426 ) -> super::builder::region_instance_group_managers::SetInstanceTemplate {
12427 super::builder::region_instance_group_managers::SetInstanceTemplate::new(self.inner.clone())
12428 }
12429
12430 /// Modifies the target pools to which all new instances in this group are
12431 /// assigned. Existing instances in the group are not affected.
12432 pub fn set_target_pools(
12433 &self,
12434 ) -> super::builder::region_instance_group_managers::SetTargetPools {
12435 super::builder::region_instance_group_managers::SetTargetPools::new(self.inner.clone())
12436 }
12437
12438 /// Flags the specified instances in the managed instance group to be
12439 /// started. This method increases thetargetSize and decreases the targetStoppedSize
12440 /// of the managed instance group by the number of instances that you start.
12441 /// The startInstances operation is marked DONE if
12442 /// the startInstances request is successful. The underlying
12443 /// actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
12444 /// method.
12445 ///
12446 /// In this request, you can only specify instances that are stopped. For
12447 /// example, if an instance was previously stopped using the stopInstances
12448 /// method, it can be started using the startInstances method.
12449 ///
12450 /// If a health check is attached to the managed instance group, the specified
12451 /// instances will be verified as healthy after they are started.
12452 ///
12453 /// You can specify a maximum of 1000 instances with this method per request.
12454 pub fn start_instances(
12455 &self,
12456 ) -> super::builder::region_instance_group_managers::StartInstances {
12457 super::builder::region_instance_group_managers::StartInstances::new(self.inner.clone())
12458 }
12459
12460 /// Flags the specified instances in the managed instance group to be
12461 /// immediately stopped. You can only specify instances that are running in
12462 /// this request. This method reduces thetargetSize and increases the targetStoppedSize
12463 /// of the managed instance group by the number of instances that you stop.
12464 /// The stopInstances operation is marked DONE if
12465 /// the stopInstances request is successful. The underlying
12466 /// actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
12467 /// method.
12468 ///
12469 /// If the standbyPolicy.initialDelaySec field is set, the group
12470 /// delays stopping the instances until initialDelaySec have
12471 /// passed from instance.creationTimestamp (that is, when the
12472 /// instance was created). This delay gives your application time to
12473 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
12474 /// will be zero delay.
12475 ///
12476 /// If the group is part of a backend
12477 /// service that has enabled
12478 /// connection draining, it can take up to 60 seconds after the connection
12479 /// draining duration has elapsed before the VM instance is stopped.
12480 ///
12481 /// Stopped instances can be started using the startInstances
12482 /// method.
12483 ///
12484 /// You can specify a maximum of 1000 instances with this method per request.
12485 pub fn stop_instances(&self) -> super::builder::region_instance_group_managers::StopInstances {
12486 super::builder::region_instance_group_managers::StopInstances::new(self.inner.clone())
12487 }
12488
12489 /// Flags the specified instances in the managed instance group to be
12490 /// immediately suspended. You can only specify instances that are running in
12491 /// this request. This method reduces thetargetSize and increases the targetSuspendedSize
12492 /// of the managed instance group by the number of instances that you suspend.
12493 /// The suspendInstances operation is marked DONE if
12494 /// the suspendInstances request is successful. The underlying
12495 /// actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
12496 /// method.
12497 ///
12498 /// If the standbyPolicy.initialDelaySec field is set, the group
12499 /// delays suspension of the instances until initialDelaySec have
12500 /// passed from instance.creationTimestamp (that is, when the
12501 /// instance was created). This delay gives your application time to
12502 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
12503 /// will be zero delay.
12504 ///
12505 /// If the group is part of a backend
12506 /// service that has enabled
12507 /// connection draining, it can take up to 60 seconds after the connection
12508 /// draining duration has elapsed before the VM instance is suspended.
12509 ///
12510 /// Suspended instances can be resumed using the resumeInstances
12511 /// method.
12512 ///
12513 /// You can specify a maximum of 1000 instances with this method per request.
12514 pub fn suspend_instances(
12515 &self,
12516 ) -> super::builder::region_instance_group_managers::SuspendInstances {
12517 super::builder::region_instance_group_managers::SuspendInstances::new(self.inner.clone())
12518 }
12519
12520 /// Inserts or updates per-instance configurations for the managed instance
12521 /// group. perInstanceConfig.name serves as a key used to
12522 /// distinguish whether to perform insert or patch.
12523 pub fn update_per_instance_configs(
12524 &self,
12525 ) -> super::builder::region_instance_group_managers::UpdatePerInstanceConfigs {
12526 super::builder::region_instance_group_managers::UpdatePerInstanceConfigs::new(
12527 self.inner.clone(),
12528 )
12529 }
12530
12531 /// Retrieves the specified region-specific Operations resource.
12532 pub fn get_operation(&self) -> super::builder::region_instance_group_managers::GetOperation {
12533 super::builder::region_instance_group_managers::GetOperation::new(self.inner.clone())
12534 }
12535}
12536
12537/// Implements a client for the Google Compute Engine API.
12538///
12539/// # Example
12540/// ```
12541/// # use google_cloud_compute_v1::client::RegionInstanceGroups;
12542/// async fn sample(
12543/// ) -> anyhow::Result<()> {
12544/// let client = RegionInstanceGroups::builder().build().await?;
12545/// // use `client` to make requests to the Google Compute Engine API.
12546/// Ok(())
12547/// }
12548/// ```
12549///
12550/// # Service Description
12551///
12552/// Service for the `regionInstanceGroups` resource.
12553///
12554/// # Configuration
12555///
12556/// To configure `RegionInstanceGroups` use the `with_*` methods in the type returned
12557/// by [builder()][RegionInstanceGroups::builder]. The default configuration should
12558/// work for most applications. Common configuration changes include
12559///
12560/// * [with_endpoint()]: by default this client uses the global default endpoint
12561/// (`https://compute.googleapis.com`). Applications using regional
12562/// endpoints or running in restricted networks (e.g. a network configured
12563/// with [Private Google Access with VPC Service Controls]) may want to
12564/// override this default.
12565/// * [with_credentials()]: by default this client uses
12566/// [Application Default Credentials]. Applications using custom
12567/// authentication may need to override this default.
12568///
12569/// [with_endpoint()]: super::builder::region_instance_groups::ClientBuilder::with_endpoint
12570/// [with_credentials()]: super::builder::region_instance_groups::ClientBuilder::with_credentials
12571/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12572/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12573///
12574/// # Pooling and Cloning
12575///
12576/// `RegionInstanceGroups` holds a connection pool internally, it is advised to
12577/// create one and reuse it. You do not need to wrap `RegionInstanceGroups` in
12578/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12579/// already uses an `Arc` internally.
12580#[cfg(feature = "region-instance-groups")]
12581#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-groups")))]
12582#[derive(Clone, Debug)]
12583pub struct RegionInstanceGroups {
12584 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroups>,
12585}
12586
12587#[cfg(feature = "region-instance-groups")]
12588impl RegionInstanceGroups {
12589 /// Returns a builder for [RegionInstanceGroups].
12590 ///
12591 /// ```
12592 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12593 /// # use google_cloud_compute_v1::client::RegionInstanceGroups;
12594 /// let client = RegionInstanceGroups::builder().build().await?;
12595 /// # Ok(()) }
12596 /// ```
12597 pub fn builder() -> super::builder::region_instance_groups::ClientBuilder {
12598 crate::new_client_builder(super::builder::region_instance_groups::client::Factory)
12599 }
12600
12601 /// Creates a new client from the provided stub.
12602 ///
12603 /// The most common case for calling this function is in tests mocking the
12604 /// client's behavior.
12605 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12606 where
12607 T: super::stub::RegionInstanceGroups + 'static,
12608 {
12609 Self { inner: stub.into() }
12610 }
12611
12612 pub(crate) async fn new(
12613 config: gaxi::options::ClientConfig,
12614 ) -> crate::ClientBuilderResult<Self> {
12615 let inner = Self::build_inner(config).await?;
12616 Ok(Self { inner })
12617 }
12618
12619 async fn build_inner(
12620 conf: gaxi::options::ClientConfig,
12621 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroups>>
12622 {
12623 if gaxi::options::tracing_enabled(&conf) {
12624 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12625 }
12626 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12627 }
12628
12629 async fn build_transport(
12630 conf: gaxi::options::ClientConfig,
12631 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroups> {
12632 super::transport::RegionInstanceGroups::new(conf).await
12633 }
12634
12635 async fn build_with_tracing(
12636 conf: gaxi::options::ClientConfig,
12637 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceGroups> {
12638 Self::build_transport(conf)
12639 .await
12640 .map(super::tracing::RegionInstanceGroups::new)
12641 }
12642
12643 /// Returns the specified instance group resource.
12644 pub fn get(&self) -> super::builder::region_instance_groups::Get {
12645 super::builder::region_instance_groups::Get::new(self.inner.clone())
12646 }
12647
12648 /// Retrieves the list of instance group resources contained within
12649 /// the specified region.
12650 pub fn list(&self) -> super::builder::region_instance_groups::List {
12651 super::builder::region_instance_groups::List::new(self.inner.clone())
12652 }
12653
12654 /// Lists the instances in the specified instance group and displays
12655 /// information about the named ports. Depending on the specified options, this
12656 /// method can list all instances or only the instances that are running.
12657 /// The orderBy query parameter is not supported.
12658 pub fn list_instances(&self) -> super::builder::region_instance_groups::ListInstances {
12659 super::builder::region_instance_groups::ListInstances::new(self.inner.clone())
12660 }
12661
12662 /// Sets the named ports for the specified regional instance group.
12663 pub fn set_named_ports(&self) -> super::builder::region_instance_groups::SetNamedPorts {
12664 super::builder::region_instance_groups::SetNamedPorts::new(self.inner.clone())
12665 }
12666
12667 /// Returns permissions that a caller has on the specified resource.
12668 pub fn test_iam_permissions(
12669 &self,
12670 ) -> super::builder::region_instance_groups::TestIamPermissions {
12671 super::builder::region_instance_groups::TestIamPermissions::new(self.inner.clone())
12672 }
12673
12674 /// Retrieves the specified region-specific Operations resource.
12675 pub fn get_operation(&self) -> super::builder::region_instance_groups::GetOperation {
12676 super::builder::region_instance_groups::GetOperation::new(self.inner.clone())
12677 }
12678}
12679
12680/// Implements a client for the Google Compute Engine API.
12681///
12682/// # Example
12683/// ```
12684/// # use google_cloud_compute_v1::client::RegionInstanceTemplates;
12685/// async fn sample(
12686/// ) -> anyhow::Result<()> {
12687/// let client = RegionInstanceTemplates::builder().build().await?;
12688/// // use `client` to make requests to the Google Compute Engine API.
12689/// Ok(())
12690/// }
12691/// ```
12692///
12693/// # Service Description
12694///
12695/// Service for the `regionInstanceTemplates` resource.
12696///
12697/// # Configuration
12698///
12699/// To configure `RegionInstanceTemplates` use the `with_*` methods in the type returned
12700/// by [builder()][RegionInstanceTemplates::builder]. The default configuration should
12701/// work for most applications. Common configuration changes include
12702///
12703/// * [with_endpoint()]: by default this client uses the global default endpoint
12704/// (`https://compute.googleapis.com`). Applications using regional
12705/// endpoints or running in restricted networks (e.g. a network configured
12706/// with [Private Google Access with VPC Service Controls]) may want to
12707/// override this default.
12708/// * [with_credentials()]: by default this client uses
12709/// [Application Default Credentials]. Applications using custom
12710/// authentication may need to override this default.
12711///
12712/// [with_endpoint()]: super::builder::region_instance_templates::ClientBuilder::with_endpoint
12713/// [with_credentials()]: super::builder::region_instance_templates::ClientBuilder::with_credentials
12714/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12715/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12716///
12717/// # Pooling and Cloning
12718///
12719/// `RegionInstanceTemplates` holds a connection pool internally, it is advised to
12720/// create one and reuse it. You do not need to wrap `RegionInstanceTemplates` in
12721/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12722/// already uses an `Arc` internally.
12723#[cfg(feature = "region-instance-templates")]
12724#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-templates")))]
12725#[derive(Clone, Debug)]
12726pub struct RegionInstanceTemplates {
12727 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceTemplates>,
12728}
12729
12730#[cfg(feature = "region-instance-templates")]
12731impl RegionInstanceTemplates {
12732 /// Returns a builder for [RegionInstanceTemplates].
12733 ///
12734 /// ```
12735 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12736 /// # use google_cloud_compute_v1::client::RegionInstanceTemplates;
12737 /// let client = RegionInstanceTemplates::builder().build().await?;
12738 /// # Ok(()) }
12739 /// ```
12740 pub fn builder() -> super::builder::region_instance_templates::ClientBuilder {
12741 crate::new_client_builder(super::builder::region_instance_templates::client::Factory)
12742 }
12743
12744 /// Creates a new client from the provided stub.
12745 ///
12746 /// The most common case for calling this function is in tests mocking the
12747 /// client's behavior.
12748 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12749 where
12750 T: super::stub::RegionInstanceTemplates + 'static,
12751 {
12752 Self { inner: stub.into() }
12753 }
12754
12755 pub(crate) async fn new(
12756 config: gaxi::options::ClientConfig,
12757 ) -> crate::ClientBuilderResult<Self> {
12758 let inner = Self::build_inner(config).await?;
12759 Ok(Self { inner })
12760 }
12761
12762 async fn build_inner(
12763 conf: gaxi::options::ClientConfig,
12764 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstanceTemplates>>
12765 {
12766 if gaxi::options::tracing_enabled(&conf) {
12767 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12768 }
12769 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12770 }
12771
12772 async fn build_transport(
12773 conf: gaxi::options::ClientConfig,
12774 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceTemplates> {
12775 super::transport::RegionInstanceTemplates::new(conf).await
12776 }
12777
12778 async fn build_with_tracing(
12779 conf: gaxi::options::ClientConfig,
12780 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstanceTemplates> {
12781 Self::build_transport(conf)
12782 .await
12783 .map(super::tracing::RegionInstanceTemplates::new)
12784 }
12785
12786 /// Deletes the specified instance template. Deleting an instance template is
12787 /// permanent and cannot be undone.
12788 pub fn delete(&self) -> super::builder::region_instance_templates::Delete {
12789 super::builder::region_instance_templates::Delete::new(self.inner.clone())
12790 }
12791
12792 /// Returns the specified instance template.
12793 pub fn get(&self) -> super::builder::region_instance_templates::Get {
12794 super::builder::region_instance_templates::Get::new(self.inner.clone())
12795 }
12796
12797 /// Creates an instance template in the specified project and region using the
12798 /// global instance template whose URL is included in the request.
12799 pub fn insert(&self) -> super::builder::region_instance_templates::Insert {
12800 super::builder::region_instance_templates::Insert::new(self.inner.clone())
12801 }
12802
12803 /// Retrieves a list of instance templates that are contained within the
12804 /// specified project and region.
12805 pub fn list(&self) -> super::builder::region_instance_templates::List {
12806 super::builder::region_instance_templates::List::new(self.inner.clone())
12807 }
12808
12809 /// Retrieves the specified region-specific Operations resource.
12810 pub fn get_operation(&self) -> super::builder::region_instance_templates::GetOperation {
12811 super::builder::region_instance_templates::GetOperation::new(self.inner.clone())
12812 }
12813}
12814
12815/// Implements a client for the Google Compute Engine API.
12816///
12817/// # Example
12818/// ```
12819/// # use google_cloud_compute_v1::client::RegionInstances;
12820/// async fn sample(
12821/// ) -> anyhow::Result<()> {
12822/// let client = RegionInstances::builder().build().await?;
12823/// // use `client` to make requests to the Google Compute Engine API.
12824/// Ok(())
12825/// }
12826/// ```
12827///
12828/// # Service Description
12829///
12830/// Service for the `regionInstances` resource.
12831///
12832/// # Configuration
12833///
12834/// To configure `RegionInstances` use the `with_*` methods in the type returned
12835/// by [builder()][RegionInstances::builder]. The default configuration should
12836/// work for most applications. Common configuration changes include
12837///
12838/// * [with_endpoint()]: by default this client uses the global default endpoint
12839/// (`https://compute.googleapis.com`). Applications using regional
12840/// endpoints or running in restricted networks (e.g. a network configured
12841/// with [Private Google Access with VPC Service Controls]) may want to
12842/// override this default.
12843/// * [with_credentials()]: by default this client uses
12844/// [Application Default Credentials]. Applications using custom
12845/// authentication may need to override this default.
12846///
12847/// [with_endpoint()]: super::builder::region_instances::ClientBuilder::with_endpoint
12848/// [with_credentials()]: super::builder::region_instances::ClientBuilder::with_credentials
12849/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12850/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12851///
12852/// # Pooling and Cloning
12853///
12854/// `RegionInstances` holds a connection pool internally, it is advised to
12855/// create one and reuse it. You do not need to wrap `RegionInstances` in
12856/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12857/// already uses an `Arc` internally.
12858#[cfg(feature = "region-instances")]
12859#[cfg_attr(docsrs, doc(cfg(feature = "region-instances")))]
12860#[derive(Clone, Debug)]
12861pub struct RegionInstances {
12862 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstances>,
12863}
12864
12865#[cfg(feature = "region-instances")]
12866impl RegionInstances {
12867 /// Returns a builder for [RegionInstances].
12868 ///
12869 /// ```
12870 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12871 /// # use google_cloud_compute_v1::client::RegionInstances;
12872 /// let client = RegionInstances::builder().build().await?;
12873 /// # Ok(()) }
12874 /// ```
12875 pub fn builder() -> super::builder::region_instances::ClientBuilder {
12876 crate::new_client_builder(super::builder::region_instances::client::Factory)
12877 }
12878
12879 /// Creates a new client from the provided stub.
12880 ///
12881 /// The most common case for calling this function is in tests mocking the
12882 /// client's behavior.
12883 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
12884 where
12885 T: super::stub::RegionInstances + 'static,
12886 {
12887 Self { inner: stub.into() }
12888 }
12889
12890 pub(crate) async fn new(
12891 config: gaxi::options::ClientConfig,
12892 ) -> crate::ClientBuilderResult<Self> {
12893 let inner = Self::build_inner(config).await?;
12894 Ok(Self { inner })
12895 }
12896
12897 async fn build_inner(
12898 conf: gaxi::options::ClientConfig,
12899 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstances>> {
12900 if gaxi::options::tracing_enabled(&conf) {
12901 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12902 }
12903 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12904 }
12905
12906 async fn build_transport(
12907 conf: gaxi::options::ClientConfig,
12908 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstances> {
12909 super::transport::RegionInstances::new(conf).await
12910 }
12911
12912 async fn build_with_tracing(
12913 conf: gaxi::options::ClientConfig,
12914 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstances> {
12915 Self::build_transport(conf)
12916 .await
12917 .map(super::tracing::RegionInstances::new)
12918 }
12919
12920 /// Creates multiple instances in a given region. Count specifies the number of
12921 /// instances to create.
12922 pub fn bulk_insert(&self) -> super::builder::region_instances::BulkInsert {
12923 super::builder::region_instances::BulkInsert::new(self.inner.clone())
12924 }
12925
12926 /// Retrieves the specified region-specific Operations resource.
12927 pub fn get_operation(&self) -> super::builder::region_instances::GetOperation {
12928 super::builder::region_instances::GetOperation::new(self.inner.clone())
12929 }
12930}
12931
12932/// Implements a client for the Google Compute Engine API.
12933///
12934/// # Example
12935/// ```
12936/// # use google_cloud_compute_v1::client::RegionInstantSnapshotGroups;
12937/// async fn sample(
12938/// ) -> anyhow::Result<()> {
12939/// let client = RegionInstantSnapshotGroups::builder().build().await?;
12940/// // use `client` to make requests to the Google Compute Engine API.
12941/// Ok(())
12942/// }
12943/// ```
12944///
12945/// # Service Description
12946///
12947/// Service for the `regionInstantSnapshotGroups` resource.
12948///
12949/// # Configuration
12950///
12951/// To configure `RegionInstantSnapshotGroups` use the `with_*` methods in the type returned
12952/// by [builder()][RegionInstantSnapshotGroups::builder]. The default configuration should
12953/// work for most applications. Common configuration changes include
12954///
12955/// * [with_endpoint()]: by default this client uses the global default endpoint
12956/// (`https://compute.googleapis.com`). Applications using regional
12957/// endpoints or running in restricted networks (e.g. a network configured
12958/// with [Private Google Access with VPC Service Controls]) may want to
12959/// override this default.
12960/// * [with_credentials()]: by default this client uses
12961/// [Application Default Credentials]. Applications using custom
12962/// authentication may need to override this default.
12963///
12964/// [with_endpoint()]: super::builder::region_instant_snapshot_groups::ClientBuilder::with_endpoint
12965/// [with_credentials()]: super::builder::region_instant_snapshot_groups::ClientBuilder::with_credentials
12966/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12967/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12968///
12969/// # Pooling and Cloning
12970///
12971/// `RegionInstantSnapshotGroups` holds a connection pool internally, it is advised to
12972/// create one and reuse it. You do not need to wrap `RegionInstantSnapshotGroups` in
12973/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12974/// already uses an `Arc` internally.
12975#[cfg(feature = "region-instant-snapshot-groups")]
12976#[cfg_attr(docsrs, doc(cfg(feature = "region-instant-snapshot-groups")))]
12977#[derive(Clone, Debug)]
12978pub struct RegionInstantSnapshotGroups {
12979 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshotGroups>,
12980}
12981
12982#[cfg(feature = "region-instant-snapshot-groups")]
12983impl RegionInstantSnapshotGroups {
12984 /// Returns a builder for [RegionInstantSnapshotGroups].
12985 ///
12986 /// ```
12987 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
12988 /// # use google_cloud_compute_v1::client::RegionInstantSnapshotGroups;
12989 /// let client = RegionInstantSnapshotGroups::builder().build().await?;
12990 /// # Ok(()) }
12991 /// ```
12992 pub fn builder() -> super::builder::region_instant_snapshot_groups::ClientBuilder {
12993 crate::new_client_builder(super::builder::region_instant_snapshot_groups::client::Factory)
12994 }
12995
12996 /// Creates a new client from the provided stub.
12997 ///
12998 /// The most common case for calling this function is in tests mocking the
12999 /// client's behavior.
13000 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13001 where
13002 T: super::stub::RegionInstantSnapshotGroups + 'static,
13003 {
13004 Self { inner: stub.into() }
13005 }
13006
13007 pub(crate) async fn new(
13008 config: gaxi::options::ClientConfig,
13009 ) -> crate::ClientBuilderResult<Self> {
13010 let inner = Self::build_inner(config).await?;
13011 Ok(Self { inner })
13012 }
13013
13014 async fn build_inner(
13015 conf: gaxi::options::ClientConfig,
13016 ) -> crate::ClientBuilderResult<
13017 std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshotGroups>,
13018 > {
13019 if gaxi::options::tracing_enabled(&conf) {
13020 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13021 }
13022 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13023 }
13024
13025 async fn build_transport(
13026 conf: gaxi::options::ClientConfig,
13027 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshotGroups> {
13028 super::transport::RegionInstantSnapshotGroups::new(conf).await
13029 }
13030
13031 async fn build_with_tracing(
13032 conf: gaxi::options::ClientConfig,
13033 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshotGroups> {
13034 Self::build_transport(conf)
13035 .await
13036 .map(super::tracing::RegionInstantSnapshotGroups::new)
13037 }
13038
13039 /// deletes a Regional InstantSnapshotGroup resource
13040 pub fn delete(&self) -> super::builder::region_instant_snapshot_groups::Delete {
13041 super::builder::region_instant_snapshot_groups::Delete::new(self.inner.clone())
13042 }
13043
13044 /// returns the specified InstantSnapshotGroup resource in the specified
13045 /// region.
13046 pub fn get(&self) -> super::builder::region_instant_snapshot_groups::Get {
13047 super::builder::region_instant_snapshot_groups::Get::new(self.inner.clone())
13048 }
13049
13050 /// Gets the access control policy for a resource. May be empty if no such
13051 /// policy or resource exists.
13052 pub fn get_iam_policy(&self) -> super::builder::region_instant_snapshot_groups::GetIamPolicy {
13053 super::builder::region_instant_snapshot_groups::GetIamPolicy::new(self.inner.clone())
13054 }
13055
13056 /// creates a Regional InstantSnapshotGroup resource
13057 pub fn insert(&self) -> super::builder::region_instant_snapshot_groups::Insert {
13058 super::builder::region_instant_snapshot_groups::Insert::new(self.inner.clone())
13059 }
13060
13061 /// retrieves the list of InstantSnapshotGroup resources contained within
13062 /// the specified region.
13063 pub fn list(&self) -> super::builder::region_instant_snapshot_groups::List {
13064 super::builder::region_instant_snapshot_groups::List::new(self.inner.clone())
13065 }
13066
13067 /// Sets the access control policy on the specified resource.
13068 /// Replaces any existing policy.
13069 pub fn set_iam_policy(&self) -> super::builder::region_instant_snapshot_groups::SetIamPolicy {
13070 super::builder::region_instant_snapshot_groups::SetIamPolicy::new(self.inner.clone())
13071 }
13072
13073 /// Returns permissions that a caller has on the specified resource.
13074 pub fn test_iam_permissions(
13075 &self,
13076 ) -> super::builder::region_instant_snapshot_groups::TestIamPermissions {
13077 super::builder::region_instant_snapshot_groups::TestIamPermissions::new(self.inner.clone())
13078 }
13079
13080 /// Retrieves the specified region-specific Operations resource.
13081 pub fn get_operation(&self) -> super::builder::region_instant_snapshot_groups::GetOperation {
13082 super::builder::region_instant_snapshot_groups::GetOperation::new(self.inner.clone())
13083 }
13084}
13085
13086/// Implements a client for the Google Compute Engine API.
13087///
13088/// # Example
13089/// ```
13090/// # use google_cloud_compute_v1::client::RegionInstantSnapshots;
13091/// async fn sample(
13092/// ) -> anyhow::Result<()> {
13093/// let client = RegionInstantSnapshots::builder().build().await?;
13094/// // use `client` to make requests to the Google Compute Engine API.
13095/// Ok(())
13096/// }
13097/// ```
13098///
13099/// # Service Description
13100///
13101/// Service for the `regionInstantSnapshots` resource.
13102///
13103/// # Configuration
13104///
13105/// To configure `RegionInstantSnapshots` use the `with_*` methods in the type returned
13106/// by [builder()][RegionInstantSnapshots::builder]. The default configuration should
13107/// work for most applications. Common configuration changes include
13108///
13109/// * [with_endpoint()]: by default this client uses the global default endpoint
13110/// (`https://compute.googleapis.com`). Applications using regional
13111/// endpoints or running in restricted networks (e.g. a network configured
13112/// with [Private Google Access with VPC Service Controls]) may want to
13113/// override this default.
13114/// * [with_credentials()]: by default this client uses
13115/// [Application Default Credentials]. Applications using custom
13116/// authentication may need to override this default.
13117///
13118/// [with_endpoint()]: super::builder::region_instant_snapshots::ClientBuilder::with_endpoint
13119/// [with_credentials()]: super::builder::region_instant_snapshots::ClientBuilder::with_credentials
13120/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13121/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13122///
13123/// # Pooling and Cloning
13124///
13125/// `RegionInstantSnapshots` holds a connection pool internally, it is advised to
13126/// create one and reuse it. You do not need to wrap `RegionInstantSnapshots` in
13127/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13128/// already uses an `Arc` internally.
13129#[cfg(feature = "region-instant-snapshots")]
13130#[cfg_attr(docsrs, doc(cfg(feature = "region-instant-snapshots")))]
13131#[derive(Clone, Debug)]
13132pub struct RegionInstantSnapshots {
13133 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshots>,
13134}
13135
13136#[cfg(feature = "region-instant-snapshots")]
13137impl RegionInstantSnapshots {
13138 /// Returns a builder for [RegionInstantSnapshots].
13139 ///
13140 /// ```
13141 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13142 /// # use google_cloud_compute_v1::client::RegionInstantSnapshots;
13143 /// let client = RegionInstantSnapshots::builder().build().await?;
13144 /// # Ok(()) }
13145 /// ```
13146 pub fn builder() -> super::builder::region_instant_snapshots::ClientBuilder {
13147 crate::new_client_builder(super::builder::region_instant_snapshots::client::Factory)
13148 }
13149
13150 /// Creates a new client from the provided stub.
13151 ///
13152 /// The most common case for calling this function is in tests mocking the
13153 /// client's behavior.
13154 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13155 where
13156 T: super::stub::RegionInstantSnapshots + 'static,
13157 {
13158 Self { inner: stub.into() }
13159 }
13160
13161 pub(crate) async fn new(
13162 config: gaxi::options::ClientConfig,
13163 ) -> crate::ClientBuilderResult<Self> {
13164 let inner = Self::build_inner(config).await?;
13165 Ok(Self { inner })
13166 }
13167
13168 async fn build_inner(
13169 conf: gaxi::options::ClientConfig,
13170 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshots>>
13171 {
13172 if gaxi::options::tracing_enabled(&conf) {
13173 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13174 }
13175 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13176 }
13177
13178 async fn build_transport(
13179 conf: gaxi::options::ClientConfig,
13180 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshots> {
13181 super::transport::RegionInstantSnapshots::new(conf).await
13182 }
13183
13184 async fn build_with_tracing(
13185 conf: gaxi::options::ClientConfig,
13186 ) -> crate::ClientBuilderResult<impl super::stub::RegionInstantSnapshots> {
13187 Self::build_transport(conf)
13188 .await
13189 .map(super::tracing::RegionInstantSnapshots::new)
13190 }
13191
13192 /// Deletes the specified InstantSnapshot resource. Keep in mind that deleting
13193 /// a single instantSnapshot might not necessarily delete all the data on that
13194 /// instantSnapshot. If any data on the instantSnapshot that is marked for
13195 /// deletion is needed for subsequent instantSnapshots, the data will be moved
13196 /// to the next corresponding instantSnapshot.
13197 ///
13198 /// For more information, seeDeleting
13199 /// instantSnapshots.
13200 pub fn delete(&self) -> super::builder::region_instant_snapshots::Delete {
13201 super::builder::region_instant_snapshots::Delete::new(self.inner.clone())
13202 }
13203
13204 /// Returns the specified InstantSnapshot resource in the specified region.
13205 pub fn get(&self) -> super::builder::region_instant_snapshots::Get {
13206 super::builder::region_instant_snapshots::Get::new(self.inner.clone())
13207 }
13208
13209 /// Gets the access control policy for a resource. May be empty if no such
13210 /// policy or resource exists.
13211 pub fn get_iam_policy(&self) -> super::builder::region_instant_snapshots::GetIamPolicy {
13212 super::builder::region_instant_snapshots::GetIamPolicy::new(self.inner.clone())
13213 }
13214
13215 /// Creates an instant snapshot in the specified region.
13216 pub fn insert(&self) -> super::builder::region_instant_snapshots::Insert {
13217 super::builder::region_instant_snapshots::Insert::new(self.inner.clone())
13218 }
13219
13220 /// Retrieves the list of InstantSnapshot resources contained within
13221 /// the specified region.
13222 pub fn list(&self) -> super::builder::region_instant_snapshots::List {
13223 super::builder::region_instant_snapshots::List::new(self.inner.clone())
13224 }
13225
13226 /// Sets the access control policy on the specified resource.
13227 /// Replaces any existing policy.
13228 pub fn set_iam_policy(&self) -> super::builder::region_instant_snapshots::SetIamPolicy {
13229 super::builder::region_instant_snapshots::SetIamPolicy::new(self.inner.clone())
13230 }
13231
13232 /// Sets the labels on a instantSnapshot in the given region. To learn more
13233 /// about labels, read the Labeling
13234 /// Resources documentation.
13235 pub fn set_labels(&self) -> super::builder::region_instant_snapshots::SetLabels {
13236 super::builder::region_instant_snapshots::SetLabels::new(self.inner.clone())
13237 }
13238
13239 /// Returns permissions that a caller has on the specified resource.
13240 pub fn test_iam_permissions(
13241 &self,
13242 ) -> super::builder::region_instant_snapshots::TestIamPermissions {
13243 super::builder::region_instant_snapshots::TestIamPermissions::new(self.inner.clone())
13244 }
13245
13246 /// Retrieves the specified region-specific Operations resource.
13247 pub fn get_operation(&self) -> super::builder::region_instant_snapshots::GetOperation {
13248 super::builder::region_instant_snapshots::GetOperation::new(self.inner.clone())
13249 }
13250}
13251
13252/// Implements a client for the Google Compute Engine API.
13253///
13254/// # Example
13255/// ```
13256/// # use google_cloud_compute_v1::client::RegionNetworkEndpointGroups;
13257/// async fn sample(
13258/// ) -> anyhow::Result<()> {
13259/// let client = RegionNetworkEndpointGroups::builder().build().await?;
13260/// // use `client` to make requests to the Google Compute Engine API.
13261/// Ok(())
13262/// }
13263/// ```
13264///
13265/// # Service Description
13266///
13267/// Service for the `regionNetworkEndpointGroups` resource.
13268///
13269/// # Configuration
13270///
13271/// To configure `RegionNetworkEndpointGroups` use the `with_*` methods in the type returned
13272/// by [builder()][RegionNetworkEndpointGroups::builder]. The default configuration should
13273/// work for most applications. Common configuration changes include
13274///
13275/// * [with_endpoint()]: by default this client uses the global default endpoint
13276/// (`https://compute.googleapis.com`). Applications using regional
13277/// endpoints or running in restricted networks (e.g. a network configured
13278/// with [Private Google Access with VPC Service Controls]) may want to
13279/// override this default.
13280/// * [with_credentials()]: by default this client uses
13281/// [Application Default Credentials]. Applications using custom
13282/// authentication may need to override this default.
13283///
13284/// [with_endpoint()]: super::builder::region_network_endpoint_groups::ClientBuilder::with_endpoint
13285/// [with_credentials()]: super::builder::region_network_endpoint_groups::ClientBuilder::with_credentials
13286/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13287/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13288///
13289/// # Pooling and Cloning
13290///
13291/// `RegionNetworkEndpointGroups` holds a connection pool internally, it is advised to
13292/// create one and reuse it. You do not need to wrap `RegionNetworkEndpointGroups` in
13293/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13294/// already uses an `Arc` internally.
13295#[cfg(feature = "region-network-endpoint-groups")]
13296#[cfg_attr(docsrs, doc(cfg(feature = "region-network-endpoint-groups")))]
13297#[derive(Clone, Debug)]
13298pub struct RegionNetworkEndpointGroups {
13299 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNetworkEndpointGroups>,
13300}
13301
13302#[cfg(feature = "region-network-endpoint-groups")]
13303impl RegionNetworkEndpointGroups {
13304 /// Returns a builder for [RegionNetworkEndpointGroups].
13305 ///
13306 /// ```
13307 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13308 /// # use google_cloud_compute_v1::client::RegionNetworkEndpointGroups;
13309 /// let client = RegionNetworkEndpointGroups::builder().build().await?;
13310 /// # Ok(()) }
13311 /// ```
13312 pub fn builder() -> super::builder::region_network_endpoint_groups::ClientBuilder {
13313 crate::new_client_builder(super::builder::region_network_endpoint_groups::client::Factory)
13314 }
13315
13316 /// Creates a new client from the provided stub.
13317 ///
13318 /// The most common case for calling this function is in tests mocking the
13319 /// client's behavior.
13320 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13321 where
13322 T: super::stub::RegionNetworkEndpointGroups + 'static,
13323 {
13324 Self { inner: stub.into() }
13325 }
13326
13327 pub(crate) async fn new(
13328 config: gaxi::options::ClientConfig,
13329 ) -> crate::ClientBuilderResult<Self> {
13330 let inner = Self::build_inner(config).await?;
13331 Ok(Self { inner })
13332 }
13333
13334 async fn build_inner(
13335 conf: gaxi::options::ClientConfig,
13336 ) -> crate::ClientBuilderResult<
13337 std::sync::Arc<dyn super::stub::dynamic::RegionNetworkEndpointGroups>,
13338 > {
13339 if gaxi::options::tracing_enabled(&conf) {
13340 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13341 }
13342 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13343 }
13344
13345 async fn build_transport(
13346 conf: gaxi::options::ClientConfig,
13347 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkEndpointGroups> {
13348 super::transport::RegionNetworkEndpointGroups::new(conf).await
13349 }
13350
13351 async fn build_with_tracing(
13352 conf: gaxi::options::ClientConfig,
13353 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkEndpointGroups> {
13354 Self::build_transport(conf)
13355 .await
13356 .map(super::tracing::RegionNetworkEndpointGroups::new)
13357 }
13358
13359 /// Attach a list of network endpoints to the specified network endpoint group.
13360 pub fn attach_network_endpoints(
13361 &self,
13362 ) -> super::builder::region_network_endpoint_groups::AttachNetworkEndpoints {
13363 super::builder::region_network_endpoint_groups::AttachNetworkEndpoints::new(
13364 self.inner.clone(),
13365 )
13366 }
13367
13368 /// Deletes the specified network endpoint group. Note that the NEG cannot be
13369 /// deleted if it is configured as a backend of a backend service.
13370 pub fn delete(&self) -> super::builder::region_network_endpoint_groups::Delete {
13371 super::builder::region_network_endpoint_groups::Delete::new(self.inner.clone())
13372 }
13373
13374 /// Detach the network endpoint from the specified network endpoint group.
13375 pub fn detach_network_endpoints(
13376 &self,
13377 ) -> super::builder::region_network_endpoint_groups::DetachNetworkEndpoints {
13378 super::builder::region_network_endpoint_groups::DetachNetworkEndpoints::new(
13379 self.inner.clone(),
13380 )
13381 }
13382
13383 /// Returns the specified network endpoint group.
13384 pub fn get(&self) -> super::builder::region_network_endpoint_groups::Get {
13385 super::builder::region_network_endpoint_groups::Get::new(self.inner.clone())
13386 }
13387
13388 /// Creates a network endpoint group in the specified project using the
13389 /// parameters that are included in the request.
13390 ///
13391 /// Note: Use the following APIs to manage network endpoint groups:
13392 ///
13393 /// - To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
13394 /// NEGs): zonal
13395 /// API
13396 /// - To manage NEGs with regional scope (such as regional internet NEGs,
13397 /// serverless NEGs, Private Service Connect NEGs): regional
13398 /// API
13399 /// - To manage NEGs with global scope (such as global internet NEGs):global
13400 /// API
13401 pub fn insert(&self) -> super::builder::region_network_endpoint_groups::Insert {
13402 super::builder::region_network_endpoint_groups::Insert::new(self.inner.clone())
13403 }
13404
13405 /// Retrieves the list of regional network endpoint groups available to the
13406 /// specified project in the given region.
13407 pub fn list(&self) -> super::builder::region_network_endpoint_groups::List {
13408 super::builder::region_network_endpoint_groups::List::new(self.inner.clone())
13409 }
13410
13411 /// Lists the network endpoints in the specified network endpoint group.
13412 pub fn list_network_endpoints(
13413 &self,
13414 ) -> super::builder::region_network_endpoint_groups::ListNetworkEndpoints {
13415 super::builder::region_network_endpoint_groups::ListNetworkEndpoints::new(
13416 self.inner.clone(),
13417 )
13418 }
13419
13420 /// Retrieves the specified region-specific Operations resource.
13421 pub fn get_operation(&self) -> super::builder::region_network_endpoint_groups::GetOperation {
13422 super::builder::region_network_endpoint_groups::GetOperation::new(self.inner.clone())
13423 }
13424}
13425
13426/// Implements a client for the Google Compute Engine API.
13427///
13428/// # Example
13429/// ```
13430/// # use google_cloud_compute_v1::client::RegionNetworkFirewallPolicies;
13431/// async fn sample(
13432/// ) -> anyhow::Result<()> {
13433/// let client = RegionNetworkFirewallPolicies::builder().build().await?;
13434/// // use `client` to make requests to the Google Compute Engine API.
13435/// Ok(())
13436/// }
13437/// ```
13438///
13439/// # Service Description
13440///
13441/// Service for the `regionNetworkFirewallPolicies` resource.
13442///
13443/// # Configuration
13444///
13445/// To configure `RegionNetworkFirewallPolicies` use the `with_*` methods in the type returned
13446/// by [builder()][RegionNetworkFirewallPolicies::builder]. The default configuration should
13447/// work for most applications. Common configuration changes include
13448///
13449/// * [with_endpoint()]: by default this client uses the global default endpoint
13450/// (`https://compute.googleapis.com`). Applications using regional
13451/// endpoints or running in restricted networks (e.g. a network configured
13452/// with [Private Google Access with VPC Service Controls]) may want to
13453/// override this default.
13454/// * [with_credentials()]: by default this client uses
13455/// [Application Default Credentials]. Applications using custom
13456/// authentication may need to override this default.
13457///
13458/// [with_endpoint()]: super::builder::region_network_firewall_policies::ClientBuilder::with_endpoint
13459/// [with_credentials()]: super::builder::region_network_firewall_policies::ClientBuilder::with_credentials
13460/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13461/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13462///
13463/// # Pooling and Cloning
13464///
13465/// `RegionNetworkFirewallPolicies` holds a connection pool internally, it is advised to
13466/// create one and reuse it. You do not need to wrap `RegionNetworkFirewallPolicies` in
13467/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13468/// already uses an `Arc` internally.
13469#[cfg(feature = "region-network-firewall-policies")]
13470#[cfg_attr(docsrs, doc(cfg(feature = "region-network-firewall-policies")))]
13471#[derive(Clone, Debug)]
13472pub struct RegionNetworkFirewallPolicies {
13473 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNetworkFirewallPolicies>,
13474}
13475
13476#[cfg(feature = "region-network-firewall-policies")]
13477impl RegionNetworkFirewallPolicies {
13478 /// Returns a builder for [RegionNetworkFirewallPolicies].
13479 ///
13480 /// ```
13481 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13482 /// # use google_cloud_compute_v1::client::RegionNetworkFirewallPolicies;
13483 /// let client = RegionNetworkFirewallPolicies::builder().build().await?;
13484 /// # Ok(()) }
13485 /// ```
13486 pub fn builder() -> super::builder::region_network_firewall_policies::ClientBuilder {
13487 crate::new_client_builder(super::builder::region_network_firewall_policies::client::Factory)
13488 }
13489
13490 /// Creates a new client from the provided stub.
13491 ///
13492 /// The most common case for calling this function is in tests mocking the
13493 /// client's behavior.
13494 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13495 where
13496 T: super::stub::RegionNetworkFirewallPolicies + 'static,
13497 {
13498 Self { inner: stub.into() }
13499 }
13500
13501 pub(crate) async fn new(
13502 config: gaxi::options::ClientConfig,
13503 ) -> crate::ClientBuilderResult<Self> {
13504 let inner = Self::build_inner(config).await?;
13505 Ok(Self { inner })
13506 }
13507
13508 async fn build_inner(
13509 conf: gaxi::options::ClientConfig,
13510 ) -> crate::ClientBuilderResult<
13511 std::sync::Arc<dyn super::stub::dynamic::RegionNetworkFirewallPolicies>,
13512 > {
13513 if gaxi::options::tracing_enabled(&conf) {
13514 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13515 }
13516 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13517 }
13518
13519 async fn build_transport(
13520 conf: gaxi::options::ClientConfig,
13521 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkFirewallPolicies> {
13522 super::transport::RegionNetworkFirewallPolicies::new(conf).await
13523 }
13524
13525 async fn build_with_tracing(
13526 conf: gaxi::options::ClientConfig,
13527 ) -> crate::ClientBuilderResult<impl super::stub::RegionNetworkFirewallPolicies> {
13528 Self::build_transport(conf)
13529 .await
13530 .map(super::tracing::RegionNetworkFirewallPolicies::new)
13531 }
13532
13533 /// Inserts an association for the specified network firewall policy.
13534 pub fn add_association(
13535 &self,
13536 ) -> super::builder::region_network_firewall_policies::AddAssociation {
13537 super::builder::region_network_firewall_policies::AddAssociation::new(self.inner.clone())
13538 }
13539
13540 /// Inserts a rule into a network firewall policy.
13541 pub fn add_rule(&self) -> super::builder::region_network_firewall_policies::AddRule {
13542 super::builder::region_network_firewall_policies::AddRule::new(self.inner.clone())
13543 }
13544
13545 /// Copies rules to the specified network firewall policy.
13546 pub fn clone_rules(&self) -> super::builder::region_network_firewall_policies::CloneRules {
13547 super::builder::region_network_firewall_policies::CloneRules::new(self.inner.clone())
13548 }
13549
13550 /// Deletes the specified network firewall policy.
13551 pub fn delete(&self) -> super::builder::region_network_firewall_policies::Delete {
13552 super::builder::region_network_firewall_policies::Delete::new(self.inner.clone())
13553 }
13554
13555 /// Returns the specified network firewall policy.
13556 pub fn get(&self) -> super::builder::region_network_firewall_policies::Get {
13557 super::builder::region_network_firewall_policies::Get::new(self.inner.clone())
13558 }
13559
13560 /// Gets an association with the specified name.
13561 pub fn get_association(
13562 &self,
13563 ) -> super::builder::region_network_firewall_policies::GetAssociation {
13564 super::builder::region_network_firewall_policies::GetAssociation::new(self.inner.clone())
13565 }
13566
13567 /// Returns the effective firewalls on a given network.
13568 pub fn get_effective_firewalls(
13569 &self,
13570 ) -> super::builder::region_network_firewall_policies::GetEffectiveFirewalls {
13571 super::builder::region_network_firewall_policies::GetEffectiveFirewalls::new(
13572 self.inner.clone(),
13573 )
13574 }
13575
13576 /// Gets the access control policy for a resource. May be empty if no such
13577 /// policy or resource exists.
13578 pub fn get_iam_policy(&self) -> super::builder::region_network_firewall_policies::GetIamPolicy {
13579 super::builder::region_network_firewall_policies::GetIamPolicy::new(self.inner.clone())
13580 }
13581
13582 /// Gets a rule of the specified priority.
13583 pub fn get_rule(&self) -> super::builder::region_network_firewall_policies::GetRule {
13584 super::builder::region_network_firewall_policies::GetRule::new(self.inner.clone())
13585 }
13586
13587 /// Creates a new network firewall policy in the specified project and region.
13588 pub fn insert(&self) -> super::builder::region_network_firewall_policies::Insert {
13589 super::builder::region_network_firewall_policies::Insert::new(self.inner.clone())
13590 }
13591
13592 /// Lists all the network firewall policies that have been configured
13593 /// for the specified project in the given region.
13594 pub fn list(&self) -> super::builder::region_network_firewall_policies::List {
13595 super::builder::region_network_firewall_policies::List::new(self.inner.clone())
13596 }
13597
13598 /// Patches the specified network firewall policy.
13599 pub fn patch(&self) -> super::builder::region_network_firewall_policies::Patch {
13600 super::builder::region_network_firewall_policies::Patch::new(self.inner.clone())
13601 }
13602
13603 /// Patches a rule of the specified priority.
13604 pub fn patch_rule(&self) -> super::builder::region_network_firewall_policies::PatchRule {
13605 super::builder::region_network_firewall_policies::PatchRule::new(self.inner.clone())
13606 }
13607
13608 /// Removes an association for the specified network firewall policy.
13609 pub fn remove_association(
13610 &self,
13611 ) -> super::builder::region_network_firewall_policies::RemoveAssociation {
13612 super::builder::region_network_firewall_policies::RemoveAssociation::new(self.inner.clone())
13613 }
13614
13615 /// Deletes a rule of the specified priority.
13616 pub fn remove_rule(&self) -> super::builder::region_network_firewall_policies::RemoveRule {
13617 super::builder::region_network_firewall_policies::RemoveRule::new(self.inner.clone())
13618 }
13619
13620 /// Sets the access control policy on the specified resource.
13621 /// Replaces any existing policy.
13622 pub fn set_iam_policy(&self) -> super::builder::region_network_firewall_policies::SetIamPolicy {
13623 super::builder::region_network_firewall_policies::SetIamPolicy::new(self.inner.clone())
13624 }
13625
13626 /// Returns permissions that a caller has on the specified resource.
13627 pub fn test_iam_permissions(
13628 &self,
13629 ) -> super::builder::region_network_firewall_policies::TestIamPermissions {
13630 super::builder::region_network_firewall_policies::TestIamPermissions::new(
13631 self.inner.clone(),
13632 )
13633 }
13634
13635 /// Retrieves the specified region-specific Operations resource.
13636 pub fn get_operation(&self) -> super::builder::region_network_firewall_policies::GetOperation {
13637 super::builder::region_network_firewall_policies::GetOperation::new(self.inner.clone())
13638 }
13639}
13640
13641/// Implements a client for the Google Compute Engine API.
13642///
13643/// # Example
13644/// ```
13645/// # use google_cloud_compute_v1::client::RegionNotificationEndpoints;
13646/// async fn sample(
13647/// ) -> anyhow::Result<()> {
13648/// let client = RegionNotificationEndpoints::builder().build().await?;
13649/// // use `client` to make requests to the Google Compute Engine API.
13650/// Ok(())
13651/// }
13652/// ```
13653///
13654/// # Service Description
13655///
13656/// Service for the `regionNotificationEndpoints` resource.
13657///
13658/// # Configuration
13659///
13660/// To configure `RegionNotificationEndpoints` use the `with_*` methods in the type returned
13661/// by [builder()][RegionNotificationEndpoints::builder]. The default configuration should
13662/// work for most applications. Common configuration changes include
13663///
13664/// * [with_endpoint()]: by default this client uses the global default endpoint
13665/// (`https://compute.googleapis.com`). Applications using regional
13666/// endpoints or running in restricted networks (e.g. a network configured
13667/// with [Private Google Access with VPC Service Controls]) may want to
13668/// override this default.
13669/// * [with_credentials()]: by default this client uses
13670/// [Application Default Credentials]. Applications using custom
13671/// authentication may need to override this default.
13672///
13673/// [with_endpoint()]: super::builder::region_notification_endpoints::ClientBuilder::with_endpoint
13674/// [with_credentials()]: super::builder::region_notification_endpoints::ClientBuilder::with_credentials
13675/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13676/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13677///
13678/// # Pooling and Cloning
13679///
13680/// `RegionNotificationEndpoints` holds a connection pool internally, it is advised to
13681/// create one and reuse it. You do not need to wrap `RegionNotificationEndpoints` in
13682/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13683/// already uses an `Arc` internally.
13684#[cfg(feature = "region-notification-endpoints")]
13685#[cfg_attr(docsrs, doc(cfg(feature = "region-notification-endpoints")))]
13686#[derive(Clone, Debug)]
13687pub struct RegionNotificationEndpoints {
13688 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNotificationEndpoints>,
13689}
13690
13691#[cfg(feature = "region-notification-endpoints")]
13692impl RegionNotificationEndpoints {
13693 /// Returns a builder for [RegionNotificationEndpoints].
13694 ///
13695 /// ```
13696 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13697 /// # use google_cloud_compute_v1::client::RegionNotificationEndpoints;
13698 /// let client = RegionNotificationEndpoints::builder().build().await?;
13699 /// # Ok(()) }
13700 /// ```
13701 pub fn builder() -> super::builder::region_notification_endpoints::ClientBuilder {
13702 crate::new_client_builder(super::builder::region_notification_endpoints::client::Factory)
13703 }
13704
13705 /// Creates a new client from the provided stub.
13706 ///
13707 /// The most common case for calling this function is in tests mocking the
13708 /// client's behavior.
13709 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13710 where
13711 T: super::stub::RegionNotificationEndpoints + 'static,
13712 {
13713 Self { inner: stub.into() }
13714 }
13715
13716 pub(crate) async fn new(
13717 config: gaxi::options::ClientConfig,
13718 ) -> crate::ClientBuilderResult<Self> {
13719 let inner = Self::build_inner(config).await?;
13720 Ok(Self { inner })
13721 }
13722
13723 async fn build_inner(
13724 conf: gaxi::options::ClientConfig,
13725 ) -> crate::ClientBuilderResult<
13726 std::sync::Arc<dyn super::stub::dynamic::RegionNotificationEndpoints>,
13727 > {
13728 if gaxi::options::tracing_enabled(&conf) {
13729 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13730 }
13731 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13732 }
13733
13734 async fn build_transport(
13735 conf: gaxi::options::ClientConfig,
13736 ) -> crate::ClientBuilderResult<impl super::stub::RegionNotificationEndpoints> {
13737 super::transport::RegionNotificationEndpoints::new(conf).await
13738 }
13739
13740 async fn build_with_tracing(
13741 conf: gaxi::options::ClientConfig,
13742 ) -> crate::ClientBuilderResult<impl super::stub::RegionNotificationEndpoints> {
13743 Self::build_transport(conf)
13744 .await
13745 .map(super::tracing::RegionNotificationEndpoints::new)
13746 }
13747
13748 /// Retrieves the list of all NotificationEndpoint resources,
13749 /// regional and global, available to the specified project.
13750 pub fn aggregated_list(&self) -> super::builder::region_notification_endpoints::AggregatedList {
13751 super::builder::region_notification_endpoints::AggregatedList::new(self.inner.clone())
13752 }
13753
13754 /// Deletes the specified NotificationEndpoint in the given region
13755 pub fn delete(&self) -> super::builder::region_notification_endpoints::Delete {
13756 super::builder::region_notification_endpoints::Delete::new(self.inner.clone())
13757 }
13758
13759 /// Returns the specified NotificationEndpoint resource in the given region.
13760 pub fn get(&self) -> super::builder::region_notification_endpoints::Get {
13761 super::builder::region_notification_endpoints::Get::new(self.inner.clone())
13762 }
13763
13764 /// Create a NotificationEndpoint in the specified project in the given region
13765 /// using the parameters that are included in the request.
13766 pub fn insert(&self) -> super::builder::region_notification_endpoints::Insert {
13767 super::builder::region_notification_endpoints::Insert::new(self.inner.clone())
13768 }
13769
13770 /// Lists the NotificationEndpoints for a project in the given region.
13771 pub fn list(&self) -> super::builder::region_notification_endpoints::List {
13772 super::builder::region_notification_endpoints::List::new(self.inner.clone())
13773 }
13774
13775 /// Returns permissions that a caller has on the specified resource.
13776 pub fn test_iam_permissions(
13777 &self,
13778 ) -> super::builder::region_notification_endpoints::TestIamPermissions {
13779 super::builder::region_notification_endpoints::TestIamPermissions::new(self.inner.clone())
13780 }
13781
13782 /// Retrieves the specified region-specific Operations resource.
13783 pub fn get_operation(&self) -> super::builder::region_notification_endpoints::GetOperation {
13784 super::builder::region_notification_endpoints::GetOperation::new(self.inner.clone())
13785 }
13786}
13787
13788/// Implements a client for the Google Compute Engine API.
13789///
13790/// # Example
13791/// ```
13792/// # use google_cloud_compute_v1::client::RegionOperations;
13793/// async fn sample(
13794/// ) -> anyhow::Result<()> {
13795/// let client = RegionOperations::builder().build().await?;
13796/// // use `client` to make requests to the Google Compute Engine API.
13797/// Ok(())
13798/// }
13799/// ```
13800///
13801/// # Service Description
13802///
13803/// Service for the `regionOperations` resource.
13804///
13805/// # Configuration
13806///
13807/// To configure `RegionOperations` use the `with_*` methods in the type returned
13808/// by [builder()][RegionOperations::builder]. The default configuration should
13809/// work for most applications. Common configuration changes include
13810///
13811/// * [with_endpoint()]: by default this client uses the global default endpoint
13812/// (`https://compute.googleapis.com`). Applications using regional
13813/// endpoints or running in restricted networks (e.g. a network configured
13814/// with [Private Google Access with VPC Service Controls]) may want to
13815/// override this default.
13816/// * [with_credentials()]: by default this client uses
13817/// [Application Default Credentials]. Applications using custom
13818/// authentication may need to override this default.
13819///
13820/// [with_endpoint()]: super::builder::region_operations::ClientBuilder::with_endpoint
13821/// [with_credentials()]: super::builder::region_operations::ClientBuilder::with_credentials
13822/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13823/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13824///
13825/// # Pooling and Cloning
13826///
13827/// `RegionOperations` holds a connection pool internally, it is advised to
13828/// create one and reuse it. You do not need to wrap `RegionOperations` in
13829/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13830/// already uses an `Arc` internally.
13831#[cfg(feature = "region-operations")]
13832#[cfg_attr(docsrs, doc(cfg(feature = "region-operations")))]
13833#[derive(Clone, Debug)]
13834pub struct RegionOperations {
13835 inner: std::sync::Arc<dyn super::stub::dynamic::RegionOperations>,
13836}
13837
13838#[cfg(feature = "region-operations")]
13839impl RegionOperations {
13840 /// Returns a builder for [RegionOperations].
13841 ///
13842 /// ```
13843 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13844 /// # use google_cloud_compute_v1::client::RegionOperations;
13845 /// let client = RegionOperations::builder().build().await?;
13846 /// # Ok(()) }
13847 /// ```
13848 pub fn builder() -> super::builder::region_operations::ClientBuilder {
13849 crate::new_client_builder(super::builder::region_operations::client::Factory)
13850 }
13851
13852 /// Creates a new client from the provided stub.
13853 ///
13854 /// The most common case for calling this function is in tests mocking the
13855 /// client's behavior.
13856 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
13857 where
13858 T: super::stub::RegionOperations + 'static,
13859 {
13860 Self { inner: stub.into() }
13861 }
13862
13863 pub(crate) async fn new(
13864 config: gaxi::options::ClientConfig,
13865 ) -> crate::ClientBuilderResult<Self> {
13866 let inner = Self::build_inner(config).await?;
13867 Ok(Self { inner })
13868 }
13869
13870 async fn build_inner(
13871 conf: gaxi::options::ClientConfig,
13872 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionOperations>>
13873 {
13874 if gaxi::options::tracing_enabled(&conf) {
13875 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13876 }
13877 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13878 }
13879
13880 async fn build_transport(
13881 conf: gaxi::options::ClientConfig,
13882 ) -> crate::ClientBuilderResult<impl super::stub::RegionOperations> {
13883 super::transport::RegionOperations::new(conf).await
13884 }
13885
13886 async fn build_with_tracing(
13887 conf: gaxi::options::ClientConfig,
13888 ) -> crate::ClientBuilderResult<impl super::stub::RegionOperations> {
13889 Self::build_transport(conf)
13890 .await
13891 .map(super::tracing::RegionOperations::new)
13892 }
13893
13894 /// Deletes the specified region-specific Operations resource.
13895 pub fn delete(&self) -> super::builder::region_operations::Delete {
13896 super::builder::region_operations::Delete::new(self.inner.clone())
13897 }
13898
13899 /// Retrieves the specified region-specific Operations resource.
13900 pub fn get(&self) -> super::builder::region_operations::Get {
13901 super::builder::region_operations::Get::new(self.inner.clone())
13902 }
13903
13904 /// Retrieves a list of Operation resources contained within
13905 /// the specified region.
13906 pub fn list(&self) -> super::builder::region_operations::List {
13907 super::builder::region_operations::List::new(self.inner.clone())
13908 }
13909
13910 /// Waits for the specified Operation resource to return as `DONE`
13911 /// or for the request to approach the 2 minute deadline, and retrieves the
13912 /// specified Operation resource. This method differs from the
13913 /// `GET` method in that it waits for no more than the default
13914 /// deadline (2 minutes) and then returns the current state of the operation,
13915 /// which might be `DONE` or still in progress.
13916 ///
13917 /// This method is called on a best-effort basis. Specifically:
13918 ///
13919 /// ```norust
13920 /// - In uncommon cases, when the server is overloaded, the request might
13921 /// return before the default deadline is reached, or might return after zero
13922 /// seconds.
13923 /// ```
13924 ///
13925 /// - If the default deadline is reached, there is no guarantee that the
13926 /// operation is actually done when the method returns. Be prepared to retry
13927 /// if the operation is not `DONE`.
13928 pub fn wait(&self) -> super::builder::region_operations::Wait {
13929 super::builder::region_operations::Wait::new(self.inner.clone())
13930 }
13931}
13932
13933/// Implements a client for the Google Compute Engine API.
13934///
13935/// # Example
13936/// ```
13937/// # use google_cloud_compute_v1::client::RegionSecurityPolicies;
13938/// async fn sample(
13939/// ) -> anyhow::Result<()> {
13940/// let client = RegionSecurityPolicies::builder().build().await?;
13941/// // use `client` to make requests to the Google Compute Engine API.
13942/// Ok(())
13943/// }
13944/// ```
13945///
13946/// # Service Description
13947///
13948/// Service for the `regionSecurityPolicies` resource.
13949///
13950/// # Configuration
13951///
13952/// To configure `RegionSecurityPolicies` use the `with_*` methods in the type returned
13953/// by [builder()][RegionSecurityPolicies::builder]. The default configuration should
13954/// work for most applications. Common configuration changes include
13955///
13956/// * [with_endpoint()]: by default this client uses the global default endpoint
13957/// (`https://compute.googleapis.com`). Applications using regional
13958/// endpoints or running in restricted networks (e.g. a network configured
13959/// with [Private Google Access with VPC Service Controls]) may want to
13960/// override this default.
13961/// * [with_credentials()]: by default this client uses
13962/// [Application Default Credentials]. Applications using custom
13963/// authentication may need to override this default.
13964///
13965/// [with_endpoint()]: super::builder::region_security_policies::ClientBuilder::with_endpoint
13966/// [with_credentials()]: super::builder::region_security_policies::ClientBuilder::with_credentials
13967/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13968/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13969///
13970/// # Pooling and Cloning
13971///
13972/// `RegionSecurityPolicies` holds a connection pool internally, it is advised to
13973/// create one and reuse it. You do not need to wrap `RegionSecurityPolicies` in
13974/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13975/// already uses an `Arc` internally.
13976#[cfg(feature = "region-security-policies")]
13977#[cfg_attr(docsrs, doc(cfg(feature = "region-security-policies")))]
13978#[derive(Clone, Debug)]
13979pub struct RegionSecurityPolicies {
13980 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSecurityPolicies>,
13981}
13982
13983#[cfg(feature = "region-security-policies")]
13984impl RegionSecurityPolicies {
13985 /// Returns a builder for [RegionSecurityPolicies].
13986 ///
13987 /// ```
13988 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
13989 /// # use google_cloud_compute_v1::client::RegionSecurityPolicies;
13990 /// let client = RegionSecurityPolicies::builder().build().await?;
13991 /// # Ok(()) }
13992 /// ```
13993 pub fn builder() -> super::builder::region_security_policies::ClientBuilder {
13994 crate::new_client_builder(super::builder::region_security_policies::client::Factory)
13995 }
13996
13997 /// Creates a new client from the provided stub.
13998 ///
13999 /// The most common case for calling this function is in tests mocking the
14000 /// client's behavior.
14001 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14002 where
14003 T: super::stub::RegionSecurityPolicies + 'static,
14004 {
14005 Self { inner: stub.into() }
14006 }
14007
14008 pub(crate) async fn new(
14009 config: gaxi::options::ClientConfig,
14010 ) -> crate::ClientBuilderResult<Self> {
14011 let inner = Self::build_inner(config).await?;
14012 Ok(Self { inner })
14013 }
14014
14015 async fn build_inner(
14016 conf: gaxi::options::ClientConfig,
14017 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSecurityPolicies>>
14018 {
14019 if gaxi::options::tracing_enabled(&conf) {
14020 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14021 }
14022 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14023 }
14024
14025 async fn build_transport(
14026 conf: gaxi::options::ClientConfig,
14027 ) -> crate::ClientBuilderResult<impl super::stub::RegionSecurityPolicies> {
14028 super::transport::RegionSecurityPolicies::new(conf).await
14029 }
14030
14031 async fn build_with_tracing(
14032 conf: gaxi::options::ClientConfig,
14033 ) -> crate::ClientBuilderResult<impl super::stub::RegionSecurityPolicies> {
14034 Self::build_transport(conf)
14035 .await
14036 .map(super::tracing::RegionSecurityPolicies::new)
14037 }
14038
14039 /// Inserts a rule into a security policy.
14040 pub fn add_rule(&self) -> super::builder::region_security_policies::AddRule {
14041 super::builder::region_security_policies::AddRule::new(self.inner.clone())
14042 }
14043
14044 /// Deletes the specified policy.
14045 pub fn delete(&self) -> super::builder::region_security_policies::Delete {
14046 super::builder::region_security_policies::Delete::new(self.inner.clone())
14047 }
14048
14049 /// List all of the ordered rules present in a single specified policy.
14050 pub fn get(&self) -> super::builder::region_security_policies::Get {
14051 super::builder::region_security_policies::Get::new(self.inner.clone())
14052 }
14053
14054 /// Gets a rule at the specified priority.
14055 pub fn get_rule(&self) -> super::builder::region_security_policies::GetRule {
14056 super::builder::region_security_policies::GetRule::new(self.inner.clone())
14057 }
14058
14059 /// Creates a new policy in the specified project using the data included in
14060 /// the request.
14061 pub fn insert(&self) -> super::builder::region_security_policies::Insert {
14062 super::builder::region_security_policies::Insert::new(self.inner.clone())
14063 }
14064
14065 /// List all the policies that have been configured for the specified project
14066 /// and region.
14067 pub fn list(&self) -> super::builder::region_security_policies::List {
14068 super::builder::region_security_policies::List::new(self.inner.clone())
14069 }
14070
14071 /// Patches the specified policy with the data included in the request. To
14072 /// clear fields in the policy, leave the fields empty and specify them in the
14073 /// updateMask. This cannot be used to be update the rules in the policy.
14074 /// Please use the per rule methods like addRule, patchRule, and removeRule
14075 /// instead.
14076 pub fn patch(&self) -> super::builder::region_security_policies::Patch {
14077 super::builder::region_security_policies::Patch::new(self.inner.clone())
14078 }
14079
14080 /// Patches a rule at the specified priority. To clear fields in the rule,
14081 /// leave the fields empty and specify them in the updateMask.
14082 pub fn patch_rule(&self) -> super::builder::region_security_policies::PatchRule {
14083 super::builder::region_security_policies::PatchRule::new(self.inner.clone())
14084 }
14085
14086 /// Deletes a rule at the specified priority.
14087 pub fn remove_rule(&self) -> super::builder::region_security_policies::RemoveRule {
14088 super::builder::region_security_policies::RemoveRule::new(self.inner.clone())
14089 }
14090
14091 /// Sets the labels on a security policy. To learn more about labels,
14092 /// read the Labeling Resources
14093 /// documentation.
14094 pub fn set_labels(&self) -> super::builder::region_security_policies::SetLabels {
14095 super::builder::region_security_policies::SetLabels::new(self.inner.clone())
14096 }
14097
14098 /// Retrieves the specified region-specific Operations resource.
14099 pub fn get_operation(&self) -> super::builder::region_security_policies::GetOperation {
14100 super::builder::region_security_policies::GetOperation::new(self.inner.clone())
14101 }
14102}
14103
14104/// Implements a client for the Google Compute Engine API.
14105///
14106/// # Example
14107/// ```
14108/// # use google_cloud_compute_v1::client::RegionSnapshotSettings;
14109/// async fn sample(
14110/// ) -> anyhow::Result<()> {
14111/// let client = RegionSnapshotSettings::builder().build().await?;
14112/// // use `client` to make requests to the Google Compute Engine API.
14113/// Ok(())
14114/// }
14115/// ```
14116///
14117/// # Service Description
14118///
14119/// Service for the `regionSnapshotSettings` resource.
14120///
14121/// # Configuration
14122///
14123/// To configure `RegionSnapshotSettings` use the `with_*` methods in the type returned
14124/// by [builder()][RegionSnapshotSettings::builder]. The default configuration should
14125/// work for most applications. Common configuration changes include
14126///
14127/// * [with_endpoint()]: by default this client uses the global default endpoint
14128/// (`https://compute.googleapis.com`). Applications using regional
14129/// endpoints or running in restricted networks (e.g. a network configured
14130/// with [Private Google Access with VPC Service Controls]) may want to
14131/// override this default.
14132/// * [with_credentials()]: by default this client uses
14133/// [Application Default Credentials]. Applications using custom
14134/// authentication may need to override this default.
14135///
14136/// [with_endpoint()]: super::builder::region_snapshot_settings::ClientBuilder::with_endpoint
14137/// [with_credentials()]: super::builder::region_snapshot_settings::ClientBuilder::with_credentials
14138/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14139/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14140///
14141/// # Pooling and Cloning
14142///
14143/// `RegionSnapshotSettings` holds a connection pool internally, it is advised to
14144/// create one and reuse it. You do not need to wrap `RegionSnapshotSettings` in
14145/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14146/// already uses an `Arc` internally.
14147#[cfg(feature = "region-snapshot-settings")]
14148#[cfg_attr(docsrs, doc(cfg(feature = "region-snapshot-settings")))]
14149#[derive(Clone, Debug)]
14150pub struct RegionSnapshotSettings {
14151 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSnapshotSettings>,
14152}
14153
14154#[cfg(feature = "region-snapshot-settings")]
14155impl RegionSnapshotSettings {
14156 /// Returns a builder for [RegionSnapshotSettings].
14157 ///
14158 /// ```
14159 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14160 /// # use google_cloud_compute_v1::client::RegionSnapshotSettings;
14161 /// let client = RegionSnapshotSettings::builder().build().await?;
14162 /// # Ok(()) }
14163 /// ```
14164 pub fn builder() -> super::builder::region_snapshot_settings::ClientBuilder {
14165 crate::new_client_builder(super::builder::region_snapshot_settings::client::Factory)
14166 }
14167
14168 /// Creates a new client from the provided stub.
14169 ///
14170 /// The most common case for calling this function is in tests mocking the
14171 /// client's behavior.
14172 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14173 where
14174 T: super::stub::RegionSnapshotSettings + 'static,
14175 {
14176 Self { inner: stub.into() }
14177 }
14178
14179 pub(crate) async fn new(
14180 config: gaxi::options::ClientConfig,
14181 ) -> crate::ClientBuilderResult<Self> {
14182 let inner = Self::build_inner(config).await?;
14183 Ok(Self { inner })
14184 }
14185
14186 async fn build_inner(
14187 conf: gaxi::options::ClientConfig,
14188 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSnapshotSettings>>
14189 {
14190 if gaxi::options::tracing_enabled(&conf) {
14191 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14192 }
14193 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14194 }
14195
14196 async fn build_transport(
14197 conf: gaxi::options::ClientConfig,
14198 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshotSettings> {
14199 super::transport::RegionSnapshotSettings::new(conf).await
14200 }
14201
14202 async fn build_with_tracing(
14203 conf: gaxi::options::ClientConfig,
14204 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshotSettings> {
14205 Self::build_transport(conf)
14206 .await
14207 .map(super::tracing::RegionSnapshotSettings::new)
14208 }
14209
14210 /// Get region snapshot settings.
14211 pub fn get(&self) -> super::builder::region_snapshot_settings::Get {
14212 super::builder::region_snapshot_settings::Get::new(self.inner.clone())
14213 }
14214
14215 /// Patch region snapshot settings.
14216 pub fn patch(&self) -> super::builder::region_snapshot_settings::Patch {
14217 super::builder::region_snapshot_settings::Patch::new(self.inner.clone())
14218 }
14219
14220 /// Retrieves the specified region-specific Operations resource.
14221 pub fn get_operation(&self) -> super::builder::region_snapshot_settings::GetOperation {
14222 super::builder::region_snapshot_settings::GetOperation::new(self.inner.clone())
14223 }
14224}
14225
14226/// Implements a client for the Google Compute Engine API.
14227///
14228/// # Example
14229/// ```
14230/// # use google_cloud_compute_v1::client::RegionSnapshots;
14231/// async fn sample(
14232/// ) -> anyhow::Result<()> {
14233/// let client = RegionSnapshots::builder().build().await?;
14234/// // use `client` to make requests to the Google Compute Engine API.
14235/// Ok(())
14236/// }
14237/// ```
14238///
14239/// # Service Description
14240///
14241/// Service for the `regionSnapshots` resource.
14242///
14243/// # Configuration
14244///
14245/// To configure `RegionSnapshots` use the `with_*` methods in the type returned
14246/// by [builder()][RegionSnapshots::builder]. The default configuration should
14247/// work for most applications. Common configuration changes include
14248///
14249/// * [with_endpoint()]: by default this client uses the global default endpoint
14250/// (`https://compute.googleapis.com`). Applications using regional
14251/// endpoints or running in restricted networks (e.g. a network configured
14252/// with [Private Google Access with VPC Service Controls]) may want to
14253/// override this default.
14254/// * [with_credentials()]: by default this client uses
14255/// [Application Default Credentials]. Applications using custom
14256/// authentication may need to override this default.
14257///
14258/// [with_endpoint()]: super::builder::region_snapshots::ClientBuilder::with_endpoint
14259/// [with_credentials()]: super::builder::region_snapshots::ClientBuilder::with_credentials
14260/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14261/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14262///
14263/// # Pooling and Cloning
14264///
14265/// `RegionSnapshots` holds a connection pool internally, it is advised to
14266/// create one and reuse it. You do not need to wrap `RegionSnapshots` in
14267/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14268/// already uses an `Arc` internally.
14269#[cfg(feature = "region-snapshots")]
14270#[cfg_attr(docsrs, doc(cfg(feature = "region-snapshots")))]
14271#[derive(Clone, Debug)]
14272pub struct RegionSnapshots {
14273 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSnapshots>,
14274}
14275
14276#[cfg(feature = "region-snapshots")]
14277impl RegionSnapshots {
14278 /// Returns a builder for [RegionSnapshots].
14279 ///
14280 /// ```
14281 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14282 /// # use google_cloud_compute_v1::client::RegionSnapshots;
14283 /// let client = RegionSnapshots::builder().build().await?;
14284 /// # Ok(()) }
14285 /// ```
14286 pub fn builder() -> super::builder::region_snapshots::ClientBuilder {
14287 crate::new_client_builder(super::builder::region_snapshots::client::Factory)
14288 }
14289
14290 /// Creates a new client from the provided stub.
14291 ///
14292 /// The most common case for calling this function is in tests mocking the
14293 /// client's behavior.
14294 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14295 where
14296 T: super::stub::RegionSnapshots + 'static,
14297 {
14298 Self { inner: stub.into() }
14299 }
14300
14301 pub(crate) async fn new(
14302 config: gaxi::options::ClientConfig,
14303 ) -> crate::ClientBuilderResult<Self> {
14304 let inner = Self::build_inner(config).await?;
14305 Ok(Self { inner })
14306 }
14307
14308 async fn build_inner(
14309 conf: gaxi::options::ClientConfig,
14310 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSnapshots>> {
14311 if gaxi::options::tracing_enabled(&conf) {
14312 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14313 }
14314 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14315 }
14316
14317 async fn build_transport(
14318 conf: gaxi::options::ClientConfig,
14319 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshots> {
14320 super::transport::RegionSnapshots::new(conf).await
14321 }
14322
14323 async fn build_with_tracing(
14324 conf: gaxi::options::ClientConfig,
14325 ) -> crate::ClientBuilderResult<impl super::stub::RegionSnapshots> {
14326 Self::build_transport(conf)
14327 .await
14328 .map(super::tracing::RegionSnapshots::new)
14329 }
14330
14331 /// Deletes the specified Snapshot resource. Keep in mind that deleting
14332 /// a single snapshot might not necessarily delete all the data on that
14333 /// snapshot. If any data on the snapshot that is marked for deletion is
14334 /// needed for subsequent snapshots, the data will be moved to the next
14335 /// corresponding snapshot.
14336 ///
14337 /// For more information, seeDeleting
14338 /// snapshots.
14339 pub fn delete(&self) -> super::builder::region_snapshots::Delete {
14340 super::builder::region_snapshots::Delete::new(self.inner.clone())
14341 }
14342
14343 /// Returns the specified Snapshot resource.
14344 pub fn get(&self) -> super::builder::region_snapshots::Get {
14345 super::builder::region_snapshots::Get::new(self.inner.clone())
14346 }
14347
14348 /// Gets the access control policy for a resource. May be empty if no such
14349 /// policy or resource exists.
14350 pub fn get_iam_policy(&self) -> super::builder::region_snapshots::GetIamPolicy {
14351 super::builder::region_snapshots::GetIamPolicy::new(self.inner.clone())
14352 }
14353
14354 /// Creates a snapshot in the specified region using the data included
14355 /// in the request.
14356 pub fn insert(&self) -> super::builder::region_snapshots::Insert {
14357 super::builder::region_snapshots::Insert::new(self.inner.clone())
14358 }
14359
14360 /// Retrieves the list of Snapshot resources contained within
14361 /// the specified region.
14362 pub fn list(&self) -> super::builder::region_snapshots::List {
14363 super::builder::region_snapshots::List::new(self.inner.clone())
14364 }
14365
14366 /// Sets the access control policy on the specified resource.
14367 /// Replaces any existing policy.
14368 pub fn set_iam_policy(&self) -> super::builder::region_snapshots::SetIamPolicy {
14369 super::builder::region_snapshots::SetIamPolicy::new(self.inner.clone())
14370 }
14371
14372 /// Sets the labels on a regional snapshot. To learn more about labels, read
14373 /// the Labeling Resources
14374 /// documentation.
14375 pub fn set_labels(&self) -> super::builder::region_snapshots::SetLabels {
14376 super::builder::region_snapshots::SetLabels::new(self.inner.clone())
14377 }
14378
14379 /// Returns permissions that a caller has on the specified resource.
14380 pub fn test_iam_permissions(&self) -> super::builder::region_snapshots::TestIamPermissions {
14381 super::builder::region_snapshots::TestIamPermissions::new(self.inner.clone())
14382 }
14383
14384 /// Rotates the customer-managed
14385 /// encryption key to the latest version for the specified snapshot.
14386 pub fn update_kms_key(&self) -> super::builder::region_snapshots::UpdateKmsKey {
14387 super::builder::region_snapshots::UpdateKmsKey::new(self.inner.clone())
14388 }
14389
14390 /// Retrieves the specified region-specific Operations resource.
14391 pub fn get_operation(&self) -> super::builder::region_snapshots::GetOperation {
14392 super::builder::region_snapshots::GetOperation::new(self.inner.clone())
14393 }
14394}
14395
14396/// Implements a client for the Google Compute Engine API.
14397///
14398/// # Example
14399/// ```
14400/// # use google_cloud_compute_v1::client::RegionSslCertificates;
14401/// async fn sample(
14402/// ) -> anyhow::Result<()> {
14403/// let client = RegionSslCertificates::builder().build().await?;
14404/// // use `client` to make requests to the Google Compute Engine API.
14405/// Ok(())
14406/// }
14407/// ```
14408///
14409/// # Service Description
14410///
14411/// Service for the `regionSslCertificates` resource.
14412///
14413/// # Configuration
14414///
14415/// To configure `RegionSslCertificates` use the `with_*` methods in the type returned
14416/// by [builder()][RegionSslCertificates::builder]. The default configuration should
14417/// work for most applications. Common configuration changes include
14418///
14419/// * [with_endpoint()]: by default this client uses the global default endpoint
14420/// (`https://compute.googleapis.com`). Applications using regional
14421/// endpoints or running in restricted networks (e.g. a network configured
14422/// with [Private Google Access with VPC Service Controls]) may want to
14423/// override this default.
14424/// * [with_credentials()]: by default this client uses
14425/// [Application Default Credentials]. Applications using custom
14426/// authentication may need to override this default.
14427///
14428/// [with_endpoint()]: super::builder::region_ssl_certificates::ClientBuilder::with_endpoint
14429/// [with_credentials()]: super::builder::region_ssl_certificates::ClientBuilder::with_credentials
14430/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14431/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14432///
14433/// # Pooling and Cloning
14434///
14435/// `RegionSslCertificates` holds a connection pool internally, it is advised to
14436/// create one and reuse it. You do not need to wrap `RegionSslCertificates` in
14437/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14438/// already uses an `Arc` internally.
14439#[cfg(feature = "region-ssl-certificates")]
14440#[cfg_attr(docsrs, doc(cfg(feature = "region-ssl-certificates")))]
14441#[derive(Clone, Debug)]
14442pub struct RegionSslCertificates {
14443 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSslCertificates>,
14444}
14445
14446#[cfg(feature = "region-ssl-certificates")]
14447impl RegionSslCertificates {
14448 /// Returns a builder for [RegionSslCertificates].
14449 ///
14450 /// ```
14451 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14452 /// # use google_cloud_compute_v1::client::RegionSslCertificates;
14453 /// let client = RegionSslCertificates::builder().build().await?;
14454 /// # Ok(()) }
14455 /// ```
14456 pub fn builder() -> super::builder::region_ssl_certificates::ClientBuilder {
14457 crate::new_client_builder(super::builder::region_ssl_certificates::client::Factory)
14458 }
14459
14460 /// Creates a new client from the provided stub.
14461 ///
14462 /// The most common case for calling this function is in tests mocking the
14463 /// client's behavior.
14464 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14465 where
14466 T: super::stub::RegionSslCertificates + 'static,
14467 {
14468 Self { inner: stub.into() }
14469 }
14470
14471 pub(crate) async fn new(
14472 config: gaxi::options::ClientConfig,
14473 ) -> crate::ClientBuilderResult<Self> {
14474 let inner = Self::build_inner(config).await?;
14475 Ok(Self { inner })
14476 }
14477
14478 async fn build_inner(
14479 conf: gaxi::options::ClientConfig,
14480 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSslCertificates>>
14481 {
14482 if gaxi::options::tracing_enabled(&conf) {
14483 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14484 }
14485 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14486 }
14487
14488 async fn build_transport(
14489 conf: gaxi::options::ClientConfig,
14490 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslCertificates> {
14491 super::transport::RegionSslCertificates::new(conf).await
14492 }
14493
14494 async fn build_with_tracing(
14495 conf: gaxi::options::ClientConfig,
14496 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslCertificates> {
14497 Self::build_transport(conf)
14498 .await
14499 .map(super::tracing::RegionSslCertificates::new)
14500 }
14501
14502 /// Deletes the specified SslCertificate resource in the region.
14503 pub fn delete(&self) -> super::builder::region_ssl_certificates::Delete {
14504 super::builder::region_ssl_certificates::Delete::new(self.inner.clone())
14505 }
14506
14507 /// Returns the specified SslCertificate resource in the specified region. Get
14508 /// a list of available SSL certificates by making a list()
14509 /// request.
14510 pub fn get(&self) -> super::builder::region_ssl_certificates::Get {
14511 super::builder::region_ssl_certificates::Get::new(self.inner.clone())
14512 }
14513
14514 /// Creates a SslCertificate resource in the specified project and region using
14515 /// the data included in the request
14516 pub fn insert(&self) -> super::builder::region_ssl_certificates::Insert {
14517 super::builder::region_ssl_certificates::Insert::new(self.inner.clone())
14518 }
14519
14520 /// Retrieves the list of SslCertificate resources available to the specified
14521 /// project in the specified region.
14522 pub fn list(&self) -> super::builder::region_ssl_certificates::List {
14523 super::builder::region_ssl_certificates::List::new(self.inner.clone())
14524 }
14525
14526 /// Retrieves the specified region-specific Operations resource.
14527 pub fn get_operation(&self) -> super::builder::region_ssl_certificates::GetOperation {
14528 super::builder::region_ssl_certificates::GetOperation::new(self.inner.clone())
14529 }
14530}
14531
14532/// Implements a client for the Google Compute Engine API.
14533///
14534/// # Example
14535/// ```
14536/// # use google_cloud_compute_v1::client::RegionSslPolicies;
14537/// async fn sample(
14538/// ) -> anyhow::Result<()> {
14539/// let client = RegionSslPolicies::builder().build().await?;
14540/// // use `client` to make requests to the Google Compute Engine API.
14541/// Ok(())
14542/// }
14543/// ```
14544///
14545/// # Service Description
14546///
14547/// Service for the `regionSslPolicies` resource.
14548///
14549/// # Configuration
14550///
14551/// To configure `RegionSslPolicies` use the `with_*` methods in the type returned
14552/// by [builder()][RegionSslPolicies::builder]. The default configuration should
14553/// work for most applications. Common configuration changes include
14554///
14555/// * [with_endpoint()]: by default this client uses the global default endpoint
14556/// (`https://compute.googleapis.com`). Applications using regional
14557/// endpoints or running in restricted networks (e.g. a network configured
14558/// with [Private Google Access with VPC Service Controls]) may want to
14559/// override this default.
14560/// * [with_credentials()]: by default this client uses
14561/// [Application Default Credentials]. Applications using custom
14562/// authentication may need to override this default.
14563///
14564/// [with_endpoint()]: super::builder::region_ssl_policies::ClientBuilder::with_endpoint
14565/// [with_credentials()]: super::builder::region_ssl_policies::ClientBuilder::with_credentials
14566/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14567/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14568///
14569/// # Pooling and Cloning
14570///
14571/// `RegionSslPolicies` holds a connection pool internally, it is advised to
14572/// create one and reuse it. You do not need to wrap `RegionSslPolicies` in
14573/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14574/// already uses an `Arc` internally.
14575#[cfg(feature = "region-ssl-policies")]
14576#[cfg_attr(docsrs, doc(cfg(feature = "region-ssl-policies")))]
14577#[derive(Clone, Debug)]
14578pub struct RegionSslPolicies {
14579 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSslPolicies>,
14580}
14581
14582#[cfg(feature = "region-ssl-policies")]
14583impl RegionSslPolicies {
14584 /// Returns a builder for [RegionSslPolicies].
14585 ///
14586 /// ```
14587 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14588 /// # use google_cloud_compute_v1::client::RegionSslPolicies;
14589 /// let client = RegionSslPolicies::builder().build().await?;
14590 /// # Ok(()) }
14591 /// ```
14592 pub fn builder() -> super::builder::region_ssl_policies::ClientBuilder {
14593 crate::new_client_builder(super::builder::region_ssl_policies::client::Factory)
14594 }
14595
14596 /// Creates a new client from the provided stub.
14597 ///
14598 /// The most common case for calling this function is in tests mocking the
14599 /// client's behavior.
14600 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14601 where
14602 T: super::stub::RegionSslPolicies + 'static,
14603 {
14604 Self { inner: stub.into() }
14605 }
14606
14607 pub(crate) async fn new(
14608 config: gaxi::options::ClientConfig,
14609 ) -> crate::ClientBuilderResult<Self> {
14610 let inner = Self::build_inner(config).await?;
14611 Ok(Self { inner })
14612 }
14613
14614 async fn build_inner(
14615 conf: gaxi::options::ClientConfig,
14616 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionSslPolicies>>
14617 {
14618 if gaxi::options::tracing_enabled(&conf) {
14619 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14620 }
14621 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14622 }
14623
14624 async fn build_transport(
14625 conf: gaxi::options::ClientConfig,
14626 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslPolicies> {
14627 super::transport::RegionSslPolicies::new(conf).await
14628 }
14629
14630 async fn build_with_tracing(
14631 conf: gaxi::options::ClientConfig,
14632 ) -> crate::ClientBuilderResult<impl super::stub::RegionSslPolicies> {
14633 Self::build_transport(conf)
14634 .await
14635 .map(super::tracing::RegionSslPolicies::new)
14636 }
14637
14638 /// Deletes the specified SSL policy. The SSL policy resource can be deleted
14639 /// only if it is not in use by any TargetHttpsProxy or TargetSslProxy
14640 /// resources.
14641 pub fn delete(&self) -> super::builder::region_ssl_policies::Delete {
14642 super::builder::region_ssl_policies::Delete::new(self.inner.clone())
14643 }
14644
14645 /// Lists all of the ordered rules present in a single specified policy.
14646 pub fn get(&self) -> super::builder::region_ssl_policies::Get {
14647 super::builder::region_ssl_policies::Get::new(self.inner.clone())
14648 }
14649
14650 /// Creates a new policy in the specified project and region using the data
14651 /// included in the request.
14652 pub fn insert(&self) -> super::builder::region_ssl_policies::Insert {
14653 super::builder::region_ssl_policies::Insert::new(self.inner.clone())
14654 }
14655
14656 /// Lists all the SSL policies that have been configured for the specified
14657 /// project and region.
14658 pub fn list(&self) -> super::builder::region_ssl_policies::List {
14659 super::builder::region_ssl_policies::List::new(self.inner.clone())
14660 }
14661
14662 /// Lists all features that can be specified in the SSL policy when using
14663 /// custom profile.
14664 pub fn list_available_features(
14665 &self,
14666 ) -> super::builder::region_ssl_policies::ListAvailableFeatures {
14667 super::builder::region_ssl_policies::ListAvailableFeatures::new(self.inner.clone())
14668 }
14669
14670 /// Patches the specified SSL policy with the data included in the request.
14671 pub fn patch(&self) -> super::builder::region_ssl_policies::Patch {
14672 super::builder::region_ssl_policies::Patch::new(self.inner.clone())
14673 }
14674
14675 /// Retrieves the specified region-specific Operations resource.
14676 pub fn get_operation(&self) -> super::builder::region_ssl_policies::GetOperation {
14677 super::builder::region_ssl_policies::GetOperation::new(self.inner.clone())
14678 }
14679}
14680
14681/// Implements a client for the Google Compute Engine API.
14682///
14683/// # Example
14684/// ```
14685/// # use google_cloud_compute_v1::client::RegionTargetHttpProxies;
14686/// async fn sample(
14687/// ) -> anyhow::Result<()> {
14688/// let client = RegionTargetHttpProxies::builder().build().await?;
14689/// // use `client` to make requests to the Google Compute Engine API.
14690/// Ok(())
14691/// }
14692/// ```
14693///
14694/// # Service Description
14695///
14696/// Service for the `regionTargetHttpProxies` resource.
14697///
14698/// # Configuration
14699///
14700/// To configure `RegionTargetHttpProxies` use the `with_*` methods in the type returned
14701/// by [builder()][RegionTargetHttpProxies::builder]. The default configuration should
14702/// work for most applications. Common configuration changes include
14703///
14704/// * [with_endpoint()]: by default this client uses the global default endpoint
14705/// (`https://compute.googleapis.com`). Applications using regional
14706/// endpoints or running in restricted networks (e.g. a network configured
14707/// with [Private Google Access with VPC Service Controls]) may want to
14708/// override this default.
14709/// * [with_credentials()]: by default this client uses
14710/// [Application Default Credentials]. Applications using custom
14711/// authentication may need to override this default.
14712///
14713/// [with_endpoint()]: super::builder::region_target_http_proxies::ClientBuilder::with_endpoint
14714/// [with_credentials()]: super::builder::region_target_http_proxies::ClientBuilder::with_credentials
14715/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14716/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14717///
14718/// # Pooling and Cloning
14719///
14720/// `RegionTargetHttpProxies` holds a connection pool internally, it is advised to
14721/// create one and reuse it. You do not need to wrap `RegionTargetHttpProxies` in
14722/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14723/// already uses an `Arc` internally.
14724#[cfg(feature = "region-target-http-proxies")]
14725#[cfg_attr(docsrs, doc(cfg(feature = "region-target-http-proxies")))]
14726#[derive(Clone, Debug)]
14727pub struct RegionTargetHttpProxies {
14728 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpProxies>,
14729}
14730
14731#[cfg(feature = "region-target-http-proxies")]
14732impl RegionTargetHttpProxies {
14733 /// Returns a builder for [RegionTargetHttpProxies].
14734 ///
14735 /// ```
14736 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14737 /// # use google_cloud_compute_v1::client::RegionTargetHttpProxies;
14738 /// let client = RegionTargetHttpProxies::builder().build().await?;
14739 /// # Ok(()) }
14740 /// ```
14741 pub fn builder() -> super::builder::region_target_http_proxies::ClientBuilder {
14742 crate::new_client_builder(super::builder::region_target_http_proxies::client::Factory)
14743 }
14744
14745 /// Creates a new client from the provided stub.
14746 ///
14747 /// The most common case for calling this function is in tests mocking the
14748 /// client's behavior.
14749 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14750 where
14751 T: super::stub::RegionTargetHttpProxies + 'static,
14752 {
14753 Self { inner: stub.into() }
14754 }
14755
14756 pub(crate) async fn new(
14757 config: gaxi::options::ClientConfig,
14758 ) -> crate::ClientBuilderResult<Self> {
14759 let inner = Self::build_inner(config).await?;
14760 Ok(Self { inner })
14761 }
14762
14763 async fn build_inner(
14764 conf: gaxi::options::ClientConfig,
14765 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpProxies>>
14766 {
14767 if gaxi::options::tracing_enabled(&conf) {
14768 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14769 }
14770 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14771 }
14772
14773 async fn build_transport(
14774 conf: gaxi::options::ClientConfig,
14775 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpProxies> {
14776 super::transport::RegionTargetHttpProxies::new(conf).await
14777 }
14778
14779 async fn build_with_tracing(
14780 conf: gaxi::options::ClientConfig,
14781 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpProxies> {
14782 Self::build_transport(conf)
14783 .await
14784 .map(super::tracing::RegionTargetHttpProxies::new)
14785 }
14786
14787 /// Deletes the specified TargetHttpProxy resource.
14788 pub fn delete(&self) -> super::builder::region_target_http_proxies::Delete {
14789 super::builder::region_target_http_proxies::Delete::new(self.inner.clone())
14790 }
14791
14792 /// Returns the specified TargetHttpProxy resource in the specified region.
14793 pub fn get(&self) -> super::builder::region_target_http_proxies::Get {
14794 super::builder::region_target_http_proxies::Get::new(self.inner.clone())
14795 }
14796
14797 /// Creates a TargetHttpProxy resource in the specified project and region
14798 /// using the data included in the request.
14799 pub fn insert(&self) -> super::builder::region_target_http_proxies::Insert {
14800 super::builder::region_target_http_proxies::Insert::new(self.inner.clone())
14801 }
14802
14803 /// Retrieves the list of TargetHttpProxy resources available
14804 /// to the specified project in the specified region.
14805 pub fn list(&self) -> super::builder::region_target_http_proxies::List {
14806 super::builder::region_target_http_proxies::List::new(self.inner.clone())
14807 }
14808
14809 /// Changes the URL map for TargetHttpProxy.
14810 pub fn set_url_map(&self) -> super::builder::region_target_http_proxies::SetUrlMap {
14811 super::builder::region_target_http_proxies::SetUrlMap::new(self.inner.clone())
14812 }
14813
14814 /// Retrieves the specified region-specific Operations resource.
14815 pub fn get_operation(&self) -> super::builder::region_target_http_proxies::GetOperation {
14816 super::builder::region_target_http_proxies::GetOperation::new(self.inner.clone())
14817 }
14818}
14819
14820/// Implements a client for the Google Compute Engine API.
14821///
14822/// # Example
14823/// ```
14824/// # use google_cloud_compute_v1::client::RegionTargetHttpsProxies;
14825/// async fn sample(
14826/// ) -> anyhow::Result<()> {
14827/// let client = RegionTargetHttpsProxies::builder().build().await?;
14828/// // use `client` to make requests to the Google Compute Engine API.
14829/// Ok(())
14830/// }
14831/// ```
14832///
14833/// # Service Description
14834///
14835/// Service for the `regionTargetHttpsProxies` resource.
14836///
14837/// # Configuration
14838///
14839/// To configure `RegionTargetHttpsProxies` use the `with_*` methods in the type returned
14840/// by [builder()][RegionTargetHttpsProxies::builder]. The default configuration should
14841/// work for most applications. Common configuration changes include
14842///
14843/// * [with_endpoint()]: by default this client uses the global default endpoint
14844/// (`https://compute.googleapis.com`). Applications using regional
14845/// endpoints or running in restricted networks (e.g. a network configured
14846/// with [Private Google Access with VPC Service Controls]) may want to
14847/// override this default.
14848/// * [with_credentials()]: by default this client uses
14849/// [Application Default Credentials]. Applications using custom
14850/// authentication may need to override this default.
14851///
14852/// [with_endpoint()]: super::builder::region_target_https_proxies::ClientBuilder::with_endpoint
14853/// [with_credentials()]: super::builder::region_target_https_proxies::ClientBuilder::with_credentials
14854/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14855/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14856///
14857/// # Pooling and Cloning
14858///
14859/// `RegionTargetHttpsProxies` holds a connection pool internally, it is advised to
14860/// create one and reuse it. You do not need to wrap `RegionTargetHttpsProxies` in
14861/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14862/// already uses an `Arc` internally.
14863#[cfg(feature = "region-target-https-proxies")]
14864#[cfg_attr(docsrs, doc(cfg(feature = "region-target-https-proxies")))]
14865#[derive(Clone, Debug)]
14866pub struct RegionTargetHttpsProxies {
14867 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpsProxies>,
14868}
14869
14870#[cfg(feature = "region-target-https-proxies")]
14871impl RegionTargetHttpsProxies {
14872 /// Returns a builder for [RegionTargetHttpsProxies].
14873 ///
14874 /// ```
14875 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
14876 /// # use google_cloud_compute_v1::client::RegionTargetHttpsProxies;
14877 /// let client = RegionTargetHttpsProxies::builder().build().await?;
14878 /// # Ok(()) }
14879 /// ```
14880 pub fn builder() -> super::builder::region_target_https_proxies::ClientBuilder {
14881 crate::new_client_builder(super::builder::region_target_https_proxies::client::Factory)
14882 }
14883
14884 /// Creates a new client from the provided stub.
14885 ///
14886 /// The most common case for calling this function is in tests mocking the
14887 /// client's behavior.
14888 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
14889 where
14890 T: super::stub::RegionTargetHttpsProxies + 'static,
14891 {
14892 Self { inner: stub.into() }
14893 }
14894
14895 pub(crate) async fn new(
14896 config: gaxi::options::ClientConfig,
14897 ) -> crate::ClientBuilderResult<Self> {
14898 let inner = Self::build_inner(config).await?;
14899 Ok(Self { inner })
14900 }
14901
14902 async fn build_inner(
14903 conf: gaxi::options::ClientConfig,
14904 ) -> crate::ClientBuilderResult<
14905 std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpsProxies>,
14906 > {
14907 if gaxi::options::tracing_enabled(&conf) {
14908 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14909 }
14910 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14911 }
14912
14913 async fn build_transport(
14914 conf: gaxi::options::ClientConfig,
14915 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpsProxies> {
14916 super::transport::RegionTargetHttpsProxies::new(conf).await
14917 }
14918
14919 async fn build_with_tracing(
14920 conf: gaxi::options::ClientConfig,
14921 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetHttpsProxies> {
14922 Self::build_transport(conf)
14923 .await
14924 .map(super::tracing::RegionTargetHttpsProxies::new)
14925 }
14926
14927 /// Deletes the specified TargetHttpsProxy resource.
14928 pub fn delete(&self) -> super::builder::region_target_https_proxies::Delete {
14929 super::builder::region_target_https_proxies::Delete::new(self.inner.clone())
14930 }
14931
14932 /// Returns the specified TargetHttpsProxy resource in the specified region.
14933 pub fn get(&self) -> super::builder::region_target_https_proxies::Get {
14934 super::builder::region_target_https_proxies::Get::new(self.inner.clone())
14935 }
14936
14937 /// Creates a TargetHttpsProxy resource in the specified project and region
14938 /// using the data included in the request.
14939 pub fn insert(&self) -> super::builder::region_target_https_proxies::Insert {
14940 super::builder::region_target_https_proxies::Insert::new(self.inner.clone())
14941 }
14942
14943 /// Retrieves the list of TargetHttpsProxy resources available
14944 /// to the specified project in the specified region.
14945 pub fn list(&self) -> super::builder::region_target_https_proxies::List {
14946 super::builder::region_target_https_proxies::List::new(self.inner.clone())
14947 }
14948
14949 /// Patches the specified regional TargetHttpsProxy resource with the data
14950 /// included in the request. This method supports PATCH
14951 /// semantics and usesJSON merge
14952 /// patch format and processing rules.
14953 pub fn patch(&self) -> super::builder::region_target_https_proxies::Patch {
14954 super::builder::region_target_https_proxies::Patch::new(self.inner.clone())
14955 }
14956
14957 /// Replaces SslCertificates for TargetHttpsProxy.
14958 pub fn set_ssl_certificates(
14959 &self,
14960 ) -> super::builder::region_target_https_proxies::SetSslCertificates {
14961 super::builder::region_target_https_proxies::SetSslCertificates::new(self.inner.clone())
14962 }
14963
14964 /// Changes the URL map for TargetHttpsProxy.
14965 pub fn set_url_map(&self) -> super::builder::region_target_https_proxies::SetUrlMap {
14966 super::builder::region_target_https_proxies::SetUrlMap::new(self.inner.clone())
14967 }
14968
14969 /// Retrieves the specified region-specific Operations resource.
14970 pub fn get_operation(&self) -> super::builder::region_target_https_proxies::GetOperation {
14971 super::builder::region_target_https_proxies::GetOperation::new(self.inner.clone())
14972 }
14973}
14974
14975/// Implements a client for the Google Compute Engine API.
14976///
14977/// # Example
14978/// ```
14979/// # use google_cloud_compute_v1::client::RegionTargetTcpProxies;
14980/// async fn sample(
14981/// ) -> anyhow::Result<()> {
14982/// let client = RegionTargetTcpProxies::builder().build().await?;
14983/// // use `client` to make requests to the Google Compute Engine API.
14984/// Ok(())
14985/// }
14986/// ```
14987///
14988/// # Service Description
14989///
14990/// Service for the `regionTargetTcpProxies` resource.
14991///
14992/// # Configuration
14993///
14994/// To configure `RegionTargetTcpProxies` use the `with_*` methods in the type returned
14995/// by [builder()][RegionTargetTcpProxies::builder]. The default configuration should
14996/// work for most applications. Common configuration changes include
14997///
14998/// * [with_endpoint()]: by default this client uses the global default endpoint
14999/// (`https://compute.googleapis.com`). Applications using regional
15000/// endpoints or running in restricted networks (e.g. a network configured
15001/// with [Private Google Access with VPC Service Controls]) may want to
15002/// override this default.
15003/// * [with_credentials()]: by default this client uses
15004/// [Application Default Credentials]. Applications using custom
15005/// authentication may need to override this default.
15006///
15007/// [with_endpoint()]: super::builder::region_target_tcp_proxies::ClientBuilder::with_endpoint
15008/// [with_credentials()]: super::builder::region_target_tcp_proxies::ClientBuilder::with_credentials
15009/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15010/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15011///
15012/// # Pooling and Cloning
15013///
15014/// `RegionTargetTcpProxies` holds a connection pool internally, it is advised to
15015/// create one and reuse it. You do not need to wrap `RegionTargetTcpProxies` in
15016/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15017/// already uses an `Arc` internally.
15018#[cfg(feature = "region-target-tcp-proxies")]
15019#[cfg_attr(docsrs, doc(cfg(feature = "region-target-tcp-proxies")))]
15020#[derive(Clone, Debug)]
15021pub struct RegionTargetTcpProxies {
15022 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetTcpProxies>,
15023}
15024
15025#[cfg(feature = "region-target-tcp-proxies")]
15026impl RegionTargetTcpProxies {
15027 /// Returns a builder for [RegionTargetTcpProxies].
15028 ///
15029 /// ```
15030 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15031 /// # use google_cloud_compute_v1::client::RegionTargetTcpProxies;
15032 /// let client = RegionTargetTcpProxies::builder().build().await?;
15033 /// # Ok(()) }
15034 /// ```
15035 pub fn builder() -> super::builder::region_target_tcp_proxies::ClientBuilder {
15036 crate::new_client_builder(super::builder::region_target_tcp_proxies::client::Factory)
15037 }
15038
15039 /// Creates a new client from the provided stub.
15040 ///
15041 /// The most common case for calling this function is in tests mocking the
15042 /// client's behavior.
15043 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15044 where
15045 T: super::stub::RegionTargetTcpProxies + 'static,
15046 {
15047 Self { inner: stub.into() }
15048 }
15049
15050 pub(crate) async fn new(
15051 config: gaxi::options::ClientConfig,
15052 ) -> crate::ClientBuilderResult<Self> {
15053 let inner = Self::build_inner(config).await?;
15054 Ok(Self { inner })
15055 }
15056
15057 async fn build_inner(
15058 conf: gaxi::options::ClientConfig,
15059 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionTargetTcpProxies>>
15060 {
15061 if gaxi::options::tracing_enabled(&conf) {
15062 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15063 }
15064 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15065 }
15066
15067 async fn build_transport(
15068 conf: gaxi::options::ClientConfig,
15069 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetTcpProxies> {
15070 super::transport::RegionTargetTcpProxies::new(conf).await
15071 }
15072
15073 async fn build_with_tracing(
15074 conf: gaxi::options::ClientConfig,
15075 ) -> crate::ClientBuilderResult<impl super::stub::RegionTargetTcpProxies> {
15076 Self::build_transport(conf)
15077 .await
15078 .map(super::tracing::RegionTargetTcpProxies::new)
15079 }
15080
15081 /// Deletes the specified TargetTcpProxy resource.
15082 pub fn delete(&self) -> super::builder::region_target_tcp_proxies::Delete {
15083 super::builder::region_target_tcp_proxies::Delete::new(self.inner.clone())
15084 }
15085
15086 /// Returns the specified TargetTcpProxy resource.
15087 pub fn get(&self) -> super::builder::region_target_tcp_proxies::Get {
15088 super::builder::region_target_tcp_proxies::Get::new(self.inner.clone())
15089 }
15090
15091 /// Creates a TargetTcpProxy resource in the specified project and region using
15092 /// the data included in the request.
15093 pub fn insert(&self) -> super::builder::region_target_tcp_proxies::Insert {
15094 super::builder::region_target_tcp_proxies::Insert::new(self.inner.clone())
15095 }
15096
15097 /// Retrieves a list of TargetTcpProxy resources
15098 /// available to the specified project in a given region.
15099 pub fn list(&self) -> super::builder::region_target_tcp_proxies::List {
15100 super::builder::region_target_tcp_proxies::List::new(self.inner.clone())
15101 }
15102
15103 /// Retrieves the specified region-specific Operations resource.
15104 pub fn get_operation(&self) -> super::builder::region_target_tcp_proxies::GetOperation {
15105 super::builder::region_target_tcp_proxies::GetOperation::new(self.inner.clone())
15106 }
15107}
15108
15109/// Implements a client for the Google Compute Engine API.
15110///
15111/// # Example
15112/// ```
15113/// # use google_cloud_compute_v1::client::RegionUrlMaps;
15114/// async fn sample(
15115/// ) -> anyhow::Result<()> {
15116/// let client = RegionUrlMaps::builder().build().await?;
15117/// // use `client` to make requests to the Google Compute Engine API.
15118/// Ok(())
15119/// }
15120/// ```
15121///
15122/// # Service Description
15123///
15124/// Service for the `regionUrlMaps` resource.
15125///
15126/// # Configuration
15127///
15128/// To configure `RegionUrlMaps` use the `with_*` methods in the type returned
15129/// by [builder()][RegionUrlMaps::builder]. The default configuration should
15130/// work for most applications. Common configuration changes include
15131///
15132/// * [with_endpoint()]: by default this client uses the global default endpoint
15133/// (`https://compute.googleapis.com`). Applications using regional
15134/// endpoints or running in restricted networks (e.g. a network configured
15135/// with [Private Google Access with VPC Service Controls]) may want to
15136/// override this default.
15137/// * [with_credentials()]: by default this client uses
15138/// [Application Default Credentials]. Applications using custom
15139/// authentication may need to override this default.
15140///
15141/// [with_endpoint()]: super::builder::region_url_maps::ClientBuilder::with_endpoint
15142/// [with_credentials()]: super::builder::region_url_maps::ClientBuilder::with_credentials
15143/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15144/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15145///
15146/// # Pooling and Cloning
15147///
15148/// `RegionUrlMaps` holds a connection pool internally, it is advised to
15149/// create one and reuse it. You do not need to wrap `RegionUrlMaps` in
15150/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15151/// already uses an `Arc` internally.
15152#[cfg(feature = "region-url-maps")]
15153#[cfg_attr(docsrs, doc(cfg(feature = "region-url-maps")))]
15154#[derive(Clone, Debug)]
15155pub struct RegionUrlMaps {
15156 inner: std::sync::Arc<dyn super::stub::dynamic::RegionUrlMaps>,
15157}
15158
15159#[cfg(feature = "region-url-maps")]
15160impl RegionUrlMaps {
15161 /// Returns a builder for [RegionUrlMaps].
15162 ///
15163 /// ```
15164 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15165 /// # use google_cloud_compute_v1::client::RegionUrlMaps;
15166 /// let client = RegionUrlMaps::builder().build().await?;
15167 /// # Ok(()) }
15168 /// ```
15169 pub fn builder() -> super::builder::region_url_maps::ClientBuilder {
15170 crate::new_client_builder(super::builder::region_url_maps::client::Factory)
15171 }
15172
15173 /// Creates a new client from the provided stub.
15174 ///
15175 /// The most common case for calling this function is in tests mocking the
15176 /// client's behavior.
15177 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15178 where
15179 T: super::stub::RegionUrlMaps + 'static,
15180 {
15181 Self { inner: stub.into() }
15182 }
15183
15184 pub(crate) async fn new(
15185 config: gaxi::options::ClientConfig,
15186 ) -> crate::ClientBuilderResult<Self> {
15187 let inner = Self::build_inner(config).await?;
15188 Ok(Self { inner })
15189 }
15190
15191 async fn build_inner(
15192 conf: gaxi::options::ClientConfig,
15193 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionUrlMaps>> {
15194 if gaxi::options::tracing_enabled(&conf) {
15195 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15196 }
15197 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15198 }
15199
15200 async fn build_transport(
15201 conf: gaxi::options::ClientConfig,
15202 ) -> crate::ClientBuilderResult<impl super::stub::RegionUrlMaps> {
15203 super::transport::RegionUrlMaps::new(conf).await
15204 }
15205
15206 async fn build_with_tracing(
15207 conf: gaxi::options::ClientConfig,
15208 ) -> crate::ClientBuilderResult<impl super::stub::RegionUrlMaps> {
15209 Self::build_transport(conf)
15210 .await
15211 .map(super::tracing::RegionUrlMaps::new)
15212 }
15213
15214 /// Deletes the specified UrlMap resource.
15215 pub fn delete(&self) -> super::builder::region_url_maps::Delete {
15216 super::builder::region_url_maps::Delete::new(self.inner.clone())
15217 }
15218
15219 /// Returns the specified UrlMap resource.
15220 pub fn get(&self) -> super::builder::region_url_maps::Get {
15221 super::builder::region_url_maps::Get::new(self.inner.clone())
15222 }
15223
15224 /// Creates a UrlMap resource in the specified project using
15225 /// the data included in the request.
15226 pub fn insert(&self) -> super::builder::region_url_maps::Insert {
15227 super::builder::region_url_maps::Insert::new(self.inner.clone())
15228 }
15229
15230 /// Retrieves the list of UrlMap resources available to the specified
15231 /// project in the specified region.
15232 pub fn list(&self) -> super::builder::region_url_maps::List {
15233 super::builder::region_url_maps::List::new(self.inner.clone())
15234 }
15235
15236 /// Patches the specified UrlMap resource with the data included in the
15237 /// request. This method supportsPATCH
15238 /// semantics and usesJSON merge
15239 /// patch format and processing rules.
15240 pub fn patch(&self) -> super::builder::region_url_maps::Patch {
15241 super::builder::region_url_maps::Patch::new(self.inner.clone())
15242 }
15243
15244 /// Updates the specified UrlMap resource with the data included in the
15245 /// request.
15246 pub fn update(&self) -> super::builder::region_url_maps::Update {
15247 super::builder::region_url_maps::Update::new(self.inner.clone())
15248 }
15249
15250 /// Runs static validation for the UrlMap. In particular, the tests of the
15251 /// provided UrlMap will be run. Calling this method does NOT create the
15252 /// UrlMap.
15253 pub fn validate(&self) -> super::builder::region_url_maps::Validate {
15254 super::builder::region_url_maps::Validate::new(self.inner.clone())
15255 }
15256
15257 /// Retrieves the specified region-specific Operations resource.
15258 pub fn get_operation(&self) -> super::builder::region_url_maps::GetOperation {
15259 super::builder::region_url_maps::GetOperation::new(self.inner.clone())
15260 }
15261}
15262
15263/// Implements a client for the Google Compute Engine API.
15264///
15265/// # Example
15266/// ```
15267/// # use google_cloud_compute_v1::client::RegionZones;
15268/// async fn sample(
15269/// ) -> anyhow::Result<()> {
15270/// let client = RegionZones::builder().build().await?;
15271/// // use `client` to make requests to the Google Compute Engine API.
15272/// Ok(())
15273/// }
15274/// ```
15275///
15276/// # Service Description
15277///
15278/// Service for the `regionZones` resource.
15279///
15280/// # Configuration
15281///
15282/// To configure `RegionZones` use the `with_*` methods in the type returned
15283/// by [builder()][RegionZones::builder]. The default configuration should
15284/// work for most applications. Common configuration changes include
15285///
15286/// * [with_endpoint()]: by default this client uses the global default endpoint
15287/// (`https://compute.googleapis.com`). Applications using regional
15288/// endpoints or running in restricted networks (e.g. a network configured
15289/// with [Private Google Access with VPC Service Controls]) may want to
15290/// override this default.
15291/// * [with_credentials()]: by default this client uses
15292/// [Application Default Credentials]. Applications using custom
15293/// authentication may need to override this default.
15294///
15295/// [with_endpoint()]: super::builder::region_zones::ClientBuilder::with_endpoint
15296/// [with_credentials()]: super::builder::region_zones::ClientBuilder::with_credentials
15297/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15298/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15299///
15300/// # Pooling and Cloning
15301///
15302/// `RegionZones` holds a connection pool internally, it is advised to
15303/// create one and reuse it. You do not need to wrap `RegionZones` in
15304/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15305/// already uses an `Arc` internally.
15306#[cfg(feature = "region-zones")]
15307#[cfg_attr(docsrs, doc(cfg(feature = "region-zones")))]
15308#[derive(Clone, Debug)]
15309pub struct RegionZones {
15310 inner: std::sync::Arc<dyn super::stub::dynamic::RegionZones>,
15311}
15312
15313#[cfg(feature = "region-zones")]
15314impl RegionZones {
15315 /// Returns a builder for [RegionZones].
15316 ///
15317 /// ```
15318 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15319 /// # use google_cloud_compute_v1::client::RegionZones;
15320 /// let client = RegionZones::builder().build().await?;
15321 /// # Ok(()) }
15322 /// ```
15323 pub fn builder() -> super::builder::region_zones::ClientBuilder {
15324 crate::new_client_builder(super::builder::region_zones::client::Factory)
15325 }
15326
15327 /// Creates a new client from the provided stub.
15328 ///
15329 /// The most common case for calling this function is in tests mocking the
15330 /// client's behavior.
15331 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15332 where
15333 T: super::stub::RegionZones + 'static,
15334 {
15335 Self { inner: stub.into() }
15336 }
15337
15338 pub(crate) async fn new(
15339 config: gaxi::options::ClientConfig,
15340 ) -> crate::ClientBuilderResult<Self> {
15341 let inner = Self::build_inner(config).await?;
15342 Ok(Self { inner })
15343 }
15344
15345 async fn build_inner(
15346 conf: gaxi::options::ClientConfig,
15347 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RegionZones>> {
15348 if gaxi::options::tracing_enabled(&conf) {
15349 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15350 }
15351 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15352 }
15353
15354 async fn build_transport(
15355 conf: gaxi::options::ClientConfig,
15356 ) -> crate::ClientBuilderResult<impl super::stub::RegionZones> {
15357 super::transport::RegionZones::new(conf).await
15358 }
15359
15360 async fn build_with_tracing(
15361 conf: gaxi::options::ClientConfig,
15362 ) -> crate::ClientBuilderResult<impl super::stub::RegionZones> {
15363 Self::build_transport(conf)
15364 .await
15365 .map(super::tracing::RegionZones::new)
15366 }
15367
15368 /// Retrieves the list of Zone resources under the specific region available to
15369 /// the specified project.
15370 pub fn list(&self) -> super::builder::region_zones::List {
15371 super::builder::region_zones::List::new(self.inner.clone())
15372 }
15373}
15374
15375/// Implements a client for the Google Compute Engine API.
15376///
15377/// # Example
15378/// ```
15379/// # use google_cloud_compute_v1::client::Regions;
15380/// async fn sample(
15381/// ) -> anyhow::Result<()> {
15382/// let client = Regions::builder().build().await?;
15383/// // use `client` to make requests to the Google Compute Engine API.
15384/// Ok(())
15385/// }
15386/// ```
15387///
15388/// # Service Description
15389///
15390/// Service for the `regions` resource.
15391///
15392/// # Configuration
15393///
15394/// To configure `Regions` use the `with_*` methods in the type returned
15395/// by [builder()][Regions::builder]. The default configuration should
15396/// work for most applications. Common configuration changes include
15397///
15398/// * [with_endpoint()]: by default this client uses the global default endpoint
15399/// (`https://compute.googleapis.com`). Applications using regional
15400/// endpoints or running in restricted networks (e.g. a network configured
15401/// with [Private Google Access with VPC Service Controls]) may want to
15402/// override this default.
15403/// * [with_credentials()]: by default this client uses
15404/// [Application Default Credentials]. Applications using custom
15405/// authentication may need to override this default.
15406///
15407/// [with_endpoint()]: super::builder::regions::ClientBuilder::with_endpoint
15408/// [with_credentials()]: super::builder::regions::ClientBuilder::with_credentials
15409/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15410/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15411///
15412/// # Pooling and Cloning
15413///
15414/// `Regions` holds a connection pool internally, it is advised to
15415/// create one and reuse it. You do not need to wrap `Regions` in
15416/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15417/// already uses an `Arc` internally.
15418#[cfg(feature = "regions")]
15419#[cfg_attr(docsrs, doc(cfg(feature = "regions")))]
15420#[derive(Clone, Debug)]
15421pub struct Regions {
15422 inner: std::sync::Arc<dyn super::stub::dynamic::Regions>,
15423}
15424
15425#[cfg(feature = "regions")]
15426impl Regions {
15427 /// Returns a builder for [Regions].
15428 ///
15429 /// ```
15430 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15431 /// # use google_cloud_compute_v1::client::Regions;
15432 /// let client = Regions::builder().build().await?;
15433 /// # Ok(()) }
15434 /// ```
15435 pub fn builder() -> super::builder::regions::ClientBuilder {
15436 crate::new_client_builder(super::builder::regions::client::Factory)
15437 }
15438
15439 /// Creates a new client from the provided stub.
15440 ///
15441 /// The most common case for calling this function is in tests mocking the
15442 /// client's behavior.
15443 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15444 where
15445 T: super::stub::Regions + 'static,
15446 {
15447 Self { inner: stub.into() }
15448 }
15449
15450 pub(crate) async fn new(
15451 config: gaxi::options::ClientConfig,
15452 ) -> crate::ClientBuilderResult<Self> {
15453 let inner = Self::build_inner(config).await?;
15454 Ok(Self { inner })
15455 }
15456
15457 async fn build_inner(
15458 conf: gaxi::options::ClientConfig,
15459 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Regions>> {
15460 if gaxi::options::tracing_enabled(&conf) {
15461 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15462 }
15463 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15464 }
15465
15466 async fn build_transport(
15467 conf: gaxi::options::ClientConfig,
15468 ) -> crate::ClientBuilderResult<impl super::stub::Regions> {
15469 super::transport::Regions::new(conf).await
15470 }
15471
15472 async fn build_with_tracing(
15473 conf: gaxi::options::ClientConfig,
15474 ) -> crate::ClientBuilderResult<impl super::stub::Regions> {
15475 Self::build_transport(conf)
15476 .await
15477 .map(super::tracing::Regions::new)
15478 }
15479
15480 /// Returns the specified Region resource.
15481 ///
15482 /// To decrease latency for this method, you can optionally omit any unneeded
15483 /// information from the response by using a field mask. This practice is
15484 /// especially recommended for unused quota information (the `quotas` field).
15485 /// To exclude one or more fields, set your request's `fields` query parameter
15486 /// to only include the fields you need. For example, to only include the `id`
15487 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
15488 /// your request.
15489 ///
15490 /// This method fails if the quota information is unavailable for the region
15491 /// and if the organization policy constraint
15492 /// compute.requireBasicQuotaInResponse is enforced. This
15493 /// constraint, when enforced, disables the fail-open behaviour when quota
15494 /// information (the `items.quotas` field) is unavailable for the region.
15495 /// It is recommended to use the default setting
15496 /// for the constraint unless your application requires the fail-closed
15497 /// behaviour for this method.
15498 pub fn get(&self) -> super::builder::regions::Get {
15499 super::builder::regions::Get::new(self.inner.clone())
15500 }
15501
15502 /// Retrieves the list of region resources available to the specified project.
15503 ///
15504 /// To decrease latency for this method, you can optionally omit any unneeded
15505 /// information from the response by using a field mask. This practice is
15506 /// especially recommended for unused quota information
15507 /// (the `items.quotas` field).
15508 /// To exclude one or more fields, set your request's `fields` query parameter
15509 /// to only include the fields you need. For example, to only include the `id`
15510 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
15511 /// your request.
15512 ///
15513 /// This method fails if the quota information is unavailable for the region
15514 /// and if the organization policy constraint
15515 /// compute.requireBasicQuotaInResponse is enforced. This
15516 /// constraint, when enforced, disables the fail-open behaviour when quota
15517 /// information (the `items.quotas` field) is unavailable for the region.
15518 /// It is recommended to use the default setting
15519 /// for the constraint unless your application requires the fail-closed
15520 /// behaviour for this method.
15521 pub fn list(&self) -> super::builder::regions::List {
15522 super::builder::regions::List::new(self.inner.clone())
15523 }
15524}
15525
15526/// Implements a client for the Google Compute Engine API.
15527///
15528/// # Example
15529/// ```
15530/// # use google_cloud_compute_v1::client::ReservationBlocks;
15531/// async fn sample(
15532/// ) -> anyhow::Result<()> {
15533/// let client = ReservationBlocks::builder().build().await?;
15534/// // use `client` to make requests to the Google Compute Engine API.
15535/// Ok(())
15536/// }
15537/// ```
15538///
15539/// # Service Description
15540///
15541/// Service for the `reservationBlocks` resource.
15542///
15543/// # Configuration
15544///
15545/// To configure `ReservationBlocks` use the `with_*` methods in the type returned
15546/// by [builder()][ReservationBlocks::builder]. The default configuration should
15547/// work for most applications. Common configuration changes include
15548///
15549/// * [with_endpoint()]: by default this client uses the global default endpoint
15550/// (`https://compute.googleapis.com`). Applications using regional
15551/// endpoints or running in restricted networks (e.g. a network configured
15552/// with [Private Google Access with VPC Service Controls]) may want to
15553/// override this default.
15554/// * [with_credentials()]: by default this client uses
15555/// [Application Default Credentials]. Applications using custom
15556/// authentication may need to override this default.
15557///
15558/// [with_endpoint()]: super::builder::reservation_blocks::ClientBuilder::with_endpoint
15559/// [with_credentials()]: super::builder::reservation_blocks::ClientBuilder::with_credentials
15560/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15561/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15562///
15563/// # Pooling and Cloning
15564///
15565/// `ReservationBlocks` holds a connection pool internally, it is advised to
15566/// create one and reuse it. You do not need to wrap `ReservationBlocks` in
15567/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15568/// already uses an `Arc` internally.
15569#[cfg(feature = "reservation-blocks")]
15570#[cfg_attr(docsrs, doc(cfg(feature = "reservation-blocks")))]
15571#[derive(Clone, Debug)]
15572pub struct ReservationBlocks {
15573 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationBlocks>,
15574}
15575
15576#[cfg(feature = "reservation-blocks")]
15577impl ReservationBlocks {
15578 /// Returns a builder for [ReservationBlocks].
15579 ///
15580 /// ```
15581 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15582 /// # use google_cloud_compute_v1::client::ReservationBlocks;
15583 /// let client = ReservationBlocks::builder().build().await?;
15584 /// # Ok(()) }
15585 /// ```
15586 pub fn builder() -> super::builder::reservation_blocks::ClientBuilder {
15587 crate::new_client_builder(super::builder::reservation_blocks::client::Factory)
15588 }
15589
15590 /// Creates a new client from the provided stub.
15591 ///
15592 /// The most common case for calling this function is in tests mocking the
15593 /// client's behavior.
15594 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15595 where
15596 T: super::stub::ReservationBlocks + 'static,
15597 {
15598 Self { inner: stub.into() }
15599 }
15600
15601 pub(crate) async fn new(
15602 config: gaxi::options::ClientConfig,
15603 ) -> crate::ClientBuilderResult<Self> {
15604 let inner = Self::build_inner(config).await?;
15605 Ok(Self { inner })
15606 }
15607
15608 async fn build_inner(
15609 conf: gaxi::options::ClientConfig,
15610 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReservationBlocks>>
15611 {
15612 if gaxi::options::tracing_enabled(&conf) {
15613 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15614 }
15615 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15616 }
15617
15618 async fn build_transport(
15619 conf: gaxi::options::ClientConfig,
15620 ) -> crate::ClientBuilderResult<impl super::stub::ReservationBlocks> {
15621 super::transport::ReservationBlocks::new(conf).await
15622 }
15623
15624 async fn build_with_tracing(
15625 conf: gaxi::options::ClientConfig,
15626 ) -> crate::ClientBuilderResult<impl super::stub::ReservationBlocks> {
15627 Self::build_transport(conf)
15628 .await
15629 .map(super::tracing::ReservationBlocks::new)
15630 }
15631
15632 /// Retrieves information about the specified reservation block.
15633 pub fn get(&self) -> super::builder::reservation_blocks::Get {
15634 super::builder::reservation_blocks::Get::new(self.inner.clone())
15635 }
15636
15637 /// Gets the access control policy for a resource. May be empty if no such
15638 /// policy or resource exists.
15639 pub fn get_iam_policy(&self) -> super::builder::reservation_blocks::GetIamPolicy {
15640 super::builder::reservation_blocks::GetIamPolicy::new(self.inner.clone())
15641 }
15642
15643 /// Retrieves a list of reservation blocks under a single reservation.
15644 pub fn list(&self) -> super::builder::reservation_blocks::List {
15645 super::builder::reservation_blocks::List::new(self.inner.clone())
15646 }
15647
15648 /// Allows customers to perform maintenance on a reservation block
15649 pub fn perform_maintenance(&self) -> super::builder::reservation_blocks::PerformMaintenance {
15650 super::builder::reservation_blocks::PerformMaintenance::new(self.inner.clone())
15651 }
15652
15653 /// Sets the access control policy on the specified resource.
15654 /// Replaces any existing policy.
15655 pub fn set_iam_policy(&self) -> super::builder::reservation_blocks::SetIamPolicy {
15656 super::builder::reservation_blocks::SetIamPolicy::new(self.inner.clone())
15657 }
15658
15659 /// Returns permissions that a caller has on the specified resource.
15660 pub fn test_iam_permissions(&self) -> super::builder::reservation_blocks::TestIamPermissions {
15661 super::builder::reservation_blocks::TestIamPermissions::new(self.inner.clone())
15662 }
15663
15664 /// Retrieves the specified zone-specific Operations resource.
15665 pub fn get_operation(&self) -> super::builder::reservation_blocks::GetOperation {
15666 super::builder::reservation_blocks::GetOperation::new(self.inner.clone())
15667 }
15668}
15669
15670/// Implements a client for the Google Compute Engine API.
15671///
15672/// # Example
15673/// ```
15674/// # use google_cloud_compute_v1::client::ReservationSlots;
15675/// async fn sample(
15676/// ) -> anyhow::Result<()> {
15677/// let client = ReservationSlots::builder().build().await?;
15678/// // use `client` to make requests to the Google Compute Engine API.
15679/// Ok(())
15680/// }
15681/// ```
15682///
15683/// # Service Description
15684///
15685/// Service for the `reservationSlots` resource.
15686///
15687/// # Configuration
15688///
15689/// To configure `ReservationSlots` use the `with_*` methods in the type returned
15690/// by [builder()][ReservationSlots::builder]. The default configuration should
15691/// work for most applications. Common configuration changes include
15692///
15693/// * [with_endpoint()]: by default this client uses the global default endpoint
15694/// (`https://compute.googleapis.com`). Applications using regional
15695/// endpoints or running in restricted networks (e.g. a network configured
15696/// with [Private Google Access with VPC Service Controls]) may want to
15697/// override this default.
15698/// * [with_credentials()]: by default this client uses
15699/// [Application Default Credentials]. Applications using custom
15700/// authentication may need to override this default.
15701///
15702/// [with_endpoint()]: super::builder::reservation_slots::ClientBuilder::with_endpoint
15703/// [with_credentials()]: super::builder::reservation_slots::ClientBuilder::with_credentials
15704/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15705/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15706///
15707/// # Pooling and Cloning
15708///
15709/// `ReservationSlots` holds a connection pool internally, it is advised to
15710/// create one and reuse it. You do not need to wrap `ReservationSlots` in
15711/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15712/// already uses an `Arc` internally.
15713#[cfg(feature = "reservation-slots")]
15714#[cfg_attr(docsrs, doc(cfg(feature = "reservation-slots")))]
15715#[derive(Clone, Debug)]
15716pub struct ReservationSlots {
15717 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationSlots>,
15718}
15719
15720#[cfg(feature = "reservation-slots")]
15721impl ReservationSlots {
15722 /// Returns a builder for [ReservationSlots].
15723 ///
15724 /// ```
15725 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15726 /// # use google_cloud_compute_v1::client::ReservationSlots;
15727 /// let client = ReservationSlots::builder().build().await?;
15728 /// # Ok(()) }
15729 /// ```
15730 pub fn builder() -> super::builder::reservation_slots::ClientBuilder {
15731 crate::new_client_builder(super::builder::reservation_slots::client::Factory)
15732 }
15733
15734 /// Creates a new client from the provided stub.
15735 ///
15736 /// The most common case for calling this function is in tests mocking the
15737 /// client's behavior.
15738 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15739 where
15740 T: super::stub::ReservationSlots + 'static,
15741 {
15742 Self { inner: stub.into() }
15743 }
15744
15745 pub(crate) async fn new(
15746 config: gaxi::options::ClientConfig,
15747 ) -> crate::ClientBuilderResult<Self> {
15748 let inner = Self::build_inner(config).await?;
15749 Ok(Self { inner })
15750 }
15751
15752 async fn build_inner(
15753 conf: gaxi::options::ClientConfig,
15754 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReservationSlots>>
15755 {
15756 if gaxi::options::tracing_enabled(&conf) {
15757 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15758 }
15759 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15760 }
15761
15762 async fn build_transport(
15763 conf: gaxi::options::ClientConfig,
15764 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSlots> {
15765 super::transport::ReservationSlots::new(conf).await
15766 }
15767
15768 async fn build_with_tracing(
15769 conf: gaxi::options::ClientConfig,
15770 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSlots> {
15771 Self::build_transport(conf)
15772 .await
15773 .map(super::tracing::ReservationSlots::new)
15774 }
15775
15776 /// Retrieves information about the specified reservation slot.
15777 pub fn get(&self) -> super::builder::reservation_slots::Get {
15778 super::builder::reservation_slots::Get::new(self.inner.clone())
15779 }
15780
15781 /// Allows customers to get SBOM versions of a reservation slot.
15782 pub fn get_version(&self) -> super::builder::reservation_slots::GetVersion {
15783 super::builder::reservation_slots::GetVersion::new(self.inner.clone())
15784 }
15785
15786 /// Retrieves a list of reservation slots under a single reservation.
15787 pub fn list(&self) -> super::builder::reservation_slots::List {
15788 super::builder::reservation_slots::List::new(self.inner.clone())
15789 }
15790
15791 /// Update a reservation slot in the specified sub-block.
15792 pub fn update(&self) -> super::builder::reservation_slots::Update {
15793 super::builder::reservation_slots::Update::new(self.inner.clone())
15794 }
15795
15796 /// Retrieves the specified zone-specific Operations resource.
15797 pub fn get_operation(&self) -> super::builder::reservation_slots::GetOperation {
15798 super::builder::reservation_slots::GetOperation::new(self.inner.clone())
15799 }
15800}
15801
15802/// Implements a client for the Google Compute Engine API.
15803///
15804/// # Example
15805/// ```
15806/// # use google_cloud_compute_v1::client::ReservationSubBlocks;
15807/// async fn sample(
15808/// ) -> anyhow::Result<()> {
15809/// let client = ReservationSubBlocks::builder().build().await?;
15810/// // use `client` to make requests to the Google Compute Engine API.
15811/// Ok(())
15812/// }
15813/// ```
15814///
15815/// # Service Description
15816///
15817/// Service for the `reservationSubBlocks` resource.
15818///
15819/// # Configuration
15820///
15821/// To configure `ReservationSubBlocks` use the `with_*` methods in the type returned
15822/// by [builder()][ReservationSubBlocks::builder]. The default configuration should
15823/// work for most applications. Common configuration changes include
15824///
15825/// * [with_endpoint()]: by default this client uses the global default endpoint
15826/// (`https://compute.googleapis.com`). Applications using regional
15827/// endpoints or running in restricted networks (e.g. a network configured
15828/// with [Private Google Access with VPC Service Controls]) may want to
15829/// override this default.
15830/// * [with_credentials()]: by default this client uses
15831/// [Application Default Credentials]. Applications using custom
15832/// authentication may need to override this default.
15833///
15834/// [with_endpoint()]: super::builder::reservation_sub_blocks::ClientBuilder::with_endpoint
15835/// [with_credentials()]: super::builder::reservation_sub_blocks::ClientBuilder::with_credentials
15836/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15837/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15838///
15839/// # Pooling and Cloning
15840///
15841/// `ReservationSubBlocks` holds a connection pool internally, it is advised to
15842/// create one and reuse it. You do not need to wrap `ReservationSubBlocks` in
15843/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15844/// already uses an `Arc` internally.
15845#[cfg(feature = "reservation-sub-blocks")]
15846#[cfg_attr(docsrs, doc(cfg(feature = "reservation-sub-blocks")))]
15847#[derive(Clone, Debug)]
15848pub struct ReservationSubBlocks {
15849 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationSubBlocks>,
15850}
15851
15852#[cfg(feature = "reservation-sub-blocks")]
15853impl ReservationSubBlocks {
15854 /// Returns a builder for [ReservationSubBlocks].
15855 ///
15856 /// ```
15857 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
15858 /// # use google_cloud_compute_v1::client::ReservationSubBlocks;
15859 /// let client = ReservationSubBlocks::builder().build().await?;
15860 /// # Ok(()) }
15861 /// ```
15862 pub fn builder() -> super::builder::reservation_sub_blocks::ClientBuilder {
15863 crate::new_client_builder(super::builder::reservation_sub_blocks::client::Factory)
15864 }
15865
15866 /// Creates a new client from the provided stub.
15867 ///
15868 /// The most common case for calling this function is in tests mocking the
15869 /// client's behavior.
15870 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
15871 where
15872 T: super::stub::ReservationSubBlocks + 'static,
15873 {
15874 Self { inner: stub.into() }
15875 }
15876
15877 pub(crate) async fn new(
15878 config: gaxi::options::ClientConfig,
15879 ) -> crate::ClientBuilderResult<Self> {
15880 let inner = Self::build_inner(config).await?;
15881 Ok(Self { inner })
15882 }
15883
15884 async fn build_inner(
15885 conf: gaxi::options::ClientConfig,
15886 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ReservationSubBlocks>>
15887 {
15888 if gaxi::options::tracing_enabled(&conf) {
15889 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15890 }
15891 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15892 }
15893
15894 async fn build_transport(
15895 conf: gaxi::options::ClientConfig,
15896 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSubBlocks> {
15897 super::transport::ReservationSubBlocks::new(conf).await
15898 }
15899
15900 async fn build_with_tracing(
15901 conf: gaxi::options::ClientConfig,
15902 ) -> crate::ClientBuilderResult<impl super::stub::ReservationSubBlocks> {
15903 Self::build_transport(conf)
15904 .await
15905 .map(super::tracing::ReservationSubBlocks::new)
15906 }
15907
15908 /// Retrieves information about the specified reservation subBlock.
15909 pub fn get(&self) -> super::builder::reservation_sub_blocks::Get {
15910 super::builder::reservation_sub_blocks::Get::new(self.inner.clone())
15911 }
15912
15913 /// Gets the access control policy for a resource. May be empty if no such
15914 /// policy or resource exists.
15915 pub fn get_iam_policy(&self) -> super::builder::reservation_sub_blocks::GetIamPolicy {
15916 super::builder::reservation_sub_blocks::GetIamPolicy::new(self.inner.clone())
15917 }
15918
15919 /// Allows customers to get SBOM versions of a reservation subBlock.
15920 pub fn get_version(&self) -> super::builder::reservation_sub_blocks::GetVersion {
15921 super::builder::reservation_sub_blocks::GetVersion::new(self.inner.clone())
15922 }
15923
15924 /// Retrieves a list of reservation subBlocks under a single reservation.
15925 pub fn list(&self) -> super::builder::reservation_sub_blocks::List {
15926 super::builder::reservation_sub_blocks::List::new(self.inner.clone())
15927 }
15928
15929 /// Allows customers to perform maintenance on a reservation subBlock
15930 pub fn perform_maintenance(
15931 &self,
15932 ) -> super::builder::reservation_sub_blocks::PerformMaintenance {
15933 super::builder::reservation_sub_blocks::PerformMaintenance::new(self.inner.clone())
15934 }
15935
15936 /// Allows customers to report a faulty subBlock.
15937 pub fn report_faulty(&self) -> super::builder::reservation_sub_blocks::ReportFaulty {
15938 super::builder::reservation_sub_blocks::ReportFaulty::new(self.inner.clone())
15939 }
15940
15941 /// Sets the access control policy on the specified resource.
15942 /// Replaces any existing policy.
15943 pub fn set_iam_policy(&self) -> super::builder::reservation_sub_blocks::SetIamPolicy {
15944 super::builder::reservation_sub_blocks::SetIamPolicy::new(self.inner.clone())
15945 }
15946
15947 /// Returns permissions that a caller has on the specified resource.
15948 pub fn test_iam_permissions(
15949 &self,
15950 ) -> super::builder::reservation_sub_blocks::TestIamPermissions {
15951 super::builder::reservation_sub_blocks::TestIamPermissions::new(self.inner.clone())
15952 }
15953
15954 /// Retrieves the specified zone-specific Operations resource.
15955 pub fn get_operation(&self) -> super::builder::reservation_sub_blocks::GetOperation {
15956 super::builder::reservation_sub_blocks::GetOperation::new(self.inner.clone())
15957 }
15958}
15959
15960/// Implements a client for the Google Compute Engine API.
15961///
15962/// # Example
15963/// ```
15964/// # use google_cloud_compute_v1::client::Reservations;
15965/// async fn sample(
15966/// ) -> anyhow::Result<()> {
15967/// let client = Reservations::builder().build().await?;
15968/// // use `client` to make requests to the Google Compute Engine API.
15969/// Ok(())
15970/// }
15971/// ```
15972///
15973/// # Service Description
15974///
15975/// Service for the `reservations` resource.
15976///
15977/// # Configuration
15978///
15979/// To configure `Reservations` use the `with_*` methods in the type returned
15980/// by [builder()][Reservations::builder]. The default configuration should
15981/// work for most applications. Common configuration changes include
15982///
15983/// * [with_endpoint()]: by default this client uses the global default endpoint
15984/// (`https://compute.googleapis.com`). Applications using regional
15985/// endpoints or running in restricted networks (e.g. a network configured
15986/// with [Private Google Access with VPC Service Controls]) may want to
15987/// override this default.
15988/// * [with_credentials()]: by default this client uses
15989/// [Application Default Credentials]. Applications using custom
15990/// authentication may need to override this default.
15991///
15992/// [with_endpoint()]: super::builder::reservations::ClientBuilder::with_endpoint
15993/// [with_credentials()]: super::builder::reservations::ClientBuilder::with_credentials
15994/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15995/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15996///
15997/// # Pooling and Cloning
15998///
15999/// `Reservations` holds a connection pool internally, it is advised to
16000/// create one and reuse it. You do not need to wrap `Reservations` in
16001/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16002/// already uses an `Arc` internally.
16003#[cfg(feature = "reservations")]
16004#[cfg_attr(docsrs, doc(cfg(feature = "reservations")))]
16005#[derive(Clone, Debug)]
16006pub struct Reservations {
16007 inner: std::sync::Arc<dyn super::stub::dynamic::Reservations>,
16008}
16009
16010#[cfg(feature = "reservations")]
16011impl Reservations {
16012 /// Returns a builder for [Reservations].
16013 ///
16014 /// ```
16015 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16016 /// # use google_cloud_compute_v1::client::Reservations;
16017 /// let client = Reservations::builder().build().await?;
16018 /// # Ok(()) }
16019 /// ```
16020 pub fn builder() -> super::builder::reservations::ClientBuilder {
16021 crate::new_client_builder(super::builder::reservations::client::Factory)
16022 }
16023
16024 /// Creates a new client from the provided stub.
16025 ///
16026 /// The most common case for calling this function is in tests mocking the
16027 /// client's behavior.
16028 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16029 where
16030 T: super::stub::Reservations + 'static,
16031 {
16032 Self { inner: stub.into() }
16033 }
16034
16035 pub(crate) async fn new(
16036 config: gaxi::options::ClientConfig,
16037 ) -> crate::ClientBuilderResult<Self> {
16038 let inner = Self::build_inner(config).await?;
16039 Ok(Self { inner })
16040 }
16041
16042 async fn build_inner(
16043 conf: gaxi::options::ClientConfig,
16044 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Reservations>> {
16045 if gaxi::options::tracing_enabled(&conf) {
16046 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16047 }
16048 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16049 }
16050
16051 async fn build_transport(
16052 conf: gaxi::options::ClientConfig,
16053 ) -> crate::ClientBuilderResult<impl super::stub::Reservations> {
16054 super::transport::Reservations::new(conf).await
16055 }
16056
16057 async fn build_with_tracing(
16058 conf: gaxi::options::ClientConfig,
16059 ) -> crate::ClientBuilderResult<impl super::stub::Reservations> {
16060 Self::build_transport(conf)
16061 .await
16062 .map(super::tracing::Reservations::new)
16063 }
16064
16065 /// Retrieves an aggregated list of reservations.
16066 ///
16067 /// To prevent failure, it is recommended that you set the
16068 /// `returnPartialSuccess` parameter to `true`.
16069 pub fn aggregated_list(&self) -> super::builder::reservations::AggregatedList {
16070 super::builder::reservations::AggregatedList::new(self.inner.clone())
16071 }
16072
16073 /// Deletes the specified reservation.
16074 pub fn delete(&self) -> super::builder::reservations::Delete {
16075 super::builder::reservations::Delete::new(self.inner.clone())
16076 }
16077
16078 /// Retrieves information about the specified reservation.
16079 pub fn get(&self) -> super::builder::reservations::Get {
16080 super::builder::reservations::Get::new(self.inner.clone())
16081 }
16082
16083 /// Gets the access control policy for a resource. May be empty if no such
16084 /// policy or resource exists.
16085 pub fn get_iam_policy(&self) -> super::builder::reservations::GetIamPolicy {
16086 super::builder::reservations::GetIamPolicy::new(self.inner.clone())
16087 }
16088
16089 /// Creates a new reservation. For more information, readReserving zonal
16090 /// resources.
16091 pub fn insert(&self) -> super::builder::reservations::Insert {
16092 super::builder::reservations::Insert::new(self.inner.clone())
16093 }
16094
16095 /// A list of all the reservations that have been configured for the
16096 /// specified project in specified zone.
16097 pub fn list(&self) -> super::builder::reservations::List {
16098 super::builder::reservations::List::new(self.inner.clone())
16099 }
16100
16101 /// Perform maintenance on an extended reservation
16102 pub fn perform_maintenance(&self) -> super::builder::reservations::PerformMaintenance {
16103 super::builder::reservations::PerformMaintenance::new(self.inner.clone())
16104 }
16105
16106 /// Resizes the reservation (applicable to standalone reservations only). For
16107 /// more information, readModifying
16108 /// reservations.
16109 pub fn resize(&self) -> super::builder::reservations::Resize {
16110 super::builder::reservations::Resize::new(self.inner.clone())
16111 }
16112
16113 /// Sets the access control policy on the specified resource.
16114 /// Replaces any existing policy.
16115 pub fn set_iam_policy(&self) -> super::builder::reservations::SetIamPolicy {
16116 super::builder::reservations::SetIamPolicy::new(self.inner.clone())
16117 }
16118
16119 /// Returns permissions that a caller has on the specified resource.
16120 pub fn test_iam_permissions(&self) -> super::builder::reservations::TestIamPermissions {
16121 super::builder::reservations::TestIamPermissions::new(self.inner.clone())
16122 }
16123
16124 /// Update share settings of the reservation.
16125 pub fn update(&self) -> super::builder::reservations::Update {
16126 super::builder::reservations::Update::new(self.inner.clone())
16127 }
16128
16129 /// Retrieves the specified zone-specific Operations resource.
16130 pub fn get_operation(&self) -> super::builder::reservations::GetOperation {
16131 super::builder::reservations::GetOperation::new(self.inner.clone())
16132 }
16133}
16134
16135/// Implements a client for the Google Compute Engine API.
16136///
16137/// # Example
16138/// ```
16139/// # use google_cloud_compute_v1::client::ResourcePolicies;
16140/// async fn sample(
16141/// ) -> anyhow::Result<()> {
16142/// let client = ResourcePolicies::builder().build().await?;
16143/// // use `client` to make requests to the Google Compute Engine API.
16144/// Ok(())
16145/// }
16146/// ```
16147///
16148/// # Service Description
16149///
16150/// Service for the `resourcePolicies` resource.
16151///
16152/// # Configuration
16153///
16154/// To configure `ResourcePolicies` use the `with_*` methods in the type returned
16155/// by [builder()][ResourcePolicies::builder]. The default configuration should
16156/// work for most applications. Common configuration changes include
16157///
16158/// * [with_endpoint()]: by default this client uses the global default endpoint
16159/// (`https://compute.googleapis.com`). Applications using regional
16160/// endpoints or running in restricted networks (e.g. a network configured
16161/// with [Private Google Access with VPC Service Controls]) may want to
16162/// override this default.
16163/// * [with_credentials()]: by default this client uses
16164/// [Application Default Credentials]. Applications using custom
16165/// authentication may need to override this default.
16166///
16167/// [with_endpoint()]: super::builder::resource_policies::ClientBuilder::with_endpoint
16168/// [with_credentials()]: super::builder::resource_policies::ClientBuilder::with_credentials
16169/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16170/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16171///
16172/// # Pooling and Cloning
16173///
16174/// `ResourcePolicies` holds a connection pool internally, it is advised to
16175/// create one and reuse it. You do not need to wrap `ResourcePolicies` in
16176/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16177/// already uses an `Arc` internally.
16178#[cfg(feature = "resource-policies")]
16179#[cfg_attr(docsrs, doc(cfg(feature = "resource-policies")))]
16180#[derive(Clone, Debug)]
16181pub struct ResourcePolicies {
16182 inner: std::sync::Arc<dyn super::stub::dynamic::ResourcePolicies>,
16183}
16184
16185#[cfg(feature = "resource-policies")]
16186impl ResourcePolicies {
16187 /// Returns a builder for [ResourcePolicies].
16188 ///
16189 /// ```
16190 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16191 /// # use google_cloud_compute_v1::client::ResourcePolicies;
16192 /// let client = ResourcePolicies::builder().build().await?;
16193 /// # Ok(()) }
16194 /// ```
16195 pub fn builder() -> super::builder::resource_policies::ClientBuilder {
16196 crate::new_client_builder(super::builder::resource_policies::client::Factory)
16197 }
16198
16199 /// Creates a new client from the provided stub.
16200 ///
16201 /// The most common case for calling this function is in tests mocking the
16202 /// client's behavior.
16203 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16204 where
16205 T: super::stub::ResourcePolicies + 'static,
16206 {
16207 Self { inner: stub.into() }
16208 }
16209
16210 pub(crate) async fn new(
16211 config: gaxi::options::ClientConfig,
16212 ) -> crate::ClientBuilderResult<Self> {
16213 let inner = Self::build_inner(config).await?;
16214 Ok(Self { inner })
16215 }
16216
16217 async fn build_inner(
16218 conf: gaxi::options::ClientConfig,
16219 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ResourcePolicies>>
16220 {
16221 if gaxi::options::tracing_enabled(&conf) {
16222 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16223 }
16224 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16225 }
16226
16227 async fn build_transport(
16228 conf: gaxi::options::ClientConfig,
16229 ) -> crate::ClientBuilderResult<impl super::stub::ResourcePolicies> {
16230 super::transport::ResourcePolicies::new(conf).await
16231 }
16232
16233 async fn build_with_tracing(
16234 conf: gaxi::options::ClientConfig,
16235 ) -> crate::ClientBuilderResult<impl super::stub::ResourcePolicies> {
16236 Self::build_transport(conf)
16237 .await
16238 .map(super::tracing::ResourcePolicies::new)
16239 }
16240
16241 /// Retrieves an aggregated list of resource policies.
16242 ///
16243 /// To prevent failure, Google recommends that you set the
16244 /// `returnPartialSuccess` parameter to `true`.
16245 pub fn aggregated_list(&self) -> super::builder::resource_policies::AggregatedList {
16246 super::builder::resource_policies::AggregatedList::new(self.inner.clone())
16247 }
16248
16249 /// Deletes the specified resource policy.
16250 pub fn delete(&self) -> super::builder::resource_policies::Delete {
16251 super::builder::resource_policies::Delete::new(self.inner.clone())
16252 }
16253
16254 /// Retrieves all information of the specified resource policy.
16255 pub fn get(&self) -> super::builder::resource_policies::Get {
16256 super::builder::resource_policies::Get::new(self.inner.clone())
16257 }
16258
16259 /// Gets the access control policy for a resource. May be empty if no such
16260 /// policy or resource exists.
16261 pub fn get_iam_policy(&self) -> super::builder::resource_policies::GetIamPolicy {
16262 super::builder::resource_policies::GetIamPolicy::new(self.inner.clone())
16263 }
16264
16265 /// Creates a new resource policy.
16266 pub fn insert(&self) -> super::builder::resource_policies::Insert {
16267 super::builder::resource_policies::Insert::new(self.inner.clone())
16268 }
16269
16270 /// A list all the resource policies that have been configured for the
16271 /// specified project in specified region.
16272 pub fn list(&self) -> super::builder::resource_policies::List {
16273 super::builder::resource_policies::List::new(self.inner.clone())
16274 }
16275
16276 /// Modify the specified resource policy.
16277 pub fn patch(&self) -> super::builder::resource_policies::Patch {
16278 super::builder::resource_policies::Patch::new(self.inner.clone())
16279 }
16280
16281 /// Sets the access control policy on the specified resource.
16282 /// Replaces any existing policy.
16283 pub fn set_iam_policy(&self) -> super::builder::resource_policies::SetIamPolicy {
16284 super::builder::resource_policies::SetIamPolicy::new(self.inner.clone())
16285 }
16286
16287 /// Returns permissions that a caller has on the specified resource.
16288 pub fn test_iam_permissions(&self) -> super::builder::resource_policies::TestIamPermissions {
16289 super::builder::resource_policies::TestIamPermissions::new(self.inner.clone())
16290 }
16291
16292 /// Retrieves the specified region-specific Operations resource.
16293 pub fn get_operation(&self) -> super::builder::resource_policies::GetOperation {
16294 super::builder::resource_policies::GetOperation::new(self.inner.clone())
16295 }
16296}
16297
16298/// Implements a client for the Google Compute Engine API.
16299///
16300/// # Example
16301/// ```
16302/// # use google_cloud_compute_v1::client::RolloutPlans;
16303/// async fn sample(
16304/// ) -> anyhow::Result<()> {
16305/// let client = RolloutPlans::builder().build().await?;
16306/// // use `client` to make requests to the Google Compute Engine API.
16307/// Ok(())
16308/// }
16309/// ```
16310///
16311/// # Service Description
16312///
16313/// Service for the `rolloutPlans` resource.
16314///
16315/// # Configuration
16316///
16317/// To configure `RolloutPlans` use the `with_*` methods in the type returned
16318/// by [builder()][RolloutPlans::builder]. The default configuration should
16319/// work for most applications. Common configuration changes include
16320///
16321/// * [with_endpoint()]: by default this client uses the global default endpoint
16322/// (`https://compute.googleapis.com`). Applications using regional
16323/// endpoints or running in restricted networks (e.g. a network configured
16324/// with [Private Google Access with VPC Service Controls]) may want to
16325/// override this default.
16326/// * [with_credentials()]: by default this client uses
16327/// [Application Default Credentials]. Applications using custom
16328/// authentication may need to override this default.
16329///
16330/// [with_endpoint()]: super::builder::rollout_plans::ClientBuilder::with_endpoint
16331/// [with_credentials()]: super::builder::rollout_plans::ClientBuilder::with_credentials
16332/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16333/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16334///
16335/// # Pooling and Cloning
16336///
16337/// `RolloutPlans` holds a connection pool internally, it is advised to
16338/// create one and reuse it. You do not need to wrap `RolloutPlans` in
16339/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16340/// already uses an `Arc` internally.
16341#[cfg(feature = "rollout-plans")]
16342#[cfg_attr(docsrs, doc(cfg(feature = "rollout-plans")))]
16343#[derive(Clone, Debug)]
16344pub struct RolloutPlans {
16345 inner: std::sync::Arc<dyn super::stub::dynamic::RolloutPlans>,
16346}
16347
16348#[cfg(feature = "rollout-plans")]
16349impl RolloutPlans {
16350 /// Returns a builder for [RolloutPlans].
16351 ///
16352 /// ```
16353 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16354 /// # use google_cloud_compute_v1::client::RolloutPlans;
16355 /// let client = RolloutPlans::builder().build().await?;
16356 /// # Ok(()) }
16357 /// ```
16358 pub fn builder() -> super::builder::rollout_plans::ClientBuilder {
16359 crate::new_client_builder(super::builder::rollout_plans::client::Factory)
16360 }
16361
16362 /// Creates a new client from the provided stub.
16363 ///
16364 /// The most common case for calling this function is in tests mocking the
16365 /// client's behavior.
16366 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16367 where
16368 T: super::stub::RolloutPlans + 'static,
16369 {
16370 Self { inner: stub.into() }
16371 }
16372
16373 pub(crate) async fn new(
16374 config: gaxi::options::ClientConfig,
16375 ) -> crate::ClientBuilderResult<Self> {
16376 let inner = Self::build_inner(config).await?;
16377 Ok(Self { inner })
16378 }
16379
16380 async fn build_inner(
16381 conf: gaxi::options::ClientConfig,
16382 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::RolloutPlans>> {
16383 if gaxi::options::tracing_enabled(&conf) {
16384 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16385 }
16386 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16387 }
16388
16389 async fn build_transport(
16390 conf: gaxi::options::ClientConfig,
16391 ) -> crate::ClientBuilderResult<impl super::stub::RolloutPlans> {
16392 super::transport::RolloutPlans::new(conf).await
16393 }
16394
16395 async fn build_with_tracing(
16396 conf: gaxi::options::ClientConfig,
16397 ) -> crate::ClientBuilderResult<impl super::stub::RolloutPlans> {
16398 Self::build_transport(conf)
16399 .await
16400 .map(super::tracing::RolloutPlans::new)
16401 }
16402
16403 /// Deletes a RolloutPlan.
16404 pub fn delete(&self) -> super::builder::rollout_plans::Delete {
16405 super::builder::rollout_plans::Delete::new(self.inner.clone())
16406 }
16407
16408 /// Gets details of a single project-scoped RolloutPlan.
16409 pub fn get(&self) -> super::builder::rollout_plans::Get {
16410 super::builder::rollout_plans::Get::new(self.inner.clone())
16411 }
16412
16413 /// Creates a new RolloutPlan in a given project and location.
16414 pub fn insert(&self) -> super::builder::rollout_plans::Insert {
16415 super::builder::rollout_plans::Insert::new(self.inner.clone())
16416 }
16417
16418 /// Lists RolloutPlans in a given project and location.
16419 pub fn list(&self) -> super::builder::rollout_plans::List {
16420 super::builder::rollout_plans::List::new(self.inner.clone())
16421 }
16422
16423 /// Retrieves the specified Operations resource.
16424 pub fn get_operation(&self) -> super::builder::rollout_plans::GetOperation {
16425 super::builder::rollout_plans::GetOperation::new(self.inner.clone())
16426 }
16427}
16428
16429/// Implements a client for the Google Compute Engine API.
16430///
16431/// # Example
16432/// ```
16433/// # use google_cloud_compute_v1::client::Rollouts;
16434/// async fn sample(
16435/// ) -> anyhow::Result<()> {
16436/// let client = Rollouts::builder().build().await?;
16437/// // use `client` to make requests to the Google Compute Engine API.
16438/// Ok(())
16439/// }
16440/// ```
16441///
16442/// # Service Description
16443///
16444/// Service for the `rollouts` resource.
16445///
16446/// # Configuration
16447///
16448/// To configure `Rollouts` use the `with_*` methods in the type returned
16449/// by [builder()][Rollouts::builder]. The default configuration should
16450/// work for most applications. Common configuration changes include
16451///
16452/// * [with_endpoint()]: by default this client uses the global default endpoint
16453/// (`https://compute.googleapis.com`). Applications using regional
16454/// endpoints or running in restricted networks (e.g. a network configured
16455/// with [Private Google Access with VPC Service Controls]) may want to
16456/// override this default.
16457/// * [with_credentials()]: by default this client uses
16458/// [Application Default Credentials]. Applications using custom
16459/// authentication may need to override this default.
16460///
16461/// [with_endpoint()]: super::builder::rollouts::ClientBuilder::with_endpoint
16462/// [with_credentials()]: super::builder::rollouts::ClientBuilder::with_credentials
16463/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16464/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16465///
16466/// # Pooling and Cloning
16467///
16468/// `Rollouts` holds a connection pool internally, it is advised to
16469/// create one and reuse it. You do not need to wrap `Rollouts` in
16470/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16471/// already uses an `Arc` internally.
16472#[cfg(feature = "rollouts")]
16473#[cfg_attr(docsrs, doc(cfg(feature = "rollouts")))]
16474#[derive(Clone, Debug)]
16475pub struct Rollouts {
16476 inner: std::sync::Arc<dyn super::stub::dynamic::Rollouts>,
16477}
16478
16479#[cfg(feature = "rollouts")]
16480impl Rollouts {
16481 /// Returns a builder for [Rollouts].
16482 ///
16483 /// ```
16484 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16485 /// # use google_cloud_compute_v1::client::Rollouts;
16486 /// let client = Rollouts::builder().build().await?;
16487 /// # Ok(()) }
16488 /// ```
16489 pub fn builder() -> super::builder::rollouts::ClientBuilder {
16490 crate::new_client_builder(super::builder::rollouts::client::Factory)
16491 }
16492
16493 /// Creates a new client from the provided stub.
16494 ///
16495 /// The most common case for calling this function is in tests mocking the
16496 /// client's behavior.
16497 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16498 where
16499 T: super::stub::Rollouts + 'static,
16500 {
16501 Self { inner: stub.into() }
16502 }
16503
16504 pub(crate) async fn new(
16505 config: gaxi::options::ClientConfig,
16506 ) -> crate::ClientBuilderResult<Self> {
16507 let inner = Self::build_inner(config).await?;
16508 Ok(Self { inner })
16509 }
16510
16511 async fn build_inner(
16512 conf: gaxi::options::ClientConfig,
16513 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Rollouts>> {
16514 if gaxi::options::tracing_enabled(&conf) {
16515 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16516 }
16517 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16518 }
16519
16520 async fn build_transport(
16521 conf: gaxi::options::ClientConfig,
16522 ) -> crate::ClientBuilderResult<impl super::stub::Rollouts> {
16523 super::transport::Rollouts::new(conf).await
16524 }
16525
16526 async fn build_with_tracing(
16527 conf: gaxi::options::ClientConfig,
16528 ) -> crate::ClientBuilderResult<impl super::stub::Rollouts> {
16529 Self::build_transport(conf)
16530 .await
16531 .map(super::tracing::Rollouts::new)
16532 }
16533
16534 /// Cancels a Rollout.
16535 pub fn cancel(&self) -> super::builder::rollouts::Cancel {
16536 super::builder::rollouts::Cancel::new(self.inner.clone())
16537 }
16538
16539 /// Deletes a Rollout.
16540 pub fn delete(&self) -> super::builder::rollouts::Delete {
16541 super::builder::rollouts::Delete::new(self.inner.clone())
16542 }
16543
16544 /// Gets details of a single project-scoped Rollout.
16545 pub fn get(&self) -> super::builder::rollouts::Get {
16546 super::builder::rollouts::Get::new(self.inner.clone())
16547 }
16548
16549 /// Lists Rollouts in a given project and location.
16550 pub fn list(&self) -> super::builder::rollouts::List {
16551 super::builder::rollouts::List::new(self.inner.clone())
16552 }
16553
16554 /// Retrieves the specified Operations resource.
16555 pub fn get_operation(&self) -> super::builder::rollouts::GetOperation {
16556 super::builder::rollouts::GetOperation::new(self.inner.clone())
16557 }
16558}
16559
16560/// Implements a client for the Google Compute Engine API.
16561///
16562/// # Example
16563/// ```
16564/// # use google_cloud_compute_v1::client::Routers;
16565/// async fn sample(
16566/// ) -> anyhow::Result<()> {
16567/// let client = Routers::builder().build().await?;
16568/// // use `client` to make requests to the Google Compute Engine API.
16569/// Ok(())
16570/// }
16571/// ```
16572///
16573/// # Service Description
16574///
16575/// Service for the `routers` resource.
16576///
16577/// # Configuration
16578///
16579/// To configure `Routers` use the `with_*` methods in the type returned
16580/// by [builder()][Routers::builder]. The default configuration should
16581/// work for most applications. Common configuration changes include
16582///
16583/// * [with_endpoint()]: by default this client uses the global default endpoint
16584/// (`https://compute.googleapis.com`). Applications using regional
16585/// endpoints or running in restricted networks (e.g. a network configured
16586/// with [Private Google Access with VPC Service Controls]) may want to
16587/// override this default.
16588/// * [with_credentials()]: by default this client uses
16589/// [Application Default Credentials]. Applications using custom
16590/// authentication may need to override this default.
16591///
16592/// [with_endpoint()]: super::builder::routers::ClientBuilder::with_endpoint
16593/// [with_credentials()]: super::builder::routers::ClientBuilder::with_credentials
16594/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16595/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16596///
16597/// # Pooling and Cloning
16598///
16599/// `Routers` holds a connection pool internally, it is advised to
16600/// create one and reuse it. You do not need to wrap `Routers` in
16601/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16602/// already uses an `Arc` internally.
16603#[cfg(feature = "routers")]
16604#[cfg_attr(docsrs, doc(cfg(feature = "routers")))]
16605#[derive(Clone, Debug)]
16606pub struct Routers {
16607 inner: std::sync::Arc<dyn super::stub::dynamic::Routers>,
16608}
16609
16610#[cfg(feature = "routers")]
16611impl Routers {
16612 /// Returns a builder for [Routers].
16613 ///
16614 /// ```
16615 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16616 /// # use google_cloud_compute_v1::client::Routers;
16617 /// let client = Routers::builder().build().await?;
16618 /// # Ok(()) }
16619 /// ```
16620 pub fn builder() -> super::builder::routers::ClientBuilder {
16621 crate::new_client_builder(super::builder::routers::client::Factory)
16622 }
16623
16624 /// Creates a new client from the provided stub.
16625 ///
16626 /// The most common case for calling this function is in tests mocking the
16627 /// client's behavior.
16628 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16629 where
16630 T: super::stub::Routers + 'static,
16631 {
16632 Self { inner: stub.into() }
16633 }
16634
16635 pub(crate) async fn new(
16636 config: gaxi::options::ClientConfig,
16637 ) -> crate::ClientBuilderResult<Self> {
16638 let inner = Self::build_inner(config).await?;
16639 Ok(Self { inner })
16640 }
16641
16642 async fn build_inner(
16643 conf: gaxi::options::ClientConfig,
16644 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Routers>> {
16645 if gaxi::options::tracing_enabled(&conf) {
16646 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16647 }
16648 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16649 }
16650
16651 async fn build_transport(
16652 conf: gaxi::options::ClientConfig,
16653 ) -> crate::ClientBuilderResult<impl super::stub::Routers> {
16654 super::transport::Routers::new(conf).await
16655 }
16656
16657 async fn build_with_tracing(
16658 conf: gaxi::options::ClientConfig,
16659 ) -> crate::ClientBuilderResult<impl super::stub::Routers> {
16660 Self::build_transport(conf)
16661 .await
16662 .map(super::tracing::Routers::new)
16663 }
16664
16665 /// Retrieves an aggregated list of routers.
16666 ///
16667 /// To prevent failure, Google recommends that you set the
16668 /// `returnPartialSuccess` parameter to `true`.
16669 pub fn aggregated_list(&self) -> super::builder::routers::AggregatedList {
16670 super::builder::routers::AggregatedList::new(self.inner.clone())
16671 }
16672
16673 /// Deletes the specified Router resource.
16674 pub fn delete(&self) -> super::builder::routers::Delete {
16675 super::builder::routers::Delete::new(self.inner.clone())
16676 }
16677
16678 /// Deletes Route Policy
16679 pub fn delete_route_policy(&self) -> super::builder::routers::DeleteRoutePolicy {
16680 super::builder::routers::DeleteRoutePolicy::new(self.inner.clone())
16681 }
16682
16683 /// Returns the specified Router resource.
16684 pub fn get(&self) -> super::builder::routers::Get {
16685 super::builder::routers::Get::new(self.inner.clone())
16686 }
16687
16688 /// Retrieves runtime NAT IP information.
16689 pub fn get_nat_ip_info(&self) -> super::builder::routers::GetNatIpInfo {
16690 super::builder::routers::GetNatIpInfo::new(self.inner.clone())
16691 }
16692
16693 /// Retrieves runtime Nat mapping information of VM endpoints.
16694 pub fn get_nat_mapping_info(&self) -> super::builder::routers::GetNatMappingInfo {
16695 super::builder::routers::GetNatMappingInfo::new(self.inner.clone())
16696 }
16697
16698 /// Returns specified Route Policy
16699 pub fn get_route_policy(&self) -> super::builder::routers::GetRoutePolicy {
16700 super::builder::routers::GetRoutePolicy::new(self.inner.clone())
16701 }
16702
16703 /// Retrieves runtime information of the specified router.
16704 pub fn get_router_status(&self) -> super::builder::routers::GetRouterStatus {
16705 super::builder::routers::GetRouterStatus::new(self.inner.clone())
16706 }
16707
16708 /// Creates a Router resource in the specified project and region using
16709 /// the data included in the request.
16710 pub fn insert(&self) -> super::builder::routers::Insert {
16711 super::builder::routers::Insert::new(self.inner.clone())
16712 }
16713
16714 /// Retrieves a list of Router resources available to the specified project.
16715 pub fn list(&self) -> super::builder::routers::List {
16716 super::builder::routers::List::new(self.inner.clone())
16717 }
16718
16719 /// Retrieves a list of router bgp routes available to the specified project.
16720 pub fn list_bgp_routes(&self) -> super::builder::routers::ListBgpRoutes {
16721 super::builder::routers::ListBgpRoutes::new(self.inner.clone())
16722 }
16723
16724 /// Retrieves a list of router route policy subresources available to the
16725 /// specified project.
16726 pub fn list_route_policies(&self) -> super::builder::routers::ListRoutePolicies {
16727 super::builder::routers::ListRoutePolicies::new(self.inner.clone())
16728 }
16729
16730 /// Patches the specified Router resource with the data included in the
16731 /// request. This method supportsPATCH
16732 /// semantics and usesJSON merge
16733 /// patch format and processing rules.
16734 pub fn patch(&self) -> super::builder::routers::Patch {
16735 super::builder::routers::Patch::new(self.inner.clone())
16736 }
16737
16738 /// Patches Route Policy
16739 pub fn patch_route_policy(&self) -> super::builder::routers::PatchRoutePolicy {
16740 super::builder::routers::PatchRoutePolicy::new(self.inner.clone())
16741 }
16742
16743 /// Preview fields auto-generated during router create andupdate operations.
16744 /// Calling this method does NOT create or update the router.
16745 pub fn preview(&self) -> super::builder::routers::Preview {
16746 super::builder::routers::Preview::new(self.inner.clone())
16747 }
16748
16749 /// Updates the specified Router resource with the data included in the
16750 /// request. This method conforms toPUT semantics, which requests that the state of the
16751 /// target resource be created or replaced with the state defined by the
16752 /// representation enclosed in the request message payload.
16753 pub fn update(&self) -> super::builder::routers::Update {
16754 super::builder::routers::Update::new(self.inner.clone())
16755 }
16756
16757 /// Updates or creates new Route Policy
16758 pub fn update_route_policy(&self) -> super::builder::routers::UpdateRoutePolicy {
16759 super::builder::routers::UpdateRoutePolicy::new(self.inner.clone())
16760 }
16761
16762 /// Retrieves the specified region-specific Operations resource.
16763 pub fn get_operation(&self) -> super::builder::routers::GetOperation {
16764 super::builder::routers::GetOperation::new(self.inner.clone())
16765 }
16766}
16767
16768/// Implements a client for the Google Compute Engine API.
16769///
16770/// # Example
16771/// ```
16772/// # use google_cloud_compute_v1::client::Routes;
16773/// async fn sample(
16774/// ) -> anyhow::Result<()> {
16775/// let client = Routes::builder().build().await?;
16776/// // use `client` to make requests to the Google Compute Engine API.
16777/// Ok(())
16778/// }
16779/// ```
16780///
16781/// # Service Description
16782///
16783/// Service for the `routes` resource.
16784///
16785/// # Configuration
16786///
16787/// To configure `Routes` use the `with_*` methods in the type returned
16788/// by [builder()][Routes::builder]. The default configuration should
16789/// work for most applications. Common configuration changes include
16790///
16791/// * [with_endpoint()]: by default this client uses the global default endpoint
16792/// (`https://compute.googleapis.com`). Applications using regional
16793/// endpoints or running in restricted networks (e.g. a network configured
16794/// with [Private Google Access with VPC Service Controls]) may want to
16795/// override this default.
16796/// * [with_credentials()]: by default this client uses
16797/// [Application Default Credentials]. Applications using custom
16798/// authentication may need to override this default.
16799///
16800/// [with_endpoint()]: super::builder::routes::ClientBuilder::with_endpoint
16801/// [with_credentials()]: super::builder::routes::ClientBuilder::with_credentials
16802/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16803/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16804///
16805/// # Pooling and Cloning
16806///
16807/// `Routes` holds a connection pool internally, it is advised to
16808/// create one and reuse it. You do not need to wrap `Routes` in
16809/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16810/// already uses an `Arc` internally.
16811#[cfg(feature = "routes")]
16812#[cfg_attr(docsrs, doc(cfg(feature = "routes")))]
16813#[derive(Clone, Debug)]
16814pub struct Routes {
16815 inner: std::sync::Arc<dyn super::stub::dynamic::Routes>,
16816}
16817
16818#[cfg(feature = "routes")]
16819impl Routes {
16820 /// Returns a builder for [Routes].
16821 ///
16822 /// ```
16823 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16824 /// # use google_cloud_compute_v1::client::Routes;
16825 /// let client = Routes::builder().build().await?;
16826 /// # Ok(()) }
16827 /// ```
16828 pub fn builder() -> super::builder::routes::ClientBuilder {
16829 crate::new_client_builder(super::builder::routes::client::Factory)
16830 }
16831
16832 /// Creates a new client from the provided stub.
16833 ///
16834 /// The most common case for calling this function is in tests mocking the
16835 /// client's behavior.
16836 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16837 where
16838 T: super::stub::Routes + 'static,
16839 {
16840 Self { inner: stub.into() }
16841 }
16842
16843 pub(crate) async fn new(
16844 config: gaxi::options::ClientConfig,
16845 ) -> crate::ClientBuilderResult<Self> {
16846 let inner = Self::build_inner(config).await?;
16847 Ok(Self { inner })
16848 }
16849
16850 async fn build_inner(
16851 conf: gaxi::options::ClientConfig,
16852 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Routes>> {
16853 if gaxi::options::tracing_enabled(&conf) {
16854 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16855 }
16856 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16857 }
16858
16859 async fn build_transport(
16860 conf: gaxi::options::ClientConfig,
16861 ) -> crate::ClientBuilderResult<impl super::stub::Routes> {
16862 super::transport::Routes::new(conf).await
16863 }
16864
16865 async fn build_with_tracing(
16866 conf: gaxi::options::ClientConfig,
16867 ) -> crate::ClientBuilderResult<impl super::stub::Routes> {
16868 Self::build_transport(conf)
16869 .await
16870 .map(super::tracing::Routes::new)
16871 }
16872
16873 /// Deletes the specified Route resource.
16874 pub fn delete(&self) -> super::builder::routes::Delete {
16875 super::builder::routes::Delete::new(self.inner.clone())
16876 }
16877
16878 /// Returns the specified Route resource.
16879 pub fn get(&self) -> super::builder::routes::Get {
16880 super::builder::routes::Get::new(self.inner.clone())
16881 }
16882
16883 /// Creates a Route resource in the specified project using the data included
16884 /// in the request.
16885 pub fn insert(&self) -> super::builder::routes::Insert {
16886 super::builder::routes::Insert::new(self.inner.clone())
16887 }
16888
16889 /// Retrieves the list of Route resources available to the specified project.
16890 pub fn list(&self) -> super::builder::routes::List {
16891 super::builder::routes::List::new(self.inner.clone())
16892 }
16893
16894 /// Returns permissions that a caller has on the specified resource.
16895 pub fn test_iam_permissions(&self) -> super::builder::routes::TestIamPermissions {
16896 super::builder::routes::TestIamPermissions::new(self.inner.clone())
16897 }
16898
16899 /// Retrieves the specified Operations resource.
16900 pub fn get_operation(&self) -> super::builder::routes::GetOperation {
16901 super::builder::routes::GetOperation::new(self.inner.clone())
16902 }
16903}
16904
16905/// Implements a client for the Google Compute Engine API.
16906///
16907/// # Example
16908/// ```
16909/// # use google_cloud_compute_v1::client::SecurityPolicies;
16910/// async fn sample(
16911/// ) -> anyhow::Result<()> {
16912/// let client = SecurityPolicies::builder().build().await?;
16913/// // use `client` to make requests to the Google Compute Engine API.
16914/// Ok(())
16915/// }
16916/// ```
16917///
16918/// # Service Description
16919///
16920/// Service for the `securityPolicies` resource.
16921///
16922/// # Configuration
16923///
16924/// To configure `SecurityPolicies` use the `with_*` methods in the type returned
16925/// by [builder()][SecurityPolicies::builder]. The default configuration should
16926/// work for most applications. Common configuration changes include
16927///
16928/// * [with_endpoint()]: by default this client uses the global default endpoint
16929/// (`https://compute.googleapis.com`). Applications using regional
16930/// endpoints or running in restricted networks (e.g. a network configured
16931/// with [Private Google Access with VPC Service Controls]) may want to
16932/// override this default.
16933/// * [with_credentials()]: by default this client uses
16934/// [Application Default Credentials]. Applications using custom
16935/// authentication may need to override this default.
16936///
16937/// [with_endpoint()]: super::builder::security_policies::ClientBuilder::with_endpoint
16938/// [with_credentials()]: super::builder::security_policies::ClientBuilder::with_credentials
16939/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16940/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16941///
16942/// # Pooling and Cloning
16943///
16944/// `SecurityPolicies` holds a connection pool internally, it is advised to
16945/// create one and reuse it. You do not need to wrap `SecurityPolicies` in
16946/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16947/// already uses an `Arc` internally.
16948#[cfg(feature = "security-policies")]
16949#[cfg_attr(docsrs, doc(cfg(feature = "security-policies")))]
16950#[derive(Clone, Debug)]
16951pub struct SecurityPolicies {
16952 inner: std::sync::Arc<dyn super::stub::dynamic::SecurityPolicies>,
16953}
16954
16955#[cfg(feature = "security-policies")]
16956impl SecurityPolicies {
16957 /// Returns a builder for [SecurityPolicies].
16958 ///
16959 /// ```
16960 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
16961 /// # use google_cloud_compute_v1::client::SecurityPolicies;
16962 /// let client = SecurityPolicies::builder().build().await?;
16963 /// # Ok(()) }
16964 /// ```
16965 pub fn builder() -> super::builder::security_policies::ClientBuilder {
16966 crate::new_client_builder(super::builder::security_policies::client::Factory)
16967 }
16968
16969 /// Creates a new client from the provided stub.
16970 ///
16971 /// The most common case for calling this function is in tests mocking the
16972 /// client's behavior.
16973 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
16974 where
16975 T: super::stub::SecurityPolicies + 'static,
16976 {
16977 Self { inner: stub.into() }
16978 }
16979
16980 pub(crate) async fn new(
16981 config: gaxi::options::ClientConfig,
16982 ) -> crate::ClientBuilderResult<Self> {
16983 let inner = Self::build_inner(config).await?;
16984 Ok(Self { inner })
16985 }
16986
16987 async fn build_inner(
16988 conf: gaxi::options::ClientConfig,
16989 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SecurityPolicies>>
16990 {
16991 if gaxi::options::tracing_enabled(&conf) {
16992 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16993 }
16994 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16995 }
16996
16997 async fn build_transport(
16998 conf: gaxi::options::ClientConfig,
16999 ) -> crate::ClientBuilderResult<impl super::stub::SecurityPolicies> {
17000 super::transport::SecurityPolicies::new(conf).await
17001 }
17002
17003 async fn build_with_tracing(
17004 conf: gaxi::options::ClientConfig,
17005 ) -> crate::ClientBuilderResult<impl super::stub::SecurityPolicies> {
17006 Self::build_transport(conf)
17007 .await
17008 .map(super::tracing::SecurityPolicies::new)
17009 }
17010
17011 /// Inserts a rule into a security policy.
17012 pub fn add_rule(&self) -> super::builder::security_policies::AddRule {
17013 super::builder::security_policies::AddRule::new(self.inner.clone())
17014 }
17015
17016 /// Retrieves the list of all SecurityPolicy resources, regional and global,
17017 /// available to the specified project.
17018 ///
17019 /// To prevent failure, Google recommends that you set the
17020 /// `returnPartialSuccess` parameter to `true`.
17021 pub fn aggregated_list(&self) -> super::builder::security_policies::AggregatedList {
17022 super::builder::security_policies::AggregatedList::new(self.inner.clone())
17023 }
17024
17025 /// Deletes the specified policy.
17026 pub fn delete(&self) -> super::builder::security_policies::Delete {
17027 super::builder::security_policies::Delete::new(self.inner.clone())
17028 }
17029
17030 /// List all of the ordered rules present in a single specified policy.
17031 pub fn get(&self) -> super::builder::security_policies::Get {
17032 super::builder::security_policies::Get::new(self.inner.clone())
17033 }
17034
17035 /// Gets a rule at the specified priority.
17036 pub fn get_rule(&self) -> super::builder::security_policies::GetRule {
17037 super::builder::security_policies::GetRule::new(self.inner.clone())
17038 }
17039
17040 /// Creates a new policy in the specified project using the data included in
17041 /// the request.
17042 pub fn insert(&self) -> super::builder::security_policies::Insert {
17043 super::builder::security_policies::Insert::new(self.inner.clone())
17044 }
17045
17046 /// List all the policies that have been configured for the specified project.
17047 pub fn list(&self) -> super::builder::security_policies::List {
17048 super::builder::security_policies::List::new(self.inner.clone())
17049 }
17050
17051 /// Gets the current list of preconfigured Web Application Firewall (WAF)
17052 /// expressions.
17053 pub fn list_preconfigured_expression_sets(
17054 &self,
17055 ) -> super::builder::security_policies::ListPreconfiguredExpressionSets {
17056 super::builder::security_policies::ListPreconfiguredExpressionSets::new(self.inner.clone())
17057 }
17058
17059 /// Patches the specified policy with the data included in the request. To
17060 /// clear fields in the policy, leave the fields empty and specify them in the
17061 /// updateMask. This cannot be used to be update the rules in the policy.
17062 /// Please use the per rule methods like addRule, patchRule, and removeRule
17063 /// instead.
17064 pub fn patch(&self) -> super::builder::security_policies::Patch {
17065 super::builder::security_policies::Patch::new(self.inner.clone())
17066 }
17067
17068 /// Patches a rule at the specified priority. To clear fields in the rule,
17069 /// leave the fields empty and specify them in the updateMask.
17070 pub fn patch_rule(&self) -> super::builder::security_policies::PatchRule {
17071 super::builder::security_policies::PatchRule::new(self.inner.clone())
17072 }
17073
17074 /// Deletes a rule at the specified priority.
17075 pub fn remove_rule(&self) -> super::builder::security_policies::RemoveRule {
17076 super::builder::security_policies::RemoveRule::new(self.inner.clone())
17077 }
17078
17079 /// Sets the labels on a security policy. To learn more about labels,
17080 /// read the Labeling Resources
17081 /// documentation.
17082 pub fn set_labels(&self) -> super::builder::security_policies::SetLabels {
17083 super::builder::security_policies::SetLabels::new(self.inner.clone())
17084 }
17085
17086 /// Retrieves the specified Operations resource.
17087 pub fn get_operation(&self) -> super::builder::security_policies::GetOperation {
17088 super::builder::security_policies::GetOperation::new(self.inner.clone())
17089 }
17090}
17091
17092/// Implements a client for the Google Compute Engine API.
17093///
17094/// # Example
17095/// ```
17096/// # use google_cloud_compute_v1::client::ServiceAttachments;
17097/// async fn sample(
17098/// ) -> anyhow::Result<()> {
17099/// let client = ServiceAttachments::builder().build().await?;
17100/// // use `client` to make requests to the Google Compute Engine API.
17101/// Ok(())
17102/// }
17103/// ```
17104///
17105/// # Service Description
17106///
17107/// Service for the `serviceAttachments` resource.
17108///
17109/// # Configuration
17110///
17111/// To configure `ServiceAttachments` use the `with_*` methods in the type returned
17112/// by [builder()][ServiceAttachments::builder]. The default configuration should
17113/// work for most applications. Common configuration changes include
17114///
17115/// * [with_endpoint()]: by default this client uses the global default endpoint
17116/// (`https://compute.googleapis.com`). Applications using regional
17117/// endpoints or running in restricted networks (e.g. a network configured
17118/// with [Private Google Access with VPC Service Controls]) may want to
17119/// override this default.
17120/// * [with_credentials()]: by default this client uses
17121/// [Application Default Credentials]. Applications using custom
17122/// authentication may need to override this default.
17123///
17124/// [with_endpoint()]: super::builder::service_attachments::ClientBuilder::with_endpoint
17125/// [with_credentials()]: super::builder::service_attachments::ClientBuilder::with_credentials
17126/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17127/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17128///
17129/// # Pooling and Cloning
17130///
17131/// `ServiceAttachments` holds a connection pool internally, it is advised to
17132/// create one and reuse it. You do not need to wrap `ServiceAttachments` in
17133/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17134/// already uses an `Arc` internally.
17135#[cfg(feature = "service-attachments")]
17136#[cfg_attr(docsrs, doc(cfg(feature = "service-attachments")))]
17137#[derive(Clone, Debug)]
17138pub struct ServiceAttachments {
17139 inner: std::sync::Arc<dyn super::stub::dynamic::ServiceAttachments>,
17140}
17141
17142#[cfg(feature = "service-attachments")]
17143impl ServiceAttachments {
17144 /// Returns a builder for [ServiceAttachments].
17145 ///
17146 /// ```
17147 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17148 /// # use google_cloud_compute_v1::client::ServiceAttachments;
17149 /// let client = ServiceAttachments::builder().build().await?;
17150 /// # Ok(()) }
17151 /// ```
17152 pub fn builder() -> super::builder::service_attachments::ClientBuilder {
17153 crate::new_client_builder(super::builder::service_attachments::client::Factory)
17154 }
17155
17156 /// Creates a new client from the provided stub.
17157 ///
17158 /// The most common case for calling this function is in tests mocking the
17159 /// client's behavior.
17160 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17161 where
17162 T: super::stub::ServiceAttachments + 'static,
17163 {
17164 Self { inner: stub.into() }
17165 }
17166
17167 pub(crate) async fn new(
17168 config: gaxi::options::ClientConfig,
17169 ) -> crate::ClientBuilderResult<Self> {
17170 let inner = Self::build_inner(config).await?;
17171 Ok(Self { inner })
17172 }
17173
17174 async fn build_inner(
17175 conf: gaxi::options::ClientConfig,
17176 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ServiceAttachments>>
17177 {
17178 if gaxi::options::tracing_enabled(&conf) {
17179 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17180 }
17181 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17182 }
17183
17184 async fn build_transport(
17185 conf: gaxi::options::ClientConfig,
17186 ) -> crate::ClientBuilderResult<impl super::stub::ServiceAttachments> {
17187 super::transport::ServiceAttachments::new(conf).await
17188 }
17189
17190 async fn build_with_tracing(
17191 conf: gaxi::options::ClientConfig,
17192 ) -> crate::ClientBuilderResult<impl super::stub::ServiceAttachments> {
17193 Self::build_transport(conf)
17194 .await
17195 .map(super::tracing::ServiceAttachments::new)
17196 }
17197
17198 /// Retrieves the list of all ServiceAttachment resources,
17199 /// regional and global, available to the specified project.
17200 ///
17201 /// To prevent failure, Google recommends that you set the
17202 /// `returnPartialSuccess` parameter to `true`.
17203 pub fn aggregated_list(&self) -> super::builder::service_attachments::AggregatedList {
17204 super::builder::service_attachments::AggregatedList::new(self.inner.clone())
17205 }
17206
17207 /// Deletes the specified ServiceAttachment in the given scope
17208 pub fn delete(&self) -> super::builder::service_attachments::Delete {
17209 super::builder::service_attachments::Delete::new(self.inner.clone())
17210 }
17211
17212 /// Returns the specified ServiceAttachment resource in the given scope.
17213 pub fn get(&self) -> super::builder::service_attachments::Get {
17214 super::builder::service_attachments::Get::new(self.inner.clone())
17215 }
17216
17217 /// Gets the access control policy for a resource. May be empty if no such
17218 /// policy or resource exists.
17219 pub fn get_iam_policy(&self) -> super::builder::service_attachments::GetIamPolicy {
17220 super::builder::service_attachments::GetIamPolicy::new(self.inner.clone())
17221 }
17222
17223 /// Creates a ServiceAttachment in the specified project in the given scope
17224 /// using the parameters that are included in the request.
17225 pub fn insert(&self) -> super::builder::service_attachments::Insert {
17226 super::builder::service_attachments::Insert::new(self.inner.clone())
17227 }
17228
17229 /// Lists the ServiceAttachments for a project in the given scope.
17230 pub fn list(&self) -> super::builder::service_attachments::List {
17231 super::builder::service_attachments::List::new(self.inner.clone())
17232 }
17233
17234 /// Patches the specified ServiceAttachment resource with the data included in
17235 /// the request. This method supports PATCH
17236 /// semantics and usesJSON merge
17237 /// patch format and processing rules.
17238 pub fn patch(&self) -> super::builder::service_attachments::Patch {
17239 super::builder::service_attachments::Patch::new(self.inner.clone())
17240 }
17241
17242 /// Sets the access control policy on the specified resource.
17243 /// Replaces any existing policy.
17244 pub fn set_iam_policy(&self) -> super::builder::service_attachments::SetIamPolicy {
17245 super::builder::service_attachments::SetIamPolicy::new(self.inner.clone())
17246 }
17247
17248 /// Returns permissions that a caller has on the specified resource.
17249 pub fn test_iam_permissions(&self) -> super::builder::service_attachments::TestIamPermissions {
17250 super::builder::service_attachments::TestIamPermissions::new(self.inner.clone())
17251 }
17252
17253 /// Retrieves the specified region-specific Operations resource.
17254 pub fn get_operation(&self) -> super::builder::service_attachments::GetOperation {
17255 super::builder::service_attachments::GetOperation::new(self.inner.clone())
17256 }
17257}
17258
17259/// Implements a client for the Google Compute Engine API.
17260///
17261/// # Example
17262/// ```
17263/// # use google_cloud_compute_v1::client::SnapshotSettings;
17264/// async fn sample(
17265/// ) -> anyhow::Result<()> {
17266/// let client = SnapshotSettings::builder().build().await?;
17267/// // use `client` to make requests to the Google Compute Engine API.
17268/// Ok(())
17269/// }
17270/// ```
17271///
17272/// # Service Description
17273///
17274/// Service for the `snapshotSettings` resource.
17275///
17276/// # Configuration
17277///
17278/// To configure `SnapshotSettings` use the `with_*` methods in the type returned
17279/// by [builder()][SnapshotSettings::builder]. The default configuration should
17280/// work for most applications. Common configuration changes include
17281///
17282/// * [with_endpoint()]: by default this client uses the global default endpoint
17283/// (`https://compute.googleapis.com`). Applications using regional
17284/// endpoints or running in restricted networks (e.g. a network configured
17285/// with [Private Google Access with VPC Service Controls]) may want to
17286/// override this default.
17287/// * [with_credentials()]: by default this client uses
17288/// [Application Default Credentials]. Applications using custom
17289/// authentication may need to override this default.
17290///
17291/// [with_endpoint()]: super::builder::snapshot_settings::ClientBuilder::with_endpoint
17292/// [with_credentials()]: super::builder::snapshot_settings::ClientBuilder::with_credentials
17293/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17294/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17295///
17296/// # Pooling and Cloning
17297///
17298/// `SnapshotSettings` holds a connection pool internally, it is advised to
17299/// create one and reuse it. You do not need to wrap `SnapshotSettings` in
17300/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17301/// already uses an `Arc` internally.
17302#[cfg(feature = "snapshot-settings")]
17303#[cfg_attr(docsrs, doc(cfg(feature = "snapshot-settings")))]
17304#[derive(Clone, Debug)]
17305pub struct SnapshotSettings {
17306 inner: std::sync::Arc<dyn super::stub::dynamic::SnapshotSettings>,
17307}
17308
17309#[cfg(feature = "snapshot-settings")]
17310impl SnapshotSettings {
17311 /// Returns a builder for [SnapshotSettings].
17312 ///
17313 /// ```
17314 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17315 /// # use google_cloud_compute_v1::client::SnapshotSettings;
17316 /// let client = SnapshotSettings::builder().build().await?;
17317 /// # Ok(()) }
17318 /// ```
17319 pub fn builder() -> super::builder::snapshot_settings::ClientBuilder {
17320 crate::new_client_builder(super::builder::snapshot_settings::client::Factory)
17321 }
17322
17323 /// Creates a new client from the provided stub.
17324 ///
17325 /// The most common case for calling this function is in tests mocking the
17326 /// client's behavior.
17327 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17328 where
17329 T: super::stub::SnapshotSettings + 'static,
17330 {
17331 Self { inner: stub.into() }
17332 }
17333
17334 pub(crate) async fn new(
17335 config: gaxi::options::ClientConfig,
17336 ) -> crate::ClientBuilderResult<Self> {
17337 let inner = Self::build_inner(config).await?;
17338 Ok(Self { inner })
17339 }
17340
17341 async fn build_inner(
17342 conf: gaxi::options::ClientConfig,
17343 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SnapshotSettings>>
17344 {
17345 if gaxi::options::tracing_enabled(&conf) {
17346 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17347 }
17348 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17349 }
17350
17351 async fn build_transport(
17352 conf: gaxi::options::ClientConfig,
17353 ) -> crate::ClientBuilderResult<impl super::stub::SnapshotSettings> {
17354 super::transport::SnapshotSettings::new(conf).await
17355 }
17356
17357 async fn build_with_tracing(
17358 conf: gaxi::options::ClientConfig,
17359 ) -> crate::ClientBuilderResult<impl super::stub::SnapshotSettings> {
17360 Self::build_transport(conf)
17361 .await
17362 .map(super::tracing::SnapshotSettings::new)
17363 }
17364
17365 /// Get snapshot settings.
17366 pub fn get(&self) -> super::builder::snapshot_settings::Get {
17367 super::builder::snapshot_settings::Get::new(self.inner.clone())
17368 }
17369
17370 /// Patch snapshot settings.
17371 pub fn patch(&self) -> super::builder::snapshot_settings::Patch {
17372 super::builder::snapshot_settings::Patch::new(self.inner.clone())
17373 }
17374
17375 /// Retrieves the specified Operations resource.
17376 pub fn get_operation(&self) -> super::builder::snapshot_settings::GetOperation {
17377 super::builder::snapshot_settings::GetOperation::new(self.inner.clone())
17378 }
17379}
17380
17381/// Implements a client for the Google Compute Engine API.
17382///
17383/// # Example
17384/// ```
17385/// # use google_cloud_compute_v1::client::Snapshots;
17386/// async fn sample(
17387/// ) -> anyhow::Result<()> {
17388/// let client = Snapshots::builder().build().await?;
17389/// // use `client` to make requests to the Google Compute Engine API.
17390/// Ok(())
17391/// }
17392/// ```
17393///
17394/// # Service Description
17395///
17396/// Service for the `snapshots` resource.
17397///
17398/// # Configuration
17399///
17400/// To configure `Snapshots` use the `with_*` methods in the type returned
17401/// by [builder()][Snapshots::builder]. The default configuration should
17402/// work for most applications. Common configuration changes include
17403///
17404/// * [with_endpoint()]: by default this client uses the global default endpoint
17405/// (`https://compute.googleapis.com`). Applications using regional
17406/// endpoints or running in restricted networks (e.g. a network configured
17407/// with [Private Google Access with VPC Service Controls]) may want to
17408/// override this default.
17409/// * [with_credentials()]: by default this client uses
17410/// [Application Default Credentials]. Applications using custom
17411/// authentication may need to override this default.
17412///
17413/// [with_endpoint()]: super::builder::snapshots::ClientBuilder::with_endpoint
17414/// [with_credentials()]: super::builder::snapshots::ClientBuilder::with_credentials
17415/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17416/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17417///
17418/// # Pooling and Cloning
17419///
17420/// `Snapshots` holds a connection pool internally, it is advised to
17421/// create one and reuse it. You do not need to wrap `Snapshots` in
17422/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17423/// already uses an `Arc` internally.
17424#[cfg(feature = "snapshots")]
17425#[cfg_attr(docsrs, doc(cfg(feature = "snapshots")))]
17426#[derive(Clone, Debug)]
17427pub struct Snapshots {
17428 inner: std::sync::Arc<dyn super::stub::dynamic::Snapshots>,
17429}
17430
17431#[cfg(feature = "snapshots")]
17432impl Snapshots {
17433 /// Returns a builder for [Snapshots].
17434 ///
17435 /// ```
17436 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17437 /// # use google_cloud_compute_v1::client::Snapshots;
17438 /// let client = Snapshots::builder().build().await?;
17439 /// # Ok(()) }
17440 /// ```
17441 pub fn builder() -> super::builder::snapshots::ClientBuilder {
17442 crate::new_client_builder(super::builder::snapshots::client::Factory)
17443 }
17444
17445 /// Creates a new client from the provided stub.
17446 ///
17447 /// The most common case for calling this function is in tests mocking the
17448 /// client's behavior.
17449 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17450 where
17451 T: super::stub::Snapshots + 'static,
17452 {
17453 Self { inner: stub.into() }
17454 }
17455
17456 pub(crate) async fn new(
17457 config: gaxi::options::ClientConfig,
17458 ) -> crate::ClientBuilderResult<Self> {
17459 let inner = Self::build_inner(config).await?;
17460 Ok(Self { inner })
17461 }
17462
17463 async fn build_inner(
17464 conf: gaxi::options::ClientConfig,
17465 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Snapshots>> {
17466 if gaxi::options::tracing_enabled(&conf) {
17467 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17468 }
17469 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17470 }
17471
17472 async fn build_transport(
17473 conf: gaxi::options::ClientConfig,
17474 ) -> crate::ClientBuilderResult<impl super::stub::Snapshots> {
17475 super::transport::Snapshots::new(conf).await
17476 }
17477
17478 async fn build_with_tracing(
17479 conf: gaxi::options::ClientConfig,
17480 ) -> crate::ClientBuilderResult<impl super::stub::Snapshots> {
17481 Self::build_transport(conf)
17482 .await
17483 .map(super::tracing::Snapshots::new)
17484 }
17485
17486 /// Deletes the specified Snapshot resource. Keep in mind that deleting
17487 /// a single snapshot might not necessarily delete all the data on that
17488 /// snapshot. If any data on the snapshot that is marked for deletion is
17489 /// needed for subsequent snapshots, the data will be moved to the next
17490 /// corresponding snapshot.
17491 ///
17492 /// For more information, seeDeleting
17493 /// snapshots.
17494 pub fn delete(&self) -> super::builder::snapshots::Delete {
17495 super::builder::snapshots::Delete::new(self.inner.clone())
17496 }
17497
17498 /// Returns the specified Snapshot resource.
17499 pub fn get(&self) -> super::builder::snapshots::Get {
17500 super::builder::snapshots::Get::new(self.inner.clone())
17501 }
17502
17503 /// Gets the access control policy for a resource. May be empty if no such
17504 /// policy or resource exists.
17505 pub fn get_iam_policy(&self) -> super::builder::snapshots::GetIamPolicy {
17506 super::builder::snapshots::GetIamPolicy::new(self.inner.clone())
17507 }
17508
17509 /// Creates a snapshot in the specified project using the data included
17510 /// in the request. For regular snapshot creation, consider using this method
17511 /// instead of disks.createSnapshot,
17512 /// as this method supports more features, such as creating snapshots in a
17513 /// project different from the source disk project.
17514 pub fn insert(&self) -> super::builder::snapshots::Insert {
17515 super::builder::snapshots::Insert::new(self.inner.clone())
17516 }
17517
17518 /// Retrieves the list of Snapshot resources contained within
17519 /// the specified project.
17520 pub fn list(&self) -> super::builder::snapshots::List {
17521 super::builder::snapshots::List::new(self.inner.clone())
17522 }
17523
17524 /// Sets the access control policy on the specified resource.
17525 /// Replaces any existing policy.
17526 pub fn set_iam_policy(&self) -> super::builder::snapshots::SetIamPolicy {
17527 super::builder::snapshots::SetIamPolicy::new(self.inner.clone())
17528 }
17529
17530 /// Sets the labels on a snapshot. To learn more about labels, read theLabeling
17531 /// Resources documentation.
17532 pub fn set_labels(&self) -> super::builder::snapshots::SetLabels {
17533 super::builder::snapshots::SetLabels::new(self.inner.clone())
17534 }
17535
17536 /// Returns permissions that a caller has on the specified resource.
17537 pub fn test_iam_permissions(&self) -> super::builder::snapshots::TestIamPermissions {
17538 super::builder::snapshots::TestIamPermissions::new(self.inner.clone())
17539 }
17540
17541 /// Rotates the customer-managed
17542 /// encryption key to the latest version for the specified snapshot.
17543 pub fn update_kms_key(&self) -> super::builder::snapshots::UpdateKmsKey {
17544 super::builder::snapshots::UpdateKmsKey::new(self.inner.clone())
17545 }
17546
17547 /// Retrieves the specified Operations resource.
17548 pub fn get_operation(&self) -> super::builder::snapshots::GetOperation {
17549 super::builder::snapshots::GetOperation::new(self.inner.clone())
17550 }
17551}
17552
17553/// Implements a client for the Google Compute Engine API.
17554///
17555/// # Example
17556/// ```
17557/// # use google_cloud_compute_v1::client::SslCertificates;
17558/// async fn sample(
17559/// ) -> anyhow::Result<()> {
17560/// let client = SslCertificates::builder().build().await?;
17561/// // use `client` to make requests to the Google Compute Engine API.
17562/// Ok(())
17563/// }
17564/// ```
17565///
17566/// # Service Description
17567///
17568/// Service for the `sslCertificates` resource.
17569///
17570/// # Configuration
17571///
17572/// To configure `SslCertificates` use the `with_*` methods in the type returned
17573/// by [builder()][SslCertificates::builder]. The default configuration should
17574/// work for most applications. Common configuration changes include
17575///
17576/// * [with_endpoint()]: by default this client uses the global default endpoint
17577/// (`https://compute.googleapis.com`). Applications using regional
17578/// endpoints or running in restricted networks (e.g. a network configured
17579/// with [Private Google Access with VPC Service Controls]) may want to
17580/// override this default.
17581/// * [with_credentials()]: by default this client uses
17582/// [Application Default Credentials]. Applications using custom
17583/// authentication may need to override this default.
17584///
17585/// [with_endpoint()]: super::builder::ssl_certificates::ClientBuilder::with_endpoint
17586/// [with_credentials()]: super::builder::ssl_certificates::ClientBuilder::with_credentials
17587/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17588/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17589///
17590/// # Pooling and Cloning
17591///
17592/// `SslCertificates` holds a connection pool internally, it is advised to
17593/// create one and reuse it. You do not need to wrap `SslCertificates` in
17594/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17595/// already uses an `Arc` internally.
17596#[cfg(feature = "ssl-certificates")]
17597#[cfg_attr(docsrs, doc(cfg(feature = "ssl-certificates")))]
17598#[derive(Clone, Debug)]
17599pub struct SslCertificates {
17600 inner: std::sync::Arc<dyn super::stub::dynamic::SslCertificates>,
17601}
17602
17603#[cfg(feature = "ssl-certificates")]
17604impl SslCertificates {
17605 /// Returns a builder for [SslCertificates].
17606 ///
17607 /// ```
17608 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17609 /// # use google_cloud_compute_v1::client::SslCertificates;
17610 /// let client = SslCertificates::builder().build().await?;
17611 /// # Ok(()) }
17612 /// ```
17613 pub fn builder() -> super::builder::ssl_certificates::ClientBuilder {
17614 crate::new_client_builder(super::builder::ssl_certificates::client::Factory)
17615 }
17616
17617 /// Creates a new client from the provided stub.
17618 ///
17619 /// The most common case for calling this function is in tests mocking the
17620 /// client's behavior.
17621 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17622 where
17623 T: super::stub::SslCertificates + 'static,
17624 {
17625 Self { inner: stub.into() }
17626 }
17627
17628 pub(crate) async fn new(
17629 config: gaxi::options::ClientConfig,
17630 ) -> crate::ClientBuilderResult<Self> {
17631 let inner = Self::build_inner(config).await?;
17632 Ok(Self { inner })
17633 }
17634
17635 async fn build_inner(
17636 conf: gaxi::options::ClientConfig,
17637 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SslCertificates>> {
17638 if gaxi::options::tracing_enabled(&conf) {
17639 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17640 }
17641 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17642 }
17643
17644 async fn build_transport(
17645 conf: gaxi::options::ClientConfig,
17646 ) -> crate::ClientBuilderResult<impl super::stub::SslCertificates> {
17647 super::transport::SslCertificates::new(conf).await
17648 }
17649
17650 async fn build_with_tracing(
17651 conf: gaxi::options::ClientConfig,
17652 ) -> crate::ClientBuilderResult<impl super::stub::SslCertificates> {
17653 Self::build_transport(conf)
17654 .await
17655 .map(super::tracing::SslCertificates::new)
17656 }
17657
17658 /// Retrieves the list of all SslCertificate resources, regional and global,
17659 /// available to the specified project.
17660 ///
17661 /// To prevent failure, Google recommends that you set the
17662 /// `returnPartialSuccess` parameter to `true`.
17663 pub fn aggregated_list(&self) -> super::builder::ssl_certificates::AggregatedList {
17664 super::builder::ssl_certificates::AggregatedList::new(self.inner.clone())
17665 }
17666
17667 /// Deletes the specified SslCertificate resource.
17668 pub fn delete(&self) -> super::builder::ssl_certificates::Delete {
17669 super::builder::ssl_certificates::Delete::new(self.inner.clone())
17670 }
17671
17672 /// Returns the specified SslCertificate resource.
17673 pub fn get(&self) -> super::builder::ssl_certificates::Get {
17674 super::builder::ssl_certificates::Get::new(self.inner.clone())
17675 }
17676
17677 /// Creates a SslCertificate resource in the specified project using the data
17678 /// included in the request.
17679 pub fn insert(&self) -> super::builder::ssl_certificates::Insert {
17680 super::builder::ssl_certificates::Insert::new(self.inner.clone())
17681 }
17682
17683 /// Retrieves the list of SslCertificate resources available to the specified
17684 /// project.
17685 pub fn list(&self) -> super::builder::ssl_certificates::List {
17686 super::builder::ssl_certificates::List::new(self.inner.clone())
17687 }
17688
17689 /// Retrieves the specified Operations resource.
17690 pub fn get_operation(&self) -> super::builder::ssl_certificates::GetOperation {
17691 super::builder::ssl_certificates::GetOperation::new(self.inner.clone())
17692 }
17693}
17694
17695/// Implements a client for the Google Compute Engine API.
17696///
17697/// # Example
17698/// ```
17699/// # use google_cloud_compute_v1::client::SslPolicies;
17700/// async fn sample(
17701/// ) -> anyhow::Result<()> {
17702/// let client = SslPolicies::builder().build().await?;
17703/// // use `client` to make requests to the Google Compute Engine API.
17704/// Ok(())
17705/// }
17706/// ```
17707///
17708/// # Service Description
17709///
17710/// Service for the `sslPolicies` resource.
17711///
17712/// # Configuration
17713///
17714/// To configure `SslPolicies` use the `with_*` methods in the type returned
17715/// by [builder()][SslPolicies::builder]. The default configuration should
17716/// work for most applications. Common configuration changes include
17717///
17718/// * [with_endpoint()]: by default this client uses the global default endpoint
17719/// (`https://compute.googleapis.com`). Applications using regional
17720/// endpoints or running in restricted networks (e.g. a network configured
17721/// with [Private Google Access with VPC Service Controls]) may want to
17722/// override this default.
17723/// * [with_credentials()]: by default this client uses
17724/// [Application Default Credentials]. Applications using custom
17725/// authentication may need to override this default.
17726///
17727/// [with_endpoint()]: super::builder::ssl_policies::ClientBuilder::with_endpoint
17728/// [with_credentials()]: super::builder::ssl_policies::ClientBuilder::with_credentials
17729/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17730/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17731///
17732/// # Pooling and Cloning
17733///
17734/// `SslPolicies` holds a connection pool internally, it is advised to
17735/// create one and reuse it. You do not need to wrap `SslPolicies` in
17736/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17737/// already uses an `Arc` internally.
17738#[cfg(feature = "ssl-policies")]
17739#[cfg_attr(docsrs, doc(cfg(feature = "ssl-policies")))]
17740#[derive(Clone, Debug)]
17741pub struct SslPolicies {
17742 inner: std::sync::Arc<dyn super::stub::dynamic::SslPolicies>,
17743}
17744
17745#[cfg(feature = "ssl-policies")]
17746impl SslPolicies {
17747 /// Returns a builder for [SslPolicies].
17748 ///
17749 /// ```
17750 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17751 /// # use google_cloud_compute_v1::client::SslPolicies;
17752 /// let client = SslPolicies::builder().build().await?;
17753 /// # Ok(()) }
17754 /// ```
17755 pub fn builder() -> super::builder::ssl_policies::ClientBuilder {
17756 crate::new_client_builder(super::builder::ssl_policies::client::Factory)
17757 }
17758
17759 /// Creates a new client from the provided stub.
17760 ///
17761 /// The most common case for calling this function is in tests mocking the
17762 /// client's behavior.
17763 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17764 where
17765 T: super::stub::SslPolicies + 'static,
17766 {
17767 Self { inner: stub.into() }
17768 }
17769
17770 pub(crate) async fn new(
17771 config: gaxi::options::ClientConfig,
17772 ) -> crate::ClientBuilderResult<Self> {
17773 let inner = Self::build_inner(config).await?;
17774 Ok(Self { inner })
17775 }
17776
17777 async fn build_inner(
17778 conf: gaxi::options::ClientConfig,
17779 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SslPolicies>> {
17780 if gaxi::options::tracing_enabled(&conf) {
17781 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17782 }
17783 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17784 }
17785
17786 async fn build_transport(
17787 conf: gaxi::options::ClientConfig,
17788 ) -> crate::ClientBuilderResult<impl super::stub::SslPolicies> {
17789 super::transport::SslPolicies::new(conf).await
17790 }
17791
17792 async fn build_with_tracing(
17793 conf: gaxi::options::ClientConfig,
17794 ) -> crate::ClientBuilderResult<impl super::stub::SslPolicies> {
17795 Self::build_transport(conf)
17796 .await
17797 .map(super::tracing::SslPolicies::new)
17798 }
17799
17800 /// Retrieves the list of all SslPolicy resources, regional and global,
17801 /// available to the specified project.
17802 ///
17803 /// To prevent failure, Google recommends that you set the
17804 /// `returnPartialSuccess` parameter to `true`.
17805 pub fn aggregated_list(&self) -> super::builder::ssl_policies::AggregatedList {
17806 super::builder::ssl_policies::AggregatedList::new(self.inner.clone())
17807 }
17808
17809 /// Deletes the specified SSL policy. The SSL policy resource can be deleted
17810 /// only if it is not in use by any TargetHttpsProxy or TargetSslProxy
17811 /// resources.
17812 pub fn delete(&self) -> super::builder::ssl_policies::Delete {
17813 super::builder::ssl_policies::Delete::new(self.inner.clone())
17814 }
17815
17816 /// Lists all of the ordered rules present in a single specified policy.
17817 pub fn get(&self) -> super::builder::ssl_policies::Get {
17818 super::builder::ssl_policies::Get::new(self.inner.clone())
17819 }
17820
17821 /// Returns the specified SSL policy resource.
17822 pub fn insert(&self) -> super::builder::ssl_policies::Insert {
17823 super::builder::ssl_policies::Insert::new(self.inner.clone())
17824 }
17825
17826 /// Lists all the SSL policies that have been configured for the specified
17827 /// project.
17828 pub fn list(&self) -> super::builder::ssl_policies::List {
17829 super::builder::ssl_policies::List::new(self.inner.clone())
17830 }
17831
17832 /// Lists all features that can be specified in the SSL policy when using
17833 /// custom profile.
17834 pub fn list_available_features(&self) -> super::builder::ssl_policies::ListAvailableFeatures {
17835 super::builder::ssl_policies::ListAvailableFeatures::new(self.inner.clone())
17836 }
17837
17838 /// Patches the specified SSL policy with the data included in the request.
17839 pub fn patch(&self) -> super::builder::ssl_policies::Patch {
17840 super::builder::ssl_policies::Patch::new(self.inner.clone())
17841 }
17842
17843 /// Retrieves the specified Operations resource.
17844 pub fn get_operation(&self) -> super::builder::ssl_policies::GetOperation {
17845 super::builder::ssl_policies::GetOperation::new(self.inner.clone())
17846 }
17847}
17848
17849/// Implements a client for the Google Compute Engine API.
17850///
17851/// # Example
17852/// ```
17853/// # use google_cloud_compute_v1::client::StoragePoolTypes;
17854/// async fn sample(
17855/// ) -> anyhow::Result<()> {
17856/// let client = StoragePoolTypes::builder().build().await?;
17857/// // use `client` to make requests to the Google Compute Engine API.
17858/// Ok(())
17859/// }
17860/// ```
17861///
17862/// # Service Description
17863///
17864/// Service for the `storagePoolTypes` resource.
17865///
17866/// # Configuration
17867///
17868/// To configure `StoragePoolTypes` use the `with_*` methods in the type returned
17869/// by [builder()][StoragePoolTypes::builder]. The default configuration should
17870/// work for most applications. Common configuration changes include
17871///
17872/// * [with_endpoint()]: by default this client uses the global default endpoint
17873/// (`https://compute.googleapis.com`). Applications using regional
17874/// endpoints or running in restricted networks (e.g. a network configured
17875/// with [Private Google Access with VPC Service Controls]) may want to
17876/// override this default.
17877/// * [with_credentials()]: by default this client uses
17878/// [Application Default Credentials]. Applications using custom
17879/// authentication may need to override this default.
17880///
17881/// [with_endpoint()]: super::builder::storage_pool_types::ClientBuilder::with_endpoint
17882/// [with_credentials()]: super::builder::storage_pool_types::ClientBuilder::with_credentials
17883/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17884/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17885///
17886/// # Pooling and Cloning
17887///
17888/// `StoragePoolTypes` holds a connection pool internally, it is advised to
17889/// create one and reuse it. You do not need to wrap `StoragePoolTypes` in
17890/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17891/// already uses an `Arc` internally.
17892#[cfg(feature = "storage-pool-types")]
17893#[cfg_attr(docsrs, doc(cfg(feature = "storage-pool-types")))]
17894#[derive(Clone, Debug)]
17895pub struct StoragePoolTypes {
17896 inner: std::sync::Arc<dyn super::stub::dynamic::StoragePoolTypes>,
17897}
17898
17899#[cfg(feature = "storage-pool-types")]
17900impl StoragePoolTypes {
17901 /// Returns a builder for [StoragePoolTypes].
17902 ///
17903 /// ```
17904 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
17905 /// # use google_cloud_compute_v1::client::StoragePoolTypes;
17906 /// let client = StoragePoolTypes::builder().build().await?;
17907 /// # Ok(()) }
17908 /// ```
17909 pub fn builder() -> super::builder::storage_pool_types::ClientBuilder {
17910 crate::new_client_builder(super::builder::storage_pool_types::client::Factory)
17911 }
17912
17913 /// Creates a new client from the provided stub.
17914 ///
17915 /// The most common case for calling this function is in tests mocking the
17916 /// client's behavior.
17917 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
17918 where
17919 T: super::stub::StoragePoolTypes + 'static,
17920 {
17921 Self { inner: stub.into() }
17922 }
17923
17924 pub(crate) async fn new(
17925 config: gaxi::options::ClientConfig,
17926 ) -> crate::ClientBuilderResult<Self> {
17927 let inner = Self::build_inner(config).await?;
17928 Ok(Self { inner })
17929 }
17930
17931 async fn build_inner(
17932 conf: gaxi::options::ClientConfig,
17933 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::StoragePoolTypes>>
17934 {
17935 if gaxi::options::tracing_enabled(&conf) {
17936 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17937 }
17938 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17939 }
17940
17941 async fn build_transport(
17942 conf: gaxi::options::ClientConfig,
17943 ) -> crate::ClientBuilderResult<impl super::stub::StoragePoolTypes> {
17944 super::transport::StoragePoolTypes::new(conf).await
17945 }
17946
17947 async fn build_with_tracing(
17948 conf: gaxi::options::ClientConfig,
17949 ) -> crate::ClientBuilderResult<impl super::stub::StoragePoolTypes> {
17950 Self::build_transport(conf)
17951 .await
17952 .map(super::tracing::StoragePoolTypes::new)
17953 }
17954
17955 /// Retrieves an aggregated list of storage pool types.
17956 ///
17957 /// To prevent failure, Google recommends that you set the
17958 /// `returnPartialSuccess` parameter to `true`.
17959 pub fn aggregated_list(&self) -> super::builder::storage_pool_types::AggregatedList {
17960 super::builder::storage_pool_types::AggregatedList::new(self.inner.clone())
17961 }
17962
17963 /// Returns the specified storage pool type.
17964 pub fn get(&self) -> super::builder::storage_pool_types::Get {
17965 super::builder::storage_pool_types::Get::new(self.inner.clone())
17966 }
17967
17968 /// Retrieves a list of storage pool types available to the specified
17969 /// project.
17970 pub fn list(&self) -> super::builder::storage_pool_types::List {
17971 super::builder::storage_pool_types::List::new(self.inner.clone())
17972 }
17973}
17974
17975/// Implements a client for the Google Compute Engine API.
17976///
17977/// # Example
17978/// ```
17979/// # use google_cloud_compute_v1::client::StoragePools;
17980/// async fn sample(
17981/// ) -> anyhow::Result<()> {
17982/// let client = StoragePools::builder().build().await?;
17983/// // use `client` to make requests to the Google Compute Engine API.
17984/// Ok(())
17985/// }
17986/// ```
17987///
17988/// # Service Description
17989///
17990/// Service for the `storagePools` resource.
17991///
17992/// # Configuration
17993///
17994/// To configure `StoragePools` use the `with_*` methods in the type returned
17995/// by [builder()][StoragePools::builder]. The default configuration should
17996/// work for most applications. Common configuration changes include
17997///
17998/// * [with_endpoint()]: by default this client uses the global default endpoint
17999/// (`https://compute.googleapis.com`). Applications using regional
18000/// endpoints or running in restricted networks (e.g. a network configured
18001/// with [Private Google Access with VPC Service Controls]) may want to
18002/// override this default.
18003/// * [with_credentials()]: by default this client uses
18004/// [Application Default Credentials]. Applications using custom
18005/// authentication may need to override this default.
18006///
18007/// [with_endpoint()]: super::builder::storage_pools::ClientBuilder::with_endpoint
18008/// [with_credentials()]: super::builder::storage_pools::ClientBuilder::with_credentials
18009/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18010/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18011///
18012/// # Pooling and Cloning
18013///
18014/// `StoragePools` holds a connection pool internally, it is advised to
18015/// create one and reuse it. You do not need to wrap `StoragePools` in
18016/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18017/// already uses an `Arc` internally.
18018#[cfg(feature = "storage-pools")]
18019#[cfg_attr(docsrs, doc(cfg(feature = "storage-pools")))]
18020#[derive(Clone, Debug)]
18021pub struct StoragePools {
18022 inner: std::sync::Arc<dyn super::stub::dynamic::StoragePools>,
18023}
18024
18025#[cfg(feature = "storage-pools")]
18026impl StoragePools {
18027 /// Returns a builder for [StoragePools].
18028 ///
18029 /// ```
18030 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18031 /// # use google_cloud_compute_v1::client::StoragePools;
18032 /// let client = StoragePools::builder().build().await?;
18033 /// # Ok(()) }
18034 /// ```
18035 pub fn builder() -> super::builder::storage_pools::ClientBuilder {
18036 crate::new_client_builder(super::builder::storage_pools::client::Factory)
18037 }
18038
18039 /// Creates a new client from the provided stub.
18040 ///
18041 /// The most common case for calling this function is in tests mocking the
18042 /// client's behavior.
18043 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18044 where
18045 T: super::stub::StoragePools + 'static,
18046 {
18047 Self { inner: stub.into() }
18048 }
18049
18050 pub(crate) async fn new(
18051 config: gaxi::options::ClientConfig,
18052 ) -> crate::ClientBuilderResult<Self> {
18053 let inner = Self::build_inner(config).await?;
18054 Ok(Self { inner })
18055 }
18056
18057 async fn build_inner(
18058 conf: gaxi::options::ClientConfig,
18059 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::StoragePools>> {
18060 if gaxi::options::tracing_enabled(&conf) {
18061 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18062 }
18063 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18064 }
18065
18066 async fn build_transport(
18067 conf: gaxi::options::ClientConfig,
18068 ) -> crate::ClientBuilderResult<impl super::stub::StoragePools> {
18069 super::transport::StoragePools::new(conf).await
18070 }
18071
18072 async fn build_with_tracing(
18073 conf: gaxi::options::ClientConfig,
18074 ) -> crate::ClientBuilderResult<impl super::stub::StoragePools> {
18075 Self::build_transport(conf)
18076 .await
18077 .map(super::tracing::StoragePools::new)
18078 }
18079
18080 /// Retrieves an aggregated list of storage pools.
18081 ///
18082 /// To prevent failure, Google recommends that you set the
18083 /// `returnPartialSuccess` parameter to `true`.
18084 pub fn aggregated_list(&self) -> super::builder::storage_pools::AggregatedList {
18085 super::builder::storage_pools::AggregatedList::new(self.inner.clone())
18086 }
18087
18088 /// Deletes the specified storage pool. Deleting a storagePool
18089 /// removes its data permanently and is irreversible. However, deleting a
18090 /// storagePool does not delete any snapshots previously
18091 /// made from the storagePool. You must separately delete
18092 /// snapshots.
18093 pub fn delete(&self) -> super::builder::storage_pools::Delete {
18094 super::builder::storage_pools::Delete::new(self.inner.clone())
18095 }
18096
18097 /// Returns a specified storage pool. Gets a list of available
18098 /// storage pools by making a list() request.
18099 pub fn get(&self) -> super::builder::storage_pools::Get {
18100 super::builder::storage_pools::Get::new(self.inner.clone())
18101 }
18102
18103 /// Gets the access control policy for a resource. May be empty if no such
18104 /// policy or resource exists.
18105 pub fn get_iam_policy(&self) -> super::builder::storage_pools::GetIamPolicy {
18106 super::builder::storage_pools::GetIamPolicy::new(self.inner.clone())
18107 }
18108
18109 /// Creates a storage pool in the specified project using the data
18110 /// in the request.
18111 pub fn insert(&self) -> super::builder::storage_pools::Insert {
18112 super::builder::storage_pools::Insert::new(self.inner.clone())
18113 }
18114
18115 /// Retrieves a list of storage pools contained within
18116 /// the specified zone.
18117 pub fn list(&self) -> super::builder::storage_pools::List {
18118 super::builder::storage_pools::List::new(self.inner.clone())
18119 }
18120
18121 /// Lists the disks in a specified storage pool.
18122 pub fn list_disks(&self) -> super::builder::storage_pools::ListDisks {
18123 super::builder::storage_pools::ListDisks::new(self.inner.clone())
18124 }
18125
18126 /// Sets the access control policy on the specified resource.
18127 /// Replaces any existing policy.
18128 pub fn set_iam_policy(&self) -> super::builder::storage_pools::SetIamPolicy {
18129 super::builder::storage_pools::SetIamPolicy::new(self.inner.clone())
18130 }
18131
18132 /// Returns permissions that a caller has on the specified resource.
18133 pub fn test_iam_permissions(&self) -> super::builder::storage_pools::TestIamPermissions {
18134 super::builder::storage_pools::TestIamPermissions::new(self.inner.clone())
18135 }
18136
18137 /// Updates the specified storagePool with the data included in the request.
18138 /// The update is performed only on selected fields included as part
18139 /// of update-mask. Only the following fields can be modified:
18140 /// pool_provisioned_capacity_gb, pool_provisioned_iops and
18141 /// pool_provisioned_throughput.
18142 pub fn update(&self) -> super::builder::storage_pools::Update {
18143 super::builder::storage_pools::Update::new(self.inner.clone())
18144 }
18145
18146 /// Retrieves the specified zone-specific Operations resource.
18147 pub fn get_operation(&self) -> super::builder::storage_pools::GetOperation {
18148 super::builder::storage_pools::GetOperation::new(self.inner.clone())
18149 }
18150}
18151
18152/// Implements a client for the Google Compute Engine API.
18153///
18154/// # Example
18155/// ```
18156/// # use google_cloud_compute_v1::client::Subnetworks;
18157/// async fn sample(
18158/// ) -> anyhow::Result<()> {
18159/// let client = Subnetworks::builder().build().await?;
18160/// // use `client` to make requests to the Google Compute Engine API.
18161/// Ok(())
18162/// }
18163/// ```
18164///
18165/// # Service Description
18166///
18167/// Service for the `subnetworks` resource.
18168///
18169/// # Configuration
18170///
18171/// To configure `Subnetworks` use the `with_*` methods in the type returned
18172/// by [builder()][Subnetworks::builder]. The default configuration should
18173/// work for most applications. Common configuration changes include
18174///
18175/// * [with_endpoint()]: by default this client uses the global default endpoint
18176/// (`https://compute.googleapis.com`). Applications using regional
18177/// endpoints or running in restricted networks (e.g. a network configured
18178/// with [Private Google Access with VPC Service Controls]) may want to
18179/// override this default.
18180/// * [with_credentials()]: by default this client uses
18181/// [Application Default Credentials]. Applications using custom
18182/// authentication may need to override this default.
18183///
18184/// [with_endpoint()]: super::builder::subnetworks::ClientBuilder::with_endpoint
18185/// [with_credentials()]: super::builder::subnetworks::ClientBuilder::with_credentials
18186/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18187/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18188///
18189/// # Pooling and Cloning
18190///
18191/// `Subnetworks` holds a connection pool internally, it is advised to
18192/// create one and reuse it. You do not need to wrap `Subnetworks` in
18193/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18194/// already uses an `Arc` internally.
18195#[cfg(feature = "subnetworks")]
18196#[cfg_attr(docsrs, doc(cfg(feature = "subnetworks")))]
18197#[derive(Clone, Debug)]
18198pub struct Subnetworks {
18199 inner: std::sync::Arc<dyn super::stub::dynamic::Subnetworks>,
18200}
18201
18202#[cfg(feature = "subnetworks")]
18203impl Subnetworks {
18204 /// Returns a builder for [Subnetworks].
18205 ///
18206 /// ```
18207 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18208 /// # use google_cloud_compute_v1::client::Subnetworks;
18209 /// let client = Subnetworks::builder().build().await?;
18210 /// # Ok(()) }
18211 /// ```
18212 pub fn builder() -> super::builder::subnetworks::ClientBuilder {
18213 crate::new_client_builder(super::builder::subnetworks::client::Factory)
18214 }
18215
18216 /// Creates a new client from the provided stub.
18217 ///
18218 /// The most common case for calling this function is in tests mocking the
18219 /// client's behavior.
18220 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18221 where
18222 T: super::stub::Subnetworks + 'static,
18223 {
18224 Self { inner: stub.into() }
18225 }
18226
18227 pub(crate) async fn new(
18228 config: gaxi::options::ClientConfig,
18229 ) -> crate::ClientBuilderResult<Self> {
18230 let inner = Self::build_inner(config).await?;
18231 Ok(Self { inner })
18232 }
18233
18234 async fn build_inner(
18235 conf: gaxi::options::ClientConfig,
18236 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Subnetworks>> {
18237 if gaxi::options::tracing_enabled(&conf) {
18238 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18239 }
18240 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18241 }
18242
18243 async fn build_transport(
18244 conf: gaxi::options::ClientConfig,
18245 ) -> crate::ClientBuilderResult<impl super::stub::Subnetworks> {
18246 super::transport::Subnetworks::new(conf).await
18247 }
18248
18249 async fn build_with_tracing(
18250 conf: gaxi::options::ClientConfig,
18251 ) -> crate::ClientBuilderResult<impl super::stub::Subnetworks> {
18252 Self::build_transport(conf)
18253 .await
18254 .map(super::tracing::Subnetworks::new)
18255 }
18256
18257 /// Retrieves an aggregated list of subnetworks.
18258 ///
18259 /// To prevent failure, Google recommends that you set the
18260 /// `returnPartialSuccess` parameter to `true`.
18261 pub fn aggregated_list(&self) -> super::builder::subnetworks::AggregatedList {
18262 super::builder::subnetworks::AggregatedList::new(self.inner.clone())
18263 }
18264
18265 /// Deletes the specified subnetwork.
18266 pub fn delete(&self) -> super::builder::subnetworks::Delete {
18267 super::builder::subnetworks::Delete::new(self.inner.clone())
18268 }
18269
18270 /// Expands the IP CIDR range of the subnetwork to a specified value.
18271 pub fn expand_ip_cidr_range(&self) -> super::builder::subnetworks::ExpandIpCidrRange {
18272 super::builder::subnetworks::ExpandIpCidrRange::new(self.inner.clone())
18273 }
18274
18275 /// Returns the specified subnetwork.
18276 pub fn get(&self) -> super::builder::subnetworks::Get {
18277 super::builder::subnetworks::Get::new(self.inner.clone())
18278 }
18279
18280 /// Gets the access control policy for a resource. May be empty if no such
18281 /// policy or resource exists.
18282 pub fn get_iam_policy(&self) -> super::builder::subnetworks::GetIamPolicy {
18283 super::builder::subnetworks::GetIamPolicy::new(self.inner.clone())
18284 }
18285
18286 /// Creates a subnetwork in the specified project using the data
18287 /// included in the request.
18288 pub fn insert(&self) -> super::builder::subnetworks::Insert {
18289 super::builder::subnetworks::Insert::new(self.inner.clone())
18290 }
18291
18292 /// Retrieves a list of subnetworks available to the specified
18293 /// project.
18294 pub fn list(&self) -> super::builder::subnetworks::List {
18295 super::builder::subnetworks::List::new(self.inner.clone())
18296 }
18297
18298 /// Retrieves an aggregated list of all usable subnetworks in the project.
18299 pub fn list_usable(&self) -> super::builder::subnetworks::ListUsable {
18300 super::builder::subnetworks::ListUsable::new(self.inner.clone())
18301 }
18302
18303 /// Patches the specified subnetwork with the data included in the request.
18304 /// Only certain fields can be updated with a patch request
18305 /// as indicated in the field descriptions.
18306 /// You must specify the current fingerprint of the
18307 /// subnetwork resource being patched.
18308 pub fn patch(&self) -> super::builder::subnetworks::Patch {
18309 super::builder::subnetworks::Patch::new(self.inner.clone())
18310 }
18311
18312 /// Sets the access control policy on the specified resource.
18313 /// Replaces any existing policy.
18314 pub fn set_iam_policy(&self) -> super::builder::subnetworks::SetIamPolicy {
18315 super::builder::subnetworks::SetIamPolicy::new(self.inner.clone())
18316 }
18317
18318 /// Set whether VMs in this subnet can access Google services without assigning
18319 /// external IP addresses through Private Google Access.
18320 pub fn set_private_ip_google_access(
18321 &self,
18322 ) -> super::builder::subnetworks::SetPrivateIpGoogleAccess {
18323 super::builder::subnetworks::SetPrivateIpGoogleAccess::new(self.inner.clone())
18324 }
18325
18326 /// Returns permissions that a caller has on the specified resource.
18327 pub fn test_iam_permissions(&self) -> super::builder::subnetworks::TestIamPermissions {
18328 super::builder::subnetworks::TestIamPermissions::new(self.inner.clone())
18329 }
18330
18331 /// Retrieves the specified region-specific Operations resource.
18332 pub fn get_operation(&self) -> super::builder::subnetworks::GetOperation {
18333 super::builder::subnetworks::GetOperation::new(self.inner.clone())
18334 }
18335}
18336
18337/// Implements a client for the Google Compute Engine API.
18338///
18339/// # Example
18340/// ```
18341/// # use google_cloud_compute_v1::client::TargetGrpcProxies;
18342/// async fn sample(
18343/// ) -> anyhow::Result<()> {
18344/// let client = TargetGrpcProxies::builder().build().await?;
18345/// // use `client` to make requests to the Google Compute Engine API.
18346/// Ok(())
18347/// }
18348/// ```
18349///
18350/// # Service Description
18351///
18352/// Service for the `targetGrpcProxies` resource.
18353///
18354/// # Configuration
18355///
18356/// To configure `TargetGrpcProxies` use the `with_*` methods in the type returned
18357/// by [builder()][TargetGrpcProxies::builder]. The default configuration should
18358/// work for most applications. Common configuration changes include
18359///
18360/// * [with_endpoint()]: by default this client uses the global default endpoint
18361/// (`https://compute.googleapis.com`). Applications using regional
18362/// endpoints or running in restricted networks (e.g. a network configured
18363/// with [Private Google Access with VPC Service Controls]) may want to
18364/// override this default.
18365/// * [with_credentials()]: by default this client uses
18366/// [Application Default Credentials]. Applications using custom
18367/// authentication may need to override this default.
18368///
18369/// [with_endpoint()]: super::builder::target_grpc_proxies::ClientBuilder::with_endpoint
18370/// [with_credentials()]: super::builder::target_grpc_proxies::ClientBuilder::with_credentials
18371/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18372/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18373///
18374/// # Pooling and Cloning
18375///
18376/// `TargetGrpcProxies` holds a connection pool internally, it is advised to
18377/// create one and reuse it. You do not need to wrap `TargetGrpcProxies` in
18378/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18379/// already uses an `Arc` internally.
18380#[cfg(feature = "target-grpc-proxies")]
18381#[cfg_attr(docsrs, doc(cfg(feature = "target-grpc-proxies")))]
18382#[derive(Clone, Debug)]
18383pub struct TargetGrpcProxies {
18384 inner: std::sync::Arc<dyn super::stub::dynamic::TargetGrpcProxies>,
18385}
18386
18387#[cfg(feature = "target-grpc-proxies")]
18388impl TargetGrpcProxies {
18389 /// Returns a builder for [TargetGrpcProxies].
18390 ///
18391 /// ```
18392 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18393 /// # use google_cloud_compute_v1::client::TargetGrpcProxies;
18394 /// let client = TargetGrpcProxies::builder().build().await?;
18395 /// # Ok(()) }
18396 /// ```
18397 pub fn builder() -> super::builder::target_grpc_proxies::ClientBuilder {
18398 crate::new_client_builder(super::builder::target_grpc_proxies::client::Factory)
18399 }
18400
18401 /// Creates a new client from the provided stub.
18402 ///
18403 /// The most common case for calling this function is in tests mocking the
18404 /// client's behavior.
18405 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18406 where
18407 T: super::stub::TargetGrpcProxies + 'static,
18408 {
18409 Self { inner: stub.into() }
18410 }
18411
18412 pub(crate) async fn new(
18413 config: gaxi::options::ClientConfig,
18414 ) -> crate::ClientBuilderResult<Self> {
18415 let inner = Self::build_inner(config).await?;
18416 Ok(Self { inner })
18417 }
18418
18419 async fn build_inner(
18420 conf: gaxi::options::ClientConfig,
18421 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetGrpcProxies>>
18422 {
18423 if gaxi::options::tracing_enabled(&conf) {
18424 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18425 }
18426 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18427 }
18428
18429 async fn build_transport(
18430 conf: gaxi::options::ClientConfig,
18431 ) -> crate::ClientBuilderResult<impl super::stub::TargetGrpcProxies> {
18432 super::transport::TargetGrpcProxies::new(conf).await
18433 }
18434
18435 async fn build_with_tracing(
18436 conf: gaxi::options::ClientConfig,
18437 ) -> crate::ClientBuilderResult<impl super::stub::TargetGrpcProxies> {
18438 Self::build_transport(conf)
18439 .await
18440 .map(super::tracing::TargetGrpcProxies::new)
18441 }
18442
18443 /// Deletes the specified TargetGrpcProxy in the given scope
18444 pub fn delete(&self) -> super::builder::target_grpc_proxies::Delete {
18445 super::builder::target_grpc_proxies::Delete::new(self.inner.clone())
18446 }
18447
18448 /// Returns the specified TargetGrpcProxy resource in the given scope.
18449 pub fn get(&self) -> super::builder::target_grpc_proxies::Get {
18450 super::builder::target_grpc_proxies::Get::new(self.inner.clone())
18451 }
18452
18453 /// Creates a TargetGrpcProxy in the specified project in the given scope
18454 /// using the parameters that are included in the request.
18455 pub fn insert(&self) -> super::builder::target_grpc_proxies::Insert {
18456 super::builder::target_grpc_proxies::Insert::new(self.inner.clone())
18457 }
18458
18459 /// Lists the TargetGrpcProxies for a project in the given scope.
18460 pub fn list(&self) -> super::builder::target_grpc_proxies::List {
18461 super::builder::target_grpc_proxies::List::new(self.inner.clone())
18462 }
18463
18464 /// Patches the specified TargetGrpcProxy resource with the data included in
18465 /// the request. This method supports PATCH
18466 /// semantics and usesJSON merge
18467 /// patch format and processing rules.
18468 pub fn patch(&self) -> super::builder::target_grpc_proxies::Patch {
18469 super::builder::target_grpc_proxies::Patch::new(self.inner.clone())
18470 }
18471
18472 /// Retrieves the specified Operations resource.
18473 pub fn get_operation(&self) -> super::builder::target_grpc_proxies::GetOperation {
18474 super::builder::target_grpc_proxies::GetOperation::new(self.inner.clone())
18475 }
18476}
18477
18478/// Implements a client for the Google Compute Engine API.
18479///
18480/// # Example
18481/// ```
18482/// # use google_cloud_compute_v1::client::TargetHttpProxies;
18483/// async fn sample(
18484/// ) -> anyhow::Result<()> {
18485/// let client = TargetHttpProxies::builder().build().await?;
18486/// // use `client` to make requests to the Google Compute Engine API.
18487/// Ok(())
18488/// }
18489/// ```
18490///
18491/// # Service Description
18492///
18493/// Service for the `targetHttpProxies` resource.
18494///
18495/// # Configuration
18496///
18497/// To configure `TargetHttpProxies` use the `with_*` methods in the type returned
18498/// by [builder()][TargetHttpProxies::builder]. The default configuration should
18499/// work for most applications. Common configuration changes include
18500///
18501/// * [with_endpoint()]: by default this client uses the global default endpoint
18502/// (`https://compute.googleapis.com`). Applications using regional
18503/// endpoints or running in restricted networks (e.g. a network configured
18504/// with [Private Google Access with VPC Service Controls]) may want to
18505/// override this default.
18506/// * [with_credentials()]: by default this client uses
18507/// [Application Default Credentials]. Applications using custom
18508/// authentication may need to override this default.
18509///
18510/// [with_endpoint()]: super::builder::target_http_proxies::ClientBuilder::with_endpoint
18511/// [with_credentials()]: super::builder::target_http_proxies::ClientBuilder::with_credentials
18512/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18513/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18514///
18515/// # Pooling and Cloning
18516///
18517/// `TargetHttpProxies` holds a connection pool internally, it is advised to
18518/// create one and reuse it. You do not need to wrap `TargetHttpProxies` in
18519/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18520/// already uses an `Arc` internally.
18521#[cfg(feature = "target-http-proxies")]
18522#[cfg_attr(docsrs, doc(cfg(feature = "target-http-proxies")))]
18523#[derive(Clone, Debug)]
18524pub struct TargetHttpProxies {
18525 inner: std::sync::Arc<dyn super::stub::dynamic::TargetHttpProxies>,
18526}
18527
18528#[cfg(feature = "target-http-proxies")]
18529impl TargetHttpProxies {
18530 /// Returns a builder for [TargetHttpProxies].
18531 ///
18532 /// ```
18533 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18534 /// # use google_cloud_compute_v1::client::TargetHttpProxies;
18535 /// let client = TargetHttpProxies::builder().build().await?;
18536 /// # Ok(()) }
18537 /// ```
18538 pub fn builder() -> super::builder::target_http_proxies::ClientBuilder {
18539 crate::new_client_builder(super::builder::target_http_proxies::client::Factory)
18540 }
18541
18542 /// Creates a new client from the provided stub.
18543 ///
18544 /// The most common case for calling this function is in tests mocking the
18545 /// client's behavior.
18546 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18547 where
18548 T: super::stub::TargetHttpProxies + 'static,
18549 {
18550 Self { inner: stub.into() }
18551 }
18552
18553 pub(crate) async fn new(
18554 config: gaxi::options::ClientConfig,
18555 ) -> crate::ClientBuilderResult<Self> {
18556 let inner = Self::build_inner(config).await?;
18557 Ok(Self { inner })
18558 }
18559
18560 async fn build_inner(
18561 conf: gaxi::options::ClientConfig,
18562 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetHttpProxies>>
18563 {
18564 if gaxi::options::tracing_enabled(&conf) {
18565 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18566 }
18567 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18568 }
18569
18570 async fn build_transport(
18571 conf: gaxi::options::ClientConfig,
18572 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpProxies> {
18573 super::transport::TargetHttpProxies::new(conf).await
18574 }
18575
18576 async fn build_with_tracing(
18577 conf: gaxi::options::ClientConfig,
18578 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpProxies> {
18579 Self::build_transport(conf)
18580 .await
18581 .map(super::tracing::TargetHttpProxies::new)
18582 }
18583
18584 /// Retrieves the list of all TargetHttpProxy resources, regional and global,
18585 /// available to the specified project.
18586 ///
18587 /// To prevent failure, Google recommends that you set the
18588 /// `returnPartialSuccess` parameter to `true`.
18589 pub fn aggregated_list(&self) -> super::builder::target_http_proxies::AggregatedList {
18590 super::builder::target_http_proxies::AggregatedList::new(self.inner.clone())
18591 }
18592
18593 /// Deletes the specified TargetHttpProxy resource.
18594 pub fn delete(&self) -> super::builder::target_http_proxies::Delete {
18595 super::builder::target_http_proxies::Delete::new(self.inner.clone())
18596 }
18597
18598 /// Returns the specified TargetHttpProxy resource.
18599 pub fn get(&self) -> super::builder::target_http_proxies::Get {
18600 super::builder::target_http_proxies::Get::new(self.inner.clone())
18601 }
18602
18603 /// Creates a TargetHttpProxy resource in the specified
18604 /// project using the data included in the request.
18605 pub fn insert(&self) -> super::builder::target_http_proxies::Insert {
18606 super::builder::target_http_proxies::Insert::new(self.inner.clone())
18607 }
18608
18609 /// Retrieves the list of TargetHttpProxy resources available
18610 /// to the specified project.
18611 pub fn list(&self) -> super::builder::target_http_proxies::List {
18612 super::builder::target_http_proxies::List::new(self.inner.clone())
18613 }
18614
18615 /// Patches the specified TargetHttpProxy resource with the data included in
18616 /// the request. This method supports PATCH
18617 /// semantics and usesJSON merge
18618 /// patch format and processing rules.
18619 pub fn patch(&self) -> super::builder::target_http_proxies::Patch {
18620 super::builder::target_http_proxies::Patch::new(self.inner.clone())
18621 }
18622
18623 /// Changes the URL map for TargetHttpProxy.
18624 pub fn set_url_map(&self) -> super::builder::target_http_proxies::SetUrlMap {
18625 super::builder::target_http_proxies::SetUrlMap::new(self.inner.clone())
18626 }
18627
18628 /// Retrieves the specified Operations resource.
18629 pub fn get_operation(&self) -> super::builder::target_http_proxies::GetOperation {
18630 super::builder::target_http_proxies::GetOperation::new(self.inner.clone())
18631 }
18632}
18633
18634/// Implements a client for the Google Compute Engine API.
18635///
18636/// # Example
18637/// ```
18638/// # use google_cloud_compute_v1::client::TargetHttpsProxies;
18639/// async fn sample(
18640/// ) -> anyhow::Result<()> {
18641/// let client = TargetHttpsProxies::builder().build().await?;
18642/// // use `client` to make requests to the Google Compute Engine API.
18643/// Ok(())
18644/// }
18645/// ```
18646///
18647/// # Service Description
18648///
18649/// Service for the `targetHttpsProxies` resource.
18650///
18651/// # Configuration
18652///
18653/// To configure `TargetHttpsProxies` use the `with_*` methods in the type returned
18654/// by [builder()][TargetHttpsProxies::builder]. The default configuration should
18655/// work for most applications. Common configuration changes include
18656///
18657/// * [with_endpoint()]: by default this client uses the global default endpoint
18658/// (`https://compute.googleapis.com`). Applications using regional
18659/// endpoints or running in restricted networks (e.g. a network configured
18660/// with [Private Google Access with VPC Service Controls]) may want to
18661/// override this default.
18662/// * [with_credentials()]: by default this client uses
18663/// [Application Default Credentials]. Applications using custom
18664/// authentication may need to override this default.
18665///
18666/// [with_endpoint()]: super::builder::target_https_proxies::ClientBuilder::with_endpoint
18667/// [with_credentials()]: super::builder::target_https_proxies::ClientBuilder::with_credentials
18668/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18669/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18670///
18671/// # Pooling and Cloning
18672///
18673/// `TargetHttpsProxies` holds a connection pool internally, it is advised to
18674/// create one and reuse it. You do not need to wrap `TargetHttpsProxies` in
18675/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18676/// already uses an `Arc` internally.
18677#[cfg(feature = "target-https-proxies")]
18678#[cfg_attr(docsrs, doc(cfg(feature = "target-https-proxies")))]
18679#[derive(Clone, Debug)]
18680pub struct TargetHttpsProxies {
18681 inner: std::sync::Arc<dyn super::stub::dynamic::TargetHttpsProxies>,
18682}
18683
18684#[cfg(feature = "target-https-proxies")]
18685impl TargetHttpsProxies {
18686 /// Returns a builder for [TargetHttpsProxies].
18687 ///
18688 /// ```
18689 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18690 /// # use google_cloud_compute_v1::client::TargetHttpsProxies;
18691 /// let client = TargetHttpsProxies::builder().build().await?;
18692 /// # Ok(()) }
18693 /// ```
18694 pub fn builder() -> super::builder::target_https_proxies::ClientBuilder {
18695 crate::new_client_builder(super::builder::target_https_proxies::client::Factory)
18696 }
18697
18698 /// Creates a new client from the provided stub.
18699 ///
18700 /// The most common case for calling this function is in tests mocking the
18701 /// client's behavior.
18702 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18703 where
18704 T: super::stub::TargetHttpsProxies + 'static,
18705 {
18706 Self { inner: stub.into() }
18707 }
18708
18709 pub(crate) async fn new(
18710 config: gaxi::options::ClientConfig,
18711 ) -> crate::ClientBuilderResult<Self> {
18712 let inner = Self::build_inner(config).await?;
18713 Ok(Self { inner })
18714 }
18715
18716 async fn build_inner(
18717 conf: gaxi::options::ClientConfig,
18718 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetHttpsProxies>>
18719 {
18720 if gaxi::options::tracing_enabled(&conf) {
18721 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18722 }
18723 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18724 }
18725
18726 async fn build_transport(
18727 conf: gaxi::options::ClientConfig,
18728 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpsProxies> {
18729 super::transport::TargetHttpsProxies::new(conf).await
18730 }
18731
18732 async fn build_with_tracing(
18733 conf: gaxi::options::ClientConfig,
18734 ) -> crate::ClientBuilderResult<impl super::stub::TargetHttpsProxies> {
18735 Self::build_transport(conf)
18736 .await
18737 .map(super::tracing::TargetHttpsProxies::new)
18738 }
18739
18740 /// Retrieves the list of all TargetHttpsProxy resources, regional and global,
18741 /// available to the specified project.
18742 ///
18743 /// To prevent failure, Google recommends that you set the
18744 /// `returnPartialSuccess` parameter to `true`.
18745 pub fn aggregated_list(&self) -> super::builder::target_https_proxies::AggregatedList {
18746 super::builder::target_https_proxies::AggregatedList::new(self.inner.clone())
18747 }
18748
18749 /// Deletes the specified TargetHttpsProxy resource.
18750 pub fn delete(&self) -> super::builder::target_https_proxies::Delete {
18751 super::builder::target_https_proxies::Delete::new(self.inner.clone())
18752 }
18753
18754 /// Returns the specified TargetHttpsProxy resource.
18755 pub fn get(&self) -> super::builder::target_https_proxies::Get {
18756 super::builder::target_https_proxies::Get::new(self.inner.clone())
18757 }
18758
18759 /// Creates a TargetHttpsProxy resource in the specified
18760 /// project using the data included in the request.
18761 pub fn insert(&self) -> super::builder::target_https_proxies::Insert {
18762 super::builder::target_https_proxies::Insert::new(self.inner.clone())
18763 }
18764
18765 /// Retrieves the list of TargetHttpsProxy resources
18766 /// available to the specified project.
18767 pub fn list(&self) -> super::builder::target_https_proxies::List {
18768 super::builder::target_https_proxies::List::new(self.inner.clone())
18769 }
18770
18771 /// Patches the specified TargetHttpsProxy resource with the data included in
18772 /// the request. This method supports PATCH
18773 /// semantics and usesJSON merge
18774 /// patch format and processing rules.
18775 pub fn patch(&self) -> super::builder::target_https_proxies::Patch {
18776 super::builder::target_https_proxies::Patch::new(self.inner.clone())
18777 }
18778
18779 /// Changes the Certificate Map for TargetHttpsProxy.
18780 pub fn set_certificate_map(&self) -> super::builder::target_https_proxies::SetCertificateMap {
18781 super::builder::target_https_proxies::SetCertificateMap::new(self.inner.clone())
18782 }
18783
18784 /// Sets the QUIC override policy for TargetHttpsProxy.
18785 pub fn set_quic_override(&self) -> super::builder::target_https_proxies::SetQuicOverride {
18786 super::builder::target_https_proxies::SetQuicOverride::new(self.inner.clone())
18787 }
18788
18789 /// Replaces SslCertificates for TargetHttpsProxy.
18790 pub fn set_ssl_certificates(&self) -> super::builder::target_https_proxies::SetSslCertificates {
18791 super::builder::target_https_proxies::SetSslCertificates::new(self.inner.clone())
18792 }
18793
18794 /// Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the
18795 /// server-side support for SSL features. This affects connections between
18796 /// clients and the HTTPS proxy load balancer. They do not affect the
18797 /// connection between the load balancer and the backends.
18798 pub fn set_ssl_policy(&self) -> super::builder::target_https_proxies::SetSslPolicy {
18799 super::builder::target_https_proxies::SetSslPolicy::new(self.inner.clone())
18800 }
18801
18802 /// Changes the URL map for TargetHttpsProxy.
18803 pub fn set_url_map(&self) -> super::builder::target_https_proxies::SetUrlMap {
18804 super::builder::target_https_proxies::SetUrlMap::new(self.inner.clone())
18805 }
18806
18807 /// Retrieves the specified Operations resource.
18808 pub fn get_operation(&self) -> super::builder::target_https_proxies::GetOperation {
18809 super::builder::target_https_proxies::GetOperation::new(self.inner.clone())
18810 }
18811}
18812
18813/// Implements a client for the Google Compute Engine API.
18814///
18815/// # Example
18816/// ```
18817/// # use google_cloud_compute_v1::client::TargetInstances;
18818/// async fn sample(
18819/// ) -> anyhow::Result<()> {
18820/// let client = TargetInstances::builder().build().await?;
18821/// // use `client` to make requests to the Google Compute Engine API.
18822/// Ok(())
18823/// }
18824/// ```
18825///
18826/// # Service Description
18827///
18828/// Service for the `targetInstances` resource.
18829///
18830/// # Configuration
18831///
18832/// To configure `TargetInstances` use the `with_*` methods in the type returned
18833/// by [builder()][TargetInstances::builder]. The default configuration should
18834/// work for most applications. Common configuration changes include
18835///
18836/// * [with_endpoint()]: by default this client uses the global default endpoint
18837/// (`https://compute.googleapis.com`). Applications using regional
18838/// endpoints or running in restricted networks (e.g. a network configured
18839/// with [Private Google Access with VPC Service Controls]) may want to
18840/// override this default.
18841/// * [with_credentials()]: by default this client uses
18842/// [Application Default Credentials]. Applications using custom
18843/// authentication may need to override this default.
18844///
18845/// [with_endpoint()]: super::builder::target_instances::ClientBuilder::with_endpoint
18846/// [with_credentials()]: super::builder::target_instances::ClientBuilder::with_credentials
18847/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18848/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18849///
18850/// # Pooling and Cloning
18851///
18852/// `TargetInstances` holds a connection pool internally, it is advised to
18853/// create one and reuse it. You do not need to wrap `TargetInstances` in
18854/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18855/// already uses an `Arc` internally.
18856#[cfg(feature = "target-instances")]
18857#[cfg_attr(docsrs, doc(cfg(feature = "target-instances")))]
18858#[derive(Clone, Debug)]
18859pub struct TargetInstances {
18860 inner: std::sync::Arc<dyn super::stub::dynamic::TargetInstances>,
18861}
18862
18863#[cfg(feature = "target-instances")]
18864impl TargetInstances {
18865 /// Returns a builder for [TargetInstances].
18866 ///
18867 /// ```
18868 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
18869 /// # use google_cloud_compute_v1::client::TargetInstances;
18870 /// let client = TargetInstances::builder().build().await?;
18871 /// # Ok(()) }
18872 /// ```
18873 pub fn builder() -> super::builder::target_instances::ClientBuilder {
18874 crate::new_client_builder(super::builder::target_instances::client::Factory)
18875 }
18876
18877 /// Creates a new client from the provided stub.
18878 ///
18879 /// The most common case for calling this function is in tests mocking the
18880 /// client's behavior.
18881 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
18882 where
18883 T: super::stub::TargetInstances + 'static,
18884 {
18885 Self { inner: stub.into() }
18886 }
18887
18888 pub(crate) async fn new(
18889 config: gaxi::options::ClientConfig,
18890 ) -> crate::ClientBuilderResult<Self> {
18891 let inner = Self::build_inner(config).await?;
18892 Ok(Self { inner })
18893 }
18894
18895 async fn build_inner(
18896 conf: gaxi::options::ClientConfig,
18897 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetInstances>> {
18898 if gaxi::options::tracing_enabled(&conf) {
18899 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18900 }
18901 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18902 }
18903
18904 async fn build_transport(
18905 conf: gaxi::options::ClientConfig,
18906 ) -> crate::ClientBuilderResult<impl super::stub::TargetInstances> {
18907 super::transport::TargetInstances::new(conf).await
18908 }
18909
18910 async fn build_with_tracing(
18911 conf: gaxi::options::ClientConfig,
18912 ) -> crate::ClientBuilderResult<impl super::stub::TargetInstances> {
18913 Self::build_transport(conf)
18914 .await
18915 .map(super::tracing::TargetInstances::new)
18916 }
18917
18918 /// Retrieves an aggregated list of target instances.
18919 ///
18920 /// To prevent failure, Google recommends that you set the
18921 /// `returnPartialSuccess` parameter to `true`.
18922 pub fn aggregated_list(&self) -> super::builder::target_instances::AggregatedList {
18923 super::builder::target_instances::AggregatedList::new(self.inner.clone())
18924 }
18925
18926 /// Deletes the specified TargetInstance resource.
18927 pub fn delete(&self) -> super::builder::target_instances::Delete {
18928 super::builder::target_instances::Delete::new(self.inner.clone())
18929 }
18930
18931 /// Returns the specified TargetInstance resource.
18932 pub fn get(&self) -> super::builder::target_instances::Get {
18933 super::builder::target_instances::Get::new(self.inner.clone())
18934 }
18935
18936 /// Creates a TargetInstance resource in the specified project and zone using
18937 /// the data included in the request.
18938 pub fn insert(&self) -> super::builder::target_instances::Insert {
18939 super::builder::target_instances::Insert::new(self.inner.clone())
18940 }
18941
18942 /// Retrieves a list of TargetInstance resources available to the specified
18943 /// project and zone.
18944 pub fn list(&self) -> super::builder::target_instances::List {
18945 super::builder::target_instances::List::new(self.inner.clone())
18946 }
18947
18948 /// Sets the Google Cloud Armor security policy for the specified target
18949 /// instance. For more information, seeGoogle
18950 /// Cloud Armor Overview
18951 pub fn set_security_policy(&self) -> super::builder::target_instances::SetSecurityPolicy {
18952 super::builder::target_instances::SetSecurityPolicy::new(self.inner.clone())
18953 }
18954
18955 /// Returns permissions that a caller has on the specified resource.
18956 pub fn test_iam_permissions(&self) -> super::builder::target_instances::TestIamPermissions {
18957 super::builder::target_instances::TestIamPermissions::new(self.inner.clone())
18958 }
18959
18960 /// Retrieves the specified zone-specific Operations resource.
18961 pub fn get_operation(&self) -> super::builder::target_instances::GetOperation {
18962 super::builder::target_instances::GetOperation::new(self.inner.clone())
18963 }
18964}
18965
18966/// Implements a client for the Google Compute Engine API.
18967///
18968/// # Example
18969/// ```
18970/// # use google_cloud_compute_v1::client::TargetPools;
18971/// async fn sample(
18972/// ) -> anyhow::Result<()> {
18973/// let client = TargetPools::builder().build().await?;
18974/// // use `client` to make requests to the Google Compute Engine API.
18975/// Ok(())
18976/// }
18977/// ```
18978///
18979/// # Service Description
18980///
18981/// Service for the `targetPools` resource.
18982///
18983/// # Configuration
18984///
18985/// To configure `TargetPools` use the `with_*` methods in the type returned
18986/// by [builder()][TargetPools::builder]. The default configuration should
18987/// work for most applications. Common configuration changes include
18988///
18989/// * [with_endpoint()]: by default this client uses the global default endpoint
18990/// (`https://compute.googleapis.com`). Applications using regional
18991/// endpoints or running in restricted networks (e.g. a network configured
18992/// with [Private Google Access with VPC Service Controls]) may want to
18993/// override this default.
18994/// * [with_credentials()]: by default this client uses
18995/// [Application Default Credentials]. Applications using custom
18996/// authentication may need to override this default.
18997///
18998/// [with_endpoint()]: super::builder::target_pools::ClientBuilder::with_endpoint
18999/// [with_credentials()]: super::builder::target_pools::ClientBuilder::with_credentials
19000/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19001/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19002///
19003/// # Pooling and Cloning
19004///
19005/// `TargetPools` holds a connection pool internally, it is advised to
19006/// create one and reuse it. You do not need to wrap `TargetPools` in
19007/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19008/// already uses an `Arc` internally.
19009#[cfg(feature = "target-pools")]
19010#[cfg_attr(docsrs, doc(cfg(feature = "target-pools")))]
19011#[derive(Clone, Debug)]
19012pub struct TargetPools {
19013 inner: std::sync::Arc<dyn super::stub::dynamic::TargetPools>,
19014}
19015
19016#[cfg(feature = "target-pools")]
19017impl TargetPools {
19018 /// Returns a builder for [TargetPools].
19019 ///
19020 /// ```
19021 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19022 /// # use google_cloud_compute_v1::client::TargetPools;
19023 /// let client = TargetPools::builder().build().await?;
19024 /// # Ok(()) }
19025 /// ```
19026 pub fn builder() -> super::builder::target_pools::ClientBuilder {
19027 crate::new_client_builder(super::builder::target_pools::client::Factory)
19028 }
19029
19030 /// Creates a new client from the provided stub.
19031 ///
19032 /// The most common case for calling this function is in tests mocking the
19033 /// client's behavior.
19034 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19035 where
19036 T: super::stub::TargetPools + 'static,
19037 {
19038 Self { inner: stub.into() }
19039 }
19040
19041 pub(crate) async fn new(
19042 config: gaxi::options::ClientConfig,
19043 ) -> crate::ClientBuilderResult<Self> {
19044 let inner = Self::build_inner(config).await?;
19045 Ok(Self { inner })
19046 }
19047
19048 async fn build_inner(
19049 conf: gaxi::options::ClientConfig,
19050 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetPools>> {
19051 if gaxi::options::tracing_enabled(&conf) {
19052 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19053 }
19054 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19055 }
19056
19057 async fn build_transport(
19058 conf: gaxi::options::ClientConfig,
19059 ) -> crate::ClientBuilderResult<impl super::stub::TargetPools> {
19060 super::transport::TargetPools::new(conf).await
19061 }
19062
19063 async fn build_with_tracing(
19064 conf: gaxi::options::ClientConfig,
19065 ) -> crate::ClientBuilderResult<impl super::stub::TargetPools> {
19066 Self::build_transport(conf)
19067 .await
19068 .map(super::tracing::TargetPools::new)
19069 }
19070
19071 /// Adds health check URLs to a target pool.
19072 pub fn add_health_check(&self) -> super::builder::target_pools::AddHealthCheck {
19073 super::builder::target_pools::AddHealthCheck::new(self.inner.clone())
19074 }
19075
19076 /// Adds an instance to a target pool.
19077 pub fn add_instance(&self) -> super::builder::target_pools::AddInstance {
19078 super::builder::target_pools::AddInstance::new(self.inner.clone())
19079 }
19080
19081 /// Retrieves an aggregated list of target pools.
19082 ///
19083 /// To prevent failure, Google recommends that you set the
19084 /// `returnPartialSuccess` parameter to `true`.
19085 pub fn aggregated_list(&self) -> super::builder::target_pools::AggregatedList {
19086 super::builder::target_pools::AggregatedList::new(self.inner.clone())
19087 }
19088
19089 /// Deletes the specified target pool.
19090 pub fn delete(&self) -> super::builder::target_pools::Delete {
19091 super::builder::target_pools::Delete::new(self.inner.clone())
19092 }
19093
19094 /// Returns the specified target pool.
19095 pub fn get(&self) -> super::builder::target_pools::Get {
19096 super::builder::target_pools::Get::new(self.inner.clone())
19097 }
19098
19099 /// Gets the most recent health check results for each IP for the
19100 /// instance that is referenced by the given target pool.
19101 pub fn get_health(&self) -> super::builder::target_pools::GetHealth {
19102 super::builder::target_pools::GetHealth::new(self.inner.clone())
19103 }
19104
19105 /// Creates a target pool in the specified project and region using
19106 /// the data included in the request.
19107 pub fn insert(&self) -> super::builder::target_pools::Insert {
19108 super::builder::target_pools::Insert::new(self.inner.clone())
19109 }
19110
19111 /// Retrieves a list of target pools available to the specified
19112 /// project and region.
19113 pub fn list(&self) -> super::builder::target_pools::List {
19114 super::builder::target_pools::List::new(self.inner.clone())
19115 }
19116
19117 /// Removes health check URL from a target pool.
19118 pub fn remove_health_check(&self) -> super::builder::target_pools::RemoveHealthCheck {
19119 super::builder::target_pools::RemoveHealthCheck::new(self.inner.clone())
19120 }
19121
19122 /// Removes instance URL from a target pool.
19123 pub fn remove_instance(&self) -> super::builder::target_pools::RemoveInstance {
19124 super::builder::target_pools::RemoveInstance::new(self.inner.clone())
19125 }
19126
19127 /// Changes a backup target pool's configurations.
19128 pub fn set_backup(&self) -> super::builder::target_pools::SetBackup {
19129 super::builder::target_pools::SetBackup::new(self.inner.clone())
19130 }
19131
19132 /// Sets the Google Cloud Armor security policy for the specified target pool.
19133 /// For more information, seeGoogle
19134 /// Cloud Armor Overview
19135 pub fn set_security_policy(&self) -> super::builder::target_pools::SetSecurityPolicy {
19136 super::builder::target_pools::SetSecurityPolicy::new(self.inner.clone())
19137 }
19138
19139 /// Returns permissions that a caller has on the specified resource.
19140 pub fn test_iam_permissions(&self) -> super::builder::target_pools::TestIamPermissions {
19141 super::builder::target_pools::TestIamPermissions::new(self.inner.clone())
19142 }
19143
19144 /// Retrieves the specified region-specific Operations resource.
19145 pub fn get_operation(&self) -> super::builder::target_pools::GetOperation {
19146 super::builder::target_pools::GetOperation::new(self.inner.clone())
19147 }
19148}
19149
19150/// Implements a client for the Google Compute Engine API.
19151///
19152/// # Example
19153/// ```
19154/// # use google_cloud_compute_v1::client::TargetSslProxies;
19155/// async fn sample(
19156/// ) -> anyhow::Result<()> {
19157/// let client = TargetSslProxies::builder().build().await?;
19158/// // use `client` to make requests to the Google Compute Engine API.
19159/// Ok(())
19160/// }
19161/// ```
19162///
19163/// # Service Description
19164///
19165/// Service for the `targetSslProxies` resource.
19166///
19167/// # Configuration
19168///
19169/// To configure `TargetSslProxies` use the `with_*` methods in the type returned
19170/// by [builder()][TargetSslProxies::builder]. The default configuration should
19171/// work for most applications. Common configuration changes include
19172///
19173/// * [with_endpoint()]: by default this client uses the global default endpoint
19174/// (`https://compute.googleapis.com`). Applications using regional
19175/// endpoints or running in restricted networks (e.g. a network configured
19176/// with [Private Google Access with VPC Service Controls]) may want to
19177/// override this default.
19178/// * [with_credentials()]: by default this client uses
19179/// [Application Default Credentials]. Applications using custom
19180/// authentication may need to override this default.
19181///
19182/// [with_endpoint()]: super::builder::target_ssl_proxies::ClientBuilder::with_endpoint
19183/// [with_credentials()]: super::builder::target_ssl_proxies::ClientBuilder::with_credentials
19184/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19185/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19186///
19187/// # Pooling and Cloning
19188///
19189/// `TargetSslProxies` holds a connection pool internally, it is advised to
19190/// create one and reuse it. You do not need to wrap `TargetSslProxies` in
19191/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19192/// already uses an `Arc` internally.
19193#[cfg(feature = "target-ssl-proxies")]
19194#[cfg_attr(docsrs, doc(cfg(feature = "target-ssl-proxies")))]
19195#[derive(Clone, Debug)]
19196pub struct TargetSslProxies {
19197 inner: std::sync::Arc<dyn super::stub::dynamic::TargetSslProxies>,
19198}
19199
19200#[cfg(feature = "target-ssl-proxies")]
19201impl TargetSslProxies {
19202 /// Returns a builder for [TargetSslProxies].
19203 ///
19204 /// ```
19205 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19206 /// # use google_cloud_compute_v1::client::TargetSslProxies;
19207 /// let client = TargetSslProxies::builder().build().await?;
19208 /// # Ok(()) }
19209 /// ```
19210 pub fn builder() -> super::builder::target_ssl_proxies::ClientBuilder {
19211 crate::new_client_builder(super::builder::target_ssl_proxies::client::Factory)
19212 }
19213
19214 /// Creates a new client from the provided stub.
19215 ///
19216 /// The most common case for calling this function is in tests mocking the
19217 /// client's behavior.
19218 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19219 where
19220 T: super::stub::TargetSslProxies + 'static,
19221 {
19222 Self { inner: stub.into() }
19223 }
19224
19225 pub(crate) async fn new(
19226 config: gaxi::options::ClientConfig,
19227 ) -> crate::ClientBuilderResult<Self> {
19228 let inner = Self::build_inner(config).await?;
19229 Ok(Self { inner })
19230 }
19231
19232 async fn build_inner(
19233 conf: gaxi::options::ClientConfig,
19234 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetSslProxies>>
19235 {
19236 if gaxi::options::tracing_enabled(&conf) {
19237 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19238 }
19239 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19240 }
19241
19242 async fn build_transport(
19243 conf: gaxi::options::ClientConfig,
19244 ) -> crate::ClientBuilderResult<impl super::stub::TargetSslProxies> {
19245 super::transport::TargetSslProxies::new(conf).await
19246 }
19247
19248 async fn build_with_tracing(
19249 conf: gaxi::options::ClientConfig,
19250 ) -> crate::ClientBuilderResult<impl super::stub::TargetSslProxies> {
19251 Self::build_transport(conf)
19252 .await
19253 .map(super::tracing::TargetSslProxies::new)
19254 }
19255
19256 /// Deletes the specified TargetSslProxy resource.
19257 pub fn delete(&self) -> super::builder::target_ssl_proxies::Delete {
19258 super::builder::target_ssl_proxies::Delete::new(self.inner.clone())
19259 }
19260
19261 /// Returns the specified TargetSslProxy resource.
19262 pub fn get(&self) -> super::builder::target_ssl_proxies::Get {
19263 super::builder::target_ssl_proxies::Get::new(self.inner.clone())
19264 }
19265
19266 /// Creates a TargetSslProxy resource in the specified project using
19267 /// the data included in the request.
19268 pub fn insert(&self) -> super::builder::target_ssl_proxies::Insert {
19269 super::builder::target_ssl_proxies::Insert::new(self.inner.clone())
19270 }
19271
19272 /// Retrieves the list of TargetSslProxy resources
19273 /// available to the specified project.
19274 pub fn list(&self) -> super::builder::target_ssl_proxies::List {
19275 super::builder::target_ssl_proxies::List::new(self.inner.clone())
19276 }
19277
19278 /// Changes the BackendService for TargetSslProxy.
19279 pub fn set_backend_service(&self) -> super::builder::target_ssl_proxies::SetBackendService {
19280 super::builder::target_ssl_proxies::SetBackendService::new(self.inner.clone())
19281 }
19282
19283 /// Changes the Certificate Map for TargetSslProxy.
19284 pub fn set_certificate_map(&self) -> super::builder::target_ssl_proxies::SetCertificateMap {
19285 super::builder::target_ssl_proxies::SetCertificateMap::new(self.inner.clone())
19286 }
19287
19288 /// Changes the ProxyHeaderType for TargetSslProxy.
19289 pub fn set_proxy_header(&self) -> super::builder::target_ssl_proxies::SetProxyHeader {
19290 super::builder::target_ssl_proxies::SetProxyHeader::new(self.inner.clone())
19291 }
19292
19293 /// Changes SslCertificates for TargetSslProxy.
19294 pub fn set_ssl_certificates(&self) -> super::builder::target_ssl_proxies::SetSslCertificates {
19295 super::builder::target_ssl_proxies::SetSslCertificates::new(self.inner.clone())
19296 }
19297
19298 /// Sets the SSL policy for TargetSslProxy. The SSL policy specifies the
19299 /// server-side support for SSL features. This affects connections between
19300 /// clients and the load balancer. They do not affect the
19301 /// connection between the load balancer and the backends.
19302 pub fn set_ssl_policy(&self) -> super::builder::target_ssl_proxies::SetSslPolicy {
19303 super::builder::target_ssl_proxies::SetSslPolicy::new(self.inner.clone())
19304 }
19305
19306 /// Returns permissions that a caller has on the specified resource.
19307 pub fn test_iam_permissions(&self) -> super::builder::target_ssl_proxies::TestIamPermissions {
19308 super::builder::target_ssl_proxies::TestIamPermissions::new(self.inner.clone())
19309 }
19310
19311 /// Retrieves the specified Operations resource.
19312 pub fn get_operation(&self) -> super::builder::target_ssl_proxies::GetOperation {
19313 super::builder::target_ssl_proxies::GetOperation::new(self.inner.clone())
19314 }
19315}
19316
19317/// Implements a client for the Google Compute Engine API.
19318///
19319/// # Example
19320/// ```
19321/// # use google_cloud_compute_v1::client::TargetTcpProxies;
19322/// async fn sample(
19323/// ) -> anyhow::Result<()> {
19324/// let client = TargetTcpProxies::builder().build().await?;
19325/// // use `client` to make requests to the Google Compute Engine API.
19326/// Ok(())
19327/// }
19328/// ```
19329///
19330/// # Service Description
19331///
19332/// Service for the `targetTcpProxies` resource.
19333///
19334/// # Configuration
19335///
19336/// To configure `TargetTcpProxies` use the `with_*` methods in the type returned
19337/// by [builder()][TargetTcpProxies::builder]. The default configuration should
19338/// work for most applications. Common configuration changes include
19339///
19340/// * [with_endpoint()]: by default this client uses the global default endpoint
19341/// (`https://compute.googleapis.com`). Applications using regional
19342/// endpoints or running in restricted networks (e.g. a network configured
19343/// with [Private Google Access with VPC Service Controls]) may want to
19344/// override this default.
19345/// * [with_credentials()]: by default this client uses
19346/// [Application Default Credentials]. Applications using custom
19347/// authentication may need to override this default.
19348///
19349/// [with_endpoint()]: super::builder::target_tcp_proxies::ClientBuilder::with_endpoint
19350/// [with_credentials()]: super::builder::target_tcp_proxies::ClientBuilder::with_credentials
19351/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19352/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19353///
19354/// # Pooling and Cloning
19355///
19356/// `TargetTcpProxies` holds a connection pool internally, it is advised to
19357/// create one and reuse it. You do not need to wrap `TargetTcpProxies` in
19358/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19359/// already uses an `Arc` internally.
19360#[cfg(feature = "target-tcp-proxies")]
19361#[cfg_attr(docsrs, doc(cfg(feature = "target-tcp-proxies")))]
19362#[derive(Clone, Debug)]
19363pub struct TargetTcpProxies {
19364 inner: std::sync::Arc<dyn super::stub::dynamic::TargetTcpProxies>,
19365}
19366
19367#[cfg(feature = "target-tcp-proxies")]
19368impl TargetTcpProxies {
19369 /// Returns a builder for [TargetTcpProxies].
19370 ///
19371 /// ```
19372 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19373 /// # use google_cloud_compute_v1::client::TargetTcpProxies;
19374 /// let client = TargetTcpProxies::builder().build().await?;
19375 /// # Ok(()) }
19376 /// ```
19377 pub fn builder() -> super::builder::target_tcp_proxies::ClientBuilder {
19378 crate::new_client_builder(super::builder::target_tcp_proxies::client::Factory)
19379 }
19380
19381 /// Creates a new client from the provided stub.
19382 ///
19383 /// The most common case for calling this function is in tests mocking the
19384 /// client's behavior.
19385 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19386 where
19387 T: super::stub::TargetTcpProxies + 'static,
19388 {
19389 Self { inner: stub.into() }
19390 }
19391
19392 pub(crate) async fn new(
19393 config: gaxi::options::ClientConfig,
19394 ) -> crate::ClientBuilderResult<Self> {
19395 let inner = Self::build_inner(config).await?;
19396 Ok(Self { inner })
19397 }
19398
19399 async fn build_inner(
19400 conf: gaxi::options::ClientConfig,
19401 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetTcpProxies>>
19402 {
19403 if gaxi::options::tracing_enabled(&conf) {
19404 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19405 }
19406 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19407 }
19408
19409 async fn build_transport(
19410 conf: gaxi::options::ClientConfig,
19411 ) -> crate::ClientBuilderResult<impl super::stub::TargetTcpProxies> {
19412 super::transport::TargetTcpProxies::new(conf).await
19413 }
19414
19415 async fn build_with_tracing(
19416 conf: gaxi::options::ClientConfig,
19417 ) -> crate::ClientBuilderResult<impl super::stub::TargetTcpProxies> {
19418 Self::build_transport(conf)
19419 .await
19420 .map(super::tracing::TargetTcpProxies::new)
19421 }
19422
19423 /// Retrieves the list of all TargetTcpProxy resources, regional and global,
19424 /// available to the specified project.
19425 ///
19426 /// To prevent failure, Google recommends that you set the
19427 /// `returnPartialSuccess` parameter to `true`.
19428 pub fn aggregated_list(&self) -> super::builder::target_tcp_proxies::AggregatedList {
19429 super::builder::target_tcp_proxies::AggregatedList::new(self.inner.clone())
19430 }
19431
19432 /// Deletes the specified TargetTcpProxy resource.
19433 pub fn delete(&self) -> super::builder::target_tcp_proxies::Delete {
19434 super::builder::target_tcp_proxies::Delete::new(self.inner.clone())
19435 }
19436
19437 /// Returns the specified TargetTcpProxy resource.
19438 pub fn get(&self) -> super::builder::target_tcp_proxies::Get {
19439 super::builder::target_tcp_proxies::Get::new(self.inner.clone())
19440 }
19441
19442 /// Creates a TargetTcpProxy resource in the specified project using
19443 /// the data included in the request.
19444 pub fn insert(&self) -> super::builder::target_tcp_proxies::Insert {
19445 super::builder::target_tcp_proxies::Insert::new(self.inner.clone())
19446 }
19447
19448 /// Retrieves the list of TargetTcpProxy resources
19449 /// available to the specified project.
19450 pub fn list(&self) -> super::builder::target_tcp_proxies::List {
19451 super::builder::target_tcp_proxies::List::new(self.inner.clone())
19452 }
19453
19454 /// Changes the BackendService for TargetTcpProxy.
19455 pub fn set_backend_service(&self) -> super::builder::target_tcp_proxies::SetBackendService {
19456 super::builder::target_tcp_proxies::SetBackendService::new(self.inner.clone())
19457 }
19458
19459 /// Changes the ProxyHeaderType for TargetTcpProxy.
19460 pub fn set_proxy_header(&self) -> super::builder::target_tcp_proxies::SetProxyHeader {
19461 super::builder::target_tcp_proxies::SetProxyHeader::new(self.inner.clone())
19462 }
19463
19464 /// Returns permissions that a caller has on the specified resource.
19465 pub fn test_iam_permissions(&self) -> super::builder::target_tcp_proxies::TestIamPermissions {
19466 super::builder::target_tcp_proxies::TestIamPermissions::new(self.inner.clone())
19467 }
19468
19469 /// Retrieves the specified Operations resource.
19470 pub fn get_operation(&self) -> super::builder::target_tcp_proxies::GetOperation {
19471 super::builder::target_tcp_proxies::GetOperation::new(self.inner.clone())
19472 }
19473}
19474
19475/// Implements a client for the Google Compute Engine API.
19476///
19477/// # Example
19478/// ```
19479/// # use google_cloud_compute_v1::client::TargetVpnGateways;
19480/// async fn sample(
19481/// ) -> anyhow::Result<()> {
19482/// let client = TargetVpnGateways::builder().build().await?;
19483/// // use `client` to make requests to the Google Compute Engine API.
19484/// Ok(())
19485/// }
19486/// ```
19487///
19488/// # Service Description
19489///
19490/// Service for the `targetVpnGateways` resource.
19491///
19492/// # Configuration
19493///
19494/// To configure `TargetVpnGateways` use the `with_*` methods in the type returned
19495/// by [builder()][TargetVpnGateways::builder]. The default configuration should
19496/// work for most applications. Common configuration changes include
19497///
19498/// * [with_endpoint()]: by default this client uses the global default endpoint
19499/// (`https://compute.googleapis.com`). Applications using regional
19500/// endpoints or running in restricted networks (e.g. a network configured
19501/// with [Private Google Access with VPC Service Controls]) may want to
19502/// override this default.
19503/// * [with_credentials()]: by default this client uses
19504/// [Application Default Credentials]. Applications using custom
19505/// authentication may need to override this default.
19506///
19507/// [with_endpoint()]: super::builder::target_vpn_gateways::ClientBuilder::with_endpoint
19508/// [with_credentials()]: super::builder::target_vpn_gateways::ClientBuilder::with_credentials
19509/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19510/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19511///
19512/// # Pooling and Cloning
19513///
19514/// `TargetVpnGateways` holds a connection pool internally, it is advised to
19515/// create one and reuse it. You do not need to wrap `TargetVpnGateways` in
19516/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19517/// already uses an `Arc` internally.
19518#[cfg(feature = "target-vpn-gateways")]
19519#[cfg_attr(docsrs, doc(cfg(feature = "target-vpn-gateways")))]
19520#[derive(Clone, Debug)]
19521pub struct TargetVpnGateways {
19522 inner: std::sync::Arc<dyn super::stub::dynamic::TargetVpnGateways>,
19523}
19524
19525#[cfg(feature = "target-vpn-gateways")]
19526impl TargetVpnGateways {
19527 /// Returns a builder for [TargetVpnGateways].
19528 ///
19529 /// ```
19530 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19531 /// # use google_cloud_compute_v1::client::TargetVpnGateways;
19532 /// let client = TargetVpnGateways::builder().build().await?;
19533 /// # Ok(()) }
19534 /// ```
19535 pub fn builder() -> super::builder::target_vpn_gateways::ClientBuilder {
19536 crate::new_client_builder(super::builder::target_vpn_gateways::client::Factory)
19537 }
19538
19539 /// Creates a new client from the provided stub.
19540 ///
19541 /// The most common case for calling this function is in tests mocking the
19542 /// client's behavior.
19543 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19544 where
19545 T: super::stub::TargetVpnGateways + 'static,
19546 {
19547 Self { inner: stub.into() }
19548 }
19549
19550 pub(crate) async fn new(
19551 config: gaxi::options::ClientConfig,
19552 ) -> crate::ClientBuilderResult<Self> {
19553 let inner = Self::build_inner(config).await?;
19554 Ok(Self { inner })
19555 }
19556
19557 async fn build_inner(
19558 conf: gaxi::options::ClientConfig,
19559 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::TargetVpnGateways>>
19560 {
19561 if gaxi::options::tracing_enabled(&conf) {
19562 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19563 }
19564 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19565 }
19566
19567 async fn build_transport(
19568 conf: gaxi::options::ClientConfig,
19569 ) -> crate::ClientBuilderResult<impl super::stub::TargetVpnGateways> {
19570 super::transport::TargetVpnGateways::new(conf).await
19571 }
19572
19573 async fn build_with_tracing(
19574 conf: gaxi::options::ClientConfig,
19575 ) -> crate::ClientBuilderResult<impl super::stub::TargetVpnGateways> {
19576 Self::build_transport(conf)
19577 .await
19578 .map(super::tracing::TargetVpnGateways::new)
19579 }
19580
19581 /// Retrieves an aggregated list of target VPN gateways.
19582 ///
19583 /// To prevent failure, Google recommends that you set the
19584 /// `returnPartialSuccess` parameter to `true`.
19585 pub fn aggregated_list(&self) -> super::builder::target_vpn_gateways::AggregatedList {
19586 super::builder::target_vpn_gateways::AggregatedList::new(self.inner.clone())
19587 }
19588
19589 /// Deletes the specified target VPN gateway.
19590 pub fn delete(&self) -> super::builder::target_vpn_gateways::Delete {
19591 super::builder::target_vpn_gateways::Delete::new(self.inner.clone())
19592 }
19593
19594 /// Returns the specified target VPN gateway.
19595 pub fn get(&self) -> super::builder::target_vpn_gateways::Get {
19596 super::builder::target_vpn_gateways::Get::new(self.inner.clone())
19597 }
19598
19599 /// Creates a target VPN gateway in the specified project and region using
19600 /// the data included in the request.
19601 pub fn insert(&self) -> super::builder::target_vpn_gateways::Insert {
19602 super::builder::target_vpn_gateways::Insert::new(self.inner.clone())
19603 }
19604
19605 /// Retrieves a list of target VPN gateways available to the specified
19606 /// project and region.
19607 pub fn list(&self) -> super::builder::target_vpn_gateways::List {
19608 super::builder::target_vpn_gateways::List::new(self.inner.clone())
19609 }
19610
19611 /// Sets the labels on a TargetVpnGateway. To learn more about labels, read theLabeling
19612 /// Resources documentation.
19613 pub fn set_labels(&self) -> super::builder::target_vpn_gateways::SetLabels {
19614 super::builder::target_vpn_gateways::SetLabels::new(self.inner.clone())
19615 }
19616
19617 /// Retrieves the specified region-specific Operations resource.
19618 pub fn get_operation(&self) -> super::builder::target_vpn_gateways::GetOperation {
19619 super::builder::target_vpn_gateways::GetOperation::new(self.inner.clone())
19620 }
19621}
19622
19623/// Implements a client for the Google Compute Engine API.
19624///
19625/// # Example
19626/// ```
19627/// # use google_cloud_compute_v1::client::UrlMaps;
19628/// async fn sample(
19629/// ) -> anyhow::Result<()> {
19630/// let client = UrlMaps::builder().build().await?;
19631/// // use `client` to make requests to the Google Compute Engine API.
19632/// Ok(())
19633/// }
19634/// ```
19635///
19636/// # Service Description
19637///
19638/// Service for the `urlMaps` resource.
19639///
19640/// # Configuration
19641///
19642/// To configure `UrlMaps` use the `with_*` methods in the type returned
19643/// by [builder()][UrlMaps::builder]. The default configuration should
19644/// work for most applications. Common configuration changes include
19645///
19646/// * [with_endpoint()]: by default this client uses the global default endpoint
19647/// (`https://compute.googleapis.com`). Applications using regional
19648/// endpoints or running in restricted networks (e.g. a network configured
19649/// with [Private Google Access with VPC Service Controls]) may want to
19650/// override this default.
19651/// * [with_credentials()]: by default this client uses
19652/// [Application Default Credentials]. Applications using custom
19653/// authentication may need to override this default.
19654///
19655/// [with_endpoint()]: super::builder::url_maps::ClientBuilder::with_endpoint
19656/// [with_credentials()]: super::builder::url_maps::ClientBuilder::with_credentials
19657/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19658/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19659///
19660/// # Pooling and Cloning
19661///
19662/// `UrlMaps` holds a connection pool internally, it is advised to
19663/// create one and reuse it. You do not need to wrap `UrlMaps` in
19664/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19665/// already uses an `Arc` internally.
19666#[cfg(feature = "url-maps")]
19667#[cfg_attr(docsrs, doc(cfg(feature = "url-maps")))]
19668#[derive(Clone, Debug)]
19669pub struct UrlMaps {
19670 inner: std::sync::Arc<dyn super::stub::dynamic::UrlMaps>,
19671}
19672
19673#[cfg(feature = "url-maps")]
19674impl UrlMaps {
19675 /// Returns a builder for [UrlMaps].
19676 ///
19677 /// ```
19678 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19679 /// # use google_cloud_compute_v1::client::UrlMaps;
19680 /// let client = UrlMaps::builder().build().await?;
19681 /// # Ok(()) }
19682 /// ```
19683 pub fn builder() -> super::builder::url_maps::ClientBuilder {
19684 crate::new_client_builder(super::builder::url_maps::client::Factory)
19685 }
19686
19687 /// Creates a new client from the provided stub.
19688 ///
19689 /// The most common case for calling this function is in tests mocking the
19690 /// client's behavior.
19691 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19692 where
19693 T: super::stub::UrlMaps + 'static,
19694 {
19695 Self { inner: stub.into() }
19696 }
19697
19698 pub(crate) async fn new(
19699 config: gaxi::options::ClientConfig,
19700 ) -> crate::ClientBuilderResult<Self> {
19701 let inner = Self::build_inner(config).await?;
19702 Ok(Self { inner })
19703 }
19704
19705 async fn build_inner(
19706 conf: gaxi::options::ClientConfig,
19707 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::UrlMaps>> {
19708 if gaxi::options::tracing_enabled(&conf) {
19709 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19710 }
19711 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19712 }
19713
19714 async fn build_transport(
19715 conf: gaxi::options::ClientConfig,
19716 ) -> crate::ClientBuilderResult<impl super::stub::UrlMaps> {
19717 super::transport::UrlMaps::new(conf).await
19718 }
19719
19720 async fn build_with_tracing(
19721 conf: gaxi::options::ClientConfig,
19722 ) -> crate::ClientBuilderResult<impl super::stub::UrlMaps> {
19723 Self::build_transport(conf)
19724 .await
19725 .map(super::tracing::UrlMaps::new)
19726 }
19727
19728 /// Retrieves the list of all UrlMap resources, regional and global,
19729 /// available to the specified project.
19730 ///
19731 /// To prevent failure, Google recommends that you set the
19732 /// `returnPartialSuccess` parameter to `true`.
19733 pub fn aggregated_list(&self) -> super::builder::url_maps::AggregatedList {
19734 super::builder::url_maps::AggregatedList::new(self.inner.clone())
19735 }
19736
19737 /// Deletes the specified UrlMap resource.
19738 pub fn delete(&self) -> super::builder::url_maps::Delete {
19739 super::builder::url_maps::Delete::new(self.inner.clone())
19740 }
19741
19742 /// Returns the specified UrlMap resource.
19743 pub fn get(&self) -> super::builder::url_maps::Get {
19744 super::builder::url_maps::Get::new(self.inner.clone())
19745 }
19746
19747 /// Creates a UrlMap resource in the specified project using
19748 /// the data included in the request.
19749 pub fn insert(&self) -> super::builder::url_maps::Insert {
19750 super::builder::url_maps::Insert::new(self.inner.clone())
19751 }
19752
19753 /// Initiates a cache invalidation operation, invalidating the specified path,
19754 /// scoped to the specified UrlMap.
19755 ///
19756 /// For more information, see [Invalidating cached
19757 /// content](/cdn/docs/invalidating-cached-content).
19758 pub fn invalidate_cache(&self) -> super::builder::url_maps::InvalidateCache {
19759 super::builder::url_maps::InvalidateCache::new(self.inner.clone())
19760 }
19761
19762 /// Retrieves the list of UrlMap resources available to the specified
19763 /// project.
19764 pub fn list(&self) -> super::builder::url_maps::List {
19765 super::builder::url_maps::List::new(self.inner.clone())
19766 }
19767
19768 /// Patches the specified UrlMap resource with the data included in the
19769 /// request. This method supportsPATCH
19770 /// semantics and uses theJSON merge
19771 /// patch format and processing rules.
19772 pub fn patch(&self) -> super::builder::url_maps::Patch {
19773 super::builder::url_maps::Patch::new(self.inner.clone())
19774 }
19775
19776 /// Returns permissions that a caller has on the specified resource.
19777 pub fn test_iam_permissions(&self) -> super::builder::url_maps::TestIamPermissions {
19778 super::builder::url_maps::TestIamPermissions::new(self.inner.clone())
19779 }
19780
19781 /// Updates the specified UrlMap resource with the data included in the
19782 /// request.
19783 pub fn update(&self) -> super::builder::url_maps::Update {
19784 super::builder::url_maps::Update::new(self.inner.clone())
19785 }
19786
19787 /// Runs static validation for the UrlMap. In particular, the tests of the
19788 /// provided UrlMap will be run. Calling this method does NOT create the
19789 /// UrlMap.
19790 pub fn validate(&self) -> super::builder::url_maps::Validate {
19791 super::builder::url_maps::Validate::new(self.inner.clone())
19792 }
19793
19794 /// Retrieves the specified Operations resource.
19795 pub fn get_operation(&self) -> super::builder::url_maps::GetOperation {
19796 super::builder::url_maps::GetOperation::new(self.inner.clone())
19797 }
19798}
19799
19800/// Implements a client for the Google Compute Engine API.
19801///
19802/// # Example
19803/// ```
19804/// # use google_cloud_compute_v1::client::VpnGateways;
19805/// async fn sample(
19806/// ) -> anyhow::Result<()> {
19807/// let client = VpnGateways::builder().build().await?;
19808/// // use `client` to make requests to the Google Compute Engine API.
19809/// Ok(())
19810/// }
19811/// ```
19812///
19813/// # Service Description
19814///
19815/// Service for the `vpnGateways` resource.
19816///
19817/// # Configuration
19818///
19819/// To configure `VpnGateways` use the `with_*` methods in the type returned
19820/// by [builder()][VpnGateways::builder]. The default configuration should
19821/// work for most applications. Common configuration changes include
19822///
19823/// * [with_endpoint()]: by default this client uses the global default endpoint
19824/// (`https://compute.googleapis.com`). Applications using regional
19825/// endpoints or running in restricted networks (e.g. a network configured
19826/// with [Private Google Access with VPC Service Controls]) may want to
19827/// override this default.
19828/// * [with_credentials()]: by default this client uses
19829/// [Application Default Credentials]. Applications using custom
19830/// authentication may need to override this default.
19831///
19832/// [with_endpoint()]: super::builder::vpn_gateways::ClientBuilder::with_endpoint
19833/// [with_credentials()]: super::builder::vpn_gateways::ClientBuilder::with_credentials
19834/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19835/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19836///
19837/// # Pooling and Cloning
19838///
19839/// `VpnGateways` holds a connection pool internally, it is advised to
19840/// create one and reuse it. You do not need to wrap `VpnGateways` in
19841/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19842/// already uses an `Arc` internally.
19843#[cfg(feature = "vpn-gateways")]
19844#[cfg_attr(docsrs, doc(cfg(feature = "vpn-gateways")))]
19845#[derive(Clone, Debug)]
19846pub struct VpnGateways {
19847 inner: std::sync::Arc<dyn super::stub::dynamic::VpnGateways>,
19848}
19849
19850#[cfg(feature = "vpn-gateways")]
19851impl VpnGateways {
19852 /// Returns a builder for [VpnGateways].
19853 ///
19854 /// ```
19855 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
19856 /// # use google_cloud_compute_v1::client::VpnGateways;
19857 /// let client = VpnGateways::builder().build().await?;
19858 /// # Ok(()) }
19859 /// ```
19860 pub fn builder() -> super::builder::vpn_gateways::ClientBuilder {
19861 crate::new_client_builder(super::builder::vpn_gateways::client::Factory)
19862 }
19863
19864 /// Creates a new client from the provided stub.
19865 ///
19866 /// The most common case for calling this function is in tests mocking the
19867 /// client's behavior.
19868 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
19869 where
19870 T: super::stub::VpnGateways + 'static,
19871 {
19872 Self { inner: stub.into() }
19873 }
19874
19875 pub(crate) async fn new(
19876 config: gaxi::options::ClientConfig,
19877 ) -> crate::ClientBuilderResult<Self> {
19878 let inner = Self::build_inner(config).await?;
19879 Ok(Self { inner })
19880 }
19881
19882 async fn build_inner(
19883 conf: gaxi::options::ClientConfig,
19884 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VpnGateways>> {
19885 if gaxi::options::tracing_enabled(&conf) {
19886 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
19887 }
19888 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
19889 }
19890
19891 async fn build_transport(
19892 conf: gaxi::options::ClientConfig,
19893 ) -> crate::ClientBuilderResult<impl super::stub::VpnGateways> {
19894 super::transport::VpnGateways::new(conf).await
19895 }
19896
19897 async fn build_with_tracing(
19898 conf: gaxi::options::ClientConfig,
19899 ) -> crate::ClientBuilderResult<impl super::stub::VpnGateways> {
19900 Self::build_transport(conf)
19901 .await
19902 .map(super::tracing::VpnGateways::new)
19903 }
19904
19905 /// Retrieves an aggregated list of VPN gateways.
19906 ///
19907 /// To prevent failure, Google recommends that you set the
19908 /// `returnPartialSuccess` parameter to `true`.
19909 pub fn aggregated_list(&self) -> super::builder::vpn_gateways::AggregatedList {
19910 super::builder::vpn_gateways::AggregatedList::new(self.inner.clone())
19911 }
19912
19913 /// Deletes the specified VPN gateway.
19914 pub fn delete(&self) -> super::builder::vpn_gateways::Delete {
19915 super::builder::vpn_gateways::Delete::new(self.inner.clone())
19916 }
19917
19918 /// Returns the specified VPN gateway.
19919 pub fn get(&self) -> super::builder::vpn_gateways::Get {
19920 super::builder::vpn_gateways::Get::new(self.inner.clone())
19921 }
19922
19923 /// Returns the status for the specified VPN gateway.
19924 pub fn get_status(&self) -> super::builder::vpn_gateways::GetStatus {
19925 super::builder::vpn_gateways::GetStatus::new(self.inner.clone())
19926 }
19927
19928 /// Creates a VPN gateway in the specified project and region using
19929 /// the data included in the request.
19930 pub fn insert(&self) -> super::builder::vpn_gateways::Insert {
19931 super::builder::vpn_gateways::Insert::new(self.inner.clone())
19932 }
19933
19934 /// Retrieves a list of VPN gateways available to the specified
19935 /// project and region.
19936 pub fn list(&self) -> super::builder::vpn_gateways::List {
19937 super::builder::vpn_gateways::List::new(self.inner.clone())
19938 }
19939
19940 /// Sets the labels on a VpnGateway. To learn more about labels, read theLabeling
19941 /// Resources documentation.
19942 pub fn set_labels(&self) -> super::builder::vpn_gateways::SetLabels {
19943 super::builder::vpn_gateways::SetLabels::new(self.inner.clone())
19944 }
19945
19946 /// Returns permissions that a caller has on the specified resource.
19947 pub fn test_iam_permissions(&self) -> super::builder::vpn_gateways::TestIamPermissions {
19948 super::builder::vpn_gateways::TestIamPermissions::new(self.inner.clone())
19949 }
19950
19951 /// Retrieves the specified region-specific Operations resource.
19952 pub fn get_operation(&self) -> super::builder::vpn_gateways::GetOperation {
19953 super::builder::vpn_gateways::GetOperation::new(self.inner.clone())
19954 }
19955}
19956
19957/// Implements a client for the Google Compute Engine API.
19958///
19959/// # Example
19960/// ```
19961/// # use google_cloud_compute_v1::client::VpnTunnels;
19962/// async fn sample(
19963/// ) -> anyhow::Result<()> {
19964/// let client = VpnTunnels::builder().build().await?;
19965/// // use `client` to make requests to the Google Compute Engine API.
19966/// Ok(())
19967/// }
19968/// ```
19969///
19970/// # Service Description
19971///
19972/// Service for the `vpnTunnels` resource.
19973///
19974/// # Configuration
19975///
19976/// To configure `VpnTunnels` use the `with_*` methods in the type returned
19977/// by [builder()][VpnTunnels::builder]. The default configuration should
19978/// work for most applications. Common configuration changes include
19979///
19980/// * [with_endpoint()]: by default this client uses the global default endpoint
19981/// (`https://compute.googleapis.com`). Applications using regional
19982/// endpoints or running in restricted networks (e.g. a network configured
19983/// with [Private Google Access with VPC Service Controls]) may want to
19984/// override this default.
19985/// * [with_credentials()]: by default this client uses
19986/// [Application Default Credentials]. Applications using custom
19987/// authentication may need to override this default.
19988///
19989/// [with_endpoint()]: super::builder::vpn_tunnels::ClientBuilder::with_endpoint
19990/// [with_credentials()]: super::builder::vpn_tunnels::ClientBuilder::with_credentials
19991/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
19992/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
19993///
19994/// # Pooling and Cloning
19995///
19996/// `VpnTunnels` holds a connection pool internally, it is advised to
19997/// create one and reuse it. You do not need to wrap `VpnTunnels` in
19998/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
19999/// already uses an `Arc` internally.
20000#[cfg(feature = "vpn-tunnels")]
20001#[cfg_attr(docsrs, doc(cfg(feature = "vpn-tunnels")))]
20002#[derive(Clone, Debug)]
20003pub struct VpnTunnels {
20004 inner: std::sync::Arc<dyn super::stub::dynamic::VpnTunnels>,
20005}
20006
20007#[cfg(feature = "vpn-tunnels")]
20008impl VpnTunnels {
20009 /// Returns a builder for [VpnTunnels].
20010 ///
20011 /// ```
20012 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20013 /// # use google_cloud_compute_v1::client::VpnTunnels;
20014 /// let client = VpnTunnels::builder().build().await?;
20015 /// # Ok(()) }
20016 /// ```
20017 pub fn builder() -> super::builder::vpn_tunnels::ClientBuilder {
20018 crate::new_client_builder(super::builder::vpn_tunnels::client::Factory)
20019 }
20020
20021 /// Creates a new client from the provided stub.
20022 ///
20023 /// The most common case for calling this function is in tests mocking the
20024 /// client's behavior.
20025 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20026 where
20027 T: super::stub::VpnTunnels + 'static,
20028 {
20029 Self { inner: stub.into() }
20030 }
20031
20032 pub(crate) async fn new(
20033 config: gaxi::options::ClientConfig,
20034 ) -> crate::ClientBuilderResult<Self> {
20035 let inner = Self::build_inner(config).await?;
20036 Ok(Self { inner })
20037 }
20038
20039 async fn build_inner(
20040 conf: gaxi::options::ClientConfig,
20041 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::VpnTunnels>> {
20042 if gaxi::options::tracing_enabled(&conf) {
20043 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20044 }
20045 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20046 }
20047
20048 async fn build_transport(
20049 conf: gaxi::options::ClientConfig,
20050 ) -> crate::ClientBuilderResult<impl super::stub::VpnTunnels> {
20051 super::transport::VpnTunnels::new(conf).await
20052 }
20053
20054 async fn build_with_tracing(
20055 conf: gaxi::options::ClientConfig,
20056 ) -> crate::ClientBuilderResult<impl super::stub::VpnTunnels> {
20057 Self::build_transport(conf)
20058 .await
20059 .map(super::tracing::VpnTunnels::new)
20060 }
20061
20062 /// Retrieves an aggregated list of VPN tunnels.
20063 ///
20064 /// To prevent failure, Google recommends that you set the
20065 /// `returnPartialSuccess` parameter to `true`.
20066 pub fn aggregated_list(&self) -> super::builder::vpn_tunnels::AggregatedList {
20067 super::builder::vpn_tunnels::AggregatedList::new(self.inner.clone())
20068 }
20069
20070 /// Deletes the specified VpnTunnel resource.
20071 pub fn delete(&self) -> super::builder::vpn_tunnels::Delete {
20072 super::builder::vpn_tunnels::Delete::new(self.inner.clone())
20073 }
20074
20075 /// Returns the specified VpnTunnel resource.
20076 pub fn get(&self) -> super::builder::vpn_tunnels::Get {
20077 super::builder::vpn_tunnels::Get::new(self.inner.clone())
20078 }
20079
20080 /// Creates a VpnTunnel resource in the specified project and region using
20081 /// the data included in the request.
20082 pub fn insert(&self) -> super::builder::vpn_tunnels::Insert {
20083 super::builder::vpn_tunnels::Insert::new(self.inner.clone())
20084 }
20085
20086 /// Retrieves a list of VpnTunnel resources contained in the specified
20087 /// project and region.
20088 pub fn list(&self) -> super::builder::vpn_tunnels::List {
20089 super::builder::vpn_tunnels::List::new(self.inner.clone())
20090 }
20091
20092 /// Sets the labels on a VpnTunnel. To learn more about labels, read theLabeling
20093 /// Resources documentation.
20094 pub fn set_labels(&self) -> super::builder::vpn_tunnels::SetLabels {
20095 super::builder::vpn_tunnels::SetLabels::new(self.inner.clone())
20096 }
20097
20098 /// Retrieves the specified region-specific Operations resource.
20099 pub fn get_operation(&self) -> super::builder::vpn_tunnels::GetOperation {
20100 super::builder::vpn_tunnels::GetOperation::new(self.inner.clone())
20101 }
20102}
20103
20104/// Implements a client for the Google Compute Engine API.
20105///
20106/// # Example
20107/// ```
20108/// # use google_cloud_compute_v1::client::WireGroups;
20109/// async fn sample(
20110/// ) -> anyhow::Result<()> {
20111/// let client = WireGroups::builder().build().await?;
20112/// // use `client` to make requests to the Google Compute Engine API.
20113/// Ok(())
20114/// }
20115/// ```
20116///
20117/// # Service Description
20118///
20119/// Service for the `wireGroups` resource.
20120///
20121/// # Configuration
20122///
20123/// To configure `WireGroups` use the `with_*` methods in the type returned
20124/// by [builder()][WireGroups::builder]. The default configuration should
20125/// work for most applications. Common configuration changes include
20126///
20127/// * [with_endpoint()]: by default this client uses the global default endpoint
20128/// (`https://compute.googleapis.com`). Applications using regional
20129/// endpoints or running in restricted networks (e.g. a network configured
20130/// with [Private Google Access with VPC Service Controls]) may want to
20131/// override this default.
20132/// * [with_credentials()]: by default this client uses
20133/// [Application Default Credentials]. Applications using custom
20134/// authentication may need to override this default.
20135///
20136/// [with_endpoint()]: super::builder::wire_groups::ClientBuilder::with_endpoint
20137/// [with_credentials()]: super::builder::wire_groups::ClientBuilder::with_credentials
20138/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20139/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20140///
20141/// # Pooling and Cloning
20142///
20143/// `WireGroups` holds a connection pool internally, it is advised to
20144/// create one and reuse it. You do not need to wrap `WireGroups` in
20145/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20146/// already uses an `Arc` internally.
20147#[cfg(feature = "wire-groups")]
20148#[cfg_attr(docsrs, doc(cfg(feature = "wire-groups")))]
20149#[derive(Clone, Debug)]
20150pub struct WireGroups {
20151 inner: std::sync::Arc<dyn super::stub::dynamic::WireGroups>,
20152}
20153
20154#[cfg(feature = "wire-groups")]
20155impl WireGroups {
20156 /// Returns a builder for [WireGroups].
20157 ///
20158 /// ```
20159 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20160 /// # use google_cloud_compute_v1::client::WireGroups;
20161 /// let client = WireGroups::builder().build().await?;
20162 /// # Ok(()) }
20163 /// ```
20164 pub fn builder() -> super::builder::wire_groups::ClientBuilder {
20165 crate::new_client_builder(super::builder::wire_groups::client::Factory)
20166 }
20167
20168 /// Creates a new client from the provided stub.
20169 ///
20170 /// The most common case for calling this function is in tests mocking the
20171 /// client's behavior.
20172 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20173 where
20174 T: super::stub::WireGroups + 'static,
20175 {
20176 Self { inner: stub.into() }
20177 }
20178
20179 pub(crate) async fn new(
20180 config: gaxi::options::ClientConfig,
20181 ) -> crate::ClientBuilderResult<Self> {
20182 let inner = Self::build_inner(config).await?;
20183 Ok(Self { inner })
20184 }
20185
20186 async fn build_inner(
20187 conf: gaxi::options::ClientConfig,
20188 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::WireGroups>> {
20189 if gaxi::options::tracing_enabled(&conf) {
20190 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20191 }
20192 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20193 }
20194
20195 async fn build_transport(
20196 conf: gaxi::options::ClientConfig,
20197 ) -> crate::ClientBuilderResult<impl super::stub::WireGroups> {
20198 super::transport::WireGroups::new(conf).await
20199 }
20200
20201 async fn build_with_tracing(
20202 conf: gaxi::options::ClientConfig,
20203 ) -> crate::ClientBuilderResult<impl super::stub::WireGroups> {
20204 Self::build_transport(conf)
20205 .await
20206 .map(super::tracing::WireGroups::new)
20207 }
20208
20209 /// Deletes the specified wire group in the given scope.
20210 pub fn delete(&self) -> super::builder::wire_groups::Delete {
20211 super::builder::wire_groups::Delete::new(self.inner.clone())
20212 }
20213
20214 /// Gets the specified wire group resource in the given scope.
20215 pub fn get(&self) -> super::builder::wire_groups::Get {
20216 super::builder::wire_groups::Get::new(self.inner.clone())
20217 }
20218
20219 /// Creates a wire group in the specified project in the given scope
20220 /// using the parameters that are included in the request.
20221 pub fn insert(&self) -> super::builder::wire_groups::Insert {
20222 super::builder::wire_groups::Insert::new(self.inner.clone())
20223 }
20224
20225 /// Lists the wire groups for a project in the given scope.
20226 pub fn list(&self) -> super::builder::wire_groups::List {
20227 super::builder::wire_groups::List::new(self.inner.clone())
20228 }
20229
20230 /// Updates the specified wire group resource with the data included in the
20231 /// request. This method supportsPATCH
20232 /// semantics and usesJSON merge
20233 /// patch format and processing rules.
20234 pub fn patch(&self) -> super::builder::wire_groups::Patch {
20235 super::builder::wire_groups::Patch::new(self.inner.clone())
20236 }
20237
20238 /// Retrieves the specified Operations resource.
20239 pub fn get_operation(&self) -> super::builder::wire_groups::GetOperation {
20240 super::builder::wire_groups::GetOperation::new(self.inner.clone())
20241 }
20242}
20243
20244/// Implements a client for the Google Compute Engine API.
20245///
20246/// # Example
20247/// ```
20248/// # use google_cloud_compute_v1::client::ZoneOperations;
20249/// async fn sample(
20250/// ) -> anyhow::Result<()> {
20251/// let client = ZoneOperations::builder().build().await?;
20252/// // use `client` to make requests to the Google Compute Engine API.
20253/// Ok(())
20254/// }
20255/// ```
20256///
20257/// # Service Description
20258///
20259/// Service for the `zoneOperations` resource.
20260///
20261/// # Configuration
20262///
20263/// To configure `ZoneOperations` use the `with_*` methods in the type returned
20264/// by [builder()][ZoneOperations::builder]. The default configuration should
20265/// work for most applications. Common configuration changes include
20266///
20267/// * [with_endpoint()]: by default this client uses the global default endpoint
20268/// (`https://compute.googleapis.com`). Applications using regional
20269/// endpoints or running in restricted networks (e.g. a network configured
20270/// with [Private Google Access with VPC Service Controls]) may want to
20271/// override this default.
20272/// * [with_credentials()]: by default this client uses
20273/// [Application Default Credentials]. Applications using custom
20274/// authentication may need to override this default.
20275///
20276/// [with_endpoint()]: super::builder::zone_operations::ClientBuilder::with_endpoint
20277/// [with_credentials()]: super::builder::zone_operations::ClientBuilder::with_credentials
20278/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20279/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20280///
20281/// # Pooling and Cloning
20282///
20283/// `ZoneOperations` holds a connection pool internally, it is advised to
20284/// create one and reuse it. You do not need to wrap `ZoneOperations` in
20285/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20286/// already uses an `Arc` internally.
20287#[cfg(feature = "zone-operations")]
20288#[cfg_attr(docsrs, doc(cfg(feature = "zone-operations")))]
20289#[derive(Clone, Debug)]
20290pub struct ZoneOperations {
20291 inner: std::sync::Arc<dyn super::stub::dynamic::ZoneOperations>,
20292}
20293
20294#[cfg(feature = "zone-operations")]
20295impl ZoneOperations {
20296 /// Returns a builder for [ZoneOperations].
20297 ///
20298 /// ```
20299 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20300 /// # use google_cloud_compute_v1::client::ZoneOperations;
20301 /// let client = ZoneOperations::builder().build().await?;
20302 /// # Ok(()) }
20303 /// ```
20304 pub fn builder() -> super::builder::zone_operations::ClientBuilder {
20305 crate::new_client_builder(super::builder::zone_operations::client::Factory)
20306 }
20307
20308 /// Creates a new client from the provided stub.
20309 ///
20310 /// The most common case for calling this function is in tests mocking the
20311 /// client's behavior.
20312 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20313 where
20314 T: super::stub::ZoneOperations + 'static,
20315 {
20316 Self { inner: stub.into() }
20317 }
20318
20319 pub(crate) async fn new(
20320 config: gaxi::options::ClientConfig,
20321 ) -> crate::ClientBuilderResult<Self> {
20322 let inner = Self::build_inner(config).await?;
20323 Ok(Self { inner })
20324 }
20325
20326 async fn build_inner(
20327 conf: gaxi::options::ClientConfig,
20328 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ZoneOperations>> {
20329 if gaxi::options::tracing_enabled(&conf) {
20330 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20331 }
20332 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20333 }
20334
20335 async fn build_transport(
20336 conf: gaxi::options::ClientConfig,
20337 ) -> crate::ClientBuilderResult<impl super::stub::ZoneOperations> {
20338 super::transport::ZoneOperations::new(conf).await
20339 }
20340
20341 async fn build_with_tracing(
20342 conf: gaxi::options::ClientConfig,
20343 ) -> crate::ClientBuilderResult<impl super::stub::ZoneOperations> {
20344 Self::build_transport(conf)
20345 .await
20346 .map(super::tracing::ZoneOperations::new)
20347 }
20348
20349 /// Deletes the specified zone-specific Operations resource.
20350 pub fn delete(&self) -> super::builder::zone_operations::Delete {
20351 super::builder::zone_operations::Delete::new(self.inner.clone())
20352 }
20353
20354 /// Retrieves the specified zone-specific Operations resource.
20355 pub fn get(&self) -> super::builder::zone_operations::Get {
20356 super::builder::zone_operations::Get::new(self.inner.clone())
20357 }
20358
20359 /// Retrieves a list of Operation resources contained within
20360 /// the specified zone.
20361 pub fn list(&self) -> super::builder::zone_operations::List {
20362 super::builder::zone_operations::List::new(self.inner.clone())
20363 }
20364
20365 /// Waits for the specified Operation resource to return as `DONE`
20366 /// or for the request to approach the 2 minute deadline, and retrieves the
20367 /// specified Operation resource. This method waits for no more than the
20368 /// 2 minutes and then returns the current state of the
20369 /// operation, which might be `DONE` or still in progress.
20370 ///
20371 /// This method is called on a best-effort basis. Specifically:
20372 ///
20373 /// ```norust
20374 /// - In uncommon cases, when the server is overloaded, the request might
20375 /// return before the default deadline is reached, or might return after zero
20376 /// seconds.
20377 /// ```
20378 ///
20379 /// - If the default deadline is reached, there is no guarantee that the
20380 /// operation is actually done when the method returns. Be prepared to retry
20381 /// if the operation is not `DONE`.
20382 pub fn wait(&self) -> super::builder::zone_operations::Wait {
20383 super::builder::zone_operations::Wait::new(self.inner.clone())
20384 }
20385}
20386
20387/// Implements a client for the Google Compute Engine API.
20388///
20389/// # Example
20390/// ```
20391/// # use google_cloud_compute_v1::client::ZoneVmExtensionPolicies;
20392/// async fn sample(
20393/// ) -> anyhow::Result<()> {
20394/// let client = ZoneVmExtensionPolicies::builder().build().await?;
20395/// // use `client` to make requests to the Google Compute Engine API.
20396/// Ok(())
20397/// }
20398/// ```
20399///
20400/// # Service Description
20401///
20402/// Service for the `zoneVmExtensionPolicies` resource.
20403///
20404/// # Configuration
20405///
20406/// To configure `ZoneVmExtensionPolicies` use the `with_*` methods in the type returned
20407/// by [builder()][ZoneVmExtensionPolicies::builder]. The default configuration should
20408/// work for most applications. Common configuration changes include
20409///
20410/// * [with_endpoint()]: by default this client uses the global default endpoint
20411/// (`https://compute.googleapis.com`). Applications using regional
20412/// endpoints or running in restricted networks (e.g. a network configured
20413/// with [Private Google Access with VPC Service Controls]) may want to
20414/// override this default.
20415/// * [with_credentials()]: by default this client uses
20416/// [Application Default Credentials]. Applications using custom
20417/// authentication may need to override this default.
20418///
20419/// [with_endpoint()]: super::builder::zone_vm_extension_policies::ClientBuilder::with_endpoint
20420/// [with_credentials()]: super::builder::zone_vm_extension_policies::ClientBuilder::with_credentials
20421/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20422/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20423///
20424/// # Pooling and Cloning
20425///
20426/// `ZoneVmExtensionPolicies` holds a connection pool internally, it is advised to
20427/// create one and reuse it. You do not need to wrap `ZoneVmExtensionPolicies` in
20428/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20429/// already uses an `Arc` internally.
20430#[cfg(feature = "zone-vm-extension-policies")]
20431#[cfg_attr(docsrs, doc(cfg(feature = "zone-vm-extension-policies")))]
20432#[derive(Clone, Debug)]
20433pub struct ZoneVmExtensionPolicies {
20434 inner: std::sync::Arc<dyn super::stub::dynamic::ZoneVmExtensionPolicies>,
20435}
20436
20437#[cfg(feature = "zone-vm-extension-policies")]
20438impl ZoneVmExtensionPolicies {
20439 /// Returns a builder for [ZoneVmExtensionPolicies].
20440 ///
20441 /// ```
20442 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20443 /// # use google_cloud_compute_v1::client::ZoneVmExtensionPolicies;
20444 /// let client = ZoneVmExtensionPolicies::builder().build().await?;
20445 /// # Ok(()) }
20446 /// ```
20447 pub fn builder() -> super::builder::zone_vm_extension_policies::ClientBuilder {
20448 crate::new_client_builder(super::builder::zone_vm_extension_policies::client::Factory)
20449 }
20450
20451 /// Creates a new client from the provided stub.
20452 ///
20453 /// The most common case for calling this function is in tests mocking the
20454 /// client's behavior.
20455 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20456 where
20457 T: super::stub::ZoneVmExtensionPolicies + 'static,
20458 {
20459 Self { inner: stub.into() }
20460 }
20461
20462 pub(crate) async fn new(
20463 config: gaxi::options::ClientConfig,
20464 ) -> crate::ClientBuilderResult<Self> {
20465 let inner = Self::build_inner(config).await?;
20466 Ok(Self { inner })
20467 }
20468
20469 async fn build_inner(
20470 conf: gaxi::options::ClientConfig,
20471 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ZoneVmExtensionPolicies>>
20472 {
20473 if gaxi::options::tracing_enabled(&conf) {
20474 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20475 }
20476 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20477 }
20478
20479 async fn build_transport(
20480 conf: gaxi::options::ClientConfig,
20481 ) -> crate::ClientBuilderResult<impl super::stub::ZoneVmExtensionPolicies> {
20482 super::transport::ZoneVmExtensionPolicies::new(conf).await
20483 }
20484
20485 async fn build_with_tracing(
20486 conf: gaxi::options::ClientConfig,
20487 ) -> crate::ClientBuilderResult<impl super::stub::ZoneVmExtensionPolicies> {
20488 Self::build_transport(conf)
20489 .await
20490 .map(super::tracing::ZoneVmExtensionPolicies::new)
20491 }
20492
20493 /// Deletes a specified zone VM extension policy within a project.
20494 pub fn delete(&self) -> super::builder::zone_vm_extension_policies::Delete {
20495 super::builder::zone_vm_extension_policies::Delete::new(self.inner.clone())
20496 }
20497
20498 /// Retrieves details of a specific zone VM extension policy within a project.
20499 pub fn get(&self) -> super::builder::zone_vm_extension_policies::Get {
20500 super::builder::zone_vm_extension_policies::Get::new(self.inner.clone())
20501 }
20502
20503 /// Creates a new zone-level VM extension policy within a project.
20504 pub fn insert(&self) -> super::builder::zone_vm_extension_policies::Insert {
20505 super::builder::zone_vm_extension_policies::Insert::new(self.inner.clone())
20506 }
20507
20508 /// Lists all VM extension policies within a specific zone for a project.
20509 pub fn list(&self) -> super::builder::zone_vm_extension_policies::List {
20510 super::builder::zone_vm_extension_policies::List::new(self.inner.clone())
20511 }
20512
20513 /// Modifies an existing zone VM extension policy within a project.
20514 pub fn update(&self) -> super::builder::zone_vm_extension_policies::Update {
20515 super::builder::zone_vm_extension_policies::Update::new(self.inner.clone())
20516 }
20517
20518 /// Retrieves the specified zone-specific Operations resource.
20519 pub fn get_operation(&self) -> super::builder::zone_vm_extension_policies::GetOperation {
20520 super::builder::zone_vm_extension_policies::GetOperation::new(self.inner.clone())
20521 }
20522}
20523
20524/// Implements a client for the Google Compute Engine API.
20525///
20526/// # Example
20527/// ```
20528/// # use google_cloud_compute_v1::client::Zones;
20529/// async fn sample(
20530/// ) -> anyhow::Result<()> {
20531/// let client = Zones::builder().build().await?;
20532/// // use `client` to make requests to the Google Compute Engine API.
20533/// Ok(())
20534/// }
20535/// ```
20536///
20537/// # Service Description
20538///
20539/// Service for the `zones` resource.
20540///
20541/// # Configuration
20542///
20543/// To configure `Zones` use the `with_*` methods in the type returned
20544/// by [builder()][Zones::builder]. The default configuration should
20545/// work for most applications. Common configuration changes include
20546///
20547/// * [with_endpoint()]: by default this client uses the global default endpoint
20548/// (`https://compute.googleapis.com`). Applications using regional
20549/// endpoints or running in restricted networks (e.g. a network configured
20550/// with [Private Google Access with VPC Service Controls]) may want to
20551/// override this default.
20552/// * [with_credentials()]: by default this client uses
20553/// [Application Default Credentials]. Applications using custom
20554/// authentication may need to override this default.
20555///
20556/// [with_endpoint()]: super::builder::zones::ClientBuilder::with_endpoint
20557/// [with_credentials()]: super::builder::zones::ClientBuilder::with_credentials
20558/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
20559/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
20560///
20561/// # Pooling and Cloning
20562///
20563/// `Zones` holds a connection pool internally, it is advised to
20564/// create one and reuse it. You do not need to wrap `Zones` in
20565/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
20566/// already uses an `Arc` internally.
20567#[cfg(feature = "zones")]
20568#[cfg_attr(docsrs, doc(cfg(feature = "zones")))]
20569#[derive(Clone, Debug)]
20570pub struct Zones {
20571 inner: std::sync::Arc<dyn super::stub::dynamic::Zones>,
20572}
20573
20574#[cfg(feature = "zones")]
20575impl Zones {
20576 /// Returns a builder for [Zones].
20577 ///
20578 /// ```
20579 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
20580 /// # use google_cloud_compute_v1::client::Zones;
20581 /// let client = Zones::builder().build().await?;
20582 /// # Ok(()) }
20583 /// ```
20584 pub fn builder() -> super::builder::zones::ClientBuilder {
20585 crate::new_client_builder(super::builder::zones::client::Factory)
20586 }
20587
20588 /// Creates a new client from the provided stub.
20589 ///
20590 /// The most common case for calling this function is in tests mocking the
20591 /// client's behavior.
20592 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
20593 where
20594 T: super::stub::Zones + 'static,
20595 {
20596 Self { inner: stub.into() }
20597 }
20598
20599 pub(crate) async fn new(
20600 config: gaxi::options::ClientConfig,
20601 ) -> crate::ClientBuilderResult<Self> {
20602 let inner = Self::build_inner(config).await?;
20603 Ok(Self { inner })
20604 }
20605
20606 async fn build_inner(
20607 conf: gaxi::options::ClientConfig,
20608 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::Zones>> {
20609 if gaxi::options::tracing_enabled(&conf) {
20610 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
20611 }
20612 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
20613 }
20614
20615 async fn build_transport(
20616 conf: gaxi::options::ClientConfig,
20617 ) -> crate::ClientBuilderResult<impl super::stub::Zones> {
20618 super::transport::Zones::new(conf).await
20619 }
20620
20621 async fn build_with_tracing(
20622 conf: gaxi::options::ClientConfig,
20623 ) -> crate::ClientBuilderResult<impl super::stub::Zones> {
20624 Self::build_transport(conf)
20625 .await
20626 .map(super::tracing::Zones::new)
20627 }
20628
20629 /// Returns the specified Zone resource.
20630 pub fn get(&self) -> super::builder::zones::Get {
20631 super::builder::zones::Get::new(self.inner.clone())
20632 }
20633
20634 /// Retrieves the list of Zone resources available to the specified project.
20635 pub fn list(&self) -> super::builder::zones::List {
20636 super::builder::zones::List::new(self.inner.clone())
20637 }
20638}