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/// # tokio_test::block_on(async {
25/// # use google_cloud_compute_v1::client::AcceleratorTypes;
26/// let client = AcceleratorTypes::builder().build().await?;
27/// // use `client` to make requests to the Google Compute Engine API.
28/// # gax::client_builder::Result::<()>::Ok(()) });
29/// ```
30///
31/// # Service Description
32///
33/// Service for the `acceleratorTypes` resource.
34///
35/// # Configuration
36///
37/// To configure `AcceleratorTypes` use the `with_*` methods in the type returned
38/// by [builder()][AcceleratorTypes::builder]. The default configuration should
39/// work for most applications. Common configuration changes include
40///
41/// * [with_endpoint()]: by default this client uses the global default endpoint
42/// (`https://compute.googleapis.com`). Applications using regional
43/// endpoints or running in restricted networks (e.g. a network configured
44// with [Private Google Access with VPC Service Controls]) may want to
45/// override this default.
46/// * [with_credentials()]: by default this client uses
47/// [Application Default Credentials]. Applications using custom
48/// authentication may need to override this default.
49///
50/// [with_endpoint()]: super::builder::accelerator_types::ClientBuilder::with_endpoint
51/// [with_credentials()]: super::builder::accelerator_types::ClientBuilder::credentials
52/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
53/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
54///
55/// # Pooling and Cloning
56///
57/// `AcceleratorTypes` holds a connection pool internally, it is advised to
58/// create one and the reuse it. You do not need to wrap `AcceleratorTypes` in
59/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
60/// already uses an `Arc` internally.
61#[cfg(feature = "accelerator-types")]
62#[cfg_attr(docsrs, doc(cfg(feature = "accelerator-types")))]
63#[derive(Clone, Debug)]
64pub struct AcceleratorTypes {
65 inner: std::sync::Arc<dyn super::stub::dynamic::AcceleratorTypes>,
66}
67
68#[cfg(feature = "accelerator-types")]
69impl AcceleratorTypes {
70 /// Returns a builder for [AcceleratorTypes].
71 ///
72 /// ```
73 /// # tokio_test::block_on(async {
74 /// # use google_cloud_compute_v1::client::AcceleratorTypes;
75 /// let client = AcceleratorTypes::builder().build().await?;
76 /// # gax::client_builder::Result::<()>::Ok(()) });
77 /// ```
78 pub fn builder() -> super::builder::accelerator_types::ClientBuilder {
79 gax::client_builder::internal::new_builder(
80 super::builder::accelerator_types::client::Factory,
81 )
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: T) -> Self
89 where
90 T: super::stub::AcceleratorTypes + 'static,
91 {
92 Self {
93 inner: std::sync::Arc::new(stub),
94 }
95 }
96
97 pub(crate) async fn new(
98 config: gaxi::options::ClientConfig,
99 ) -> gax::client_builder::Result<Self> {
100 let inner = Self::build_inner(config).await?;
101 Ok(Self { inner })
102 }
103
104 async fn build_inner(
105 conf: gaxi::options::ClientConfig,
106 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::AcceleratorTypes>>
107 {
108 if gaxi::options::tracing_enabled(&conf) {
109 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
110 }
111 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
112 }
113
114 async fn build_transport(
115 conf: gaxi::options::ClientConfig,
116 ) -> gax::client_builder::Result<impl super::stub::AcceleratorTypes> {
117 super::transport::AcceleratorTypes::new(conf).await
118 }
119
120 async fn build_with_tracing(
121 conf: gaxi::options::ClientConfig,
122 ) -> gax::client_builder::Result<impl super::stub::AcceleratorTypes> {
123 Self::build_transport(conf)
124 .await
125 .map(super::tracing::AcceleratorTypes::new)
126 }
127
128 /// Retrieves an aggregated list of accelerator types.
129 ///
130 /// To prevent failure, Google recommends that you set the
131 /// `returnPartialSuccess` parameter to `true`.
132 pub fn aggregated_list(&self) -> super::builder::accelerator_types::AggregatedList {
133 super::builder::accelerator_types::AggregatedList::new(self.inner.clone())
134 }
135
136 /// Returns the specified accelerator type.
137 pub fn get(&self) -> super::builder::accelerator_types::Get {
138 super::builder::accelerator_types::Get::new(self.inner.clone())
139 }
140
141 /// Retrieves a list of accelerator types that are available to the specified
142 /// project.
143 pub fn list(&self) -> super::builder::accelerator_types::List {
144 super::builder::accelerator_types::List::new(self.inner.clone())
145 }
146}
147
148/// Implements a client for the Google Compute Engine API.
149///
150/// # Example
151/// ```
152/// # tokio_test::block_on(async {
153/// # use google_cloud_compute_v1::client::Addresses;
154/// let client = Addresses::builder().build().await?;
155/// // use `client` to make requests to the Google Compute Engine API.
156/// # gax::client_builder::Result::<()>::Ok(()) });
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::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 the 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 /// # tokio_test::block_on(async {
202 /// # use google_cloud_compute_v1::client::Addresses;
203 /// let client = Addresses::builder().build().await?;
204 /// # gax::client_builder::Result::<()>::Ok(()) });
205 /// ```
206 pub fn builder() -> super::builder::addresses::ClientBuilder {
207 gax::client_builder::internal::new_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: T) -> Self
215 where
216 T: super::stub::Addresses + 'static,
217 {
218 Self {
219 inner: std::sync::Arc::new(stub),
220 }
221 }
222
223 pub(crate) async fn new(
224 config: gaxi::options::ClientConfig,
225 ) -> gax::client_builder::Result<Self> {
226 let inner = Self::build_inner(config).await?;
227 Ok(Self { inner })
228 }
229
230 async fn build_inner(
231 conf: gaxi::options::ClientConfig,
232 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Addresses>> {
233 if gaxi::options::tracing_enabled(&conf) {
234 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
235 }
236 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
237 }
238
239 async fn build_transport(
240 conf: gaxi::options::ClientConfig,
241 ) -> gax::client_builder::Result<impl super::stub::Addresses> {
242 super::transport::Addresses::new(conf).await
243 }
244
245 async fn build_with_tracing(
246 conf: gaxi::options::ClientConfig,
247 ) -> gax::client_builder::Result<impl super::stub::Addresses> {
248 Self::build_transport(conf)
249 .await
250 .map(super::tracing::Addresses::new)
251 }
252
253 /// Retrieves an aggregated list of addresses.
254 ///
255 /// To prevent failure, Google recommends that you set the
256 /// `returnPartialSuccess` parameter to `true`.
257 pub fn aggregated_list(&self) -> super::builder::addresses::AggregatedList {
258 super::builder::addresses::AggregatedList::new(self.inner.clone())
259 }
260
261 /// Deletes the specified address resource.
262 pub fn delete(&self) -> super::builder::addresses::Delete {
263 super::builder::addresses::Delete::new(self.inner.clone())
264 }
265
266 /// Returns the specified address resource.
267 pub fn get(&self) -> super::builder::addresses::Get {
268 super::builder::addresses::Get::new(self.inner.clone())
269 }
270
271 /// Creates an address resource in the specified project by using the data
272 /// included in the request.
273 pub fn insert(&self) -> super::builder::addresses::Insert {
274 super::builder::addresses::Insert::new(self.inner.clone())
275 }
276
277 /// Retrieves a list of addresses contained within
278 /// the specified region.
279 pub fn list(&self) -> super::builder::addresses::List {
280 super::builder::addresses::List::new(self.inner.clone())
281 }
282
283 /// Moves the specified address resource.
284 pub fn r#move(&self) -> super::builder::addresses::Move {
285 super::builder::addresses::Move::new(self.inner.clone())
286 }
287
288 /// Sets the labels on an Address. To learn more about labels, read theLabeling
289 /// Resources documentation.
290 pub fn set_labels(&self) -> super::builder::addresses::SetLabels {
291 super::builder::addresses::SetLabels::new(self.inner.clone())
292 }
293
294 /// Returns permissions that a caller has on the specified resource.
295 pub fn test_iam_permissions(&self) -> super::builder::addresses::TestIamPermissions {
296 super::builder::addresses::TestIamPermissions::new(self.inner.clone())
297 }
298
299 /// Retrieves the specified region-specific Operations resource.
300 pub fn get_operation(&self) -> super::builder::addresses::GetOperation {
301 super::builder::addresses::GetOperation::new(self.inner.clone())
302 }
303}
304
305/// Implements a client for the Google Compute Engine API.
306///
307/// # Example
308/// ```
309/// # tokio_test::block_on(async {
310/// # use google_cloud_compute_v1::client::Autoscalers;
311/// let client = Autoscalers::builder().build().await?;
312/// // use `client` to make requests to the Google Compute Engine API.
313/// # gax::client_builder::Result::<()>::Ok(()) });
314/// ```
315///
316/// # Service Description
317///
318/// Service for the `autoscalers` resource.
319///
320/// # Configuration
321///
322/// To configure `Autoscalers` use the `with_*` methods in the type returned
323/// by [builder()][Autoscalers::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::autoscalers::ClientBuilder::with_endpoint
336/// [with_credentials()]: super::builder::autoscalers::ClientBuilder::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/// `Autoscalers` holds a connection pool internally, it is advised to
343/// create one and the reuse it. You do not need to wrap `Autoscalers` 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 = "autoscalers")]
347#[cfg_attr(docsrs, doc(cfg(feature = "autoscalers")))]
348#[derive(Clone, Debug)]
349pub struct Autoscalers {
350 inner: std::sync::Arc<dyn super::stub::dynamic::Autoscalers>,
351}
352
353#[cfg(feature = "autoscalers")]
354impl Autoscalers {
355 /// Returns a builder for [Autoscalers].
356 ///
357 /// ```
358 /// # tokio_test::block_on(async {
359 /// # use google_cloud_compute_v1::client::Autoscalers;
360 /// let client = Autoscalers::builder().build().await?;
361 /// # gax::client_builder::Result::<()>::Ok(()) });
362 /// ```
363 pub fn builder() -> super::builder::autoscalers::ClientBuilder {
364 gax::client_builder::internal::new_builder(super::builder::autoscalers::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: T) -> Self
372 where
373 T: super::stub::Autoscalers + 'static,
374 {
375 Self {
376 inner: std::sync::Arc::new(stub),
377 }
378 }
379
380 pub(crate) async fn new(
381 config: gaxi::options::ClientConfig,
382 ) -> gax::client_builder::Result<Self> {
383 let inner = Self::build_inner(config).await?;
384 Ok(Self { inner })
385 }
386
387 async fn build_inner(
388 conf: gaxi::options::ClientConfig,
389 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Autoscalers>> {
390 if gaxi::options::tracing_enabled(&conf) {
391 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
392 }
393 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
394 }
395
396 async fn build_transport(
397 conf: gaxi::options::ClientConfig,
398 ) -> gax::client_builder::Result<impl super::stub::Autoscalers> {
399 super::transport::Autoscalers::new(conf).await
400 }
401
402 async fn build_with_tracing(
403 conf: gaxi::options::ClientConfig,
404 ) -> gax::client_builder::Result<impl super::stub::Autoscalers> {
405 Self::build_transport(conf)
406 .await
407 .map(super::tracing::Autoscalers::new)
408 }
409
410 /// Retrieves an aggregated list of autoscalers.
411 ///
412 /// To prevent failure, Google recommends that you set the
413 /// `returnPartialSuccess` parameter to `true`.
414 pub fn aggregated_list(&self) -> super::builder::autoscalers::AggregatedList {
415 super::builder::autoscalers::AggregatedList::new(self.inner.clone())
416 }
417
418 /// Deletes the specified autoscaler.
419 pub fn delete(&self) -> super::builder::autoscalers::Delete {
420 super::builder::autoscalers::Delete::new(self.inner.clone())
421 }
422
423 /// Returns the specified autoscaler resource.
424 pub fn get(&self) -> super::builder::autoscalers::Get {
425 super::builder::autoscalers::Get::new(self.inner.clone())
426 }
427
428 /// Creates an autoscaler in the specified project using the data
429 /// included in the request.
430 pub fn insert(&self) -> super::builder::autoscalers::Insert {
431 super::builder::autoscalers::Insert::new(self.inner.clone())
432 }
433
434 /// Retrieves a list of autoscalers contained within
435 /// the specified zone.
436 pub fn list(&self) -> super::builder::autoscalers::List {
437 super::builder::autoscalers::List::new(self.inner.clone())
438 }
439
440 /// Updates an autoscaler in the specified project using the data
441 /// included in the request. This method supportsPATCH
442 /// semantics and uses theJSON merge
443 /// patch format and processing rules.
444 pub fn patch(&self) -> super::builder::autoscalers::Patch {
445 super::builder::autoscalers::Patch::new(self.inner.clone())
446 }
447
448 /// Updates an autoscaler in the specified project using the data
449 /// included in the request.
450 pub fn update(&self) -> super::builder::autoscalers::Update {
451 super::builder::autoscalers::Update::new(self.inner.clone())
452 }
453
454 /// Retrieves the specified zone-specific Operations resource.
455 pub fn get_operation(&self) -> super::builder::autoscalers::GetOperation {
456 super::builder::autoscalers::GetOperation::new(self.inner.clone())
457 }
458}
459
460/// Implements a client for the Google Compute Engine API.
461///
462/// # Example
463/// ```
464/// # tokio_test::block_on(async {
465/// # use google_cloud_compute_v1::client::BackendBuckets;
466/// let client = BackendBuckets::builder().build().await?;
467/// // use `client` to make requests to the Google Compute Engine API.
468/// # gax::client_builder::Result::<()>::Ok(()) });
469/// ```
470///
471/// # Service Description
472///
473/// Service for the `backendBuckets` resource.
474///
475/// # Configuration
476///
477/// To configure `BackendBuckets` use the `with_*` methods in the type returned
478/// by [builder()][BackendBuckets::builder]. The default configuration should
479/// work for most applications. Common configuration changes include
480///
481/// * [with_endpoint()]: by default this client uses the global default endpoint
482/// (`https://compute.googleapis.com`). Applications using regional
483/// endpoints or running in restricted networks (e.g. a network configured
484// with [Private Google Access with VPC Service Controls]) may want to
485/// override this default.
486/// * [with_credentials()]: by default this client uses
487/// [Application Default Credentials]. Applications using custom
488/// authentication may need to override this default.
489///
490/// [with_endpoint()]: super::builder::backend_buckets::ClientBuilder::with_endpoint
491/// [with_credentials()]: super::builder::backend_buckets::ClientBuilder::credentials
492/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
493/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
494///
495/// # Pooling and Cloning
496///
497/// `BackendBuckets` holds a connection pool internally, it is advised to
498/// create one and the reuse it. You do not need to wrap `BackendBuckets` in
499/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
500/// already uses an `Arc` internally.
501#[cfg(feature = "backend-buckets")]
502#[cfg_attr(docsrs, doc(cfg(feature = "backend-buckets")))]
503#[derive(Clone, Debug)]
504pub struct BackendBuckets {
505 inner: std::sync::Arc<dyn super::stub::dynamic::BackendBuckets>,
506}
507
508#[cfg(feature = "backend-buckets")]
509impl BackendBuckets {
510 /// Returns a builder for [BackendBuckets].
511 ///
512 /// ```
513 /// # tokio_test::block_on(async {
514 /// # use google_cloud_compute_v1::client::BackendBuckets;
515 /// let client = BackendBuckets::builder().build().await?;
516 /// # gax::client_builder::Result::<()>::Ok(()) });
517 /// ```
518 pub fn builder() -> super::builder::backend_buckets::ClientBuilder {
519 gax::client_builder::internal::new_builder(super::builder::backend_buckets::client::Factory)
520 }
521
522 /// Creates a new client from the provided stub.
523 ///
524 /// The most common case for calling this function is in tests mocking the
525 /// client's behavior.
526 pub fn from_stub<T>(stub: T) -> Self
527 where
528 T: super::stub::BackendBuckets + 'static,
529 {
530 Self {
531 inner: std::sync::Arc::new(stub),
532 }
533 }
534
535 pub(crate) async fn new(
536 config: gaxi::options::ClientConfig,
537 ) -> gax::client_builder::Result<Self> {
538 let inner = Self::build_inner(config).await?;
539 Ok(Self { inner })
540 }
541
542 async fn build_inner(
543 conf: gaxi::options::ClientConfig,
544 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::BackendBuckets>> {
545 if gaxi::options::tracing_enabled(&conf) {
546 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
547 }
548 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
549 }
550
551 async fn build_transport(
552 conf: gaxi::options::ClientConfig,
553 ) -> gax::client_builder::Result<impl super::stub::BackendBuckets> {
554 super::transport::BackendBuckets::new(conf).await
555 }
556
557 async fn build_with_tracing(
558 conf: gaxi::options::ClientConfig,
559 ) -> gax::client_builder::Result<impl super::stub::BackendBuckets> {
560 Self::build_transport(conf)
561 .await
562 .map(super::tracing::BackendBuckets::new)
563 }
564
565 /// Adds a key for validating requests with signed URLs for this backend
566 /// bucket.
567 pub fn add_signed_url_key(&self) -> super::builder::backend_buckets::AddSignedUrlKey {
568 super::builder::backend_buckets::AddSignedUrlKey::new(self.inner.clone())
569 }
570
571 /// Deletes the specified BackendBucket resource.
572 pub fn delete(&self) -> super::builder::backend_buckets::Delete {
573 super::builder::backend_buckets::Delete::new(self.inner.clone())
574 }
575
576 /// Deletes a key for validating requests with signed URLs for this backend
577 /// bucket.
578 pub fn delete_signed_url_key(&self) -> super::builder::backend_buckets::DeleteSignedUrlKey {
579 super::builder::backend_buckets::DeleteSignedUrlKey::new(self.inner.clone())
580 }
581
582 /// Returns the specified BackendBucket resource.
583 pub fn get(&self) -> super::builder::backend_buckets::Get {
584 super::builder::backend_buckets::Get::new(self.inner.clone())
585 }
586
587 /// Gets the access control policy for a resource. May be empty if no such
588 /// policy or resource exists.
589 pub fn get_iam_policy(&self) -> super::builder::backend_buckets::GetIamPolicy {
590 super::builder::backend_buckets::GetIamPolicy::new(self.inner.clone())
591 }
592
593 /// Creates a BackendBucket resource in the specified project using
594 /// the data included in the request.
595 pub fn insert(&self) -> super::builder::backend_buckets::Insert {
596 super::builder::backend_buckets::Insert::new(self.inner.clone())
597 }
598
599 /// Retrieves the list of BackendBucket resources available to the specified
600 /// project.
601 pub fn list(&self) -> super::builder::backend_buckets::List {
602 super::builder::backend_buckets::List::new(self.inner.clone())
603 }
604
605 /// Updates the specified BackendBucket resource with the data included in the
606 /// request. This method supportsPATCH
607 /// semantics and uses theJSON merge
608 /// patch format and processing rules.
609 pub fn patch(&self) -> super::builder::backend_buckets::Patch {
610 super::builder::backend_buckets::Patch::new(self.inner.clone())
611 }
612
613 /// Sets the edge security policy for the specified backend bucket.
614 pub fn set_edge_security_policy(
615 &self,
616 ) -> super::builder::backend_buckets::SetEdgeSecurityPolicy {
617 super::builder::backend_buckets::SetEdgeSecurityPolicy::new(self.inner.clone())
618 }
619
620 /// Sets the access control policy on the specified resource.
621 /// Replaces any existing policy.
622 pub fn set_iam_policy(&self) -> super::builder::backend_buckets::SetIamPolicy {
623 super::builder::backend_buckets::SetIamPolicy::new(self.inner.clone())
624 }
625
626 /// Returns permissions that a caller has on the specified resource.
627 pub fn test_iam_permissions(&self) -> super::builder::backend_buckets::TestIamPermissions {
628 super::builder::backend_buckets::TestIamPermissions::new(self.inner.clone())
629 }
630
631 /// Updates the specified BackendBucket resource with the data included in the
632 /// request.
633 pub fn update(&self) -> super::builder::backend_buckets::Update {
634 super::builder::backend_buckets::Update::new(self.inner.clone())
635 }
636
637 /// Retrieves the specified Operations resource.
638 pub fn get_operation(&self) -> super::builder::backend_buckets::GetOperation {
639 super::builder::backend_buckets::GetOperation::new(self.inner.clone())
640 }
641}
642
643/// Implements a client for the Google Compute Engine API.
644///
645/// # Example
646/// ```
647/// # tokio_test::block_on(async {
648/// # use google_cloud_compute_v1::client::BackendServices;
649/// let client = BackendServices::builder().build().await?;
650/// // use `client` to make requests to the Google Compute Engine API.
651/// # gax::client_builder::Result::<()>::Ok(()) });
652/// ```
653///
654/// # Service Description
655///
656/// Service for the `backendServices` resource.
657///
658/// # Configuration
659///
660/// To configure `BackendServices` use the `with_*` methods in the type returned
661/// by [builder()][BackendServices::builder]. The default configuration should
662/// work for most applications. Common configuration changes include
663///
664/// * [with_endpoint()]: by default this client uses the global default endpoint
665/// (`https://compute.googleapis.com`). Applications using regional
666/// endpoints or running in restricted networks (e.g. a network configured
667// with [Private Google Access with VPC Service Controls]) may want to
668/// override this default.
669/// * [with_credentials()]: by default this client uses
670/// [Application Default Credentials]. Applications using custom
671/// authentication may need to override this default.
672///
673/// [with_endpoint()]: super::builder::backend_services::ClientBuilder::with_endpoint
674/// [with_credentials()]: super::builder::backend_services::ClientBuilder::credentials
675/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
676/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
677///
678/// # Pooling and Cloning
679///
680/// `BackendServices` holds a connection pool internally, it is advised to
681/// create one and the reuse it. You do not need to wrap `BackendServices` in
682/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
683/// already uses an `Arc` internally.
684#[cfg(feature = "backend-services")]
685#[cfg_attr(docsrs, doc(cfg(feature = "backend-services")))]
686#[derive(Clone, Debug)]
687pub struct BackendServices {
688 inner: std::sync::Arc<dyn super::stub::dynamic::BackendServices>,
689}
690
691#[cfg(feature = "backend-services")]
692impl BackendServices {
693 /// Returns a builder for [BackendServices].
694 ///
695 /// ```
696 /// # tokio_test::block_on(async {
697 /// # use google_cloud_compute_v1::client::BackendServices;
698 /// let client = BackendServices::builder().build().await?;
699 /// # gax::client_builder::Result::<()>::Ok(()) });
700 /// ```
701 pub fn builder() -> super::builder::backend_services::ClientBuilder {
702 gax::client_builder::internal::new_builder(
703 super::builder::backend_services::client::Factory,
704 )
705 }
706
707 /// Creates a new client from the provided stub.
708 ///
709 /// The most common case for calling this function is in tests mocking the
710 /// client's behavior.
711 pub fn from_stub<T>(stub: T) -> Self
712 where
713 T: super::stub::BackendServices + 'static,
714 {
715 Self {
716 inner: std::sync::Arc::new(stub),
717 }
718 }
719
720 pub(crate) async fn new(
721 config: gaxi::options::ClientConfig,
722 ) -> gax::client_builder::Result<Self> {
723 let inner = Self::build_inner(config).await?;
724 Ok(Self { inner })
725 }
726
727 async fn build_inner(
728 conf: gaxi::options::ClientConfig,
729 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::BackendServices>>
730 {
731 if gaxi::options::tracing_enabled(&conf) {
732 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
733 }
734 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
735 }
736
737 async fn build_transport(
738 conf: gaxi::options::ClientConfig,
739 ) -> gax::client_builder::Result<impl super::stub::BackendServices> {
740 super::transport::BackendServices::new(conf).await
741 }
742
743 async fn build_with_tracing(
744 conf: gaxi::options::ClientConfig,
745 ) -> gax::client_builder::Result<impl super::stub::BackendServices> {
746 Self::build_transport(conf)
747 .await
748 .map(super::tracing::BackendServices::new)
749 }
750
751 /// Adds a key for validating requests with signed URLs for this backend
752 /// service.
753 pub fn add_signed_url_key(&self) -> super::builder::backend_services::AddSignedUrlKey {
754 super::builder::backend_services::AddSignedUrlKey::new(self.inner.clone())
755 }
756
757 /// Retrieves the list of all BackendService resources, regional and global,
758 /// available to the specified project.
759 ///
760 /// To prevent failure, Google recommends that you set the
761 /// `returnPartialSuccess` parameter to `true`.
762 pub fn aggregated_list(&self) -> super::builder::backend_services::AggregatedList {
763 super::builder::backend_services::AggregatedList::new(self.inner.clone())
764 }
765
766 /// Deletes the specified BackendService resource.
767 pub fn delete(&self) -> super::builder::backend_services::Delete {
768 super::builder::backend_services::Delete::new(self.inner.clone())
769 }
770
771 /// Deletes a key for validating requests with signed URLs for this backend
772 /// service.
773 pub fn delete_signed_url_key(&self) -> super::builder::backend_services::DeleteSignedUrlKey {
774 super::builder::backend_services::DeleteSignedUrlKey::new(self.inner.clone())
775 }
776
777 /// Returns the specified BackendService resource.
778 pub fn get(&self) -> super::builder::backend_services::Get {
779 super::builder::backend_services::Get::new(self.inner.clone())
780 }
781
782 /// Returns effective security policies applied to this backend service.
783 pub fn get_effective_security_policies(
784 &self,
785 ) -> super::builder::backend_services::GetEffectiveSecurityPolicies {
786 super::builder::backend_services::GetEffectiveSecurityPolicies::new(self.inner.clone())
787 }
788
789 /// Gets the most recent health check results for this
790 /// BackendService.
791 ///
792 /// Example request body:
793 ///
794 /// {
795 /// "group": "/zones/us-east1-b/instanceGroups/lb-backend-example"
796 /// }
797 pub fn get_health(&self) -> super::builder::backend_services::GetHealth {
798 super::builder::backend_services::GetHealth::new(self.inner.clone())
799 }
800
801 /// Gets the access control policy for a resource. May be empty if no such
802 /// policy or resource exists.
803 pub fn get_iam_policy(&self) -> super::builder::backend_services::GetIamPolicy {
804 super::builder::backend_services::GetIamPolicy::new(self.inner.clone())
805 }
806
807 /// Creates a BackendService resource in the specified project using
808 /// the data included in the request. For more information, see
809 /// Backend services overview.
810 pub fn insert(&self) -> super::builder::backend_services::Insert {
811 super::builder::backend_services::Insert::new(self.inner.clone())
812 }
813
814 /// Retrieves the list of BackendService resources available to the specified
815 /// project.
816 pub fn list(&self) -> super::builder::backend_services::List {
817 super::builder::backend_services::List::new(self.inner.clone())
818 }
819
820 /// Retrieves a list of all usable backend services in the specified project.
821 pub fn list_usable(&self) -> super::builder::backend_services::ListUsable {
822 super::builder::backend_services::ListUsable::new(self.inner.clone())
823 }
824
825 /// Patches the specified BackendService resource with the data included in the
826 /// request. For more information, see
827 /// Backend services overview. This method
828 /// supports PATCH semantics and uses the JSON merge
829 /// patch format and processing rules.
830 pub fn patch(&self) -> super::builder::backend_services::Patch {
831 super::builder::backend_services::Patch::new(self.inner.clone())
832 }
833
834 /// Sets the edge security policy for the specified backend service.
835 pub fn set_edge_security_policy(
836 &self,
837 ) -> super::builder::backend_services::SetEdgeSecurityPolicy {
838 super::builder::backend_services::SetEdgeSecurityPolicy::new(self.inner.clone())
839 }
840
841 /// Sets the access control policy on the specified resource.
842 /// Replaces any existing policy.
843 pub fn set_iam_policy(&self) -> super::builder::backend_services::SetIamPolicy {
844 super::builder::backend_services::SetIamPolicy::new(self.inner.clone())
845 }
846
847 /// Sets the Google Cloud Armor security policy for the specified backend
848 /// service. For more information, seeGoogle
849 /// Cloud Armor Overview
850 pub fn set_security_policy(&self) -> super::builder::backend_services::SetSecurityPolicy {
851 super::builder::backend_services::SetSecurityPolicy::new(self.inner.clone())
852 }
853
854 /// Returns permissions that a caller has on the specified resource.
855 pub fn test_iam_permissions(&self) -> super::builder::backend_services::TestIamPermissions {
856 super::builder::backend_services::TestIamPermissions::new(self.inner.clone())
857 }
858
859 /// Updates the specified BackendService resource with the data included in the
860 /// request. For more information, seeBackend
861 /// services overview.
862 pub fn update(&self) -> super::builder::backend_services::Update {
863 super::builder::backend_services::Update::new(self.inner.clone())
864 }
865
866 /// Retrieves the specified Operations resource.
867 pub fn get_operation(&self) -> super::builder::backend_services::GetOperation {
868 super::builder::backend_services::GetOperation::new(self.inner.clone())
869 }
870}
871
872/// Implements a client for the Google Compute Engine API.
873///
874/// # Example
875/// ```
876/// # tokio_test::block_on(async {
877/// # use google_cloud_compute_v1::client::CrossSiteNetworks;
878/// let client = CrossSiteNetworks::builder().build().await?;
879/// // use `client` to make requests to the Google Compute Engine API.
880/// # gax::client_builder::Result::<()>::Ok(()) });
881/// ```
882///
883/// # Service Description
884///
885/// Service for the `crossSiteNetworks` resource.
886///
887/// # Configuration
888///
889/// To configure `CrossSiteNetworks` use the `with_*` methods in the type returned
890/// by [builder()][CrossSiteNetworks::builder]. The default configuration should
891/// work for most applications. Common configuration changes include
892///
893/// * [with_endpoint()]: by default this client uses the global default endpoint
894/// (`https://compute.googleapis.com`). Applications using regional
895/// endpoints or running in restricted networks (e.g. a network configured
896// with [Private Google Access with VPC Service Controls]) may want to
897/// override this default.
898/// * [with_credentials()]: by default this client uses
899/// [Application Default Credentials]. Applications using custom
900/// authentication may need to override this default.
901///
902/// [with_endpoint()]: super::builder::cross_site_networks::ClientBuilder::with_endpoint
903/// [with_credentials()]: super::builder::cross_site_networks::ClientBuilder::credentials
904/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
905/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
906///
907/// # Pooling and Cloning
908///
909/// `CrossSiteNetworks` holds a connection pool internally, it is advised to
910/// create one and the reuse it. You do not need to wrap `CrossSiteNetworks` in
911/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
912/// already uses an `Arc` internally.
913#[cfg(feature = "cross-site-networks")]
914#[cfg_attr(docsrs, doc(cfg(feature = "cross-site-networks")))]
915#[derive(Clone, Debug)]
916pub struct CrossSiteNetworks {
917 inner: std::sync::Arc<dyn super::stub::dynamic::CrossSiteNetworks>,
918}
919
920#[cfg(feature = "cross-site-networks")]
921impl CrossSiteNetworks {
922 /// Returns a builder for [CrossSiteNetworks].
923 ///
924 /// ```
925 /// # tokio_test::block_on(async {
926 /// # use google_cloud_compute_v1::client::CrossSiteNetworks;
927 /// let client = CrossSiteNetworks::builder().build().await?;
928 /// # gax::client_builder::Result::<()>::Ok(()) });
929 /// ```
930 pub fn builder() -> super::builder::cross_site_networks::ClientBuilder {
931 gax::client_builder::internal::new_builder(
932 super::builder::cross_site_networks::client::Factory,
933 )
934 }
935
936 /// Creates a new client from the provided stub.
937 ///
938 /// The most common case for calling this function is in tests mocking the
939 /// client's behavior.
940 pub fn from_stub<T>(stub: T) -> Self
941 where
942 T: super::stub::CrossSiteNetworks + 'static,
943 {
944 Self {
945 inner: std::sync::Arc::new(stub),
946 }
947 }
948
949 pub(crate) async fn new(
950 config: gaxi::options::ClientConfig,
951 ) -> gax::client_builder::Result<Self> {
952 let inner = Self::build_inner(config).await?;
953 Ok(Self { inner })
954 }
955
956 async fn build_inner(
957 conf: gaxi::options::ClientConfig,
958 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::CrossSiteNetworks>>
959 {
960 if gaxi::options::tracing_enabled(&conf) {
961 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
962 }
963 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
964 }
965
966 async fn build_transport(
967 conf: gaxi::options::ClientConfig,
968 ) -> gax::client_builder::Result<impl super::stub::CrossSiteNetworks> {
969 super::transport::CrossSiteNetworks::new(conf).await
970 }
971
972 async fn build_with_tracing(
973 conf: gaxi::options::ClientConfig,
974 ) -> gax::client_builder::Result<impl super::stub::CrossSiteNetworks> {
975 Self::build_transport(conf)
976 .await
977 .map(super::tracing::CrossSiteNetworks::new)
978 }
979
980 /// Deletes the specified cross-site network in the given scope.
981 pub fn delete(&self) -> super::builder::cross_site_networks::Delete {
982 super::builder::cross_site_networks::Delete::new(self.inner.clone())
983 }
984
985 /// Returns the specified cross-site network in the given scope.
986 pub fn get(&self) -> super::builder::cross_site_networks::Get {
987 super::builder::cross_site_networks::Get::new(self.inner.clone())
988 }
989
990 /// Creates a cross-site network in the specified project in the given scope
991 /// using the parameters that are included in the request.
992 pub fn insert(&self) -> super::builder::cross_site_networks::Insert {
993 super::builder::cross_site_networks::Insert::new(self.inner.clone())
994 }
995
996 /// Lists the cross-site networks for a project in the given scope.
997 pub fn list(&self) -> super::builder::cross_site_networks::List {
998 super::builder::cross_site_networks::List::new(self.inner.clone())
999 }
1000
1001 /// Updates the specified cross-site network with the data included in
1002 /// the request. This method supportsPATCH
1003 /// semantics and uses theJSON merge
1004 /// patch format and processing rules.
1005 pub fn patch(&self) -> super::builder::cross_site_networks::Patch {
1006 super::builder::cross_site_networks::Patch::new(self.inner.clone())
1007 }
1008
1009 /// Retrieves the specified Operations resource.
1010 pub fn get_operation(&self) -> super::builder::cross_site_networks::GetOperation {
1011 super::builder::cross_site_networks::GetOperation::new(self.inner.clone())
1012 }
1013}
1014
1015/// Implements a client for the Google Compute Engine API.
1016///
1017/// # Example
1018/// ```
1019/// # tokio_test::block_on(async {
1020/// # use google_cloud_compute_v1::client::DiskTypes;
1021/// let client = DiskTypes::builder().build().await?;
1022/// // use `client` to make requests to the Google Compute Engine API.
1023/// # gax::client_builder::Result::<()>::Ok(()) });
1024/// ```
1025///
1026/// # Service Description
1027///
1028/// Service for the `diskTypes` resource.
1029///
1030/// # Configuration
1031///
1032/// To configure `DiskTypes` use the `with_*` methods in the type returned
1033/// by [builder()][DiskTypes::builder]. The default configuration should
1034/// work for most applications. Common configuration changes include
1035///
1036/// * [with_endpoint()]: by default this client uses the global default endpoint
1037/// (`https://compute.googleapis.com`). Applications using regional
1038/// endpoints or running in restricted networks (e.g. a network configured
1039// with [Private Google Access with VPC Service Controls]) may want to
1040/// override this default.
1041/// * [with_credentials()]: by default this client uses
1042/// [Application Default Credentials]. Applications using custom
1043/// authentication may need to override this default.
1044///
1045/// [with_endpoint()]: super::builder::disk_types::ClientBuilder::with_endpoint
1046/// [with_credentials()]: super::builder::disk_types::ClientBuilder::credentials
1047/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1048/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1049///
1050/// # Pooling and Cloning
1051///
1052/// `DiskTypes` holds a connection pool internally, it is advised to
1053/// create one and the reuse it. You do not need to wrap `DiskTypes` in
1054/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1055/// already uses an `Arc` internally.
1056#[cfg(feature = "disk-types")]
1057#[cfg_attr(docsrs, doc(cfg(feature = "disk-types")))]
1058#[derive(Clone, Debug)]
1059pub struct DiskTypes {
1060 inner: std::sync::Arc<dyn super::stub::dynamic::DiskTypes>,
1061}
1062
1063#[cfg(feature = "disk-types")]
1064impl DiskTypes {
1065 /// Returns a builder for [DiskTypes].
1066 ///
1067 /// ```
1068 /// # tokio_test::block_on(async {
1069 /// # use google_cloud_compute_v1::client::DiskTypes;
1070 /// let client = DiskTypes::builder().build().await?;
1071 /// # gax::client_builder::Result::<()>::Ok(()) });
1072 /// ```
1073 pub fn builder() -> super::builder::disk_types::ClientBuilder {
1074 gax::client_builder::internal::new_builder(super::builder::disk_types::client::Factory)
1075 }
1076
1077 /// Creates a new client from the provided stub.
1078 ///
1079 /// The most common case for calling this function is in tests mocking the
1080 /// client's behavior.
1081 pub fn from_stub<T>(stub: T) -> Self
1082 where
1083 T: super::stub::DiskTypes + 'static,
1084 {
1085 Self {
1086 inner: std::sync::Arc::new(stub),
1087 }
1088 }
1089
1090 pub(crate) async fn new(
1091 config: gaxi::options::ClientConfig,
1092 ) -> gax::client_builder::Result<Self> {
1093 let inner = Self::build_inner(config).await?;
1094 Ok(Self { inner })
1095 }
1096
1097 async fn build_inner(
1098 conf: gaxi::options::ClientConfig,
1099 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::DiskTypes>> {
1100 if gaxi::options::tracing_enabled(&conf) {
1101 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1102 }
1103 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1104 }
1105
1106 async fn build_transport(
1107 conf: gaxi::options::ClientConfig,
1108 ) -> gax::client_builder::Result<impl super::stub::DiskTypes> {
1109 super::transport::DiskTypes::new(conf).await
1110 }
1111
1112 async fn build_with_tracing(
1113 conf: gaxi::options::ClientConfig,
1114 ) -> gax::client_builder::Result<impl super::stub::DiskTypes> {
1115 Self::build_transport(conf)
1116 .await
1117 .map(super::tracing::DiskTypes::new)
1118 }
1119
1120 /// Retrieves an aggregated list of disk types.
1121 ///
1122 /// To prevent failure, Google recommends that you set the
1123 /// `returnPartialSuccess` parameter to `true`.
1124 pub fn aggregated_list(&self) -> super::builder::disk_types::AggregatedList {
1125 super::builder::disk_types::AggregatedList::new(self.inner.clone())
1126 }
1127
1128 /// Returns the specified disk type.
1129 pub fn get(&self) -> super::builder::disk_types::Get {
1130 super::builder::disk_types::Get::new(self.inner.clone())
1131 }
1132
1133 /// Retrieves a list of disk types available to the specified
1134 /// project.
1135 pub fn list(&self) -> super::builder::disk_types::List {
1136 super::builder::disk_types::List::new(self.inner.clone())
1137 }
1138}
1139
1140/// Implements a client for the Google Compute Engine API.
1141///
1142/// # Example
1143/// ```
1144/// # tokio_test::block_on(async {
1145/// # use google_cloud_compute_v1::client::Disks;
1146/// let client = Disks::builder().build().await?;
1147/// // use `client` to make requests to the Google Compute Engine API.
1148/// # gax::client_builder::Result::<()>::Ok(()) });
1149/// ```
1150///
1151/// # Service Description
1152///
1153/// Service for the `disks` resource.
1154///
1155/// # Configuration
1156///
1157/// To configure `Disks` use the `with_*` methods in the type returned
1158/// by [builder()][Disks::builder]. The default configuration should
1159/// work for most applications. Common configuration changes include
1160///
1161/// * [with_endpoint()]: by default this client uses the global default endpoint
1162/// (`https://compute.googleapis.com`). Applications using regional
1163/// endpoints or running in restricted networks (e.g. a network configured
1164// with [Private Google Access with VPC Service Controls]) may want to
1165/// override this default.
1166/// * [with_credentials()]: by default this client uses
1167/// [Application Default Credentials]. Applications using custom
1168/// authentication may need to override this default.
1169///
1170/// [with_endpoint()]: super::builder::disks::ClientBuilder::with_endpoint
1171/// [with_credentials()]: super::builder::disks::ClientBuilder::credentials
1172/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1173/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1174///
1175/// # Pooling and Cloning
1176///
1177/// `Disks` holds a connection pool internally, it is advised to
1178/// create one and the reuse it. You do not need to wrap `Disks` in
1179/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1180/// already uses an `Arc` internally.
1181#[cfg(feature = "disks")]
1182#[cfg_attr(docsrs, doc(cfg(feature = "disks")))]
1183#[derive(Clone, Debug)]
1184pub struct Disks {
1185 inner: std::sync::Arc<dyn super::stub::dynamic::Disks>,
1186}
1187
1188#[cfg(feature = "disks")]
1189impl Disks {
1190 /// Returns a builder for [Disks].
1191 ///
1192 /// ```
1193 /// # tokio_test::block_on(async {
1194 /// # use google_cloud_compute_v1::client::Disks;
1195 /// let client = Disks::builder().build().await?;
1196 /// # gax::client_builder::Result::<()>::Ok(()) });
1197 /// ```
1198 pub fn builder() -> super::builder::disks::ClientBuilder {
1199 gax::client_builder::internal::new_builder(super::builder::disks::client::Factory)
1200 }
1201
1202 /// Creates a new client from the provided stub.
1203 ///
1204 /// The most common case for calling this function is in tests mocking the
1205 /// client's behavior.
1206 pub fn from_stub<T>(stub: T) -> Self
1207 where
1208 T: super::stub::Disks + 'static,
1209 {
1210 Self {
1211 inner: std::sync::Arc::new(stub),
1212 }
1213 }
1214
1215 pub(crate) async fn new(
1216 config: gaxi::options::ClientConfig,
1217 ) -> gax::client_builder::Result<Self> {
1218 let inner = Self::build_inner(config).await?;
1219 Ok(Self { inner })
1220 }
1221
1222 async fn build_inner(
1223 conf: gaxi::options::ClientConfig,
1224 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Disks>> {
1225 if gaxi::options::tracing_enabled(&conf) {
1226 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1227 }
1228 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1229 }
1230
1231 async fn build_transport(
1232 conf: gaxi::options::ClientConfig,
1233 ) -> gax::client_builder::Result<impl super::stub::Disks> {
1234 super::transport::Disks::new(conf).await
1235 }
1236
1237 async fn build_with_tracing(
1238 conf: gaxi::options::ClientConfig,
1239 ) -> gax::client_builder::Result<impl super::stub::Disks> {
1240 Self::build_transport(conf)
1241 .await
1242 .map(super::tracing::Disks::new)
1243 }
1244
1245 /// Adds existing resource policies to a disk. You can only add one
1246 /// policy which will be applied to this disk for scheduling snapshot
1247 /// creation.
1248 pub fn add_resource_policies(&self) -> super::builder::disks::AddResourcePolicies {
1249 super::builder::disks::AddResourcePolicies::new(self.inner.clone())
1250 }
1251
1252 /// Retrieves an aggregated list of persistent disks.
1253 ///
1254 /// To prevent failure, Google recommends that you set the
1255 /// `returnPartialSuccess` parameter to `true`.
1256 pub fn aggregated_list(&self) -> super::builder::disks::AggregatedList {
1257 super::builder::disks::AggregatedList::new(self.inner.clone())
1258 }
1259
1260 /// Bulk create a set of disks.
1261 pub fn bulk_insert(&self) -> super::builder::disks::BulkInsert {
1262 super::builder::disks::BulkInsert::new(self.inner.clone())
1263 }
1264
1265 /// Sets the labels on many disks at once. To learn more about labels, read theLabeling
1266 /// Resources documentation.
1267 pub fn bulk_set_labels(&self) -> super::builder::disks::BulkSetLabels {
1268 super::builder::disks::BulkSetLabels::new(self.inner.clone())
1269 }
1270
1271 /// Creates a snapshot of a specified persistent disk. For regular snapshot
1272 /// creation, consider using snapshots.insert
1273 /// instead, as that method supports more features, such as creating snapshots
1274 /// in a project different from the source disk project.
1275 pub fn create_snapshot(&self) -> super::builder::disks::CreateSnapshot {
1276 super::builder::disks::CreateSnapshot::new(self.inner.clone())
1277 }
1278
1279 /// Deletes the specified persistent disk. Deleting a disk removes its data
1280 /// permanently and is irreversible. However, deleting a disk does not
1281 /// delete any snapshots
1282 /// previously made from the disk. You must separatelydelete
1283 /// snapshots.
1284 pub fn delete(&self) -> super::builder::disks::Delete {
1285 super::builder::disks::Delete::new(self.inner.clone())
1286 }
1287
1288 /// Returns the specified persistent disk.
1289 pub fn get(&self) -> super::builder::disks::Get {
1290 super::builder::disks::Get::new(self.inner.clone())
1291 }
1292
1293 /// Gets the access control policy for a resource. May be empty if no such
1294 /// policy or resource exists.
1295 pub fn get_iam_policy(&self) -> super::builder::disks::GetIamPolicy {
1296 super::builder::disks::GetIamPolicy::new(self.inner.clone())
1297 }
1298
1299 /// Creates a persistent disk in the specified project using the data
1300 /// in the request. You can create a disk from a source
1301 /// (sourceImage, sourceSnapshot, orsourceDisk) or create an empty 500 GB data disk by
1302 /// omitting all properties. You can also create a disk that is larger than
1303 /// the default size by specifying the sizeGb property.
1304 pub fn insert(&self) -> super::builder::disks::Insert {
1305 super::builder::disks::Insert::new(self.inner.clone())
1306 }
1307
1308 /// Retrieves a list of persistent disks contained within
1309 /// the specified zone.
1310 pub fn list(&self) -> super::builder::disks::List {
1311 super::builder::disks::List::new(self.inner.clone())
1312 }
1313
1314 /// Removes resource policies from a disk.
1315 pub fn remove_resource_policies(&self) -> super::builder::disks::RemoveResourcePolicies {
1316 super::builder::disks::RemoveResourcePolicies::new(self.inner.clone())
1317 }
1318
1319 /// Resizes the specified persistent disk.
1320 /// You can only increase the size of the disk.
1321 pub fn resize(&self) -> super::builder::disks::Resize {
1322 super::builder::disks::Resize::new(self.inner.clone())
1323 }
1324
1325 /// Sets the access control policy on the specified resource.
1326 /// Replaces any existing policy.
1327 pub fn set_iam_policy(&self) -> super::builder::disks::SetIamPolicy {
1328 super::builder::disks::SetIamPolicy::new(self.inner.clone())
1329 }
1330
1331 /// Sets the labels on a disk. To learn more about labels, read theLabeling
1332 /// Resources documentation.
1333 pub fn set_labels(&self) -> super::builder::disks::SetLabels {
1334 super::builder::disks::SetLabels::new(self.inner.clone())
1335 }
1336
1337 /// Starts asynchronous replication.
1338 /// Must be invoked on the primary disk.
1339 pub fn start_async_replication(&self) -> super::builder::disks::StartAsyncReplication {
1340 super::builder::disks::StartAsyncReplication::new(self.inner.clone())
1341 }
1342
1343 /// Stops asynchronous replication.
1344 /// Can be invoked either on the primary or on the secondary disk.
1345 pub fn stop_async_replication(&self) -> super::builder::disks::StopAsyncReplication {
1346 super::builder::disks::StopAsyncReplication::new(self.inner.clone())
1347 }
1348
1349 /// Stops asynchronous replication for a consistency group of disks.
1350 /// Can be invoked either in the primary or secondary scope.
1351 pub fn stop_group_async_replication(&self) -> super::builder::disks::StopGroupAsyncReplication {
1352 super::builder::disks::StopGroupAsyncReplication::new(self.inner.clone())
1353 }
1354
1355 /// Returns permissions that a caller has on the specified resource.
1356 pub fn test_iam_permissions(&self) -> super::builder::disks::TestIamPermissions {
1357 super::builder::disks::TestIamPermissions::new(self.inner.clone())
1358 }
1359
1360 /// Updates the specified disk with the data included in the request.
1361 /// The update is performed only on selected fields included as part
1362 /// of update-mask. Only the following fields can be modified: user_license.
1363 pub fn update(&self) -> super::builder::disks::Update {
1364 super::builder::disks::Update::new(self.inner.clone())
1365 }
1366
1367 /// Retrieves the specified zone-specific Operations resource.
1368 pub fn get_operation(&self) -> super::builder::disks::GetOperation {
1369 super::builder::disks::GetOperation::new(self.inner.clone())
1370 }
1371}
1372
1373/// Implements a client for the Google Compute Engine API.
1374///
1375/// # Example
1376/// ```
1377/// # tokio_test::block_on(async {
1378/// # use google_cloud_compute_v1::client::ExternalVpnGateways;
1379/// let client = ExternalVpnGateways::builder().build().await?;
1380/// // use `client` to make requests to the Google Compute Engine API.
1381/// # gax::client_builder::Result::<()>::Ok(()) });
1382/// ```
1383///
1384/// # Service Description
1385///
1386/// Service for the `externalVpnGateways` resource.
1387///
1388/// # Configuration
1389///
1390/// To configure `ExternalVpnGateways` use the `with_*` methods in the type returned
1391/// by [builder()][ExternalVpnGateways::builder]. The default configuration should
1392/// work for most applications. Common configuration changes include
1393///
1394/// * [with_endpoint()]: by default this client uses the global default endpoint
1395/// (`https://compute.googleapis.com`). Applications using regional
1396/// endpoints or running in restricted networks (e.g. a network configured
1397// with [Private Google Access with VPC Service Controls]) may want to
1398/// override this default.
1399/// * [with_credentials()]: by default this client uses
1400/// [Application Default Credentials]. Applications using custom
1401/// authentication may need to override this default.
1402///
1403/// [with_endpoint()]: super::builder::external_vpn_gateways::ClientBuilder::with_endpoint
1404/// [with_credentials()]: super::builder::external_vpn_gateways::ClientBuilder::credentials
1405/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1406/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1407///
1408/// # Pooling and Cloning
1409///
1410/// `ExternalVpnGateways` holds a connection pool internally, it is advised to
1411/// create one and the reuse it. You do not need to wrap `ExternalVpnGateways` in
1412/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1413/// already uses an `Arc` internally.
1414#[cfg(feature = "external-vpn-gateways")]
1415#[cfg_attr(docsrs, doc(cfg(feature = "external-vpn-gateways")))]
1416#[derive(Clone, Debug)]
1417pub struct ExternalVpnGateways {
1418 inner: std::sync::Arc<dyn super::stub::dynamic::ExternalVpnGateways>,
1419}
1420
1421#[cfg(feature = "external-vpn-gateways")]
1422impl ExternalVpnGateways {
1423 /// Returns a builder for [ExternalVpnGateways].
1424 ///
1425 /// ```
1426 /// # tokio_test::block_on(async {
1427 /// # use google_cloud_compute_v1::client::ExternalVpnGateways;
1428 /// let client = ExternalVpnGateways::builder().build().await?;
1429 /// # gax::client_builder::Result::<()>::Ok(()) });
1430 /// ```
1431 pub fn builder() -> super::builder::external_vpn_gateways::ClientBuilder {
1432 gax::client_builder::internal::new_builder(
1433 super::builder::external_vpn_gateways::client::Factory,
1434 )
1435 }
1436
1437 /// Creates a new client from the provided stub.
1438 ///
1439 /// The most common case for calling this function is in tests mocking the
1440 /// client's behavior.
1441 pub fn from_stub<T>(stub: T) -> Self
1442 where
1443 T: super::stub::ExternalVpnGateways + 'static,
1444 {
1445 Self {
1446 inner: std::sync::Arc::new(stub),
1447 }
1448 }
1449
1450 pub(crate) async fn new(
1451 config: gaxi::options::ClientConfig,
1452 ) -> gax::client_builder::Result<Self> {
1453 let inner = Self::build_inner(config).await?;
1454 Ok(Self { inner })
1455 }
1456
1457 async fn build_inner(
1458 conf: gaxi::options::ClientConfig,
1459 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ExternalVpnGateways>>
1460 {
1461 if gaxi::options::tracing_enabled(&conf) {
1462 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1463 }
1464 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1465 }
1466
1467 async fn build_transport(
1468 conf: gaxi::options::ClientConfig,
1469 ) -> gax::client_builder::Result<impl super::stub::ExternalVpnGateways> {
1470 super::transport::ExternalVpnGateways::new(conf).await
1471 }
1472
1473 async fn build_with_tracing(
1474 conf: gaxi::options::ClientConfig,
1475 ) -> gax::client_builder::Result<impl super::stub::ExternalVpnGateways> {
1476 Self::build_transport(conf)
1477 .await
1478 .map(super::tracing::ExternalVpnGateways::new)
1479 }
1480
1481 /// Deletes the specified externalVpnGateway.
1482 pub fn delete(&self) -> super::builder::external_vpn_gateways::Delete {
1483 super::builder::external_vpn_gateways::Delete::new(self.inner.clone())
1484 }
1485
1486 /// Returns the specified externalVpnGateway. Get a list of available
1487 /// externalVpnGateways by making a list() request.
1488 pub fn get(&self) -> super::builder::external_vpn_gateways::Get {
1489 super::builder::external_vpn_gateways::Get::new(self.inner.clone())
1490 }
1491
1492 /// Creates a ExternalVpnGateway in the specified project using
1493 /// the data included in the request.
1494 pub fn insert(&self) -> super::builder::external_vpn_gateways::Insert {
1495 super::builder::external_vpn_gateways::Insert::new(self.inner.clone())
1496 }
1497
1498 /// Retrieves the list of ExternalVpnGateway available to the specified
1499 /// project.
1500 pub fn list(&self) -> super::builder::external_vpn_gateways::List {
1501 super::builder::external_vpn_gateways::List::new(self.inner.clone())
1502 }
1503
1504 /// Sets the labels on an ExternalVpnGateway. To learn more about labels,
1505 /// read the Labeling
1506 /// Resources documentation.
1507 pub fn set_labels(&self) -> super::builder::external_vpn_gateways::SetLabels {
1508 super::builder::external_vpn_gateways::SetLabels::new(self.inner.clone())
1509 }
1510
1511 /// Returns permissions that a caller has on the specified resource.
1512 pub fn test_iam_permissions(
1513 &self,
1514 ) -> super::builder::external_vpn_gateways::TestIamPermissions {
1515 super::builder::external_vpn_gateways::TestIamPermissions::new(self.inner.clone())
1516 }
1517
1518 /// Retrieves the specified Operations resource.
1519 pub fn get_operation(&self) -> super::builder::external_vpn_gateways::GetOperation {
1520 super::builder::external_vpn_gateways::GetOperation::new(self.inner.clone())
1521 }
1522}
1523
1524/// Implements a client for the Google Compute Engine API.
1525///
1526/// # Example
1527/// ```
1528/// # tokio_test::block_on(async {
1529/// # use google_cloud_compute_v1::client::FirewallPolicies;
1530/// let client = FirewallPolicies::builder().build().await?;
1531/// // use `client` to make requests to the Google Compute Engine API.
1532/// # gax::client_builder::Result::<()>::Ok(()) });
1533/// ```
1534///
1535/// # Service Description
1536///
1537/// Service for the `firewallPolicies` resource.
1538///
1539/// # Configuration
1540///
1541/// To configure `FirewallPolicies` use the `with_*` methods in the type returned
1542/// by [builder()][FirewallPolicies::builder]. The default configuration should
1543/// work for most applications. Common configuration changes include
1544///
1545/// * [with_endpoint()]: by default this client uses the global default endpoint
1546/// (`https://compute.googleapis.com`). Applications using regional
1547/// endpoints or running in restricted networks (e.g. a network configured
1548// with [Private Google Access with VPC Service Controls]) may want to
1549/// override this default.
1550/// * [with_credentials()]: by default this client uses
1551/// [Application Default Credentials]. Applications using custom
1552/// authentication may need to override this default.
1553///
1554/// [with_endpoint()]: super::builder::firewall_policies::ClientBuilder::with_endpoint
1555/// [with_credentials()]: super::builder::firewall_policies::ClientBuilder::credentials
1556/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1557/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1558///
1559/// # Pooling and Cloning
1560///
1561/// `FirewallPolicies` holds a connection pool internally, it is advised to
1562/// create one and the reuse it. You do not need to wrap `FirewallPolicies` in
1563/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1564/// already uses an `Arc` internally.
1565#[cfg(feature = "firewall-policies")]
1566#[cfg_attr(docsrs, doc(cfg(feature = "firewall-policies")))]
1567#[derive(Clone, Debug)]
1568pub struct FirewallPolicies {
1569 inner: std::sync::Arc<dyn super::stub::dynamic::FirewallPolicies>,
1570}
1571
1572#[cfg(feature = "firewall-policies")]
1573impl FirewallPolicies {
1574 /// Returns a builder for [FirewallPolicies].
1575 ///
1576 /// ```
1577 /// # tokio_test::block_on(async {
1578 /// # use google_cloud_compute_v1::client::FirewallPolicies;
1579 /// let client = FirewallPolicies::builder().build().await?;
1580 /// # gax::client_builder::Result::<()>::Ok(()) });
1581 /// ```
1582 pub fn builder() -> super::builder::firewall_policies::ClientBuilder {
1583 gax::client_builder::internal::new_builder(
1584 super::builder::firewall_policies::client::Factory,
1585 )
1586 }
1587
1588 /// Creates a new client from the provided stub.
1589 ///
1590 /// The most common case for calling this function is in tests mocking the
1591 /// client's behavior.
1592 pub fn from_stub<T>(stub: T) -> Self
1593 where
1594 T: super::stub::FirewallPolicies + 'static,
1595 {
1596 Self {
1597 inner: std::sync::Arc::new(stub),
1598 }
1599 }
1600
1601 pub(crate) async fn new(
1602 config: gaxi::options::ClientConfig,
1603 ) -> gax::client_builder::Result<Self> {
1604 let inner = Self::build_inner(config).await?;
1605 Ok(Self { inner })
1606 }
1607
1608 async fn build_inner(
1609 conf: gaxi::options::ClientConfig,
1610 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FirewallPolicies>>
1611 {
1612 if gaxi::options::tracing_enabled(&conf) {
1613 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1614 }
1615 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1616 }
1617
1618 async fn build_transport(
1619 conf: gaxi::options::ClientConfig,
1620 ) -> gax::client_builder::Result<impl super::stub::FirewallPolicies> {
1621 super::transport::FirewallPolicies::new(conf).await
1622 }
1623
1624 async fn build_with_tracing(
1625 conf: gaxi::options::ClientConfig,
1626 ) -> gax::client_builder::Result<impl super::stub::FirewallPolicies> {
1627 Self::build_transport(conf)
1628 .await
1629 .map(super::tracing::FirewallPolicies::new)
1630 }
1631
1632 /// Inserts an association for the specified firewall policy.
1633 pub fn add_association(&self) -> super::builder::firewall_policies::AddAssociation {
1634 super::builder::firewall_policies::AddAssociation::new(self.inner.clone())
1635 }
1636
1637 /// Inserts a rule into a firewall policy.
1638 pub fn add_rule(&self) -> super::builder::firewall_policies::AddRule {
1639 super::builder::firewall_policies::AddRule::new(self.inner.clone())
1640 }
1641
1642 /// Copies rules to the specified firewall policy.
1643 pub fn clone_rules(&self) -> super::builder::firewall_policies::CloneRules {
1644 super::builder::firewall_policies::CloneRules::new(self.inner.clone())
1645 }
1646
1647 /// Deletes the specified policy.
1648 pub fn delete(&self) -> super::builder::firewall_policies::Delete {
1649 super::builder::firewall_policies::Delete::new(self.inner.clone())
1650 }
1651
1652 /// Returns the specified firewall policy.
1653 pub fn get(&self) -> super::builder::firewall_policies::Get {
1654 super::builder::firewall_policies::Get::new(self.inner.clone())
1655 }
1656
1657 /// Gets an association with the specified name.
1658 pub fn get_association(&self) -> super::builder::firewall_policies::GetAssociation {
1659 super::builder::firewall_policies::GetAssociation::new(self.inner.clone())
1660 }
1661
1662 /// Gets the access control policy for a resource. May be empty if no such
1663 /// policy or resource exists.
1664 pub fn get_iam_policy(&self) -> super::builder::firewall_policies::GetIamPolicy {
1665 super::builder::firewall_policies::GetIamPolicy::new(self.inner.clone())
1666 }
1667
1668 /// Gets a rule of the specified priority.
1669 pub fn get_rule(&self) -> super::builder::firewall_policies::GetRule {
1670 super::builder::firewall_policies::GetRule::new(self.inner.clone())
1671 }
1672
1673 /// Creates a new policy in the specified project using the data included in
1674 /// the request.
1675 pub fn insert(&self) -> super::builder::firewall_policies::Insert {
1676 super::builder::firewall_policies::Insert::new(self.inner.clone())
1677 }
1678
1679 /// Lists all the policies that have been configured for the specified
1680 /// folder or organization.
1681 pub fn list(&self) -> super::builder::firewall_policies::List {
1682 super::builder::firewall_policies::List::new(self.inner.clone())
1683 }
1684
1685 /// Lists associations of a specified target, i.e., organization or folder.
1686 pub fn list_associations(&self) -> super::builder::firewall_policies::ListAssociations {
1687 super::builder::firewall_policies::ListAssociations::new(self.inner.clone())
1688 }
1689
1690 /// Moves the specified firewall policy.
1691 pub fn r#move(&self) -> super::builder::firewall_policies::Move {
1692 super::builder::firewall_policies::Move::new(self.inner.clone())
1693 }
1694
1695 /// Patches the specified policy with the data included in the request.
1696 pub fn patch(&self) -> super::builder::firewall_policies::Patch {
1697 super::builder::firewall_policies::Patch::new(self.inner.clone())
1698 }
1699
1700 /// Patches a rule of the specified priority.
1701 pub fn patch_rule(&self) -> super::builder::firewall_policies::PatchRule {
1702 super::builder::firewall_policies::PatchRule::new(self.inner.clone())
1703 }
1704
1705 /// Removes an association for the specified firewall policy.
1706 pub fn remove_association(&self) -> super::builder::firewall_policies::RemoveAssociation {
1707 super::builder::firewall_policies::RemoveAssociation::new(self.inner.clone())
1708 }
1709
1710 /// Deletes a rule of the specified priority.
1711 pub fn remove_rule(&self) -> super::builder::firewall_policies::RemoveRule {
1712 super::builder::firewall_policies::RemoveRule::new(self.inner.clone())
1713 }
1714
1715 /// Sets the access control policy on the specified resource.
1716 /// Replaces any existing policy.
1717 pub fn set_iam_policy(&self) -> super::builder::firewall_policies::SetIamPolicy {
1718 super::builder::firewall_policies::SetIamPolicy::new(self.inner.clone())
1719 }
1720
1721 /// Returns permissions that a caller has on the specified resource.
1722 pub fn test_iam_permissions(&self) -> super::builder::firewall_policies::TestIamPermissions {
1723 super::builder::firewall_policies::TestIamPermissions::new(self.inner.clone())
1724 }
1725
1726 /// Retrieves the specified Operations resource. Gets a list of operations
1727 /// by making a `list()` request.
1728 pub fn get_operation(&self) -> super::builder::firewall_policies::GetOperation {
1729 super::builder::firewall_policies::GetOperation::new(self.inner.clone())
1730 }
1731}
1732
1733/// Implements a client for the Google Compute Engine API.
1734///
1735/// # Example
1736/// ```
1737/// # tokio_test::block_on(async {
1738/// # use google_cloud_compute_v1::client::Firewalls;
1739/// let client = Firewalls::builder().build().await?;
1740/// // use `client` to make requests to the Google Compute Engine API.
1741/// # gax::client_builder::Result::<()>::Ok(()) });
1742/// ```
1743///
1744/// # Service Description
1745///
1746/// Service for the `firewalls` resource.
1747///
1748/// # Configuration
1749///
1750/// To configure `Firewalls` use the `with_*` methods in the type returned
1751/// by [builder()][Firewalls::builder]. The default configuration should
1752/// work for most applications. Common configuration changes include
1753///
1754/// * [with_endpoint()]: by default this client uses the global default endpoint
1755/// (`https://compute.googleapis.com`). Applications using regional
1756/// endpoints or running in restricted networks (e.g. a network configured
1757// with [Private Google Access with VPC Service Controls]) may want to
1758/// override this default.
1759/// * [with_credentials()]: by default this client uses
1760/// [Application Default Credentials]. Applications using custom
1761/// authentication may need to override this default.
1762///
1763/// [with_endpoint()]: super::builder::firewalls::ClientBuilder::with_endpoint
1764/// [with_credentials()]: super::builder::firewalls::ClientBuilder::credentials
1765/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1766/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1767///
1768/// # Pooling and Cloning
1769///
1770/// `Firewalls` holds a connection pool internally, it is advised to
1771/// create one and the reuse it. You do not need to wrap `Firewalls` in
1772/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1773/// already uses an `Arc` internally.
1774#[cfg(feature = "firewalls")]
1775#[cfg_attr(docsrs, doc(cfg(feature = "firewalls")))]
1776#[derive(Clone, Debug)]
1777pub struct Firewalls {
1778 inner: std::sync::Arc<dyn super::stub::dynamic::Firewalls>,
1779}
1780
1781#[cfg(feature = "firewalls")]
1782impl Firewalls {
1783 /// Returns a builder for [Firewalls].
1784 ///
1785 /// ```
1786 /// # tokio_test::block_on(async {
1787 /// # use google_cloud_compute_v1::client::Firewalls;
1788 /// let client = Firewalls::builder().build().await?;
1789 /// # gax::client_builder::Result::<()>::Ok(()) });
1790 /// ```
1791 pub fn builder() -> super::builder::firewalls::ClientBuilder {
1792 gax::client_builder::internal::new_builder(super::builder::firewalls::client::Factory)
1793 }
1794
1795 /// Creates a new client from the provided stub.
1796 ///
1797 /// The most common case for calling this function is in tests mocking the
1798 /// client's behavior.
1799 pub fn from_stub<T>(stub: T) -> Self
1800 where
1801 T: super::stub::Firewalls + 'static,
1802 {
1803 Self {
1804 inner: std::sync::Arc::new(stub),
1805 }
1806 }
1807
1808 pub(crate) async fn new(
1809 config: gaxi::options::ClientConfig,
1810 ) -> gax::client_builder::Result<Self> {
1811 let inner = Self::build_inner(config).await?;
1812 Ok(Self { inner })
1813 }
1814
1815 async fn build_inner(
1816 conf: gaxi::options::ClientConfig,
1817 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Firewalls>> {
1818 if gaxi::options::tracing_enabled(&conf) {
1819 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1820 }
1821 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1822 }
1823
1824 async fn build_transport(
1825 conf: gaxi::options::ClientConfig,
1826 ) -> gax::client_builder::Result<impl super::stub::Firewalls> {
1827 super::transport::Firewalls::new(conf).await
1828 }
1829
1830 async fn build_with_tracing(
1831 conf: gaxi::options::ClientConfig,
1832 ) -> gax::client_builder::Result<impl super::stub::Firewalls> {
1833 Self::build_transport(conf)
1834 .await
1835 .map(super::tracing::Firewalls::new)
1836 }
1837
1838 /// Deletes the specified firewall.
1839 pub fn delete(&self) -> super::builder::firewalls::Delete {
1840 super::builder::firewalls::Delete::new(self.inner.clone())
1841 }
1842
1843 /// Returns the specified firewall.
1844 pub fn get(&self) -> super::builder::firewalls::Get {
1845 super::builder::firewalls::Get::new(self.inner.clone())
1846 }
1847
1848 /// Creates a firewall rule in the specified project using the data
1849 /// included in the request.
1850 pub fn insert(&self) -> super::builder::firewalls::Insert {
1851 super::builder::firewalls::Insert::new(self.inner.clone())
1852 }
1853
1854 /// Retrieves the list of firewall rules available to the specified
1855 /// project.
1856 pub fn list(&self) -> super::builder::firewalls::List {
1857 super::builder::firewalls::List::new(self.inner.clone())
1858 }
1859
1860 /// Updates the specified firewall rule with the data included in the
1861 /// request. This method supportsPATCH
1862 /// semantics and uses theJSON merge
1863 /// patch format and processing rules.
1864 pub fn patch(&self) -> super::builder::firewalls::Patch {
1865 super::builder::firewalls::Patch::new(self.inner.clone())
1866 }
1867
1868 /// Updates the specified firewall rule with the data included in the
1869 /// request.
1870 /// Note that all fields will be updated if using PUT, even fields that are not
1871 /// specified. To update individual fields, please use PATCH instead.
1872 pub fn update(&self) -> super::builder::firewalls::Update {
1873 super::builder::firewalls::Update::new(self.inner.clone())
1874 }
1875
1876 /// Retrieves the specified Operations resource.
1877 pub fn get_operation(&self) -> super::builder::firewalls::GetOperation {
1878 super::builder::firewalls::GetOperation::new(self.inner.clone())
1879 }
1880}
1881
1882/// Implements a client for the Google Compute Engine API.
1883///
1884/// # Example
1885/// ```
1886/// # tokio_test::block_on(async {
1887/// # use google_cloud_compute_v1::client::ForwardingRules;
1888/// let client = ForwardingRules::builder().build().await?;
1889/// // use `client` to make requests to the Google Compute Engine API.
1890/// # gax::client_builder::Result::<()>::Ok(()) });
1891/// ```
1892///
1893/// # Service Description
1894///
1895/// Service for the `forwardingRules` resource.
1896///
1897/// # Configuration
1898///
1899/// To configure `ForwardingRules` use the `with_*` methods in the type returned
1900/// by [builder()][ForwardingRules::builder]. The default configuration should
1901/// work for most applications. Common configuration changes include
1902///
1903/// * [with_endpoint()]: by default this client uses the global default endpoint
1904/// (`https://compute.googleapis.com`). Applications using regional
1905/// endpoints or running in restricted networks (e.g. a network configured
1906// with [Private Google Access with VPC Service Controls]) may want to
1907/// override this default.
1908/// * [with_credentials()]: by default this client uses
1909/// [Application Default Credentials]. Applications using custom
1910/// authentication may need to override this default.
1911///
1912/// [with_endpoint()]: super::builder::forwarding_rules::ClientBuilder::with_endpoint
1913/// [with_credentials()]: super::builder::forwarding_rules::ClientBuilder::credentials
1914/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1915/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1916///
1917/// # Pooling and Cloning
1918///
1919/// `ForwardingRules` holds a connection pool internally, it is advised to
1920/// create one and the reuse it. You do not need to wrap `ForwardingRules` in
1921/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1922/// already uses an `Arc` internally.
1923#[cfg(feature = "forwarding-rules")]
1924#[cfg_attr(docsrs, doc(cfg(feature = "forwarding-rules")))]
1925#[derive(Clone, Debug)]
1926pub struct ForwardingRules {
1927 inner: std::sync::Arc<dyn super::stub::dynamic::ForwardingRules>,
1928}
1929
1930#[cfg(feature = "forwarding-rules")]
1931impl ForwardingRules {
1932 /// Returns a builder for [ForwardingRules].
1933 ///
1934 /// ```
1935 /// # tokio_test::block_on(async {
1936 /// # use google_cloud_compute_v1::client::ForwardingRules;
1937 /// let client = ForwardingRules::builder().build().await?;
1938 /// # gax::client_builder::Result::<()>::Ok(()) });
1939 /// ```
1940 pub fn builder() -> super::builder::forwarding_rules::ClientBuilder {
1941 gax::client_builder::internal::new_builder(
1942 super::builder::forwarding_rules::client::Factory,
1943 )
1944 }
1945
1946 /// Creates a new client from the provided stub.
1947 ///
1948 /// The most common case for calling this function is in tests mocking the
1949 /// client's behavior.
1950 pub fn from_stub<T>(stub: T) -> Self
1951 where
1952 T: super::stub::ForwardingRules + 'static,
1953 {
1954 Self {
1955 inner: std::sync::Arc::new(stub),
1956 }
1957 }
1958
1959 pub(crate) async fn new(
1960 config: gaxi::options::ClientConfig,
1961 ) -> gax::client_builder::Result<Self> {
1962 let inner = Self::build_inner(config).await?;
1963 Ok(Self { inner })
1964 }
1965
1966 async fn build_inner(
1967 conf: gaxi::options::ClientConfig,
1968 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ForwardingRules>>
1969 {
1970 if gaxi::options::tracing_enabled(&conf) {
1971 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1972 }
1973 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1974 }
1975
1976 async fn build_transport(
1977 conf: gaxi::options::ClientConfig,
1978 ) -> gax::client_builder::Result<impl super::stub::ForwardingRules> {
1979 super::transport::ForwardingRules::new(conf).await
1980 }
1981
1982 async fn build_with_tracing(
1983 conf: gaxi::options::ClientConfig,
1984 ) -> gax::client_builder::Result<impl super::stub::ForwardingRules> {
1985 Self::build_transport(conf)
1986 .await
1987 .map(super::tracing::ForwardingRules::new)
1988 }
1989
1990 /// Retrieves an aggregated list of forwarding rules.
1991 ///
1992 /// To prevent failure, Google recommends that you set the
1993 /// `returnPartialSuccess` parameter to `true`.
1994 pub fn aggregated_list(&self) -> super::builder::forwarding_rules::AggregatedList {
1995 super::builder::forwarding_rules::AggregatedList::new(self.inner.clone())
1996 }
1997
1998 /// Deletes the specified ForwardingRule resource.
1999 pub fn delete(&self) -> super::builder::forwarding_rules::Delete {
2000 super::builder::forwarding_rules::Delete::new(self.inner.clone())
2001 }
2002
2003 /// Returns the specified ForwardingRule resource.
2004 pub fn get(&self) -> super::builder::forwarding_rules::Get {
2005 super::builder::forwarding_rules::Get::new(self.inner.clone())
2006 }
2007
2008 /// Creates a ForwardingRule resource in the specified project and region using
2009 /// the data included in the request.
2010 pub fn insert(&self) -> super::builder::forwarding_rules::Insert {
2011 super::builder::forwarding_rules::Insert::new(self.inner.clone())
2012 }
2013
2014 /// Retrieves a list of ForwardingRule resources available to the specified
2015 /// project and region.
2016 pub fn list(&self) -> super::builder::forwarding_rules::List {
2017 super::builder::forwarding_rules::List::new(self.inner.clone())
2018 }
2019
2020 /// Updates the specified forwarding rule with the data included in the
2021 /// request. This method supportsPATCH
2022 /// semantics and uses theJSON merge
2023 /// patch format and processing rules. Currently, you can only
2024 /// patch the network_tier field.
2025 pub fn patch(&self) -> super::builder::forwarding_rules::Patch {
2026 super::builder::forwarding_rules::Patch::new(self.inner.clone())
2027 }
2028
2029 /// Sets the labels on the specified resource. To learn more about labels,
2030 /// read the
2031 /// Labeling Resources documentation.
2032 pub fn set_labels(&self) -> super::builder::forwarding_rules::SetLabels {
2033 super::builder::forwarding_rules::SetLabels::new(self.inner.clone())
2034 }
2035
2036 /// Changes target URL for forwarding rule. The new target should be of the
2037 /// same type as the old target.
2038 pub fn set_target(&self) -> super::builder::forwarding_rules::SetTarget {
2039 super::builder::forwarding_rules::SetTarget::new(self.inner.clone())
2040 }
2041
2042 /// Retrieves the specified region-specific Operations resource.
2043 pub fn get_operation(&self) -> super::builder::forwarding_rules::GetOperation {
2044 super::builder::forwarding_rules::GetOperation::new(self.inner.clone())
2045 }
2046}
2047
2048/// Implements a client for the Google Compute Engine API.
2049///
2050/// # Example
2051/// ```
2052/// # tokio_test::block_on(async {
2053/// # use google_cloud_compute_v1::client::FutureReservations;
2054/// let client = FutureReservations::builder().build().await?;
2055/// // use `client` to make requests to the Google Compute Engine API.
2056/// # gax::client_builder::Result::<()>::Ok(()) });
2057/// ```
2058///
2059/// # Service Description
2060///
2061/// Service for the `futureReservations` resource.
2062///
2063/// # Configuration
2064///
2065/// To configure `FutureReservations` use the `with_*` methods in the type returned
2066/// by [builder()][FutureReservations::builder]. The default configuration should
2067/// work for most applications. Common configuration changes include
2068///
2069/// * [with_endpoint()]: by default this client uses the global default endpoint
2070/// (`https://compute.googleapis.com`). Applications using regional
2071/// endpoints or running in restricted networks (e.g. a network configured
2072// with [Private Google Access with VPC Service Controls]) may want to
2073/// override this default.
2074/// * [with_credentials()]: by default this client uses
2075/// [Application Default Credentials]. Applications using custom
2076/// authentication may need to override this default.
2077///
2078/// [with_endpoint()]: super::builder::future_reservations::ClientBuilder::with_endpoint
2079/// [with_credentials()]: super::builder::future_reservations::ClientBuilder::credentials
2080/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2081/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2082///
2083/// # Pooling and Cloning
2084///
2085/// `FutureReservations` holds a connection pool internally, it is advised to
2086/// create one and the reuse it. You do not need to wrap `FutureReservations` in
2087/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2088/// already uses an `Arc` internally.
2089#[cfg(feature = "future-reservations")]
2090#[cfg_attr(docsrs, doc(cfg(feature = "future-reservations")))]
2091#[derive(Clone, Debug)]
2092pub struct FutureReservations {
2093 inner: std::sync::Arc<dyn super::stub::dynamic::FutureReservations>,
2094}
2095
2096#[cfg(feature = "future-reservations")]
2097impl FutureReservations {
2098 /// Returns a builder for [FutureReservations].
2099 ///
2100 /// ```
2101 /// # tokio_test::block_on(async {
2102 /// # use google_cloud_compute_v1::client::FutureReservations;
2103 /// let client = FutureReservations::builder().build().await?;
2104 /// # gax::client_builder::Result::<()>::Ok(()) });
2105 /// ```
2106 pub fn builder() -> super::builder::future_reservations::ClientBuilder {
2107 gax::client_builder::internal::new_builder(
2108 super::builder::future_reservations::client::Factory,
2109 )
2110 }
2111
2112 /// Creates a new client from the provided stub.
2113 ///
2114 /// The most common case for calling this function is in tests mocking the
2115 /// client's behavior.
2116 pub fn from_stub<T>(stub: T) -> Self
2117 where
2118 T: super::stub::FutureReservations + 'static,
2119 {
2120 Self {
2121 inner: std::sync::Arc::new(stub),
2122 }
2123 }
2124
2125 pub(crate) async fn new(
2126 config: gaxi::options::ClientConfig,
2127 ) -> gax::client_builder::Result<Self> {
2128 let inner = Self::build_inner(config).await?;
2129 Ok(Self { inner })
2130 }
2131
2132 async fn build_inner(
2133 conf: gaxi::options::ClientConfig,
2134 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::FutureReservations>>
2135 {
2136 if gaxi::options::tracing_enabled(&conf) {
2137 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2138 }
2139 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2140 }
2141
2142 async fn build_transport(
2143 conf: gaxi::options::ClientConfig,
2144 ) -> gax::client_builder::Result<impl super::stub::FutureReservations> {
2145 super::transport::FutureReservations::new(conf).await
2146 }
2147
2148 async fn build_with_tracing(
2149 conf: gaxi::options::ClientConfig,
2150 ) -> gax::client_builder::Result<impl super::stub::FutureReservations> {
2151 Self::build_transport(conf)
2152 .await
2153 .map(super::tracing::FutureReservations::new)
2154 }
2155
2156 /// Retrieves an aggregated list of future reservations.
2157 ///
2158 /// To prevent failure, recommendation is that you set the
2159 /// `returnPartialSuccess` parameter to `true`.
2160 pub fn aggregated_list(&self) -> super::builder::future_reservations::AggregatedList {
2161 super::builder::future_reservations::AggregatedList::new(self.inner.clone())
2162 }
2163
2164 /// Cancel the specified future reservation.
2165 pub fn cancel(&self) -> super::builder::future_reservations::Cancel {
2166 super::builder::future_reservations::Cancel::new(self.inner.clone())
2167 }
2168
2169 /// Deletes the specified future reservation.
2170 pub fn delete(&self) -> super::builder::future_reservations::Delete {
2171 super::builder::future_reservations::Delete::new(self.inner.clone())
2172 }
2173
2174 /// Retrieves information about the specified future reservation.
2175 pub fn get(&self) -> super::builder::future_reservations::Get {
2176 super::builder::future_reservations::Get::new(self.inner.clone())
2177 }
2178
2179 /// Creates a new Future Reservation.
2180 pub fn insert(&self) -> super::builder::future_reservations::Insert {
2181 super::builder::future_reservations::Insert::new(self.inner.clone())
2182 }
2183
2184 /// A list of all the future reservations that have been configured for the
2185 /// specified project in specified zone.
2186 pub fn list(&self) -> super::builder::future_reservations::List {
2187 super::builder::future_reservations::List::new(self.inner.clone())
2188 }
2189
2190 /// Updates the specified future reservation.
2191 pub fn update(&self) -> super::builder::future_reservations::Update {
2192 super::builder::future_reservations::Update::new(self.inner.clone())
2193 }
2194
2195 /// Retrieves the specified zone-specific Operations resource.
2196 pub fn get_operation(&self) -> super::builder::future_reservations::GetOperation {
2197 super::builder::future_reservations::GetOperation::new(self.inner.clone())
2198 }
2199}
2200
2201/// Implements a client for the Google Compute Engine API.
2202///
2203/// # Example
2204/// ```
2205/// # tokio_test::block_on(async {
2206/// # use google_cloud_compute_v1::client::GlobalAddresses;
2207/// let client = GlobalAddresses::builder().build().await?;
2208/// // use `client` to make requests to the Google Compute Engine API.
2209/// # gax::client_builder::Result::<()>::Ok(()) });
2210/// ```
2211///
2212/// # Service Description
2213///
2214/// Service for the `globalAddresses` resource.
2215///
2216/// # Configuration
2217///
2218/// To configure `GlobalAddresses` use the `with_*` methods in the type returned
2219/// by [builder()][GlobalAddresses::builder]. The default configuration should
2220/// work for most applications. Common configuration changes include
2221///
2222/// * [with_endpoint()]: by default this client uses the global default endpoint
2223/// (`https://compute.googleapis.com`). Applications using regional
2224/// endpoints or running in restricted networks (e.g. a network configured
2225// with [Private Google Access with VPC Service Controls]) may want to
2226/// override this default.
2227/// * [with_credentials()]: by default this client uses
2228/// [Application Default Credentials]. Applications using custom
2229/// authentication may need to override this default.
2230///
2231/// [with_endpoint()]: super::builder::global_addresses::ClientBuilder::with_endpoint
2232/// [with_credentials()]: super::builder::global_addresses::ClientBuilder::credentials
2233/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2234/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2235///
2236/// # Pooling and Cloning
2237///
2238/// `GlobalAddresses` holds a connection pool internally, it is advised to
2239/// create one and the reuse it. You do not need to wrap `GlobalAddresses` in
2240/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2241/// already uses an `Arc` internally.
2242#[cfg(feature = "global-addresses")]
2243#[cfg_attr(docsrs, doc(cfg(feature = "global-addresses")))]
2244#[derive(Clone, Debug)]
2245pub struct GlobalAddresses {
2246 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalAddresses>,
2247}
2248
2249#[cfg(feature = "global-addresses")]
2250impl GlobalAddresses {
2251 /// Returns a builder for [GlobalAddresses].
2252 ///
2253 /// ```
2254 /// # tokio_test::block_on(async {
2255 /// # use google_cloud_compute_v1::client::GlobalAddresses;
2256 /// let client = GlobalAddresses::builder().build().await?;
2257 /// # gax::client_builder::Result::<()>::Ok(()) });
2258 /// ```
2259 pub fn builder() -> super::builder::global_addresses::ClientBuilder {
2260 gax::client_builder::internal::new_builder(
2261 super::builder::global_addresses::client::Factory,
2262 )
2263 }
2264
2265 /// Creates a new client from the provided stub.
2266 ///
2267 /// The most common case for calling this function is in tests mocking the
2268 /// client's behavior.
2269 pub fn from_stub<T>(stub: T) -> Self
2270 where
2271 T: super::stub::GlobalAddresses + 'static,
2272 {
2273 Self {
2274 inner: std::sync::Arc::new(stub),
2275 }
2276 }
2277
2278 pub(crate) async fn new(
2279 config: gaxi::options::ClientConfig,
2280 ) -> gax::client_builder::Result<Self> {
2281 let inner = Self::build_inner(config).await?;
2282 Ok(Self { inner })
2283 }
2284
2285 async fn build_inner(
2286 conf: gaxi::options::ClientConfig,
2287 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GlobalAddresses>>
2288 {
2289 if gaxi::options::tracing_enabled(&conf) {
2290 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2291 }
2292 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2293 }
2294
2295 async fn build_transport(
2296 conf: gaxi::options::ClientConfig,
2297 ) -> gax::client_builder::Result<impl super::stub::GlobalAddresses> {
2298 super::transport::GlobalAddresses::new(conf).await
2299 }
2300
2301 async fn build_with_tracing(
2302 conf: gaxi::options::ClientConfig,
2303 ) -> gax::client_builder::Result<impl super::stub::GlobalAddresses> {
2304 Self::build_transport(conf)
2305 .await
2306 .map(super::tracing::GlobalAddresses::new)
2307 }
2308
2309 /// Deletes the specified address resource.
2310 pub fn delete(&self) -> super::builder::global_addresses::Delete {
2311 super::builder::global_addresses::Delete::new(self.inner.clone())
2312 }
2313
2314 /// Returns the specified address resource.
2315 pub fn get(&self) -> super::builder::global_addresses::Get {
2316 super::builder::global_addresses::Get::new(self.inner.clone())
2317 }
2318
2319 /// Creates an address resource in the specified project by using the data
2320 /// included in the request.
2321 pub fn insert(&self) -> super::builder::global_addresses::Insert {
2322 super::builder::global_addresses::Insert::new(self.inner.clone())
2323 }
2324
2325 /// Retrieves a list of global addresses.
2326 pub fn list(&self) -> super::builder::global_addresses::List {
2327 super::builder::global_addresses::List::new(self.inner.clone())
2328 }
2329
2330 /// Moves the specified address resource from one project to another project.
2331 pub fn r#move(&self) -> super::builder::global_addresses::Move {
2332 super::builder::global_addresses::Move::new(self.inner.clone())
2333 }
2334
2335 /// Sets the labels on a GlobalAddress. To learn more about labels, read theLabeling
2336 /// Resources documentation.
2337 pub fn set_labels(&self) -> super::builder::global_addresses::SetLabels {
2338 super::builder::global_addresses::SetLabels::new(self.inner.clone())
2339 }
2340
2341 /// Returns permissions that a caller has on the specified resource.
2342 pub fn test_iam_permissions(&self) -> super::builder::global_addresses::TestIamPermissions {
2343 super::builder::global_addresses::TestIamPermissions::new(self.inner.clone())
2344 }
2345
2346 /// Retrieves the specified Operations resource.
2347 pub fn get_operation(&self) -> super::builder::global_addresses::GetOperation {
2348 super::builder::global_addresses::GetOperation::new(self.inner.clone())
2349 }
2350}
2351
2352/// Implements a client for the Google Compute Engine API.
2353///
2354/// # Example
2355/// ```
2356/// # tokio_test::block_on(async {
2357/// # use google_cloud_compute_v1::client::GlobalForwardingRules;
2358/// let client = GlobalForwardingRules::builder().build().await?;
2359/// // use `client` to make requests to the Google Compute Engine API.
2360/// # gax::client_builder::Result::<()>::Ok(()) });
2361/// ```
2362///
2363/// # Service Description
2364///
2365/// Service for the `globalForwardingRules` resource.
2366///
2367/// # Configuration
2368///
2369/// To configure `GlobalForwardingRules` use the `with_*` methods in the type returned
2370/// by [builder()][GlobalForwardingRules::builder]. The default configuration should
2371/// work for most applications. Common configuration changes include
2372///
2373/// * [with_endpoint()]: by default this client uses the global default endpoint
2374/// (`https://compute.googleapis.com`). Applications using regional
2375/// endpoints or running in restricted networks (e.g. a network configured
2376// with [Private Google Access with VPC Service Controls]) may want to
2377/// override this default.
2378/// * [with_credentials()]: by default this client uses
2379/// [Application Default Credentials]. Applications using custom
2380/// authentication may need to override this default.
2381///
2382/// [with_endpoint()]: super::builder::global_forwarding_rules::ClientBuilder::with_endpoint
2383/// [with_credentials()]: super::builder::global_forwarding_rules::ClientBuilder::credentials
2384/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2385/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2386///
2387/// # Pooling and Cloning
2388///
2389/// `GlobalForwardingRules` holds a connection pool internally, it is advised to
2390/// create one and the reuse it. You do not need to wrap `GlobalForwardingRules` in
2391/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2392/// already uses an `Arc` internally.
2393#[cfg(feature = "global-forwarding-rules")]
2394#[cfg_attr(docsrs, doc(cfg(feature = "global-forwarding-rules")))]
2395#[derive(Clone, Debug)]
2396pub struct GlobalForwardingRules {
2397 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalForwardingRules>,
2398}
2399
2400#[cfg(feature = "global-forwarding-rules")]
2401impl GlobalForwardingRules {
2402 /// Returns a builder for [GlobalForwardingRules].
2403 ///
2404 /// ```
2405 /// # tokio_test::block_on(async {
2406 /// # use google_cloud_compute_v1::client::GlobalForwardingRules;
2407 /// let client = GlobalForwardingRules::builder().build().await?;
2408 /// # gax::client_builder::Result::<()>::Ok(()) });
2409 /// ```
2410 pub fn builder() -> super::builder::global_forwarding_rules::ClientBuilder {
2411 gax::client_builder::internal::new_builder(
2412 super::builder::global_forwarding_rules::client::Factory,
2413 )
2414 }
2415
2416 /// Creates a new client from the provided stub.
2417 ///
2418 /// The most common case for calling this function is in tests mocking the
2419 /// client's behavior.
2420 pub fn from_stub<T>(stub: T) -> Self
2421 where
2422 T: super::stub::GlobalForwardingRules + 'static,
2423 {
2424 Self {
2425 inner: std::sync::Arc::new(stub),
2426 }
2427 }
2428
2429 pub(crate) async fn new(
2430 config: gaxi::options::ClientConfig,
2431 ) -> gax::client_builder::Result<Self> {
2432 let inner = Self::build_inner(config).await?;
2433 Ok(Self { inner })
2434 }
2435
2436 async fn build_inner(
2437 conf: gaxi::options::ClientConfig,
2438 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GlobalForwardingRules>>
2439 {
2440 if gaxi::options::tracing_enabled(&conf) {
2441 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2442 }
2443 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2444 }
2445
2446 async fn build_transport(
2447 conf: gaxi::options::ClientConfig,
2448 ) -> gax::client_builder::Result<impl super::stub::GlobalForwardingRules> {
2449 super::transport::GlobalForwardingRules::new(conf).await
2450 }
2451
2452 async fn build_with_tracing(
2453 conf: gaxi::options::ClientConfig,
2454 ) -> gax::client_builder::Result<impl super::stub::GlobalForwardingRules> {
2455 Self::build_transport(conf)
2456 .await
2457 .map(super::tracing::GlobalForwardingRules::new)
2458 }
2459
2460 /// Deletes the specified GlobalForwardingRule resource.
2461 pub fn delete(&self) -> super::builder::global_forwarding_rules::Delete {
2462 super::builder::global_forwarding_rules::Delete::new(self.inner.clone())
2463 }
2464
2465 /// Returns the specified GlobalForwardingRule resource. Gets a list of
2466 /// available forwarding rules by making a list() request.
2467 pub fn get(&self) -> super::builder::global_forwarding_rules::Get {
2468 super::builder::global_forwarding_rules::Get::new(self.inner.clone())
2469 }
2470
2471 /// Creates a GlobalForwardingRule resource in the specified project using
2472 /// the data included in the request.
2473 pub fn insert(&self) -> super::builder::global_forwarding_rules::Insert {
2474 super::builder::global_forwarding_rules::Insert::new(self.inner.clone())
2475 }
2476
2477 /// Retrieves a list of GlobalForwardingRule resources available to the
2478 /// specified project.
2479 pub fn list(&self) -> super::builder::global_forwarding_rules::List {
2480 super::builder::global_forwarding_rules::List::new(self.inner.clone())
2481 }
2482
2483 /// Updates the specified forwarding rule with the data included in the
2484 /// request. This method supportsPATCH
2485 /// semantics and uses theJSON merge
2486 /// patch format and processing rules. Currently, you can only
2487 /// patch the network_tier field.
2488 pub fn patch(&self) -> super::builder::global_forwarding_rules::Patch {
2489 super::builder::global_forwarding_rules::Patch::new(self.inner.clone())
2490 }
2491
2492 /// Sets the labels on the specified resource. To learn more about labels,
2493 /// read the
2494 /// Labeling resources documentation.
2495 pub fn set_labels(&self) -> super::builder::global_forwarding_rules::SetLabels {
2496 super::builder::global_forwarding_rules::SetLabels::new(self.inner.clone())
2497 }
2498
2499 /// Changes target URL for the GlobalForwardingRule resource. The new target
2500 /// should be of the same type as the old target.
2501 pub fn set_target(&self) -> super::builder::global_forwarding_rules::SetTarget {
2502 super::builder::global_forwarding_rules::SetTarget::new(self.inner.clone())
2503 }
2504
2505 /// Retrieves the specified Operations resource.
2506 pub fn get_operation(&self) -> super::builder::global_forwarding_rules::GetOperation {
2507 super::builder::global_forwarding_rules::GetOperation::new(self.inner.clone())
2508 }
2509}
2510
2511/// Implements a client for the Google Compute Engine API.
2512///
2513/// # Example
2514/// ```
2515/// # tokio_test::block_on(async {
2516/// # use google_cloud_compute_v1::client::GlobalNetworkEndpointGroups;
2517/// let client = GlobalNetworkEndpointGroups::builder().build().await?;
2518/// // use `client` to make requests to the Google Compute Engine API.
2519/// # gax::client_builder::Result::<()>::Ok(()) });
2520/// ```
2521///
2522/// # Service Description
2523///
2524/// Service for the `globalNetworkEndpointGroups` resource.
2525///
2526/// # Configuration
2527///
2528/// To configure `GlobalNetworkEndpointGroups` use the `with_*` methods in the type returned
2529/// by [builder()][GlobalNetworkEndpointGroups::builder]. The default configuration should
2530/// work for most applications. Common configuration changes include
2531///
2532/// * [with_endpoint()]: by default this client uses the global default endpoint
2533/// (`https://compute.googleapis.com`). Applications using regional
2534/// endpoints or running in restricted networks (e.g. a network configured
2535// with [Private Google Access with VPC Service Controls]) may want to
2536/// override this default.
2537/// * [with_credentials()]: by default this client uses
2538/// [Application Default Credentials]. Applications using custom
2539/// authentication may need to override this default.
2540///
2541/// [with_endpoint()]: super::builder::global_network_endpoint_groups::ClientBuilder::with_endpoint
2542/// [with_credentials()]: super::builder::global_network_endpoint_groups::ClientBuilder::credentials
2543/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2544/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2545///
2546/// # Pooling and Cloning
2547///
2548/// `GlobalNetworkEndpointGroups` holds a connection pool internally, it is advised to
2549/// create one and the reuse it. You do not need to wrap `GlobalNetworkEndpointGroups` in
2550/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2551/// already uses an `Arc` internally.
2552#[cfg(feature = "global-network-endpoint-groups")]
2553#[cfg_attr(docsrs, doc(cfg(feature = "global-network-endpoint-groups")))]
2554#[derive(Clone, Debug)]
2555pub struct GlobalNetworkEndpointGroups {
2556 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalNetworkEndpointGroups>,
2557}
2558
2559#[cfg(feature = "global-network-endpoint-groups")]
2560impl GlobalNetworkEndpointGroups {
2561 /// Returns a builder for [GlobalNetworkEndpointGroups].
2562 ///
2563 /// ```
2564 /// # tokio_test::block_on(async {
2565 /// # use google_cloud_compute_v1::client::GlobalNetworkEndpointGroups;
2566 /// let client = GlobalNetworkEndpointGroups::builder().build().await?;
2567 /// # gax::client_builder::Result::<()>::Ok(()) });
2568 /// ```
2569 pub fn builder() -> super::builder::global_network_endpoint_groups::ClientBuilder {
2570 gax::client_builder::internal::new_builder(
2571 super::builder::global_network_endpoint_groups::client::Factory,
2572 )
2573 }
2574
2575 /// Creates a new client from the provided stub.
2576 ///
2577 /// The most common case for calling this function is in tests mocking the
2578 /// client's behavior.
2579 pub fn from_stub<T>(stub: T) -> Self
2580 where
2581 T: super::stub::GlobalNetworkEndpointGroups + 'static,
2582 {
2583 Self {
2584 inner: std::sync::Arc::new(stub),
2585 }
2586 }
2587
2588 pub(crate) async fn new(
2589 config: gaxi::options::ClientConfig,
2590 ) -> gax::client_builder::Result<Self> {
2591 let inner = Self::build_inner(config).await?;
2592 Ok(Self { inner })
2593 }
2594
2595 async fn build_inner(
2596 conf: gaxi::options::ClientConfig,
2597 ) -> gax::client_builder::Result<
2598 std::sync::Arc<dyn super::stub::dynamic::GlobalNetworkEndpointGroups>,
2599 > {
2600 if gaxi::options::tracing_enabled(&conf) {
2601 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2602 }
2603 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2604 }
2605
2606 async fn build_transport(
2607 conf: gaxi::options::ClientConfig,
2608 ) -> gax::client_builder::Result<impl super::stub::GlobalNetworkEndpointGroups> {
2609 super::transport::GlobalNetworkEndpointGroups::new(conf).await
2610 }
2611
2612 async fn build_with_tracing(
2613 conf: gaxi::options::ClientConfig,
2614 ) -> gax::client_builder::Result<impl super::stub::GlobalNetworkEndpointGroups> {
2615 Self::build_transport(conf)
2616 .await
2617 .map(super::tracing::GlobalNetworkEndpointGroups::new)
2618 }
2619
2620 /// Attach a network endpoint to the specified network endpoint group.
2621 pub fn attach_network_endpoints(
2622 &self,
2623 ) -> super::builder::global_network_endpoint_groups::AttachNetworkEndpoints {
2624 super::builder::global_network_endpoint_groups::AttachNetworkEndpoints::new(
2625 self.inner.clone(),
2626 )
2627 }
2628
2629 /// Deletes the specified network endpoint group.Note that the NEG cannot be
2630 /// deleted if there are backend services referencing it.
2631 pub fn delete(&self) -> super::builder::global_network_endpoint_groups::Delete {
2632 super::builder::global_network_endpoint_groups::Delete::new(self.inner.clone())
2633 }
2634
2635 /// Detach the network endpoint from the specified network endpoint group.
2636 pub fn detach_network_endpoints(
2637 &self,
2638 ) -> super::builder::global_network_endpoint_groups::DetachNetworkEndpoints {
2639 super::builder::global_network_endpoint_groups::DetachNetworkEndpoints::new(
2640 self.inner.clone(),
2641 )
2642 }
2643
2644 /// Returns the specified network endpoint group.
2645 pub fn get(&self) -> super::builder::global_network_endpoint_groups::Get {
2646 super::builder::global_network_endpoint_groups::Get::new(self.inner.clone())
2647 }
2648
2649 /// Creates a network endpoint group in the specified project using the
2650 /// parameters that are included in the request.
2651 pub fn insert(&self) -> super::builder::global_network_endpoint_groups::Insert {
2652 super::builder::global_network_endpoint_groups::Insert::new(self.inner.clone())
2653 }
2654
2655 /// Retrieves the list of network endpoint groups that are located in the
2656 /// specified project.
2657 pub fn list(&self) -> super::builder::global_network_endpoint_groups::List {
2658 super::builder::global_network_endpoint_groups::List::new(self.inner.clone())
2659 }
2660
2661 /// Lists the network endpoints in the specified network endpoint group.
2662 pub fn list_network_endpoints(
2663 &self,
2664 ) -> super::builder::global_network_endpoint_groups::ListNetworkEndpoints {
2665 super::builder::global_network_endpoint_groups::ListNetworkEndpoints::new(
2666 self.inner.clone(),
2667 )
2668 }
2669
2670 /// Retrieves the specified Operations resource.
2671 pub fn get_operation(&self) -> super::builder::global_network_endpoint_groups::GetOperation {
2672 super::builder::global_network_endpoint_groups::GetOperation::new(self.inner.clone())
2673 }
2674}
2675
2676/// Implements a client for the Google Compute Engine API.
2677///
2678/// # Example
2679/// ```
2680/// # tokio_test::block_on(async {
2681/// # use google_cloud_compute_v1::client::GlobalOperations;
2682/// let client = GlobalOperations::builder().build().await?;
2683/// // use `client` to make requests to the Google Compute Engine API.
2684/// # gax::client_builder::Result::<()>::Ok(()) });
2685/// ```
2686///
2687/// # Service Description
2688///
2689/// Service for the `globalOperations` resource.
2690///
2691/// # Configuration
2692///
2693/// To configure `GlobalOperations` use the `with_*` methods in the type returned
2694/// by [builder()][GlobalOperations::builder]. The default configuration should
2695/// work for most applications. Common configuration changes include
2696///
2697/// * [with_endpoint()]: by default this client uses the global default endpoint
2698/// (`https://compute.googleapis.com`). Applications using regional
2699/// endpoints or running in restricted networks (e.g. a network configured
2700// with [Private Google Access with VPC Service Controls]) may want to
2701/// override this default.
2702/// * [with_credentials()]: by default this client uses
2703/// [Application Default Credentials]. Applications using custom
2704/// authentication may need to override this default.
2705///
2706/// [with_endpoint()]: super::builder::global_operations::ClientBuilder::with_endpoint
2707/// [with_credentials()]: super::builder::global_operations::ClientBuilder::credentials
2708/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2709/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2710///
2711/// # Pooling and Cloning
2712///
2713/// `GlobalOperations` holds a connection pool internally, it is advised to
2714/// create one and the reuse it. You do not need to wrap `GlobalOperations` in
2715/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2716/// already uses an `Arc` internally.
2717#[cfg(feature = "global-operations")]
2718#[cfg_attr(docsrs, doc(cfg(feature = "global-operations")))]
2719#[derive(Clone, Debug)]
2720pub struct GlobalOperations {
2721 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalOperations>,
2722}
2723
2724#[cfg(feature = "global-operations")]
2725impl GlobalOperations {
2726 /// Returns a builder for [GlobalOperations].
2727 ///
2728 /// ```
2729 /// # tokio_test::block_on(async {
2730 /// # use google_cloud_compute_v1::client::GlobalOperations;
2731 /// let client = GlobalOperations::builder().build().await?;
2732 /// # gax::client_builder::Result::<()>::Ok(()) });
2733 /// ```
2734 pub fn builder() -> super::builder::global_operations::ClientBuilder {
2735 gax::client_builder::internal::new_builder(
2736 super::builder::global_operations::client::Factory,
2737 )
2738 }
2739
2740 /// Creates a new client from the provided stub.
2741 ///
2742 /// The most common case for calling this function is in tests mocking the
2743 /// client's behavior.
2744 pub fn from_stub<T>(stub: T) -> Self
2745 where
2746 T: super::stub::GlobalOperations + 'static,
2747 {
2748 Self {
2749 inner: std::sync::Arc::new(stub),
2750 }
2751 }
2752
2753 pub(crate) async fn new(
2754 config: gaxi::options::ClientConfig,
2755 ) -> gax::client_builder::Result<Self> {
2756 let inner = Self::build_inner(config).await?;
2757 Ok(Self { inner })
2758 }
2759
2760 async fn build_inner(
2761 conf: gaxi::options::ClientConfig,
2762 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::GlobalOperations>>
2763 {
2764 if gaxi::options::tracing_enabled(&conf) {
2765 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2766 }
2767 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2768 }
2769
2770 async fn build_transport(
2771 conf: gaxi::options::ClientConfig,
2772 ) -> gax::client_builder::Result<impl super::stub::GlobalOperations> {
2773 super::transport::GlobalOperations::new(conf).await
2774 }
2775
2776 async fn build_with_tracing(
2777 conf: gaxi::options::ClientConfig,
2778 ) -> gax::client_builder::Result<impl super::stub::GlobalOperations> {
2779 Self::build_transport(conf)
2780 .await
2781 .map(super::tracing::GlobalOperations::new)
2782 }
2783
2784 /// Retrieves an aggregated list of all operations.
2785 ///
2786 /// To prevent failure, Google recommends that you set the
2787 /// `returnPartialSuccess` parameter to `true`.
2788 pub fn aggregated_list(&self) -> super::builder::global_operations::AggregatedList {
2789 super::builder::global_operations::AggregatedList::new(self.inner.clone())
2790 }
2791
2792 /// Deletes the specified Operations resource.
2793 pub fn delete(&self) -> super::builder::global_operations::Delete {
2794 super::builder::global_operations::Delete::new(self.inner.clone())
2795 }
2796
2797 /// Retrieves the specified Operations resource.
2798 pub fn get(&self) -> super::builder::global_operations::Get {
2799 super::builder::global_operations::Get::new(self.inner.clone())
2800 }
2801
2802 /// Retrieves a list of Operation resources contained within the specified
2803 /// project.
2804 pub fn list(&self) -> super::builder::global_operations::List {
2805 super::builder::global_operations::List::new(self.inner.clone())
2806 }
2807
2808 /// Waits for the specified Operation resource to return as `DONE`
2809 /// or for the request to approach the 2 minute deadline, and retrieves the
2810 /// specified Operation resource. This method differs from the
2811 /// `GET` method in that it waits for no more than the default
2812 /// deadline (2 minutes) and then returns the current state of the operation,
2813 /// which might be `DONE` or still in progress.
2814 ///
2815 /// This method is called on a best-effort basis. Specifically:
2816 ///
2817 /// ```norust
2818 /// - In uncommon cases, when the server is overloaded, the request might
2819 /// return before the default deadline is reached, or might return after zero
2820 /// seconds.
2821 /// ```
2822 ///
2823 /// - If the default deadline is reached, there is no guarantee that the
2824 /// operation is actually done when the method returns. Be prepared to retry
2825 /// if the operation is not `DONE`.
2826 pub fn wait(&self) -> super::builder::global_operations::Wait {
2827 super::builder::global_operations::Wait::new(self.inner.clone())
2828 }
2829}
2830
2831/// Implements a client for the Google Compute Engine API.
2832///
2833/// # Example
2834/// ```
2835/// # tokio_test::block_on(async {
2836/// # use google_cloud_compute_v1::client::GlobalOrganizationOperations;
2837/// let client = GlobalOrganizationOperations::builder().build().await?;
2838/// // use `client` to make requests to the Google Compute Engine API.
2839/// # gax::client_builder::Result::<()>::Ok(()) });
2840/// ```
2841///
2842/// # Service Description
2843///
2844/// Service for the `globalOrganizationOperations` resource.
2845///
2846/// # Configuration
2847///
2848/// To configure `GlobalOrganizationOperations` use the `with_*` methods in the type returned
2849/// by [builder()][GlobalOrganizationOperations::builder]. The default configuration should
2850/// work for most applications. Common configuration changes include
2851///
2852/// * [with_endpoint()]: by default this client uses the global default endpoint
2853/// (`https://compute.googleapis.com`). Applications using regional
2854/// endpoints or running in restricted networks (e.g. a network configured
2855// with [Private Google Access with VPC Service Controls]) may want to
2856/// override this default.
2857/// * [with_credentials()]: by default this client uses
2858/// [Application Default Credentials]. Applications using custom
2859/// authentication may need to override this default.
2860///
2861/// [with_endpoint()]: super::builder::global_organization_operations::ClientBuilder::with_endpoint
2862/// [with_credentials()]: super::builder::global_organization_operations::ClientBuilder::credentials
2863/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2864/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2865///
2866/// # Pooling and Cloning
2867///
2868/// `GlobalOrganizationOperations` holds a connection pool internally, it is advised to
2869/// create one and the reuse it. You do not need to wrap `GlobalOrganizationOperations` in
2870/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2871/// already uses an `Arc` internally.
2872#[cfg(feature = "global-organization-operations")]
2873#[cfg_attr(docsrs, doc(cfg(feature = "global-organization-operations")))]
2874#[derive(Clone, Debug)]
2875pub struct GlobalOrganizationOperations {
2876 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalOrganizationOperations>,
2877}
2878
2879#[cfg(feature = "global-organization-operations")]
2880impl GlobalOrganizationOperations {
2881 /// Returns a builder for [GlobalOrganizationOperations].
2882 ///
2883 /// ```
2884 /// # tokio_test::block_on(async {
2885 /// # use google_cloud_compute_v1::client::GlobalOrganizationOperations;
2886 /// let client = GlobalOrganizationOperations::builder().build().await?;
2887 /// # gax::client_builder::Result::<()>::Ok(()) });
2888 /// ```
2889 pub fn builder() -> super::builder::global_organization_operations::ClientBuilder {
2890 gax::client_builder::internal::new_builder(
2891 super::builder::global_organization_operations::client::Factory,
2892 )
2893 }
2894
2895 /// Creates a new client from the provided stub.
2896 ///
2897 /// The most common case for calling this function is in tests mocking the
2898 /// client's behavior.
2899 pub fn from_stub<T>(stub: T) -> Self
2900 where
2901 T: super::stub::GlobalOrganizationOperations + 'static,
2902 {
2903 Self {
2904 inner: std::sync::Arc::new(stub),
2905 }
2906 }
2907
2908 pub(crate) async fn new(
2909 config: gaxi::options::ClientConfig,
2910 ) -> gax::client_builder::Result<Self> {
2911 let inner = Self::build_inner(config).await?;
2912 Ok(Self { inner })
2913 }
2914
2915 async fn build_inner(
2916 conf: gaxi::options::ClientConfig,
2917 ) -> gax::client_builder::Result<
2918 std::sync::Arc<dyn super::stub::dynamic::GlobalOrganizationOperations>,
2919 > {
2920 if gaxi::options::tracing_enabled(&conf) {
2921 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2922 }
2923 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2924 }
2925
2926 async fn build_transport(
2927 conf: gaxi::options::ClientConfig,
2928 ) -> gax::client_builder::Result<impl super::stub::GlobalOrganizationOperations> {
2929 super::transport::GlobalOrganizationOperations::new(conf).await
2930 }
2931
2932 async fn build_with_tracing(
2933 conf: gaxi::options::ClientConfig,
2934 ) -> gax::client_builder::Result<impl super::stub::GlobalOrganizationOperations> {
2935 Self::build_transport(conf)
2936 .await
2937 .map(super::tracing::GlobalOrganizationOperations::new)
2938 }
2939
2940 /// Deletes the specified Operations resource.
2941 pub fn delete(&self) -> super::builder::global_organization_operations::Delete {
2942 super::builder::global_organization_operations::Delete::new(self.inner.clone())
2943 }
2944
2945 /// Retrieves the specified Operations resource. Gets a list of operations
2946 /// by making a `list()` request.
2947 pub fn get(&self) -> super::builder::global_organization_operations::Get {
2948 super::builder::global_organization_operations::Get::new(self.inner.clone())
2949 }
2950
2951 /// Retrieves a list of Operation resources contained within the specified
2952 /// organization.
2953 pub fn list(&self) -> super::builder::global_organization_operations::List {
2954 super::builder::global_organization_operations::List::new(self.inner.clone())
2955 }
2956}
2957
2958/// Implements a client for the Google Compute Engine API.
2959///
2960/// # Example
2961/// ```
2962/// # tokio_test::block_on(async {
2963/// # use google_cloud_compute_v1::client::GlobalPublicDelegatedPrefixes;
2964/// let client = GlobalPublicDelegatedPrefixes::builder().build().await?;
2965/// // use `client` to make requests to the Google Compute Engine API.
2966/// # gax::client_builder::Result::<()>::Ok(()) });
2967/// ```
2968///
2969/// # Service Description
2970///
2971/// Service for the `globalPublicDelegatedPrefixes` resource.
2972///
2973/// # Configuration
2974///
2975/// To configure `GlobalPublicDelegatedPrefixes` use the `with_*` methods in the type returned
2976/// by [builder()][GlobalPublicDelegatedPrefixes::builder]. The default configuration should
2977/// work for most applications. Common configuration changes include
2978///
2979/// * [with_endpoint()]: by default this client uses the global default endpoint
2980/// (`https://compute.googleapis.com`). Applications using regional
2981/// endpoints or running in restricted networks (e.g. a network configured
2982// with [Private Google Access with VPC Service Controls]) may want to
2983/// override this default.
2984/// * [with_credentials()]: by default this client uses
2985/// [Application Default Credentials]. Applications using custom
2986/// authentication may need to override this default.
2987///
2988/// [with_endpoint()]: super::builder::global_public_delegated_prefixes::ClientBuilder::with_endpoint
2989/// [with_credentials()]: super::builder::global_public_delegated_prefixes::ClientBuilder::credentials
2990/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2991/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2992///
2993/// # Pooling and Cloning
2994///
2995/// `GlobalPublicDelegatedPrefixes` holds a connection pool internally, it is advised to
2996/// create one and the reuse it. You do not need to wrap `GlobalPublicDelegatedPrefixes` in
2997/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2998/// already uses an `Arc` internally.
2999#[cfg(feature = "global-public-delegated-prefixes")]
3000#[cfg_attr(docsrs, doc(cfg(feature = "global-public-delegated-prefixes")))]
3001#[derive(Clone, Debug)]
3002pub struct GlobalPublicDelegatedPrefixes {
3003 inner: std::sync::Arc<dyn super::stub::dynamic::GlobalPublicDelegatedPrefixes>,
3004}
3005
3006#[cfg(feature = "global-public-delegated-prefixes")]
3007impl GlobalPublicDelegatedPrefixes {
3008 /// Returns a builder for [GlobalPublicDelegatedPrefixes].
3009 ///
3010 /// ```
3011 /// # tokio_test::block_on(async {
3012 /// # use google_cloud_compute_v1::client::GlobalPublicDelegatedPrefixes;
3013 /// let client = GlobalPublicDelegatedPrefixes::builder().build().await?;
3014 /// # gax::client_builder::Result::<()>::Ok(()) });
3015 /// ```
3016 pub fn builder() -> super::builder::global_public_delegated_prefixes::ClientBuilder {
3017 gax::client_builder::internal::new_builder(
3018 super::builder::global_public_delegated_prefixes::client::Factory,
3019 )
3020 }
3021
3022 /// Creates a new client from the provided stub.
3023 ///
3024 /// The most common case for calling this function is in tests mocking the
3025 /// client's behavior.
3026 pub fn from_stub<T>(stub: T) -> Self
3027 where
3028 T: super::stub::GlobalPublicDelegatedPrefixes + 'static,
3029 {
3030 Self {
3031 inner: std::sync::Arc::new(stub),
3032 }
3033 }
3034
3035 pub(crate) async fn new(
3036 config: gaxi::options::ClientConfig,
3037 ) -> gax::client_builder::Result<Self> {
3038 let inner = Self::build_inner(config).await?;
3039 Ok(Self { inner })
3040 }
3041
3042 async fn build_inner(
3043 conf: gaxi::options::ClientConfig,
3044 ) -> gax::client_builder::Result<
3045 std::sync::Arc<dyn super::stub::dynamic::GlobalPublicDelegatedPrefixes>,
3046 > {
3047 if gaxi::options::tracing_enabled(&conf) {
3048 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3049 }
3050 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3051 }
3052
3053 async fn build_transport(
3054 conf: gaxi::options::ClientConfig,
3055 ) -> gax::client_builder::Result<impl super::stub::GlobalPublicDelegatedPrefixes> {
3056 super::transport::GlobalPublicDelegatedPrefixes::new(conf).await
3057 }
3058
3059 async fn build_with_tracing(
3060 conf: gaxi::options::ClientConfig,
3061 ) -> gax::client_builder::Result<impl super::stub::GlobalPublicDelegatedPrefixes> {
3062 Self::build_transport(conf)
3063 .await
3064 .map(super::tracing::GlobalPublicDelegatedPrefixes::new)
3065 }
3066
3067 /// Deletes the specified global PublicDelegatedPrefix.
3068 pub fn delete(&self) -> super::builder::global_public_delegated_prefixes::Delete {
3069 super::builder::global_public_delegated_prefixes::Delete::new(self.inner.clone())
3070 }
3071
3072 /// Returns the specified global PublicDelegatedPrefix resource.
3073 pub fn get(&self) -> super::builder::global_public_delegated_prefixes::Get {
3074 super::builder::global_public_delegated_prefixes::Get::new(self.inner.clone())
3075 }
3076
3077 /// Creates a global PublicDelegatedPrefix in the specified project using the
3078 /// parameters that are included in the request.
3079 pub fn insert(&self) -> super::builder::global_public_delegated_prefixes::Insert {
3080 super::builder::global_public_delegated_prefixes::Insert::new(self.inner.clone())
3081 }
3082
3083 /// Lists the global PublicDelegatedPrefixes for a project.
3084 pub fn list(&self) -> super::builder::global_public_delegated_prefixes::List {
3085 super::builder::global_public_delegated_prefixes::List::new(self.inner.clone())
3086 }
3087
3088 /// Patches the specified global PublicDelegatedPrefix resource with the data
3089 /// included in the request. This method supportsPATCH
3090 /// semantics and usesJSON merge
3091 /// patch format and processing rules.
3092 pub fn patch(&self) -> super::builder::global_public_delegated_prefixes::Patch {
3093 super::builder::global_public_delegated_prefixes::Patch::new(self.inner.clone())
3094 }
3095
3096 /// Retrieves the specified Operations resource.
3097 pub fn get_operation(&self) -> super::builder::global_public_delegated_prefixes::GetOperation {
3098 super::builder::global_public_delegated_prefixes::GetOperation::new(self.inner.clone())
3099 }
3100}
3101
3102/// Implements a client for the Google Compute Engine API.
3103///
3104/// # Example
3105/// ```
3106/// # tokio_test::block_on(async {
3107/// # use google_cloud_compute_v1::client::HealthChecks;
3108/// let client = HealthChecks::builder().build().await?;
3109/// // use `client` to make requests to the Google Compute Engine API.
3110/// # gax::client_builder::Result::<()>::Ok(()) });
3111/// ```
3112///
3113/// # Service Description
3114///
3115/// Service for the `healthChecks` resource.
3116///
3117/// # Configuration
3118///
3119/// To configure `HealthChecks` use the `with_*` methods in the type returned
3120/// by [builder()][HealthChecks::builder]. The default configuration should
3121/// work for most applications. Common configuration changes include
3122///
3123/// * [with_endpoint()]: by default this client uses the global default endpoint
3124/// (`https://compute.googleapis.com`). Applications using regional
3125/// endpoints or running in restricted networks (e.g. a network configured
3126// with [Private Google Access with VPC Service Controls]) may want to
3127/// override this default.
3128/// * [with_credentials()]: by default this client uses
3129/// [Application Default Credentials]. Applications using custom
3130/// authentication may need to override this default.
3131///
3132/// [with_endpoint()]: super::builder::health_checks::ClientBuilder::with_endpoint
3133/// [with_credentials()]: super::builder::health_checks::ClientBuilder::credentials
3134/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3135/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3136///
3137/// # Pooling and Cloning
3138///
3139/// `HealthChecks` holds a connection pool internally, it is advised to
3140/// create one and the reuse it. You do not need to wrap `HealthChecks` in
3141/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3142/// already uses an `Arc` internally.
3143#[cfg(feature = "health-checks")]
3144#[cfg_attr(docsrs, doc(cfg(feature = "health-checks")))]
3145#[derive(Clone, Debug)]
3146pub struct HealthChecks {
3147 inner: std::sync::Arc<dyn super::stub::dynamic::HealthChecks>,
3148}
3149
3150#[cfg(feature = "health-checks")]
3151impl HealthChecks {
3152 /// Returns a builder for [HealthChecks].
3153 ///
3154 /// ```
3155 /// # tokio_test::block_on(async {
3156 /// # use google_cloud_compute_v1::client::HealthChecks;
3157 /// let client = HealthChecks::builder().build().await?;
3158 /// # gax::client_builder::Result::<()>::Ok(()) });
3159 /// ```
3160 pub fn builder() -> super::builder::health_checks::ClientBuilder {
3161 gax::client_builder::internal::new_builder(super::builder::health_checks::client::Factory)
3162 }
3163
3164 /// Creates a new client from the provided stub.
3165 ///
3166 /// The most common case for calling this function is in tests mocking the
3167 /// client's behavior.
3168 pub fn from_stub<T>(stub: T) -> Self
3169 where
3170 T: super::stub::HealthChecks + 'static,
3171 {
3172 Self {
3173 inner: std::sync::Arc::new(stub),
3174 }
3175 }
3176
3177 pub(crate) async fn new(
3178 config: gaxi::options::ClientConfig,
3179 ) -> gax::client_builder::Result<Self> {
3180 let inner = Self::build_inner(config).await?;
3181 Ok(Self { inner })
3182 }
3183
3184 async fn build_inner(
3185 conf: gaxi::options::ClientConfig,
3186 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::HealthChecks>> {
3187 if gaxi::options::tracing_enabled(&conf) {
3188 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3189 }
3190 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3191 }
3192
3193 async fn build_transport(
3194 conf: gaxi::options::ClientConfig,
3195 ) -> gax::client_builder::Result<impl super::stub::HealthChecks> {
3196 super::transport::HealthChecks::new(conf).await
3197 }
3198
3199 async fn build_with_tracing(
3200 conf: gaxi::options::ClientConfig,
3201 ) -> gax::client_builder::Result<impl super::stub::HealthChecks> {
3202 Self::build_transport(conf)
3203 .await
3204 .map(super::tracing::HealthChecks::new)
3205 }
3206
3207 /// Retrieves the list of all HealthCheck resources, regional and global,
3208 /// available to the specified project.
3209 ///
3210 /// To prevent failure, Google recommends that you set the
3211 /// `returnPartialSuccess` parameter to `true`.
3212 pub fn aggregated_list(&self) -> super::builder::health_checks::AggregatedList {
3213 super::builder::health_checks::AggregatedList::new(self.inner.clone())
3214 }
3215
3216 /// Deletes the specified HealthCheck resource.
3217 pub fn delete(&self) -> super::builder::health_checks::Delete {
3218 super::builder::health_checks::Delete::new(self.inner.clone())
3219 }
3220
3221 /// Returns the specified HealthCheck resource.
3222 pub fn get(&self) -> super::builder::health_checks::Get {
3223 super::builder::health_checks::Get::new(self.inner.clone())
3224 }
3225
3226 /// Creates a HealthCheck resource in the specified project using the data
3227 /// included in the request.
3228 pub fn insert(&self) -> super::builder::health_checks::Insert {
3229 super::builder::health_checks::Insert::new(self.inner.clone())
3230 }
3231
3232 /// Retrieves the list of HealthCheck resources available to the specified
3233 /// project.
3234 pub fn list(&self) -> super::builder::health_checks::List {
3235 super::builder::health_checks::List::new(self.inner.clone())
3236 }
3237
3238 /// Updates a HealthCheck resource in the specified project using the data
3239 /// included in the request. This method supportsPATCH
3240 /// semantics and uses theJSON merge
3241 /// patch format and processing rules.
3242 pub fn patch(&self) -> super::builder::health_checks::Patch {
3243 super::builder::health_checks::Patch::new(self.inner.clone())
3244 }
3245
3246 /// Updates a HealthCheck resource in the specified project using the data
3247 /// included in the request.
3248 pub fn update(&self) -> super::builder::health_checks::Update {
3249 super::builder::health_checks::Update::new(self.inner.clone())
3250 }
3251
3252 /// Retrieves the specified Operations resource.
3253 pub fn get_operation(&self) -> super::builder::health_checks::GetOperation {
3254 super::builder::health_checks::GetOperation::new(self.inner.clone())
3255 }
3256}
3257
3258/// Implements a client for the Google Compute Engine API.
3259///
3260/// # Example
3261/// ```
3262/// # tokio_test::block_on(async {
3263/// # use google_cloud_compute_v1::client::HttpHealthChecks;
3264/// let client = HttpHealthChecks::builder().build().await?;
3265/// // use `client` to make requests to the Google Compute Engine API.
3266/// # gax::client_builder::Result::<()>::Ok(()) });
3267/// ```
3268///
3269/// # Service Description
3270///
3271/// Service for the `httpHealthChecks` resource.
3272///
3273/// # Configuration
3274///
3275/// To configure `HttpHealthChecks` use the `with_*` methods in the type returned
3276/// by [builder()][HttpHealthChecks::builder]. The default configuration should
3277/// work for most applications. Common configuration changes include
3278///
3279/// * [with_endpoint()]: by default this client uses the global default endpoint
3280/// (`https://compute.googleapis.com`). Applications using regional
3281/// endpoints or running in restricted networks (e.g. a network configured
3282// with [Private Google Access with VPC Service Controls]) may want to
3283/// override this default.
3284/// * [with_credentials()]: by default this client uses
3285/// [Application Default Credentials]. Applications using custom
3286/// authentication may need to override this default.
3287///
3288/// [with_endpoint()]: super::builder::http_health_checks::ClientBuilder::with_endpoint
3289/// [with_credentials()]: super::builder::http_health_checks::ClientBuilder::credentials
3290/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3291/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3292///
3293/// # Pooling and Cloning
3294///
3295/// `HttpHealthChecks` holds a connection pool internally, it is advised to
3296/// create one and the reuse it. You do not need to wrap `HttpHealthChecks` in
3297/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3298/// already uses an `Arc` internally.
3299#[cfg(feature = "http-health-checks")]
3300#[cfg_attr(docsrs, doc(cfg(feature = "http-health-checks")))]
3301#[derive(Clone, Debug)]
3302pub struct HttpHealthChecks {
3303 inner: std::sync::Arc<dyn super::stub::dynamic::HttpHealthChecks>,
3304}
3305
3306#[cfg(feature = "http-health-checks")]
3307impl HttpHealthChecks {
3308 /// Returns a builder for [HttpHealthChecks].
3309 ///
3310 /// ```
3311 /// # tokio_test::block_on(async {
3312 /// # use google_cloud_compute_v1::client::HttpHealthChecks;
3313 /// let client = HttpHealthChecks::builder().build().await?;
3314 /// # gax::client_builder::Result::<()>::Ok(()) });
3315 /// ```
3316 pub fn builder() -> super::builder::http_health_checks::ClientBuilder {
3317 gax::client_builder::internal::new_builder(
3318 super::builder::http_health_checks::client::Factory,
3319 )
3320 }
3321
3322 /// Creates a new client from the provided stub.
3323 ///
3324 /// The most common case for calling this function is in tests mocking the
3325 /// client's behavior.
3326 pub fn from_stub<T>(stub: T) -> Self
3327 where
3328 T: super::stub::HttpHealthChecks + 'static,
3329 {
3330 Self {
3331 inner: std::sync::Arc::new(stub),
3332 }
3333 }
3334
3335 pub(crate) async fn new(
3336 config: gaxi::options::ClientConfig,
3337 ) -> gax::client_builder::Result<Self> {
3338 let inner = Self::build_inner(config).await?;
3339 Ok(Self { inner })
3340 }
3341
3342 async fn build_inner(
3343 conf: gaxi::options::ClientConfig,
3344 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::HttpHealthChecks>>
3345 {
3346 if gaxi::options::tracing_enabled(&conf) {
3347 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3348 }
3349 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3350 }
3351
3352 async fn build_transport(
3353 conf: gaxi::options::ClientConfig,
3354 ) -> gax::client_builder::Result<impl super::stub::HttpHealthChecks> {
3355 super::transport::HttpHealthChecks::new(conf).await
3356 }
3357
3358 async fn build_with_tracing(
3359 conf: gaxi::options::ClientConfig,
3360 ) -> gax::client_builder::Result<impl super::stub::HttpHealthChecks> {
3361 Self::build_transport(conf)
3362 .await
3363 .map(super::tracing::HttpHealthChecks::new)
3364 }
3365
3366 /// Deletes the specified HttpHealthCheck resource.
3367 pub fn delete(&self) -> super::builder::http_health_checks::Delete {
3368 super::builder::http_health_checks::Delete::new(self.inner.clone())
3369 }
3370
3371 /// Returns the specified HttpHealthCheck resource.
3372 pub fn get(&self) -> super::builder::http_health_checks::Get {
3373 super::builder::http_health_checks::Get::new(self.inner.clone())
3374 }
3375
3376 /// Creates a HttpHealthCheck resource in the specified project using the data
3377 /// included in the request.
3378 pub fn insert(&self) -> super::builder::http_health_checks::Insert {
3379 super::builder::http_health_checks::Insert::new(self.inner.clone())
3380 }
3381
3382 /// Retrieves the list of HttpHealthCheck resources available to the specified
3383 /// project.
3384 pub fn list(&self) -> super::builder::http_health_checks::List {
3385 super::builder::http_health_checks::List::new(self.inner.clone())
3386 }
3387
3388 /// Updates a HttpHealthCheck resource in the specified project using the data
3389 /// included in the request. This method supportsPATCH
3390 /// semantics and uses theJSON merge
3391 /// patch format and processing rules.
3392 pub fn patch(&self) -> super::builder::http_health_checks::Patch {
3393 super::builder::http_health_checks::Patch::new(self.inner.clone())
3394 }
3395
3396 /// Updates a HttpHealthCheck resource in the specified project using the data
3397 /// included in the request.
3398 pub fn update(&self) -> super::builder::http_health_checks::Update {
3399 super::builder::http_health_checks::Update::new(self.inner.clone())
3400 }
3401
3402 /// Retrieves the specified Operations resource.
3403 pub fn get_operation(&self) -> super::builder::http_health_checks::GetOperation {
3404 super::builder::http_health_checks::GetOperation::new(self.inner.clone())
3405 }
3406}
3407
3408/// Implements a client for the Google Compute Engine API.
3409///
3410/// # Example
3411/// ```
3412/// # tokio_test::block_on(async {
3413/// # use google_cloud_compute_v1::client::HttpsHealthChecks;
3414/// let client = HttpsHealthChecks::builder().build().await?;
3415/// // use `client` to make requests to the Google Compute Engine API.
3416/// # gax::client_builder::Result::<()>::Ok(()) });
3417/// ```
3418///
3419/// # Service Description
3420///
3421/// Service for the `httpsHealthChecks` resource.
3422///
3423/// # Configuration
3424///
3425/// To configure `HttpsHealthChecks` use the `with_*` methods in the type returned
3426/// by [builder()][HttpsHealthChecks::builder]. The default configuration should
3427/// work for most applications. Common configuration changes include
3428///
3429/// * [with_endpoint()]: by default this client uses the global default endpoint
3430/// (`https://compute.googleapis.com`). Applications using regional
3431/// endpoints or running in restricted networks (e.g. a network configured
3432// with [Private Google Access with VPC Service Controls]) may want to
3433/// override this default.
3434/// * [with_credentials()]: by default this client uses
3435/// [Application Default Credentials]. Applications using custom
3436/// authentication may need to override this default.
3437///
3438/// [with_endpoint()]: super::builder::https_health_checks::ClientBuilder::with_endpoint
3439/// [with_credentials()]: super::builder::https_health_checks::ClientBuilder::credentials
3440/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3441/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3442///
3443/// # Pooling and Cloning
3444///
3445/// `HttpsHealthChecks` holds a connection pool internally, it is advised to
3446/// create one and the reuse it. You do not need to wrap `HttpsHealthChecks` in
3447/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3448/// already uses an `Arc` internally.
3449#[cfg(feature = "https-health-checks")]
3450#[cfg_attr(docsrs, doc(cfg(feature = "https-health-checks")))]
3451#[derive(Clone, Debug)]
3452pub struct HttpsHealthChecks {
3453 inner: std::sync::Arc<dyn super::stub::dynamic::HttpsHealthChecks>,
3454}
3455
3456#[cfg(feature = "https-health-checks")]
3457impl HttpsHealthChecks {
3458 /// Returns a builder for [HttpsHealthChecks].
3459 ///
3460 /// ```
3461 /// # tokio_test::block_on(async {
3462 /// # use google_cloud_compute_v1::client::HttpsHealthChecks;
3463 /// let client = HttpsHealthChecks::builder().build().await?;
3464 /// # gax::client_builder::Result::<()>::Ok(()) });
3465 /// ```
3466 pub fn builder() -> super::builder::https_health_checks::ClientBuilder {
3467 gax::client_builder::internal::new_builder(
3468 super::builder::https_health_checks::client::Factory,
3469 )
3470 }
3471
3472 /// Creates a new client from the provided stub.
3473 ///
3474 /// The most common case for calling this function is in tests mocking the
3475 /// client's behavior.
3476 pub fn from_stub<T>(stub: T) -> Self
3477 where
3478 T: super::stub::HttpsHealthChecks + 'static,
3479 {
3480 Self {
3481 inner: std::sync::Arc::new(stub),
3482 }
3483 }
3484
3485 pub(crate) async fn new(
3486 config: gaxi::options::ClientConfig,
3487 ) -> gax::client_builder::Result<Self> {
3488 let inner = Self::build_inner(config).await?;
3489 Ok(Self { inner })
3490 }
3491
3492 async fn build_inner(
3493 conf: gaxi::options::ClientConfig,
3494 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::HttpsHealthChecks>>
3495 {
3496 if gaxi::options::tracing_enabled(&conf) {
3497 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3498 }
3499 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3500 }
3501
3502 async fn build_transport(
3503 conf: gaxi::options::ClientConfig,
3504 ) -> gax::client_builder::Result<impl super::stub::HttpsHealthChecks> {
3505 super::transport::HttpsHealthChecks::new(conf).await
3506 }
3507
3508 async fn build_with_tracing(
3509 conf: gaxi::options::ClientConfig,
3510 ) -> gax::client_builder::Result<impl super::stub::HttpsHealthChecks> {
3511 Self::build_transport(conf)
3512 .await
3513 .map(super::tracing::HttpsHealthChecks::new)
3514 }
3515
3516 /// Deletes the specified HttpsHealthCheck resource.
3517 pub fn delete(&self) -> super::builder::https_health_checks::Delete {
3518 super::builder::https_health_checks::Delete::new(self.inner.clone())
3519 }
3520
3521 /// Returns the specified HttpsHealthCheck resource.
3522 pub fn get(&self) -> super::builder::https_health_checks::Get {
3523 super::builder::https_health_checks::Get::new(self.inner.clone())
3524 }
3525
3526 /// Creates a HttpsHealthCheck resource in the specified project using the data
3527 /// included in the request.
3528 pub fn insert(&self) -> super::builder::https_health_checks::Insert {
3529 super::builder::https_health_checks::Insert::new(self.inner.clone())
3530 }
3531
3532 /// Retrieves the list of HttpsHealthCheck resources available to the specified
3533 /// project.
3534 pub fn list(&self) -> super::builder::https_health_checks::List {
3535 super::builder::https_health_checks::List::new(self.inner.clone())
3536 }
3537
3538 /// Updates a HttpsHealthCheck resource in the specified project using the data
3539 /// included in the request. This method supportsPATCH
3540 /// semantics and uses theJSON merge
3541 /// patch format and processing rules.
3542 pub fn patch(&self) -> super::builder::https_health_checks::Patch {
3543 super::builder::https_health_checks::Patch::new(self.inner.clone())
3544 }
3545
3546 /// Updates a HttpsHealthCheck resource in the specified project using the data
3547 /// included in the request.
3548 pub fn update(&self) -> super::builder::https_health_checks::Update {
3549 super::builder::https_health_checks::Update::new(self.inner.clone())
3550 }
3551
3552 /// Retrieves the specified Operations resource.
3553 pub fn get_operation(&self) -> super::builder::https_health_checks::GetOperation {
3554 super::builder::https_health_checks::GetOperation::new(self.inner.clone())
3555 }
3556}
3557
3558/// Implements a client for the Google Compute Engine API.
3559///
3560/// # Example
3561/// ```
3562/// # tokio_test::block_on(async {
3563/// # use google_cloud_compute_v1::client::ImageFamilyViews;
3564/// let client = ImageFamilyViews::builder().build().await?;
3565/// // use `client` to make requests to the Google Compute Engine API.
3566/// # gax::client_builder::Result::<()>::Ok(()) });
3567/// ```
3568///
3569/// # Service Description
3570///
3571/// Service for the `imageFamilyViews` resource.
3572///
3573/// # Configuration
3574///
3575/// To configure `ImageFamilyViews` use the `with_*` methods in the type returned
3576/// by [builder()][ImageFamilyViews::builder]. The default configuration should
3577/// work for most applications. Common configuration changes include
3578///
3579/// * [with_endpoint()]: by default this client uses the global default endpoint
3580/// (`https://compute.googleapis.com`). Applications using regional
3581/// endpoints or running in restricted networks (e.g. a network configured
3582// with [Private Google Access with VPC Service Controls]) may want to
3583/// override this default.
3584/// * [with_credentials()]: by default this client uses
3585/// [Application Default Credentials]. Applications using custom
3586/// authentication may need to override this default.
3587///
3588/// [with_endpoint()]: super::builder::image_family_views::ClientBuilder::with_endpoint
3589/// [with_credentials()]: super::builder::image_family_views::ClientBuilder::credentials
3590/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3591/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3592///
3593/// # Pooling and Cloning
3594///
3595/// `ImageFamilyViews` holds a connection pool internally, it is advised to
3596/// create one and the reuse it. You do not need to wrap `ImageFamilyViews` in
3597/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3598/// already uses an `Arc` internally.
3599#[cfg(feature = "image-family-views")]
3600#[cfg_attr(docsrs, doc(cfg(feature = "image-family-views")))]
3601#[derive(Clone, Debug)]
3602pub struct ImageFamilyViews {
3603 inner: std::sync::Arc<dyn super::stub::dynamic::ImageFamilyViews>,
3604}
3605
3606#[cfg(feature = "image-family-views")]
3607impl ImageFamilyViews {
3608 /// Returns a builder for [ImageFamilyViews].
3609 ///
3610 /// ```
3611 /// # tokio_test::block_on(async {
3612 /// # use google_cloud_compute_v1::client::ImageFamilyViews;
3613 /// let client = ImageFamilyViews::builder().build().await?;
3614 /// # gax::client_builder::Result::<()>::Ok(()) });
3615 /// ```
3616 pub fn builder() -> super::builder::image_family_views::ClientBuilder {
3617 gax::client_builder::internal::new_builder(
3618 super::builder::image_family_views::client::Factory,
3619 )
3620 }
3621
3622 /// Creates a new client from the provided stub.
3623 ///
3624 /// The most common case for calling this function is in tests mocking the
3625 /// client's behavior.
3626 pub fn from_stub<T>(stub: T) -> Self
3627 where
3628 T: super::stub::ImageFamilyViews + 'static,
3629 {
3630 Self {
3631 inner: std::sync::Arc::new(stub),
3632 }
3633 }
3634
3635 pub(crate) async fn new(
3636 config: gaxi::options::ClientConfig,
3637 ) -> gax::client_builder::Result<Self> {
3638 let inner = Self::build_inner(config).await?;
3639 Ok(Self { inner })
3640 }
3641
3642 async fn build_inner(
3643 conf: gaxi::options::ClientConfig,
3644 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ImageFamilyViews>>
3645 {
3646 if gaxi::options::tracing_enabled(&conf) {
3647 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3648 }
3649 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3650 }
3651
3652 async fn build_transport(
3653 conf: gaxi::options::ClientConfig,
3654 ) -> gax::client_builder::Result<impl super::stub::ImageFamilyViews> {
3655 super::transport::ImageFamilyViews::new(conf).await
3656 }
3657
3658 async fn build_with_tracing(
3659 conf: gaxi::options::ClientConfig,
3660 ) -> gax::client_builder::Result<impl super::stub::ImageFamilyViews> {
3661 Self::build_transport(conf)
3662 .await
3663 .map(super::tracing::ImageFamilyViews::new)
3664 }
3665
3666 /// Returns the latest image that is part of an image family, is not
3667 /// deprecated and is rolled out in the specified zone.
3668 pub fn get(&self) -> super::builder::image_family_views::Get {
3669 super::builder::image_family_views::Get::new(self.inner.clone())
3670 }
3671}
3672
3673/// Implements a client for the Google Compute Engine API.
3674///
3675/// # Example
3676/// ```
3677/// # tokio_test::block_on(async {
3678/// # use google_cloud_compute_v1::client::Images;
3679/// let client = Images::builder().build().await?;
3680/// // use `client` to make requests to the Google Compute Engine API.
3681/// # gax::client_builder::Result::<()>::Ok(()) });
3682/// ```
3683///
3684/// # Service Description
3685///
3686/// Service for the `images` resource.
3687///
3688/// # Configuration
3689///
3690/// To configure `Images` use the `with_*` methods in the type returned
3691/// by [builder()][Images::builder]. The default configuration should
3692/// work for most applications. Common configuration changes include
3693///
3694/// * [with_endpoint()]: by default this client uses the global default endpoint
3695/// (`https://compute.googleapis.com`). Applications using regional
3696/// endpoints or running in restricted networks (e.g. a network configured
3697// with [Private Google Access with VPC Service Controls]) may want to
3698/// override this default.
3699/// * [with_credentials()]: by default this client uses
3700/// [Application Default Credentials]. Applications using custom
3701/// authentication may need to override this default.
3702///
3703/// [with_endpoint()]: super::builder::images::ClientBuilder::with_endpoint
3704/// [with_credentials()]: super::builder::images::ClientBuilder::credentials
3705/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3706/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3707///
3708/// # Pooling and Cloning
3709///
3710/// `Images` holds a connection pool internally, it is advised to
3711/// create one and the reuse it. You do not need to wrap `Images` in
3712/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3713/// already uses an `Arc` internally.
3714#[cfg(feature = "images")]
3715#[cfg_attr(docsrs, doc(cfg(feature = "images")))]
3716#[derive(Clone, Debug)]
3717pub struct Images {
3718 inner: std::sync::Arc<dyn super::stub::dynamic::Images>,
3719}
3720
3721#[cfg(feature = "images")]
3722impl Images {
3723 /// Returns a builder for [Images].
3724 ///
3725 /// ```
3726 /// # tokio_test::block_on(async {
3727 /// # use google_cloud_compute_v1::client::Images;
3728 /// let client = Images::builder().build().await?;
3729 /// # gax::client_builder::Result::<()>::Ok(()) });
3730 /// ```
3731 pub fn builder() -> super::builder::images::ClientBuilder {
3732 gax::client_builder::internal::new_builder(super::builder::images::client::Factory)
3733 }
3734
3735 /// Creates a new client from the provided stub.
3736 ///
3737 /// The most common case for calling this function is in tests mocking the
3738 /// client's behavior.
3739 pub fn from_stub<T>(stub: T) -> Self
3740 where
3741 T: super::stub::Images + 'static,
3742 {
3743 Self {
3744 inner: std::sync::Arc::new(stub),
3745 }
3746 }
3747
3748 pub(crate) async fn new(
3749 config: gaxi::options::ClientConfig,
3750 ) -> gax::client_builder::Result<Self> {
3751 let inner = Self::build_inner(config).await?;
3752 Ok(Self { inner })
3753 }
3754
3755 async fn build_inner(
3756 conf: gaxi::options::ClientConfig,
3757 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Images>> {
3758 if gaxi::options::tracing_enabled(&conf) {
3759 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3760 }
3761 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3762 }
3763
3764 async fn build_transport(
3765 conf: gaxi::options::ClientConfig,
3766 ) -> gax::client_builder::Result<impl super::stub::Images> {
3767 super::transport::Images::new(conf).await
3768 }
3769
3770 async fn build_with_tracing(
3771 conf: gaxi::options::ClientConfig,
3772 ) -> gax::client_builder::Result<impl super::stub::Images> {
3773 Self::build_transport(conf)
3774 .await
3775 .map(super::tracing::Images::new)
3776 }
3777
3778 /// Deletes the specified image.
3779 pub fn delete(&self) -> super::builder::images::Delete {
3780 super::builder::images::Delete::new(self.inner.clone())
3781 }
3782
3783 /// Sets the deprecation status of an image.
3784 ///
3785 /// If an empty request body is given, clears the deprecation status instead.
3786 pub fn deprecate(&self) -> super::builder::images::Deprecate {
3787 super::builder::images::Deprecate::new(self.inner.clone())
3788 }
3789
3790 /// Returns the specified image.
3791 pub fn get(&self) -> super::builder::images::Get {
3792 super::builder::images::Get::new(self.inner.clone())
3793 }
3794
3795 /// Returns the latest image that is part of an image family and is not
3796 /// deprecated. For more information on image families, seePublic
3797 /// image families documentation.
3798 pub fn get_from_family(&self) -> super::builder::images::GetFromFamily {
3799 super::builder::images::GetFromFamily::new(self.inner.clone())
3800 }
3801
3802 /// Gets the access control policy for a resource. May be empty if no such
3803 /// policy or resource exists.
3804 pub fn get_iam_policy(&self) -> super::builder::images::GetIamPolicy {
3805 super::builder::images::GetIamPolicy::new(self.inner.clone())
3806 }
3807
3808 /// Creates an image in the specified project using the data included
3809 /// in the request.
3810 pub fn insert(&self) -> super::builder::images::Insert {
3811 super::builder::images::Insert::new(self.inner.clone())
3812 }
3813
3814 /// Retrieves the list of custom images
3815 /// available to the specified project. Custom images are images you
3816 /// create that belong to your project. This method does not
3817 /// get any images that belong to other projects, including publicly-available
3818 /// images, like Debian 8. If you want to get a list of publicly-available
3819 /// images, use this method to make a request to the respective image project,
3820 /// such as debian-cloud or windows-cloud.
3821 pub fn list(&self) -> super::builder::images::List {
3822 super::builder::images::List::new(self.inner.clone())
3823 }
3824
3825 /// Patches the specified image with the data included in the request.
3826 /// Only the following fields can be modified: family, description,
3827 /// deprecation status.
3828 pub fn patch(&self) -> super::builder::images::Patch {
3829 super::builder::images::Patch::new(self.inner.clone())
3830 }
3831
3832 /// Sets the access control policy on the specified resource.
3833 /// Replaces any existing policy.
3834 pub fn set_iam_policy(&self) -> super::builder::images::SetIamPolicy {
3835 super::builder::images::SetIamPolicy::new(self.inner.clone())
3836 }
3837
3838 /// Sets the labels on an image. To learn more about labels, read theLabeling
3839 /// Resources documentation.
3840 pub fn set_labels(&self) -> super::builder::images::SetLabels {
3841 super::builder::images::SetLabels::new(self.inner.clone())
3842 }
3843
3844 /// Returns permissions that a caller has on the specified resource.
3845 pub fn test_iam_permissions(&self) -> super::builder::images::TestIamPermissions {
3846 super::builder::images::TestIamPermissions::new(self.inner.clone())
3847 }
3848
3849 /// Retrieves the specified Operations resource.
3850 pub fn get_operation(&self) -> super::builder::images::GetOperation {
3851 super::builder::images::GetOperation::new(self.inner.clone())
3852 }
3853}
3854
3855/// Implements a client for the Google Compute Engine API.
3856///
3857/// # Example
3858/// ```
3859/// # tokio_test::block_on(async {
3860/// # use google_cloud_compute_v1::client::InstanceGroupManagerResizeRequests;
3861/// let client = InstanceGroupManagerResizeRequests::builder().build().await?;
3862/// // use `client` to make requests to the Google Compute Engine API.
3863/// # gax::client_builder::Result::<()>::Ok(()) });
3864/// ```
3865///
3866/// # Service Description
3867///
3868/// Service for the `instanceGroupManagerResizeRequests` resource.
3869///
3870/// # Configuration
3871///
3872/// To configure `InstanceGroupManagerResizeRequests` use the `with_*` methods in the type returned
3873/// by [builder()][InstanceGroupManagerResizeRequests::builder]. The default configuration should
3874/// work for most applications. Common configuration changes include
3875///
3876/// * [with_endpoint()]: by default this client uses the global default endpoint
3877/// (`https://compute.googleapis.com`). Applications using regional
3878/// endpoints or running in restricted networks (e.g. a network configured
3879// with [Private Google Access with VPC Service Controls]) may want to
3880/// override this default.
3881/// * [with_credentials()]: by default this client uses
3882/// [Application Default Credentials]. Applications using custom
3883/// authentication may need to override this default.
3884///
3885/// [with_endpoint()]: super::builder::instance_group_manager_resize_requests::ClientBuilder::with_endpoint
3886/// [with_credentials()]: super::builder::instance_group_manager_resize_requests::ClientBuilder::credentials
3887/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
3888/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
3889///
3890/// # Pooling and Cloning
3891///
3892/// `InstanceGroupManagerResizeRequests` holds a connection pool internally, it is advised to
3893/// create one and the reuse it. You do not need to wrap `InstanceGroupManagerResizeRequests` in
3894/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
3895/// already uses an `Arc` internally.
3896#[cfg(feature = "instance-group-manager-resize-requests")]
3897#[cfg_attr(docsrs, doc(cfg(feature = "instance-group-manager-resize-requests")))]
3898#[derive(Clone, Debug)]
3899pub struct InstanceGroupManagerResizeRequests {
3900 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagerResizeRequests>,
3901}
3902
3903#[cfg(feature = "instance-group-manager-resize-requests")]
3904impl InstanceGroupManagerResizeRequests {
3905 /// Returns a builder for [InstanceGroupManagerResizeRequests].
3906 ///
3907 /// ```
3908 /// # tokio_test::block_on(async {
3909 /// # use google_cloud_compute_v1::client::InstanceGroupManagerResizeRequests;
3910 /// let client = InstanceGroupManagerResizeRequests::builder().build().await?;
3911 /// # gax::client_builder::Result::<()>::Ok(()) });
3912 /// ```
3913 pub fn builder() -> super::builder::instance_group_manager_resize_requests::ClientBuilder {
3914 gax::client_builder::internal::new_builder(
3915 super::builder::instance_group_manager_resize_requests::client::Factory,
3916 )
3917 }
3918
3919 /// Creates a new client from the provided stub.
3920 ///
3921 /// The most common case for calling this function is in tests mocking the
3922 /// client's behavior.
3923 pub fn from_stub<T>(stub: T) -> Self
3924 where
3925 T: super::stub::InstanceGroupManagerResizeRequests + 'static,
3926 {
3927 Self {
3928 inner: std::sync::Arc::new(stub),
3929 }
3930 }
3931
3932 pub(crate) async fn new(
3933 config: gaxi::options::ClientConfig,
3934 ) -> gax::client_builder::Result<Self> {
3935 let inner = Self::build_inner(config).await?;
3936 Ok(Self { inner })
3937 }
3938
3939 async fn build_inner(
3940 conf: gaxi::options::ClientConfig,
3941 ) -> gax::client_builder::Result<
3942 std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagerResizeRequests>,
3943 > {
3944 if gaxi::options::tracing_enabled(&conf) {
3945 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3946 }
3947 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3948 }
3949
3950 async fn build_transport(
3951 conf: gaxi::options::ClientConfig,
3952 ) -> gax::client_builder::Result<impl super::stub::InstanceGroupManagerResizeRequests> {
3953 super::transport::InstanceGroupManagerResizeRequests::new(conf).await
3954 }
3955
3956 async fn build_with_tracing(
3957 conf: gaxi::options::ClientConfig,
3958 ) -> gax::client_builder::Result<impl super::stub::InstanceGroupManagerResizeRequests> {
3959 Self::build_transport(conf)
3960 .await
3961 .map(super::tracing::InstanceGroupManagerResizeRequests::new)
3962 }
3963
3964 /// Cancels the specified resize request and removes it from the queue.
3965 /// Cancelled resize request does no longer wait for the resources to be
3966 /// provisioned. Cancel is only possible for requests that are accepted in the
3967 /// queue.
3968 pub fn cancel(&self) -> super::builder::instance_group_manager_resize_requests::Cancel {
3969 super::builder::instance_group_manager_resize_requests::Cancel::new(self.inner.clone())
3970 }
3971
3972 /// Deletes the specified, inactive resize request. Requests that are still
3973 /// active cannot be deleted. Deleting request does not delete instances that
3974 /// were provisioned previously.
3975 pub fn delete(&self) -> super::builder::instance_group_manager_resize_requests::Delete {
3976 super::builder::instance_group_manager_resize_requests::Delete::new(self.inner.clone())
3977 }
3978
3979 /// Returns all of the details about the specified resize request.
3980 pub fn get(&self) -> super::builder::instance_group_manager_resize_requests::Get {
3981 super::builder::instance_group_manager_resize_requests::Get::new(self.inner.clone())
3982 }
3983
3984 /// Creates a new resize request that starts provisioning VMs immediately
3985 /// or queues VM creation.
3986 pub fn insert(&self) -> super::builder::instance_group_manager_resize_requests::Insert {
3987 super::builder::instance_group_manager_resize_requests::Insert::new(self.inner.clone())
3988 }
3989
3990 /// Retrieves a list of resize requests that are contained in the
3991 /// managed instance group.
3992 pub fn list(&self) -> super::builder::instance_group_manager_resize_requests::List {
3993 super::builder::instance_group_manager_resize_requests::List::new(self.inner.clone())
3994 }
3995
3996 /// Retrieves the specified zone-specific Operations resource.
3997 pub fn get_operation(
3998 &self,
3999 ) -> super::builder::instance_group_manager_resize_requests::GetOperation {
4000 super::builder::instance_group_manager_resize_requests::GetOperation::new(
4001 self.inner.clone(),
4002 )
4003 }
4004}
4005
4006/// Implements a client for the Google Compute Engine API.
4007///
4008/// # Example
4009/// ```
4010/// # tokio_test::block_on(async {
4011/// # use google_cloud_compute_v1::client::InstanceGroupManagers;
4012/// let client = InstanceGroupManagers::builder().build().await?;
4013/// // use `client` to make requests to the Google Compute Engine API.
4014/// # gax::client_builder::Result::<()>::Ok(()) });
4015/// ```
4016///
4017/// # Service Description
4018///
4019/// Service for the `instanceGroupManagers` resource.
4020///
4021/// # Configuration
4022///
4023/// To configure `InstanceGroupManagers` use the `with_*` methods in the type returned
4024/// by [builder()][InstanceGroupManagers::builder]. The default configuration should
4025/// work for most applications. Common configuration changes include
4026///
4027/// * [with_endpoint()]: by default this client uses the global default endpoint
4028/// (`https://compute.googleapis.com`). Applications using regional
4029/// endpoints or running in restricted networks (e.g. a network configured
4030// with [Private Google Access with VPC Service Controls]) may want to
4031/// override this default.
4032/// * [with_credentials()]: by default this client uses
4033/// [Application Default Credentials]. Applications using custom
4034/// authentication may need to override this default.
4035///
4036/// [with_endpoint()]: super::builder::instance_group_managers::ClientBuilder::with_endpoint
4037/// [with_credentials()]: super::builder::instance_group_managers::ClientBuilder::credentials
4038/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4039/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4040///
4041/// # Pooling and Cloning
4042///
4043/// `InstanceGroupManagers` holds a connection pool internally, it is advised to
4044/// create one and the reuse it. You do not need to wrap `InstanceGroupManagers` in
4045/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4046/// already uses an `Arc` internally.
4047#[cfg(feature = "instance-group-managers")]
4048#[cfg_attr(docsrs, doc(cfg(feature = "instance-group-managers")))]
4049#[derive(Clone, Debug)]
4050pub struct InstanceGroupManagers {
4051 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagers>,
4052}
4053
4054#[cfg(feature = "instance-group-managers")]
4055impl InstanceGroupManagers {
4056 /// Returns a builder for [InstanceGroupManagers].
4057 ///
4058 /// ```
4059 /// # tokio_test::block_on(async {
4060 /// # use google_cloud_compute_v1::client::InstanceGroupManagers;
4061 /// let client = InstanceGroupManagers::builder().build().await?;
4062 /// # gax::client_builder::Result::<()>::Ok(()) });
4063 /// ```
4064 pub fn builder() -> super::builder::instance_group_managers::ClientBuilder {
4065 gax::client_builder::internal::new_builder(
4066 super::builder::instance_group_managers::client::Factory,
4067 )
4068 }
4069
4070 /// Creates a new client from the provided stub.
4071 ///
4072 /// The most common case for calling this function is in tests mocking the
4073 /// client's behavior.
4074 pub fn from_stub<T>(stub: T) -> Self
4075 where
4076 T: super::stub::InstanceGroupManagers + 'static,
4077 {
4078 Self {
4079 inner: std::sync::Arc::new(stub),
4080 }
4081 }
4082
4083 pub(crate) async fn new(
4084 config: gaxi::options::ClientConfig,
4085 ) -> gax::client_builder::Result<Self> {
4086 let inner = Self::build_inner(config).await?;
4087 Ok(Self { inner })
4088 }
4089
4090 async fn build_inner(
4091 conf: gaxi::options::ClientConfig,
4092 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InstanceGroupManagers>>
4093 {
4094 if gaxi::options::tracing_enabled(&conf) {
4095 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4096 }
4097 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4098 }
4099
4100 async fn build_transport(
4101 conf: gaxi::options::ClientConfig,
4102 ) -> gax::client_builder::Result<impl super::stub::InstanceGroupManagers> {
4103 super::transport::InstanceGroupManagers::new(conf).await
4104 }
4105
4106 async fn build_with_tracing(
4107 conf: gaxi::options::ClientConfig,
4108 ) -> gax::client_builder::Result<impl super::stub::InstanceGroupManagers> {
4109 Self::build_transport(conf)
4110 .await
4111 .map(super::tracing::InstanceGroupManagers::new)
4112 }
4113
4114 /// Flags the specified instances to be removed from the
4115 /// managed instance group. Abandoning an instance does not delete the
4116 /// instance, but it does remove the instance from any target pools that are
4117 /// applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
4118 /// number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
4119 /// not yet been removed from the group. You must separately verify the
4120 /// status of the abandoning action with thelistmanagedinstances
4121 /// method.
4122 ///
4123 /// If the group is part of a backend
4124 /// service that has enabled
4125 /// connection draining, it can take up to 60 seconds after the connection
4126 /// draining duration has elapsed before the VM instance is removed or deleted.
4127 ///
4128 /// You can specify a maximum of 1000 instances with this method per request.
4129 pub fn abandon_instances(&self) -> super::builder::instance_group_managers::AbandonInstances {
4130 super::builder::instance_group_managers::AbandonInstances::new(self.inner.clone())
4131 }
4132
4133 /// Retrieves the list of managed instance groups and groups them by zone.
4134 ///
4135 /// To prevent failure, Google recommends that you set the
4136 /// `returnPartialSuccess` parameter to `true`.
4137 pub fn aggregated_list(&self) -> super::builder::instance_group_managers::AggregatedList {
4138 super::builder::instance_group_managers::AggregatedList::new(self.inner.clone())
4139 }
4140
4141 /// Applies changes to selected instances on the managed instance group.
4142 /// This method can be used to apply new overrides and/or new versions.
4143 pub fn apply_updates_to_instances(
4144 &self,
4145 ) -> super::builder::instance_group_managers::ApplyUpdatesToInstances {
4146 super::builder::instance_group_managers::ApplyUpdatesToInstances::new(self.inner.clone())
4147 }
4148
4149 /// Creates instances with per-instance configurations in this managed instance
4150 /// group. Instances are created using the current instance template. Thecreate instances operation is marked DONE if thecreateInstances request is successful. The underlying actions
4151 /// take additional time. You must separately verify the status of thecreating or actions with the listmanagedinstances
4152 /// method.
4153 pub fn create_instances(&self) -> super::builder::instance_group_managers::CreateInstances {
4154 super::builder::instance_group_managers::CreateInstances::new(self.inner.clone())
4155 }
4156
4157 /// Deletes the specified managed instance group and all of the instances
4158 /// in that group. Note that the instance group must not belong to a
4159 /// backend service. Read
4160 /// Deleting an instance group for more information.
4161 pub fn delete(&self) -> super::builder::instance_group_managers::Delete {
4162 super::builder::instance_group_managers::Delete::new(self.inner.clone())
4163 }
4164
4165 /// Flags the specified instances in the managed instance group for immediate
4166 /// deletion. The instances are also removed from any target
4167 /// pools of which they were a member. This method reduces thetargetSize of the managed instance group by the number of
4168 /// instances that you delete. This operation is marked as DONE
4169 /// when the action is scheduled even if the instances are still being deleted.
4170 /// You must separately verify the status of the deleting action
4171 /// with thelistmanagedinstances
4172 /// method.
4173 ///
4174 /// If the group is part of a backend
4175 /// service that has enabled
4176 /// connection draining, it can take up to 60 seconds after the connection
4177 /// draining duration has elapsed before the VM instance is removed or deleted.
4178 ///
4179 /// You can specify a maximum of 1000 instances with this method per request.
4180 pub fn delete_instances(&self) -> super::builder::instance_group_managers::DeleteInstances {
4181 super::builder::instance_group_managers::DeleteInstances::new(self.inner.clone())
4182 }
4183
4184 /// Deletes selected per-instance configurations for the managed instance
4185 /// group.
4186 pub fn delete_per_instance_configs(
4187 &self,
4188 ) -> super::builder::instance_group_managers::DeletePerInstanceConfigs {
4189 super::builder::instance_group_managers::DeletePerInstanceConfigs::new(self.inner.clone())
4190 }
4191
4192 /// Returns all of the details about the specified managed instance group.
4193 pub fn get(&self) -> super::builder::instance_group_managers::Get {
4194 super::builder::instance_group_managers::Get::new(self.inner.clone())
4195 }
4196
4197 /// Creates a managed instance group using the information that you specify
4198 /// in the request. After the group is created, instances in the group are
4199 /// created using the specified instance template.
4200 /// This operation is marked as DONE when the group is created
4201 /// even if the instances in the group have not yet been created. You
4202 /// must separately verify the status of the individual instances with thelistmanagedinstances
4203 /// method.
4204 ///
4205 /// A managed instance group can have up to 1000 VM instances per group. Please
4206 /// contact Cloud Support if you need an increase in
4207 /// this limit.
4208 pub fn insert(&self) -> super::builder::instance_group_managers::Insert {
4209 super::builder::instance_group_managers::Insert::new(self.inner.clone())
4210 }
4211
4212 /// Retrieves a list of managed instance groups that are contained within the
4213 /// specified project and zone.
4214 pub fn list(&self) -> super::builder::instance_group_managers::List {
4215 super::builder::instance_group_managers::List::new(self.inner.clone())
4216 }
4217
4218 /// Lists all errors thrown by actions on instances for a given managed
4219 /// instance group. The filter and orderBy query
4220 /// parameters are not supported.
4221 pub fn list_errors(&self) -> super::builder::instance_group_managers::ListErrors {
4222 super::builder::instance_group_managers::ListErrors::new(self.inner.clone())
4223 }
4224
4225 /// Lists all of the instances in the managed instance group. Each instance
4226 /// in the list has a currentAction, which indicates the action
4227 /// that the managed instance group is performing on the instance. For example,
4228 /// if the group is still creating an instance, the currentAction
4229 /// is CREATING. If a previous action failed, the
4230 /// list displays the errors for that failed action. The orderBy
4231 /// query parameter is not supported. The `pageToken` query parameter is
4232 /// supported only if the group's `listManagedInstancesResults` field is set
4233 /// to `PAGINATED`.
4234 pub fn list_managed_instances(
4235 &self,
4236 ) -> super::builder::instance_group_managers::ListManagedInstances {
4237 super::builder::instance_group_managers::ListManagedInstances::new(self.inner.clone())
4238 }
4239
4240 /// Lists all of the per-instance configurations defined for the managed
4241 /// instance group. The orderBy query parameter is not supported.
4242 pub fn list_per_instance_configs(
4243 &self,
4244 ) -> super::builder::instance_group_managers::ListPerInstanceConfigs {
4245 super::builder::instance_group_managers::ListPerInstanceConfigs::new(self.inner.clone())
4246 }
4247
4248 /// Updates a managed instance group using the information that you specify
4249 /// in the request.
4250 /// This operation is marked as DONE when the group is patched
4251 /// even if the instances in the group are still in the process of being
4252 /// patched. You must separately verify the status of the individual instances
4253 /// with thelistManagedInstances
4254 /// method. This method supportsPATCH
4255 /// semantics and uses theJSON merge
4256 /// patch format and processing rules.
4257 ///
4258 /// If you update your group to specify a new template or instance
4259 /// configuration, it's possible that your intended specification for each VM
4260 /// in the group is different from the current state of that VM. To learn how
4261 /// to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
4262 /// a MIG.
4263 pub fn patch(&self) -> super::builder::instance_group_managers::Patch {
4264 super::builder::instance_group_managers::Patch::new(self.inner.clone())
4265 }
4266
4267 /// Inserts or patches per-instance configurations for the managed instance
4268 /// group. perInstanceConfig.name serves as a key used to
4269 /// distinguish whether to perform insert or patch.
4270 pub fn patch_per_instance_configs(
4271 &self,
4272 ) -> super::builder::instance_group_managers::PatchPerInstanceConfigs {
4273 super::builder::instance_group_managers::PatchPerInstanceConfigs::new(self.inner.clone())
4274 }
4275
4276 /// Flags the specified VM instances in the managed instance group to be
4277 /// immediately recreated. Each instance is recreated using the group's current
4278 /// configuration. This operation is marked as DONE when the flag
4279 /// is set even if the instances have not yet been recreated. You must
4280 /// separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
4281 /// the status of managed instances.
4282 ///
4283 /// If the group is part of a backend
4284 /// service that has enabled
4285 /// connection draining, it can take up to 60 seconds after the connection
4286 /// draining duration has elapsed before the VM instance is removed or deleted.
4287 ///
4288 /// You can specify a maximum of 1000 instances with this method per request.
4289 pub fn recreate_instances(&self) -> super::builder::instance_group_managers::RecreateInstances {
4290 super::builder::instance_group_managers::RecreateInstances::new(self.inner.clone())
4291 }
4292
4293 /// Resizes the managed instance group. If you increase the size, the group
4294 /// creates new instances using the current instance template. If you decrease
4295 /// the size, the group deletes instances. The resize operation is markedDONE when the resize actions are scheduled even if the group
4296 /// has not yet added or deleted any instances. You must separately
4297 /// verify the status of the creating or deleting
4298 /// actions with thelistmanagedinstances
4299 /// method.
4300 ///
4301 /// When resizing down, the instance group arbitrarily chooses the order in
4302 /// which VMs are deleted. The group takes into account some VM attributes when
4303 /// making the selection including:
4304 ///
4305 /// + The status of the VM instance.
4306 /// + The health of the VM instance.
4307 /// + The instance template version the VM is based on.
4308 /// + For regional managed instance groups, the location of the VM instance.
4309 ///
4310 /// This list is subject to change.
4311 ///
4312 /// If the group is part of a backend
4313 /// service that has enabled
4314 /// connection draining, it can take up to 60 seconds after the connection
4315 /// draining duration has elapsed before the VM instance is removed or deleted.
4316 pub fn resize(&self) -> super::builder::instance_group_managers::Resize {
4317 super::builder::instance_group_managers::Resize::new(self.inner.clone())
4318 }
4319
4320 /// Flags the specified instances in the managed instance group to be
4321 /// resumed. This method increases thetargetSize and decreases the targetSuspendedSize
4322 /// of the managed instance group by the number of instances that you resume.
4323 /// The resumeInstances operation is marked DONE if
4324 /// the resumeInstances request is successful. The underlying
4325 /// actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
4326 /// method.
4327 ///
4328 /// In this request, you can only specify instances that are suspended. For
4329 /// example, if an instance was previously suspended using the suspendInstances
4330 /// method, it can be resumed using the resumeInstances method.
4331 ///
4332 /// If a health check is attached to the managed instance group, the specified
4333 /// instances will be verified as healthy after they are resumed.
4334 ///
4335 /// You can specify a maximum of 1000 instances with this method per request.
4336 pub fn resume_instances(&self) -> super::builder::instance_group_managers::ResumeInstances {
4337 super::builder::instance_group_managers::ResumeInstances::new(self.inner.clone())
4338 }
4339
4340 /// Specifies the instance template to use when creating new instances in this
4341 /// group. The templates for existing instances in the group do not change
4342 /// unless you run recreateInstances, runapplyUpdatesToInstances, or set the group'supdatePolicy.type to PROACTIVE.
4343 pub fn set_instance_template(
4344 &self,
4345 ) -> super::builder::instance_group_managers::SetInstanceTemplate {
4346 super::builder::instance_group_managers::SetInstanceTemplate::new(self.inner.clone())
4347 }
4348
4349 /// Modifies the target pools to which all instances in this managed instance
4350 /// group are assigned. The target pools automatically apply to all of the
4351 /// instances in the managed instance group. This operation is markedDONE when you make the request even if the instances have not
4352 /// yet been added to their target pools. The change might take some time to
4353 /// apply to all of the instances in the group depending on the size of the
4354 /// group.
4355 pub fn set_target_pools(&self) -> super::builder::instance_group_managers::SetTargetPools {
4356 super::builder::instance_group_managers::SetTargetPools::new(self.inner.clone())
4357 }
4358
4359 /// Flags the specified instances in the managed instance group to be
4360 /// started. This method increases thetargetSize and decreases the targetStoppedSize
4361 /// of the managed instance group by the number of instances that you start.
4362 /// The startInstances operation is marked DONE if
4363 /// the startInstances request is successful. The underlying
4364 /// actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
4365 /// method.
4366 ///
4367 /// In this request, you can only specify instances that are stopped. For
4368 /// example, if an instance was previously stopped using the stopInstances
4369 /// method, it can be started using the startInstances method.
4370 ///
4371 /// If a health check is attached to the managed instance group, the specified
4372 /// instances will be verified as healthy after they are started.
4373 ///
4374 /// You can specify a maximum of 1000 instances with this method per request.
4375 pub fn start_instances(&self) -> super::builder::instance_group_managers::StartInstances {
4376 super::builder::instance_group_managers::StartInstances::new(self.inner.clone())
4377 }
4378
4379 /// Flags the specified instances in the managed instance group to be
4380 /// immediately stopped. You can only specify instances that are running in
4381 /// this request. This method reduces thetargetSize and increases the targetStoppedSize
4382 /// of the managed instance group by the number of instances that you stop.
4383 /// The stopInstances operation is marked DONE if
4384 /// the stopInstances request is successful. The underlying
4385 /// actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
4386 /// method.
4387 ///
4388 /// If the standbyPolicy.initialDelaySec field is set, the group
4389 /// delays stopping the instances until initialDelaySec have
4390 /// passed from instance.creationTimestamp (that is, when the
4391 /// instance was created). This delay gives your application time to
4392 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
4393 /// will be zero delay.
4394 ///
4395 /// If the group is part of a backend
4396 /// service that has enabled
4397 /// connection draining, it can take up to 60 seconds after the connection
4398 /// draining duration has elapsed before the VM instance is stopped.
4399 ///
4400 /// Stopped instances can be started using the startInstances
4401 /// method.
4402 ///
4403 /// You can specify a maximum of 1000 instances with this method per request.
4404 pub fn stop_instances(&self) -> super::builder::instance_group_managers::StopInstances {
4405 super::builder::instance_group_managers::StopInstances::new(self.inner.clone())
4406 }
4407
4408 /// Flags the specified instances in the managed instance group to be
4409 /// immediately suspended. You can only specify instances that are running in
4410 /// this request. This method reduces thetargetSize and increases the targetSuspendedSize
4411 /// of the managed instance group by the number of instances that you suspend.
4412 /// The suspendInstances operation is marked DONE if
4413 /// the suspendInstances request is successful. The underlying
4414 /// actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
4415 /// method.
4416 ///
4417 /// If the standbyPolicy.initialDelaySec field is set, the group
4418 /// delays suspension of the instances until initialDelaySec have
4419 /// passed from instance.creationTimestamp (that is, when the
4420 /// instance was created). This delay gives your application time to
4421 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
4422 /// will be zero delay.
4423 ///
4424 /// If the group is part of a backend
4425 /// service that has enabled
4426 /// connection draining, it can take up to 60 seconds after the connection
4427 /// draining duration has elapsed before the VM instance is suspended.
4428 ///
4429 /// Suspended instances can be resumed using the resumeInstances
4430 /// method.
4431 ///
4432 /// You can specify a maximum of 1000 instances with this method per request.
4433 pub fn suspend_instances(&self) -> super::builder::instance_group_managers::SuspendInstances {
4434 super::builder::instance_group_managers::SuspendInstances::new(self.inner.clone())
4435 }
4436
4437 /// Inserts or updates per-instance configurations for the managed instance
4438 /// group. perInstanceConfig.name serves as a key used to
4439 /// distinguish whether to perform insert or patch.
4440 pub fn update_per_instance_configs(
4441 &self,
4442 ) -> super::builder::instance_group_managers::UpdatePerInstanceConfigs {
4443 super::builder::instance_group_managers::UpdatePerInstanceConfigs::new(self.inner.clone())
4444 }
4445
4446 /// Retrieves the specified zone-specific Operations resource.
4447 pub fn get_operation(&self) -> super::builder::instance_group_managers::GetOperation {
4448 super::builder::instance_group_managers::GetOperation::new(self.inner.clone())
4449 }
4450}
4451
4452/// Implements a client for the Google Compute Engine API.
4453///
4454/// # Example
4455/// ```
4456/// # tokio_test::block_on(async {
4457/// # use google_cloud_compute_v1::client::InstanceGroups;
4458/// let client = InstanceGroups::builder().build().await?;
4459/// // use `client` to make requests to the Google Compute Engine API.
4460/// # gax::client_builder::Result::<()>::Ok(()) });
4461/// ```
4462///
4463/// # Service Description
4464///
4465/// Service for the `instanceGroups` resource.
4466///
4467/// # Configuration
4468///
4469/// To configure `InstanceGroups` use the `with_*` methods in the type returned
4470/// by [builder()][InstanceGroups::builder]. The default configuration should
4471/// work for most applications. Common configuration changes include
4472///
4473/// * [with_endpoint()]: by default this client uses the global default endpoint
4474/// (`https://compute.googleapis.com`). Applications using regional
4475/// endpoints or running in restricted networks (e.g. a network configured
4476// with [Private Google Access with VPC Service Controls]) may want to
4477/// override this default.
4478/// * [with_credentials()]: by default this client uses
4479/// [Application Default Credentials]. Applications using custom
4480/// authentication may need to override this default.
4481///
4482/// [with_endpoint()]: super::builder::instance_groups::ClientBuilder::with_endpoint
4483/// [with_credentials()]: super::builder::instance_groups::ClientBuilder::credentials
4484/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4485/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4486///
4487/// # Pooling and Cloning
4488///
4489/// `InstanceGroups` holds a connection pool internally, it is advised to
4490/// create one and the reuse it. You do not need to wrap `InstanceGroups` in
4491/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4492/// already uses an `Arc` internally.
4493#[cfg(feature = "instance-groups")]
4494#[cfg_attr(docsrs, doc(cfg(feature = "instance-groups")))]
4495#[derive(Clone, Debug)]
4496pub struct InstanceGroups {
4497 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceGroups>,
4498}
4499
4500#[cfg(feature = "instance-groups")]
4501impl InstanceGroups {
4502 /// Returns a builder for [InstanceGroups].
4503 ///
4504 /// ```
4505 /// # tokio_test::block_on(async {
4506 /// # use google_cloud_compute_v1::client::InstanceGroups;
4507 /// let client = InstanceGroups::builder().build().await?;
4508 /// # gax::client_builder::Result::<()>::Ok(()) });
4509 /// ```
4510 pub fn builder() -> super::builder::instance_groups::ClientBuilder {
4511 gax::client_builder::internal::new_builder(super::builder::instance_groups::client::Factory)
4512 }
4513
4514 /// Creates a new client from the provided stub.
4515 ///
4516 /// The most common case for calling this function is in tests mocking the
4517 /// client's behavior.
4518 pub fn from_stub<T>(stub: T) -> Self
4519 where
4520 T: super::stub::InstanceGroups + 'static,
4521 {
4522 Self {
4523 inner: std::sync::Arc::new(stub),
4524 }
4525 }
4526
4527 pub(crate) async fn new(
4528 config: gaxi::options::ClientConfig,
4529 ) -> gax::client_builder::Result<Self> {
4530 let inner = Self::build_inner(config).await?;
4531 Ok(Self { inner })
4532 }
4533
4534 async fn build_inner(
4535 conf: gaxi::options::ClientConfig,
4536 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InstanceGroups>> {
4537 if gaxi::options::tracing_enabled(&conf) {
4538 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4539 }
4540 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4541 }
4542
4543 async fn build_transport(
4544 conf: gaxi::options::ClientConfig,
4545 ) -> gax::client_builder::Result<impl super::stub::InstanceGroups> {
4546 super::transport::InstanceGroups::new(conf).await
4547 }
4548
4549 async fn build_with_tracing(
4550 conf: gaxi::options::ClientConfig,
4551 ) -> gax::client_builder::Result<impl super::stub::InstanceGroups> {
4552 Self::build_transport(conf)
4553 .await
4554 .map(super::tracing::InstanceGroups::new)
4555 }
4556
4557 /// Adds a list of instances to the specified instance group. All of the
4558 /// instances in the instance group must be in the same network/subnetwork.
4559 /// Read
4560 /// Adding instances for more information.
4561 pub fn add_instances(&self) -> super::builder::instance_groups::AddInstances {
4562 super::builder::instance_groups::AddInstances::new(self.inner.clone())
4563 }
4564
4565 /// Retrieves the list of instance groups and sorts them by zone.
4566 ///
4567 /// To prevent failure, Google recommends that you set the
4568 /// `returnPartialSuccess` parameter to `true`.
4569 pub fn aggregated_list(&self) -> super::builder::instance_groups::AggregatedList {
4570 super::builder::instance_groups::AggregatedList::new(self.inner.clone())
4571 }
4572
4573 /// Deletes the specified instance group. The instances in the group are not
4574 /// deleted. Note that instance group must not belong to a backend service.
4575 /// Read
4576 /// Deleting an instance group for more information.
4577 pub fn delete(&self) -> super::builder::instance_groups::Delete {
4578 super::builder::instance_groups::Delete::new(self.inner.clone())
4579 }
4580
4581 /// Returns the specified zonal instance group. Get a list of available zonal
4582 /// instance groups by making a list() request.
4583 ///
4584 /// For managed instance groups, use theinstanceGroupManagers
4585 /// or regionInstanceGroupManagers
4586 /// methods instead.
4587 pub fn get(&self) -> super::builder::instance_groups::Get {
4588 super::builder::instance_groups::Get::new(self.inner.clone())
4589 }
4590
4591 /// Creates an instance group in the specified project using the
4592 /// parameters that are included in the request.
4593 pub fn insert(&self) -> super::builder::instance_groups::Insert {
4594 super::builder::instance_groups::Insert::new(self.inner.clone())
4595 }
4596
4597 /// Retrieves the list of zonal instance group resources contained within the
4598 /// specified zone.
4599 ///
4600 /// For managed instance groups, use theinstanceGroupManagers
4601 /// or regionInstanceGroupManagers
4602 /// methods instead.
4603 pub fn list(&self) -> super::builder::instance_groups::List {
4604 super::builder::instance_groups::List::new(self.inner.clone())
4605 }
4606
4607 /// Lists the instances in the specified instance group.
4608 /// The orderBy query parameter is not supported.
4609 /// The filter query parameter is supported, but only for
4610 /// expressions that use `eq` (equal) or `ne` (not equal) operators.
4611 pub fn list_instances(&self) -> super::builder::instance_groups::ListInstances {
4612 super::builder::instance_groups::ListInstances::new(self.inner.clone())
4613 }
4614
4615 /// Removes one or more instances from the specified instance group, but does
4616 /// not delete those instances.
4617 ///
4618 /// If the group is part of a backend
4619 /// service that has enabled
4620 /// connection draining, it can take up to 60 seconds after the connection
4621 /// draining duration before the VM instance is removed or deleted.
4622 pub fn remove_instances(&self) -> super::builder::instance_groups::RemoveInstances {
4623 super::builder::instance_groups::RemoveInstances::new(self.inner.clone())
4624 }
4625
4626 /// Sets the named ports for the specified instance group.
4627 pub fn set_named_ports(&self) -> super::builder::instance_groups::SetNamedPorts {
4628 super::builder::instance_groups::SetNamedPorts::new(self.inner.clone())
4629 }
4630
4631 /// Returns permissions that a caller has on the specified resource.
4632 pub fn test_iam_permissions(&self) -> super::builder::instance_groups::TestIamPermissions {
4633 super::builder::instance_groups::TestIamPermissions::new(self.inner.clone())
4634 }
4635
4636 /// Retrieves the specified zone-specific Operations resource.
4637 pub fn get_operation(&self) -> super::builder::instance_groups::GetOperation {
4638 super::builder::instance_groups::GetOperation::new(self.inner.clone())
4639 }
4640}
4641
4642/// Implements a client for the Google Compute Engine API.
4643///
4644/// # Example
4645/// ```
4646/// # tokio_test::block_on(async {
4647/// # use google_cloud_compute_v1::client::InstanceSettings;
4648/// let client = InstanceSettings::builder().build().await?;
4649/// // use `client` to make requests to the Google Compute Engine API.
4650/// # gax::client_builder::Result::<()>::Ok(()) });
4651/// ```
4652///
4653/// # Service Description
4654///
4655/// Service for the `instanceSettings` resource.
4656///
4657/// # Configuration
4658///
4659/// To configure `InstanceSettings` use the `with_*` methods in the type returned
4660/// by [builder()][InstanceSettings::builder]. The default configuration should
4661/// work for most applications. Common configuration changes include
4662///
4663/// * [with_endpoint()]: by default this client uses the global default endpoint
4664/// (`https://compute.googleapis.com`). Applications using regional
4665/// endpoints or running in restricted networks (e.g. a network configured
4666// with [Private Google Access with VPC Service Controls]) may want to
4667/// override this default.
4668/// * [with_credentials()]: by default this client uses
4669/// [Application Default Credentials]. Applications using custom
4670/// authentication may need to override this default.
4671///
4672/// [with_endpoint()]: super::builder::instance_settings::ClientBuilder::with_endpoint
4673/// [with_credentials()]: super::builder::instance_settings::ClientBuilder::credentials
4674/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4675/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4676///
4677/// # Pooling and Cloning
4678///
4679/// `InstanceSettings` holds a connection pool internally, it is advised to
4680/// create one and the reuse it. You do not need to wrap `InstanceSettings` in
4681/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4682/// already uses an `Arc` internally.
4683#[cfg(feature = "instance-settings")]
4684#[cfg_attr(docsrs, doc(cfg(feature = "instance-settings")))]
4685#[derive(Clone, Debug)]
4686pub struct InstanceSettings {
4687 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceSettings>,
4688}
4689
4690#[cfg(feature = "instance-settings")]
4691impl InstanceSettings {
4692 /// Returns a builder for [InstanceSettings].
4693 ///
4694 /// ```
4695 /// # tokio_test::block_on(async {
4696 /// # use google_cloud_compute_v1::client::InstanceSettings;
4697 /// let client = InstanceSettings::builder().build().await?;
4698 /// # gax::client_builder::Result::<()>::Ok(()) });
4699 /// ```
4700 pub fn builder() -> super::builder::instance_settings::ClientBuilder {
4701 gax::client_builder::internal::new_builder(
4702 super::builder::instance_settings::client::Factory,
4703 )
4704 }
4705
4706 /// Creates a new client from the provided stub.
4707 ///
4708 /// The most common case for calling this function is in tests mocking the
4709 /// client's behavior.
4710 pub fn from_stub<T>(stub: T) -> Self
4711 where
4712 T: super::stub::InstanceSettings + 'static,
4713 {
4714 Self {
4715 inner: std::sync::Arc::new(stub),
4716 }
4717 }
4718
4719 pub(crate) async fn new(
4720 config: gaxi::options::ClientConfig,
4721 ) -> gax::client_builder::Result<Self> {
4722 let inner = Self::build_inner(config).await?;
4723 Ok(Self { inner })
4724 }
4725
4726 async fn build_inner(
4727 conf: gaxi::options::ClientConfig,
4728 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InstanceSettings>>
4729 {
4730 if gaxi::options::tracing_enabled(&conf) {
4731 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4732 }
4733 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4734 }
4735
4736 async fn build_transport(
4737 conf: gaxi::options::ClientConfig,
4738 ) -> gax::client_builder::Result<impl super::stub::InstanceSettings> {
4739 super::transport::InstanceSettings::new(conf).await
4740 }
4741
4742 async fn build_with_tracing(
4743 conf: gaxi::options::ClientConfig,
4744 ) -> gax::client_builder::Result<impl super::stub::InstanceSettings> {
4745 Self::build_transport(conf)
4746 .await
4747 .map(super::tracing::InstanceSettings::new)
4748 }
4749
4750 /// Get Instance settings.
4751 pub fn get(&self) -> super::builder::instance_settings::Get {
4752 super::builder::instance_settings::Get::new(self.inner.clone())
4753 }
4754
4755 /// Patch Instance settings
4756 pub fn patch(&self) -> super::builder::instance_settings::Patch {
4757 super::builder::instance_settings::Patch::new(self.inner.clone())
4758 }
4759
4760 /// Retrieves the specified zone-specific Operations resource.
4761 pub fn get_operation(&self) -> super::builder::instance_settings::GetOperation {
4762 super::builder::instance_settings::GetOperation::new(self.inner.clone())
4763 }
4764}
4765
4766/// Implements a client for the Google Compute Engine API.
4767///
4768/// # Example
4769/// ```
4770/// # tokio_test::block_on(async {
4771/// # use google_cloud_compute_v1::client::InstanceTemplates;
4772/// let client = InstanceTemplates::builder().build().await?;
4773/// // use `client` to make requests to the Google Compute Engine API.
4774/// # gax::client_builder::Result::<()>::Ok(()) });
4775/// ```
4776///
4777/// # Service Description
4778///
4779/// Service for the `instanceTemplates` resource.
4780///
4781/// # Configuration
4782///
4783/// To configure `InstanceTemplates` use the `with_*` methods in the type returned
4784/// by [builder()][InstanceTemplates::builder]. The default configuration should
4785/// work for most applications. Common configuration changes include
4786///
4787/// * [with_endpoint()]: by default this client uses the global default endpoint
4788/// (`https://compute.googleapis.com`). Applications using regional
4789/// endpoints or running in restricted networks (e.g. a network configured
4790// with [Private Google Access with VPC Service Controls]) may want to
4791/// override this default.
4792/// * [with_credentials()]: by default this client uses
4793/// [Application Default Credentials]. Applications using custom
4794/// authentication may need to override this default.
4795///
4796/// [with_endpoint()]: super::builder::instance_templates::ClientBuilder::with_endpoint
4797/// [with_credentials()]: super::builder::instance_templates::ClientBuilder::credentials
4798/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4799/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4800///
4801/// # Pooling and Cloning
4802///
4803/// `InstanceTemplates` holds a connection pool internally, it is advised to
4804/// create one and the reuse it. You do not need to wrap `InstanceTemplates` in
4805/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4806/// already uses an `Arc` internally.
4807#[cfg(feature = "instance-templates")]
4808#[cfg_attr(docsrs, doc(cfg(feature = "instance-templates")))]
4809#[derive(Clone, Debug)]
4810pub struct InstanceTemplates {
4811 inner: std::sync::Arc<dyn super::stub::dynamic::InstanceTemplates>,
4812}
4813
4814#[cfg(feature = "instance-templates")]
4815impl InstanceTemplates {
4816 /// Returns a builder for [InstanceTemplates].
4817 ///
4818 /// ```
4819 /// # tokio_test::block_on(async {
4820 /// # use google_cloud_compute_v1::client::InstanceTemplates;
4821 /// let client = InstanceTemplates::builder().build().await?;
4822 /// # gax::client_builder::Result::<()>::Ok(()) });
4823 /// ```
4824 pub fn builder() -> super::builder::instance_templates::ClientBuilder {
4825 gax::client_builder::internal::new_builder(
4826 super::builder::instance_templates::client::Factory,
4827 )
4828 }
4829
4830 /// Creates a new client from the provided stub.
4831 ///
4832 /// The most common case for calling this function is in tests mocking the
4833 /// client's behavior.
4834 pub fn from_stub<T>(stub: T) -> Self
4835 where
4836 T: super::stub::InstanceTemplates + 'static,
4837 {
4838 Self {
4839 inner: std::sync::Arc::new(stub),
4840 }
4841 }
4842
4843 pub(crate) async fn new(
4844 config: gaxi::options::ClientConfig,
4845 ) -> gax::client_builder::Result<Self> {
4846 let inner = Self::build_inner(config).await?;
4847 Ok(Self { inner })
4848 }
4849
4850 async fn build_inner(
4851 conf: gaxi::options::ClientConfig,
4852 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InstanceTemplates>>
4853 {
4854 if gaxi::options::tracing_enabled(&conf) {
4855 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
4856 }
4857 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
4858 }
4859
4860 async fn build_transport(
4861 conf: gaxi::options::ClientConfig,
4862 ) -> gax::client_builder::Result<impl super::stub::InstanceTemplates> {
4863 super::transport::InstanceTemplates::new(conf).await
4864 }
4865
4866 async fn build_with_tracing(
4867 conf: gaxi::options::ClientConfig,
4868 ) -> gax::client_builder::Result<impl super::stub::InstanceTemplates> {
4869 Self::build_transport(conf)
4870 .await
4871 .map(super::tracing::InstanceTemplates::new)
4872 }
4873
4874 /// Retrieves the list of all InstanceTemplates resources, regional and global,
4875 /// available to the specified project.
4876 ///
4877 /// To prevent failure, Google recommends that you set the
4878 /// `returnPartialSuccess` parameter to `true`.
4879 pub fn aggregated_list(&self) -> super::builder::instance_templates::AggregatedList {
4880 super::builder::instance_templates::AggregatedList::new(self.inner.clone())
4881 }
4882
4883 /// Deletes the specified instance template. Deleting an instance template is
4884 /// permanent and cannot be undone. It is not possible to delete templates
4885 /// that are already in use by a managed instance group.
4886 pub fn delete(&self) -> super::builder::instance_templates::Delete {
4887 super::builder::instance_templates::Delete::new(self.inner.clone())
4888 }
4889
4890 /// Returns the specified instance template.
4891 pub fn get(&self) -> super::builder::instance_templates::Get {
4892 super::builder::instance_templates::Get::new(self.inner.clone())
4893 }
4894
4895 /// Gets the access control policy for a resource. May be empty if no such
4896 /// policy or resource exists.
4897 pub fn get_iam_policy(&self) -> super::builder::instance_templates::GetIamPolicy {
4898 super::builder::instance_templates::GetIamPolicy::new(self.inner.clone())
4899 }
4900
4901 /// Creates an instance template in the specified project using the
4902 /// data that is included in the request. If you are creating a new template to
4903 /// update an existing instance group, your new instance template must use the
4904 /// same network or, if applicable, the same subnetwork as the original
4905 /// template.
4906 pub fn insert(&self) -> super::builder::instance_templates::Insert {
4907 super::builder::instance_templates::Insert::new(self.inner.clone())
4908 }
4909
4910 /// Retrieves a list of instance templates that are contained within
4911 /// the specified project.
4912 pub fn list(&self) -> super::builder::instance_templates::List {
4913 super::builder::instance_templates::List::new(self.inner.clone())
4914 }
4915
4916 /// Sets the access control policy on the specified resource.
4917 /// Replaces any existing policy.
4918 pub fn set_iam_policy(&self) -> super::builder::instance_templates::SetIamPolicy {
4919 super::builder::instance_templates::SetIamPolicy::new(self.inner.clone())
4920 }
4921
4922 /// Returns permissions that a caller has on the specified resource.
4923 pub fn test_iam_permissions(&self) -> super::builder::instance_templates::TestIamPermissions {
4924 super::builder::instance_templates::TestIamPermissions::new(self.inner.clone())
4925 }
4926
4927 /// Retrieves the specified Operations resource.
4928 pub fn get_operation(&self) -> super::builder::instance_templates::GetOperation {
4929 super::builder::instance_templates::GetOperation::new(self.inner.clone())
4930 }
4931}
4932
4933/// Implements a client for the Google Compute Engine API.
4934///
4935/// # Example
4936/// ```
4937/// # tokio_test::block_on(async {
4938/// # use google_cloud_compute_v1::client::Instances;
4939/// let client = Instances::builder().build().await?;
4940/// // use `client` to make requests to the Google Compute Engine API.
4941/// # gax::client_builder::Result::<()>::Ok(()) });
4942/// ```
4943///
4944/// # Service Description
4945///
4946/// Service for the `instances` resource.
4947///
4948/// # Configuration
4949///
4950/// To configure `Instances` use the `with_*` methods in the type returned
4951/// by [builder()][Instances::builder]. The default configuration should
4952/// work for most applications. Common configuration changes include
4953///
4954/// * [with_endpoint()]: by default this client uses the global default endpoint
4955/// (`https://compute.googleapis.com`). Applications using regional
4956/// endpoints or running in restricted networks (e.g. a network configured
4957// with [Private Google Access with VPC Service Controls]) may want to
4958/// override this default.
4959/// * [with_credentials()]: by default this client uses
4960/// [Application Default Credentials]. Applications using custom
4961/// authentication may need to override this default.
4962///
4963/// [with_endpoint()]: super::builder::instances::ClientBuilder::with_endpoint
4964/// [with_credentials()]: super::builder::instances::ClientBuilder::credentials
4965/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
4966/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
4967///
4968/// # Pooling and Cloning
4969///
4970/// `Instances` holds a connection pool internally, it is advised to
4971/// create one and the reuse it. You do not need to wrap `Instances` in
4972/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
4973/// already uses an `Arc` internally.
4974#[cfg(feature = "instances")]
4975#[cfg_attr(docsrs, doc(cfg(feature = "instances")))]
4976#[derive(Clone, Debug)]
4977pub struct Instances {
4978 inner: std::sync::Arc<dyn super::stub::dynamic::Instances>,
4979}
4980
4981#[cfg(feature = "instances")]
4982impl Instances {
4983 /// Returns a builder for [Instances].
4984 ///
4985 /// ```
4986 /// # tokio_test::block_on(async {
4987 /// # use google_cloud_compute_v1::client::Instances;
4988 /// let client = Instances::builder().build().await?;
4989 /// # gax::client_builder::Result::<()>::Ok(()) });
4990 /// ```
4991 pub fn builder() -> super::builder::instances::ClientBuilder {
4992 gax::client_builder::internal::new_builder(super::builder::instances::client::Factory)
4993 }
4994
4995 /// Creates a new client from the provided stub.
4996 ///
4997 /// The most common case for calling this function is in tests mocking the
4998 /// client's behavior.
4999 pub fn from_stub<T>(stub: T) -> Self
5000 where
5001 T: super::stub::Instances + 'static,
5002 {
5003 Self {
5004 inner: std::sync::Arc::new(stub),
5005 }
5006 }
5007
5008 pub(crate) async fn new(
5009 config: gaxi::options::ClientConfig,
5010 ) -> gax::client_builder::Result<Self> {
5011 let inner = Self::build_inner(config).await?;
5012 Ok(Self { inner })
5013 }
5014
5015 async fn build_inner(
5016 conf: gaxi::options::ClientConfig,
5017 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Instances>> {
5018 if gaxi::options::tracing_enabled(&conf) {
5019 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5020 }
5021 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5022 }
5023
5024 async fn build_transport(
5025 conf: gaxi::options::ClientConfig,
5026 ) -> gax::client_builder::Result<impl super::stub::Instances> {
5027 super::transport::Instances::new(conf).await
5028 }
5029
5030 async fn build_with_tracing(
5031 conf: gaxi::options::ClientConfig,
5032 ) -> gax::client_builder::Result<impl super::stub::Instances> {
5033 Self::build_transport(conf)
5034 .await
5035 .map(super::tracing::Instances::new)
5036 }
5037
5038 /// Adds an access config to an instance's network interface.
5039 pub fn add_access_config(&self) -> super::builder::instances::AddAccessConfig {
5040 super::builder::instances::AddAccessConfig::new(self.inner.clone())
5041 }
5042
5043 /// Adds one dynamic network interface to an active instance.
5044 pub fn add_network_interface(&self) -> super::builder::instances::AddNetworkInterface {
5045 super::builder::instances::AddNetworkInterface::new(self.inner.clone())
5046 }
5047
5048 /// Adds existing resource policies to an instance. You can only add one
5049 /// policy right now which will be applied to this instance for scheduling live
5050 /// migrations.
5051 pub fn add_resource_policies(&self) -> super::builder::instances::AddResourcePolicies {
5052 super::builder::instances::AddResourcePolicies::new(self.inner.clone())
5053 }
5054
5055 /// Retrieves an aggregated list of all of the instances in your project
5056 /// across all regions and zones.
5057 ///
5058 /// The performance of this method degrades when a filter is specified on a
5059 /// project that has a very large number of instances.
5060 ///
5061 /// To prevent failure, Google recommends that you set the
5062 /// `returnPartialSuccess` parameter to `true`.
5063 pub fn aggregated_list(&self) -> super::builder::instances::AggregatedList {
5064 super::builder::instances::AggregatedList::new(self.inner.clone())
5065 }
5066
5067 /// Attaches an existing Disk resource to an instance. You must first
5068 /// create the disk before you can attach it. It is not possible to create
5069 /// and attach a disk at the same time. For more information, readAdding a
5070 /// persistent disk to your instance.
5071 pub fn attach_disk(&self) -> super::builder::instances::AttachDisk {
5072 super::builder::instances::AttachDisk::new(self.inner.clone())
5073 }
5074
5075 /// Creates multiple instances. Count specifies the number of instances to
5076 /// create. For more information, seeAbout bulk
5077 /// creation of VMs.
5078 pub fn bulk_insert(&self) -> super::builder::instances::BulkInsert {
5079 super::builder::instances::BulkInsert::new(self.inner.clone())
5080 }
5081
5082 /// Deletes the specified Instance resource. For more information, seeDeleting
5083 /// an instance.
5084 pub fn delete(&self) -> super::builder::instances::Delete {
5085 super::builder::instances::Delete::new(self.inner.clone())
5086 }
5087
5088 /// Deletes an access config from an instance's network interface.
5089 pub fn delete_access_config(&self) -> super::builder::instances::DeleteAccessConfig {
5090 super::builder::instances::DeleteAccessConfig::new(self.inner.clone())
5091 }
5092
5093 /// Deletes one dynamic network interface from an active instance.
5094 /// InstancesDeleteNetworkInterfaceRequest indicates:
5095 ///
5096 /// - instance from which to delete, using project+zone+resource_id fields;
5097 /// - dynamic network interface to be deleted, using network_interface_name
5098 /// field;
5099 pub fn delete_network_interface(&self) -> super::builder::instances::DeleteNetworkInterface {
5100 super::builder::instances::DeleteNetworkInterface::new(self.inner.clone())
5101 }
5102
5103 /// Detaches a disk from an instance.
5104 pub fn detach_disk(&self) -> super::builder::instances::DetachDisk {
5105 super::builder::instances::DetachDisk::new(self.inner.clone())
5106 }
5107
5108 /// Returns the specified Instance resource.
5109 pub fn get(&self) -> super::builder::instances::Get {
5110 super::builder::instances::Get::new(self.inner.clone())
5111 }
5112
5113 /// Returns effective firewalls applied to an interface of the instance.
5114 pub fn get_effective_firewalls(&self) -> super::builder::instances::GetEffectiveFirewalls {
5115 super::builder::instances::GetEffectiveFirewalls::new(self.inner.clone())
5116 }
5117
5118 /// Returns the specified guest attributes entry.
5119 pub fn get_guest_attributes(&self) -> super::builder::instances::GetGuestAttributes {
5120 super::builder::instances::GetGuestAttributes::new(self.inner.clone())
5121 }
5122
5123 /// Gets the access control policy for a resource. May be empty if no such
5124 /// policy or resource exists.
5125 pub fn get_iam_policy(&self) -> super::builder::instances::GetIamPolicy {
5126 super::builder::instances::GetIamPolicy::new(self.inner.clone())
5127 }
5128
5129 /// Returns the screenshot from the specified instance.
5130 pub fn get_screenshot(&self) -> super::builder::instances::GetScreenshot {
5131 super::builder::instances::GetScreenshot::new(self.inner.clone())
5132 }
5133
5134 /// Returns the last 1 MB of serial port output from the specified instance.
5135 pub fn get_serial_port_output(&self) -> super::builder::instances::GetSerialPortOutput {
5136 super::builder::instances::GetSerialPortOutput::new(self.inner.clone())
5137 }
5138
5139 /// Returns the Shielded Instance Identity of an instance
5140 pub fn get_shielded_instance_identity(
5141 &self,
5142 ) -> super::builder::instances::GetShieldedInstanceIdentity {
5143 super::builder::instances::GetShieldedInstanceIdentity::new(self.inner.clone())
5144 }
5145
5146 /// Creates an instance resource in the specified project using the data
5147 /// included in the request.
5148 pub fn insert(&self) -> super::builder::instances::Insert {
5149 super::builder::instances::Insert::new(self.inner.clone())
5150 }
5151
5152 /// Retrieves the list of instances contained within
5153 /// the specified zone.
5154 pub fn list(&self) -> super::builder::instances::List {
5155 super::builder::instances::List::new(self.inner.clone())
5156 }
5157
5158 /// Retrieves a list of resources that refer to the VM instance specified in
5159 /// the request. For example, if the VM instance is part of a managed or
5160 /// unmanaged instance group, the referrers list includes the instance group.
5161 /// For more information, readViewing
5162 /// referrers to VM instances.
5163 pub fn list_referrers(&self) -> super::builder::instances::ListReferrers {
5164 super::builder::instances::ListReferrers::new(self.inner.clone())
5165 }
5166
5167 /// Perform a manual maintenance on the instance.
5168 pub fn perform_maintenance(&self) -> super::builder::instances::PerformMaintenance {
5169 super::builder::instances::PerformMaintenance::new(self.inner.clone())
5170 }
5171
5172 /// Removes resource policies from an instance.
5173 pub fn remove_resource_policies(&self) -> super::builder::instances::RemoveResourcePolicies {
5174 super::builder::instances::RemoveResourcePolicies::new(self.inner.clone())
5175 }
5176
5177 /// Mark the host as faulty and try to restart the instance on a new host.
5178 pub fn report_host_as_faulty(&self) -> super::builder::instances::ReportHostAsFaulty {
5179 super::builder::instances::ReportHostAsFaulty::new(self.inner.clone())
5180 }
5181
5182 /// Performs a reset on the instance. This is a hard reset. The VM
5183 /// does not do a graceful shutdown. For more information, seeResetting
5184 /// an instance.
5185 pub fn reset(&self) -> super::builder::instances::Reset {
5186 super::builder::instances::Reset::new(self.inner.clone())
5187 }
5188
5189 /// Resumes an instance that was suspended using theinstances().suspend
5190 /// method.
5191 pub fn resume(&self) -> super::builder::instances::Resume {
5192 super::builder::instances::Resume::new(self.inner.clone())
5193 }
5194
5195 /// Sends diagnostic interrupt to the instance.
5196 pub fn send_diagnostic_interrupt(&self) -> super::builder::instances::SendDiagnosticInterrupt {
5197 super::builder::instances::SendDiagnosticInterrupt::new(self.inner.clone())
5198 }
5199
5200 /// Sets deletion protection on the instance.
5201 pub fn set_deletion_protection(&self) -> super::builder::instances::SetDeletionProtection {
5202 super::builder::instances::SetDeletionProtection::new(self.inner.clone())
5203 }
5204
5205 /// Sets the auto-delete flag for a disk attached to an instance.
5206 pub fn set_disk_auto_delete(&self) -> super::builder::instances::SetDiskAutoDelete {
5207 super::builder::instances::SetDiskAutoDelete::new(self.inner.clone())
5208 }
5209
5210 /// Sets the access control policy on the specified resource.
5211 /// Replaces any existing policy.
5212 pub fn set_iam_policy(&self) -> super::builder::instances::SetIamPolicy {
5213 super::builder::instances::SetIamPolicy::new(self.inner.clone())
5214 }
5215
5216 /// Sets labels on an instance. To learn more about labels, read theLabeling
5217 /// Resources documentation.
5218 pub fn set_labels(&self) -> super::builder::instances::SetLabels {
5219 super::builder::instances::SetLabels::new(self.inner.clone())
5220 }
5221
5222 /// Changes the number and/or type of accelerator for a stopped instance to the
5223 /// values specified in the request.
5224 pub fn set_machine_resources(&self) -> super::builder::instances::SetMachineResources {
5225 super::builder::instances::SetMachineResources::new(self.inner.clone())
5226 }
5227
5228 /// Changes the machine type for a stopped instance to the machine
5229 /// type specified in the request.
5230 pub fn set_machine_type(&self) -> super::builder::instances::SetMachineType {
5231 super::builder::instances::SetMachineType::new(self.inner.clone())
5232 }
5233
5234 /// Sets metadata for the specified instance to the data included
5235 /// in the request.
5236 pub fn set_metadata(&self) -> super::builder::instances::SetMetadata {
5237 super::builder::instances::SetMetadata::new(self.inner.clone())
5238 }
5239
5240 /// Changes the minimum CPU platform that this instance should use.
5241 /// This method can only
5242 /// be called on a stopped instance. For more information, readSpecifying a
5243 /// Minimum CPU Platform.
5244 pub fn set_min_cpu_platform(&self) -> super::builder::instances::SetMinCpuPlatform {
5245 super::builder::instances::SetMinCpuPlatform::new(self.inner.clone())
5246 }
5247
5248 /// Sets name of an instance.
5249 pub fn set_name(&self) -> super::builder::instances::SetName {
5250 super::builder::instances::SetName::new(self.inner.clone())
5251 }
5252
5253 /// Sets an instance's scheduling options. You can only call this method on astopped instance,
5254 /// that is, a VM instance that is in a `TERMINATED` state. SeeInstance Life
5255 /// Cycle for more information on the possible instance states.
5256 /// For more information about setting scheduling options for a VM, seeSet
5257 /// VM host maintenance policy.
5258 pub fn set_scheduling(&self) -> super::builder::instances::SetScheduling {
5259 super::builder::instances::SetScheduling::new(self.inner.clone())
5260 }
5261
5262 /// Sets the Google Cloud Armor security policy for the specified instance.
5263 /// For more information, seeGoogle
5264 /// Cloud Armor Overview
5265 pub fn set_security_policy(&self) -> super::builder::instances::SetSecurityPolicy {
5266 super::builder::instances::SetSecurityPolicy::new(self.inner.clone())
5267 }
5268
5269 /// Sets the service account on the instance. For more information,
5270 /// readChanging
5271 /// the service account and access scopes for an instance.
5272 pub fn set_service_account(&self) -> super::builder::instances::SetServiceAccount {
5273 super::builder::instances::SetServiceAccount::new(self.inner.clone())
5274 }
5275
5276 /// Sets the Shielded Instance integrity policy for an instance. You can
5277 /// only use this method on a running instance. This method
5278 /// supports PATCH semantics and uses the JSON merge
5279 /// patch format and processing rules.
5280 pub fn set_shielded_instance_integrity_policy(
5281 &self,
5282 ) -> super::builder::instances::SetShieldedInstanceIntegrityPolicy {
5283 super::builder::instances::SetShieldedInstanceIntegrityPolicy::new(self.inner.clone())
5284 }
5285
5286 /// Sets network tags
5287 /// for the specified instance to the data included in the request.
5288 pub fn set_tags(&self) -> super::builder::instances::SetTags {
5289 super::builder::instances::SetTags::new(self.inner.clone())
5290 }
5291
5292 /// Simulates a host maintenance event on a VM. For more information, see
5293 /// Simulate a host maintenance event.
5294 pub fn simulate_maintenance_event(
5295 &self,
5296 ) -> super::builder::instances::SimulateMaintenanceEvent {
5297 super::builder::instances::SimulateMaintenanceEvent::new(self.inner.clone())
5298 }
5299
5300 /// Starts an instance that was stopped using theinstances().stop
5301 /// method. For more information, seeRestart an
5302 /// instance.
5303 pub fn start(&self) -> super::builder::instances::Start {
5304 super::builder::instances::Start::new(self.inner.clone())
5305 }
5306
5307 /// Starts an instance that was stopped using theinstances().stop
5308 /// method. For more information, seeRestart an
5309 /// instance.
5310 pub fn start_with_encryption_key(&self) -> super::builder::instances::StartWithEncryptionKey {
5311 super::builder::instances::StartWithEncryptionKey::new(self.inner.clone())
5312 }
5313
5314 /// Stops a running instance, shutting it down cleanly, and allows
5315 /// you to restart the instance at a later time. Stopped instances do not incur
5316 /// VM usage charges while they are stopped. However, resources that the VM is
5317 /// using, such as persistent disks and static IP addresses, will continue to
5318 /// be charged until they are deleted. For more information, seeStopping
5319 /// an instance.
5320 pub fn stop(&self) -> super::builder::instances::Stop {
5321 super::builder::instances::Stop::new(self.inner.clone())
5322 }
5323
5324 /// This method suspends a running instance, saving its state to persistent
5325 /// storage, and allows you to resume the instance at a later time. Suspended
5326 /// instances have no compute costs (cores or RAM), and incur only storage
5327 /// charges for the saved VM memory and localSSD data. Any charged resources
5328 /// the virtual machine was using, such as persistent disks and static IP
5329 /// addresses, will continue to be charged while the instance is suspended.
5330 /// For more information, see
5331 /// Suspending and resuming an instance.
5332 pub fn suspend(&self) -> super::builder::instances::Suspend {
5333 super::builder::instances::Suspend::new(self.inner.clone())
5334 }
5335
5336 /// Returns permissions that a caller has on the specified resource.
5337 pub fn test_iam_permissions(&self) -> super::builder::instances::TestIamPermissions {
5338 super::builder::instances::TestIamPermissions::new(self.inner.clone())
5339 }
5340
5341 /// Updates an instance only if the necessary resources are available. This
5342 /// method can update only a specific set of instance properties. See
5343 /// Updating a running instance for a list of updatable instance
5344 /// properties.
5345 pub fn update(&self) -> super::builder::instances::Update {
5346 super::builder::instances::Update::new(self.inner.clone())
5347 }
5348
5349 /// Updates the specified access config from an instance's network interface
5350 /// with the data included in the request. This method supportsPATCH
5351 /// semantics and uses theJSON merge
5352 /// patch format and processing rules.
5353 pub fn update_access_config(&self) -> super::builder::instances::UpdateAccessConfig {
5354 super::builder::instances::UpdateAccessConfig::new(self.inner.clone())
5355 }
5356
5357 /// Updates the Display config for a VM instance. You can
5358 /// only use this method on a stopped VM instance. This method supportsPATCH
5359 /// semantics and uses theJSON merge
5360 /// patch format and processing rules.
5361 pub fn update_display_device(&self) -> super::builder::instances::UpdateDisplayDevice {
5362 super::builder::instances::UpdateDisplayDevice::new(self.inner.clone())
5363 }
5364
5365 /// Updates an instance's network interface. This method can only update an
5366 /// interface's alias IP range and attached network. See Modifying
5367 /// alias IP ranges for an existing instance for instructions on
5368 /// changing alias IP ranges. See Migrating
5369 /// a VM between networks for instructions on migrating an interface.
5370 /// This method follows PATCH semantics.
5371 pub fn update_network_interface(&self) -> super::builder::instances::UpdateNetworkInterface {
5372 super::builder::instances::UpdateNetworkInterface::new(self.inner.clone())
5373 }
5374
5375 /// Updates the Shielded Instance config for an instance. You can
5376 /// only use this method on a stopped instance. This method supportsPATCH
5377 /// semantics and uses theJSON merge
5378 /// patch format and processing rules.
5379 pub fn update_shielded_instance_config(
5380 &self,
5381 ) -> super::builder::instances::UpdateShieldedInstanceConfig {
5382 super::builder::instances::UpdateShieldedInstanceConfig::new(self.inner.clone())
5383 }
5384
5385 /// Retrieves the specified zone-specific Operations resource.
5386 pub fn get_operation(&self) -> super::builder::instances::GetOperation {
5387 super::builder::instances::GetOperation::new(self.inner.clone())
5388 }
5389}
5390
5391/// Implements a client for the Google Compute Engine API.
5392///
5393/// # Example
5394/// ```
5395/// # tokio_test::block_on(async {
5396/// # use google_cloud_compute_v1::client::InstantSnapshots;
5397/// let client = InstantSnapshots::builder().build().await?;
5398/// // use `client` to make requests to the Google Compute Engine API.
5399/// # gax::client_builder::Result::<()>::Ok(()) });
5400/// ```
5401///
5402/// # Service Description
5403///
5404/// Service for the `instantSnapshots` resource.
5405///
5406/// # Configuration
5407///
5408/// To configure `InstantSnapshots` use the `with_*` methods in the type returned
5409/// by [builder()][InstantSnapshots::builder]. The default configuration should
5410/// work for most applications. Common configuration changes include
5411///
5412/// * [with_endpoint()]: by default this client uses the global default endpoint
5413/// (`https://compute.googleapis.com`). Applications using regional
5414/// endpoints or running in restricted networks (e.g. a network configured
5415// with [Private Google Access with VPC Service Controls]) may want to
5416/// override this default.
5417/// * [with_credentials()]: by default this client uses
5418/// [Application Default Credentials]. Applications using custom
5419/// authentication may need to override this default.
5420///
5421/// [with_endpoint()]: super::builder::instant_snapshots::ClientBuilder::with_endpoint
5422/// [with_credentials()]: super::builder::instant_snapshots::ClientBuilder::credentials
5423/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5424/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5425///
5426/// # Pooling and Cloning
5427///
5428/// `InstantSnapshots` holds a connection pool internally, it is advised to
5429/// create one and the reuse it. You do not need to wrap `InstantSnapshots` in
5430/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5431/// already uses an `Arc` internally.
5432#[cfg(feature = "instant-snapshots")]
5433#[cfg_attr(docsrs, doc(cfg(feature = "instant-snapshots")))]
5434#[derive(Clone, Debug)]
5435pub struct InstantSnapshots {
5436 inner: std::sync::Arc<dyn super::stub::dynamic::InstantSnapshots>,
5437}
5438
5439#[cfg(feature = "instant-snapshots")]
5440impl InstantSnapshots {
5441 /// Returns a builder for [InstantSnapshots].
5442 ///
5443 /// ```
5444 /// # tokio_test::block_on(async {
5445 /// # use google_cloud_compute_v1::client::InstantSnapshots;
5446 /// let client = InstantSnapshots::builder().build().await?;
5447 /// # gax::client_builder::Result::<()>::Ok(()) });
5448 /// ```
5449 pub fn builder() -> super::builder::instant_snapshots::ClientBuilder {
5450 gax::client_builder::internal::new_builder(
5451 super::builder::instant_snapshots::client::Factory,
5452 )
5453 }
5454
5455 /// Creates a new client from the provided stub.
5456 ///
5457 /// The most common case for calling this function is in tests mocking the
5458 /// client's behavior.
5459 pub fn from_stub<T>(stub: T) -> Self
5460 where
5461 T: super::stub::InstantSnapshots + 'static,
5462 {
5463 Self {
5464 inner: std::sync::Arc::new(stub),
5465 }
5466 }
5467
5468 pub(crate) async fn new(
5469 config: gaxi::options::ClientConfig,
5470 ) -> gax::client_builder::Result<Self> {
5471 let inner = Self::build_inner(config).await?;
5472 Ok(Self { inner })
5473 }
5474
5475 async fn build_inner(
5476 conf: gaxi::options::ClientConfig,
5477 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InstantSnapshots>>
5478 {
5479 if gaxi::options::tracing_enabled(&conf) {
5480 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5481 }
5482 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5483 }
5484
5485 async fn build_transport(
5486 conf: gaxi::options::ClientConfig,
5487 ) -> gax::client_builder::Result<impl super::stub::InstantSnapshots> {
5488 super::transport::InstantSnapshots::new(conf).await
5489 }
5490
5491 async fn build_with_tracing(
5492 conf: gaxi::options::ClientConfig,
5493 ) -> gax::client_builder::Result<impl super::stub::InstantSnapshots> {
5494 Self::build_transport(conf)
5495 .await
5496 .map(super::tracing::InstantSnapshots::new)
5497 }
5498
5499 /// Retrieves an aggregated list of instantSnapshots.
5500 ///
5501 /// To prevent failure, Google recommends that you set the
5502 /// `returnPartialSuccess` parameter to `true`.
5503 pub fn aggregated_list(&self) -> super::builder::instant_snapshots::AggregatedList {
5504 super::builder::instant_snapshots::AggregatedList::new(self.inner.clone())
5505 }
5506
5507 /// Deletes the specified InstantSnapshot resource. Keep in mind that deleting
5508 /// a single instantSnapshot might not necessarily delete all the data on that
5509 /// instantSnapshot. If any data on the instantSnapshot that is marked for
5510 /// deletion is needed for subsequent instantSnapshots, the data will be moved
5511 /// to the next corresponding instantSnapshot.
5512 ///
5513 /// For more information, seeDeleting
5514 /// instantSnapshots.
5515 pub fn delete(&self) -> super::builder::instant_snapshots::Delete {
5516 super::builder::instant_snapshots::Delete::new(self.inner.clone())
5517 }
5518
5519 /// Returns the specified InstantSnapshot resource in the specified zone.
5520 pub fn get(&self) -> super::builder::instant_snapshots::Get {
5521 super::builder::instant_snapshots::Get::new(self.inner.clone())
5522 }
5523
5524 /// Gets the access control policy for a resource. May be empty if no such
5525 /// policy or resource exists.
5526 pub fn get_iam_policy(&self) -> super::builder::instant_snapshots::GetIamPolicy {
5527 super::builder::instant_snapshots::GetIamPolicy::new(self.inner.clone())
5528 }
5529
5530 /// Creates an instant snapshot in the specified zone.
5531 pub fn insert(&self) -> super::builder::instant_snapshots::Insert {
5532 super::builder::instant_snapshots::Insert::new(self.inner.clone())
5533 }
5534
5535 /// Retrieves the list of InstantSnapshot resources contained within
5536 /// the specified zone.
5537 pub fn list(&self) -> super::builder::instant_snapshots::List {
5538 super::builder::instant_snapshots::List::new(self.inner.clone())
5539 }
5540
5541 /// Sets the access control policy on the specified resource.
5542 /// Replaces any existing policy.
5543 pub fn set_iam_policy(&self) -> super::builder::instant_snapshots::SetIamPolicy {
5544 super::builder::instant_snapshots::SetIamPolicy::new(self.inner.clone())
5545 }
5546
5547 /// Sets the labels on a instantSnapshot in the given zone. To learn more about
5548 /// labels, read the Labeling
5549 /// Resources documentation.
5550 pub fn set_labels(&self) -> super::builder::instant_snapshots::SetLabels {
5551 super::builder::instant_snapshots::SetLabels::new(self.inner.clone())
5552 }
5553
5554 /// Returns permissions that a caller has on the specified resource.
5555 pub fn test_iam_permissions(&self) -> super::builder::instant_snapshots::TestIamPermissions {
5556 super::builder::instant_snapshots::TestIamPermissions::new(self.inner.clone())
5557 }
5558
5559 /// Retrieves the specified zone-specific Operations resource.
5560 pub fn get_operation(&self) -> super::builder::instant_snapshots::GetOperation {
5561 super::builder::instant_snapshots::GetOperation::new(self.inner.clone())
5562 }
5563}
5564
5565/// Implements a client for the Google Compute Engine API.
5566///
5567/// # Example
5568/// ```
5569/// # tokio_test::block_on(async {
5570/// # use google_cloud_compute_v1::client::InterconnectAttachmentGroups;
5571/// let client = InterconnectAttachmentGroups::builder().build().await?;
5572/// // use `client` to make requests to the Google Compute Engine API.
5573/// # gax::client_builder::Result::<()>::Ok(()) });
5574/// ```
5575///
5576/// # Service Description
5577///
5578/// Service for the `interconnectAttachmentGroups` resource.
5579///
5580/// # Configuration
5581///
5582/// To configure `InterconnectAttachmentGroups` use the `with_*` methods in the type returned
5583/// by [builder()][InterconnectAttachmentGroups::builder]. The default configuration should
5584/// work for most applications. Common configuration changes include
5585///
5586/// * [with_endpoint()]: by default this client uses the global default endpoint
5587/// (`https://compute.googleapis.com`). Applications using regional
5588/// endpoints or running in restricted networks (e.g. a network configured
5589// with [Private Google Access with VPC Service Controls]) may want to
5590/// override this default.
5591/// * [with_credentials()]: by default this client uses
5592/// [Application Default Credentials]. Applications using custom
5593/// authentication may need to override this default.
5594///
5595/// [with_endpoint()]: super::builder::interconnect_attachment_groups::ClientBuilder::with_endpoint
5596/// [with_credentials()]: super::builder::interconnect_attachment_groups::ClientBuilder::credentials
5597/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5598/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5599///
5600/// # Pooling and Cloning
5601///
5602/// `InterconnectAttachmentGroups` holds a connection pool internally, it is advised to
5603/// create one and the reuse it. You do not need to wrap `InterconnectAttachmentGroups` in
5604/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5605/// already uses an `Arc` internally.
5606#[cfg(feature = "interconnect-attachment-groups")]
5607#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-attachment-groups")))]
5608#[derive(Clone, Debug)]
5609pub struct InterconnectAttachmentGroups {
5610 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachmentGroups>,
5611}
5612
5613#[cfg(feature = "interconnect-attachment-groups")]
5614impl InterconnectAttachmentGroups {
5615 /// Returns a builder for [InterconnectAttachmentGroups].
5616 ///
5617 /// ```
5618 /// # tokio_test::block_on(async {
5619 /// # use google_cloud_compute_v1::client::InterconnectAttachmentGroups;
5620 /// let client = InterconnectAttachmentGroups::builder().build().await?;
5621 /// # gax::client_builder::Result::<()>::Ok(()) });
5622 /// ```
5623 pub fn builder() -> super::builder::interconnect_attachment_groups::ClientBuilder {
5624 gax::client_builder::internal::new_builder(
5625 super::builder::interconnect_attachment_groups::client::Factory,
5626 )
5627 }
5628
5629 /// Creates a new client from the provided stub.
5630 ///
5631 /// The most common case for calling this function is in tests mocking the
5632 /// client's behavior.
5633 pub fn from_stub<T>(stub: T) -> Self
5634 where
5635 T: super::stub::InterconnectAttachmentGroups + 'static,
5636 {
5637 Self {
5638 inner: std::sync::Arc::new(stub),
5639 }
5640 }
5641
5642 pub(crate) async fn new(
5643 config: gaxi::options::ClientConfig,
5644 ) -> gax::client_builder::Result<Self> {
5645 let inner = Self::build_inner(config).await?;
5646 Ok(Self { inner })
5647 }
5648
5649 async fn build_inner(
5650 conf: gaxi::options::ClientConfig,
5651 ) -> gax::client_builder::Result<
5652 std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachmentGroups>,
5653 > {
5654 if gaxi::options::tracing_enabled(&conf) {
5655 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5656 }
5657 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5658 }
5659
5660 async fn build_transport(
5661 conf: gaxi::options::ClientConfig,
5662 ) -> gax::client_builder::Result<impl super::stub::InterconnectAttachmentGroups> {
5663 super::transport::InterconnectAttachmentGroups::new(conf).await
5664 }
5665
5666 async fn build_with_tracing(
5667 conf: gaxi::options::ClientConfig,
5668 ) -> gax::client_builder::Result<impl super::stub::InterconnectAttachmentGroups> {
5669 Self::build_transport(conf)
5670 .await
5671 .map(super::tracing::InterconnectAttachmentGroups::new)
5672 }
5673
5674 /// Deletes the specified InterconnectAttachmentGroup in the given scope
5675 pub fn delete(&self) -> super::builder::interconnect_attachment_groups::Delete {
5676 super::builder::interconnect_attachment_groups::Delete::new(self.inner.clone())
5677 }
5678
5679 /// Returns the specified InterconnectAttachmentGroup resource in the given
5680 /// scope.
5681 pub fn get(&self) -> super::builder::interconnect_attachment_groups::Get {
5682 super::builder::interconnect_attachment_groups::Get::new(self.inner.clone())
5683 }
5684
5685 /// Gets the access control policy for a resource. May be empty if no such
5686 /// policy or resource exists.
5687 pub fn get_iam_policy(&self) -> super::builder::interconnect_attachment_groups::GetIamPolicy {
5688 super::builder::interconnect_attachment_groups::GetIamPolicy::new(self.inner.clone())
5689 }
5690
5691 /// Returns the InterconnectAttachmentStatuses for the specified
5692 /// InterconnectAttachmentGroup resource.
5693 pub fn get_operational_status(
5694 &self,
5695 ) -> super::builder::interconnect_attachment_groups::GetOperationalStatus {
5696 super::builder::interconnect_attachment_groups::GetOperationalStatus::new(
5697 self.inner.clone(),
5698 )
5699 }
5700
5701 /// Creates a InterconnectAttachmentGroup in the specified project in the given
5702 /// scope using the parameters that are included in the request.
5703 pub fn insert(&self) -> super::builder::interconnect_attachment_groups::Insert {
5704 super::builder::interconnect_attachment_groups::Insert::new(self.inner.clone())
5705 }
5706
5707 /// Lists the InterconnectAttachmentGroups for a project in the given scope.
5708 pub fn list(&self) -> super::builder::interconnect_attachment_groups::List {
5709 super::builder::interconnect_attachment_groups::List::new(self.inner.clone())
5710 }
5711
5712 /// Patches the specified InterconnectAttachmentGroup resource with the data
5713 /// included in the request. This method supports PATCH
5714 /// semantics and usesJSON merge
5715 /// patch format and processing rules.
5716 pub fn patch(&self) -> super::builder::interconnect_attachment_groups::Patch {
5717 super::builder::interconnect_attachment_groups::Patch::new(self.inner.clone())
5718 }
5719
5720 /// Sets the access control policy on the specified resource.
5721 /// Replaces any existing policy.
5722 pub fn set_iam_policy(&self) -> super::builder::interconnect_attachment_groups::SetIamPolicy {
5723 super::builder::interconnect_attachment_groups::SetIamPolicy::new(self.inner.clone())
5724 }
5725
5726 /// Returns permissions that a caller has on the specified resource.
5727 pub fn test_iam_permissions(
5728 &self,
5729 ) -> super::builder::interconnect_attachment_groups::TestIamPermissions {
5730 super::builder::interconnect_attachment_groups::TestIamPermissions::new(self.inner.clone())
5731 }
5732
5733 /// Retrieves the specified Operations resource.
5734 pub fn get_operation(&self) -> super::builder::interconnect_attachment_groups::GetOperation {
5735 super::builder::interconnect_attachment_groups::GetOperation::new(self.inner.clone())
5736 }
5737}
5738
5739/// Implements a client for the Google Compute Engine API.
5740///
5741/// # Example
5742/// ```
5743/// # tokio_test::block_on(async {
5744/// # use google_cloud_compute_v1::client::InterconnectAttachments;
5745/// let client = InterconnectAttachments::builder().build().await?;
5746/// // use `client` to make requests to the Google Compute Engine API.
5747/// # gax::client_builder::Result::<()>::Ok(()) });
5748/// ```
5749///
5750/// # Service Description
5751///
5752/// Service for the `interconnectAttachments` resource.
5753///
5754/// # Configuration
5755///
5756/// To configure `InterconnectAttachments` use the `with_*` methods in the type returned
5757/// by [builder()][InterconnectAttachments::builder]. The default configuration should
5758/// work for most applications. Common configuration changes include
5759///
5760/// * [with_endpoint()]: by default this client uses the global default endpoint
5761/// (`https://compute.googleapis.com`). Applications using regional
5762/// endpoints or running in restricted networks (e.g. a network configured
5763// with [Private Google Access with VPC Service Controls]) may want to
5764/// override this default.
5765/// * [with_credentials()]: by default this client uses
5766/// [Application Default Credentials]. Applications using custom
5767/// authentication may need to override this default.
5768///
5769/// [with_endpoint()]: super::builder::interconnect_attachments::ClientBuilder::with_endpoint
5770/// [with_credentials()]: super::builder::interconnect_attachments::ClientBuilder::credentials
5771/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5772/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5773///
5774/// # Pooling and Cloning
5775///
5776/// `InterconnectAttachments` holds a connection pool internally, it is advised to
5777/// create one and the reuse it. You do not need to wrap `InterconnectAttachments` in
5778/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5779/// already uses an `Arc` internally.
5780#[cfg(feature = "interconnect-attachments")]
5781#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-attachments")))]
5782#[derive(Clone, Debug)]
5783pub struct InterconnectAttachments {
5784 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachments>,
5785}
5786
5787#[cfg(feature = "interconnect-attachments")]
5788impl InterconnectAttachments {
5789 /// Returns a builder for [InterconnectAttachments].
5790 ///
5791 /// ```
5792 /// # tokio_test::block_on(async {
5793 /// # use google_cloud_compute_v1::client::InterconnectAttachments;
5794 /// let client = InterconnectAttachments::builder().build().await?;
5795 /// # gax::client_builder::Result::<()>::Ok(()) });
5796 /// ```
5797 pub fn builder() -> super::builder::interconnect_attachments::ClientBuilder {
5798 gax::client_builder::internal::new_builder(
5799 super::builder::interconnect_attachments::client::Factory,
5800 )
5801 }
5802
5803 /// Creates a new client from the provided stub.
5804 ///
5805 /// The most common case for calling this function is in tests mocking the
5806 /// client's behavior.
5807 pub fn from_stub<T>(stub: T) -> Self
5808 where
5809 T: super::stub::InterconnectAttachments + 'static,
5810 {
5811 Self {
5812 inner: std::sync::Arc::new(stub),
5813 }
5814 }
5815
5816 pub(crate) async fn new(
5817 config: gaxi::options::ClientConfig,
5818 ) -> gax::client_builder::Result<Self> {
5819 let inner = Self::build_inner(config).await?;
5820 Ok(Self { inner })
5821 }
5822
5823 async fn build_inner(
5824 conf: gaxi::options::ClientConfig,
5825 ) -> gax::client_builder::Result<
5826 std::sync::Arc<dyn super::stub::dynamic::InterconnectAttachments>,
5827 > {
5828 if gaxi::options::tracing_enabled(&conf) {
5829 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5830 }
5831 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5832 }
5833
5834 async fn build_transport(
5835 conf: gaxi::options::ClientConfig,
5836 ) -> gax::client_builder::Result<impl super::stub::InterconnectAttachments> {
5837 super::transport::InterconnectAttachments::new(conf).await
5838 }
5839
5840 async fn build_with_tracing(
5841 conf: gaxi::options::ClientConfig,
5842 ) -> gax::client_builder::Result<impl super::stub::InterconnectAttachments> {
5843 Self::build_transport(conf)
5844 .await
5845 .map(super::tracing::InterconnectAttachments::new)
5846 }
5847
5848 /// Retrieves an aggregated list of interconnect attachments.
5849 ///
5850 /// To prevent failure, Google recommends that you set the
5851 /// `returnPartialSuccess` parameter to `true`.
5852 pub fn aggregated_list(&self) -> super::builder::interconnect_attachments::AggregatedList {
5853 super::builder::interconnect_attachments::AggregatedList::new(self.inner.clone())
5854 }
5855
5856 /// Deletes the specified interconnect attachment.
5857 pub fn delete(&self) -> super::builder::interconnect_attachments::Delete {
5858 super::builder::interconnect_attachments::Delete::new(self.inner.clone())
5859 }
5860
5861 /// Returns the specified interconnect attachment.
5862 pub fn get(&self) -> super::builder::interconnect_attachments::Get {
5863 super::builder::interconnect_attachments::Get::new(self.inner.clone())
5864 }
5865
5866 /// Creates an InterconnectAttachment in the specified project using the data
5867 /// included in the request.
5868 pub fn insert(&self) -> super::builder::interconnect_attachments::Insert {
5869 super::builder::interconnect_attachments::Insert::new(self.inner.clone())
5870 }
5871
5872 /// Retrieves the list of interconnect attachments contained within
5873 /// the specified region.
5874 pub fn list(&self) -> super::builder::interconnect_attachments::List {
5875 super::builder::interconnect_attachments::List::new(self.inner.clone())
5876 }
5877
5878 /// Updates the specified interconnect attachment with the data included in the
5879 /// request. This method supportsPATCH
5880 /// semantics and uses theJSON merge
5881 /// patch format and processing rules.
5882 pub fn patch(&self) -> super::builder::interconnect_attachments::Patch {
5883 super::builder::interconnect_attachments::Patch::new(self.inner.clone())
5884 }
5885
5886 /// Sets the labels on an InterconnectAttachment. To learn more about labels,
5887 /// read the Labeling
5888 /// Resources documentation.
5889 pub fn set_labels(&self) -> super::builder::interconnect_attachments::SetLabels {
5890 super::builder::interconnect_attachments::SetLabels::new(self.inner.clone())
5891 }
5892
5893 /// Retrieves the specified region-specific Operations resource.
5894 pub fn get_operation(&self) -> super::builder::interconnect_attachments::GetOperation {
5895 super::builder::interconnect_attachments::GetOperation::new(self.inner.clone())
5896 }
5897}
5898
5899/// Implements a client for the Google Compute Engine API.
5900///
5901/// # Example
5902/// ```
5903/// # tokio_test::block_on(async {
5904/// # use google_cloud_compute_v1::client::InterconnectGroups;
5905/// let client = InterconnectGroups::builder().build().await?;
5906/// // use `client` to make requests to the Google Compute Engine API.
5907/// # gax::client_builder::Result::<()>::Ok(()) });
5908/// ```
5909///
5910/// # Service Description
5911///
5912/// Service for the `interconnectGroups` resource.
5913///
5914/// # Configuration
5915///
5916/// To configure `InterconnectGroups` use the `with_*` methods in the type returned
5917/// by [builder()][InterconnectGroups::builder]. The default configuration should
5918/// work for most applications. Common configuration changes include
5919///
5920/// * [with_endpoint()]: by default this client uses the global default endpoint
5921/// (`https://compute.googleapis.com`). Applications using regional
5922/// endpoints or running in restricted networks (e.g. a network configured
5923// with [Private Google Access with VPC Service Controls]) may want to
5924/// override this default.
5925/// * [with_credentials()]: by default this client uses
5926/// [Application Default Credentials]. Applications using custom
5927/// authentication may need to override this default.
5928///
5929/// [with_endpoint()]: super::builder::interconnect_groups::ClientBuilder::with_endpoint
5930/// [with_credentials()]: super::builder::interconnect_groups::ClientBuilder::credentials
5931/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
5932/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
5933///
5934/// # Pooling and Cloning
5935///
5936/// `InterconnectGroups` holds a connection pool internally, it is advised to
5937/// create one and the reuse it. You do not need to wrap `InterconnectGroups` in
5938/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
5939/// already uses an `Arc` internally.
5940#[cfg(feature = "interconnect-groups")]
5941#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-groups")))]
5942#[derive(Clone, Debug)]
5943pub struct InterconnectGroups {
5944 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectGroups>,
5945}
5946
5947#[cfg(feature = "interconnect-groups")]
5948impl InterconnectGroups {
5949 /// Returns a builder for [InterconnectGroups].
5950 ///
5951 /// ```
5952 /// # tokio_test::block_on(async {
5953 /// # use google_cloud_compute_v1::client::InterconnectGroups;
5954 /// let client = InterconnectGroups::builder().build().await?;
5955 /// # gax::client_builder::Result::<()>::Ok(()) });
5956 /// ```
5957 pub fn builder() -> super::builder::interconnect_groups::ClientBuilder {
5958 gax::client_builder::internal::new_builder(
5959 super::builder::interconnect_groups::client::Factory,
5960 )
5961 }
5962
5963 /// Creates a new client from the provided stub.
5964 ///
5965 /// The most common case for calling this function is in tests mocking the
5966 /// client's behavior.
5967 pub fn from_stub<T>(stub: T) -> Self
5968 where
5969 T: super::stub::InterconnectGroups + 'static,
5970 {
5971 Self {
5972 inner: std::sync::Arc::new(stub),
5973 }
5974 }
5975
5976 pub(crate) async fn new(
5977 config: gaxi::options::ClientConfig,
5978 ) -> gax::client_builder::Result<Self> {
5979 let inner = Self::build_inner(config).await?;
5980 Ok(Self { inner })
5981 }
5982
5983 async fn build_inner(
5984 conf: gaxi::options::ClientConfig,
5985 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InterconnectGroups>>
5986 {
5987 if gaxi::options::tracing_enabled(&conf) {
5988 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
5989 }
5990 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
5991 }
5992
5993 async fn build_transport(
5994 conf: gaxi::options::ClientConfig,
5995 ) -> gax::client_builder::Result<impl super::stub::InterconnectGroups> {
5996 super::transport::InterconnectGroups::new(conf).await
5997 }
5998
5999 async fn build_with_tracing(
6000 conf: gaxi::options::ClientConfig,
6001 ) -> gax::client_builder::Result<impl super::stub::InterconnectGroups> {
6002 Self::build_transport(conf)
6003 .await
6004 .map(super::tracing::InterconnectGroups::new)
6005 }
6006
6007 /// Create Interconnects with redundancy by creating them in a specified
6008 /// interconnect group.
6009 pub fn create_members(&self) -> super::builder::interconnect_groups::CreateMembers {
6010 super::builder::interconnect_groups::CreateMembers::new(self.inner.clone())
6011 }
6012
6013 /// Deletes the specified InterconnectGroup in the given scope
6014 pub fn delete(&self) -> super::builder::interconnect_groups::Delete {
6015 super::builder::interconnect_groups::Delete::new(self.inner.clone())
6016 }
6017
6018 /// Returns the specified InterconnectGroup resource in the given scope.
6019 pub fn get(&self) -> super::builder::interconnect_groups::Get {
6020 super::builder::interconnect_groups::Get::new(self.inner.clone())
6021 }
6022
6023 /// Gets the access control policy for a resource. May be empty if no such
6024 /// policy or resource exists.
6025 pub fn get_iam_policy(&self) -> super::builder::interconnect_groups::GetIamPolicy {
6026 super::builder::interconnect_groups::GetIamPolicy::new(self.inner.clone())
6027 }
6028
6029 /// Returns the interconnectStatuses for the specified
6030 /// InterconnectGroup.
6031 pub fn get_operational_status(
6032 &self,
6033 ) -> super::builder::interconnect_groups::GetOperationalStatus {
6034 super::builder::interconnect_groups::GetOperationalStatus::new(self.inner.clone())
6035 }
6036
6037 /// Creates a InterconnectGroup in the specified project in the given scope
6038 /// using the parameters that are included in the request.
6039 pub fn insert(&self) -> super::builder::interconnect_groups::Insert {
6040 super::builder::interconnect_groups::Insert::new(self.inner.clone())
6041 }
6042
6043 /// Lists the InterconnectGroups for a project in the given scope.
6044 pub fn list(&self) -> super::builder::interconnect_groups::List {
6045 super::builder::interconnect_groups::List::new(self.inner.clone())
6046 }
6047
6048 /// Patches the specified InterconnectGroup resource with the data included in
6049 /// the request. This method supports PATCH
6050 /// semantics and usesJSON merge
6051 /// patch format and processing rules.
6052 pub fn patch(&self) -> super::builder::interconnect_groups::Patch {
6053 super::builder::interconnect_groups::Patch::new(self.inner.clone())
6054 }
6055
6056 /// Sets the access control policy on the specified resource.
6057 /// Replaces any existing policy.
6058 pub fn set_iam_policy(&self) -> super::builder::interconnect_groups::SetIamPolicy {
6059 super::builder::interconnect_groups::SetIamPolicy::new(self.inner.clone())
6060 }
6061
6062 /// Returns permissions that a caller has on the specified resource.
6063 pub fn test_iam_permissions(&self) -> super::builder::interconnect_groups::TestIamPermissions {
6064 super::builder::interconnect_groups::TestIamPermissions::new(self.inner.clone())
6065 }
6066
6067 /// Retrieves the specified Operations resource.
6068 pub fn get_operation(&self) -> super::builder::interconnect_groups::GetOperation {
6069 super::builder::interconnect_groups::GetOperation::new(self.inner.clone())
6070 }
6071}
6072
6073/// Implements a client for the Google Compute Engine API.
6074///
6075/// # Example
6076/// ```
6077/// # tokio_test::block_on(async {
6078/// # use google_cloud_compute_v1::client::InterconnectLocations;
6079/// let client = InterconnectLocations::builder().build().await?;
6080/// // use `client` to make requests to the Google Compute Engine API.
6081/// # gax::client_builder::Result::<()>::Ok(()) });
6082/// ```
6083///
6084/// # Service Description
6085///
6086/// Service for the `interconnectLocations` resource.
6087///
6088/// # Configuration
6089///
6090/// To configure `InterconnectLocations` use the `with_*` methods in the type returned
6091/// by [builder()][InterconnectLocations::builder]. The default configuration should
6092/// work for most applications. Common configuration changes include
6093///
6094/// * [with_endpoint()]: by default this client uses the global default endpoint
6095/// (`https://compute.googleapis.com`). Applications using regional
6096/// endpoints or running in restricted networks (e.g. a network configured
6097// with [Private Google Access with VPC Service Controls]) may want to
6098/// override this default.
6099/// * [with_credentials()]: by default this client uses
6100/// [Application Default Credentials]. Applications using custom
6101/// authentication may need to override this default.
6102///
6103/// [with_endpoint()]: super::builder::interconnect_locations::ClientBuilder::with_endpoint
6104/// [with_credentials()]: super::builder::interconnect_locations::ClientBuilder::credentials
6105/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6106/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6107///
6108/// # Pooling and Cloning
6109///
6110/// `InterconnectLocations` holds a connection pool internally, it is advised to
6111/// create one and the reuse it. You do not need to wrap `InterconnectLocations` in
6112/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6113/// already uses an `Arc` internally.
6114#[cfg(feature = "interconnect-locations")]
6115#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-locations")))]
6116#[derive(Clone, Debug)]
6117pub struct InterconnectLocations {
6118 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectLocations>,
6119}
6120
6121#[cfg(feature = "interconnect-locations")]
6122impl InterconnectLocations {
6123 /// Returns a builder for [InterconnectLocations].
6124 ///
6125 /// ```
6126 /// # tokio_test::block_on(async {
6127 /// # use google_cloud_compute_v1::client::InterconnectLocations;
6128 /// let client = InterconnectLocations::builder().build().await?;
6129 /// # gax::client_builder::Result::<()>::Ok(()) });
6130 /// ```
6131 pub fn builder() -> super::builder::interconnect_locations::ClientBuilder {
6132 gax::client_builder::internal::new_builder(
6133 super::builder::interconnect_locations::client::Factory,
6134 )
6135 }
6136
6137 /// Creates a new client from the provided stub.
6138 ///
6139 /// The most common case for calling this function is in tests mocking the
6140 /// client's behavior.
6141 pub fn from_stub<T>(stub: T) -> Self
6142 where
6143 T: super::stub::InterconnectLocations + 'static,
6144 {
6145 Self {
6146 inner: std::sync::Arc::new(stub),
6147 }
6148 }
6149
6150 pub(crate) async fn new(
6151 config: gaxi::options::ClientConfig,
6152 ) -> gax::client_builder::Result<Self> {
6153 let inner = Self::build_inner(config).await?;
6154 Ok(Self { inner })
6155 }
6156
6157 async fn build_inner(
6158 conf: gaxi::options::ClientConfig,
6159 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::InterconnectLocations>>
6160 {
6161 if gaxi::options::tracing_enabled(&conf) {
6162 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6163 }
6164 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6165 }
6166
6167 async fn build_transport(
6168 conf: gaxi::options::ClientConfig,
6169 ) -> gax::client_builder::Result<impl super::stub::InterconnectLocations> {
6170 super::transport::InterconnectLocations::new(conf).await
6171 }
6172
6173 async fn build_with_tracing(
6174 conf: gaxi::options::ClientConfig,
6175 ) -> gax::client_builder::Result<impl super::stub::InterconnectLocations> {
6176 Self::build_transport(conf)
6177 .await
6178 .map(super::tracing::InterconnectLocations::new)
6179 }
6180
6181 /// Returns the details for the specified interconnect location. Gets a list of
6182 /// available interconnect locations by making a list() request.
6183 pub fn get(&self) -> super::builder::interconnect_locations::Get {
6184 super::builder::interconnect_locations::Get::new(self.inner.clone())
6185 }
6186
6187 /// Retrieves the list of interconnect locations available to the specified
6188 /// project.
6189 pub fn list(&self) -> super::builder::interconnect_locations::List {
6190 super::builder::interconnect_locations::List::new(self.inner.clone())
6191 }
6192}
6193
6194/// Implements a client for the Google Compute Engine API.
6195///
6196/// # Example
6197/// ```
6198/// # tokio_test::block_on(async {
6199/// # use google_cloud_compute_v1::client::InterconnectRemoteLocations;
6200/// let client = InterconnectRemoteLocations::builder().build().await?;
6201/// // use `client` to make requests to the Google Compute Engine API.
6202/// # gax::client_builder::Result::<()>::Ok(()) });
6203/// ```
6204///
6205/// # Service Description
6206///
6207/// Service for the `interconnectRemoteLocations` resource.
6208///
6209/// # Configuration
6210///
6211/// To configure `InterconnectRemoteLocations` use the `with_*` methods in the type returned
6212/// by [builder()][InterconnectRemoteLocations::builder]. The default configuration should
6213/// work for most applications. Common configuration changes include
6214///
6215/// * [with_endpoint()]: by default this client uses the global default endpoint
6216/// (`https://compute.googleapis.com`). Applications using regional
6217/// endpoints or running in restricted networks (e.g. a network configured
6218// with [Private Google Access with VPC Service Controls]) may want to
6219/// override this default.
6220/// * [with_credentials()]: by default this client uses
6221/// [Application Default Credentials]. Applications using custom
6222/// authentication may need to override this default.
6223///
6224/// [with_endpoint()]: super::builder::interconnect_remote_locations::ClientBuilder::with_endpoint
6225/// [with_credentials()]: super::builder::interconnect_remote_locations::ClientBuilder::credentials
6226/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6227/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6228///
6229/// # Pooling and Cloning
6230///
6231/// `InterconnectRemoteLocations` holds a connection pool internally, it is advised to
6232/// create one and the reuse it. You do not need to wrap `InterconnectRemoteLocations` in
6233/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6234/// already uses an `Arc` internally.
6235#[cfg(feature = "interconnect-remote-locations")]
6236#[cfg_attr(docsrs, doc(cfg(feature = "interconnect-remote-locations")))]
6237#[derive(Clone, Debug)]
6238pub struct InterconnectRemoteLocations {
6239 inner: std::sync::Arc<dyn super::stub::dynamic::InterconnectRemoteLocations>,
6240}
6241
6242#[cfg(feature = "interconnect-remote-locations")]
6243impl InterconnectRemoteLocations {
6244 /// Returns a builder for [InterconnectRemoteLocations].
6245 ///
6246 /// ```
6247 /// # tokio_test::block_on(async {
6248 /// # use google_cloud_compute_v1::client::InterconnectRemoteLocations;
6249 /// let client = InterconnectRemoteLocations::builder().build().await?;
6250 /// # gax::client_builder::Result::<()>::Ok(()) });
6251 /// ```
6252 pub fn builder() -> super::builder::interconnect_remote_locations::ClientBuilder {
6253 gax::client_builder::internal::new_builder(
6254 super::builder::interconnect_remote_locations::client::Factory,
6255 )
6256 }
6257
6258 /// Creates a new client from the provided stub.
6259 ///
6260 /// The most common case for calling this function is in tests mocking the
6261 /// client's behavior.
6262 pub fn from_stub<T>(stub: T) -> Self
6263 where
6264 T: super::stub::InterconnectRemoteLocations + 'static,
6265 {
6266 Self {
6267 inner: std::sync::Arc::new(stub),
6268 }
6269 }
6270
6271 pub(crate) async fn new(
6272 config: gaxi::options::ClientConfig,
6273 ) -> gax::client_builder::Result<Self> {
6274 let inner = Self::build_inner(config).await?;
6275 Ok(Self { inner })
6276 }
6277
6278 async fn build_inner(
6279 conf: gaxi::options::ClientConfig,
6280 ) -> gax::client_builder::Result<
6281 std::sync::Arc<dyn super::stub::dynamic::InterconnectRemoteLocations>,
6282 > {
6283 if gaxi::options::tracing_enabled(&conf) {
6284 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6285 }
6286 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6287 }
6288
6289 async fn build_transport(
6290 conf: gaxi::options::ClientConfig,
6291 ) -> gax::client_builder::Result<impl super::stub::InterconnectRemoteLocations> {
6292 super::transport::InterconnectRemoteLocations::new(conf).await
6293 }
6294
6295 async fn build_with_tracing(
6296 conf: gaxi::options::ClientConfig,
6297 ) -> gax::client_builder::Result<impl super::stub::InterconnectRemoteLocations> {
6298 Self::build_transport(conf)
6299 .await
6300 .map(super::tracing::InterconnectRemoteLocations::new)
6301 }
6302
6303 /// Returns the details for the specified interconnect remote location. Gets a
6304 /// list of available interconnect remote locations by making alist() request.
6305 pub fn get(&self) -> super::builder::interconnect_remote_locations::Get {
6306 super::builder::interconnect_remote_locations::Get::new(self.inner.clone())
6307 }
6308
6309 /// Retrieves the list of interconnect remote locations available to the
6310 /// specified project.
6311 pub fn list(&self) -> super::builder::interconnect_remote_locations::List {
6312 super::builder::interconnect_remote_locations::List::new(self.inner.clone())
6313 }
6314}
6315
6316/// Implements a client for the Google Compute Engine API.
6317///
6318/// # Example
6319/// ```
6320/// # tokio_test::block_on(async {
6321/// # use google_cloud_compute_v1::client::Interconnects;
6322/// let client = Interconnects::builder().build().await?;
6323/// // use `client` to make requests to the Google Compute Engine API.
6324/// # gax::client_builder::Result::<()>::Ok(()) });
6325/// ```
6326///
6327/// # Service Description
6328///
6329/// Service for the `interconnects` resource.
6330///
6331/// # Configuration
6332///
6333/// To configure `Interconnects` use the `with_*` methods in the type returned
6334/// by [builder()][Interconnects::builder]. The default configuration should
6335/// work for most applications. Common configuration changes include
6336///
6337/// * [with_endpoint()]: by default this client uses the global default endpoint
6338/// (`https://compute.googleapis.com`). Applications using regional
6339/// endpoints or running in restricted networks (e.g. a network configured
6340// with [Private Google Access with VPC Service Controls]) may want to
6341/// override this default.
6342/// * [with_credentials()]: by default this client uses
6343/// [Application Default Credentials]. Applications using custom
6344/// authentication may need to override this default.
6345///
6346/// [with_endpoint()]: super::builder::interconnects::ClientBuilder::with_endpoint
6347/// [with_credentials()]: super::builder::interconnects::ClientBuilder::credentials
6348/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6349/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6350///
6351/// # Pooling and Cloning
6352///
6353/// `Interconnects` holds a connection pool internally, it is advised to
6354/// create one and the reuse it. You do not need to wrap `Interconnects` in
6355/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6356/// already uses an `Arc` internally.
6357#[cfg(feature = "interconnects")]
6358#[cfg_attr(docsrs, doc(cfg(feature = "interconnects")))]
6359#[derive(Clone, Debug)]
6360pub struct Interconnects {
6361 inner: std::sync::Arc<dyn super::stub::dynamic::Interconnects>,
6362}
6363
6364#[cfg(feature = "interconnects")]
6365impl Interconnects {
6366 /// Returns a builder for [Interconnects].
6367 ///
6368 /// ```
6369 /// # tokio_test::block_on(async {
6370 /// # use google_cloud_compute_v1::client::Interconnects;
6371 /// let client = Interconnects::builder().build().await?;
6372 /// # gax::client_builder::Result::<()>::Ok(()) });
6373 /// ```
6374 pub fn builder() -> super::builder::interconnects::ClientBuilder {
6375 gax::client_builder::internal::new_builder(super::builder::interconnects::client::Factory)
6376 }
6377
6378 /// Creates a new client from the provided stub.
6379 ///
6380 /// The most common case for calling this function is in tests mocking the
6381 /// client's behavior.
6382 pub fn from_stub<T>(stub: T) -> Self
6383 where
6384 T: super::stub::Interconnects + 'static,
6385 {
6386 Self {
6387 inner: std::sync::Arc::new(stub),
6388 }
6389 }
6390
6391 pub(crate) async fn new(
6392 config: gaxi::options::ClientConfig,
6393 ) -> gax::client_builder::Result<Self> {
6394 let inner = Self::build_inner(config).await?;
6395 Ok(Self { inner })
6396 }
6397
6398 async fn build_inner(
6399 conf: gaxi::options::ClientConfig,
6400 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Interconnects>> {
6401 if gaxi::options::tracing_enabled(&conf) {
6402 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6403 }
6404 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6405 }
6406
6407 async fn build_transport(
6408 conf: gaxi::options::ClientConfig,
6409 ) -> gax::client_builder::Result<impl super::stub::Interconnects> {
6410 super::transport::Interconnects::new(conf).await
6411 }
6412
6413 async fn build_with_tracing(
6414 conf: gaxi::options::ClientConfig,
6415 ) -> gax::client_builder::Result<impl super::stub::Interconnects> {
6416 Self::build_transport(conf)
6417 .await
6418 .map(super::tracing::Interconnects::new)
6419 }
6420
6421 /// Deletes the specified Interconnect.
6422 pub fn delete(&self) -> super::builder::interconnects::Delete {
6423 super::builder::interconnects::Delete::new(self.inner.clone())
6424 }
6425
6426 /// Returns the specified Interconnect. Get a list of available Interconnects
6427 /// by making a list() request.
6428 pub fn get(&self) -> super::builder::interconnects::Get {
6429 super::builder::interconnects::Get::new(self.inner.clone())
6430 }
6431
6432 /// Returns the interconnectDiagnostics for the specified
6433 /// Interconnect.
6434 ///
6435 /// In the event of a
6436 /// global outage, do not use this API to make decisions about where to
6437 /// redirect your network traffic.
6438 ///
6439 /// Unlike a VLAN attachment, which is regional, a Cloud Interconnect
6440 /// connection is a global resource. A global outage can prevent this
6441 /// API from functioning properly.
6442 pub fn get_diagnostics(&self) -> super::builder::interconnects::GetDiagnostics {
6443 super::builder::interconnects::GetDiagnostics::new(self.inner.clone())
6444 }
6445
6446 /// Returns the interconnectMacsecConfig for the specified
6447 /// Interconnect.
6448 pub fn get_macsec_config(&self) -> super::builder::interconnects::GetMacsecConfig {
6449 super::builder::interconnects::GetMacsecConfig::new(self.inner.clone())
6450 }
6451
6452 /// Creates an Interconnect in the specified project using
6453 /// the data included in the request.
6454 pub fn insert(&self) -> super::builder::interconnects::Insert {
6455 super::builder::interconnects::Insert::new(self.inner.clone())
6456 }
6457
6458 /// Retrieves the list of Interconnects available to the specified project.
6459 pub fn list(&self) -> super::builder::interconnects::List {
6460 super::builder::interconnects::List::new(self.inner.clone())
6461 }
6462
6463 /// Updates the specified Interconnect with the data included in the request.
6464 /// This method supportsPATCH
6465 /// semantics and uses theJSON merge
6466 /// patch format and processing rules.
6467 pub fn patch(&self) -> super::builder::interconnects::Patch {
6468 super::builder::interconnects::Patch::new(self.inner.clone())
6469 }
6470
6471 /// Sets the labels on an Interconnect. To learn more about labels,
6472 /// read the Labeling
6473 /// Resources documentation.
6474 pub fn set_labels(&self) -> super::builder::interconnects::SetLabels {
6475 super::builder::interconnects::SetLabels::new(self.inner.clone())
6476 }
6477
6478 /// Retrieves the specified Operations resource.
6479 pub fn get_operation(&self) -> super::builder::interconnects::GetOperation {
6480 super::builder::interconnects::GetOperation::new(self.inner.clone())
6481 }
6482}
6483
6484/// Implements a client for the Google Compute Engine API.
6485///
6486/// # Example
6487/// ```
6488/// # tokio_test::block_on(async {
6489/// # use google_cloud_compute_v1::client::LicenseCodes;
6490/// let client = LicenseCodes::builder().build().await?;
6491/// // use `client` to make requests to the Google Compute Engine API.
6492/// # gax::client_builder::Result::<()>::Ok(()) });
6493/// ```
6494///
6495/// # Service Description
6496///
6497/// Service for the `licenseCodes` resource.
6498///
6499/// # Configuration
6500///
6501/// To configure `LicenseCodes` use the `with_*` methods in the type returned
6502/// by [builder()][LicenseCodes::builder]. The default configuration should
6503/// work for most applications. Common configuration changes include
6504///
6505/// * [with_endpoint()]: by default this client uses the global default endpoint
6506/// (`https://compute.googleapis.com`). Applications using regional
6507/// endpoints or running in restricted networks (e.g. a network configured
6508// with [Private Google Access with VPC Service Controls]) may want to
6509/// override this default.
6510/// * [with_credentials()]: by default this client uses
6511/// [Application Default Credentials]. Applications using custom
6512/// authentication may need to override this default.
6513///
6514/// [with_endpoint()]: super::builder::license_codes::ClientBuilder::with_endpoint
6515/// [with_credentials()]: super::builder::license_codes::ClientBuilder::credentials
6516/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6517/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6518///
6519/// # Pooling and Cloning
6520///
6521/// `LicenseCodes` holds a connection pool internally, it is advised to
6522/// create one and the reuse it. You do not need to wrap `LicenseCodes` in
6523/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6524/// already uses an `Arc` internally.
6525#[cfg(feature = "license-codes")]
6526#[cfg_attr(docsrs, doc(cfg(feature = "license-codes")))]
6527#[derive(Clone, Debug)]
6528pub struct LicenseCodes {
6529 inner: std::sync::Arc<dyn super::stub::dynamic::LicenseCodes>,
6530}
6531
6532#[cfg(feature = "license-codes")]
6533impl LicenseCodes {
6534 /// Returns a builder for [LicenseCodes].
6535 ///
6536 /// ```
6537 /// # tokio_test::block_on(async {
6538 /// # use google_cloud_compute_v1::client::LicenseCodes;
6539 /// let client = LicenseCodes::builder().build().await?;
6540 /// # gax::client_builder::Result::<()>::Ok(()) });
6541 /// ```
6542 pub fn builder() -> super::builder::license_codes::ClientBuilder {
6543 gax::client_builder::internal::new_builder(super::builder::license_codes::client::Factory)
6544 }
6545
6546 /// Creates a new client from the provided stub.
6547 ///
6548 /// The most common case for calling this function is in tests mocking the
6549 /// client's behavior.
6550 pub fn from_stub<T>(stub: T) -> Self
6551 where
6552 T: super::stub::LicenseCodes + 'static,
6553 {
6554 Self {
6555 inner: std::sync::Arc::new(stub),
6556 }
6557 }
6558
6559 pub(crate) async fn new(
6560 config: gaxi::options::ClientConfig,
6561 ) -> gax::client_builder::Result<Self> {
6562 let inner = Self::build_inner(config).await?;
6563 Ok(Self { inner })
6564 }
6565
6566 async fn build_inner(
6567 conf: gaxi::options::ClientConfig,
6568 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::LicenseCodes>> {
6569 if gaxi::options::tracing_enabled(&conf) {
6570 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6571 }
6572 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6573 }
6574
6575 async fn build_transport(
6576 conf: gaxi::options::ClientConfig,
6577 ) -> gax::client_builder::Result<impl super::stub::LicenseCodes> {
6578 super::transport::LicenseCodes::new(conf).await
6579 }
6580
6581 async fn build_with_tracing(
6582 conf: gaxi::options::ClientConfig,
6583 ) -> gax::client_builder::Result<impl super::stub::LicenseCodes> {
6584 Self::build_transport(conf)
6585 .await
6586 .map(super::tracing::LicenseCodes::new)
6587 }
6588
6589 /// Return a specified license code. License codes are mirrored across
6590 /// all projects that have permissions to read the License Code.
6591 /// *Caution* This resource is intended
6592 /// for use only by third-party partners who are creatingCloud Marketplace
6593 /// images.
6594 pub fn get(&self) -> super::builder::license_codes::Get {
6595 super::builder::license_codes::Get::new(self.inner.clone())
6596 }
6597
6598 /// Returns permissions that a caller has on the specified resource.
6599 /// *Caution* This resource is intended
6600 /// for use only by third-party partners who are creatingCloud Marketplace
6601 /// images.
6602 pub fn test_iam_permissions(&self) -> super::builder::license_codes::TestIamPermissions {
6603 super::builder::license_codes::TestIamPermissions::new(self.inner.clone())
6604 }
6605}
6606
6607/// Implements a client for the Google Compute Engine API.
6608///
6609/// # Example
6610/// ```
6611/// # tokio_test::block_on(async {
6612/// # use google_cloud_compute_v1::client::Licenses;
6613/// let client = Licenses::builder().build().await?;
6614/// // use `client` to make requests to the Google Compute Engine API.
6615/// # gax::client_builder::Result::<()>::Ok(()) });
6616/// ```
6617///
6618/// # Service Description
6619///
6620/// Service for the `licenses` resource.
6621///
6622/// # Configuration
6623///
6624/// To configure `Licenses` use the `with_*` methods in the type returned
6625/// by [builder()][Licenses::builder]. The default configuration should
6626/// work for most applications. Common configuration changes include
6627///
6628/// * [with_endpoint()]: by default this client uses the global default endpoint
6629/// (`https://compute.googleapis.com`). Applications using regional
6630/// endpoints or running in restricted networks (e.g. a network configured
6631// with [Private Google Access with VPC Service Controls]) may want to
6632/// override this default.
6633/// * [with_credentials()]: by default this client uses
6634/// [Application Default Credentials]. Applications using custom
6635/// authentication may need to override this default.
6636///
6637/// [with_endpoint()]: super::builder::licenses::ClientBuilder::with_endpoint
6638/// [with_credentials()]: super::builder::licenses::ClientBuilder::credentials
6639/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6640/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6641///
6642/// # Pooling and Cloning
6643///
6644/// `Licenses` holds a connection pool internally, it is advised to
6645/// create one and the reuse it. You do not need to wrap `Licenses` in
6646/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6647/// already uses an `Arc` internally.
6648#[cfg(feature = "licenses")]
6649#[cfg_attr(docsrs, doc(cfg(feature = "licenses")))]
6650#[derive(Clone, Debug)]
6651pub struct Licenses {
6652 inner: std::sync::Arc<dyn super::stub::dynamic::Licenses>,
6653}
6654
6655#[cfg(feature = "licenses")]
6656impl Licenses {
6657 /// Returns a builder for [Licenses].
6658 ///
6659 /// ```
6660 /// # tokio_test::block_on(async {
6661 /// # use google_cloud_compute_v1::client::Licenses;
6662 /// let client = Licenses::builder().build().await?;
6663 /// # gax::client_builder::Result::<()>::Ok(()) });
6664 /// ```
6665 pub fn builder() -> super::builder::licenses::ClientBuilder {
6666 gax::client_builder::internal::new_builder(super::builder::licenses::client::Factory)
6667 }
6668
6669 /// Creates a new client from the provided stub.
6670 ///
6671 /// The most common case for calling this function is in tests mocking the
6672 /// client's behavior.
6673 pub fn from_stub<T>(stub: T) -> Self
6674 where
6675 T: super::stub::Licenses + 'static,
6676 {
6677 Self {
6678 inner: std::sync::Arc::new(stub),
6679 }
6680 }
6681
6682 pub(crate) async fn new(
6683 config: gaxi::options::ClientConfig,
6684 ) -> gax::client_builder::Result<Self> {
6685 let inner = Self::build_inner(config).await?;
6686 Ok(Self { inner })
6687 }
6688
6689 async fn build_inner(
6690 conf: gaxi::options::ClientConfig,
6691 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Licenses>> {
6692 if gaxi::options::tracing_enabled(&conf) {
6693 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6694 }
6695 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6696 }
6697
6698 async fn build_transport(
6699 conf: gaxi::options::ClientConfig,
6700 ) -> gax::client_builder::Result<impl super::stub::Licenses> {
6701 super::transport::Licenses::new(conf).await
6702 }
6703
6704 async fn build_with_tracing(
6705 conf: gaxi::options::ClientConfig,
6706 ) -> gax::client_builder::Result<impl super::stub::Licenses> {
6707 Self::build_transport(conf)
6708 .await
6709 .map(super::tracing::Licenses::new)
6710 }
6711
6712 /// Deletes the specified license.
6713 /// *Caution* This resource is intended
6714 /// for use only by third-party partners who are creatingCloud Marketplace
6715 /// images.
6716 pub fn delete(&self) -> super::builder::licenses::Delete {
6717 super::builder::licenses::Delete::new(self.inner.clone())
6718 }
6719
6720 /// Returns the specified License resource.
6721 /// *Caution* This resource is intended
6722 /// for use only by third-party partners who are creatingCloud Marketplace
6723 /// images.
6724 pub fn get(&self) -> super::builder::licenses::Get {
6725 super::builder::licenses::Get::new(self.inner.clone())
6726 }
6727
6728 /// Gets the access control policy for a resource. May be empty if no such
6729 /// policy or resource exists.
6730 /// *Caution* This resource is intended
6731 /// for use only by third-party partners who are creatingCloud Marketplace
6732 /// images.
6733 pub fn get_iam_policy(&self) -> super::builder::licenses::GetIamPolicy {
6734 super::builder::licenses::GetIamPolicy::new(self.inner.clone())
6735 }
6736
6737 /// Create a License resource in the specified project.
6738 /// *Caution* This resource is intended
6739 /// for use only by third-party partners who are creatingCloud Marketplace
6740 /// images.
6741 pub fn insert(&self) -> super::builder::licenses::Insert {
6742 super::builder::licenses::Insert::new(self.inner.clone())
6743 }
6744
6745 /// Retrieves the list of licenses
6746 /// available in the specified project. This method does not
6747 /// get any licenses that belong to other projects, including licenses attached
6748 /// to publicly-available images, like Debian 9. If you want to get a list of
6749 /// publicly-available licenses, use this method to make a request to the
6750 /// respective image project, such as debian-cloud orwindows-cloud.
6751 /// *Caution* This resource is intended
6752 /// for use only by third-party partners who are creatingCloud Marketplace
6753 /// images.
6754 pub fn list(&self) -> super::builder::licenses::List {
6755 super::builder::licenses::List::new(self.inner.clone())
6756 }
6757
6758 /// Sets the access control policy on the specified resource.
6759 /// Replaces any existing policy.
6760 /// *Caution* This resource is intended
6761 /// for use only by third-party partners who are creatingCloud Marketplace
6762 /// images.
6763 pub fn set_iam_policy(&self) -> super::builder::licenses::SetIamPolicy {
6764 super::builder::licenses::SetIamPolicy::new(self.inner.clone())
6765 }
6766
6767 /// Returns permissions that a caller has on the specified resource.
6768 /// *Caution* This resource is intended
6769 /// for use only by third-party partners who are creatingCloud Marketplace
6770 /// images.
6771 pub fn test_iam_permissions(&self) -> super::builder::licenses::TestIamPermissions {
6772 super::builder::licenses::TestIamPermissions::new(self.inner.clone())
6773 }
6774
6775 /// Updates a License resource in the specified project.
6776 /// *Caution* This resource is intended
6777 /// for use only by third-party partners who are creatingCloud Marketplace
6778 /// images.
6779 pub fn update(&self) -> super::builder::licenses::Update {
6780 super::builder::licenses::Update::new(self.inner.clone())
6781 }
6782
6783 /// Retrieves the specified Operations resource.
6784 pub fn get_operation(&self) -> super::builder::licenses::GetOperation {
6785 super::builder::licenses::GetOperation::new(self.inner.clone())
6786 }
6787}
6788
6789/// Implements a client for the Google Compute Engine API.
6790///
6791/// # Example
6792/// ```
6793/// # tokio_test::block_on(async {
6794/// # use google_cloud_compute_v1::client::MachineImages;
6795/// let client = MachineImages::builder().build().await?;
6796/// // use `client` to make requests to the Google Compute Engine API.
6797/// # gax::client_builder::Result::<()>::Ok(()) });
6798/// ```
6799///
6800/// # Service Description
6801///
6802/// Service for the `machineImages` resource.
6803///
6804/// # Configuration
6805///
6806/// To configure `MachineImages` use the `with_*` methods in the type returned
6807/// by [builder()][MachineImages::builder]. The default configuration should
6808/// work for most applications. Common configuration changes include
6809///
6810/// * [with_endpoint()]: by default this client uses the global default endpoint
6811/// (`https://compute.googleapis.com`). Applications using regional
6812/// endpoints or running in restricted networks (e.g. a network configured
6813// with [Private Google Access with VPC Service Controls]) may want to
6814/// override this default.
6815/// * [with_credentials()]: by default this client uses
6816/// [Application Default Credentials]. Applications using custom
6817/// authentication may need to override this default.
6818///
6819/// [with_endpoint()]: super::builder::machine_images::ClientBuilder::with_endpoint
6820/// [with_credentials()]: super::builder::machine_images::ClientBuilder::credentials
6821/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6822/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6823///
6824/// # Pooling and Cloning
6825///
6826/// `MachineImages` holds a connection pool internally, it is advised to
6827/// create one and the reuse it. You do not need to wrap `MachineImages` in
6828/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6829/// already uses an `Arc` internally.
6830#[cfg(feature = "machine-images")]
6831#[cfg_attr(docsrs, doc(cfg(feature = "machine-images")))]
6832#[derive(Clone, Debug)]
6833pub struct MachineImages {
6834 inner: std::sync::Arc<dyn super::stub::dynamic::MachineImages>,
6835}
6836
6837#[cfg(feature = "machine-images")]
6838impl MachineImages {
6839 /// Returns a builder for [MachineImages].
6840 ///
6841 /// ```
6842 /// # tokio_test::block_on(async {
6843 /// # use google_cloud_compute_v1::client::MachineImages;
6844 /// let client = MachineImages::builder().build().await?;
6845 /// # gax::client_builder::Result::<()>::Ok(()) });
6846 /// ```
6847 pub fn builder() -> super::builder::machine_images::ClientBuilder {
6848 gax::client_builder::internal::new_builder(super::builder::machine_images::client::Factory)
6849 }
6850
6851 /// Creates a new client from the provided stub.
6852 ///
6853 /// The most common case for calling this function is in tests mocking the
6854 /// client's behavior.
6855 pub fn from_stub<T>(stub: T) -> Self
6856 where
6857 T: super::stub::MachineImages + 'static,
6858 {
6859 Self {
6860 inner: std::sync::Arc::new(stub),
6861 }
6862 }
6863
6864 pub(crate) async fn new(
6865 config: gaxi::options::ClientConfig,
6866 ) -> gax::client_builder::Result<Self> {
6867 let inner = Self::build_inner(config).await?;
6868 Ok(Self { inner })
6869 }
6870
6871 async fn build_inner(
6872 conf: gaxi::options::ClientConfig,
6873 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MachineImages>> {
6874 if gaxi::options::tracing_enabled(&conf) {
6875 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
6876 }
6877 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
6878 }
6879
6880 async fn build_transport(
6881 conf: gaxi::options::ClientConfig,
6882 ) -> gax::client_builder::Result<impl super::stub::MachineImages> {
6883 super::transport::MachineImages::new(conf).await
6884 }
6885
6886 async fn build_with_tracing(
6887 conf: gaxi::options::ClientConfig,
6888 ) -> gax::client_builder::Result<impl super::stub::MachineImages> {
6889 Self::build_transport(conf)
6890 .await
6891 .map(super::tracing::MachineImages::new)
6892 }
6893
6894 /// Deletes the specified machine image. Deleting a machine image is permanent
6895 /// and cannot be undone.
6896 pub fn delete(&self) -> super::builder::machine_images::Delete {
6897 super::builder::machine_images::Delete::new(self.inner.clone())
6898 }
6899
6900 /// Returns the specified machine image.
6901 pub fn get(&self) -> super::builder::machine_images::Get {
6902 super::builder::machine_images::Get::new(self.inner.clone())
6903 }
6904
6905 /// Gets the access control policy for a resource. May be empty if no such
6906 /// policy or resource exists.
6907 pub fn get_iam_policy(&self) -> super::builder::machine_images::GetIamPolicy {
6908 super::builder::machine_images::GetIamPolicy::new(self.inner.clone())
6909 }
6910
6911 /// Creates a machine image in the specified project using the
6912 /// data that is included in the request. If you are creating a new machine
6913 /// image to update an existing instance, your new machine image should use the
6914 /// same network or, if applicable, the same subnetwork as the original
6915 /// instance.
6916 pub fn insert(&self) -> super::builder::machine_images::Insert {
6917 super::builder::machine_images::Insert::new(self.inner.clone())
6918 }
6919
6920 /// Retrieves a list of machine images that are contained within
6921 /// the specified project.
6922 pub fn list(&self) -> super::builder::machine_images::List {
6923 super::builder::machine_images::List::new(self.inner.clone())
6924 }
6925
6926 /// Sets the access control policy on the specified resource.
6927 /// Replaces any existing policy.
6928 pub fn set_iam_policy(&self) -> super::builder::machine_images::SetIamPolicy {
6929 super::builder::machine_images::SetIamPolicy::new(self.inner.clone())
6930 }
6931
6932 /// Sets the labels on a machine image. To learn more about labels, read theLabeling
6933 /// Resources documentation.
6934 pub fn set_labels(&self) -> super::builder::machine_images::SetLabels {
6935 super::builder::machine_images::SetLabels::new(self.inner.clone())
6936 }
6937
6938 /// Returns permissions that a caller has on the specified resource.
6939 pub fn test_iam_permissions(&self) -> super::builder::machine_images::TestIamPermissions {
6940 super::builder::machine_images::TestIamPermissions::new(self.inner.clone())
6941 }
6942
6943 /// Retrieves the specified Operations resource.
6944 pub fn get_operation(&self) -> super::builder::machine_images::GetOperation {
6945 super::builder::machine_images::GetOperation::new(self.inner.clone())
6946 }
6947}
6948
6949/// Implements a client for the Google Compute Engine API.
6950///
6951/// # Example
6952/// ```
6953/// # tokio_test::block_on(async {
6954/// # use google_cloud_compute_v1::client::MachineTypes;
6955/// let client = MachineTypes::builder().build().await?;
6956/// // use `client` to make requests to the Google Compute Engine API.
6957/// # gax::client_builder::Result::<()>::Ok(()) });
6958/// ```
6959///
6960/// # Service Description
6961///
6962/// Service for the `machineTypes` resource.
6963///
6964/// # Configuration
6965///
6966/// To configure `MachineTypes` use the `with_*` methods in the type returned
6967/// by [builder()][MachineTypes::builder]. The default configuration should
6968/// work for most applications. Common configuration changes include
6969///
6970/// * [with_endpoint()]: by default this client uses the global default endpoint
6971/// (`https://compute.googleapis.com`). Applications using regional
6972/// endpoints or running in restricted networks (e.g. a network configured
6973// with [Private Google Access with VPC Service Controls]) may want to
6974/// override this default.
6975/// * [with_credentials()]: by default this client uses
6976/// [Application Default Credentials]. Applications using custom
6977/// authentication may need to override this default.
6978///
6979/// [with_endpoint()]: super::builder::machine_types::ClientBuilder::with_endpoint
6980/// [with_credentials()]: super::builder::machine_types::ClientBuilder::credentials
6981/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
6982/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
6983///
6984/// # Pooling and Cloning
6985///
6986/// `MachineTypes` holds a connection pool internally, it is advised to
6987/// create one and the reuse it. You do not need to wrap `MachineTypes` in
6988/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
6989/// already uses an `Arc` internally.
6990#[cfg(feature = "machine-types")]
6991#[cfg_attr(docsrs, doc(cfg(feature = "machine-types")))]
6992#[derive(Clone, Debug)]
6993pub struct MachineTypes {
6994 inner: std::sync::Arc<dyn super::stub::dynamic::MachineTypes>,
6995}
6996
6997#[cfg(feature = "machine-types")]
6998impl MachineTypes {
6999 /// Returns a builder for [MachineTypes].
7000 ///
7001 /// ```
7002 /// # tokio_test::block_on(async {
7003 /// # use google_cloud_compute_v1::client::MachineTypes;
7004 /// let client = MachineTypes::builder().build().await?;
7005 /// # gax::client_builder::Result::<()>::Ok(()) });
7006 /// ```
7007 pub fn builder() -> super::builder::machine_types::ClientBuilder {
7008 gax::client_builder::internal::new_builder(super::builder::machine_types::client::Factory)
7009 }
7010
7011 /// Creates a new client from the provided stub.
7012 ///
7013 /// The most common case for calling this function is in tests mocking the
7014 /// client's behavior.
7015 pub fn from_stub<T>(stub: T) -> Self
7016 where
7017 T: super::stub::MachineTypes + 'static,
7018 {
7019 Self {
7020 inner: std::sync::Arc::new(stub),
7021 }
7022 }
7023
7024 pub(crate) async fn new(
7025 config: gaxi::options::ClientConfig,
7026 ) -> gax::client_builder::Result<Self> {
7027 let inner = Self::build_inner(config).await?;
7028 Ok(Self { inner })
7029 }
7030
7031 async fn build_inner(
7032 conf: gaxi::options::ClientConfig,
7033 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::MachineTypes>> {
7034 if gaxi::options::tracing_enabled(&conf) {
7035 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7036 }
7037 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7038 }
7039
7040 async fn build_transport(
7041 conf: gaxi::options::ClientConfig,
7042 ) -> gax::client_builder::Result<impl super::stub::MachineTypes> {
7043 super::transport::MachineTypes::new(conf).await
7044 }
7045
7046 async fn build_with_tracing(
7047 conf: gaxi::options::ClientConfig,
7048 ) -> gax::client_builder::Result<impl super::stub::MachineTypes> {
7049 Self::build_transport(conf)
7050 .await
7051 .map(super::tracing::MachineTypes::new)
7052 }
7053
7054 /// Retrieves an aggregated list of machine types.
7055 ///
7056 /// To prevent failure, Google recommends that you set the
7057 /// `returnPartialSuccess` parameter to `true`.
7058 pub fn aggregated_list(&self) -> super::builder::machine_types::AggregatedList {
7059 super::builder::machine_types::AggregatedList::new(self.inner.clone())
7060 }
7061
7062 /// Returns the specified machine type.
7063 pub fn get(&self) -> super::builder::machine_types::Get {
7064 super::builder::machine_types::Get::new(self.inner.clone())
7065 }
7066
7067 /// Retrieves a list of machine types available to the specified
7068 /// project.
7069 pub fn list(&self) -> super::builder::machine_types::List {
7070 super::builder::machine_types::List::new(self.inner.clone())
7071 }
7072}
7073
7074/// Implements a client for the Google Compute Engine API.
7075///
7076/// # Example
7077/// ```
7078/// # tokio_test::block_on(async {
7079/// # use google_cloud_compute_v1::client::NetworkAttachments;
7080/// let client = NetworkAttachments::builder().build().await?;
7081/// // use `client` to make requests to the Google Compute Engine API.
7082/// # gax::client_builder::Result::<()>::Ok(()) });
7083/// ```
7084///
7085/// # Service Description
7086///
7087/// Service for the `networkAttachments` resource.
7088///
7089/// # Configuration
7090///
7091/// To configure `NetworkAttachments` use the `with_*` methods in the type returned
7092/// by [builder()][NetworkAttachments::builder]. The default configuration should
7093/// work for most applications. Common configuration changes include
7094///
7095/// * [with_endpoint()]: by default this client uses the global default endpoint
7096/// (`https://compute.googleapis.com`). Applications using regional
7097/// endpoints or running in restricted networks (e.g. a network configured
7098// with [Private Google Access with VPC Service Controls]) may want to
7099/// override this default.
7100/// * [with_credentials()]: by default this client uses
7101/// [Application Default Credentials]. Applications using custom
7102/// authentication may need to override this default.
7103///
7104/// [with_endpoint()]: super::builder::network_attachments::ClientBuilder::with_endpoint
7105/// [with_credentials()]: super::builder::network_attachments::ClientBuilder::credentials
7106/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7107/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7108///
7109/// # Pooling and Cloning
7110///
7111/// `NetworkAttachments` holds a connection pool internally, it is advised to
7112/// create one and the reuse it. You do not need to wrap `NetworkAttachments` in
7113/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7114/// already uses an `Arc` internally.
7115#[cfg(feature = "network-attachments")]
7116#[cfg_attr(docsrs, doc(cfg(feature = "network-attachments")))]
7117#[derive(Clone, Debug)]
7118pub struct NetworkAttachments {
7119 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkAttachments>,
7120}
7121
7122#[cfg(feature = "network-attachments")]
7123impl NetworkAttachments {
7124 /// Returns a builder for [NetworkAttachments].
7125 ///
7126 /// ```
7127 /// # tokio_test::block_on(async {
7128 /// # use google_cloud_compute_v1::client::NetworkAttachments;
7129 /// let client = NetworkAttachments::builder().build().await?;
7130 /// # gax::client_builder::Result::<()>::Ok(()) });
7131 /// ```
7132 pub fn builder() -> super::builder::network_attachments::ClientBuilder {
7133 gax::client_builder::internal::new_builder(
7134 super::builder::network_attachments::client::Factory,
7135 )
7136 }
7137
7138 /// Creates a new client from the provided stub.
7139 ///
7140 /// The most common case for calling this function is in tests mocking the
7141 /// client's behavior.
7142 pub fn from_stub<T>(stub: T) -> Self
7143 where
7144 T: super::stub::NetworkAttachments + 'static,
7145 {
7146 Self {
7147 inner: std::sync::Arc::new(stub),
7148 }
7149 }
7150
7151 pub(crate) async fn new(
7152 config: gaxi::options::ClientConfig,
7153 ) -> gax::client_builder::Result<Self> {
7154 let inner = Self::build_inner(config).await?;
7155 Ok(Self { inner })
7156 }
7157
7158 async fn build_inner(
7159 conf: gaxi::options::ClientConfig,
7160 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NetworkAttachments>>
7161 {
7162 if gaxi::options::tracing_enabled(&conf) {
7163 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7164 }
7165 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7166 }
7167
7168 async fn build_transport(
7169 conf: gaxi::options::ClientConfig,
7170 ) -> gax::client_builder::Result<impl super::stub::NetworkAttachments> {
7171 super::transport::NetworkAttachments::new(conf).await
7172 }
7173
7174 async fn build_with_tracing(
7175 conf: gaxi::options::ClientConfig,
7176 ) -> gax::client_builder::Result<impl super::stub::NetworkAttachments> {
7177 Self::build_transport(conf)
7178 .await
7179 .map(super::tracing::NetworkAttachments::new)
7180 }
7181
7182 /// Retrieves the list of all NetworkAttachment resources,
7183 /// regional and global, available to the specified project.
7184 ///
7185 /// To prevent failure, Google recommends that you set the
7186 /// `returnPartialSuccess` parameter to `true`.
7187 pub fn aggregated_list(&self) -> super::builder::network_attachments::AggregatedList {
7188 super::builder::network_attachments::AggregatedList::new(self.inner.clone())
7189 }
7190
7191 /// Deletes the specified NetworkAttachment in the given scope
7192 pub fn delete(&self) -> super::builder::network_attachments::Delete {
7193 super::builder::network_attachments::Delete::new(self.inner.clone())
7194 }
7195
7196 /// Returns the specified NetworkAttachment resource in the given scope.
7197 pub fn get(&self) -> super::builder::network_attachments::Get {
7198 super::builder::network_attachments::Get::new(self.inner.clone())
7199 }
7200
7201 /// Gets the access control policy for a resource. May be empty if no such
7202 /// policy or resource exists.
7203 pub fn get_iam_policy(&self) -> super::builder::network_attachments::GetIamPolicy {
7204 super::builder::network_attachments::GetIamPolicy::new(self.inner.clone())
7205 }
7206
7207 /// Creates a NetworkAttachment in the specified project in the given scope
7208 /// using the parameters that are included in the request.
7209 pub fn insert(&self) -> super::builder::network_attachments::Insert {
7210 super::builder::network_attachments::Insert::new(self.inner.clone())
7211 }
7212
7213 /// Lists the NetworkAttachments for a project in the given scope.
7214 pub fn list(&self) -> super::builder::network_attachments::List {
7215 super::builder::network_attachments::List::new(self.inner.clone())
7216 }
7217
7218 /// Patches the specified NetworkAttachment resource with the data included in
7219 /// the request. This method supports PATCH
7220 /// semantics and usesJSON merge
7221 /// patch format and processing rules.
7222 pub fn patch(&self) -> super::builder::network_attachments::Patch {
7223 super::builder::network_attachments::Patch::new(self.inner.clone())
7224 }
7225
7226 /// Sets the access control policy on the specified resource.
7227 /// Replaces any existing policy.
7228 pub fn set_iam_policy(&self) -> super::builder::network_attachments::SetIamPolicy {
7229 super::builder::network_attachments::SetIamPolicy::new(self.inner.clone())
7230 }
7231
7232 /// Returns permissions that a caller has on the specified resource.
7233 pub fn test_iam_permissions(&self) -> super::builder::network_attachments::TestIamPermissions {
7234 super::builder::network_attachments::TestIamPermissions::new(self.inner.clone())
7235 }
7236
7237 /// Retrieves the specified region-specific Operations resource.
7238 pub fn get_operation(&self) -> super::builder::network_attachments::GetOperation {
7239 super::builder::network_attachments::GetOperation::new(self.inner.clone())
7240 }
7241}
7242
7243/// Implements a client for the Google Compute Engine API.
7244///
7245/// # Example
7246/// ```
7247/// # tokio_test::block_on(async {
7248/// # use google_cloud_compute_v1::client::NetworkEdgeSecurityServices;
7249/// let client = NetworkEdgeSecurityServices::builder().build().await?;
7250/// // use `client` to make requests to the Google Compute Engine API.
7251/// # gax::client_builder::Result::<()>::Ok(()) });
7252/// ```
7253///
7254/// # Service Description
7255///
7256/// Service for the `networkEdgeSecurityServices` resource.
7257///
7258/// # Configuration
7259///
7260/// To configure `NetworkEdgeSecurityServices` use the `with_*` methods in the type returned
7261/// by [builder()][NetworkEdgeSecurityServices::builder]. The default configuration should
7262/// work for most applications. Common configuration changes include
7263///
7264/// * [with_endpoint()]: by default this client uses the global default endpoint
7265/// (`https://compute.googleapis.com`). Applications using regional
7266/// endpoints or running in restricted networks (e.g. a network configured
7267// with [Private Google Access with VPC Service Controls]) may want to
7268/// override this default.
7269/// * [with_credentials()]: by default this client uses
7270/// [Application Default Credentials]. Applications using custom
7271/// authentication may need to override this default.
7272///
7273/// [with_endpoint()]: super::builder::network_edge_security_services::ClientBuilder::with_endpoint
7274/// [with_credentials()]: super::builder::network_edge_security_services::ClientBuilder::credentials
7275/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7276/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7277///
7278/// # Pooling and Cloning
7279///
7280/// `NetworkEdgeSecurityServices` holds a connection pool internally, it is advised to
7281/// create one and the reuse it. You do not need to wrap `NetworkEdgeSecurityServices` in
7282/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7283/// already uses an `Arc` internally.
7284#[cfg(feature = "network-edge-security-services")]
7285#[cfg_attr(docsrs, doc(cfg(feature = "network-edge-security-services")))]
7286#[derive(Clone, Debug)]
7287pub struct NetworkEdgeSecurityServices {
7288 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkEdgeSecurityServices>,
7289}
7290
7291#[cfg(feature = "network-edge-security-services")]
7292impl NetworkEdgeSecurityServices {
7293 /// Returns a builder for [NetworkEdgeSecurityServices].
7294 ///
7295 /// ```
7296 /// # tokio_test::block_on(async {
7297 /// # use google_cloud_compute_v1::client::NetworkEdgeSecurityServices;
7298 /// let client = NetworkEdgeSecurityServices::builder().build().await?;
7299 /// # gax::client_builder::Result::<()>::Ok(()) });
7300 /// ```
7301 pub fn builder() -> super::builder::network_edge_security_services::ClientBuilder {
7302 gax::client_builder::internal::new_builder(
7303 super::builder::network_edge_security_services::client::Factory,
7304 )
7305 }
7306
7307 /// Creates a new client from the provided stub.
7308 ///
7309 /// The most common case for calling this function is in tests mocking the
7310 /// client's behavior.
7311 pub fn from_stub<T>(stub: T) -> Self
7312 where
7313 T: super::stub::NetworkEdgeSecurityServices + 'static,
7314 {
7315 Self {
7316 inner: std::sync::Arc::new(stub),
7317 }
7318 }
7319
7320 pub(crate) async fn new(
7321 config: gaxi::options::ClientConfig,
7322 ) -> gax::client_builder::Result<Self> {
7323 let inner = Self::build_inner(config).await?;
7324 Ok(Self { inner })
7325 }
7326
7327 async fn build_inner(
7328 conf: gaxi::options::ClientConfig,
7329 ) -> gax::client_builder::Result<
7330 std::sync::Arc<dyn super::stub::dynamic::NetworkEdgeSecurityServices>,
7331 > {
7332 if gaxi::options::tracing_enabled(&conf) {
7333 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7334 }
7335 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7336 }
7337
7338 async fn build_transport(
7339 conf: gaxi::options::ClientConfig,
7340 ) -> gax::client_builder::Result<impl super::stub::NetworkEdgeSecurityServices> {
7341 super::transport::NetworkEdgeSecurityServices::new(conf).await
7342 }
7343
7344 async fn build_with_tracing(
7345 conf: gaxi::options::ClientConfig,
7346 ) -> gax::client_builder::Result<impl super::stub::NetworkEdgeSecurityServices> {
7347 Self::build_transport(conf)
7348 .await
7349 .map(super::tracing::NetworkEdgeSecurityServices::new)
7350 }
7351
7352 /// Retrieves the list of all NetworkEdgeSecurityService resources available to
7353 /// the specified project.
7354 ///
7355 /// To prevent failure, Google recommends that you set the
7356 /// `returnPartialSuccess` parameter to `true`.
7357 pub fn aggregated_list(
7358 &self,
7359 ) -> super::builder::network_edge_security_services::AggregatedList {
7360 super::builder::network_edge_security_services::AggregatedList::new(self.inner.clone())
7361 }
7362
7363 /// Deletes the specified service.
7364 pub fn delete(&self) -> super::builder::network_edge_security_services::Delete {
7365 super::builder::network_edge_security_services::Delete::new(self.inner.clone())
7366 }
7367
7368 /// Gets a specified NetworkEdgeSecurityService.
7369 pub fn get(&self) -> super::builder::network_edge_security_services::Get {
7370 super::builder::network_edge_security_services::Get::new(self.inner.clone())
7371 }
7372
7373 /// Creates a new service in the specified project using the data included in
7374 /// the request.
7375 pub fn insert(&self) -> super::builder::network_edge_security_services::Insert {
7376 super::builder::network_edge_security_services::Insert::new(self.inner.clone())
7377 }
7378
7379 /// Patches the specified policy with the data included in the request.
7380 pub fn patch(&self) -> super::builder::network_edge_security_services::Patch {
7381 super::builder::network_edge_security_services::Patch::new(self.inner.clone())
7382 }
7383
7384 /// Retrieves the specified region-specific Operations resource.
7385 pub fn get_operation(&self) -> super::builder::network_edge_security_services::GetOperation {
7386 super::builder::network_edge_security_services::GetOperation::new(self.inner.clone())
7387 }
7388}
7389
7390/// Implements a client for the Google Compute Engine API.
7391///
7392/// # Example
7393/// ```
7394/// # tokio_test::block_on(async {
7395/// # use google_cloud_compute_v1::client::NetworkEndpointGroups;
7396/// let client = NetworkEndpointGroups::builder().build().await?;
7397/// // use `client` to make requests to the Google Compute Engine API.
7398/// # gax::client_builder::Result::<()>::Ok(()) });
7399/// ```
7400///
7401/// # Service Description
7402///
7403/// Service for the `networkEndpointGroups` resource.
7404///
7405/// # Configuration
7406///
7407/// To configure `NetworkEndpointGroups` use the `with_*` methods in the type returned
7408/// by [builder()][NetworkEndpointGroups::builder]. The default configuration should
7409/// work for most applications. Common configuration changes include
7410///
7411/// * [with_endpoint()]: by default this client uses the global default endpoint
7412/// (`https://compute.googleapis.com`). Applications using regional
7413/// endpoints or running in restricted networks (e.g. a network configured
7414// with [Private Google Access with VPC Service Controls]) may want to
7415/// override this default.
7416/// * [with_credentials()]: by default this client uses
7417/// [Application Default Credentials]. Applications using custom
7418/// authentication may need to override this default.
7419///
7420/// [with_endpoint()]: super::builder::network_endpoint_groups::ClientBuilder::with_endpoint
7421/// [with_credentials()]: super::builder::network_endpoint_groups::ClientBuilder::credentials
7422/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7423/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7424///
7425/// # Pooling and Cloning
7426///
7427/// `NetworkEndpointGroups` holds a connection pool internally, it is advised to
7428/// create one and the reuse it. You do not need to wrap `NetworkEndpointGroups` in
7429/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7430/// already uses an `Arc` internally.
7431#[cfg(feature = "network-endpoint-groups")]
7432#[cfg_attr(docsrs, doc(cfg(feature = "network-endpoint-groups")))]
7433#[derive(Clone, Debug)]
7434pub struct NetworkEndpointGroups {
7435 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkEndpointGroups>,
7436}
7437
7438#[cfg(feature = "network-endpoint-groups")]
7439impl NetworkEndpointGroups {
7440 /// Returns a builder for [NetworkEndpointGroups].
7441 ///
7442 /// ```
7443 /// # tokio_test::block_on(async {
7444 /// # use google_cloud_compute_v1::client::NetworkEndpointGroups;
7445 /// let client = NetworkEndpointGroups::builder().build().await?;
7446 /// # gax::client_builder::Result::<()>::Ok(()) });
7447 /// ```
7448 pub fn builder() -> super::builder::network_endpoint_groups::ClientBuilder {
7449 gax::client_builder::internal::new_builder(
7450 super::builder::network_endpoint_groups::client::Factory,
7451 )
7452 }
7453
7454 /// Creates a new client from the provided stub.
7455 ///
7456 /// The most common case for calling this function is in tests mocking the
7457 /// client's behavior.
7458 pub fn from_stub<T>(stub: T) -> Self
7459 where
7460 T: super::stub::NetworkEndpointGroups + 'static,
7461 {
7462 Self {
7463 inner: std::sync::Arc::new(stub),
7464 }
7465 }
7466
7467 pub(crate) async fn new(
7468 config: gaxi::options::ClientConfig,
7469 ) -> gax::client_builder::Result<Self> {
7470 let inner = Self::build_inner(config).await?;
7471 Ok(Self { inner })
7472 }
7473
7474 async fn build_inner(
7475 conf: gaxi::options::ClientConfig,
7476 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NetworkEndpointGroups>>
7477 {
7478 if gaxi::options::tracing_enabled(&conf) {
7479 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7480 }
7481 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7482 }
7483
7484 async fn build_transport(
7485 conf: gaxi::options::ClientConfig,
7486 ) -> gax::client_builder::Result<impl super::stub::NetworkEndpointGroups> {
7487 super::transport::NetworkEndpointGroups::new(conf).await
7488 }
7489
7490 async fn build_with_tracing(
7491 conf: gaxi::options::ClientConfig,
7492 ) -> gax::client_builder::Result<impl super::stub::NetworkEndpointGroups> {
7493 Self::build_transport(conf)
7494 .await
7495 .map(super::tracing::NetworkEndpointGroups::new)
7496 }
7497
7498 /// Retrieves the list of network endpoint groups and sorts them by zone.
7499 ///
7500 /// To prevent failure, Google recommends that you set the
7501 /// `returnPartialSuccess` parameter to `true`.
7502 pub fn aggregated_list(&self) -> super::builder::network_endpoint_groups::AggregatedList {
7503 super::builder::network_endpoint_groups::AggregatedList::new(self.inner.clone())
7504 }
7505
7506 /// Attach a list of network endpoints to the specified network endpoint group.
7507 pub fn attach_network_endpoints(
7508 &self,
7509 ) -> super::builder::network_endpoint_groups::AttachNetworkEndpoints {
7510 super::builder::network_endpoint_groups::AttachNetworkEndpoints::new(self.inner.clone())
7511 }
7512
7513 /// Deletes the specified network endpoint group. The network endpoints in the
7514 /// NEG and the VM instances they belong to are not terminated when the NEG is
7515 /// deleted. Note that the NEG cannot be deleted if there are backend services
7516 /// referencing it.
7517 pub fn delete(&self) -> super::builder::network_endpoint_groups::Delete {
7518 super::builder::network_endpoint_groups::Delete::new(self.inner.clone())
7519 }
7520
7521 /// Detach a list of network endpoints from the specified network endpoint
7522 /// group.
7523 pub fn detach_network_endpoints(
7524 &self,
7525 ) -> super::builder::network_endpoint_groups::DetachNetworkEndpoints {
7526 super::builder::network_endpoint_groups::DetachNetworkEndpoints::new(self.inner.clone())
7527 }
7528
7529 /// Returns the specified network endpoint group.
7530 pub fn get(&self) -> super::builder::network_endpoint_groups::Get {
7531 super::builder::network_endpoint_groups::Get::new(self.inner.clone())
7532 }
7533
7534 /// Creates a network endpoint group in the specified project using the
7535 /// parameters that are included in the request.
7536 pub fn insert(&self) -> super::builder::network_endpoint_groups::Insert {
7537 super::builder::network_endpoint_groups::Insert::new(self.inner.clone())
7538 }
7539
7540 /// Retrieves the list of network endpoint groups that are located in the
7541 /// specified project and zone.
7542 pub fn list(&self) -> super::builder::network_endpoint_groups::List {
7543 super::builder::network_endpoint_groups::List::new(self.inner.clone())
7544 }
7545
7546 /// Lists the network endpoints in the specified network endpoint group.
7547 pub fn list_network_endpoints(
7548 &self,
7549 ) -> super::builder::network_endpoint_groups::ListNetworkEndpoints {
7550 super::builder::network_endpoint_groups::ListNetworkEndpoints::new(self.inner.clone())
7551 }
7552
7553 /// Returns permissions that a caller has on the specified resource.
7554 pub fn test_iam_permissions(
7555 &self,
7556 ) -> super::builder::network_endpoint_groups::TestIamPermissions {
7557 super::builder::network_endpoint_groups::TestIamPermissions::new(self.inner.clone())
7558 }
7559
7560 /// Retrieves the specified zone-specific Operations resource.
7561 pub fn get_operation(&self) -> super::builder::network_endpoint_groups::GetOperation {
7562 super::builder::network_endpoint_groups::GetOperation::new(self.inner.clone())
7563 }
7564}
7565
7566/// Implements a client for the Google Compute Engine API.
7567///
7568/// # Example
7569/// ```
7570/// # tokio_test::block_on(async {
7571/// # use google_cloud_compute_v1::client::NetworkFirewallPolicies;
7572/// let client = NetworkFirewallPolicies::builder().build().await?;
7573/// // use `client` to make requests to the Google Compute Engine API.
7574/// # gax::client_builder::Result::<()>::Ok(()) });
7575/// ```
7576///
7577/// # Service Description
7578///
7579/// Service for the `networkFirewallPolicies` resource.
7580///
7581/// # Configuration
7582///
7583/// To configure `NetworkFirewallPolicies` use the `with_*` methods in the type returned
7584/// by [builder()][NetworkFirewallPolicies::builder]. The default configuration should
7585/// work for most applications. Common configuration changes include
7586///
7587/// * [with_endpoint()]: by default this client uses the global default endpoint
7588/// (`https://compute.googleapis.com`). Applications using regional
7589/// endpoints or running in restricted networks (e.g. a network configured
7590// with [Private Google Access with VPC Service Controls]) may want to
7591/// override this default.
7592/// * [with_credentials()]: by default this client uses
7593/// [Application Default Credentials]. Applications using custom
7594/// authentication may need to override this default.
7595///
7596/// [with_endpoint()]: super::builder::network_firewall_policies::ClientBuilder::with_endpoint
7597/// [with_credentials()]: super::builder::network_firewall_policies::ClientBuilder::credentials
7598/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7599/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7600///
7601/// # Pooling and Cloning
7602///
7603/// `NetworkFirewallPolicies` holds a connection pool internally, it is advised to
7604/// create one and the reuse it. You do not need to wrap `NetworkFirewallPolicies` in
7605/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7606/// already uses an `Arc` internally.
7607#[cfg(feature = "network-firewall-policies")]
7608#[cfg_attr(docsrs, doc(cfg(feature = "network-firewall-policies")))]
7609#[derive(Clone, Debug)]
7610pub struct NetworkFirewallPolicies {
7611 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkFirewallPolicies>,
7612}
7613
7614#[cfg(feature = "network-firewall-policies")]
7615impl NetworkFirewallPolicies {
7616 /// Returns a builder for [NetworkFirewallPolicies].
7617 ///
7618 /// ```
7619 /// # tokio_test::block_on(async {
7620 /// # use google_cloud_compute_v1::client::NetworkFirewallPolicies;
7621 /// let client = NetworkFirewallPolicies::builder().build().await?;
7622 /// # gax::client_builder::Result::<()>::Ok(()) });
7623 /// ```
7624 pub fn builder() -> super::builder::network_firewall_policies::ClientBuilder {
7625 gax::client_builder::internal::new_builder(
7626 super::builder::network_firewall_policies::client::Factory,
7627 )
7628 }
7629
7630 /// Creates a new client from the provided stub.
7631 ///
7632 /// The most common case for calling this function is in tests mocking the
7633 /// client's behavior.
7634 pub fn from_stub<T>(stub: T) -> Self
7635 where
7636 T: super::stub::NetworkFirewallPolicies + 'static,
7637 {
7638 Self {
7639 inner: std::sync::Arc::new(stub),
7640 }
7641 }
7642
7643 pub(crate) async fn new(
7644 config: gaxi::options::ClientConfig,
7645 ) -> gax::client_builder::Result<Self> {
7646 let inner = Self::build_inner(config).await?;
7647 Ok(Self { inner })
7648 }
7649
7650 async fn build_inner(
7651 conf: gaxi::options::ClientConfig,
7652 ) -> gax::client_builder::Result<
7653 std::sync::Arc<dyn super::stub::dynamic::NetworkFirewallPolicies>,
7654 > {
7655 if gaxi::options::tracing_enabled(&conf) {
7656 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7657 }
7658 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7659 }
7660
7661 async fn build_transport(
7662 conf: gaxi::options::ClientConfig,
7663 ) -> gax::client_builder::Result<impl super::stub::NetworkFirewallPolicies> {
7664 super::transport::NetworkFirewallPolicies::new(conf).await
7665 }
7666
7667 async fn build_with_tracing(
7668 conf: gaxi::options::ClientConfig,
7669 ) -> gax::client_builder::Result<impl super::stub::NetworkFirewallPolicies> {
7670 Self::build_transport(conf)
7671 .await
7672 .map(super::tracing::NetworkFirewallPolicies::new)
7673 }
7674
7675 /// Inserts an association for the specified firewall policy.
7676 pub fn add_association(&self) -> super::builder::network_firewall_policies::AddAssociation {
7677 super::builder::network_firewall_policies::AddAssociation::new(self.inner.clone())
7678 }
7679
7680 /// Inserts a packet mirroring rule into a firewall policy.
7681 pub fn add_packet_mirroring_rule(
7682 &self,
7683 ) -> super::builder::network_firewall_policies::AddPacketMirroringRule {
7684 super::builder::network_firewall_policies::AddPacketMirroringRule::new(self.inner.clone())
7685 }
7686
7687 /// Inserts a rule into a firewall policy.
7688 pub fn add_rule(&self) -> super::builder::network_firewall_policies::AddRule {
7689 super::builder::network_firewall_policies::AddRule::new(self.inner.clone())
7690 }
7691
7692 /// Retrieves an aggregated list of network firewall policies, listing network
7693 /// firewall policies from all applicable scopes (global and regional) and
7694 /// grouping the results per scope.
7695 ///
7696 /// To prevent failure, Google recommends that you set the
7697 /// `returnPartialSuccess` parameter to `true`.
7698 pub fn aggregated_list(&self) -> super::builder::network_firewall_policies::AggregatedList {
7699 super::builder::network_firewall_policies::AggregatedList::new(self.inner.clone())
7700 }
7701
7702 /// Copies rules to the specified firewall policy.
7703 pub fn clone_rules(&self) -> super::builder::network_firewall_policies::CloneRules {
7704 super::builder::network_firewall_policies::CloneRules::new(self.inner.clone())
7705 }
7706
7707 /// Deletes the specified policy.
7708 pub fn delete(&self) -> super::builder::network_firewall_policies::Delete {
7709 super::builder::network_firewall_policies::Delete::new(self.inner.clone())
7710 }
7711
7712 /// Returns the specified network firewall policy.
7713 pub fn get(&self) -> super::builder::network_firewall_policies::Get {
7714 super::builder::network_firewall_policies::Get::new(self.inner.clone())
7715 }
7716
7717 /// Gets an association with the specified name.
7718 pub fn get_association(&self) -> super::builder::network_firewall_policies::GetAssociation {
7719 super::builder::network_firewall_policies::GetAssociation::new(self.inner.clone())
7720 }
7721
7722 /// Gets the access control policy for a resource. May be empty if no such
7723 /// policy or resource exists.
7724 pub fn get_iam_policy(&self) -> super::builder::network_firewall_policies::GetIamPolicy {
7725 super::builder::network_firewall_policies::GetIamPolicy::new(self.inner.clone())
7726 }
7727
7728 /// Gets a packet mirroring rule of the specified priority.
7729 pub fn get_packet_mirroring_rule(
7730 &self,
7731 ) -> super::builder::network_firewall_policies::GetPacketMirroringRule {
7732 super::builder::network_firewall_policies::GetPacketMirroringRule::new(self.inner.clone())
7733 }
7734
7735 /// Gets a rule of the specified priority.
7736 pub fn get_rule(&self) -> super::builder::network_firewall_policies::GetRule {
7737 super::builder::network_firewall_policies::GetRule::new(self.inner.clone())
7738 }
7739
7740 /// Creates a new policy in the specified project using the data included in
7741 /// the request.
7742 pub fn insert(&self) -> super::builder::network_firewall_policies::Insert {
7743 super::builder::network_firewall_policies::Insert::new(self.inner.clone())
7744 }
7745
7746 /// Lists all the policies that have been configured for the specified project.
7747 pub fn list(&self) -> super::builder::network_firewall_policies::List {
7748 super::builder::network_firewall_policies::List::new(self.inner.clone())
7749 }
7750
7751 /// Patches the specified policy with the data included in the request.
7752 pub fn patch(&self) -> super::builder::network_firewall_policies::Patch {
7753 super::builder::network_firewall_policies::Patch::new(self.inner.clone())
7754 }
7755
7756 /// Patches a packet mirroring rule of the specified priority.
7757 pub fn patch_packet_mirroring_rule(
7758 &self,
7759 ) -> super::builder::network_firewall_policies::PatchPacketMirroringRule {
7760 super::builder::network_firewall_policies::PatchPacketMirroringRule::new(self.inner.clone())
7761 }
7762
7763 /// Patches a rule of the specified priority.
7764 pub fn patch_rule(&self) -> super::builder::network_firewall_policies::PatchRule {
7765 super::builder::network_firewall_policies::PatchRule::new(self.inner.clone())
7766 }
7767
7768 /// Removes an association for the specified firewall policy.
7769 pub fn remove_association(
7770 &self,
7771 ) -> super::builder::network_firewall_policies::RemoveAssociation {
7772 super::builder::network_firewall_policies::RemoveAssociation::new(self.inner.clone())
7773 }
7774
7775 /// Deletes a packet mirroring rule of the specified priority.
7776 pub fn remove_packet_mirroring_rule(
7777 &self,
7778 ) -> super::builder::network_firewall_policies::RemovePacketMirroringRule {
7779 super::builder::network_firewall_policies::RemovePacketMirroringRule::new(
7780 self.inner.clone(),
7781 )
7782 }
7783
7784 /// Deletes a rule of the specified priority.
7785 pub fn remove_rule(&self) -> super::builder::network_firewall_policies::RemoveRule {
7786 super::builder::network_firewall_policies::RemoveRule::new(self.inner.clone())
7787 }
7788
7789 /// Sets the access control policy on the specified resource.
7790 /// Replaces any existing policy.
7791 pub fn set_iam_policy(&self) -> super::builder::network_firewall_policies::SetIamPolicy {
7792 super::builder::network_firewall_policies::SetIamPolicy::new(self.inner.clone())
7793 }
7794
7795 /// Returns permissions that a caller has on the specified resource.
7796 pub fn test_iam_permissions(
7797 &self,
7798 ) -> super::builder::network_firewall_policies::TestIamPermissions {
7799 super::builder::network_firewall_policies::TestIamPermissions::new(self.inner.clone())
7800 }
7801
7802 /// Retrieves the specified Operations resource.
7803 pub fn get_operation(&self) -> super::builder::network_firewall_policies::GetOperation {
7804 super::builder::network_firewall_policies::GetOperation::new(self.inner.clone())
7805 }
7806}
7807
7808/// Implements a client for the Google Compute Engine API.
7809///
7810/// # Example
7811/// ```
7812/// # tokio_test::block_on(async {
7813/// # use google_cloud_compute_v1::client::NetworkProfiles;
7814/// let client = NetworkProfiles::builder().build().await?;
7815/// // use `client` to make requests to the Google Compute Engine API.
7816/// # gax::client_builder::Result::<()>::Ok(()) });
7817/// ```
7818///
7819/// # Service Description
7820///
7821/// Service for the `networkProfiles` resource.
7822///
7823/// # Configuration
7824///
7825/// To configure `NetworkProfiles` use the `with_*` methods in the type returned
7826/// by [builder()][NetworkProfiles::builder]. The default configuration should
7827/// work for most applications. Common configuration changes include
7828///
7829/// * [with_endpoint()]: by default this client uses the global default endpoint
7830/// (`https://compute.googleapis.com`). Applications using regional
7831/// endpoints or running in restricted networks (e.g. a network configured
7832// with [Private Google Access with VPC Service Controls]) may want to
7833/// override this default.
7834/// * [with_credentials()]: by default this client uses
7835/// [Application Default Credentials]. Applications using custom
7836/// authentication may need to override this default.
7837///
7838/// [with_endpoint()]: super::builder::network_profiles::ClientBuilder::with_endpoint
7839/// [with_credentials()]: super::builder::network_profiles::ClientBuilder::credentials
7840/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7841/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7842///
7843/// # Pooling and Cloning
7844///
7845/// `NetworkProfiles` holds a connection pool internally, it is advised to
7846/// create one and the reuse it. You do not need to wrap `NetworkProfiles` in
7847/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7848/// already uses an `Arc` internally.
7849#[cfg(feature = "network-profiles")]
7850#[cfg_attr(docsrs, doc(cfg(feature = "network-profiles")))]
7851#[derive(Clone, Debug)]
7852pub struct NetworkProfiles {
7853 inner: std::sync::Arc<dyn super::stub::dynamic::NetworkProfiles>,
7854}
7855
7856#[cfg(feature = "network-profiles")]
7857impl NetworkProfiles {
7858 /// Returns a builder for [NetworkProfiles].
7859 ///
7860 /// ```
7861 /// # tokio_test::block_on(async {
7862 /// # use google_cloud_compute_v1::client::NetworkProfiles;
7863 /// let client = NetworkProfiles::builder().build().await?;
7864 /// # gax::client_builder::Result::<()>::Ok(()) });
7865 /// ```
7866 pub fn builder() -> super::builder::network_profiles::ClientBuilder {
7867 gax::client_builder::internal::new_builder(
7868 super::builder::network_profiles::client::Factory,
7869 )
7870 }
7871
7872 /// Creates a new client from the provided stub.
7873 ///
7874 /// The most common case for calling this function is in tests mocking the
7875 /// client's behavior.
7876 pub fn from_stub<T>(stub: T) -> Self
7877 where
7878 T: super::stub::NetworkProfiles + 'static,
7879 {
7880 Self {
7881 inner: std::sync::Arc::new(stub),
7882 }
7883 }
7884
7885 pub(crate) async fn new(
7886 config: gaxi::options::ClientConfig,
7887 ) -> gax::client_builder::Result<Self> {
7888 let inner = Self::build_inner(config).await?;
7889 Ok(Self { inner })
7890 }
7891
7892 async fn build_inner(
7893 conf: gaxi::options::ClientConfig,
7894 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NetworkProfiles>>
7895 {
7896 if gaxi::options::tracing_enabled(&conf) {
7897 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
7898 }
7899 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
7900 }
7901
7902 async fn build_transport(
7903 conf: gaxi::options::ClientConfig,
7904 ) -> gax::client_builder::Result<impl super::stub::NetworkProfiles> {
7905 super::transport::NetworkProfiles::new(conf).await
7906 }
7907
7908 async fn build_with_tracing(
7909 conf: gaxi::options::ClientConfig,
7910 ) -> gax::client_builder::Result<impl super::stub::NetworkProfiles> {
7911 Self::build_transport(conf)
7912 .await
7913 .map(super::tracing::NetworkProfiles::new)
7914 }
7915
7916 /// Returns the specified network profile.
7917 pub fn get(&self) -> super::builder::network_profiles::Get {
7918 super::builder::network_profiles::Get::new(self.inner.clone())
7919 }
7920
7921 /// Retrieves a list of network profiles available to the specified
7922 /// project.
7923 pub fn list(&self) -> super::builder::network_profiles::List {
7924 super::builder::network_profiles::List::new(self.inner.clone())
7925 }
7926}
7927
7928/// Implements a client for the Google Compute Engine API.
7929///
7930/// # Example
7931/// ```
7932/// # tokio_test::block_on(async {
7933/// # use google_cloud_compute_v1::client::Networks;
7934/// let client = Networks::builder().build().await?;
7935/// // use `client` to make requests to the Google Compute Engine API.
7936/// # gax::client_builder::Result::<()>::Ok(()) });
7937/// ```
7938///
7939/// # Service Description
7940///
7941/// Service for the `networks` resource.
7942///
7943/// # Configuration
7944///
7945/// To configure `Networks` use the `with_*` methods in the type returned
7946/// by [builder()][Networks::builder]. The default configuration should
7947/// work for most applications. Common configuration changes include
7948///
7949/// * [with_endpoint()]: by default this client uses the global default endpoint
7950/// (`https://compute.googleapis.com`). Applications using regional
7951/// endpoints or running in restricted networks (e.g. a network configured
7952// with [Private Google Access with VPC Service Controls]) may want to
7953/// override this default.
7954/// * [with_credentials()]: by default this client uses
7955/// [Application Default Credentials]. Applications using custom
7956/// authentication may need to override this default.
7957///
7958/// [with_endpoint()]: super::builder::networks::ClientBuilder::with_endpoint
7959/// [with_credentials()]: super::builder::networks::ClientBuilder::credentials
7960/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
7961/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
7962///
7963/// # Pooling and Cloning
7964///
7965/// `Networks` holds a connection pool internally, it is advised to
7966/// create one and the reuse it. You do not need to wrap `Networks` in
7967/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
7968/// already uses an `Arc` internally.
7969#[cfg(feature = "networks")]
7970#[cfg_attr(docsrs, doc(cfg(feature = "networks")))]
7971#[derive(Clone, Debug)]
7972pub struct Networks {
7973 inner: std::sync::Arc<dyn super::stub::dynamic::Networks>,
7974}
7975
7976#[cfg(feature = "networks")]
7977impl Networks {
7978 /// Returns a builder for [Networks].
7979 ///
7980 /// ```
7981 /// # tokio_test::block_on(async {
7982 /// # use google_cloud_compute_v1::client::Networks;
7983 /// let client = Networks::builder().build().await?;
7984 /// # gax::client_builder::Result::<()>::Ok(()) });
7985 /// ```
7986 pub fn builder() -> super::builder::networks::ClientBuilder {
7987 gax::client_builder::internal::new_builder(super::builder::networks::client::Factory)
7988 }
7989
7990 /// Creates a new client from the provided stub.
7991 ///
7992 /// The most common case for calling this function is in tests mocking the
7993 /// client's behavior.
7994 pub fn from_stub<T>(stub: T) -> Self
7995 where
7996 T: super::stub::Networks + 'static,
7997 {
7998 Self {
7999 inner: std::sync::Arc::new(stub),
8000 }
8001 }
8002
8003 pub(crate) async fn new(
8004 config: gaxi::options::ClientConfig,
8005 ) -> gax::client_builder::Result<Self> {
8006 let inner = Self::build_inner(config).await?;
8007 Ok(Self { inner })
8008 }
8009
8010 async fn build_inner(
8011 conf: gaxi::options::ClientConfig,
8012 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Networks>> {
8013 if gaxi::options::tracing_enabled(&conf) {
8014 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8015 }
8016 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8017 }
8018
8019 async fn build_transport(
8020 conf: gaxi::options::ClientConfig,
8021 ) -> gax::client_builder::Result<impl super::stub::Networks> {
8022 super::transport::Networks::new(conf).await
8023 }
8024
8025 async fn build_with_tracing(
8026 conf: gaxi::options::ClientConfig,
8027 ) -> gax::client_builder::Result<impl super::stub::Networks> {
8028 Self::build_transport(conf)
8029 .await
8030 .map(super::tracing::Networks::new)
8031 }
8032
8033 /// Adds a peering to the specified network.
8034 pub fn add_peering(&self) -> super::builder::networks::AddPeering {
8035 super::builder::networks::AddPeering::new(self.inner.clone())
8036 }
8037
8038 /// Deletes the specified network.
8039 pub fn delete(&self) -> super::builder::networks::Delete {
8040 super::builder::networks::Delete::new(self.inner.clone())
8041 }
8042
8043 /// Returns the specified network.
8044 pub fn get(&self) -> super::builder::networks::Get {
8045 super::builder::networks::Get::new(self.inner.clone())
8046 }
8047
8048 /// Returns the effective firewalls on a given network.
8049 pub fn get_effective_firewalls(&self) -> super::builder::networks::GetEffectiveFirewalls {
8050 super::builder::networks::GetEffectiveFirewalls::new(self.inner.clone())
8051 }
8052
8053 /// Creates a network in the specified project using the data included
8054 /// in the request.
8055 pub fn insert(&self) -> super::builder::networks::Insert {
8056 super::builder::networks::Insert::new(self.inner.clone())
8057 }
8058
8059 /// Retrieves the list of networks available to the specified project.
8060 pub fn list(&self) -> super::builder::networks::List {
8061 super::builder::networks::List::new(self.inner.clone())
8062 }
8063
8064 /// Lists the peering routes exchanged over peering connection.
8065 pub fn list_peering_routes(&self) -> super::builder::networks::ListPeeringRoutes {
8066 super::builder::networks::ListPeeringRoutes::new(self.inner.clone())
8067 }
8068
8069 /// Patches the specified network with the data included in the request.
8070 /// Only routingConfig can be modified.
8071 pub fn patch(&self) -> super::builder::networks::Patch {
8072 super::builder::networks::Patch::new(self.inner.clone())
8073 }
8074
8075 /// Removes a peering from the specified network.
8076 pub fn remove_peering(&self) -> super::builder::networks::RemovePeering {
8077 super::builder::networks::RemovePeering::new(self.inner.clone())
8078 }
8079
8080 /// Requests to remove a peering from the specified network. Applicable only
8081 /// for PeeringConnection with update_strategy=CONSENSUS.
8082 pub fn request_remove_peering(&self) -> super::builder::networks::RequestRemovePeering {
8083 super::builder::networks::RequestRemovePeering::new(self.inner.clone())
8084 }
8085
8086 /// Switches the network mode from auto subnet mode to custom subnet mode.
8087 pub fn switch_to_custom_mode(&self) -> super::builder::networks::SwitchToCustomMode {
8088 super::builder::networks::SwitchToCustomMode::new(self.inner.clone())
8089 }
8090
8091 /// Updates the specified network peering with the data included in the
8092 /// request. You can only modify the NetworkPeering.export_custom_routes field
8093 /// and the NetworkPeering.import_custom_routes field.
8094 pub fn update_peering(&self) -> super::builder::networks::UpdatePeering {
8095 super::builder::networks::UpdatePeering::new(self.inner.clone())
8096 }
8097
8098 /// Retrieves the specified Operations resource.
8099 pub fn get_operation(&self) -> super::builder::networks::GetOperation {
8100 super::builder::networks::GetOperation::new(self.inner.clone())
8101 }
8102}
8103
8104/// Implements a client for the Google Compute Engine API.
8105///
8106/// # Example
8107/// ```
8108/// # tokio_test::block_on(async {
8109/// # use google_cloud_compute_v1::client::NodeGroups;
8110/// let client = NodeGroups::builder().build().await?;
8111/// // use `client` to make requests to the Google Compute Engine API.
8112/// # gax::client_builder::Result::<()>::Ok(()) });
8113/// ```
8114///
8115/// # Service Description
8116///
8117/// Service for the `nodeGroups` resource.
8118///
8119/// # Configuration
8120///
8121/// To configure `NodeGroups` use the `with_*` methods in the type returned
8122/// by [builder()][NodeGroups::builder]. The default configuration should
8123/// work for most applications. Common configuration changes include
8124///
8125/// * [with_endpoint()]: by default this client uses the global default endpoint
8126/// (`https://compute.googleapis.com`). Applications using regional
8127/// endpoints or running in restricted networks (e.g. a network configured
8128// with [Private Google Access with VPC Service Controls]) may want to
8129/// override this default.
8130/// * [with_credentials()]: by default this client uses
8131/// [Application Default Credentials]. Applications using custom
8132/// authentication may need to override this default.
8133///
8134/// [with_endpoint()]: super::builder::node_groups::ClientBuilder::with_endpoint
8135/// [with_credentials()]: super::builder::node_groups::ClientBuilder::credentials
8136/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8137/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8138///
8139/// # Pooling and Cloning
8140///
8141/// `NodeGroups` holds a connection pool internally, it is advised to
8142/// create one and the reuse it. You do not need to wrap `NodeGroups` in
8143/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8144/// already uses an `Arc` internally.
8145#[cfg(feature = "node-groups")]
8146#[cfg_attr(docsrs, doc(cfg(feature = "node-groups")))]
8147#[derive(Clone, Debug)]
8148pub struct NodeGroups {
8149 inner: std::sync::Arc<dyn super::stub::dynamic::NodeGroups>,
8150}
8151
8152#[cfg(feature = "node-groups")]
8153impl NodeGroups {
8154 /// Returns a builder for [NodeGroups].
8155 ///
8156 /// ```
8157 /// # tokio_test::block_on(async {
8158 /// # use google_cloud_compute_v1::client::NodeGroups;
8159 /// let client = NodeGroups::builder().build().await?;
8160 /// # gax::client_builder::Result::<()>::Ok(()) });
8161 /// ```
8162 pub fn builder() -> super::builder::node_groups::ClientBuilder {
8163 gax::client_builder::internal::new_builder(super::builder::node_groups::client::Factory)
8164 }
8165
8166 /// Creates a new client from the provided stub.
8167 ///
8168 /// The most common case for calling this function is in tests mocking the
8169 /// client's behavior.
8170 pub fn from_stub<T>(stub: T) -> Self
8171 where
8172 T: super::stub::NodeGroups + 'static,
8173 {
8174 Self {
8175 inner: std::sync::Arc::new(stub),
8176 }
8177 }
8178
8179 pub(crate) async fn new(
8180 config: gaxi::options::ClientConfig,
8181 ) -> gax::client_builder::Result<Self> {
8182 let inner = Self::build_inner(config).await?;
8183 Ok(Self { inner })
8184 }
8185
8186 async fn build_inner(
8187 conf: gaxi::options::ClientConfig,
8188 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NodeGroups>> {
8189 if gaxi::options::tracing_enabled(&conf) {
8190 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8191 }
8192 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8193 }
8194
8195 async fn build_transport(
8196 conf: gaxi::options::ClientConfig,
8197 ) -> gax::client_builder::Result<impl super::stub::NodeGroups> {
8198 super::transport::NodeGroups::new(conf).await
8199 }
8200
8201 async fn build_with_tracing(
8202 conf: gaxi::options::ClientConfig,
8203 ) -> gax::client_builder::Result<impl super::stub::NodeGroups> {
8204 Self::build_transport(conf)
8205 .await
8206 .map(super::tracing::NodeGroups::new)
8207 }
8208
8209 /// Adds specified number of nodes to the node group.
8210 pub fn add_nodes(&self) -> super::builder::node_groups::AddNodes {
8211 super::builder::node_groups::AddNodes::new(self.inner.clone())
8212 }
8213
8214 /// Retrieves an aggregated list of node groups.
8215 /// Note: use nodeGroups.listNodes for more details about each group.
8216 ///
8217 /// To prevent failure, Google recommends that you set the
8218 /// `returnPartialSuccess` parameter to `true`.
8219 pub fn aggregated_list(&self) -> super::builder::node_groups::AggregatedList {
8220 super::builder::node_groups::AggregatedList::new(self.inner.clone())
8221 }
8222
8223 /// Deletes the specified NodeGroup resource.
8224 pub fn delete(&self) -> super::builder::node_groups::Delete {
8225 super::builder::node_groups::Delete::new(self.inner.clone())
8226 }
8227
8228 /// Deletes specified nodes from the node group.
8229 pub fn delete_nodes(&self) -> super::builder::node_groups::DeleteNodes {
8230 super::builder::node_groups::DeleteNodes::new(self.inner.clone())
8231 }
8232
8233 /// Returns the specified NodeGroup. Get a list of available NodeGroups
8234 /// by making a list() request.
8235 /// Note: the "nodes" field should not be used. Use nodeGroups.listNodes
8236 /// instead.
8237 pub fn get(&self) -> super::builder::node_groups::Get {
8238 super::builder::node_groups::Get::new(self.inner.clone())
8239 }
8240
8241 /// Gets the access control policy for a resource. May be empty if no such
8242 /// policy or resource exists.
8243 pub fn get_iam_policy(&self) -> super::builder::node_groups::GetIamPolicy {
8244 super::builder::node_groups::GetIamPolicy::new(self.inner.clone())
8245 }
8246
8247 /// Creates a NodeGroup resource in the specified project using the data
8248 /// included in the request.
8249 pub fn insert(&self) -> super::builder::node_groups::Insert {
8250 super::builder::node_groups::Insert::new(self.inner.clone())
8251 }
8252
8253 /// Retrieves a list of node groups available to the specified project.
8254 /// Note: use nodeGroups.listNodes for more details about each group.
8255 pub fn list(&self) -> super::builder::node_groups::List {
8256 super::builder::node_groups::List::new(self.inner.clone())
8257 }
8258
8259 /// Lists nodes in the node group.
8260 pub fn list_nodes(&self) -> super::builder::node_groups::ListNodes {
8261 super::builder::node_groups::ListNodes::new(self.inner.clone())
8262 }
8263
8264 /// Updates the specified node group.
8265 pub fn patch(&self) -> super::builder::node_groups::Patch {
8266 super::builder::node_groups::Patch::new(self.inner.clone())
8267 }
8268
8269 /// Perform maintenance on a subset of nodes in the node group.
8270 pub fn perform_maintenance(&self) -> super::builder::node_groups::PerformMaintenance {
8271 super::builder::node_groups::PerformMaintenance::new(self.inner.clone())
8272 }
8273
8274 /// Sets the access control policy on the specified resource.
8275 /// Replaces any existing policy.
8276 pub fn set_iam_policy(&self) -> super::builder::node_groups::SetIamPolicy {
8277 super::builder::node_groups::SetIamPolicy::new(self.inner.clone())
8278 }
8279
8280 /// Updates the node template of the node group.
8281 pub fn set_node_template(&self) -> super::builder::node_groups::SetNodeTemplate {
8282 super::builder::node_groups::SetNodeTemplate::new(self.inner.clone())
8283 }
8284
8285 /// Simulates maintenance event on specified nodes from the node group.
8286 pub fn simulate_maintenance_event(
8287 &self,
8288 ) -> super::builder::node_groups::SimulateMaintenanceEvent {
8289 super::builder::node_groups::SimulateMaintenanceEvent::new(self.inner.clone())
8290 }
8291
8292 /// Returns permissions that a caller has on the specified resource.
8293 pub fn test_iam_permissions(&self) -> super::builder::node_groups::TestIamPermissions {
8294 super::builder::node_groups::TestIamPermissions::new(self.inner.clone())
8295 }
8296
8297 /// Retrieves the specified zone-specific Operations resource.
8298 pub fn get_operation(&self) -> super::builder::node_groups::GetOperation {
8299 super::builder::node_groups::GetOperation::new(self.inner.clone())
8300 }
8301}
8302
8303/// Implements a client for the Google Compute Engine API.
8304///
8305/// # Example
8306/// ```
8307/// # tokio_test::block_on(async {
8308/// # use google_cloud_compute_v1::client::NodeTemplates;
8309/// let client = NodeTemplates::builder().build().await?;
8310/// // use `client` to make requests to the Google Compute Engine API.
8311/// # gax::client_builder::Result::<()>::Ok(()) });
8312/// ```
8313///
8314/// # Service Description
8315///
8316/// Service for the `nodeTemplates` resource.
8317///
8318/// # Configuration
8319///
8320/// To configure `NodeTemplates` use the `with_*` methods in the type returned
8321/// by [builder()][NodeTemplates::builder]. The default configuration should
8322/// work for most applications. Common configuration changes include
8323///
8324/// * [with_endpoint()]: by default this client uses the global default endpoint
8325/// (`https://compute.googleapis.com`). Applications using regional
8326/// endpoints or running in restricted networks (e.g. a network configured
8327// with [Private Google Access with VPC Service Controls]) may want to
8328/// override this default.
8329/// * [with_credentials()]: by default this client uses
8330/// [Application Default Credentials]. Applications using custom
8331/// authentication may need to override this default.
8332///
8333/// [with_endpoint()]: super::builder::node_templates::ClientBuilder::with_endpoint
8334/// [with_credentials()]: super::builder::node_templates::ClientBuilder::credentials
8335/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8336/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8337///
8338/// # Pooling and Cloning
8339///
8340/// `NodeTemplates` holds a connection pool internally, it is advised to
8341/// create one and the reuse it. You do not need to wrap `NodeTemplates` in
8342/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8343/// already uses an `Arc` internally.
8344#[cfg(feature = "node-templates")]
8345#[cfg_attr(docsrs, doc(cfg(feature = "node-templates")))]
8346#[derive(Clone, Debug)]
8347pub struct NodeTemplates {
8348 inner: std::sync::Arc<dyn super::stub::dynamic::NodeTemplates>,
8349}
8350
8351#[cfg(feature = "node-templates")]
8352impl NodeTemplates {
8353 /// Returns a builder for [NodeTemplates].
8354 ///
8355 /// ```
8356 /// # tokio_test::block_on(async {
8357 /// # use google_cloud_compute_v1::client::NodeTemplates;
8358 /// let client = NodeTemplates::builder().build().await?;
8359 /// # gax::client_builder::Result::<()>::Ok(()) });
8360 /// ```
8361 pub fn builder() -> super::builder::node_templates::ClientBuilder {
8362 gax::client_builder::internal::new_builder(super::builder::node_templates::client::Factory)
8363 }
8364
8365 /// Creates a new client from the provided stub.
8366 ///
8367 /// The most common case for calling this function is in tests mocking the
8368 /// client's behavior.
8369 pub fn from_stub<T>(stub: T) -> Self
8370 where
8371 T: super::stub::NodeTemplates + 'static,
8372 {
8373 Self {
8374 inner: std::sync::Arc::new(stub),
8375 }
8376 }
8377
8378 pub(crate) async fn new(
8379 config: gaxi::options::ClientConfig,
8380 ) -> gax::client_builder::Result<Self> {
8381 let inner = Self::build_inner(config).await?;
8382 Ok(Self { inner })
8383 }
8384
8385 async fn build_inner(
8386 conf: gaxi::options::ClientConfig,
8387 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NodeTemplates>> {
8388 if gaxi::options::tracing_enabled(&conf) {
8389 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8390 }
8391 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8392 }
8393
8394 async fn build_transport(
8395 conf: gaxi::options::ClientConfig,
8396 ) -> gax::client_builder::Result<impl super::stub::NodeTemplates> {
8397 super::transport::NodeTemplates::new(conf).await
8398 }
8399
8400 async fn build_with_tracing(
8401 conf: gaxi::options::ClientConfig,
8402 ) -> gax::client_builder::Result<impl super::stub::NodeTemplates> {
8403 Self::build_transport(conf)
8404 .await
8405 .map(super::tracing::NodeTemplates::new)
8406 }
8407
8408 /// Retrieves an aggregated list of node templates.
8409 ///
8410 /// To prevent failure, Google recommends that you set the
8411 /// `returnPartialSuccess` parameter to `true`.
8412 pub fn aggregated_list(&self) -> super::builder::node_templates::AggregatedList {
8413 super::builder::node_templates::AggregatedList::new(self.inner.clone())
8414 }
8415
8416 /// Deletes the specified NodeTemplate resource.
8417 pub fn delete(&self) -> super::builder::node_templates::Delete {
8418 super::builder::node_templates::Delete::new(self.inner.clone())
8419 }
8420
8421 /// Returns the specified node template.
8422 pub fn get(&self) -> super::builder::node_templates::Get {
8423 super::builder::node_templates::Get::new(self.inner.clone())
8424 }
8425
8426 /// Gets the access control policy for a resource. May be empty if no such
8427 /// policy or resource exists.
8428 pub fn get_iam_policy(&self) -> super::builder::node_templates::GetIamPolicy {
8429 super::builder::node_templates::GetIamPolicy::new(self.inner.clone())
8430 }
8431
8432 /// Creates a NodeTemplate resource in the specified project using the data
8433 /// included in the request.
8434 pub fn insert(&self) -> super::builder::node_templates::Insert {
8435 super::builder::node_templates::Insert::new(self.inner.clone())
8436 }
8437
8438 /// Retrieves a list of node templates available to the specified
8439 /// project.
8440 pub fn list(&self) -> super::builder::node_templates::List {
8441 super::builder::node_templates::List::new(self.inner.clone())
8442 }
8443
8444 /// Sets the access control policy on the specified resource.
8445 /// Replaces any existing policy.
8446 pub fn set_iam_policy(&self) -> super::builder::node_templates::SetIamPolicy {
8447 super::builder::node_templates::SetIamPolicy::new(self.inner.clone())
8448 }
8449
8450 /// Returns permissions that a caller has on the specified resource.
8451 pub fn test_iam_permissions(&self) -> super::builder::node_templates::TestIamPermissions {
8452 super::builder::node_templates::TestIamPermissions::new(self.inner.clone())
8453 }
8454
8455 /// Retrieves the specified region-specific Operations resource.
8456 pub fn get_operation(&self) -> super::builder::node_templates::GetOperation {
8457 super::builder::node_templates::GetOperation::new(self.inner.clone())
8458 }
8459}
8460
8461/// Implements a client for the Google Compute Engine API.
8462///
8463/// # Example
8464/// ```
8465/// # tokio_test::block_on(async {
8466/// # use google_cloud_compute_v1::client::NodeTypes;
8467/// let client = NodeTypes::builder().build().await?;
8468/// // use `client` to make requests to the Google Compute Engine API.
8469/// # gax::client_builder::Result::<()>::Ok(()) });
8470/// ```
8471///
8472/// # Service Description
8473///
8474/// Service for the `nodeTypes` resource.
8475///
8476/// # Configuration
8477///
8478/// To configure `NodeTypes` use the `with_*` methods in the type returned
8479/// by [builder()][NodeTypes::builder]. The default configuration should
8480/// work for most applications. Common configuration changes include
8481///
8482/// * [with_endpoint()]: by default this client uses the global default endpoint
8483/// (`https://compute.googleapis.com`). Applications using regional
8484/// endpoints or running in restricted networks (e.g. a network configured
8485// with [Private Google Access with VPC Service Controls]) may want to
8486/// override this default.
8487/// * [with_credentials()]: by default this client uses
8488/// [Application Default Credentials]. Applications using custom
8489/// authentication may need to override this default.
8490///
8491/// [with_endpoint()]: super::builder::node_types::ClientBuilder::with_endpoint
8492/// [with_credentials()]: super::builder::node_types::ClientBuilder::credentials
8493/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8494/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8495///
8496/// # Pooling and Cloning
8497///
8498/// `NodeTypes` holds a connection pool internally, it is advised to
8499/// create one and the reuse it. You do not need to wrap `NodeTypes` in
8500/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8501/// already uses an `Arc` internally.
8502#[cfg(feature = "node-types")]
8503#[cfg_attr(docsrs, doc(cfg(feature = "node-types")))]
8504#[derive(Clone, Debug)]
8505pub struct NodeTypes {
8506 inner: std::sync::Arc<dyn super::stub::dynamic::NodeTypes>,
8507}
8508
8509#[cfg(feature = "node-types")]
8510impl NodeTypes {
8511 /// Returns a builder for [NodeTypes].
8512 ///
8513 /// ```
8514 /// # tokio_test::block_on(async {
8515 /// # use google_cloud_compute_v1::client::NodeTypes;
8516 /// let client = NodeTypes::builder().build().await?;
8517 /// # gax::client_builder::Result::<()>::Ok(()) });
8518 /// ```
8519 pub fn builder() -> super::builder::node_types::ClientBuilder {
8520 gax::client_builder::internal::new_builder(super::builder::node_types::client::Factory)
8521 }
8522
8523 /// Creates a new client from the provided stub.
8524 ///
8525 /// The most common case for calling this function is in tests mocking the
8526 /// client's behavior.
8527 pub fn from_stub<T>(stub: T) -> Self
8528 where
8529 T: super::stub::NodeTypes + 'static,
8530 {
8531 Self {
8532 inner: std::sync::Arc::new(stub),
8533 }
8534 }
8535
8536 pub(crate) async fn new(
8537 config: gaxi::options::ClientConfig,
8538 ) -> gax::client_builder::Result<Self> {
8539 let inner = Self::build_inner(config).await?;
8540 Ok(Self { inner })
8541 }
8542
8543 async fn build_inner(
8544 conf: gaxi::options::ClientConfig,
8545 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::NodeTypes>> {
8546 if gaxi::options::tracing_enabled(&conf) {
8547 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8548 }
8549 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8550 }
8551
8552 async fn build_transport(
8553 conf: gaxi::options::ClientConfig,
8554 ) -> gax::client_builder::Result<impl super::stub::NodeTypes> {
8555 super::transport::NodeTypes::new(conf).await
8556 }
8557
8558 async fn build_with_tracing(
8559 conf: gaxi::options::ClientConfig,
8560 ) -> gax::client_builder::Result<impl super::stub::NodeTypes> {
8561 Self::build_transport(conf)
8562 .await
8563 .map(super::tracing::NodeTypes::new)
8564 }
8565
8566 /// Retrieves an aggregated list of node types.
8567 ///
8568 /// To prevent failure, Google recommends that you set the
8569 /// `returnPartialSuccess` parameter to `true`.
8570 pub fn aggregated_list(&self) -> super::builder::node_types::AggregatedList {
8571 super::builder::node_types::AggregatedList::new(self.inner.clone())
8572 }
8573
8574 /// Returns the specified node type.
8575 pub fn get(&self) -> super::builder::node_types::Get {
8576 super::builder::node_types::Get::new(self.inner.clone())
8577 }
8578
8579 /// Retrieves a list of node types available to the specified
8580 /// project.
8581 pub fn list(&self) -> super::builder::node_types::List {
8582 super::builder::node_types::List::new(self.inner.clone())
8583 }
8584}
8585
8586/// Implements a client for the Google Compute Engine API.
8587///
8588/// # Example
8589/// ```
8590/// # tokio_test::block_on(async {
8591/// # use google_cloud_compute_v1::client::OrganizationSecurityPolicies;
8592/// let client = OrganizationSecurityPolicies::builder().build().await?;
8593/// // use `client` to make requests to the Google Compute Engine API.
8594/// # gax::client_builder::Result::<()>::Ok(()) });
8595/// ```
8596///
8597/// # Service Description
8598///
8599/// Service for the `organizationSecurityPolicies` resource.
8600///
8601/// # Configuration
8602///
8603/// To configure `OrganizationSecurityPolicies` use the `with_*` methods in the type returned
8604/// by [builder()][OrganizationSecurityPolicies::builder]. The default configuration should
8605/// work for most applications. Common configuration changes include
8606///
8607/// * [with_endpoint()]: by default this client uses the global default endpoint
8608/// (`https://compute.googleapis.com`). Applications using regional
8609/// endpoints or running in restricted networks (e.g. a network configured
8610// with [Private Google Access with VPC Service Controls]) may want to
8611/// override this default.
8612/// * [with_credentials()]: by default this client uses
8613/// [Application Default Credentials]. Applications using custom
8614/// authentication may need to override this default.
8615///
8616/// [with_endpoint()]: super::builder::organization_security_policies::ClientBuilder::with_endpoint
8617/// [with_credentials()]: super::builder::organization_security_policies::ClientBuilder::credentials
8618/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8619/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8620///
8621/// # Pooling and Cloning
8622///
8623/// `OrganizationSecurityPolicies` holds a connection pool internally, it is advised to
8624/// create one and the reuse it. You do not need to wrap `OrganizationSecurityPolicies` in
8625/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8626/// already uses an `Arc` internally.
8627#[cfg(feature = "organization-security-policies")]
8628#[cfg_attr(docsrs, doc(cfg(feature = "organization-security-policies")))]
8629#[derive(Clone, Debug)]
8630pub struct OrganizationSecurityPolicies {
8631 inner: std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityPolicies>,
8632}
8633
8634#[cfg(feature = "organization-security-policies")]
8635impl OrganizationSecurityPolicies {
8636 /// Returns a builder for [OrganizationSecurityPolicies].
8637 ///
8638 /// ```
8639 /// # tokio_test::block_on(async {
8640 /// # use google_cloud_compute_v1::client::OrganizationSecurityPolicies;
8641 /// let client = OrganizationSecurityPolicies::builder().build().await?;
8642 /// # gax::client_builder::Result::<()>::Ok(()) });
8643 /// ```
8644 pub fn builder() -> super::builder::organization_security_policies::ClientBuilder {
8645 gax::client_builder::internal::new_builder(
8646 super::builder::organization_security_policies::client::Factory,
8647 )
8648 }
8649
8650 /// Creates a new client from the provided stub.
8651 ///
8652 /// The most common case for calling this function is in tests mocking the
8653 /// client's behavior.
8654 pub fn from_stub<T>(stub: T) -> Self
8655 where
8656 T: super::stub::OrganizationSecurityPolicies + 'static,
8657 {
8658 Self {
8659 inner: std::sync::Arc::new(stub),
8660 }
8661 }
8662
8663 pub(crate) async fn new(
8664 config: gaxi::options::ClientConfig,
8665 ) -> gax::client_builder::Result<Self> {
8666 let inner = Self::build_inner(config).await?;
8667 Ok(Self { inner })
8668 }
8669
8670 async fn build_inner(
8671 conf: gaxi::options::ClientConfig,
8672 ) -> gax::client_builder::Result<
8673 std::sync::Arc<dyn super::stub::dynamic::OrganizationSecurityPolicies>,
8674 > {
8675 if gaxi::options::tracing_enabled(&conf) {
8676 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8677 }
8678 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8679 }
8680
8681 async fn build_transport(
8682 conf: gaxi::options::ClientConfig,
8683 ) -> gax::client_builder::Result<impl super::stub::OrganizationSecurityPolicies> {
8684 super::transport::OrganizationSecurityPolicies::new(conf).await
8685 }
8686
8687 async fn build_with_tracing(
8688 conf: gaxi::options::ClientConfig,
8689 ) -> gax::client_builder::Result<impl super::stub::OrganizationSecurityPolicies> {
8690 Self::build_transport(conf)
8691 .await
8692 .map(super::tracing::OrganizationSecurityPolicies::new)
8693 }
8694
8695 /// Inserts an association for the specified security policy.
8696 ///
8697 /// This has billing implications. Projects in the hierarchy with effective
8698 /// hierarchical security policies will be automatically enrolled into Cloud
8699 /// Armor Enterprise if not already enrolled.
8700 ///
8701 /// Use of this API to modify firewall policies is deprecated. Use
8702 /// firewallPolicies.addAssociation instead if possible.
8703 pub fn add_association(
8704 &self,
8705 ) -> super::builder::organization_security_policies::AddAssociation {
8706 super::builder::organization_security_policies::AddAssociation::new(self.inner.clone())
8707 }
8708
8709 /// Inserts a rule into a security policy.
8710 pub fn add_rule(&self) -> super::builder::organization_security_policies::AddRule {
8711 super::builder::organization_security_policies::AddRule::new(self.inner.clone())
8712 }
8713
8714 /// Copies rules to the specified security policy.
8715 ///
8716 /// Use of this API to modify firewall policies is deprecated. Use
8717 /// firewallPolicies.copyRules instead.
8718 pub fn copy_rules(&self) -> super::builder::organization_security_policies::CopyRules {
8719 super::builder::organization_security_policies::CopyRules::new(self.inner.clone())
8720 }
8721
8722 /// Deletes the specified policy.
8723 ///
8724 /// Use of this API to remove firewall policies is deprecated. Use
8725 /// firewallPolicies.delete instead.
8726 pub fn delete(&self) -> super::builder::organization_security_policies::Delete {
8727 super::builder::organization_security_policies::Delete::new(self.inner.clone())
8728 }
8729
8730 /// List all of the ordered rules present in a single specified policy.
8731 ///
8732 /// Use of this API to read firewall policies is deprecated. Use
8733 /// firewallPolicies.get instead.
8734 pub fn get(&self) -> super::builder::organization_security_policies::Get {
8735 super::builder::organization_security_policies::Get::new(self.inner.clone())
8736 }
8737
8738 /// Gets an association with the specified name.
8739 ///
8740 /// Use of this API to read firewall policies is deprecated. Use
8741 /// firewallPolicies.getAssociation instead if possible.
8742 pub fn get_association(
8743 &self,
8744 ) -> super::builder::organization_security_policies::GetAssociation {
8745 super::builder::organization_security_policies::GetAssociation::new(self.inner.clone())
8746 }
8747
8748 /// Gets a rule at the specified priority.
8749 ///
8750 /// Use of this API to read firewall policies is deprecated. Use
8751 /// firewallPolicies.getRule instead.
8752 pub fn get_rule(&self) -> super::builder::organization_security_policies::GetRule {
8753 super::builder::organization_security_policies::GetRule::new(self.inner.clone())
8754 }
8755
8756 /// Creates a new policy in the specified organization using the data included
8757 /// in the request.
8758 ///
8759 /// Use of this API to insert firewall policies is deprecated. Use
8760 /// firewallPolicies.insert instead.
8761 pub fn insert(&self) -> super::builder::organization_security_policies::Insert {
8762 super::builder::organization_security_policies::Insert::new(self.inner.clone())
8763 }
8764
8765 /// List all the policies that have been configured for the specified
8766 /// organization.
8767 ///
8768 /// Use of this API to read firewall policies is deprecated. Use
8769 /// firewallPolicies.list instead.
8770 pub fn list(&self) -> super::builder::organization_security_policies::List {
8771 super::builder::organization_security_policies::List::new(self.inner.clone())
8772 }
8773
8774 /// Lists associations of a specified target, i.e., organization or folder.
8775 ///
8776 /// Use of this API to read firewall policies is deprecated. Use
8777 /// firewallPolicies.listAssociations instead if possible.
8778 pub fn list_associations(
8779 &self,
8780 ) -> super::builder::organization_security_policies::ListAssociations {
8781 super::builder::organization_security_policies::ListAssociations::new(self.inner.clone())
8782 }
8783
8784 /// Gets the current list of preconfigured Web Application Firewall (WAF)
8785 /// expressions.
8786 pub fn list_preconfigured_expression_sets(
8787 &self,
8788 ) -> super::builder::organization_security_policies::ListPreconfiguredExpressionSets {
8789 super::builder::organization_security_policies::ListPreconfiguredExpressionSets::new(
8790 self.inner.clone(),
8791 )
8792 }
8793
8794 /// Moves the specified security policy.
8795 ///
8796 /// Use of this API to modify firewall policies is deprecated. Use
8797 /// firewallPolicies.move instead.
8798 pub fn r#move(&self) -> super::builder::organization_security_policies::Move {
8799 super::builder::organization_security_policies::Move::new(self.inner.clone())
8800 }
8801
8802 /// Patches the specified policy with the data included in the request.
8803 ///
8804 /// Use of this API to modify firewall policies is deprecated. Use
8805 /// firewallPolicies.patch instead.
8806 pub fn patch(&self) -> super::builder::organization_security_policies::Patch {
8807 super::builder::organization_security_policies::Patch::new(self.inner.clone())
8808 }
8809
8810 /// Patches a rule at the specified priority.
8811 ///
8812 /// Use of this API to modify firewall policies is deprecated. Use
8813 /// firewallPolicies.patchRule instead.
8814 pub fn patch_rule(&self) -> super::builder::organization_security_policies::PatchRule {
8815 super::builder::organization_security_policies::PatchRule::new(self.inner.clone())
8816 }
8817
8818 /// Removes an association for the specified security policy.
8819 ///
8820 /// Use of this API to modify firewall policies is deprecated. Use
8821 /// firewallPolicies.removeAssociation instead if possible.
8822 pub fn remove_association(
8823 &self,
8824 ) -> super::builder::organization_security_policies::RemoveAssociation {
8825 super::builder::organization_security_policies::RemoveAssociation::new(self.inner.clone())
8826 }
8827
8828 /// Deletes a rule at the specified priority.
8829 pub fn remove_rule(&self) -> super::builder::organization_security_policies::RemoveRule {
8830 super::builder::organization_security_policies::RemoveRule::new(self.inner.clone())
8831 }
8832
8833 /// Retrieves the specified Operations resource. Gets a list of operations
8834 /// by making a `list()` request.
8835 pub fn get_operation(&self) -> super::builder::organization_security_policies::GetOperation {
8836 super::builder::organization_security_policies::GetOperation::new(self.inner.clone())
8837 }
8838}
8839
8840/// Implements a client for the Google Compute Engine API.
8841///
8842/// # Example
8843/// ```
8844/// # tokio_test::block_on(async {
8845/// # use google_cloud_compute_v1::client::PacketMirrorings;
8846/// let client = PacketMirrorings::builder().build().await?;
8847/// // use `client` to make requests to the Google Compute Engine API.
8848/// # gax::client_builder::Result::<()>::Ok(()) });
8849/// ```
8850///
8851/// # Service Description
8852///
8853/// Service for the `packetMirrorings` resource.
8854///
8855/// # Configuration
8856///
8857/// To configure `PacketMirrorings` use the `with_*` methods in the type returned
8858/// by [builder()][PacketMirrorings::builder]. The default configuration should
8859/// work for most applications. Common configuration changes include
8860///
8861/// * [with_endpoint()]: by default this client uses the global default endpoint
8862/// (`https://compute.googleapis.com`). Applications using regional
8863/// endpoints or running in restricted networks (e.g. a network configured
8864// with [Private Google Access with VPC Service Controls]) may want to
8865/// override this default.
8866/// * [with_credentials()]: by default this client uses
8867/// [Application Default Credentials]. Applications using custom
8868/// authentication may need to override this default.
8869///
8870/// [with_endpoint()]: super::builder::packet_mirrorings::ClientBuilder::with_endpoint
8871/// [with_credentials()]: super::builder::packet_mirrorings::ClientBuilder::credentials
8872/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
8873/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
8874///
8875/// # Pooling and Cloning
8876///
8877/// `PacketMirrorings` holds a connection pool internally, it is advised to
8878/// create one and the reuse it. You do not need to wrap `PacketMirrorings` in
8879/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
8880/// already uses an `Arc` internally.
8881#[cfg(feature = "packet-mirrorings")]
8882#[cfg_attr(docsrs, doc(cfg(feature = "packet-mirrorings")))]
8883#[derive(Clone, Debug)]
8884pub struct PacketMirrorings {
8885 inner: std::sync::Arc<dyn super::stub::dynamic::PacketMirrorings>,
8886}
8887
8888#[cfg(feature = "packet-mirrorings")]
8889impl PacketMirrorings {
8890 /// Returns a builder for [PacketMirrorings].
8891 ///
8892 /// ```
8893 /// # tokio_test::block_on(async {
8894 /// # use google_cloud_compute_v1::client::PacketMirrorings;
8895 /// let client = PacketMirrorings::builder().build().await?;
8896 /// # gax::client_builder::Result::<()>::Ok(()) });
8897 /// ```
8898 pub fn builder() -> super::builder::packet_mirrorings::ClientBuilder {
8899 gax::client_builder::internal::new_builder(
8900 super::builder::packet_mirrorings::client::Factory,
8901 )
8902 }
8903
8904 /// Creates a new client from the provided stub.
8905 ///
8906 /// The most common case for calling this function is in tests mocking the
8907 /// client's behavior.
8908 pub fn from_stub<T>(stub: T) -> Self
8909 where
8910 T: super::stub::PacketMirrorings + 'static,
8911 {
8912 Self {
8913 inner: std::sync::Arc::new(stub),
8914 }
8915 }
8916
8917 pub(crate) async fn new(
8918 config: gaxi::options::ClientConfig,
8919 ) -> gax::client_builder::Result<Self> {
8920 let inner = Self::build_inner(config).await?;
8921 Ok(Self { inner })
8922 }
8923
8924 async fn build_inner(
8925 conf: gaxi::options::ClientConfig,
8926 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PacketMirrorings>>
8927 {
8928 if gaxi::options::tracing_enabled(&conf) {
8929 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
8930 }
8931 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
8932 }
8933
8934 async fn build_transport(
8935 conf: gaxi::options::ClientConfig,
8936 ) -> gax::client_builder::Result<impl super::stub::PacketMirrorings> {
8937 super::transport::PacketMirrorings::new(conf).await
8938 }
8939
8940 async fn build_with_tracing(
8941 conf: gaxi::options::ClientConfig,
8942 ) -> gax::client_builder::Result<impl super::stub::PacketMirrorings> {
8943 Self::build_transport(conf)
8944 .await
8945 .map(super::tracing::PacketMirrorings::new)
8946 }
8947
8948 /// Retrieves an aggregated list of packetMirrorings.
8949 ///
8950 /// To prevent failure, Google recommends that you set the
8951 /// `returnPartialSuccess` parameter to `true`.
8952 pub fn aggregated_list(&self) -> super::builder::packet_mirrorings::AggregatedList {
8953 super::builder::packet_mirrorings::AggregatedList::new(self.inner.clone())
8954 }
8955
8956 /// Deletes the specified PacketMirroring resource.
8957 pub fn delete(&self) -> super::builder::packet_mirrorings::Delete {
8958 super::builder::packet_mirrorings::Delete::new(self.inner.clone())
8959 }
8960
8961 /// Returns the specified PacketMirroring resource.
8962 pub fn get(&self) -> super::builder::packet_mirrorings::Get {
8963 super::builder::packet_mirrorings::Get::new(self.inner.clone())
8964 }
8965
8966 /// Creates a PacketMirroring resource in the specified project and region
8967 /// using the data included in the request.
8968 pub fn insert(&self) -> super::builder::packet_mirrorings::Insert {
8969 super::builder::packet_mirrorings::Insert::new(self.inner.clone())
8970 }
8971
8972 /// Retrieves a list of PacketMirroring resources available to the specified
8973 /// project and region.
8974 pub fn list(&self) -> super::builder::packet_mirrorings::List {
8975 super::builder::packet_mirrorings::List::new(self.inner.clone())
8976 }
8977
8978 /// Patches the specified PacketMirroring resource with the data included in
8979 /// the request. This method supportsPATCH
8980 /// semantics and usesJSON merge
8981 /// patch format and processing rules.
8982 pub fn patch(&self) -> super::builder::packet_mirrorings::Patch {
8983 super::builder::packet_mirrorings::Patch::new(self.inner.clone())
8984 }
8985
8986 /// Returns permissions that a caller has on the specified resource.
8987 pub fn test_iam_permissions(&self) -> super::builder::packet_mirrorings::TestIamPermissions {
8988 super::builder::packet_mirrorings::TestIamPermissions::new(self.inner.clone())
8989 }
8990
8991 /// Retrieves the specified region-specific Operations resource.
8992 pub fn get_operation(&self) -> super::builder::packet_mirrorings::GetOperation {
8993 super::builder::packet_mirrorings::GetOperation::new(self.inner.clone())
8994 }
8995}
8996
8997/// Implements a client for the Google Compute Engine API.
8998///
8999/// # Example
9000/// ```
9001/// # tokio_test::block_on(async {
9002/// # use google_cloud_compute_v1::client::PreviewFeatures;
9003/// let client = PreviewFeatures::builder().build().await?;
9004/// // use `client` to make requests to the Google Compute Engine API.
9005/// # gax::client_builder::Result::<()>::Ok(()) });
9006/// ```
9007///
9008/// # Service Description
9009///
9010/// Service for the `previewFeatures` resource.
9011///
9012/// # Configuration
9013///
9014/// To configure `PreviewFeatures` use the `with_*` methods in the type returned
9015/// by [builder()][PreviewFeatures::builder]. The default configuration should
9016/// work for most applications. Common configuration changes include
9017///
9018/// * [with_endpoint()]: by default this client uses the global default endpoint
9019/// (`https://compute.googleapis.com`). Applications using regional
9020/// endpoints or running in restricted networks (e.g. a network configured
9021// with [Private Google Access with VPC Service Controls]) may want to
9022/// override this default.
9023/// * [with_credentials()]: by default this client uses
9024/// [Application Default Credentials]. Applications using custom
9025/// authentication may need to override this default.
9026///
9027/// [with_endpoint()]: super::builder::preview_features::ClientBuilder::with_endpoint
9028/// [with_credentials()]: super::builder::preview_features::ClientBuilder::credentials
9029/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9030/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9031///
9032/// # Pooling and Cloning
9033///
9034/// `PreviewFeatures` holds a connection pool internally, it is advised to
9035/// create one and the reuse it. You do not need to wrap `PreviewFeatures` in
9036/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9037/// already uses an `Arc` internally.
9038#[cfg(feature = "preview-features")]
9039#[cfg_attr(docsrs, doc(cfg(feature = "preview-features")))]
9040#[derive(Clone, Debug)]
9041pub struct PreviewFeatures {
9042 inner: std::sync::Arc<dyn super::stub::dynamic::PreviewFeatures>,
9043}
9044
9045#[cfg(feature = "preview-features")]
9046impl PreviewFeatures {
9047 /// Returns a builder for [PreviewFeatures].
9048 ///
9049 /// ```
9050 /// # tokio_test::block_on(async {
9051 /// # use google_cloud_compute_v1::client::PreviewFeatures;
9052 /// let client = PreviewFeatures::builder().build().await?;
9053 /// # gax::client_builder::Result::<()>::Ok(()) });
9054 /// ```
9055 pub fn builder() -> super::builder::preview_features::ClientBuilder {
9056 gax::client_builder::internal::new_builder(
9057 super::builder::preview_features::client::Factory,
9058 )
9059 }
9060
9061 /// Creates a new client from the provided stub.
9062 ///
9063 /// The most common case for calling this function is in tests mocking the
9064 /// client's behavior.
9065 pub fn from_stub<T>(stub: T) -> Self
9066 where
9067 T: super::stub::PreviewFeatures + 'static,
9068 {
9069 Self {
9070 inner: std::sync::Arc::new(stub),
9071 }
9072 }
9073
9074 pub(crate) async fn new(
9075 config: gaxi::options::ClientConfig,
9076 ) -> gax::client_builder::Result<Self> {
9077 let inner = Self::build_inner(config).await?;
9078 Ok(Self { inner })
9079 }
9080
9081 async fn build_inner(
9082 conf: gaxi::options::ClientConfig,
9083 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::PreviewFeatures>>
9084 {
9085 if gaxi::options::tracing_enabled(&conf) {
9086 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9087 }
9088 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9089 }
9090
9091 async fn build_transport(
9092 conf: gaxi::options::ClientConfig,
9093 ) -> gax::client_builder::Result<impl super::stub::PreviewFeatures> {
9094 super::transport::PreviewFeatures::new(conf).await
9095 }
9096
9097 async fn build_with_tracing(
9098 conf: gaxi::options::ClientConfig,
9099 ) -> gax::client_builder::Result<impl super::stub::PreviewFeatures> {
9100 Self::build_transport(conf)
9101 .await
9102 .map(super::tracing::PreviewFeatures::new)
9103 }
9104
9105 /// Returns the details of the given PreviewFeature.
9106 pub fn get(&self) -> super::builder::preview_features::Get {
9107 super::builder::preview_features::Get::new(self.inner.clone())
9108 }
9109
9110 /// Returns the details of the given PreviewFeature.
9111 pub fn list(&self) -> super::builder::preview_features::List {
9112 super::builder::preview_features::List::new(self.inner.clone())
9113 }
9114
9115 /// Patches the given PreviewFeature. This method is used to enable or disable
9116 /// a PreviewFeature.
9117 pub fn update(&self) -> super::builder::preview_features::Update {
9118 super::builder::preview_features::Update::new(self.inner.clone())
9119 }
9120
9121 /// Retrieves the specified Operations resource.
9122 pub fn get_operation(&self) -> super::builder::preview_features::GetOperation {
9123 super::builder::preview_features::GetOperation::new(self.inner.clone())
9124 }
9125}
9126
9127/// Implements a client for the Google Compute Engine API.
9128///
9129/// # Example
9130/// ```
9131/// # tokio_test::block_on(async {
9132/// # use google_cloud_compute_v1::client::Projects;
9133/// let client = Projects::builder().build().await?;
9134/// // use `client` to make requests to the Google Compute Engine API.
9135/// # gax::client_builder::Result::<()>::Ok(()) });
9136/// ```
9137///
9138/// # Service Description
9139///
9140/// Service for the `projects` resource.
9141///
9142/// # Configuration
9143///
9144/// To configure `Projects` use the `with_*` methods in the type returned
9145/// by [builder()][Projects::builder]. The default configuration should
9146/// work for most applications. Common configuration changes include
9147///
9148/// * [with_endpoint()]: by default this client uses the global default endpoint
9149/// (`https://compute.googleapis.com`). Applications using regional
9150/// endpoints or running in restricted networks (e.g. a network configured
9151// with [Private Google Access with VPC Service Controls]) may want to
9152/// override this default.
9153/// * [with_credentials()]: by default this client uses
9154/// [Application Default Credentials]. Applications using custom
9155/// authentication may need to override this default.
9156///
9157/// [with_endpoint()]: super::builder::projects::ClientBuilder::with_endpoint
9158/// [with_credentials()]: super::builder::projects::ClientBuilder::credentials
9159/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9160/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9161///
9162/// # Pooling and Cloning
9163///
9164/// `Projects` holds a connection pool internally, it is advised to
9165/// create one and the reuse it. You do not need to wrap `Projects` in
9166/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9167/// already uses an `Arc` internally.
9168#[cfg(feature = "projects")]
9169#[cfg_attr(docsrs, doc(cfg(feature = "projects")))]
9170#[derive(Clone, Debug)]
9171pub struct Projects {
9172 inner: std::sync::Arc<dyn super::stub::dynamic::Projects>,
9173}
9174
9175#[cfg(feature = "projects")]
9176impl Projects {
9177 /// Returns a builder for [Projects].
9178 ///
9179 /// ```
9180 /// # tokio_test::block_on(async {
9181 /// # use google_cloud_compute_v1::client::Projects;
9182 /// let client = Projects::builder().build().await?;
9183 /// # gax::client_builder::Result::<()>::Ok(()) });
9184 /// ```
9185 pub fn builder() -> super::builder::projects::ClientBuilder {
9186 gax::client_builder::internal::new_builder(super::builder::projects::client::Factory)
9187 }
9188
9189 /// Creates a new client from the provided stub.
9190 ///
9191 /// The most common case for calling this function is in tests mocking the
9192 /// client's behavior.
9193 pub fn from_stub<T>(stub: T) -> Self
9194 where
9195 T: super::stub::Projects + 'static,
9196 {
9197 Self {
9198 inner: std::sync::Arc::new(stub),
9199 }
9200 }
9201
9202 pub(crate) async fn new(
9203 config: gaxi::options::ClientConfig,
9204 ) -> gax::client_builder::Result<Self> {
9205 let inner = Self::build_inner(config).await?;
9206 Ok(Self { inner })
9207 }
9208
9209 async fn build_inner(
9210 conf: gaxi::options::ClientConfig,
9211 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Projects>> {
9212 if gaxi::options::tracing_enabled(&conf) {
9213 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9214 }
9215 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9216 }
9217
9218 async fn build_transport(
9219 conf: gaxi::options::ClientConfig,
9220 ) -> gax::client_builder::Result<impl super::stub::Projects> {
9221 super::transport::Projects::new(conf).await
9222 }
9223
9224 async fn build_with_tracing(
9225 conf: gaxi::options::ClientConfig,
9226 ) -> gax::client_builder::Result<impl super::stub::Projects> {
9227 Self::build_transport(conf)
9228 .await
9229 .map(super::tracing::Projects::new)
9230 }
9231
9232 /// Disable this project as a shared VPC host project.
9233 pub fn disable_xpn_host(&self) -> super::builder::projects::DisableXpnHost {
9234 super::builder::projects::DisableXpnHost::new(self.inner.clone())
9235 }
9236
9237 /// Disable a service resource (also known as service project) associated with
9238 /// this host project.
9239 pub fn disable_xpn_resource(&self) -> super::builder::projects::DisableXpnResource {
9240 super::builder::projects::DisableXpnResource::new(self.inner.clone())
9241 }
9242
9243 /// Enable this project as a shared VPC host project.
9244 pub fn enable_xpn_host(&self) -> super::builder::projects::EnableXpnHost {
9245 super::builder::projects::EnableXpnHost::new(self.inner.clone())
9246 }
9247
9248 /// Enable service resource (a.k.a service project) for a host project, so that
9249 /// subnets in the host project can be used by instances in the service
9250 /// project.
9251 pub fn enable_xpn_resource(&self) -> super::builder::projects::EnableXpnResource {
9252 super::builder::projects::EnableXpnResource::new(self.inner.clone())
9253 }
9254
9255 /// Returns the specified Project resource.
9256 ///
9257 /// To decrease latency for this method, you can optionally omit any unneeded
9258 /// information from the response by using a field mask. This practice is
9259 /// especially recommended for unused quota information (the `quotas` field).
9260 /// To exclude one or more fields, set your request's `fields` query parameter
9261 /// to only include the fields you need. For example, to only include the `id`
9262 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
9263 /// your request.
9264 pub fn get(&self) -> super::builder::projects::Get {
9265 super::builder::projects::Get::new(self.inner.clone())
9266 }
9267
9268 /// Gets the shared VPC host project that this project links to. May be empty
9269 /// if no link exists.
9270 pub fn get_xpn_host(&self) -> super::builder::projects::GetXpnHost {
9271 super::builder::projects::GetXpnHost::new(self.inner.clone())
9272 }
9273
9274 /// Gets service resources (a.k.a service project) associated with this host
9275 /// project.
9276 pub fn get_xpn_resources(&self) -> super::builder::projects::GetXpnResources {
9277 super::builder::projects::GetXpnResources::new(self.inner.clone())
9278 }
9279
9280 /// Lists all shared VPC host projects visible to the user in an organization.
9281 pub fn list_xpn_hosts(&self) -> super::builder::projects::ListXpnHosts {
9282 super::builder::projects::ListXpnHosts::new(self.inner.clone())
9283 }
9284
9285 /// Starting September 29, 2025, you can't use the moveDisk API on new
9286 /// projects. To move a disk to a different region or zone, follow the steps in
9287 /// [Change the location of a
9288 /// disk](https://{$universe.dns_names.final_documentation_domain}/compute/docs/disks/migrate-to-hyperdisk#migrate-to-hd).
9289 ///
9290 /// Projects that already use the moveDisk API can continue usage until
9291 /// September 29, 2026.
9292 ///
9293 /// Starting November 1, 2025, API responses will include a warning message in
9294 /// the response body about the upcoming deprecation. You can skip the message
9295 /// to continue using the service without interruption.
9296 #[deprecated]
9297 pub fn move_disk(&self) -> super::builder::projects::MoveDisk {
9298 super::builder::projects::MoveDisk::new(self.inner.clone())
9299 }
9300
9301 /// Moves an instance and its attached persistent disks from one zone to
9302 /// another.
9303 /// *Note*: Moving VMs or disks by using this method might
9304 /// cause unexpected behavior. For more information, see the [known
9305 /// issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior).
9306 /// [Deprecated] This method is deprecated. See [moving instance across
9307 /// zones](/compute/docs/instances/moving-instance-across-zones) instead.
9308 #[deprecated]
9309 pub fn move_instance(&self) -> super::builder::projects::MoveInstance {
9310 super::builder::projects::MoveInstance::new(self.inner.clone())
9311 }
9312
9313 /// Sets the Cloud Armor tier of the project. To set ENTERPRISE or above the
9314 /// billing account of the project must be subscribed to Cloud Armor
9315 /// Enterprise. See Subscribing
9316 /// to Cloud Armor Enterprise for more information.
9317 pub fn set_cloud_armor_tier(&self) -> super::builder::projects::SetCloudArmorTier {
9318 super::builder::projects::SetCloudArmorTier::new(self.inner.clone())
9319 }
9320
9321 /// Sets metadata common to all instances within the specified project using
9322 /// the data included in the request.
9323 pub fn set_common_instance_metadata(
9324 &self,
9325 ) -> super::builder::projects::SetCommonInstanceMetadata {
9326 super::builder::projects::SetCommonInstanceMetadata::new(self.inner.clone())
9327 }
9328
9329 /// Sets the default network tier of the project. The default network tier is
9330 /// used when an address/forwardingRule/instance is created without specifying
9331 /// the network tier field.
9332 pub fn set_default_network_tier(&self) -> super::builder::projects::SetDefaultNetworkTier {
9333 super::builder::projects::SetDefaultNetworkTier::new(self.inner.clone())
9334 }
9335
9336 /// Enables the usage export feature and sets theusage export bucket
9337 /// where reports are stored. If you provide an empty request body using this
9338 /// method, the usage export feature will be disabled.
9339 pub fn set_usage_export_bucket(&self) -> super::builder::projects::SetUsageExportBucket {
9340 super::builder::projects::SetUsageExportBucket::new(self.inner.clone())
9341 }
9342
9343 /// Retrieves the specified Operations resource.
9344 pub fn get_operation(&self) -> super::builder::projects::GetOperation {
9345 super::builder::projects::GetOperation::new(self.inner.clone())
9346 }
9347}
9348
9349/// Implements a client for the Google Compute Engine API.
9350///
9351/// # Example
9352/// ```
9353/// # tokio_test::block_on(async {
9354/// # use google_cloud_compute_v1::client::PublicAdvertisedPrefixes;
9355/// let client = PublicAdvertisedPrefixes::builder().build().await?;
9356/// // use `client` to make requests to the Google Compute Engine API.
9357/// # gax::client_builder::Result::<()>::Ok(()) });
9358/// ```
9359///
9360/// # Service Description
9361///
9362/// Service for the `publicAdvertisedPrefixes` resource.
9363///
9364/// # Configuration
9365///
9366/// To configure `PublicAdvertisedPrefixes` use the `with_*` methods in the type returned
9367/// by [builder()][PublicAdvertisedPrefixes::builder]. The default configuration should
9368/// work for most applications. Common configuration changes include
9369///
9370/// * [with_endpoint()]: by default this client uses the global default endpoint
9371/// (`https://compute.googleapis.com`). Applications using regional
9372/// endpoints or running in restricted networks (e.g. a network configured
9373// with [Private Google Access with VPC Service Controls]) may want to
9374/// override this default.
9375/// * [with_credentials()]: by default this client uses
9376/// [Application Default Credentials]. Applications using custom
9377/// authentication may need to override this default.
9378///
9379/// [with_endpoint()]: super::builder::public_advertised_prefixes::ClientBuilder::with_endpoint
9380/// [with_credentials()]: super::builder::public_advertised_prefixes::ClientBuilder::credentials
9381/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9382/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9383///
9384/// # Pooling and Cloning
9385///
9386/// `PublicAdvertisedPrefixes` holds a connection pool internally, it is advised to
9387/// create one and the reuse it. You do not need to wrap `PublicAdvertisedPrefixes` in
9388/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9389/// already uses an `Arc` internally.
9390#[cfg(feature = "public-advertised-prefixes")]
9391#[cfg_attr(docsrs, doc(cfg(feature = "public-advertised-prefixes")))]
9392#[derive(Clone, Debug)]
9393pub struct PublicAdvertisedPrefixes {
9394 inner: std::sync::Arc<dyn super::stub::dynamic::PublicAdvertisedPrefixes>,
9395}
9396
9397#[cfg(feature = "public-advertised-prefixes")]
9398impl PublicAdvertisedPrefixes {
9399 /// Returns a builder for [PublicAdvertisedPrefixes].
9400 ///
9401 /// ```
9402 /// # tokio_test::block_on(async {
9403 /// # use google_cloud_compute_v1::client::PublicAdvertisedPrefixes;
9404 /// let client = PublicAdvertisedPrefixes::builder().build().await?;
9405 /// # gax::client_builder::Result::<()>::Ok(()) });
9406 /// ```
9407 pub fn builder() -> super::builder::public_advertised_prefixes::ClientBuilder {
9408 gax::client_builder::internal::new_builder(
9409 super::builder::public_advertised_prefixes::client::Factory,
9410 )
9411 }
9412
9413 /// Creates a new client from the provided stub.
9414 ///
9415 /// The most common case for calling this function is in tests mocking the
9416 /// client's behavior.
9417 pub fn from_stub<T>(stub: T) -> Self
9418 where
9419 T: super::stub::PublicAdvertisedPrefixes + 'static,
9420 {
9421 Self {
9422 inner: std::sync::Arc::new(stub),
9423 }
9424 }
9425
9426 pub(crate) async fn new(
9427 config: gaxi::options::ClientConfig,
9428 ) -> gax::client_builder::Result<Self> {
9429 let inner = Self::build_inner(config).await?;
9430 Ok(Self { inner })
9431 }
9432
9433 async fn build_inner(
9434 conf: gaxi::options::ClientConfig,
9435 ) -> gax::client_builder::Result<
9436 std::sync::Arc<dyn super::stub::dynamic::PublicAdvertisedPrefixes>,
9437 > {
9438 if gaxi::options::tracing_enabled(&conf) {
9439 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9440 }
9441 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9442 }
9443
9444 async fn build_transport(
9445 conf: gaxi::options::ClientConfig,
9446 ) -> gax::client_builder::Result<impl super::stub::PublicAdvertisedPrefixes> {
9447 super::transport::PublicAdvertisedPrefixes::new(conf).await
9448 }
9449
9450 async fn build_with_tracing(
9451 conf: gaxi::options::ClientConfig,
9452 ) -> gax::client_builder::Result<impl super::stub::PublicAdvertisedPrefixes> {
9453 Self::build_transport(conf)
9454 .await
9455 .map(super::tracing::PublicAdvertisedPrefixes::new)
9456 }
9457
9458 /// Announces the specified PublicAdvertisedPrefix
9459 pub fn announce(&self) -> super::builder::public_advertised_prefixes::Announce {
9460 super::builder::public_advertised_prefixes::Announce::new(self.inner.clone())
9461 }
9462
9463 /// Deletes the specified PublicAdvertisedPrefix
9464 pub fn delete(&self) -> super::builder::public_advertised_prefixes::Delete {
9465 super::builder::public_advertised_prefixes::Delete::new(self.inner.clone())
9466 }
9467
9468 /// Returns the specified PublicAdvertisedPrefix resource.
9469 pub fn get(&self) -> super::builder::public_advertised_prefixes::Get {
9470 super::builder::public_advertised_prefixes::Get::new(self.inner.clone())
9471 }
9472
9473 /// Creates a PublicAdvertisedPrefix in the specified project
9474 /// using the parameters that are included in the request.
9475 pub fn insert(&self) -> super::builder::public_advertised_prefixes::Insert {
9476 super::builder::public_advertised_prefixes::Insert::new(self.inner.clone())
9477 }
9478
9479 /// Lists the PublicAdvertisedPrefixes for a project.
9480 pub fn list(&self) -> super::builder::public_advertised_prefixes::List {
9481 super::builder::public_advertised_prefixes::List::new(self.inner.clone())
9482 }
9483
9484 /// Patches the specified Router resource with the data included in the
9485 /// request. This method supportsPATCH
9486 /// semantics and usesJSON merge
9487 /// patch format and processing rules.
9488 pub fn patch(&self) -> super::builder::public_advertised_prefixes::Patch {
9489 super::builder::public_advertised_prefixes::Patch::new(self.inner.clone())
9490 }
9491
9492 /// Withdraws the specified PublicAdvertisedPrefix
9493 pub fn withdraw(&self) -> super::builder::public_advertised_prefixes::Withdraw {
9494 super::builder::public_advertised_prefixes::Withdraw::new(self.inner.clone())
9495 }
9496
9497 /// Retrieves the specified Operations resource.
9498 pub fn get_operation(&self) -> super::builder::public_advertised_prefixes::GetOperation {
9499 super::builder::public_advertised_prefixes::GetOperation::new(self.inner.clone())
9500 }
9501}
9502
9503/// Implements a client for the Google Compute Engine API.
9504///
9505/// # Example
9506/// ```
9507/// # tokio_test::block_on(async {
9508/// # use google_cloud_compute_v1::client::PublicDelegatedPrefixes;
9509/// let client = PublicDelegatedPrefixes::builder().build().await?;
9510/// // use `client` to make requests to the Google Compute Engine API.
9511/// # gax::client_builder::Result::<()>::Ok(()) });
9512/// ```
9513///
9514/// # Service Description
9515///
9516/// Service for the `publicDelegatedPrefixes` resource.
9517///
9518/// # Configuration
9519///
9520/// To configure `PublicDelegatedPrefixes` use the `with_*` methods in the type returned
9521/// by [builder()][PublicDelegatedPrefixes::builder]. The default configuration should
9522/// work for most applications. Common configuration changes include
9523///
9524/// * [with_endpoint()]: by default this client uses the global default endpoint
9525/// (`https://compute.googleapis.com`). Applications using regional
9526/// endpoints or running in restricted networks (e.g. a network configured
9527// with [Private Google Access with VPC Service Controls]) may want to
9528/// override this default.
9529/// * [with_credentials()]: by default this client uses
9530/// [Application Default Credentials]. Applications using custom
9531/// authentication may need to override this default.
9532///
9533/// [with_endpoint()]: super::builder::public_delegated_prefixes::ClientBuilder::with_endpoint
9534/// [with_credentials()]: super::builder::public_delegated_prefixes::ClientBuilder::credentials
9535/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9536/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9537///
9538/// # Pooling and Cloning
9539///
9540/// `PublicDelegatedPrefixes` holds a connection pool internally, it is advised to
9541/// create one and the reuse it. You do not need to wrap `PublicDelegatedPrefixes` in
9542/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9543/// already uses an `Arc` internally.
9544#[cfg(feature = "public-delegated-prefixes")]
9545#[cfg_attr(docsrs, doc(cfg(feature = "public-delegated-prefixes")))]
9546#[derive(Clone, Debug)]
9547pub struct PublicDelegatedPrefixes {
9548 inner: std::sync::Arc<dyn super::stub::dynamic::PublicDelegatedPrefixes>,
9549}
9550
9551#[cfg(feature = "public-delegated-prefixes")]
9552impl PublicDelegatedPrefixes {
9553 /// Returns a builder for [PublicDelegatedPrefixes].
9554 ///
9555 /// ```
9556 /// # tokio_test::block_on(async {
9557 /// # use google_cloud_compute_v1::client::PublicDelegatedPrefixes;
9558 /// let client = PublicDelegatedPrefixes::builder().build().await?;
9559 /// # gax::client_builder::Result::<()>::Ok(()) });
9560 /// ```
9561 pub fn builder() -> super::builder::public_delegated_prefixes::ClientBuilder {
9562 gax::client_builder::internal::new_builder(
9563 super::builder::public_delegated_prefixes::client::Factory,
9564 )
9565 }
9566
9567 /// Creates a new client from the provided stub.
9568 ///
9569 /// The most common case for calling this function is in tests mocking the
9570 /// client's behavior.
9571 pub fn from_stub<T>(stub: T) -> Self
9572 where
9573 T: super::stub::PublicDelegatedPrefixes + 'static,
9574 {
9575 Self {
9576 inner: std::sync::Arc::new(stub),
9577 }
9578 }
9579
9580 pub(crate) async fn new(
9581 config: gaxi::options::ClientConfig,
9582 ) -> gax::client_builder::Result<Self> {
9583 let inner = Self::build_inner(config).await?;
9584 Ok(Self { inner })
9585 }
9586
9587 async fn build_inner(
9588 conf: gaxi::options::ClientConfig,
9589 ) -> gax::client_builder::Result<
9590 std::sync::Arc<dyn super::stub::dynamic::PublicDelegatedPrefixes>,
9591 > {
9592 if gaxi::options::tracing_enabled(&conf) {
9593 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9594 }
9595 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9596 }
9597
9598 async fn build_transport(
9599 conf: gaxi::options::ClientConfig,
9600 ) -> gax::client_builder::Result<impl super::stub::PublicDelegatedPrefixes> {
9601 super::transport::PublicDelegatedPrefixes::new(conf).await
9602 }
9603
9604 async fn build_with_tracing(
9605 conf: gaxi::options::ClientConfig,
9606 ) -> gax::client_builder::Result<impl super::stub::PublicDelegatedPrefixes> {
9607 Self::build_transport(conf)
9608 .await
9609 .map(super::tracing::PublicDelegatedPrefixes::new)
9610 }
9611
9612 /// Lists all PublicDelegatedPrefix resources owned by the specific project
9613 /// across all scopes.
9614 ///
9615 /// To prevent failure, Google recommends that you set the
9616 /// `returnPartialSuccess` parameter to `true`.
9617 pub fn aggregated_list(&self) -> super::builder::public_delegated_prefixes::AggregatedList {
9618 super::builder::public_delegated_prefixes::AggregatedList::new(self.inner.clone())
9619 }
9620
9621 /// Announces the specified PublicDelegatedPrefix in the given region.
9622 pub fn announce(&self) -> super::builder::public_delegated_prefixes::Announce {
9623 super::builder::public_delegated_prefixes::Announce::new(self.inner.clone())
9624 }
9625
9626 /// Deletes the specified PublicDelegatedPrefix in the given region.
9627 pub fn delete(&self) -> super::builder::public_delegated_prefixes::Delete {
9628 super::builder::public_delegated_prefixes::Delete::new(self.inner.clone())
9629 }
9630
9631 /// Returns the specified PublicDelegatedPrefix resource in the given region.
9632 pub fn get(&self) -> super::builder::public_delegated_prefixes::Get {
9633 super::builder::public_delegated_prefixes::Get::new(self.inner.clone())
9634 }
9635
9636 /// Creates a PublicDelegatedPrefix in the specified project in the given
9637 /// region using the parameters that are included in the request.
9638 pub fn insert(&self) -> super::builder::public_delegated_prefixes::Insert {
9639 super::builder::public_delegated_prefixes::Insert::new(self.inner.clone())
9640 }
9641
9642 /// Lists the PublicDelegatedPrefixes for a project in the given region.
9643 pub fn list(&self) -> super::builder::public_delegated_prefixes::List {
9644 super::builder::public_delegated_prefixes::List::new(self.inner.clone())
9645 }
9646
9647 /// Patches the specified PublicDelegatedPrefix resource with the data included
9648 /// in the request. This method supportsPATCH
9649 /// semantics and usesJSON merge
9650 /// patch format and processing rules.
9651 pub fn patch(&self) -> super::builder::public_delegated_prefixes::Patch {
9652 super::builder::public_delegated_prefixes::Patch::new(self.inner.clone())
9653 }
9654
9655 /// Withdraws the specified PublicDelegatedPrefix in the given region.
9656 pub fn withdraw(&self) -> super::builder::public_delegated_prefixes::Withdraw {
9657 super::builder::public_delegated_prefixes::Withdraw::new(self.inner.clone())
9658 }
9659
9660 /// Retrieves the specified region-specific Operations resource.
9661 pub fn get_operation(&self) -> super::builder::public_delegated_prefixes::GetOperation {
9662 super::builder::public_delegated_prefixes::GetOperation::new(self.inner.clone())
9663 }
9664}
9665
9666/// Implements a client for the Google Compute Engine API.
9667///
9668/// # Example
9669/// ```
9670/// # tokio_test::block_on(async {
9671/// # use google_cloud_compute_v1::client::RegionAutoscalers;
9672/// let client = RegionAutoscalers::builder().build().await?;
9673/// // use `client` to make requests to the Google Compute Engine API.
9674/// # gax::client_builder::Result::<()>::Ok(()) });
9675/// ```
9676///
9677/// # Service Description
9678///
9679/// Service for the `regionAutoscalers` resource.
9680///
9681/// # Configuration
9682///
9683/// To configure `RegionAutoscalers` use the `with_*` methods in the type returned
9684/// by [builder()][RegionAutoscalers::builder]. The default configuration should
9685/// work for most applications. Common configuration changes include
9686///
9687/// * [with_endpoint()]: by default this client uses the global default endpoint
9688/// (`https://compute.googleapis.com`). Applications using regional
9689/// endpoints or running in restricted networks (e.g. a network configured
9690// with [Private Google Access with VPC Service Controls]) may want to
9691/// override this default.
9692/// * [with_credentials()]: by default this client uses
9693/// [Application Default Credentials]. Applications using custom
9694/// authentication may need to override this default.
9695///
9696/// [with_endpoint()]: super::builder::region_autoscalers::ClientBuilder::with_endpoint
9697/// [with_credentials()]: super::builder::region_autoscalers::ClientBuilder::credentials
9698/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9699/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9700///
9701/// # Pooling and Cloning
9702///
9703/// `RegionAutoscalers` holds a connection pool internally, it is advised to
9704/// create one and the reuse it. You do not need to wrap `RegionAutoscalers` in
9705/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9706/// already uses an `Arc` internally.
9707#[cfg(feature = "region-autoscalers")]
9708#[cfg_attr(docsrs, doc(cfg(feature = "region-autoscalers")))]
9709#[derive(Clone, Debug)]
9710pub struct RegionAutoscalers {
9711 inner: std::sync::Arc<dyn super::stub::dynamic::RegionAutoscalers>,
9712}
9713
9714#[cfg(feature = "region-autoscalers")]
9715impl RegionAutoscalers {
9716 /// Returns a builder for [RegionAutoscalers].
9717 ///
9718 /// ```
9719 /// # tokio_test::block_on(async {
9720 /// # use google_cloud_compute_v1::client::RegionAutoscalers;
9721 /// let client = RegionAutoscalers::builder().build().await?;
9722 /// # gax::client_builder::Result::<()>::Ok(()) });
9723 /// ```
9724 pub fn builder() -> super::builder::region_autoscalers::ClientBuilder {
9725 gax::client_builder::internal::new_builder(
9726 super::builder::region_autoscalers::client::Factory,
9727 )
9728 }
9729
9730 /// Creates a new client from the provided stub.
9731 ///
9732 /// The most common case for calling this function is in tests mocking the
9733 /// client's behavior.
9734 pub fn from_stub<T>(stub: T) -> Self
9735 where
9736 T: super::stub::RegionAutoscalers + 'static,
9737 {
9738 Self {
9739 inner: std::sync::Arc::new(stub),
9740 }
9741 }
9742
9743 pub(crate) async fn new(
9744 config: gaxi::options::ClientConfig,
9745 ) -> gax::client_builder::Result<Self> {
9746 let inner = Self::build_inner(config).await?;
9747 Ok(Self { inner })
9748 }
9749
9750 async fn build_inner(
9751 conf: gaxi::options::ClientConfig,
9752 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionAutoscalers>>
9753 {
9754 if gaxi::options::tracing_enabled(&conf) {
9755 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9756 }
9757 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9758 }
9759
9760 async fn build_transport(
9761 conf: gaxi::options::ClientConfig,
9762 ) -> gax::client_builder::Result<impl super::stub::RegionAutoscalers> {
9763 super::transport::RegionAutoscalers::new(conf).await
9764 }
9765
9766 async fn build_with_tracing(
9767 conf: gaxi::options::ClientConfig,
9768 ) -> gax::client_builder::Result<impl super::stub::RegionAutoscalers> {
9769 Self::build_transport(conf)
9770 .await
9771 .map(super::tracing::RegionAutoscalers::new)
9772 }
9773
9774 /// Deletes the specified autoscaler.
9775 pub fn delete(&self) -> super::builder::region_autoscalers::Delete {
9776 super::builder::region_autoscalers::Delete::new(self.inner.clone())
9777 }
9778
9779 /// Returns the specified autoscaler.
9780 pub fn get(&self) -> super::builder::region_autoscalers::Get {
9781 super::builder::region_autoscalers::Get::new(self.inner.clone())
9782 }
9783
9784 /// Creates an autoscaler in the specified project using
9785 /// the data included in the request.
9786 pub fn insert(&self) -> super::builder::region_autoscalers::Insert {
9787 super::builder::region_autoscalers::Insert::new(self.inner.clone())
9788 }
9789
9790 /// Retrieves a list of autoscalers contained within
9791 /// the specified region.
9792 pub fn list(&self) -> super::builder::region_autoscalers::List {
9793 super::builder::region_autoscalers::List::new(self.inner.clone())
9794 }
9795
9796 /// Updates an autoscaler in the specified project using
9797 /// the data included in the request. This method supportsPATCH
9798 /// semantics and uses theJSON merge
9799 /// patch format and processing rules.
9800 pub fn patch(&self) -> super::builder::region_autoscalers::Patch {
9801 super::builder::region_autoscalers::Patch::new(self.inner.clone())
9802 }
9803
9804 /// Updates an autoscaler in the specified project using
9805 /// the data included in the request.
9806 pub fn update(&self) -> super::builder::region_autoscalers::Update {
9807 super::builder::region_autoscalers::Update::new(self.inner.clone())
9808 }
9809
9810 /// Retrieves the specified region-specific Operations resource.
9811 pub fn get_operation(&self) -> super::builder::region_autoscalers::GetOperation {
9812 super::builder::region_autoscalers::GetOperation::new(self.inner.clone())
9813 }
9814}
9815
9816/// Implements a client for the Google Compute Engine API.
9817///
9818/// # Example
9819/// ```
9820/// # tokio_test::block_on(async {
9821/// # use google_cloud_compute_v1::client::RegionBackendServices;
9822/// let client = RegionBackendServices::builder().build().await?;
9823/// // use `client` to make requests to the Google Compute Engine API.
9824/// # gax::client_builder::Result::<()>::Ok(()) });
9825/// ```
9826///
9827/// # Service Description
9828///
9829/// Service for the `regionBackendServices` resource.
9830///
9831/// # Configuration
9832///
9833/// To configure `RegionBackendServices` use the `with_*` methods in the type returned
9834/// by [builder()][RegionBackendServices::builder]. The default configuration should
9835/// work for most applications. Common configuration changes include
9836///
9837/// * [with_endpoint()]: by default this client uses the global default endpoint
9838/// (`https://compute.googleapis.com`). Applications using regional
9839/// endpoints or running in restricted networks (e.g. a network configured
9840// with [Private Google Access with VPC Service Controls]) may want to
9841/// override this default.
9842/// * [with_credentials()]: by default this client uses
9843/// [Application Default Credentials]. Applications using custom
9844/// authentication may need to override this default.
9845///
9846/// [with_endpoint()]: super::builder::region_backend_services::ClientBuilder::with_endpoint
9847/// [with_credentials()]: super::builder::region_backend_services::ClientBuilder::credentials
9848/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
9849/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
9850///
9851/// # Pooling and Cloning
9852///
9853/// `RegionBackendServices` holds a connection pool internally, it is advised to
9854/// create one and the reuse it. You do not need to wrap `RegionBackendServices` in
9855/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
9856/// already uses an `Arc` internally.
9857#[cfg(feature = "region-backend-services")]
9858#[cfg_attr(docsrs, doc(cfg(feature = "region-backend-services")))]
9859#[derive(Clone, Debug)]
9860pub struct RegionBackendServices {
9861 inner: std::sync::Arc<dyn super::stub::dynamic::RegionBackendServices>,
9862}
9863
9864#[cfg(feature = "region-backend-services")]
9865impl RegionBackendServices {
9866 /// Returns a builder for [RegionBackendServices].
9867 ///
9868 /// ```
9869 /// # tokio_test::block_on(async {
9870 /// # use google_cloud_compute_v1::client::RegionBackendServices;
9871 /// let client = RegionBackendServices::builder().build().await?;
9872 /// # gax::client_builder::Result::<()>::Ok(()) });
9873 /// ```
9874 pub fn builder() -> super::builder::region_backend_services::ClientBuilder {
9875 gax::client_builder::internal::new_builder(
9876 super::builder::region_backend_services::client::Factory,
9877 )
9878 }
9879
9880 /// Creates a new client from the provided stub.
9881 ///
9882 /// The most common case for calling this function is in tests mocking the
9883 /// client's behavior.
9884 pub fn from_stub<T>(stub: T) -> Self
9885 where
9886 T: super::stub::RegionBackendServices + 'static,
9887 {
9888 Self {
9889 inner: std::sync::Arc::new(stub),
9890 }
9891 }
9892
9893 pub(crate) async fn new(
9894 config: gaxi::options::ClientConfig,
9895 ) -> gax::client_builder::Result<Self> {
9896 let inner = Self::build_inner(config).await?;
9897 Ok(Self { inner })
9898 }
9899
9900 async fn build_inner(
9901 conf: gaxi::options::ClientConfig,
9902 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionBackendServices>>
9903 {
9904 if gaxi::options::tracing_enabled(&conf) {
9905 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
9906 }
9907 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
9908 }
9909
9910 async fn build_transport(
9911 conf: gaxi::options::ClientConfig,
9912 ) -> gax::client_builder::Result<impl super::stub::RegionBackendServices> {
9913 super::transport::RegionBackendServices::new(conf).await
9914 }
9915
9916 async fn build_with_tracing(
9917 conf: gaxi::options::ClientConfig,
9918 ) -> gax::client_builder::Result<impl super::stub::RegionBackendServices> {
9919 Self::build_transport(conf)
9920 .await
9921 .map(super::tracing::RegionBackendServices::new)
9922 }
9923
9924 /// Deletes the specified regional BackendService resource.
9925 pub fn delete(&self) -> super::builder::region_backend_services::Delete {
9926 super::builder::region_backend_services::Delete::new(self.inner.clone())
9927 }
9928
9929 /// Returns the specified regional BackendService resource.
9930 pub fn get(&self) -> super::builder::region_backend_services::Get {
9931 super::builder::region_backend_services::Get::new(self.inner.clone())
9932 }
9933
9934 /// Gets the most recent health check results for this
9935 /// regional BackendService.
9936 pub fn get_health(&self) -> super::builder::region_backend_services::GetHealth {
9937 super::builder::region_backend_services::GetHealth::new(self.inner.clone())
9938 }
9939
9940 /// Gets the access control policy for a resource. May be empty if no such
9941 /// policy or resource exists.
9942 pub fn get_iam_policy(&self) -> super::builder::region_backend_services::GetIamPolicy {
9943 super::builder::region_backend_services::GetIamPolicy::new(self.inner.clone())
9944 }
9945
9946 /// Creates a regional BackendService resource in the specified project using
9947 /// the data included in the request. For more information, see
9948 /// Backend services overview.
9949 pub fn insert(&self) -> super::builder::region_backend_services::Insert {
9950 super::builder::region_backend_services::Insert::new(self.inner.clone())
9951 }
9952
9953 /// Retrieves the list of regional BackendService resources available to the
9954 /// specified project in the given region.
9955 pub fn list(&self) -> super::builder::region_backend_services::List {
9956 super::builder::region_backend_services::List::new(self.inner.clone())
9957 }
9958
9959 /// Retrieves a list of all usable backend services in the specified project in
9960 /// the given region.
9961 pub fn list_usable(&self) -> super::builder::region_backend_services::ListUsable {
9962 super::builder::region_backend_services::ListUsable::new(self.inner.clone())
9963 }
9964
9965 /// Updates the specified regional BackendService resource with the data
9966 /// included in the request. For more information, see
9967 /// Understanding backend services This method
9968 /// supports PATCH semantics and uses the JSON merge
9969 /// patch format and processing rules.
9970 pub fn patch(&self) -> super::builder::region_backend_services::Patch {
9971 super::builder::region_backend_services::Patch::new(self.inner.clone())
9972 }
9973
9974 /// Sets the access control policy on the specified resource.
9975 /// Replaces any existing policy.
9976 pub fn set_iam_policy(&self) -> super::builder::region_backend_services::SetIamPolicy {
9977 super::builder::region_backend_services::SetIamPolicy::new(self.inner.clone())
9978 }
9979
9980 /// Sets the Google Cloud Armor security policy for the specified backend
9981 /// service. For more information, seeGoogle
9982 /// Cloud Armor Overview
9983 pub fn set_security_policy(
9984 &self,
9985 ) -> super::builder::region_backend_services::SetSecurityPolicy {
9986 super::builder::region_backend_services::SetSecurityPolicy::new(self.inner.clone())
9987 }
9988
9989 /// Returns permissions that a caller has on the specified resource.
9990 pub fn test_iam_permissions(
9991 &self,
9992 ) -> super::builder::region_backend_services::TestIamPermissions {
9993 super::builder::region_backend_services::TestIamPermissions::new(self.inner.clone())
9994 }
9995
9996 /// Updates the specified regional BackendService resource with the data
9997 /// included in the request. For more information,
9998 /// see
9999 /// Backend services overview.
10000 pub fn update(&self) -> super::builder::region_backend_services::Update {
10001 super::builder::region_backend_services::Update::new(self.inner.clone())
10002 }
10003
10004 /// Retrieves the specified region-specific Operations resource.
10005 pub fn get_operation(&self) -> super::builder::region_backend_services::GetOperation {
10006 super::builder::region_backend_services::GetOperation::new(self.inner.clone())
10007 }
10008}
10009
10010/// Implements a client for the Google Compute Engine API.
10011///
10012/// # Example
10013/// ```
10014/// # tokio_test::block_on(async {
10015/// # use google_cloud_compute_v1::client::RegionCommitments;
10016/// let client = RegionCommitments::builder().build().await?;
10017/// // use `client` to make requests to the Google Compute Engine API.
10018/// # gax::client_builder::Result::<()>::Ok(()) });
10019/// ```
10020///
10021/// # Service Description
10022///
10023/// Service for the `regionCommitments` resource.
10024///
10025/// # Configuration
10026///
10027/// To configure `RegionCommitments` use the `with_*` methods in the type returned
10028/// by [builder()][RegionCommitments::builder]. The default configuration should
10029/// work for most applications. Common configuration changes include
10030///
10031/// * [with_endpoint()]: by default this client uses the global default endpoint
10032/// (`https://compute.googleapis.com`). Applications using regional
10033/// endpoints or running in restricted networks (e.g. a network configured
10034// with [Private Google Access with VPC Service Controls]) may want to
10035/// override this default.
10036/// * [with_credentials()]: by default this client uses
10037/// [Application Default Credentials]. Applications using custom
10038/// authentication may need to override this default.
10039///
10040/// [with_endpoint()]: super::builder::region_commitments::ClientBuilder::with_endpoint
10041/// [with_credentials()]: super::builder::region_commitments::ClientBuilder::credentials
10042/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10043/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10044///
10045/// # Pooling and Cloning
10046///
10047/// `RegionCommitments` holds a connection pool internally, it is advised to
10048/// create one and the reuse it. You do not need to wrap `RegionCommitments` in
10049/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10050/// already uses an `Arc` internally.
10051#[cfg(feature = "region-commitments")]
10052#[cfg_attr(docsrs, doc(cfg(feature = "region-commitments")))]
10053#[derive(Clone, Debug)]
10054pub struct RegionCommitments {
10055 inner: std::sync::Arc<dyn super::stub::dynamic::RegionCommitments>,
10056}
10057
10058#[cfg(feature = "region-commitments")]
10059impl RegionCommitments {
10060 /// Returns a builder for [RegionCommitments].
10061 ///
10062 /// ```
10063 /// # tokio_test::block_on(async {
10064 /// # use google_cloud_compute_v1::client::RegionCommitments;
10065 /// let client = RegionCommitments::builder().build().await?;
10066 /// # gax::client_builder::Result::<()>::Ok(()) });
10067 /// ```
10068 pub fn builder() -> super::builder::region_commitments::ClientBuilder {
10069 gax::client_builder::internal::new_builder(
10070 super::builder::region_commitments::client::Factory,
10071 )
10072 }
10073
10074 /// Creates a new client from the provided stub.
10075 ///
10076 /// The most common case for calling this function is in tests mocking the
10077 /// client's behavior.
10078 pub fn from_stub<T>(stub: T) -> Self
10079 where
10080 T: super::stub::RegionCommitments + 'static,
10081 {
10082 Self {
10083 inner: std::sync::Arc::new(stub),
10084 }
10085 }
10086
10087 pub(crate) async fn new(
10088 config: gaxi::options::ClientConfig,
10089 ) -> gax::client_builder::Result<Self> {
10090 let inner = Self::build_inner(config).await?;
10091 Ok(Self { inner })
10092 }
10093
10094 async fn build_inner(
10095 conf: gaxi::options::ClientConfig,
10096 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionCommitments>>
10097 {
10098 if gaxi::options::tracing_enabled(&conf) {
10099 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10100 }
10101 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10102 }
10103
10104 async fn build_transport(
10105 conf: gaxi::options::ClientConfig,
10106 ) -> gax::client_builder::Result<impl super::stub::RegionCommitments> {
10107 super::transport::RegionCommitments::new(conf).await
10108 }
10109
10110 async fn build_with_tracing(
10111 conf: gaxi::options::ClientConfig,
10112 ) -> gax::client_builder::Result<impl super::stub::RegionCommitments> {
10113 Self::build_transport(conf)
10114 .await
10115 .map(super::tracing::RegionCommitments::new)
10116 }
10117
10118 /// Retrieves an aggregated list of commitments by region.
10119 ///
10120 /// To prevent failure, Google recommends that you set the
10121 /// `returnPartialSuccess` parameter to `true`.
10122 pub fn aggregated_list(&self) -> super::builder::region_commitments::AggregatedList {
10123 super::builder::region_commitments::AggregatedList::new(self.inner.clone())
10124 }
10125
10126 /// Returns the specified commitment resource.
10127 pub fn get(&self) -> super::builder::region_commitments::Get {
10128 super::builder::region_commitments::Get::new(self.inner.clone())
10129 }
10130
10131 /// Creates a commitment in the specified project using the data
10132 /// included in the request.
10133 pub fn insert(&self) -> super::builder::region_commitments::Insert {
10134 super::builder::region_commitments::Insert::new(self.inner.clone())
10135 }
10136
10137 /// Retrieves a list of commitments contained within
10138 /// the specified region.
10139 pub fn list(&self) -> super::builder::region_commitments::List {
10140 super::builder::region_commitments::List::new(self.inner.clone())
10141 }
10142
10143 /// Updates the specified commitment with the data included in the request.
10144 /// Update is performed only on selected fields included as part of
10145 /// update-mask. Only the following fields can be updated: auto_renew and plan.
10146 pub fn update(&self) -> super::builder::region_commitments::Update {
10147 super::builder::region_commitments::Update::new(self.inner.clone())
10148 }
10149
10150 /// Retrieves the specified region-specific Operations resource.
10151 pub fn get_operation(&self) -> super::builder::region_commitments::GetOperation {
10152 super::builder::region_commitments::GetOperation::new(self.inner.clone())
10153 }
10154}
10155
10156/// Implements a client for the Google Compute Engine API.
10157///
10158/// # Example
10159/// ```
10160/// # tokio_test::block_on(async {
10161/// # use google_cloud_compute_v1::client::RegionDiskTypes;
10162/// let client = RegionDiskTypes::builder().build().await?;
10163/// // use `client` to make requests to the Google Compute Engine API.
10164/// # gax::client_builder::Result::<()>::Ok(()) });
10165/// ```
10166///
10167/// # Service Description
10168///
10169/// Service for the `regionDiskTypes` resource.
10170///
10171/// # Configuration
10172///
10173/// To configure `RegionDiskTypes` use the `with_*` methods in the type returned
10174/// by [builder()][RegionDiskTypes::builder]. The default configuration should
10175/// work for most applications. Common configuration changes include
10176///
10177/// * [with_endpoint()]: by default this client uses the global default endpoint
10178/// (`https://compute.googleapis.com`). Applications using regional
10179/// endpoints or running in restricted networks (e.g. a network configured
10180// with [Private Google Access with VPC Service Controls]) may want to
10181/// override this default.
10182/// * [with_credentials()]: by default this client uses
10183/// [Application Default Credentials]. Applications using custom
10184/// authentication may need to override this default.
10185///
10186/// [with_endpoint()]: super::builder::region_disk_types::ClientBuilder::with_endpoint
10187/// [with_credentials()]: super::builder::region_disk_types::ClientBuilder::credentials
10188/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10189/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10190///
10191/// # Pooling and Cloning
10192///
10193/// `RegionDiskTypes` holds a connection pool internally, it is advised to
10194/// create one and the reuse it. You do not need to wrap `RegionDiskTypes` in
10195/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10196/// already uses an `Arc` internally.
10197#[cfg(feature = "region-disk-types")]
10198#[cfg_attr(docsrs, doc(cfg(feature = "region-disk-types")))]
10199#[derive(Clone, Debug)]
10200pub struct RegionDiskTypes {
10201 inner: std::sync::Arc<dyn super::stub::dynamic::RegionDiskTypes>,
10202}
10203
10204#[cfg(feature = "region-disk-types")]
10205impl RegionDiskTypes {
10206 /// Returns a builder for [RegionDiskTypes].
10207 ///
10208 /// ```
10209 /// # tokio_test::block_on(async {
10210 /// # use google_cloud_compute_v1::client::RegionDiskTypes;
10211 /// let client = RegionDiskTypes::builder().build().await?;
10212 /// # gax::client_builder::Result::<()>::Ok(()) });
10213 /// ```
10214 pub fn builder() -> super::builder::region_disk_types::ClientBuilder {
10215 gax::client_builder::internal::new_builder(
10216 super::builder::region_disk_types::client::Factory,
10217 )
10218 }
10219
10220 /// Creates a new client from the provided stub.
10221 ///
10222 /// The most common case for calling this function is in tests mocking the
10223 /// client's behavior.
10224 pub fn from_stub<T>(stub: T) -> Self
10225 where
10226 T: super::stub::RegionDiskTypes + 'static,
10227 {
10228 Self {
10229 inner: std::sync::Arc::new(stub),
10230 }
10231 }
10232
10233 pub(crate) async fn new(
10234 config: gaxi::options::ClientConfig,
10235 ) -> gax::client_builder::Result<Self> {
10236 let inner = Self::build_inner(config).await?;
10237 Ok(Self { inner })
10238 }
10239
10240 async fn build_inner(
10241 conf: gaxi::options::ClientConfig,
10242 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionDiskTypes>>
10243 {
10244 if gaxi::options::tracing_enabled(&conf) {
10245 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10246 }
10247 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10248 }
10249
10250 async fn build_transport(
10251 conf: gaxi::options::ClientConfig,
10252 ) -> gax::client_builder::Result<impl super::stub::RegionDiskTypes> {
10253 super::transport::RegionDiskTypes::new(conf).await
10254 }
10255
10256 async fn build_with_tracing(
10257 conf: gaxi::options::ClientConfig,
10258 ) -> gax::client_builder::Result<impl super::stub::RegionDiskTypes> {
10259 Self::build_transport(conf)
10260 .await
10261 .map(super::tracing::RegionDiskTypes::new)
10262 }
10263
10264 /// Returns the specified regional disk type.
10265 pub fn get(&self) -> super::builder::region_disk_types::Get {
10266 super::builder::region_disk_types::Get::new(self.inner.clone())
10267 }
10268
10269 /// Retrieves a list of regional disk types available to the specified project.
10270 pub fn list(&self) -> super::builder::region_disk_types::List {
10271 super::builder::region_disk_types::List::new(self.inner.clone())
10272 }
10273}
10274
10275/// Implements a client for the Google Compute Engine API.
10276///
10277/// # Example
10278/// ```
10279/// # tokio_test::block_on(async {
10280/// # use google_cloud_compute_v1::client::RegionDisks;
10281/// let client = RegionDisks::builder().build().await?;
10282/// // use `client` to make requests to the Google Compute Engine API.
10283/// # gax::client_builder::Result::<()>::Ok(()) });
10284/// ```
10285///
10286/// # Service Description
10287///
10288/// Service for the `regionDisks` resource.
10289///
10290/// # Configuration
10291///
10292/// To configure `RegionDisks` use the `with_*` methods in the type returned
10293/// by [builder()][RegionDisks::builder]. The default configuration should
10294/// work for most applications. Common configuration changes include
10295///
10296/// * [with_endpoint()]: by default this client uses the global default endpoint
10297/// (`https://compute.googleapis.com`). Applications using regional
10298/// endpoints or running in restricted networks (e.g. a network configured
10299// with [Private Google Access with VPC Service Controls]) may want to
10300/// override this default.
10301/// * [with_credentials()]: by default this client uses
10302/// [Application Default Credentials]. Applications using custom
10303/// authentication may need to override this default.
10304///
10305/// [with_endpoint()]: super::builder::region_disks::ClientBuilder::with_endpoint
10306/// [with_credentials()]: super::builder::region_disks::ClientBuilder::credentials
10307/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10308/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10309///
10310/// # Pooling and Cloning
10311///
10312/// `RegionDisks` holds a connection pool internally, it is advised to
10313/// create one and the reuse it. You do not need to wrap `RegionDisks` in
10314/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10315/// already uses an `Arc` internally.
10316#[cfg(feature = "region-disks")]
10317#[cfg_attr(docsrs, doc(cfg(feature = "region-disks")))]
10318#[derive(Clone, Debug)]
10319pub struct RegionDisks {
10320 inner: std::sync::Arc<dyn super::stub::dynamic::RegionDisks>,
10321}
10322
10323#[cfg(feature = "region-disks")]
10324impl RegionDisks {
10325 /// Returns a builder for [RegionDisks].
10326 ///
10327 /// ```
10328 /// # tokio_test::block_on(async {
10329 /// # use google_cloud_compute_v1::client::RegionDisks;
10330 /// let client = RegionDisks::builder().build().await?;
10331 /// # gax::client_builder::Result::<()>::Ok(()) });
10332 /// ```
10333 pub fn builder() -> super::builder::region_disks::ClientBuilder {
10334 gax::client_builder::internal::new_builder(super::builder::region_disks::client::Factory)
10335 }
10336
10337 /// Creates a new client from the provided stub.
10338 ///
10339 /// The most common case for calling this function is in tests mocking the
10340 /// client's behavior.
10341 pub fn from_stub<T>(stub: T) -> Self
10342 where
10343 T: super::stub::RegionDisks + 'static,
10344 {
10345 Self {
10346 inner: std::sync::Arc::new(stub),
10347 }
10348 }
10349
10350 pub(crate) async fn new(
10351 config: gaxi::options::ClientConfig,
10352 ) -> gax::client_builder::Result<Self> {
10353 let inner = Self::build_inner(config).await?;
10354 Ok(Self { inner })
10355 }
10356
10357 async fn build_inner(
10358 conf: gaxi::options::ClientConfig,
10359 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionDisks>> {
10360 if gaxi::options::tracing_enabled(&conf) {
10361 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10362 }
10363 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10364 }
10365
10366 async fn build_transport(
10367 conf: gaxi::options::ClientConfig,
10368 ) -> gax::client_builder::Result<impl super::stub::RegionDisks> {
10369 super::transport::RegionDisks::new(conf).await
10370 }
10371
10372 async fn build_with_tracing(
10373 conf: gaxi::options::ClientConfig,
10374 ) -> gax::client_builder::Result<impl super::stub::RegionDisks> {
10375 Self::build_transport(conf)
10376 .await
10377 .map(super::tracing::RegionDisks::new)
10378 }
10379
10380 /// Adds existing resource policies to a regional disk. You can only add one
10381 /// policy which will be applied to this disk for scheduling snapshot
10382 /// creation.
10383 pub fn add_resource_policies(&self) -> super::builder::region_disks::AddResourcePolicies {
10384 super::builder::region_disks::AddResourcePolicies::new(self.inner.clone())
10385 }
10386
10387 /// Bulk create a set of disks.
10388 pub fn bulk_insert(&self) -> super::builder::region_disks::BulkInsert {
10389 super::builder::region_disks::BulkInsert::new(self.inner.clone())
10390 }
10391
10392 /// Creates a snapshot of a specified persistent disk. For regular snapshot
10393 /// creation, consider using snapshots.insert
10394 /// instead, as that method supports more features, such as creating snapshots
10395 /// in a project different from the source disk project.
10396 pub fn create_snapshot(&self) -> super::builder::region_disks::CreateSnapshot {
10397 super::builder::region_disks::CreateSnapshot::new(self.inner.clone())
10398 }
10399
10400 /// Deletes the specified regional persistent disk. Deleting a regional disk
10401 /// removes all the replicas of its data permanently and is irreversible.
10402 /// However, deleting a disk does not delete anysnapshots
10403 /// previously made from the disk. You must separatelydelete
10404 /// snapshots.
10405 pub fn delete(&self) -> super::builder::region_disks::Delete {
10406 super::builder::region_disks::Delete::new(self.inner.clone())
10407 }
10408
10409 /// Returns a specified regional persistent disk.
10410 pub fn get(&self) -> super::builder::region_disks::Get {
10411 super::builder::region_disks::Get::new(self.inner.clone())
10412 }
10413
10414 /// Gets the access control policy for a resource. May be empty if no such
10415 /// policy or resource exists.
10416 pub fn get_iam_policy(&self) -> super::builder::region_disks::GetIamPolicy {
10417 super::builder::region_disks::GetIamPolicy::new(self.inner.clone())
10418 }
10419
10420 /// Creates a persistent regional disk in the specified project using the data
10421 /// included in the request.
10422 pub fn insert(&self) -> super::builder::region_disks::Insert {
10423 super::builder::region_disks::Insert::new(self.inner.clone())
10424 }
10425
10426 /// Retrieves the list of persistent disks contained within
10427 /// the specified region.
10428 pub fn list(&self) -> super::builder::region_disks::List {
10429 super::builder::region_disks::List::new(self.inner.clone())
10430 }
10431
10432 /// Removes resource policies from a regional disk.
10433 pub fn remove_resource_policies(&self) -> super::builder::region_disks::RemoveResourcePolicies {
10434 super::builder::region_disks::RemoveResourcePolicies::new(self.inner.clone())
10435 }
10436
10437 /// Resizes the specified regional persistent disk.
10438 pub fn resize(&self) -> super::builder::region_disks::Resize {
10439 super::builder::region_disks::Resize::new(self.inner.clone())
10440 }
10441
10442 /// Sets the access control policy on the specified resource.
10443 /// Replaces any existing policy.
10444 pub fn set_iam_policy(&self) -> super::builder::region_disks::SetIamPolicy {
10445 super::builder::region_disks::SetIamPolicy::new(self.inner.clone())
10446 }
10447
10448 /// Sets the labels on the target regional disk.
10449 pub fn set_labels(&self) -> super::builder::region_disks::SetLabels {
10450 super::builder::region_disks::SetLabels::new(self.inner.clone())
10451 }
10452
10453 /// Starts asynchronous replication.
10454 /// Must be invoked on the primary disk.
10455 pub fn start_async_replication(&self) -> super::builder::region_disks::StartAsyncReplication {
10456 super::builder::region_disks::StartAsyncReplication::new(self.inner.clone())
10457 }
10458
10459 /// Stops asynchronous replication.
10460 /// Can be invoked either on the primary or on the secondary disk.
10461 pub fn stop_async_replication(&self) -> super::builder::region_disks::StopAsyncReplication {
10462 super::builder::region_disks::StopAsyncReplication::new(self.inner.clone())
10463 }
10464
10465 /// Stops asynchronous replication for a consistency group of disks.
10466 /// Can be invoked either in the primary or secondary scope.
10467 pub fn stop_group_async_replication(
10468 &self,
10469 ) -> super::builder::region_disks::StopGroupAsyncReplication {
10470 super::builder::region_disks::StopGroupAsyncReplication::new(self.inner.clone())
10471 }
10472
10473 /// Returns permissions that a caller has on the specified resource.
10474 pub fn test_iam_permissions(&self) -> super::builder::region_disks::TestIamPermissions {
10475 super::builder::region_disks::TestIamPermissions::new(self.inner.clone())
10476 }
10477
10478 /// Update the specified disk with the data included in the request. Update is
10479 /// performed only on selected fields included as part of update-mask. Only the
10480 /// following fields can be modified: user_license.
10481 pub fn update(&self) -> super::builder::region_disks::Update {
10482 super::builder::region_disks::Update::new(self.inner.clone())
10483 }
10484
10485 /// Retrieves the specified region-specific Operations resource.
10486 pub fn get_operation(&self) -> super::builder::region_disks::GetOperation {
10487 super::builder::region_disks::GetOperation::new(self.inner.clone())
10488 }
10489}
10490
10491/// Implements a client for the Google Compute Engine API.
10492///
10493/// # Example
10494/// ```
10495/// # tokio_test::block_on(async {
10496/// # use google_cloud_compute_v1::client::RegionHealthCheckServices;
10497/// let client = RegionHealthCheckServices::builder().build().await?;
10498/// // use `client` to make requests to the Google Compute Engine API.
10499/// # gax::client_builder::Result::<()>::Ok(()) });
10500/// ```
10501///
10502/// # Service Description
10503///
10504/// Service for the `regionHealthCheckServices` resource.
10505///
10506/// # Configuration
10507///
10508/// To configure `RegionHealthCheckServices` use the `with_*` methods in the type returned
10509/// by [builder()][RegionHealthCheckServices::builder]. The default configuration should
10510/// work for most applications. Common configuration changes include
10511///
10512/// * [with_endpoint()]: by default this client uses the global default endpoint
10513/// (`https://compute.googleapis.com`). Applications using regional
10514/// endpoints or running in restricted networks (e.g. a network configured
10515// with [Private Google Access with VPC Service Controls]) may want to
10516/// override this default.
10517/// * [with_credentials()]: by default this client uses
10518/// [Application Default Credentials]. Applications using custom
10519/// authentication may need to override this default.
10520///
10521/// [with_endpoint()]: super::builder::region_health_check_services::ClientBuilder::with_endpoint
10522/// [with_credentials()]: super::builder::region_health_check_services::ClientBuilder::credentials
10523/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10524/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10525///
10526/// # Pooling and Cloning
10527///
10528/// `RegionHealthCheckServices` holds a connection pool internally, it is advised to
10529/// create one and the reuse it. You do not need to wrap `RegionHealthCheckServices` in
10530/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10531/// already uses an `Arc` internally.
10532#[cfg(feature = "region-health-check-services")]
10533#[cfg_attr(docsrs, doc(cfg(feature = "region-health-check-services")))]
10534#[derive(Clone, Debug)]
10535pub struct RegionHealthCheckServices {
10536 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthCheckServices>,
10537}
10538
10539#[cfg(feature = "region-health-check-services")]
10540impl RegionHealthCheckServices {
10541 /// Returns a builder for [RegionHealthCheckServices].
10542 ///
10543 /// ```
10544 /// # tokio_test::block_on(async {
10545 /// # use google_cloud_compute_v1::client::RegionHealthCheckServices;
10546 /// let client = RegionHealthCheckServices::builder().build().await?;
10547 /// # gax::client_builder::Result::<()>::Ok(()) });
10548 /// ```
10549 pub fn builder() -> super::builder::region_health_check_services::ClientBuilder {
10550 gax::client_builder::internal::new_builder(
10551 super::builder::region_health_check_services::client::Factory,
10552 )
10553 }
10554
10555 /// Creates a new client from the provided stub.
10556 ///
10557 /// The most common case for calling this function is in tests mocking the
10558 /// client's behavior.
10559 pub fn from_stub<T>(stub: T) -> Self
10560 where
10561 T: super::stub::RegionHealthCheckServices + 'static,
10562 {
10563 Self {
10564 inner: std::sync::Arc::new(stub),
10565 }
10566 }
10567
10568 pub(crate) async fn new(
10569 config: gaxi::options::ClientConfig,
10570 ) -> gax::client_builder::Result<Self> {
10571 let inner = Self::build_inner(config).await?;
10572 Ok(Self { inner })
10573 }
10574
10575 async fn build_inner(
10576 conf: gaxi::options::ClientConfig,
10577 ) -> gax::client_builder::Result<
10578 std::sync::Arc<dyn super::stub::dynamic::RegionHealthCheckServices>,
10579 > {
10580 if gaxi::options::tracing_enabled(&conf) {
10581 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10582 }
10583 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10584 }
10585
10586 async fn build_transport(
10587 conf: gaxi::options::ClientConfig,
10588 ) -> gax::client_builder::Result<impl super::stub::RegionHealthCheckServices> {
10589 super::transport::RegionHealthCheckServices::new(conf).await
10590 }
10591
10592 async fn build_with_tracing(
10593 conf: gaxi::options::ClientConfig,
10594 ) -> gax::client_builder::Result<impl super::stub::RegionHealthCheckServices> {
10595 Self::build_transport(conf)
10596 .await
10597 .map(super::tracing::RegionHealthCheckServices::new)
10598 }
10599
10600 /// Deletes the specified regional HealthCheckService.
10601 pub fn delete(&self) -> super::builder::region_health_check_services::Delete {
10602 super::builder::region_health_check_services::Delete::new(self.inner.clone())
10603 }
10604
10605 /// Returns the specified regional HealthCheckService resource.
10606 pub fn get(&self) -> super::builder::region_health_check_services::Get {
10607 super::builder::region_health_check_services::Get::new(self.inner.clone())
10608 }
10609
10610 /// Creates a regional HealthCheckService resource in the
10611 /// specified project and region using the data included in the request.
10612 pub fn insert(&self) -> super::builder::region_health_check_services::Insert {
10613 super::builder::region_health_check_services::Insert::new(self.inner.clone())
10614 }
10615
10616 /// Lists all the HealthCheckService resources that have been
10617 /// configured for the specified project in the given region.
10618 pub fn list(&self) -> super::builder::region_health_check_services::List {
10619 super::builder::region_health_check_services::List::new(self.inner.clone())
10620 }
10621
10622 /// Updates the specified regional HealthCheckService resource
10623 /// with the data included in the request. This method supportsPATCH
10624 /// semantics and uses theJSON merge
10625 /// patch format and processing rules.
10626 pub fn patch(&self) -> super::builder::region_health_check_services::Patch {
10627 super::builder::region_health_check_services::Patch::new(self.inner.clone())
10628 }
10629
10630 /// Retrieves the specified region-specific Operations resource.
10631 pub fn get_operation(&self) -> super::builder::region_health_check_services::GetOperation {
10632 super::builder::region_health_check_services::GetOperation::new(self.inner.clone())
10633 }
10634}
10635
10636/// Implements a client for the Google Compute Engine API.
10637///
10638/// # Example
10639/// ```
10640/// # tokio_test::block_on(async {
10641/// # use google_cloud_compute_v1::client::RegionHealthChecks;
10642/// let client = RegionHealthChecks::builder().build().await?;
10643/// // use `client` to make requests to the Google Compute Engine API.
10644/// # gax::client_builder::Result::<()>::Ok(()) });
10645/// ```
10646///
10647/// # Service Description
10648///
10649/// Service for the `regionHealthChecks` resource.
10650///
10651/// # Configuration
10652///
10653/// To configure `RegionHealthChecks` use the `with_*` methods in the type returned
10654/// by [builder()][RegionHealthChecks::builder]. The default configuration should
10655/// work for most applications. Common configuration changes include
10656///
10657/// * [with_endpoint()]: by default this client uses the global default endpoint
10658/// (`https://compute.googleapis.com`). Applications using regional
10659/// endpoints or running in restricted networks (e.g. a network configured
10660// with [Private Google Access with VPC Service Controls]) may want to
10661/// override this default.
10662/// * [with_credentials()]: by default this client uses
10663/// [Application Default Credentials]. Applications using custom
10664/// authentication may need to override this default.
10665///
10666/// [with_endpoint()]: super::builder::region_health_checks::ClientBuilder::with_endpoint
10667/// [with_credentials()]: super::builder::region_health_checks::ClientBuilder::credentials
10668/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10669/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10670///
10671/// # Pooling and Cloning
10672///
10673/// `RegionHealthChecks` holds a connection pool internally, it is advised to
10674/// create one and the reuse it. You do not need to wrap `RegionHealthChecks` in
10675/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10676/// already uses an `Arc` internally.
10677#[cfg(feature = "region-health-checks")]
10678#[cfg_attr(docsrs, doc(cfg(feature = "region-health-checks")))]
10679#[derive(Clone, Debug)]
10680pub struct RegionHealthChecks {
10681 inner: std::sync::Arc<dyn super::stub::dynamic::RegionHealthChecks>,
10682}
10683
10684#[cfg(feature = "region-health-checks")]
10685impl RegionHealthChecks {
10686 /// Returns a builder for [RegionHealthChecks].
10687 ///
10688 /// ```
10689 /// # tokio_test::block_on(async {
10690 /// # use google_cloud_compute_v1::client::RegionHealthChecks;
10691 /// let client = RegionHealthChecks::builder().build().await?;
10692 /// # gax::client_builder::Result::<()>::Ok(()) });
10693 /// ```
10694 pub fn builder() -> super::builder::region_health_checks::ClientBuilder {
10695 gax::client_builder::internal::new_builder(
10696 super::builder::region_health_checks::client::Factory,
10697 )
10698 }
10699
10700 /// Creates a new client from the provided stub.
10701 ///
10702 /// The most common case for calling this function is in tests mocking the
10703 /// client's behavior.
10704 pub fn from_stub<T>(stub: T) -> Self
10705 where
10706 T: super::stub::RegionHealthChecks + 'static,
10707 {
10708 Self {
10709 inner: std::sync::Arc::new(stub),
10710 }
10711 }
10712
10713 pub(crate) async fn new(
10714 config: gaxi::options::ClientConfig,
10715 ) -> gax::client_builder::Result<Self> {
10716 let inner = Self::build_inner(config).await?;
10717 Ok(Self { inner })
10718 }
10719
10720 async fn build_inner(
10721 conf: gaxi::options::ClientConfig,
10722 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionHealthChecks>>
10723 {
10724 if gaxi::options::tracing_enabled(&conf) {
10725 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10726 }
10727 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10728 }
10729
10730 async fn build_transport(
10731 conf: gaxi::options::ClientConfig,
10732 ) -> gax::client_builder::Result<impl super::stub::RegionHealthChecks> {
10733 super::transport::RegionHealthChecks::new(conf).await
10734 }
10735
10736 async fn build_with_tracing(
10737 conf: gaxi::options::ClientConfig,
10738 ) -> gax::client_builder::Result<impl super::stub::RegionHealthChecks> {
10739 Self::build_transport(conf)
10740 .await
10741 .map(super::tracing::RegionHealthChecks::new)
10742 }
10743
10744 /// Deletes the specified HealthCheck resource.
10745 pub fn delete(&self) -> super::builder::region_health_checks::Delete {
10746 super::builder::region_health_checks::Delete::new(self.inner.clone())
10747 }
10748
10749 /// Returns the specified HealthCheck resource.
10750 pub fn get(&self) -> super::builder::region_health_checks::Get {
10751 super::builder::region_health_checks::Get::new(self.inner.clone())
10752 }
10753
10754 /// Creates a HealthCheck resource in the specified project using the data
10755 /// included in the request.
10756 pub fn insert(&self) -> super::builder::region_health_checks::Insert {
10757 super::builder::region_health_checks::Insert::new(self.inner.clone())
10758 }
10759
10760 /// Retrieves the list of HealthCheck resources available to the specified
10761 /// project.
10762 pub fn list(&self) -> super::builder::region_health_checks::List {
10763 super::builder::region_health_checks::List::new(self.inner.clone())
10764 }
10765
10766 /// Updates a HealthCheck resource in the specified project using the data
10767 /// included in the request. This method supportsPATCH
10768 /// semantics and uses theJSON merge
10769 /// patch format and processing rules.
10770 pub fn patch(&self) -> super::builder::region_health_checks::Patch {
10771 super::builder::region_health_checks::Patch::new(self.inner.clone())
10772 }
10773
10774 /// Updates a HealthCheck resource in the specified project using the data
10775 /// included in the request.
10776 pub fn update(&self) -> super::builder::region_health_checks::Update {
10777 super::builder::region_health_checks::Update::new(self.inner.clone())
10778 }
10779
10780 /// Retrieves the specified region-specific Operations resource.
10781 pub fn get_operation(&self) -> super::builder::region_health_checks::GetOperation {
10782 super::builder::region_health_checks::GetOperation::new(self.inner.clone())
10783 }
10784}
10785
10786/// Implements a client for the Google Compute Engine API.
10787///
10788/// # Example
10789/// ```
10790/// # tokio_test::block_on(async {
10791/// # use google_cloud_compute_v1::client::RegionInstanceGroupManagers;
10792/// let client = RegionInstanceGroupManagers::builder().build().await?;
10793/// // use `client` to make requests to the Google Compute Engine API.
10794/// # gax::client_builder::Result::<()>::Ok(()) });
10795/// ```
10796///
10797/// # Service Description
10798///
10799/// Service for the `regionInstanceGroupManagers` resource.
10800///
10801/// # Configuration
10802///
10803/// To configure `RegionInstanceGroupManagers` use the `with_*` methods in the type returned
10804/// by [builder()][RegionInstanceGroupManagers::builder]. The default configuration should
10805/// work for most applications. Common configuration changes include
10806///
10807/// * [with_endpoint()]: by default this client uses the global default endpoint
10808/// (`https://compute.googleapis.com`). Applications using regional
10809/// endpoints or running in restricted networks (e.g. a network configured
10810// with [Private Google Access with VPC Service Controls]) may want to
10811/// override this default.
10812/// * [with_credentials()]: by default this client uses
10813/// [Application Default Credentials]. Applications using custom
10814/// authentication may need to override this default.
10815///
10816/// [with_endpoint()]: super::builder::region_instance_group_managers::ClientBuilder::with_endpoint
10817/// [with_credentials()]: super::builder::region_instance_group_managers::ClientBuilder::credentials
10818/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
10819/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
10820///
10821/// # Pooling and Cloning
10822///
10823/// `RegionInstanceGroupManagers` holds a connection pool internally, it is advised to
10824/// create one and the reuse it. You do not need to wrap `RegionInstanceGroupManagers` in
10825/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
10826/// already uses an `Arc` internally.
10827#[cfg(feature = "region-instance-group-managers")]
10828#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-group-managers")))]
10829#[derive(Clone, Debug)]
10830pub struct RegionInstanceGroupManagers {
10831 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagers>,
10832}
10833
10834#[cfg(feature = "region-instance-group-managers")]
10835impl RegionInstanceGroupManagers {
10836 /// Returns a builder for [RegionInstanceGroupManagers].
10837 ///
10838 /// ```
10839 /// # tokio_test::block_on(async {
10840 /// # use google_cloud_compute_v1::client::RegionInstanceGroupManagers;
10841 /// let client = RegionInstanceGroupManagers::builder().build().await?;
10842 /// # gax::client_builder::Result::<()>::Ok(()) });
10843 /// ```
10844 pub fn builder() -> super::builder::region_instance_group_managers::ClientBuilder {
10845 gax::client_builder::internal::new_builder(
10846 super::builder::region_instance_group_managers::client::Factory,
10847 )
10848 }
10849
10850 /// Creates a new client from the provided stub.
10851 ///
10852 /// The most common case for calling this function is in tests mocking the
10853 /// client's behavior.
10854 pub fn from_stub<T>(stub: T) -> Self
10855 where
10856 T: super::stub::RegionInstanceGroupManagers + 'static,
10857 {
10858 Self {
10859 inner: std::sync::Arc::new(stub),
10860 }
10861 }
10862
10863 pub(crate) async fn new(
10864 config: gaxi::options::ClientConfig,
10865 ) -> gax::client_builder::Result<Self> {
10866 let inner = Self::build_inner(config).await?;
10867 Ok(Self { inner })
10868 }
10869
10870 async fn build_inner(
10871 conf: gaxi::options::ClientConfig,
10872 ) -> gax::client_builder::Result<
10873 std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroupManagers>,
10874 > {
10875 if gaxi::options::tracing_enabled(&conf) {
10876 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
10877 }
10878 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
10879 }
10880
10881 async fn build_transport(
10882 conf: gaxi::options::ClientConfig,
10883 ) -> gax::client_builder::Result<impl super::stub::RegionInstanceGroupManagers> {
10884 super::transport::RegionInstanceGroupManagers::new(conf).await
10885 }
10886
10887 async fn build_with_tracing(
10888 conf: gaxi::options::ClientConfig,
10889 ) -> gax::client_builder::Result<impl super::stub::RegionInstanceGroupManagers> {
10890 Self::build_transport(conf)
10891 .await
10892 .map(super::tracing::RegionInstanceGroupManagers::new)
10893 }
10894
10895 /// Flags the specified instances to be immediately removed from the managed
10896 /// instance group. Abandoning an instance does not delete the
10897 /// instance, but it does remove the instance from any target pools that are
10898 /// applied by the managed instance group. This method reduces thetargetSize of the managed instance group by the
10899 /// number of instances that you abandon. This operation is marked asDONE when the action is scheduled even if the instances have
10900 /// not yet been removed from the group. You must separately verify the
10901 /// status of the abandoning action with thelistmanagedinstances
10902 /// method.
10903 ///
10904 /// If the group is part of a backend
10905 /// service that has enabled
10906 /// connection draining, it can take up to 60 seconds after the connection
10907 /// draining duration has elapsed before the VM instance is removed or deleted.
10908 ///
10909 /// You can specify a maximum of 1000 instances with this method per request.
10910 pub fn abandon_instances(
10911 &self,
10912 ) -> super::builder::region_instance_group_managers::AbandonInstances {
10913 super::builder::region_instance_group_managers::AbandonInstances::new(self.inner.clone())
10914 }
10915
10916 /// Apply updates to selected instances the managed instance group.
10917 pub fn apply_updates_to_instances(
10918 &self,
10919 ) -> super::builder::region_instance_group_managers::ApplyUpdatesToInstances {
10920 super::builder::region_instance_group_managers::ApplyUpdatesToInstances::new(
10921 self.inner.clone(),
10922 )
10923 }
10924
10925 /// Creates instances with per-instance configurations in this regional managed
10926 /// instance group. Instances are created using the current instance template.
10927 /// The create instances operation is marked DONE if
10928 /// the createInstances request is successful. The underlying
10929 /// actions take additional time. You must separately verify the status of thecreating or actions with the listmanagedinstances
10930 /// method.
10931 pub fn create_instances(
10932 &self,
10933 ) -> super::builder::region_instance_group_managers::CreateInstances {
10934 super::builder::region_instance_group_managers::CreateInstances::new(self.inner.clone())
10935 }
10936
10937 /// Deletes the specified managed instance group and all of the instances
10938 /// in that group.
10939 pub fn delete(&self) -> super::builder::region_instance_group_managers::Delete {
10940 super::builder::region_instance_group_managers::Delete::new(self.inner.clone())
10941 }
10942
10943 /// Flags the specified instances in the managed instance group to be
10944 /// immediately deleted. The instances are also removed from any target
10945 /// pools of which they were a member. This method reduces thetargetSize of the managed instance group by the number of
10946 /// instances that you delete.
10947 /// The deleteInstances operation is marked DONE if
10948 /// the deleteInstances request is successful. The underlying
10949 /// actions take additional time. You must separately verify the status of thedeleting action with thelistmanagedinstances
10950 /// method.
10951 ///
10952 /// If the group is part of a backend
10953 /// service that has enabled
10954 /// connection draining, it can take up to 60 seconds after the connection
10955 /// draining duration has elapsed before the VM instance is removed or deleted.
10956 ///
10957 /// You can specify a maximum of 1000 instances with this method per request.
10958 pub fn delete_instances(
10959 &self,
10960 ) -> super::builder::region_instance_group_managers::DeleteInstances {
10961 super::builder::region_instance_group_managers::DeleteInstances::new(self.inner.clone())
10962 }
10963
10964 /// Deletes selected per-instance configurations for the managed instance
10965 /// group.
10966 pub fn delete_per_instance_configs(
10967 &self,
10968 ) -> super::builder::region_instance_group_managers::DeletePerInstanceConfigs {
10969 super::builder::region_instance_group_managers::DeletePerInstanceConfigs::new(
10970 self.inner.clone(),
10971 )
10972 }
10973
10974 /// Returns all of the details about the specified managed instance group.
10975 pub fn get(&self) -> super::builder::region_instance_group_managers::Get {
10976 super::builder::region_instance_group_managers::Get::new(self.inner.clone())
10977 }
10978
10979 /// Creates a managed instance group using the information that you specify
10980 /// in the request. After the group is created, instances in the group are
10981 /// created using the specified instance template.
10982 /// This operation is marked as DONE when the group is created
10983 /// even if the instances in the group have not yet been created. You must
10984 /// separately verify the status of the individual instances with thelistmanagedinstances
10985 /// method.
10986 ///
10987 /// A regional managed instance group can contain up to 2000 instances.
10988 pub fn insert(&self) -> super::builder::region_instance_group_managers::Insert {
10989 super::builder::region_instance_group_managers::Insert::new(self.inner.clone())
10990 }
10991
10992 /// Retrieves the list of managed instance groups that are contained
10993 /// within the specified region.
10994 pub fn list(&self) -> super::builder::region_instance_group_managers::List {
10995 super::builder::region_instance_group_managers::List::new(self.inner.clone())
10996 }
10997
10998 /// Lists all errors thrown by actions on instances for a given regional
10999 /// managed instance group. The filter andorderBy query parameters are not supported.
11000 pub fn list_errors(&self) -> super::builder::region_instance_group_managers::ListErrors {
11001 super::builder::region_instance_group_managers::ListErrors::new(self.inner.clone())
11002 }
11003
11004 /// Lists the instances in the managed instance group and instances that are
11005 /// scheduled to be created. The list includes any current actions
11006 /// that the group has scheduled for its instances. The orderBy
11007 /// query parameter is not supported. The `pageToken` query parameter is
11008 /// supported only if the group's `listManagedInstancesResults` field is set
11009 /// to `PAGINATED`.
11010 pub fn list_managed_instances(
11011 &self,
11012 ) -> super::builder::region_instance_group_managers::ListManagedInstances {
11013 super::builder::region_instance_group_managers::ListManagedInstances::new(
11014 self.inner.clone(),
11015 )
11016 }
11017
11018 /// Lists all of the per-instance configurations defined for the managed
11019 /// instance group. The orderBy query parameter is not supported.
11020 pub fn list_per_instance_configs(
11021 &self,
11022 ) -> super::builder::region_instance_group_managers::ListPerInstanceConfigs {
11023 super::builder::region_instance_group_managers::ListPerInstanceConfigs::new(
11024 self.inner.clone(),
11025 )
11026 }
11027
11028 /// Updates a managed instance group using the information that you specify
11029 /// in the request.
11030 /// This operation is marked as DONE when the group is patched
11031 /// even if the instances in the group are still in the process of being
11032 /// patched. You must separately verify the status of the individual instances
11033 /// with the listmanagedinstances
11034 /// method. This method supportsPATCH
11035 /// semantics and uses theJSON merge
11036 /// patch format and processing rules.
11037 ///
11038 /// If you update your group to specify a new template or instance
11039 /// configuration, it's possible that your intended specification for each VM
11040 /// in the group is different from the current state of that VM. To learn how
11041 /// to apply an updated configuration to the VMs in a MIG, seeUpdating instances in
11042 /// a MIG.
11043 pub fn patch(&self) -> super::builder::region_instance_group_managers::Patch {
11044 super::builder::region_instance_group_managers::Patch::new(self.inner.clone())
11045 }
11046
11047 /// Inserts or patches per-instance configurations for the managed instance
11048 /// group. perInstanceConfig.name serves as a key used to
11049 /// distinguish whether to perform insert or patch.
11050 pub fn patch_per_instance_configs(
11051 &self,
11052 ) -> super::builder::region_instance_group_managers::PatchPerInstanceConfigs {
11053 super::builder::region_instance_group_managers::PatchPerInstanceConfigs::new(
11054 self.inner.clone(),
11055 )
11056 }
11057
11058 /// Flags the specified VM instances in the managed instance group to be
11059 /// immediately recreated. Each instance is recreated using the group's current
11060 /// configuration. This operation is marked as DONE when the flag
11061 /// is set even if the instances have not yet been recreated. You must
11062 /// separately verify the status of each instance by checking itscurrentAction field; for more information, see Checking
11063 /// the status of managed instances.
11064 ///
11065 /// If the group is part of a backend
11066 /// service that has enabled
11067 /// connection draining, it can take up to 60 seconds after the connection
11068 /// draining duration has elapsed before the VM instance is removed or deleted.
11069 ///
11070 /// You can specify a maximum of 1000 instances with this method per request.
11071 pub fn recreate_instances(
11072 &self,
11073 ) -> super::builder::region_instance_group_managers::RecreateInstances {
11074 super::builder::region_instance_group_managers::RecreateInstances::new(self.inner.clone())
11075 }
11076
11077 /// Changes the intended size of the managed instance group. If you increase
11078 /// the size, the group creates new instances using the current instance
11079 /// template. If you decrease the size, the group deletes one or more
11080 /// instances.
11081 ///
11082 /// The resize operation is marked DONE if theresize request is successful. The underlying actions take
11083 /// additional time. You must separately verify the status of thecreating or deleting actions with thelistmanagedinstances
11084 /// method.
11085 ///
11086 /// If the group is part of a backend
11087 /// service that has enabled
11088 /// connection draining, it can take up to 60 seconds after the connection
11089 /// draining duration has elapsed before the VM instance is removed or deleted.
11090 pub fn resize(&self) -> super::builder::region_instance_group_managers::Resize {
11091 super::builder::region_instance_group_managers::Resize::new(self.inner.clone())
11092 }
11093
11094 /// Flags the specified instances in the managed instance group to be
11095 /// resumed. This method increases thetargetSize and decreases the targetSuspendedSize
11096 /// of the managed instance group by the number of instances that you resume.
11097 /// The resumeInstances operation is marked DONE if
11098 /// the resumeInstances request is successful. The underlying
11099 /// actions take additional time. You must separately verify the status of theRESUMING action with thelistmanagedinstances
11100 /// method.
11101 ///
11102 /// In this request, you can only specify instances that are suspended. For
11103 /// example, if an instance was previously suspended using the suspendInstances
11104 /// method, it can be resumed using the resumeInstances method.
11105 ///
11106 /// If a health check is attached to the managed instance group, the specified
11107 /// instances will be verified as healthy after they are resumed.
11108 ///
11109 /// You can specify a maximum of 1000 instances with this method per request.
11110 pub fn resume_instances(
11111 &self,
11112 ) -> super::builder::region_instance_group_managers::ResumeInstances {
11113 super::builder::region_instance_group_managers::ResumeInstances::new(self.inner.clone())
11114 }
11115
11116 /// Sets the instance template to use when creating new instances or recreating
11117 /// instances in this group. Existing instances are not affected.
11118 pub fn set_instance_template(
11119 &self,
11120 ) -> super::builder::region_instance_group_managers::SetInstanceTemplate {
11121 super::builder::region_instance_group_managers::SetInstanceTemplate::new(self.inner.clone())
11122 }
11123
11124 /// Modifies the target pools to which all new instances in this group are
11125 /// assigned. Existing instances in the group are not affected.
11126 pub fn set_target_pools(
11127 &self,
11128 ) -> super::builder::region_instance_group_managers::SetTargetPools {
11129 super::builder::region_instance_group_managers::SetTargetPools::new(self.inner.clone())
11130 }
11131
11132 /// Flags the specified instances in the managed instance group to be
11133 /// started. This method increases thetargetSize and decreases the targetStoppedSize
11134 /// of the managed instance group by the number of instances that you start.
11135 /// The startInstances operation is marked DONE if
11136 /// the startInstances request is successful. The underlying
11137 /// actions take additional time. You must separately verify the status of theSTARTING action with thelistmanagedinstances
11138 /// method.
11139 ///
11140 /// In this request, you can only specify instances that are stopped. For
11141 /// example, if an instance was previously stopped using the stopInstances
11142 /// method, it can be started using the startInstances method.
11143 ///
11144 /// If a health check is attached to the managed instance group, the specified
11145 /// instances will be verified as healthy after they are started.
11146 ///
11147 /// You can specify a maximum of 1000 instances with this method per request.
11148 pub fn start_instances(
11149 &self,
11150 ) -> super::builder::region_instance_group_managers::StartInstances {
11151 super::builder::region_instance_group_managers::StartInstances::new(self.inner.clone())
11152 }
11153
11154 /// Flags the specified instances in the managed instance group to be
11155 /// immediately stopped. You can only specify instances that are running in
11156 /// this request. This method reduces thetargetSize and increases the targetStoppedSize
11157 /// of the managed instance group by the number of instances that you stop.
11158 /// The stopInstances operation is marked DONE if
11159 /// the stopInstances request is successful. The underlying
11160 /// actions take additional time. You must separately verify the status of theSTOPPING action with thelistmanagedinstances
11161 /// method.
11162 ///
11163 /// If the standbyPolicy.initialDelaySec field is set, the group
11164 /// delays stopping the instances until initialDelaySec have
11165 /// passed from instance.creationTimestamp (that is, when the
11166 /// instance was created). This delay gives your application time to
11167 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
11168 /// will be zero delay.
11169 ///
11170 /// If the group is part of a backend
11171 /// service that has enabled
11172 /// connection draining, it can take up to 60 seconds after the connection
11173 /// draining duration has elapsed before the VM instance is stopped.
11174 ///
11175 /// Stopped instances can be started using the startInstances
11176 /// method.
11177 ///
11178 /// You can specify a maximum of 1000 instances with this method per request.
11179 pub fn stop_instances(&self) -> super::builder::region_instance_group_managers::StopInstances {
11180 super::builder::region_instance_group_managers::StopInstances::new(self.inner.clone())
11181 }
11182
11183 /// Flags the specified instances in the managed instance group to be
11184 /// immediately suspended. You can only specify instances that are running in
11185 /// this request. This method reduces thetargetSize and increases the targetSuspendedSize
11186 /// of the managed instance group by the number of instances that you suspend.
11187 /// The suspendInstances operation is marked DONE if
11188 /// the suspendInstances request is successful. The underlying
11189 /// actions take additional time. You must separately verify the status of theSUSPENDING action with thelistmanagedinstances
11190 /// method.
11191 ///
11192 /// If the standbyPolicy.initialDelaySec field is set, the group
11193 /// delays suspension of the instances until initialDelaySec have
11194 /// passed from instance.creationTimestamp (that is, when the
11195 /// instance was created). This delay gives your application time to
11196 /// set itself up and initialize on the instance. If more thaninitialDelaySec seconds have passed sinceinstance.creationTimestamp when this method is called, there
11197 /// will be zero delay.
11198 ///
11199 /// If the group is part of a backend
11200 /// service that has enabled
11201 /// connection draining, it can take up to 60 seconds after the connection
11202 /// draining duration has elapsed before the VM instance is suspended.
11203 ///
11204 /// Suspended instances can be resumed using the resumeInstances
11205 /// method.
11206 ///
11207 /// You can specify a maximum of 1000 instances with this method per request.
11208 pub fn suspend_instances(
11209 &self,
11210 ) -> super::builder::region_instance_group_managers::SuspendInstances {
11211 super::builder::region_instance_group_managers::SuspendInstances::new(self.inner.clone())
11212 }
11213
11214 /// Inserts or updates per-instance configurations for the managed instance
11215 /// group. perInstanceConfig.name serves as a key used to
11216 /// distinguish whether to perform insert or patch.
11217 pub fn update_per_instance_configs(
11218 &self,
11219 ) -> super::builder::region_instance_group_managers::UpdatePerInstanceConfigs {
11220 super::builder::region_instance_group_managers::UpdatePerInstanceConfigs::new(
11221 self.inner.clone(),
11222 )
11223 }
11224
11225 /// Retrieves the specified region-specific Operations resource.
11226 pub fn get_operation(&self) -> super::builder::region_instance_group_managers::GetOperation {
11227 super::builder::region_instance_group_managers::GetOperation::new(self.inner.clone())
11228 }
11229}
11230
11231/// Implements a client for the Google Compute Engine API.
11232///
11233/// # Example
11234/// ```
11235/// # tokio_test::block_on(async {
11236/// # use google_cloud_compute_v1::client::RegionInstanceGroups;
11237/// let client = RegionInstanceGroups::builder().build().await?;
11238/// // use `client` to make requests to the Google Compute Engine API.
11239/// # gax::client_builder::Result::<()>::Ok(()) });
11240/// ```
11241///
11242/// # Service Description
11243///
11244/// Service for the `regionInstanceGroups` resource.
11245///
11246/// # Configuration
11247///
11248/// To configure `RegionInstanceGroups` use the `with_*` methods in the type returned
11249/// by [builder()][RegionInstanceGroups::builder]. The default configuration should
11250/// work for most applications. Common configuration changes include
11251///
11252/// * [with_endpoint()]: by default this client uses the global default endpoint
11253/// (`https://compute.googleapis.com`). Applications using regional
11254/// endpoints or running in restricted networks (e.g. a network configured
11255// with [Private Google Access with VPC Service Controls]) may want to
11256/// override this default.
11257/// * [with_credentials()]: by default this client uses
11258/// [Application Default Credentials]. Applications using custom
11259/// authentication may need to override this default.
11260///
11261/// [with_endpoint()]: super::builder::region_instance_groups::ClientBuilder::with_endpoint
11262/// [with_credentials()]: super::builder::region_instance_groups::ClientBuilder::credentials
11263/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11264/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11265///
11266/// # Pooling and Cloning
11267///
11268/// `RegionInstanceGroups` holds a connection pool internally, it is advised to
11269/// create one and the reuse it. You do not need to wrap `RegionInstanceGroups` in
11270/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11271/// already uses an `Arc` internally.
11272#[cfg(feature = "region-instance-groups")]
11273#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-groups")))]
11274#[derive(Clone, Debug)]
11275pub struct RegionInstanceGroups {
11276 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroups>,
11277}
11278
11279#[cfg(feature = "region-instance-groups")]
11280impl RegionInstanceGroups {
11281 /// Returns a builder for [RegionInstanceGroups].
11282 ///
11283 /// ```
11284 /// # tokio_test::block_on(async {
11285 /// # use google_cloud_compute_v1::client::RegionInstanceGroups;
11286 /// let client = RegionInstanceGroups::builder().build().await?;
11287 /// # gax::client_builder::Result::<()>::Ok(()) });
11288 /// ```
11289 pub fn builder() -> super::builder::region_instance_groups::ClientBuilder {
11290 gax::client_builder::internal::new_builder(
11291 super::builder::region_instance_groups::client::Factory,
11292 )
11293 }
11294
11295 /// Creates a new client from the provided stub.
11296 ///
11297 /// The most common case for calling this function is in tests mocking the
11298 /// client's behavior.
11299 pub fn from_stub<T>(stub: T) -> Self
11300 where
11301 T: super::stub::RegionInstanceGroups + 'static,
11302 {
11303 Self {
11304 inner: std::sync::Arc::new(stub),
11305 }
11306 }
11307
11308 pub(crate) async fn new(
11309 config: gaxi::options::ClientConfig,
11310 ) -> gax::client_builder::Result<Self> {
11311 let inner = Self::build_inner(config).await?;
11312 Ok(Self { inner })
11313 }
11314
11315 async fn build_inner(
11316 conf: gaxi::options::ClientConfig,
11317 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionInstanceGroups>>
11318 {
11319 if gaxi::options::tracing_enabled(&conf) {
11320 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11321 }
11322 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11323 }
11324
11325 async fn build_transport(
11326 conf: gaxi::options::ClientConfig,
11327 ) -> gax::client_builder::Result<impl super::stub::RegionInstanceGroups> {
11328 super::transport::RegionInstanceGroups::new(conf).await
11329 }
11330
11331 async fn build_with_tracing(
11332 conf: gaxi::options::ClientConfig,
11333 ) -> gax::client_builder::Result<impl super::stub::RegionInstanceGroups> {
11334 Self::build_transport(conf)
11335 .await
11336 .map(super::tracing::RegionInstanceGroups::new)
11337 }
11338
11339 /// Returns the specified instance group resource.
11340 pub fn get(&self) -> super::builder::region_instance_groups::Get {
11341 super::builder::region_instance_groups::Get::new(self.inner.clone())
11342 }
11343
11344 /// Retrieves the list of instance group resources contained within
11345 /// the specified region.
11346 pub fn list(&self) -> super::builder::region_instance_groups::List {
11347 super::builder::region_instance_groups::List::new(self.inner.clone())
11348 }
11349
11350 /// Lists the instances in the specified instance group and displays
11351 /// information about the named ports. Depending on the specified options, this
11352 /// method can list all instances or only the instances that are running.
11353 /// The orderBy query parameter is not supported.
11354 pub fn list_instances(&self) -> super::builder::region_instance_groups::ListInstances {
11355 super::builder::region_instance_groups::ListInstances::new(self.inner.clone())
11356 }
11357
11358 /// Sets the named ports for the specified regional instance group.
11359 pub fn set_named_ports(&self) -> super::builder::region_instance_groups::SetNamedPorts {
11360 super::builder::region_instance_groups::SetNamedPorts::new(self.inner.clone())
11361 }
11362
11363 /// Returns permissions that a caller has on the specified resource.
11364 pub fn test_iam_permissions(
11365 &self,
11366 ) -> super::builder::region_instance_groups::TestIamPermissions {
11367 super::builder::region_instance_groups::TestIamPermissions::new(self.inner.clone())
11368 }
11369
11370 /// Retrieves the specified region-specific Operations resource.
11371 pub fn get_operation(&self) -> super::builder::region_instance_groups::GetOperation {
11372 super::builder::region_instance_groups::GetOperation::new(self.inner.clone())
11373 }
11374}
11375
11376/// Implements a client for the Google Compute Engine API.
11377///
11378/// # Example
11379/// ```
11380/// # tokio_test::block_on(async {
11381/// # use google_cloud_compute_v1::client::RegionInstanceTemplates;
11382/// let client = RegionInstanceTemplates::builder().build().await?;
11383/// // use `client` to make requests to the Google Compute Engine API.
11384/// # gax::client_builder::Result::<()>::Ok(()) });
11385/// ```
11386///
11387/// # Service Description
11388///
11389/// Service for the `regionInstanceTemplates` resource.
11390///
11391/// # Configuration
11392///
11393/// To configure `RegionInstanceTemplates` use the `with_*` methods in the type returned
11394/// by [builder()][RegionInstanceTemplates::builder]. The default configuration should
11395/// work for most applications. Common configuration changes include
11396///
11397/// * [with_endpoint()]: by default this client uses the global default endpoint
11398/// (`https://compute.googleapis.com`). Applications using regional
11399/// endpoints or running in restricted networks (e.g. a network configured
11400// with [Private Google Access with VPC Service Controls]) may want to
11401/// override this default.
11402/// * [with_credentials()]: by default this client uses
11403/// [Application Default Credentials]. Applications using custom
11404/// authentication may need to override this default.
11405///
11406/// [with_endpoint()]: super::builder::region_instance_templates::ClientBuilder::with_endpoint
11407/// [with_credentials()]: super::builder::region_instance_templates::ClientBuilder::credentials
11408/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11409/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11410///
11411/// # Pooling and Cloning
11412///
11413/// `RegionInstanceTemplates` holds a connection pool internally, it is advised to
11414/// create one and the reuse it. You do not need to wrap `RegionInstanceTemplates` in
11415/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11416/// already uses an `Arc` internally.
11417#[cfg(feature = "region-instance-templates")]
11418#[cfg_attr(docsrs, doc(cfg(feature = "region-instance-templates")))]
11419#[derive(Clone, Debug)]
11420pub struct RegionInstanceTemplates {
11421 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstanceTemplates>,
11422}
11423
11424#[cfg(feature = "region-instance-templates")]
11425impl RegionInstanceTemplates {
11426 /// Returns a builder for [RegionInstanceTemplates].
11427 ///
11428 /// ```
11429 /// # tokio_test::block_on(async {
11430 /// # use google_cloud_compute_v1::client::RegionInstanceTemplates;
11431 /// let client = RegionInstanceTemplates::builder().build().await?;
11432 /// # gax::client_builder::Result::<()>::Ok(()) });
11433 /// ```
11434 pub fn builder() -> super::builder::region_instance_templates::ClientBuilder {
11435 gax::client_builder::internal::new_builder(
11436 super::builder::region_instance_templates::client::Factory,
11437 )
11438 }
11439
11440 /// Creates a new client from the provided stub.
11441 ///
11442 /// The most common case for calling this function is in tests mocking the
11443 /// client's behavior.
11444 pub fn from_stub<T>(stub: T) -> Self
11445 where
11446 T: super::stub::RegionInstanceTemplates + 'static,
11447 {
11448 Self {
11449 inner: std::sync::Arc::new(stub),
11450 }
11451 }
11452
11453 pub(crate) async fn new(
11454 config: gaxi::options::ClientConfig,
11455 ) -> gax::client_builder::Result<Self> {
11456 let inner = Self::build_inner(config).await?;
11457 Ok(Self { inner })
11458 }
11459
11460 async fn build_inner(
11461 conf: gaxi::options::ClientConfig,
11462 ) -> gax::client_builder::Result<
11463 std::sync::Arc<dyn super::stub::dynamic::RegionInstanceTemplates>,
11464 > {
11465 if gaxi::options::tracing_enabled(&conf) {
11466 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11467 }
11468 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11469 }
11470
11471 async fn build_transport(
11472 conf: gaxi::options::ClientConfig,
11473 ) -> gax::client_builder::Result<impl super::stub::RegionInstanceTemplates> {
11474 super::transport::RegionInstanceTemplates::new(conf).await
11475 }
11476
11477 async fn build_with_tracing(
11478 conf: gaxi::options::ClientConfig,
11479 ) -> gax::client_builder::Result<impl super::stub::RegionInstanceTemplates> {
11480 Self::build_transport(conf)
11481 .await
11482 .map(super::tracing::RegionInstanceTemplates::new)
11483 }
11484
11485 /// Deletes the specified instance template. Deleting an instance template is
11486 /// permanent and cannot be undone.
11487 pub fn delete(&self) -> super::builder::region_instance_templates::Delete {
11488 super::builder::region_instance_templates::Delete::new(self.inner.clone())
11489 }
11490
11491 /// Returns the specified instance template.
11492 pub fn get(&self) -> super::builder::region_instance_templates::Get {
11493 super::builder::region_instance_templates::Get::new(self.inner.clone())
11494 }
11495
11496 /// Creates an instance template in the specified project and region using the
11497 /// global instance template whose URL is included in the request.
11498 pub fn insert(&self) -> super::builder::region_instance_templates::Insert {
11499 super::builder::region_instance_templates::Insert::new(self.inner.clone())
11500 }
11501
11502 /// Retrieves a list of instance templates that are contained within the
11503 /// specified project and region.
11504 pub fn list(&self) -> super::builder::region_instance_templates::List {
11505 super::builder::region_instance_templates::List::new(self.inner.clone())
11506 }
11507
11508 /// Retrieves the specified region-specific Operations resource.
11509 pub fn get_operation(&self) -> super::builder::region_instance_templates::GetOperation {
11510 super::builder::region_instance_templates::GetOperation::new(self.inner.clone())
11511 }
11512}
11513
11514/// Implements a client for the Google Compute Engine API.
11515///
11516/// # Example
11517/// ```
11518/// # tokio_test::block_on(async {
11519/// # use google_cloud_compute_v1::client::RegionInstances;
11520/// let client = RegionInstances::builder().build().await?;
11521/// // use `client` to make requests to the Google Compute Engine API.
11522/// # gax::client_builder::Result::<()>::Ok(()) });
11523/// ```
11524///
11525/// # Service Description
11526///
11527/// Service for the `regionInstances` resource.
11528///
11529/// # Configuration
11530///
11531/// To configure `RegionInstances` use the `with_*` methods in the type returned
11532/// by [builder()][RegionInstances::builder]. The default configuration should
11533/// work for most applications. Common configuration changes include
11534///
11535/// * [with_endpoint()]: by default this client uses the global default endpoint
11536/// (`https://compute.googleapis.com`). Applications using regional
11537/// endpoints or running in restricted networks (e.g. a network configured
11538// with [Private Google Access with VPC Service Controls]) may want to
11539/// override this default.
11540/// * [with_credentials()]: by default this client uses
11541/// [Application Default Credentials]. Applications using custom
11542/// authentication may need to override this default.
11543///
11544/// [with_endpoint()]: super::builder::region_instances::ClientBuilder::with_endpoint
11545/// [with_credentials()]: super::builder::region_instances::ClientBuilder::credentials
11546/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11547/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11548///
11549/// # Pooling and Cloning
11550///
11551/// `RegionInstances` holds a connection pool internally, it is advised to
11552/// create one and the reuse it. You do not need to wrap `RegionInstances` in
11553/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11554/// already uses an `Arc` internally.
11555#[cfg(feature = "region-instances")]
11556#[cfg_attr(docsrs, doc(cfg(feature = "region-instances")))]
11557#[derive(Clone, Debug)]
11558pub struct RegionInstances {
11559 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstances>,
11560}
11561
11562#[cfg(feature = "region-instances")]
11563impl RegionInstances {
11564 /// Returns a builder for [RegionInstances].
11565 ///
11566 /// ```
11567 /// # tokio_test::block_on(async {
11568 /// # use google_cloud_compute_v1::client::RegionInstances;
11569 /// let client = RegionInstances::builder().build().await?;
11570 /// # gax::client_builder::Result::<()>::Ok(()) });
11571 /// ```
11572 pub fn builder() -> super::builder::region_instances::ClientBuilder {
11573 gax::client_builder::internal::new_builder(
11574 super::builder::region_instances::client::Factory,
11575 )
11576 }
11577
11578 /// Creates a new client from the provided stub.
11579 ///
11580 /// The most common case for calling this function is in tests mocking the
11581 /// client's behavior.
11582 pub fn from_stub<T>(stub: T) -> Self
11583 where
11584 T: super::stub::RegionInstances + 'static,
11585 {
11586 Self {
11587 inner: std::sync::Arc::new(stub),
11588 }
11589 }
11590
11591 pub(crate) async fn new(
11592 config: gaxi::options::ClientConfig,
11593 ) -> gax::client_builder::Result<Self> {
11594 let inner = Self::build_inner(config).await?;
11595 Ok(Self { inner })
11596 }
11597
11598 async fn build_inner(
11599 conf: gaxi::options::ClientConfig,
11600 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionInstances>>
11601 {
11602 if gaxi::options::tracing_enabled(&conf) {
11603 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11604 }
11605 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11606 }
11607
11608 async fn build_transport(
11609 conf: gaxi::options::ClientConfig,
11610 ) -> gax::client_builder::Result<impl super::stub::RegionInstances> {
11611 super::transport::RegionInstances::new(conf).await
11612 }
11613
11614 async fn build_with_tracing(
11615 conf: gaxi::options::ClientConfig,
11616 ) -> gax::client_builder::Result<impl super::stub::RegionInstances> {
11617 Self::build_transport(conf)
11618 .await
11619 .map(super::tracing::RegionInstances::new)
11620 }
11621
11622 /// Creates multiple instances in a given region. Count specifies the number of
11623 /// instances to create.
11624 pub fn bulk_insert(&self) -> super::builder::region_instances::BulkInsert {
11625 super::builder::region_instances::BulkInsert::new(self.inner.clone())
11626 }
11627
11628 /// Retrieves the specified region-specific Operations resource.
11629 pub fn get_operation(&self) -> super::builder::region_instances::GetOperation {
11630 super::builder::region_instances::GetOperation::new(self.inner.clone())
11631 }
11632}
11633
11634/// Implements a client for the Google Compute Engine API.
11635///
11636/// # Example
11637/// ```
11638/// # tokio_test::block_on(async {
11639/// # use google_cloud_compute_v1::client::RegionInstantSnapshots;
11640/// let client = RegionInstantSnapshots::builder().build().await?;
11641/// // use `client` to make requests to the Google Compute Engine API.
11642/// # gax::client_builder::Result::<()>::Ok(()) });
11643/// ```
11644///
11645/// # Service Description
11646///
11647/// Service for the `regionInstantSnapshots` resource.
11648///
11649/// # Configuration
11650///
11651/// To configure `RegionInstantSnapshots` use the `with_*` methods in the type returned
11652/// by [builder()][RegionInstantSnapshots::builder]. The default configuration should
11653/// work for most applications. Common configuration changes include
11654///
11655/// * [with_endpoint()]: by default this client uses the global default endpoint
11656/// (`https://compute.googleapis.com`). Applications using regional
11657/// endpoints or running in restricted networks (e.g. a network configured
11658// with [Private Google Access with VPC Service Controls]) may want to
11659/// override this default.
11660/// * [with_credentials()]: by default this client uses
11661/// [Application Default Credentials]. Applications using custom
11662/// authentication may need to override this default.
11663///
11664/// [with_endpoint()]: super::builder::region_instant_snapshots::ClientBuilder::with_endpoint
11665/// [with_credentials()]: super::builder::region_instant_snapshots::ClientBuilder::credentials
11666/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11667/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11668///
11669/// # Pooling and Cloning
11670///
11671/// `RegionInstantSnapshots` holds a connection pool internally, it is advised to
11672/// create one and the reuse it. You do not need to wrap `RegionInstantSnapshots` in
11673/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11674/// already uses an `Arc` internally.
11675#[cfg(feature = "region-instant-snapshots")]
11676#[cfg_attr(docsrs, doc(cfg(feature = "region-instant-snapshots")))]
11677#[derive(Clone, Debug)]
11678pub struct RegionInstantSnapshots {
11679 inner: std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshots>,
11680}
11681
11682#[cfg(feature = "region-instant-snapshots")]
11683impl RegionInstantSnapshots {
11684 /// Returns a builder for [RegionInstantSnapshots].
11685 ///
11686 /// ```
11687 /// # tokio_test::block_on(async {
11688 /// # use google_cloud_compute_v1::client::RegionInstantSnapshots;
11689 /// let client = RegionInstantSnapshots::builder().build().await?;
11690 /// # gax::client_builder::Result::<()>::Ok(()) });
11691 /// ```
11692 pub fn builder() -> super::builder::region_instant_snapshots::ClientBuilder {
11693 gax::client_builder::internal::new_builder(
11694 super::builder::region_instant_snapshots::client::Factory,
11695 )
11696 }
11697
11698 /// Creates a new client from the provided stub.
11699 ///
11700 /// The most common case for calling this function is in tests mocking the
11701 /// client's behavior.
11702 pub fn from_stub<T>(stub: T) -> Self
11703 where
11704 T: super::stub::RegionInstantSnapshots + 'static,
11705 {
11706 Self {
11707 inner: std::sync::Arc::new(stub),
11708 }
11709 }
11710
11711 pub(crate) async fn new(
11712 config: gaxi::options::ClientConfig,
11713 ) -> gax::client_builder::Result<Self> {
11714 let inner = Self::build_inner(config).await?;
11715 Ok(Self { inner })
11716 }
11717
11718 async fn build_inner(
11719 conf: gaxi::options::ClientConfig,
11720 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionInstantSnapshots>>
11721 {
11722 if gaxi::options::tracing_enabled(&conf) {
11723 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11724 }
11725 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11726 }
11727
11728 async fn build_transport(
11729 conf: gaxi::options::ClientConfig,
11730 ) -> gax::client_builder::Result<impl super::stub::RegionInstantSnapshots> {
11731 super::transport::RegionInstantSnapshots::new(conf).await
11732 }
11733
11734 async fn build_with_tracing(
11735 conf: gaxi::options::ClientConfig,
11736 ) -> gax::client_builder::Result<impl super::stub::RegionInstantSnapshots> {
11737 Self::build_transport(conf)
11738 .await
11739 .map(super::tracing::RegionInstantSnapshots::new)
11740 }
11741
11742 /// Deletes the specified InstantSnapshot resource. Keep in mind that deleting
11743 /// a single instantSnapshot might not necessarily delete all the data on that
11744 /// instantSnapshot. If any data on the instantSnapshot that is marked for
11745 /// deletion is needed for subsequent instantSnapshots, the data will be moved
11746 /// to the next corresponding instantSnapshot.
11747 ///
11748 /// For more information, seeDeleting
11749 /// instantSnapshots.
11750 pub fn delete(&self) -> super::builder::region_instant_snapshots::Delete {
11751 super::builder::region_instant_snapshots::Delete::new(self.inner.clone())
11752 }
11753
11754 /// Returns the specified InstantSnapshot resource in the specified region.
11755 pub fn get(&self) -> super::builder::region_instant_snapshots::Get {
11756 super::builder::region_instant_snapshots::Get::new(self.inner.clone())
11757 }
11758
11759 /// Gets the access control policy for a resource. May be empty if no such
11760 /// policy or resource exists.
11761 pub fn get_iam_policy(&self) -> super::builder::region_instant_snapshots::GetIamPolicy {
11762 super::builder::region_instant_snapshots::GetIamPolicy::new(self.inner.clone())
11763 }
11764
11765 /// Creates an instant snapshot in the specified region.
11766 pub fn insert(&self) -> super::builder::region_instant_snapshots::Insert {
11767 super::builder::region_instant_snapshots::Insert::new(self.inner.clone())
11768 }
11769
11770 /// Retrieves the list of InstantSnapshot resources contained within
11771 /// the specified region.
11772 pub fn list(&self) -> super::builder::region_instant_snapshots::List {
11773 super::builder::region_instant_snapshots::List::new(self.inner.clone())
11774 }
11775
11776 /// Sets the access control policy on the specified resource.
11777 /// Replaces any existing policy.
11778 pub fn set_iam_policy(&self) -> super::builder::region_instant_snapshots::SetIamPolicy {
11779 super::builder::region_instant_snapshots::SetIamPolicy::new(self.inner.clone())
11780 }
11781
11782 /// Sets the labels on a instantSnapshot in the given region. To learn more
11783 /// about labels, read the Labeling
11784 /// Resources documentation.
11785 pub fn set_labels(&self) -> super::builder::region_instant_snapshots::SetLabels {
11786 super::builder::region_instant_snapshots::SetLabels::new(self.inner.clone())
11787 }
11788
11789 /// Returns permissions that a caller has on the specified resource.
11790 pub fn test_iam_permissions(
11791 &self,
11792 ) -> super::builder::region_instant_snapshots::TestIamPermissions {
11793 super::builder::region_instant_snapshots::TestIamPermissions::new(self.inner.clone())
11794 }
11795
11796 /// Retrieves the specified region-specific Operations resource.
11797 pub fn get_operation(&self) -> super::builder::region_instant_snapshots::GetOperation {
11798 super::builder::region_instant_snapshots::GetOperation::new(self.inner.clone())
11799 }
11800}
11801
11802/// Implements a client for the Google Compute Engine API.
11803///
11804/// # Example
11805/// ```
11806/// # tokio_test::block_on(async {
11807/// # use google_cloud_compute_v1::client::RegionNetworkEndpointGroups;
11808/// let client = RegionNetworkEndpointGroups::builder().build().await?;
11809/// // use `client` to make requests to the Google Compute Engine API.
11810/// # gax::client_builder::Result::<()>::Ok(()) });
11811/// ```
11812///
11813/// # Service Description
11814///
11815/// Service for the `regionNetworkEndpointGroups` resource.
11816///
11817/// # Configuration
11818///
11819/// To configure `RegionNetworkEndpointGroups` use the `with_*` methods in the type returned
11820/// by [builder()][RegionNetworkEndpointGroups::builder]. The default configuration should
11821/// work for most applications. Common configuration changes include
11822///
11823/// * [with_endpoint()]: by default this client uses the global default endpoint
11824/// (`https://compute.googleapis.com`). Applications using regional
11825/// endpoints or running in restricted networks (e.g. a network configured
11826// with [Private Google Access with VPC Service Controls]) may want to
11827/// override this default.
11828/// * [with_credentials()]: by default this client uses
11829/// [Application Default Credentials]. Applications using custom
11830/// authentication may need to override this default.
11831///
11832/// [with_endpoint()]: super::builder::region_network_endpoint_groups::ClientBuilder::with_endpoint
11833/// [with_credentials()]: super::builder::region_network_endpoint_groups::ClientBuilder::credentials
11834/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
11835/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
11836///
11837/// # Pooling and Cloning
11838///
11839/// `RegionNetworkEndpointGroups` holds a connection pool internally, it is advised to
11840/// create one and the reuse it. You do not need to wrap `RegionNetworkEndpointGroups` in
11841/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
11842/// already uses an `Arc` internally.
11843#[cfg(feature = "region-network-endpoint-groups")]
11844#[cfg_attr(docsrs, doc(cfg(feature = "region-network-endpoint-groups")))]
11845#[derive(Clone, Debug)]
11846pub struct RegionNetworkEndpointGroups {
11847 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNetworkEndpointGroups>,
11848}
11849
11850#[cfg(feature = "region-network-endpoint-groups")]
11851impl RegionNetworkEndpointGroups {
11852 /// Returns a builder for [RegionNetworkEndpointGroups].
11853 ///
11854 /// ```
11855 /// # tokio_test::block_on(async {
11856 /// # use google_cloud_compute_v1::client::RegionNetworkEndpointGroups;
11857 /// let client = RegionNetworkEndpointGroups::builder().build().await?;
11858 /// # gax::client_builder::Result::<()>::Ok(()) });
11859 /// ```
11860 pub fn builder() -> super::builder::region_network_endpoint_groups::ClientBuilder {
11861 gax::client_builder::internal::new_builder(
11862 super::builder::region_network_endpoint_groups::client::Factory,
11863 )
11864 }
11865
11866 /// Creates a new client from the provided stub.
11867 ///
11868 /// The most common case for calling this function is in tests mocking the
11869 /// client's behavior.
11870 pub fn from_stub<T>(stub: T) -> Self
11871 where
11872 T: super::stub::RegionNetworkEndpointGroups + 'static,
11873 {
11874 Self {
11875 inner: std::sync::Arc::new(stub),
11876 }
11877 }
11878
11879 pub(crate) async fn new(
11880 config: gaxi::options::ClientConfig,
11881 ) -> gax::client_builder::Result<Self> {
11882 let inner = Self::build_inner(config).await?;
11883 Ok(Self { inner })
11884 }
11885
11886 async fn build_inner(
11887 conf: gaxi::options::ClientConfig,
11888 ) -> gax::client_builder::Result<
11889 std::sync::Arc<dyn super::stub::dynamic::RegionNetworkEndpointGroups>,
11890 > {
11891 if gaxi::options::tracing_enabled(&conf) {
11892 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
11893 }
11894 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
11895 }
11896
11897 async fn build_transport(
11898 conf: gaxi::options::ClientConfig,
11899 ) -> gax::client_builder::Result<impl super::stub::RegionNetworkEndpointGroups> {
11900 super::transport::RegionNetworkEndpointGroups::new(conf).await
11901 }
11902
11903 async fn build_with_tracing(
11904 conf: gaxi::options::ClientConfig,
11905 ) -> gax::client_builder::Result<impl super::stub::RegionNetworkEndpointGroups> {
11906 Self::build_transport(conf)
11907 .await
11908 .map(super::tracing::RegionNetworkEndpointGroups::new)
11909 }
11910
11911 /// Attach a list of network endpoints to the specified network endpoint group.
11912 pub fn attach_network_endpoints(
11913 &self,
11914 ) -> super::builder::region_network_endpoint_groups::AttachNetworkEndpoints {
11915 super::builder::region_network_endpoint_groups::AttachNetworkEndpoints::new(
11916 self.inner.clone(),
11917 )
11918 }
11919
11920 /// Deletes the specified network endpoint group. Note that the NEG cannot be
11921 /// deleted if it is configured as a backend of a backend service.
11922 pub fn delete(&self) -> super::builder::region_network_endpoint_groups::Delete {
11923 super::builder::region_network_endpoint_groups::Delete::new(self.inner.clone())
11924 }
11925
11926 /// Detach the network endpoint from the specified network endpoint group.
11927 pub fn detach_network_endpoints(
11928 &self,
11929 ) -> super::builder::region_network_endpoint_groups::DetachNetworkEndpoints {
11930 super::builder::region_network_endpoint_groups::DetachNetworkEndpoints::new(
11931 self.inner.clone(),
11932 )
11933 }
11934
11935 /// Returns the specified network endpoint group.
11936 pub fn get(&self) -> super::builder::region_network_endpoint_groups::Get {
11937 super::builder::region_network_endpoint_groups::Get::new(self.inner.clone())
11938 }
11939
11940 /// Creates a network endpoint group in the specified project using the
11941 /// parameters that are included in the request.
11942 pub fn insert(&self) -> super::builder::region_network_endpoint_groups::Insert {
11943 super::builder::region_network_endpoint_groups::Insert::new(self.inner.clone())
11944 }
11945
11946 /// Retrieves the list of regional network endpoint groups available to the
11947 /// specified project in the given region.
11948 pub fn list(&self) -> super::builder::region_network_endpoint_groups::List {
11949 super::builder::region_network_endpoint_groups::List::new(self.inner.clone())
11950 }
11951
11952 /// Lists the network endpoints in the specified network endpoint group.
11953 pub fn list_network_endpoints(
11954 &self,
11955 ) -> super::builder::region_network_endpoint_groups::ListNetworkEndpoints {
11956 super::builder::region_network_endpoint_groups::ListNetworkEndpoints::new(
11957 self.inner.clone(),
11958 )
11959 }
11960
11961 /// Retrieves the specified region-specific Operations resource.
11962 pub fn get_operation(&self) -> super::builder::region_network_endpoint_groups::GetOperation {
11963 super::builder::region_network_endpoint_groups::GetOperation::new(self.inner.clone())
11964 }
11965}
11966
11967/// Implements a client for the Google Compute Engine API.
11968///
11969/// # Example
11970/// ```
11971/// # tokio_test::block_on(async {
11972/// # use google_cloud_compute_v1::client::RegionNetworkFirewallPolicies;
11973/// let client = RegionNetworkFirewallPolicies::builder().build().await?;
11974/// // use `client` to make requests to the Google Compute Engine API.
11975/// # gax::client_builder::Result::<()>::Ok(()) });
11976/// ```
11977///
11978/// # Service Description
11979///
11980/// Service for the `regionNetworkFirewallPolicies` resource.
11981///
11982/// # Configuration
11983///
11984/// To configure `RegionNetworkFirewallPolicies` use the `with_*` methods in the type returned
11985/// by [builder()][RegionNetworkFirewallPolicies::builder]. The default configuration should
11986/// work for most applications. Common configuration changes include
11987///
11988/// * [with_endpoint()]: by default this client uses the global default endpoint
11989/// (`https://compute.googleapis.com`). Applications using regional
11990/// endpoints or running in restricted networks (e.g. a network configured
11991// with [Private Google Access with VPC Service Controls]) may want to
11992/// override this default.
11993/// * [with_credentials()]: by default this client uses
11994/// [Application Default Credentials]. Applications using custom
11995/// authentication may need to override this default.
11996///
11997/// [with_endpoint()]: super::builder::region_network_firewall_policies::ClientBuilder::with_endpoint
11998/// [with_credentials()]: super::builder::region_network_firewall_policies::ClientBuilder::credentials
11999/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12000/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12001///
12002/// # Pooling and Cloning
12003///
12004/// `RegionNetworkFirewallPolicies` holds a connection pool internally, it is advised to
12005/// create one and the reuse it. You do not need to wrap `RegionNetworkFirewallPolicies` in
12006/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12007/// already uses an `Arc` internally.
12008#[cfg(feature = "region-network-firewall-policies")]
12009#[cfg_attr(docsrs, doc(cfg(feature = "region-network-firewall-policies")))]
12010#[derive(Clone, Debug)]
12011pub struct RegionNetworkFirewallPolicies {
12012 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNetworkFirewallPolicies>,
12013}
12014
12015#[cfg(feature = "region-network-firewall-policies")]
12016impl RegionNetworkFirewallPolicies {
12017 /// Returns a builder for [RegionNetworkFirewallPolicies].
12018 ///
12019 /// ```
12020 /// # tokio_test::block_on(async {
12021 /// # use google_cloud_compute_v1::client::RegionNetworkFirewallPolicies;
12022 /// let client = RegionNetworkFirewallPolicies::builder().build().await?;
12023 /// # gax::client_builder::Result::<()>::Ok(()) });
12024 /// ```
12025 pub fn builder() -> super::builder::region_network_firewall_policies::ClientBuilder {
12026 gax::client_builder::internal::new_builder(
12027 super::builder::region_network_firewall_policies::client::Factory,
12028 )
12029 }
12030
12031 /// Creates a new client from the provided stub.
12032 ///
12033 /// The most common case for calling this function is in tests mocking the
12034 /// client's behavior.
12035 pub fn from_stub<T>(stub: T) -> Self
12036 where
12037 T: super::stub::RegionNetworkFirewallPolicies + 'static,
12038 {
12039 Self {
12040 inner: std::sync::Arc::new(stub),
12041 }
12042 }
12043
12044 pub(crate) async fn new(
12045 config: gaxi::options::ClientConfig,
12046 ) -> gax::client_builder::Result<Self> {
12047 let inner = Self::build_inner(config).await?;
12048 Ok(Self { inner })
12049 }
12050
12051 async fn build_inner(
12052 conf: gaxi::options::ClientConfig,
12053 ) -> gax::client_builder::Result<
12054 std::sync::Arc<dyn super::stub::dynamic::RegionNetworkFirewallPolicies>,
12055 > {
12056 if gaxi::options::tracing_enabled(&conf) {
12057 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12058 }
12059 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12060 }
12061
12062 async fn build_transport(
12063 conf: gaxi::options::ClientConfig,
12064 ) -> gax::client_builder::Result<impl super::stub::RegionNetworkFirewallPolicies> {
12065 super::transport::RegionNetworkFirewallPolicies::new(conf).await
12066 }
12067
12068 async fn build_with_tracing(
12069 conf: gaxi::options::ClientConfig,
12070 ) -> gax::client_builder::Result<impl super::stub::RegionNetworkFirewallPolicies> {
12071 Self::build_transport(conf)
12072 .await
12073 .map(super::tracing::RegionNetworkFirewallPolicies::new)
12074 }
12075
12076 /// Inserts an association for the specified network firewall policy.
12077 pub fn add_association(
12078 &self,
12079 ) -> super::builder::region_network_firewall_policies::AddAssociation {
12080 super::builder::region_network_firewall_policies::AddAssociation::new(self.inner.clone())
12081 }
12082
12083 /// Inserts a rule into a network firewall policy.
12084 pub fn add_rule(&self) -> super::builder::region_network_firewall_policies::AddRule {
12085 super::builder::region_network_firewall_policies::AddRule::new(self.inner.clone())
12086 }
12087
12088 /// Copies rules to the specified network firewall policy.
12089 pub fn clone_rules(&self) -> super::builder::region_network_firewall_policies::CloneRules {
12090 super::builder::region_network_firewall_policies::CloneRules::new(self.inner.clone())
12091 }
12092
12093 /// Deletes the specified network firewall policy.
12094 pub fn delete(&self) -> super::builder::region_network_firewall_policies::Delete {
12095 super::builder::region_network_firewall_policies::Delete::new(self.inner.clone())
12096 }
12097
12098 /// Returns the specified network firewall policy.
12099 pub fn get(&self) -> super::builder::region_network_firewall_policies::Get {
12100 super::builder::region_network_firewall_policies::Get::new(self.inner.clone())
12101 }
12102
12103 /// Gets an association with the specified name.
12104 pub fn get_association(
12105 &self,
12106 ) -> super::builder::region_network_firewall_policies::GetAssociation {
12107 super::builder::region_network_firewall_policies::GetAssociation::new(self.inner.clone())
12108 }
12109
12110 /// Returns the effective firewalls on a given network.
12111 pub fn get_effective_firewalls(
12112 &self,
12113 ) -> super::builder::region_network_firewall_policies::GetEffectiveFirewalls {
12114 super::builder::region_network_firewall_policies::GetEffectiveFirewalls::new(
12115 self.inner.clone(),
12116 )
12117 }
12118
12119 /// Gets the access control policy for a resource. May be empty if no such
12120 /// policy or resource exists.
12121 pub fn get_iam_policy(&self) -> super::builder::region_network_firewall_policies::GetIamPolicy {
12122 super::builder::region_network_firewall_policies::GetIamPolicy::new(self.inner.clone())
12123 }
12124
12125 /// Gets a rule of the specified priority.
12126 pub fn get_rule(&self) -> super::builder::region_network_firewall_policies::GetRule {
12127 super::builder::region_network_firewall_policies::GetRule::new(self.inner.clone())
12128 }
12129
12130 /// Creates a new network firewall policy in the specified project and region.
12131 pub fn insert(&self) -> super::builder::region_network_firewall_policies::Insert {
12132 super::builder::region_network_firewall_policies::Insert::new(self.inner.clone())
12133 }
12134
12135 /// Lists all the network firewall policies that have been configured
12136 /// for the specified project in the given region.
12137 pub fn list(&self) -> super::builder::region_network_firewall_policies::List {
12138 super::builder::region_network_firewall_policies::List::new(self.inner.clone())
12139 }
12140
12141 /// Patches the specified network firewall policy.
12142 pub fn patch(&self) -> super::builder::region_network_firewall_policies::Patch {
12143 super::builder::region_network_firewall_policies::Patch::new(self.inner.clone())
12144 }
12145
12146 /// Patches a rule of the specified priority.
12147 pub fn patch_rule(&self) -> super::builder::region_network_firewall_policies::PatchRule {
12148 super::builder::region_network_firewall_policies::PatchRule::new(self.inner.clone())
12149 }
12150
12151 /// Removes an association for the specified network firewall policy.
12152 pub fn remove_association(
12153 &self,
12154 ) -> super::builder::region_network_firewall_policies::RemoveAssociation {
12155 super::builder::region_network_firewall_policies::RemoveAssociation::new(self.inner.clone())
12156 }
12157
12158 /// Deletes a rule of the specified priority.
12159 pub fn remove_rule(&self) -> super::builder::region_network_firewall_policies::RemoveRule {
12160 super::builder::region_network_firewall_policies::RemoveRule::new(self.inner.clone())
12161 }
12162
12163 /// Sets the access control policy on the specified resource.
12164 /// Replaces any existing policy.
12165 pub fn set_iam_policy(&self) -> super::builder::region_network_firewall_policies::SetIamPolicy {
12166 super::builder::region_network_firewall_policies::SetIamPolicy::new(self.inner.clone())
12167 }
12168
12169 /// Returns permissions that a caller has on the specified resource.
12170 pub fn test_iam_permissions(
12171 &self,
12172 ) -> super::builder::region_network_firewall_policies::TestIamPermissions {
12173 super::builder::region_network_firewall_policies::TestIamPermissions::new(
12174 self.inner.clone(),
12175 )
12176 }
12177
12178 /// Retrieves the specified region-specific Operations resource.
12179 pub fn get_operation(&self) -> super::builder::region_network_firewall_policies::GetOperation {
12180 super::builder::region_network_firewall_policies::GetOperation::new(self.inner.clone())
12181 }
12182}
12183
12184/// Implements a client for the Google Compute Engine API.
12185///
12186/// # Example
12187/// ```
12188/// # tokio_test::block_on(async {
12189/// # use google_cloud_compute_v1::client::RegionNotificationEndpoints;
12190/// let client = RegionNotificationEndpoints::builder().build().await?;
12191/// // use `client` to make requests to the Google Compute Engine API.
12192/// # gax::client_builder::Result::<()>::Ok(()) });
12193/// ```
12194///
12195/// # Service Description
12196///
12197/// Service for the `regionNotificationEndpoints` resource.
12198///
12199/// # Configuration
12200///
12201/// To configure `RegionNotificationEndpoints` use the `with_*` methods in the type returned
12202/// by [builder()][RegionNotificationEndpoints::builder]. The default configuration should
12203/// work for most applications. Common configuration changes include
12204///
12205/// * [with_endpoint()]: by default this client uses the global default endpoint
12206/// (`https://compute.googleapis.com`). Applications using regional
12207/// endpoints or running in restricted networks (e.g. a network configured
12208// with [Private Google Access with VPC Service Controls]) may want to
12209/// override this default.
12210/// * [with_credentials()]: by default this client uses
12211/// [Application Default Credentials]. Applications using custom
12212/// authentication may need to override this default.
12213///
12214/// [with_endpoint()]: super::builder::region_notification_endpoints::ClientBuilder::with_endpoint
12215/// [with_credentials()]: super::builder::region_notification_endpoints::ClientBuilder::credentials
12216/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12217/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12218///
12219/// # Pooling and Cloning
12220///
12221/// `RegionNotificationEndpoints` holds a connection pool internally, it is advised to
12222/// create one and the reuse it. You do not need to wrap `RegionNotificationEndpoints` in
12223/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12224/// already uses an `Arc` internally.
12225#[cfg(feature = "region-notification-endpoints")]
12226#[cfg_attr(docsrs, doc(cfg(feature = "region-notification-endpoints")))]
12227#[derive(Clone, Debug)]
12228pub struct RegionNotificationEndpoints {
12229 inner: std::sync::Arc<dyn super::stub::dynamic::RegionNotificationEndpoints>,
12230}
12231
12232#[cfg(feature = "region-notification-endpoints")]
12233impl RegionNotificationEndpoints {
12234 /// Returns a builder for [RegionNotificationEndpoints].
12235 ///
12236 /// ```
12237 /// # tokio_test::block_on(async {
12238 /// # use google_cloud_compute_v1::client::RegionNotificationEndpoints;
12239 /// let client = RegionNotificationEndpoints::builder().build().await?;
12240 /// # gax::client_builder::Result::<()>::Ok(()) });
12241 /// ```
12242 pub fn builder() -> super::builder::region_notification_endpoints::ClientBuilder {
12243 gax::client_builder::internal::new_builder(
12244 super::builder::region_notification_endpoints::client::Factory,
12245 )
12246 }
12247
12248 /// Creates a new client from the provided stub.
12249 ///
12250 /// The most common case for calling this function is in tests mocking the
12251 /// client's behavior.
12252 pub fn from_stub<T>(stub: T) -> Self
12253 where
12254 T: super::stub::RegionNotificationEndpoints + 'static,
12255 {
12256 Self {
12257 inner: std::sync::Arc::new(stub),
12258 }
12259 }
12260
12261 pub(crate) async fn new(
12262 config: gaxi::options::ClientConfig,
12263 ) -> gax::client_builder::Result<Self> {
12264 let inner = Self::build_inner(config).await?;
12265 Ok(Self { inner })
12266 }
12267
12268 async fn build_inner(
12269 conf: gaxi::options::ClientConfig,
12270 ) -> gax::client_builder::Result<
12271 std::sync::Arc<dyn super::stub::dynamic::RegionNotificationEndpoints>,
12272 > {
12273 if gaxi::options::tracing_enabled(&conf) {
12274 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12275 }
12276 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12277 }
12278
12279 async fn build_transport(
12280 conf: gaxi::options::ClientConfig,
12281 ) -> gax::client_builder::Result<impl super::stub::RegionNotificationEndpoints> {
12282 super::transport::RegionNotificationEndpoints::new(conf).await
12283 }
12284
12285 async fn build_with_tracing(
12286 conf: gaxi::options::ClientConfig,
12287 ) -> gax::client_builder::Result<impl super::stub::RegionNotificationEndpoints> {
12288 Self::build_transport(conf)
12289 .await
12290 .map(super::tracing::RegionNotificationEndpoints::new)
12291 }
12292
12293 /// Deletes the specified NotificationEndpoint in the given region
12294 pub fn delete(&self) -> super::builder::region_notification_endpoints::Delete {
12295 super::builder::region_notification_endpoints::Delete::new(self.inner.clone())
12296 }
12297
12298 /// Returns the specified NotificationEndpoint resource in the given region.
12299 pub fn get(&self) -> super::builder::region_notification_endpoints::Get {
12300 super::builder::region_notification_endpoints::Get::new(self.inner.clone())
12301 }
12302
12303 /// Create a NotificationEndpoint in the specified project in the given region
12304 /// using the parameters that are included in the request.
12305 pub fn insert(&self) -> super::builder::region_notification_endpoints::Insert {
12306 super::builder::region_notification_endpoints::Insert::new(self.inner.clone())
12307 }
12308
12309 /// Lists the NotificationEndpoints for a project in the given region.
12310 pub fn list(&self) -> super::builder::region_notification_endpoints::List {
12311 super::builder::region_notification_endpoints::List::new(self.inner.clone())
12312 }
12313
12314 /// Retrieves the specified region-specific Operations resource.
12315 pub fn get_operation(&self) -> super::builder::region_notification_endpoints::GetOperation {
12316 super::builder::region_notification_endpoints::GetOperation::new(self.inner.clone())
12317 }
12318}
12319
12320/// Implements a client for the Google Compute Engine API.
12321///
12322/// # Example
12323/// ```
12324/// # tokio_test::block_on(async {
12325/// # use google_cloud_compute_v1::client::RegionOperations;
12326/// let client = RegionOperations::builder().build().await?;
12327/// // use `client` to make requests to the Google Compute Engine API.
12328/// # gax::client_builder::Result::<()>::Ok(()) });
12329/// ```
12330///
12331/// # Service Description
12332///
12333/// Service for the `regionOperations` resource.
12334///
12335/// # Configuration
12336///
12337/// To configure `RegionOperations` use the `with_*` methods in the type returned
12338/// by [builder()][RegionOperations::builder]. The default configuration should
12339/// work for most applications. Common configuration changes include
12340///
12341/// * [with_endpoint()]: by default this client uses the global default endpoint
12342/// (`https://compute.googleapis.com`). Applications using regional
12343/// endpoints or running in restricted networks (e.g. a network configured
12344// with [Private Google Access with VPC Service Controls]) may want to
12345/// override this default.
12346/// * [with_credentials()]: by default this client uses
12347/// [Application Default Credentials]. Applications using custom
12348/// authentication may need to override this default.
12349///
12350/// [with_endpoint()]: super::builder::region_operations::ClientBuilder::with_endpoint
12351/// [with_credentials()]: super::builder::region_operations::ClientBuilder::credentials
12352/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12353/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12354///
12355/// # Pooling and Cloning
12356///
12357/// `RegionOperations` holds a connection pool internally, it is advised to
12358/// create one and the reuse it. You do not need to wrap `RegionOperations` in
12359/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12360/// already uses an `Arc` internally.
12361#[cfg(feature = "region-operations")]
12362#[cfg_attr(docsrs, doc(cfg(feature = "region-operations")))]
12363#[derive(Clone, Debug)]
12364pub struct RegionOperations {
12365 inner: std::sync::Arc<dyn super::stub::dynamic::RegionOperations>,
12366}
12367
12368#[cfg(feature = "region-operations")]
12369impl RegionOperations {
12370 /// Returns a builder for [RegionOperations].
12371 ///
12372 /// ```
12373 /// # tokio_test::block_on(async {
12374 /// # use google_cloud_compute_v1::client::RegionOperations;
12375 /// let client = RegionOperations::builder().build().await?;
12376 /// # gax::client_builder::Result::<()>::Ok(()) });
12377 /// ```
12378 pub fn builder() -> super::builder::region_operations::ClientBuilder {
12379 gax::client_builder::internal::new_builder(
12380 super::builder::region_operations::client::Factory,
12381 )
12382 }
12383
12384 /// Creates a new client from the provided stub.
12385 ///
12386 /// The most common case for calling this function is in tests mocking the
12387 /// client's behavior.
12388 pub fn from_stub<T>(stub: T) -> Self
12389 where
12390 T: super::stub::RegionOperations + 'static,
12391 {
12392 Self {
12393 inner: std::sync::Arc::new(stub),
12394 }
12395 }
12396
12397 pub(crate) async fn new(
12398 config: gaxi::options::ClientConfig,
12399 ) -> gax::client_builder::Result<Self> {
12400 let inner = Self::build_inner(config).await?;
12401 Ok(Self { inner })
12402 }
12403
12404 async fn build_inner(
12405 conf: gaxi::options::ClientConfig,
12406 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionOperations>>
12407 {
12408 if gaxi::options::tracing_enabled(&conf) {
12409 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12410 }
12411 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12412 }
12413
12414 async fn build_transport(
12415 conf: gaxi::options::ClientConfig,
12416 ) -> gax::client_builder::Result<impl super::stub::RegionOperations> {
12417 super::transport::RegionOperations::new(conf).await
12418 }
12419
12420 async fn build_with_tracing(
12421 conf: gaxi::options::ClientConfig,
12422 ) -> gax::client_builder::Result<impl super::stub::RegionOperations> {
12423 Self::build_transport(conf)
12424 .await
12425 .map(super::tracing::RegionOperations::new)
12426 }
12427
12428 /// Deletes the specified region-specific Operations resource.
12429 pub fn delete(&self) -> super::builder::region_operations::Delete {
12430 super::builder::region_operations::Delete::new(self.inner.clone())
12431 }
12432
12433 /// Retrieves the specified region-specific Operations resource.
12434 pub fn get(&self) -> super::builder::region_operations::Get {
12435 super::builder::region_operations::Get::new(self.inner.clone())
12436 }
12437
12438 /// Retrieves a list of Operation resources contained within
12439 /// the specified region.
12440 pub fn list(&self) -> super::builder::region_operations::List {
12441 super::builder::region_operations::List::new(self.inner.clone())
12442 }
12443
12444 /// Waits for the specified Operation resource to return as `DONE`
12445 /// or for the request to approach the 2 minute deadline, and retrieves the
12446 /// specified Operation resource. This method differs from the
12447 /// `GET` method in that it waits for no more than the default
12448 /// deadline (2 minutes) and then returns the current state of the operation,
12449 /// which might be `DONE` or still in progress.
12450 ///
12451 /// This method is called on a best-effort basis. Specifically:
12452 ///
12453 /// ```norust
12454 /// - In uncommon cases, when the server is overloaded, the request might
12455 /// return before the default deadline is reached, or might return after zero
12456 /// seconds.
12457 /// ```
12458 ///
12459 /// - If the default deadline is reached, there is no guarantee that the
12460 /// operation is actually done when the method returns. Be prepared to retry
12461 /// if the operation is not `DONE`.
12462 pub fn wait(&self) -> super::builder::region_operations::Wait {
12463 super::builder::region_operations::Wait::new(self.inner.clone())
12464 }
12465}
12466
12467/// Implements a client for the Google Compute Engine API.
12468///
12469/// # Example
12470/// ```
12471/// # tokio_test::block_on(async {
12472/// # use google_cloud_compute_v1::client::RegionSecurityPolicies;
12473/// let client = RegionSecurityPolicies::builder().build().await?;
12474/// // use `client` to make requests to the Google Compute Engine API.
12475/// # gax::client_builder::Result::<()>::Ok(()) });
12476/// ```
12477///
12478/// # Service Description
12479///
12480/// Service for the `regionSecurityPolicies` resource.
12481///
12482/// # Configuration
12483///
12484/// To configure `RegionSecurityPolicies` use the `with_*` methods in the type returned
12485/// by [builder()][RegionSecurityPolicies::builder]. The default configuration should
12486/// work for most applications. Common configuration changes include
12487///
12488/// * [with_endpoint()]: by default this client uses the global default endpoint
12489/// (`https://compute.googleapis.com`). Applications using regional
12490/// endpoints or running in restricted networks (e.g. a network configured
12491// with [Private Google Access with VPC Service Controls]) may want to
12492/// override this default.
12493/// * [with_credentials()]: by default this client uses
12494/// [Application Default Credentials]. Applications using custom
12495/// authentication may need to override this default.
12496///
12497/// [with_endpoint()]: super::builder::region_security_policies::ClientBuilder::with_endpoint
12498/// [with_credentials()]: super::builder::region_security_policies::ClientBuilder::credentials
12499/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12500/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12501///
12502/// # Pooling and Cloning
12503///
12504/// `RegionSecurityPolicies` holds a connection pool internally, it is advised to
12505/// create one and the reuse it. You do not need to wrap `RegionSecurityPolicies` in
12506/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12507/// already uses an `Arc` internally.
12508#[cfg(feature = "region-security-policies")]
12509#[cfg_attr(docsrs, doc(cfg(feature = "region-security-policies")))]
12510#[derive(Clone, Debug)]
12511pub struct RegionSecurityPolicies {
12512 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSecurityPolicies>,
12513}
12514
12515#[cfg(feature = "region-security-policies")]
12516impl RegionSecurityPolicies {
12517 /// Returns a builder for [RegionSecurityPolicies].
12518 ///
12519 /// ```
12520 /// # tokio_test::block_on(async {
12521 /// # use google_cloud_compute_v1::client::RegionSecurityPolicies;
12522 /// let client = RegionSecurityPolicies::builder().build().await?;
12523 /// # gax::client_builder::Result::<()>::Ok(()) });
12524 /// ```
12525 pub fn builder() -> super::builder::region_security_policies::ClientBuilder {
12526 gax::client_builder::internal::new_builder(
12527 super::builder::region_security_policies::client::Factory,
12528 )
12529 }
12530
12531 /// Creates a new client from the provided stub.
12532 ///
12533 /// The most common case for calling this function is in tests mocking the
12534 /// client's behavior.
12535 pub fn from_stub<T>(stub: T) -> Self
12536 where
12537 T: super::stub::RegionSecurityPolicies + 'static,
12538 {
12539 Self {
12540 inner: std::sync::Arc::new(stub),
12541 }
12542 }
12543
12544 pub(crate) async fn new(
12545 config: gaxi::options::ClientConfig,
12546 ) -> gax::client_builder::Result<Self> {
12547 let inner = Self::build_inner(config).await?;
12548 Ok(Self { inner })
12549 }
12550
12551 async fn build_inner(
12552 conf: gaxi::options::ClientConfig,
12553 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionSecurityPolicies>>
12554 {
12555 if gaxi::options::tracing_enabled(&conf) {
12556 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12557 }
12558 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12559 }
12560
12561 async fn build_transport(
12562 conf: gaxi::options::ClientConfig,
12563 ) -> gax::client_builder::Result<impl super::stub::RegionSecurityPolicies> {
12564 super::transport::RegionSecurityPolicies::new(conf).await
12565 }
12566
12567 async fn build_with_tracing(
12568 conf: gaxi::options::ClientConfig,
12569 ) -> gax::client_builder::Result<impl super::stub::RegionSecurityPolicies> {
12570 Self::build_transport(conf)
12571 .await
12572 .map(super::tracing::RegionSecurityPolicies::new)
12573 }
12574
12575 /// Inserts a rule into a security policy.
12576 pub fn add_rule(&self) -> super::builder::region_security_policies::AddRule {
12577 super::builder::region_security_policies::AddRule::new(self.inner.clone())
12578 }
12579
12580 /// Deletes the specified policy.
12581 pub fn delete(&self) -> super::builder::region_security_policies::Delete {
12582 super::builder::region_security_policies::Delete::new(self.inner.clone())
12583 }
12584
12585 /// List all of the ordered rules present in a single specified policy.
12586 pub fn get(&self) -> super::builder::region_security_policies::Get {
12587 super::builder::region_security_policies::Get::new(self.inner.clone())
12588 }
12589
12590 /// Gets a rule at the specified priority.
12591 pub fn get_rule(&self) -> super::builder::region_security_policies::GetRule {
12592 super::builder::region_security_policies::GetRule::new(self.inner.clone())
12593 }
12594
12595 /// Creates a new policy in the specified project using the data included in
12596 /// the request.
12597 pub fn insert(&self) -> super::builder::region_security_policies::Insert {
12598 super::builder::region_security_policies::Insert::new(self.inner.clone())
12599 }
12600
12601 /// List all the policies that have been configured for the specified project
12602 /// and region.
12603 pub fn list(&self) -> super::builder::region_security_policies::List {
12604 super::builder::region_security_policies::List::new(self.inner.clone())
12605 }
12606
12607 /// Patches the specified policy with the data included in the request. To
12608 /// clear fields in the policy, leave the fields empty and specify them in the
12609 /// updateMask. This cannot be used to be update the rules in the policy.
12610 /// Please use the per rule methods like addRule, patchRule, and removeRule
12611 /// instead.
12612 pub fn patch(&self) -> super::builder::region_security_policies::Patch {
12613 super::builder::region_security_policies::Patch::new(self.inner.clone())
12614 }
12615
12616 /// Patches a rule at the specified priority. To clear fields in the rule,
12617 /// leave the fields empty and specify them in the updateMask.
12618 pub fn patch_rule(&self) -> super::builder::region_security_policies::PatchRule {
12619 super::builder::region_security_policies::PatchRule::new(self.inner.clone())
12620 }
12621
12622 /// Deletes a rule at the specified priority.
12623 pub fn remove_rule(&self) -> super::builder::region_security_policies::RemoveRule {
12624 super::builder::region_security_policies::RemoveRule::new(self.inner.clone())
12625 }
12626
12627 /// Sets the labels on a security policy. To learn more about labels,
12628 /// read the Labeling Resources
12629 /// documentation.
12630 pub fn set_labels(&self) -> super::builder::region_security_policies::SetLabels {
12631 super::builder::region_security_policies::SetLabels::new(self.inner.clone())
12632 }
12633
12634 /// Retrieves the specified region-specific Operations resource.
12635 pub fn get_operation(&self) -> super::builder::region_security_policies::GetOperation {
12636 super::builder::region_security_policies::GetOperation::new(self.inner.clone())
12637 }
12638}
12639
12640/// Implements a client for the Google Compute Engine API.
12641///
12642/// # Example
12643/// ```
12644/// # tokio_test::block_on(async {
12645/// # use google_cloud_compute_v1::client::RegionSslCertificates;
12646/// let client = RegionSslCertificates::builder().build().await?;
12647/// // use `client` to make requests to the Google Compute Engine API.
12648/// # gax::client_builder::Result::<()>::Ok(()) });
12649/// ```
12650///
12651/// # Service Description
12652///
12653/// Service for the `regionSslCertificates` resource.
12654///
12655/// # Configuration
12656///
12657/// To configure `RegionSslCertificates` use the `with_*` methods in the type returned
12658/// by [builder()][RegionSslCertificates::builder]. The default configuration should
12659/// work for most applications. Common configuration changes include
12660///
12661/// * [with_endpoint()]: by default this client uses the global default endpoint
12662/// (`https://compute.googleapis.com`). Applications using regional
12663/// endpoints or running in restricted networks (e.g. a network configured
12664// with [Private Google Access with VPC Service Controls]) may want to
12665/// override this default.
12666/// * [with_credentials()]: by default this client uses
12667/// [Application Default Credentials]. Applications using custom
12668/// authentication may need to override this default.
12669///
12670/// [with_endpoint()]: super::builder::region_ssl_certificates::ClientBuilder::with_endpoint
12671/// [with_credentials()]: super::builder::region_ssl_certificates::ClientBuilder::credentials
12672/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12673/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12674///
12675/// # Pooling and Cloning
12676///
12677/// `RegionSslCertificates` holds a connection pool internally, it is advised to
12678/// create one and the reuse it. You do not need to wrap `RegionSslCertificates` in
12679/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12680/// already uses an `Arc` internally.
12681#[cfg(feature = "region-ssl-certificates")]
12682#[cfg_attr(docsrs, doc(cfg(feature = "region-ssl-certificates")))]
12683#[derive(Clone, Debug)]
12684pub struct RegionSslCertificates {
12685 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSslCertificates>,
12686}
12687
12688#[cfg(feature = "region-ssl-certificates")]
12689impl RegionSslCertificates {
12690 /// Returns a builder for [RegionSslCertificates].
12691 ///
12692 /// ```
12693 /// # tokio_test::block_on(async {
12694 /// # use google_cloud_compute_v1::client::RegionSslCertificates;
12695 /// let client = RegionSslCertificates::builder().build().await?;
12696 /// # gax::client_builder::Result::<()>::Ok(()) });
12697 /// ```
12698 pub fn builder() -> super::builder::region_ssl_certificates::ClientBuilder {
12699 gax::client_builder::internal::new_builder(
12700 super::builder::region_ssl_certificates::client::Factory,
12701 )
12702 }
12703
12704 /// Creates a new client from the provided stub.
12705 ///
12706 /// The most common case for calling this function is in tests mocking the
12707 /// client's behavior.
12708 pub fn from_stub<T>(stub: T) -> Self
12709 where
12710 T: super::stub::RegionSslCertificates + 'static,
12711 {
12712 Self {
12713 inner: std::sync::Arc::new(stub),
12714 }
12715 }
12716
12717 pub(crate) async fn new(
12718 config: gaxi::options::ClientConfig,
12719 ) -> gax::client_builder::Result<Self> {
12720 let inner = Self::build_inner(config).await?;
12721 Ok(Self { inner })
12722 }
12723
12724 async fn build_inner(
12725 conf: gaxi::options::ClientConfig,
12726 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionSslCertificates>>
12727 {
12728 if gaxi::options::tracing_enabled(&conf) {
12729 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12730 }
12731 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12732 }
12733
12734 async fn build_transport(
12735 conf: gaxi::options::ClientConfig,
12736 ) -> gax::client_builder::Result<impl super::stub::RegionSslCertificates> {
12737 super::transport::RegionSslCertificates::new(conf).await
12738 }
12739
12740 async fn build_with_tracing(
12741 conf: gaxi::options::ClientConfig,
12742 ) -> gax::client_builder::Result<impl super::stub::RegionSslCertificates> {
12743 Self::build_transport(conf)
12744 .await
12745 .map(super::tracing::RegionSslCertificates::new)
12746 }
12747
12748 /// Deletes the specified SslCertificate resource in the region.
12749 pub fn delete(&self) -> super::builder::region_ssl_certificates::Delete {
12750 super::builder::region_ssl_certificates::Delete::new(self.inner.clone())
12751 }
12752
12753 /// Returns the specified SslCertificate resource in the specified region. Get
12754 /// a list of available SSL certificates by making a list()
12755 /// request.
12756 pub fn get(&self) -> super::builder::region_ssl_certificates::Get {
12757 super::builder::region_ssl_certificates::Get::new(self.inner.clone())
12758 }
12759
12760 /// Creates a SslCertificate resource in the specified project and region using
12761 /// the data included in the request
12762 pub fn insert(&self) -> super::builder::region_ssl_certificates::Insert {
12763 super::builder::region_ssl_certificates::Insert::new(self.inner.clone())
12764 }
12765
12766 /// Retrieves the list of SslCertificate resources available to the specified
12767 /// project in the specified region.
12768 pub fn list(&self) -> super::builder::region_ssl_certificates::List {
12769 super::builder::region_ssl_certificates::List::new(self.inner.clone())
12770 }
12771
12772 /// Retrieves the specified region-specific Operations resource.
12773 pub fn get_operation(&self) -> super::builder::region_ssl_certificates::GetOperation {
12774 super::builder::region_ssl_certificates::GetOperation::new(self.inner.clone())
12775 }
12776}
12777
12778/// Implements a client for the Google Compute Engine API.
12779///
12780/// # Example
12781/// ```
12782/// # tokio_test::block_on(async {
12783/// # use google_cloud_compute_v1::client::RegionSslPolicies;
12784/// let client = RegionSslPolicies::builder().build().await?;
12785/// // use `client` to make requests to the Google Compute Engine API.
12786/// # gax::client_builder::Result::<()>::Ok(()) });
12787/// ```
12788///
12789/// # Service Description
12790///
12791/// Service for the `regionSslPolicies` resource.
12792///
12793/// # Configuration
12794///
12795/// To configure `RegionSslPolicies` use the `with_*` methods in the type returned
12796/// by [builder()][RegionSslPolicies::builder]. The default configuration should
12797/// work for most applications. Common configuration changes include
12798///
12799/// * [with_endpoint()]: by default this client uses the global default endpoint
12800/// (`https://compute.googleapis.com`). Applications using regional
12801/// endpoints or running in restricted networks (e.g. a network configured
12802// with [Private Google Access with VPC Service Controls]) may want to
12803/// override this default.
12804/// * [with_credentials()]: by default this client uses
12805/// [Application Default Credentials]. Applications using custom
12806/// authentication may need to override this default.
12807///
12808/// [with_endpoint()]: super::builder::region_ssl_policies::ClientBuilder::with_endpoint
12809/// [with_credentials()]: super::builder::region_ssl_policies::ClientBuilder::credentials
12810/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12811/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12812///
12813/// # Pooling and Cloning
12814///
12815/// `RegionSslPolicies` holds a connection pool internally, it is advised to
12816/// create one and the reuse it. You do not need to wrap `RegionSslPolicies` in
12817/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12818/// already uses an `Arc` internally.
12819#[cfg(feature = "region-ssl-policies")]
12820#[cfg_attr(docsrs, doc(cfg(feature = "region-ssl-policies")))]
12821#[derive(Clone, Debug)]
12822pub struct RegionSslPolicies {
12823 inner: std::sync::Arc<dyn super::stub::dynamic::RegionSslPolicies>,
12824}
12825
12826#[cfg(feature = "region-ssl-policies")]
12827impl RegionSslPolicies {
12828 /// Returns a builder for [RegionSslPolicies].
12829 ///
12830 /// ```
12831 /// # tokio_test::block_on(async {
12832 /// # use google_cloud_compute_v1::client::RegionSslPolicies;
12833 /// let client = RegionSslPolicies::builder().build().await?;
12834 /// # gax::client_builder::Result::<()>::Ok(()) });
12835 /// ```
12836 pub fn builder() -> super::builder::region_ssl_policies::ClientBuilder {
12837 gax::client_builder::internal::new_builder(
12838 super::builder::region_ssl_policies::client::Factory,
12839 )
12840 }
12841
12842 /// Creates a new client from the provided stub.
12843 ///
12844 /// The most common case for calling this function is in tests mocking the
12845 /// client's behavior.
12846 pub fn from_stub<T>(stub: T) -> Self
12847 where
12848 T: super::stub::RegionSslPolicies + 'static,
12849 {
12850 Self {
12851 inner: std::sync::Arc::new(stub),
12852 }
12853 }
12854
12855 pub(crate) async fn new(
12856 config: gaxi::options::ClientConfig,
12857 ) -> gax::client_builder::Result<Self> {
12858 let inner = Self::build_inner(config).await?;
12859 Ok(Self { inner })
12860 }
12861
12862 async fn build_inner(
12863 conf: gaxi::options::ClientConfig,
12864 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionSslPolicies>>
12865 {
12866 if gaxi::options::tracing_enabled(&conf) {
12867 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
12868 }
12869 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
12870 }
12871
12872 async fn build_transport(
12873 conf: gaxi::options::ClientConfig,
12874 ) -> gax::client_builder::Result<impl super::stub::RegionSslPolicies> {
12875 super::transport::RegionSslPolicies::new(conf).await
12876 }
12877
12878 async fn build_with_tracing(
12879 conf: gaxi::options::ClientConfig,
12880 ) -> gax::client_builder::Result<impl super::stub::RegionSslPolicies> {
12881 Self::build_transport(conf)
12882 .await
12883 .map(super::tracing::RegionSslPolicies::new)
12884 }
12885
12886 /// Deletes the specified SSL policy. The SSL policy resource can be deleted
12887 /// only if it is not in use by any TargetHttpsProxy or TargetSslProxy
12888 /// resources.
12889 pub fn delete(&self) -> super::builder::region_ssl_policies::Delete {
12890 super::builder::region_ssl_policies::Delete::new(self.inner.clone())
12891 }
12892
12893 /// Lists all of the ordered rules present in a single specified policy.
12894 pub fn get(&self) -> super::builder::region_ssl_policies::Get {
12895 super::builder::region_ssl_policies::Get::new(self.inner.clone())
12896 }
12897
12898 /// Creates a new policy in the specified project and region using the data
12899 /// included in the request.
12900 pub fn insert(&self) -> super::builder::region_ssl_policies::Insert {
12901 super::builder::region_ssl_policies::Insert::new(self.inner.clone())
12902 }
12903
12904 /// Lists all the SSL policies that have been configured for the specified
12905 /// project and region.
12906 pub fn list(&self) -> super::builder::region_ssl_policies::List {
12907 super::builder::region_ssl_policies::List::new(self.inner.clone())
12908 }
12909
12910 /// Lists all features that can be specified in the SSL policy when using
12911 /// custom profile.
12912 pub fn list_available_features(
12913 &self,
12914 ) -> super::builder::region_ssl_policies::ListAvailableFeatures {
12915 super::builder::region_ssl_policies::ListAvailableFeatures::new(self.inner.clone())
12916 }
12917
12918 /// Patches the specified SSL policy with the data included in the request.
12919 pub fn patch(&self) -> super::builder::region_ssl_policies::Patch {
12920 super::builder::region_ssl_policies::Patch::new(self.inner.clone())
12921 }
12922
12923 /// Retrieves the specified region-specific Operations resource.
12924 pub fn get_operation(&self) -> super::builder::region_ssl_policies::GetOperation {
12925 super::builder::region_ssl_policies::GetOperation::new(self.inner.clone())
12926 }
12927}
12928
12929/// Implements a client for the Google Compute Engine API.
12930///
12931/// # Example
12932/// ```
12933/// # tokio_test::block_on(async {
12934/// # use google_cloud_compute_v1::client::RegionTargetHttpProxies;
12935/// let client = RegionTargetHttpProxies::builder().build().await?;
12936/// // use `client` to make requests to the Google Compute Engine API.
12937/// # gax::client_builder::Result::<()>::Ok(()) });
12938/// ```
12939///
12940/// # Service Description
12941///
12942/// Service for the `regionTargetHttpProxies` resource.
12943///
12944/// # Configuration
12945///
12946/// To configure `RegionTargetHttpProxies` use the `with_*` methods in the type returned
12947/// by [builder()][RegionTargetHttpProxies::builder]. The default configuration should
12948/// work for most applications. Common configuration changes include
12949///
12950/// * [with_endpoint()]: by default this client uses the global default endpoint
12951/// (`https://compute.googleapis.com`). Applications using regional
12952/// endpoints or running in restricted networks (e.g. a network configured
12953// with [Private Google Access with VPC Service Controls]) may want to
12954/// override this default.
12955/// * [with_credentials()]: by default this client uses
12956/// [Application Default Credentials]. Applications using custom
12957/// authentication may need to override this default.
12958///
12959/// [with_endpoint()]: super::builder::region_target_http_proxies::ClientBuilder::with_endpoint
12960/// [with_credentials()]: super::builder::region_target_http_proxies::ClientBuilder::credentials
12961/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
12962/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
12963///
12964/// # Pooling and Cloning
12965///
12966/// `RegionTargetHttpProxies` holds a connection pool internally, it is advised to
12967/// create one and the reuse it. You do not need to wrap `RegionTargetHttpProxies` in
12968/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
12969/// already uses an `Arc` internally.
12970#[cfg(feature = "region-target-http-proxies")]
12971#[cfg_attr(docsrs, doc(cfg(feature = "region-target-http-proxies")))]
12972#[derive(Clone, Debug)]
12973pub struct RegionTargetHttpProxies {
12974 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpProxies>,
12975}
12976
12977#[cfg(feature = "region-target-http-proxies")]
12978impl RegionTargetHttpProxies {
12979 /// Returns a builder for [RegionTargetHttpProxies].
12980 ///
12981 /// ```
12982 /// # tokio_test::block_on(async {
12983 /// # use google_cloud_compute_v1::client::RegionTargetHttpProxies;
12984 /// let client = RegionTargetHttpProxies::builder().build().await?;
12985 /// # gax::client_builder::Result::<()>::Ok(()) });
12986 /// ```
12987 pub fn builder() -> super::builder::region_target_http_proxies::ClientBuilder {
12988 gax::client_builder::internal::new_builder(
12989 super::builder::region_target_http_proxies::client::Factory,
12990 )
12991 }
12992
12993 /// Creates a new client from the provided stub.
12994 ///
12995 /// The most common case for calling this function is in tests mocking the
12996 /// client's behavior.
12997 pub fn from_stub<T>(stub: T) -> Self
12998 where
12999 T: super::stub::RegionTargetHttpProxies + 'static,
13000 {
13001 Self {
13002 inner: std::sync::Arc::new(stub),
13003 }
13004 }
13005
13006 pub(crate) async fn new(
13007 config: gaxi::options::ClientConfig,
13008 ) -> gax::client_builder::Result<Self> {
13009 let inner = Self::build_inner(config).await?;
13010 Ok(Self { inner })
13011 }
13012
13013 async fn build_inner(
13014 conf: gaxi::options::ClientConfig,
13015 ) -> gax::client_builder::Result<
13016 std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpProxies>,
13017 > {
13018 if gaxi::options::tracing_enabled(&conf) {
13019 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13020 }
13021 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13022 }
13023
13024 async fn build_transport(
13025 conf: gaxi::options::ClientConfig,
13026 ) -> gax::client_builder::Result<impl super::stub::RegionTargetHttpProxies> {
13027 super::transport::RegionTargetHttpProxies::new(conf).await
13028 }
13029
13030 async fn build_with_tracing(
13031 conf: gaxi::options::ClientConfig,
13032 ) -> gax::client_builder::Result<impl super::stub::RegionTargetHttpProxies> {
13033 Self::build_transport(conf)
13034 .await
13035 .map(super::tracing::RegionTargetHttpProxies::new)
13036 }
13037
13038 /// Deletes the specified TargetHttpProxy resource.
13039 pub fn delete(&self) -> super::builder::region_target_http_proxies::Delete {
13040 super::builder::region_target_http_proxies::Delete::new(self.inner.clone())
13041 }
13042
13043 /// Returns the specified TargetHttpProxy resource in the specified region.
13044 pub fn get(&self) -> super::builder::region_target_http_proxies::Get {
13045 super::builder::region_target_http_proxies::Get::new(self.inner.clone())
13046 }
13047
13048 /// Creates a TargetHttpProxy resource in the specified project and region
13049 /// using the data included in the request.
13050 pub fn insert(&self) -> super::builder::region_target_http_proxies::Insert {
13051 super::builder::region_target_http_proxies::Insert::new(self.inner.clone())
13052 }
13053
13054 /// Retrieves the list of TargetHttpProxy resources available
13055 /// to the specified project in the specified region.
13056 pub fn list(&self) -> super::builder::region_target_http_proxies::List {
13057 super::builder::region_target_http_proxies::List::new(self.inner.clone())
13058 }
13059
13060 /// Changes the URL map for TargetHttpProxy.
13061 pub fn set_url_map(&self) -> super::builder::region_target_http_proxies::SetUrlMap {
13062 super::builder::region_target_http_proxies::SetUrlMap::new(self.inner.clone())
13063 }
13064
13065 /// Retrieves the specified region-specific Operations resource.
13066 pub fn get_operation(&self) -> super::builder::region_target_http_proxies::GetOperation {
13067 super::builder::region_target_http_proxies::GetOperation::new(self.inner.clone())
13068 }
13069}
13070
13071/// Implements a client for the Google Compute Engine API.
13072///
13073/// # Example
13074/// ```
13075/// # tokio_test::block_on(async {
13076/// # use google_cloud_compute_v1::client::RegionTargetHttpsProxies;
13077/// let client = RegionTargetHttpsProxies::builder().build().await?;
13078/// // use `client` to make requests to the Google Compute Engine API.
13079/// # gax::client_builder::Result::<()>::Ok(()) });
13080/// ```
13081///
13082/// # Service Description
13083///
13084/// Service for the `regionTargetHttpsProxies` resource.
13085///
13086/// # Configuration
13087///
13088/// To configure `RegionTargetHttpsProxies` use the `with_*` methods in the type returned
13089/// by [builder()][RegionTargetHttpsProxies::builder]. The default configuration should
13090/// work for most applications. Common configuration changes include
13091///
13092/// * [with_endpoint()]: by default this client uses the global default endpoint
13093/// (`https://compute.googleapis.com`). Applications using regional
13094/// endpoints or running in restricted networks (e.g. a network configured
13095// with [Private Google Access with VPC Service Controls]) may want to
13096/// override this default.
13097/// * [with_credentials()]: by default this client uses
13098/// [Application Default Credentials]. Applications using custom
13099/// authentication may need to override this default.
13100///
13101/// [with_endpoint()]: super::builder::region_target_https_proxies::ClientBuilder::with_endpoint
13102/// [with_credentials()]: super::builder::region_target_https_proxies::ClientBuilder::credentials
13103/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13104/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13105///
13106/// # Pooling and Cloning
13107///
13108/// `RegionTargetHttpsProxies` holds a connection pool internally, it is advised to
13109/// create one and the reuse it. You do not need to wrap `RegionTargetHttpsProxies` in
13110/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13111/// already uses an `Arc` internally.
13112#[cfg(feature = "region-target-https-proxies")]
13113#[cfg_attr(docsrs, doc(cfg(feature = "region-target-https-proxies")))]
13114#[derive(Clone, Debug)]
13115pub struct RegionTargetHttpsProxies {
13116 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpsProxies>,
13117}
13118
13119#[cfg(feature = "region-target-https-proxies")]
13120impl RegionTargetHttpsProxies {
13121 /// Returns a builder for [RegionTargetHttpsProxies].
13122 ///
13123 /// ```
13124 /// # tokio_test::block_on(async {
13125 /// # use google_cloud_compute_v1::client::RegionTargetHttpsProxies;
13126 /// let client = RegionTargetHttpsProxies::builder().build().await?;
13127 /// # gax::client_builder::Result::<()>::Ok(()) });
13128 /// ```
13129 pub fn builder() -> super::builder::region_target_https_proxies::ClientBuilder {
13130 gax::client_builder::internal::new_builder(
13131 super::builder::region_target_https_proxies::client::Factory,
13132 )
13133 }
13134
13135 /// Creates a new client from the provided stub.
13136 ///
13137 /// The most common case for calling this function is in tests mocking the
13138 /// client's behavior.
13139 pub fn from_stub<T>(stub: T) -> Self
13140 where
13141 T: super::stub::RegionTargetHttpsProxies + 'static,
13142 {
13143 Self {
13144 inner: std::sync::Arc::new(stub),
13145 }
13146 }
13147
13148 pub(crate) async fn new(
13149 config: gaxi::options::ClientConfig,
13150 ) -> gax::client_builder::Result<Self> {
13151 let inner = Self::build_inner(config).await?;
13152 Ok(Self { inner })
13153 }
13154
13155 async fn build_inner(
13156 conf: gaxi::options::ClientConfig,
13157 ) -> gax::client_builder::Result<
13158 std::sync::Arc<dyn super::stub::dynamic::RegionTargetHttpsProxies>,
13159 > {
13160 if gaxi::options::tracing_enabled(&conf) {
13161 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13162 }
13163 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13164 }
13165
13166 async fn build_transport(
13167 conf: gaxi::options::ClientConfig,
13168 ) -> gax::client_builder::Result<impl super::stub::RegionTargetHttpsProxies> {
13169 super::transport::RegionTargetHttpsProxies::new(conf).await
13170 }
13171
13172 async fn build_with_tracing(
13173 conf: gaxi::options::ClientConfig,
13174 ) -> gax::client_builder::Result<impl super::stub::RegionTargetHttpsProxies> {
13175 Self::build_transport(conf)
13176 .await
13177 .map(super::tracing::RegionTargetHttpsProxies::new)
13178 }
13179
13180 /// Deletes the specified TargetHttpsProxy resource.
13181 pub fn delete(&self) -> super::builder::region_target_https_proxies::Delete {
13182 super::builder::region_target_https_proxies::Delete::new(self.inner.clone())
13183 }
13184
13185 /// Returns the specified TargetHttpsProxy resource in the specified region.
13186 pub fn get(&self) -> super::builder::region_target_https_proxies::Get {
13187 super::builder::region_target_https_proxies::Get::new(self.inner.clone())
13188 }
13189
13190 /// Creates a TargetHttpsProxy resource in the specified project and region
13191 /// using the data included in the request.
13192 pub fn insert(&self) -> super::builder::region_target_https_proxies::Insert {
13193 super::builder::region_target_https_proxies::Insert::new(self.inner.clone())
13194 }
13195
13196 /// Retrieves the list of TargetHttpsProxy resources available
13197 /// to the specified project in the specified region.
13198 pub fn list(&self) -> super::builder::region_target_https_proxies::List {
13199 super::builder::region_target_https_proxies::List::new(self.inner.clone())
13200 }
13201
13202 /// Patches the specified regional TargetHttpsProxy resource with the data
13203 /// included in the request. This method supports PATCH
13204 /// semantics and usesJSON merge
13205 /// patch format and processing rules.
13206 pub fn patch(&self) -> super::builder::region_target_https_proxies::Patch {
13207 super::builder::region_target_https_proxies::Patch::new(self.inner.clone())
13208 }
13209
13210 /// Replaces SslCertificates for TargetHttpsProxy.
13211 pub fn set_ssl_certificates(
13212 &self,
13213 ) -> super::builder::region_target_https_proxies::SetSslCertificates {
13214 super::builder::region_target_https_proxies::SetSslCertificates::new(self.inner.clone())
13215 }
13216
13217 /// Changes the URL map for TargetHttpsProxy.
13218 pub fn set_url_map(&self) -> super::builder::region_target_https_proxies::SetUrlMap {
13219 super::builder::region_target_https_proxies::SetUrlMap::new(self.inner.clone())
13220 }
13221
13222 /// Retrieves the specified region-specific Operations resource.
13223 pub fn get_operation(&self) -> super::builder::region_target_https_proxies::GetOperation {
13224 super::builder::region_target_https_proxies::GetOperation::new(self.inner.clone())
13225 }
13226}
13227
13228/// Implements a client for the Google Compute Engine API.
13229///
13230/// # Example
13231/// ```
13232/// # tokio_test::block_on(async {
13233/// # use google_cloud_compute_v1::client::RegionTargetTcpProxies;
13234/// let client = RegionTargetTcpProxies::builder().build().await?;
13235/// // use `client` to make requests to the Google Compute Engine API.
13236/// # gax::client_builder::Result::<()>::Ok(()) });
13237/// ```
13238///
13239/// # Service Description
13240///
13241/// Service for the `regionTargetTcpProxies` resource.
13242///
13243/// # Configuration
13244///
13245/// To configure `RegionTargetTcpProxies` use the `with_*` methods in the type returned
13246/// by [builder()][RegionTargetTcpProxies::builder]. The default configuration should
13247/// work for most applications. Common configuration changes include
13248///
13249/// * [with_endpoint()]: by default this client uses the global default endpoint
13250/// (`https://compute.googleapis.com`). Applications using regional
13251/// endpoints or running in restricted networks (e.g. a network configured
13252// with [Private Google Access with VPC Service Controls]) may want to
13253/// override this default.
13254/// * [with_credentials()]: by default this client uses
13255/// [Application Default Credentials]. Applications using custom
13256/// authentication may need to override this default.
13257///
13258/// [with_endpoint()]: super::builder::region_target_tcp_proxies::ClientBuilder::with_endpoint
13259/// [with_credentials()]: super::builder::region_target_tcp_proxies::ClientBuilder::credentials
13260/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13261/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13262///
13263/// # Pooling and Cloning
13264///
13265/// `RegionTargetTcpProxies` holds a connection pool internally, it is advised to
13266/// create one and the reuse it. You do not need to wrap `RegionTargetTcpProxies` in
13267/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13268/// already uses an `Arc` internally.
13269#[cfg(feature = "region-target-tcp-proxies")]
13270#[cfg_attr(docsrs, doc(cfg(feature = "region-target-tcp-proxies")))]
13271#[derive(Clone, Debug)]
13272pub struct RegionTargetTcpProxies {
13273 inner: std::sync::Arc<dyn super::stub::dynamic::RegionTargetTcpProxies>,
13274}
13275
13276#[cfg(feature = "region-target-tcp-proxies")]
13277impl RegionTargetTcpProxies {
13278 /// Returns a builder for [RegionTargetTcpProxies].
13279 ///
13280 /// ```
13281 /// # tokio_test::block_on(async {
13282 /// # use google_cloud_compute_v1::client::RegionTargetTcpProxies;
13283 /// let client = RegionTargetTcpProxies::builder().build().await?;
13284 /// # gax::client_builder::Result::<()>::Ok(()) });
13285 /// ```
13286 pub fn builder() -> super::builder::region_target_tcp_proxies::ClientBuilder {
13287 gax::client_builder::internal::new_builder(
13288 super::builder::region_target_tcp_proxies::client::Factory,
13289 )
13290 }
13291
13292 /// Creates a new client from the provided stub.
13293 ///
13294 /// The most common case for calling this function is in tests mocking the
13295 /// client's behavior.
13296 pub fn from_stub<T>(stub: T) -> Self
13297 where
13298 T: super::stub::RegionTargetTcpProxies + 'static,
13299 {
13300 Self {
13301 inner: std::sync::Arc::new(stub),
13302 }
13303 }
13304
13305 pub(crate) async fn new(
13306 config: gaxi::options::ClientConfig,
13307 ) -> gax::client_builder::Result<Self> {
13308 let inner = Self::build_inner(config).await?;
13309 Ok(Self { inner })
13310 }
13311
13312 async fn build_inner(
13313 conf: gaxi::options::ClientConfig,
13314 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionTargetTcpProxies>>
13315 {
13316 if gaxi::options::tracing_enabled(&conf) {
13317 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13318 }
13319 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13320 }
13321
13322 async fn build_transport(
13323 conf: gaxi::options::ClientConfig,
13324 ) -> gax::client_builder::Result<impl super::stub::RegionTargetTcpProxies> {
13325 super::transport::RegionTargetTcpProxies::new(conf).await
13326 }
13327
13328 async fn build_with_tracing(
13329 conf: gaxi::options::ClientConfig,
13330 ) -> gax::client_builder::Result<impl super::stub::RegionTargetTcpProxies> {
13331 Self::build_transport(conf)
13332 .await
13333 .map(super::tracing::RegionTargetTcpProxies::new)
13334 }
13335
13336 /// Deletes the specified TargetTcpProxy resource.
13337 pub fn delete(&self) -> super::builder::region_target_tcp_proxies::Delete {
13338 super::builder::region_target_tcp_proxies::Delete::new(self.inner.clone())
13339 }
13340
13341 /// Returns the specified TargetTcpProxy resource.
13342 pub fn get(&self) -> super::builder::region_target_tcp_proxies::Get {
13343 super::builder::region_target_tcp_proxies::Get::new(self.inner.clone())
13344 }
13345
13346 /// Creates a TargetTcpProxy resource in the specified project and region using
13347 /// the data included in the request.
13348 pub fn insert(&self) -> super::builder::region_target_tcp_proxies::Insert {
13349 super::builder::region_target_tcp_proxies::Insert::new(self.inner.clone())
13350 }
13351
13352 /// Retrieves a list of TargetTcpProxy resources
13353 /// available to the specified project in a given region.
13354 pub fn list(&self) -> super::builder::region_target_tcp_proxies::List {
13355 super::builder::region_target_tcp_proxies::List::new(self.inner.clone())
13356 }
13357
13358 /// Retrieves the specified region-specific Operations resource.
13359 pub fn get_operation(&self) -> super::builder::region_target_tcp_proxies::GetOperation {
13360 super::builder::region_target_tcp_proxies::GetOperation::new(self.inner.clone())
13361 }
13362}
13363
13364/// Implements a client for the Google Compute Engine API.
13365///
13366/// # Example
13367/// ```
13368/// # tokio_test::block_on(async {
13369/// # use google_cloud_compute_v1::client::RegionUrlMaps;
13370/// let client = RegionUrlMaps::builder().build().await?;
13371/// // use `client` to make requests to the Google Compute Engine API.
13372/// # gax::client_builder::Result::<()>::Ok(()) });
13373/// ```
13374///
13375/// # Service Description
13376///
13377/// Service for the `regionUrlMaps` resource.
13378///
13379/// # Configuration
13380///
13381/// To configure `RegionUrlMaps` use the `with_*` methods in the type returned
13382/// by [builder()][RegionUrlMaps::builder]. The default configuration should
13383/// work for most applications. Common configuration changes include
13384///
13385/// * [with_endpoint()]: by default this client uses the global default endpoint
13386/// (`https://compute.googleapis.com`). Applications using regional
13387/// endpoints or running in restricted networks (e.g. a network configured
13388// with [Private Google Access with VPC Service Controls]) may want to
13389/// override this default.
13390/// * [with_credentials()]: by default this client uses
13391/// [Application Default Credentials]. Applications using custom
13392/// authentication may need to override this default.
13393///
13394/// [with_endpoint()]: super::builder::region_url_maps::ClientBuilder::with_endpoint
13395/// [with_credentials()]: super::builder::region_url_maps::ClientBuilder::credentials
13396/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13397/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13398///
13399/// # Pooling and Cloning
13400///
13401/// `RegionUrlMaps` holds a connection pool internally, it is advised to
13402/// create one and the reuse it. You do not need to wrap `RegionUrlMaps` in
13403/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13404/// already uses an `Arc` internally.
13405#[cfg(feature = "region-url-maps")]
13406#[cfg_attr(docsrs, doc(cfg(feature = "region-url-maps")))]
13407#[derive(Clone, Debug)]
13408pub struct RegionUrlMaps {
13409 inner: std::sync::Arc<dyn super::stub::dynamic::RegionUrlMaps>,
13410}
13411
13412#[cfg(feature = "region-url-maps")]
13413impl RegionUrlMaps {
13414 /// Returns a builder for [RegionUrlMaps].
13415 ///
13416 /// ```
13417 /// # tokio_test::block_on(async {
13418 /// # use google_cloud_compute_v1::client::RegionUrlMaps;
13419 /// let client = RegionUrlMaps::builder().build().await?;
13420 /// # gax::client_builder::Result::<()>::Ok(()) });
13421 /// ```
13422 pub fn builder() -> super::builder::region_url_maps::ClientBuilder {
13423 gax::client_builder::internal::new_builder(super::builder::region_url_maps::client::Factory)
13424 }
13425
13426 /// Creates a new client from the provided stub.
13427 ///
13428 /// The most common case for calling this function is in tests mocking the
13429 /// client's behavior.
13430 pub fn from_stub<T>(stub: T) -> Self
13431 where
13432 T: super::stub::RegionUrlMaps + 'static,
13433 {
13434 Self {
13435 inner: std::sync::Arc::new(stub),
13436 }
13437 }
13438
13439 pub(crate) async fn new(
13440 config: gaxi::options::ClientConfig,
13441 ) -> gax::client_builder::Result<Self> {
13442 let inner = Self::build_inner(config).await?;
13443 Ok(Self { inner })
13444 }
13445
13446 async fn build_inner(
13447 conf: gaxi::options::ClientConfig,
13448 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionUrlMaps>> {
13449 if gaxi::options::tracing_enabled(&conf) {
13450 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13451 }
13452 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13453 }
13454
13455 async fn build_transport(
13456 conf: gaxi::options::ClientConfig,
13457 ) -> gax::client_builder::Result<impl super::stub::RegionUrlMaps> {
13458 super::transport::RegionUrlMaps::new(conf).await
13459 }
13460
13461 async fn build_with_tracing(
13462 conf: gaxi::options::ClientConfig,
13463 ) -> gax::client_builder::Result<impl super::stub::RegionUrlMaps> {
13464 Self::build_transport(conf)
13465 .await
13466 .map(super::tracing::RegionUrlMaps::new)
13467 }
13468
13469 /// Deletes the specified UrlMap resource.
13470 pub fn delete(&self) -> super::builder::region_url_maps::Delete {
13471 super::builder::region_url_maps::Delete::new(self.inner.clone())
13472 }
13473
13474 /// Returns the specified UrlMap resource.
13475 pub fn get(&self) -> super::builder::region_url_maps::Get {
13476 super::builder::region_url_maps::Get::new(self.inner.clone())
13477 }
13478
13479 /// Creates a UrlMap resource in the specified project using
13480 /// the data included in the request.
13481 pub fn insert(&self) -> super::builder::region_url_maps::Insert {
13482 super::builder::region_url_maps::Insert::new(self.inner.clone())
13483 }
13484
13485 /// Retrieves the list of UrlMap resources available to the specified
13486 /// project in the specified region.
13487 pub fn list(&self) -> super::builder::region_url_maps::List {
13488 super::builder::region_url_maps::List::new(self.inner.clone())
13489 }
13490
13491 /// Patches the specified UrlMap resource with the data included in the
13492 /// request. This method supportsPATCH
13493 /// semantics and usesJSON merge
13494 /// patch format and processing rules.
13495 pub fn patch(&self) -> super::builder::region_url_maps::Patch {
13496 super::builder::region_url_maps::Patch::new(self.inner.clone())
13497 }
13498
13499 /// Updates the specified UrlMap resource with the data included in the
13500 /// request.
13501 pub fn update(&self) -> super::builder::region_url_maps::Update {
13502 super::builder::region_url_maps::Update::new(self.inner.clone())
13503 }
13504
13505 /// Runs static validation for the UrlMap. In particular, the tests of the
13506 /// provided UrlMap will be run. Calling this method does NOT create the
13507 /// UrlMap.
13508 pub fn validate(&self) -> super::builder::region_url_maps::Validate {
13509 super::builder::region_url_maps::Validate::new(self.inner.clone())
13510 }
13511
13512 /// Retrieves the specified region-specific Operations resource.
13513 pub fn get_operation(&self) -> super::builder::region_url_maps::GetOperation {
13514 super::builder::region_url_maps::GetOperation::new(self.inner.clone())
13515 }
13516}
13517
13518/// Implements a client for the Google Compute Engine API.
13519///
13520/// # Example
13521/// ```
13522/// # tokio_test::block_on(async {
13523/// # use google_cloud_compute_v1::client::RegionZones;
13524/// let client = RegionZones::builder().build().await?;
13525/// // use `client` to make requests to the Google Compute Engine API.
13526/// # gax::client_builder::Result::<()>::Ok(()) });
13527/// ```
13528///
13529/// # Service Description
13530///
13531/// Service for the `regionZones` resource.
13532///
13533/// # Configuration
13534///
13535/// To configure `RegionZones` use the `with_*` methods in the type returned
13536/// by [builder()][RegionZones::builder]. The default configuration should
13537/// work for most applications. Common configuration changes include
13538///
13539/// * [with_endpoint()]: by default this client uses the global default endpoint
13540/// (`https://compute.googleapis.com`). Applications using regional
13541/// endpoints or running in restricted networks (e.g. a network configured
13542// with [Private Google Access with VPC Service Controls]) may want to
13543/// override this default.
13544/// * [with_credentials()]: by default this client uses
13545/// [Application Default Credentials]. Applications using custom
13546/// authentication may need to override this default.
13547///
13548/// [with_endpoint()]: super::builder::region_zones::ClientBuilder::with_endpoint
13549/// [with_credentials()]: super::builder::region_zones::ClientBuilder::credentials
13550/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13551/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13552///
13553/// # Pooling and Cloning
13554///
13555/// `RegionZones` holds a connection pool internally, it is advised to
13556/// create one and the reuse it. You do not need to wrap `RegionZones` in
13557/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13558/// already uses an `Arc` internally.
13559#[cfg(feature = "region-zones")]
13560#[cfg_attr(docsrs, doc(cfg(feature = "region-zones")))]
13561#[derive(Clone, Debug)]
13562pub struct RegionZones {
13563 inner: std::sync::Arc<dyn super::stub::dynamic::RegionZones>,
13564}
13565
13566#[cfg(feature = "region-zones")]
13567impl RegionZones {
13568 /// Returns a builder for [RegionZones].
13569 ///
13570 /// ```
13571 /// # tokio_test::block_on(async {
13572 /// # use google_cloud_compute_v1::client::RegionZones;
13573 /// let client = RegionZones::builder().build().await?;
13574 /// # gax::client_builder::Result::<()>::Ok(()) });
13575 /// ```
13576 pub fn builder() -> super::builder::region_zones::ClientBuilder {
13577 gax::client_builder::internal::new_builder(super::builder::region_zones::client::Factory)
13578 }
13579
13580 /// Creates a new client from the provided stub.
13581 ///
13582 /// The most common case for calling this function is in tests mocking the
13583 /// client's behavior.
13584 pub fn from_stub<T>(stub: T) -> Self
13585 where
13586 T: super::stub::RegionZones + 'static,
13587 {
13588 Self {
13589 inner: std::sync::Arc::new(stub),
13590 }
13591 }
13592
13593 pub(crate) async fn new(
13594 config: gaxi::options::ClientConfig,
13595 ) -> gax::client_builder::Result<Self> {
13596 let inner = Self::build_inner(config).await?;
13597 Ok(Self { inner })
13598 }
13599
13600 async fn build_inner(
13601 conf: gaxi::options::ClientConfig,
13602 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::RegionZones>> {
13603 if gaxi::options::tracing_enabled(&conf) {
13604 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13605 }
13606 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13607 }
13608
13609 async fn build_transport(
13610 conf: gaxi::options::ClientConfig,
13611 ) -> gax::client_builder::Result<impl super::stub::RegionZones> {
13612 super::transport::RegionZones::new(conf).await
13613 }
13614
13615 async fn build_with_tracing(
13616 conf: gaxi::options::ClientConfig,
13617 ) -> gax::client_builder::Result<impl super::stub::RegionZones> {
13618 Self::build_transport(conf)
13619 .await
13620 .map(super::tracing::RegionZones::new)
13621 }
13622
13623 /// Retrieves the list of Zone resources under the specific region available to
13624 /// the specified project.
13625 pub fn list(&self) -> super::builder::region_zones::List {
13626 super::builder::region_zones::List::new(self.inner.clone())
13627 }
13628}
13629
13630/// Implements a client for the Google Compute Engine API.
13631///
13632/// # Example
13633/// ```
13634/// # tokio_test::block_on(async {
13635/// # use google_cloud_compute_v1::client::Regions;
13636/// let client = Regions::builder().build().await?;
13637/// // use `client` to make requests to the Google Compute Engine API.
13638/// # gax::client_builder::Result::<()>::Ok(()) });
13639/// ```
13640///
13641/// # Service Description
13642///
13643/// Service for the `regions` resource.
13644///
13645/// # Configuration
13646///
13647/// To configure `Regions` use the `with_*` methods in the type returned
13648/// by [builder()][Regions::builder]. The default configuration should
13649/// work for most applications. Common configuration changes include
13650///
13651/// * [with_endpoint()]: by default this client uses the global default endpoint
13652/// (`https://compute.googleapis.com`). Applications using regional
13653/// endpoints or running in restricted networks (e.g. a network configured
13654// with [Private Google Access with VPC Service Controls]) may want to
13655/// override this default.
13656/// * [with_credentials()]: by default this client uses
13657/// [Application Default Credentials]. Applications using custom
13658/// authentication may need to override this default.
13659///
13660/// [with_endpoint()]: super::builder::regions::ClientBuilder::with_endpoint
13661/// [with_credentials()]: super::builder::regions::ClientBuilder::credentials
13662/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13663/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13664///
13665/// # Pooling and Cloning
13666///
13667/// `Regions` holds a connection pool internally, it is advised to
13668/// create one and the reuse it. You do not need to wrap `Regions` in
13669/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13670/// already uses an `Arc` internally.
13671#[cfg(feature = "regions")]
13672#[cfg_attr(docsrs, doc(cfg(feature = "regions")))]
13673#[derive(Clone, Debug)]
13674pub struct Regions {
13675 inner: std::sync::Arc<dyn super::stub::dynamic::Regions>,
13676}
13677
13678#[cfg(feature = "regions")]
13679impl Regions {
13680 /// Returns a builder for [Regions].
13681 ///
13682 /// ```
13683 /// # tokio_test::block_on(async {
13684 /// # use google_cloud_compute_v1::client::Regions;
13685 /// let client = Regions::builder().build().await?;
13686 /// # gax::client_builder::Result::<()>::Ok(()) });
13687 /// ```
13688 pub fn builder() -> super::builder::regions::ClientBuilder {
13689 gax::client_builder::internal::new_builder(super::builder::regions::client::Factory)
13690 }
13691
13692 /// Creates a new client from the provided stub.
13693 ///
13694 /// The most common case for calling this function is in tests mocking the
13695 /// client's behavior.
13696 pub fn from_stub<T>(stub: T) -> Self
13697 where
13698 T: super::stub::Regions + 'static,
13699 {
13700 Self {
13701 inner: std::sync::Arc::new(stub),
13702 }
13703 }
13704
13705 pub(crate) async fn new(
13706 config: gaxi::options::ClientConfig,
13707 ) -> gax::client_builder::Result<Self> {
13708 let inner = Self::build_inner(config).await?;
13709 Ok(Self { inner })
13710 }
13711
13712 async fn build_inner(
13713 conf: gaxi::options::ClientConfig,
13714 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Regions>> {
13715 if gaxi::options::tracing_enabled(&conf) {
13716 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13717 }
13718 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13719 }
13720
13721 async fn build_transport(
13722 conf: gaxi::options::ClientConfig,
13723 ) -> gax::client_builder::Result<impl super::stub::Regions> {
13724 super::transport::Regions::new(conf).await
13725 }
13726
13727 async fn build_with_tracing(
13728 conf: gaxi::options::ClientConfig,
13729 ) -> gax::client_builder::Result<impl super::stub::Regions> {
13730 Self::build_transport(conf)
13731 .await
13732 .map(super::tracing::Regions::new)
13733 }
13734
13735 /// Returns the specified Region resource.
13736 ///
13737 /// To decrease latency for this method, you can optionally omit any unneeded
13738 /// information from the response by using a field mask. This practice is
13739 /// especially recommended for unused quota information (the `quotas` field).
13740 /// To exclude one or more fields, set your request's `fields` query parameter
13741 /// to only include the fields you need. For example, to only include the `id`
13742 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
13743 /// your request.
13744 ///
13745 /// This method fails if the quota information is unavailable for the region
13746 /// and if the organization policy constraint
13747 /// compute.requireBasicQuotaInResponse is enforced. This
13748 /// constraint, when enforced, disables the fail-open behaviour when quota
13749 /// information (the `items.quotas` field) is unavailable for the region.
13750 /// It is recommended to use the default setting
13751 /// for the constraint unless your application requires the fail-closed
13752 /// behaviour for this method.
13753 pub fn get(&self) -> super::builder::regions::Get {
13754 super::builder::regions::Get::new(self.inner.clone())
13755 }
13756
13757 /// Retrieves the list of region resources available to the specified project.
13758 ///
13759 /// To decrease latency for this method, you can optionally omit any unneeded
13760 /// information from the response by using a field mask. This practice is
13761 /// especially recommended for unused quota information
13762 /// (the `items.quotas` field).
13763 /// To exclude one or more fields, set your request's `fields` query parameter
13764 /// to only include the fields you need. For example, to only include the `id`
13765 /// and `selfLink` fields, add the query parameter `?fields=id,selfLink` to
13766 /// your request.
13767 ///
13768 /// This method fails if the quota information is unavailable for the region
13769 /// and if the organization policy constraint
13770 /// compute.requireBasicQuotaInResponse is enforced. This
13771 /// constraint, when enforced, disables the fail-open behaviour when quota
13772 /// information (the `items.quotas` field) is unavailable for the region.
13773 /// It is recommended to use the default setting
13774 /// for the constraint unless your application requires the fail-closed
13775 /// behaviour for this method.
13776 pub fn list(&self) -> super::builder::regions::List {
13777 super::builder::regions::List::new(self.inner.clone())
13778 }
13779}
13780
13781/// Implements a client for the Google Compute Engine API.
13782///
13783/// # Example
13784/// ```
13785/// # tokio_test::block_on(async {
13786/// # use google_cloud_compute_v1::client::ReservationBlocks;
13787/// let client = ReservationBlocks::builder().build().await?;
13788/// // use `client` to make requests to the Google Compute Engine API.
13789/// # gax::client_builder::Result::<()>::Ok(()) });
13790/// ```
13791///
13792/// # Service Description
13793///
13794/// Service for the `reservationBlocks` resource.
13795///
13796/// # Configuration
13797///
13798/// To configure `ReservationBlocks` use the `with_*` methods in the type returned
13799/// by [builder()][ReservationBlocks::builder]. The default configuration should
13800/// work for most applications. Common configuration changes include
13801///
13802/// * [with_endpoint()]: by default this client uses the global default endpoint
13803/// (`https://compute.googleapis.com`). Applications using regional
13804/// endpoints or running in restricted networks (e.g. a network configured
13805// with [Private Google Access with VPC Service Controls]) may want to
13806/// override this default.
13807/// * [with_credentials()]: by default this client uses
13808/// [Application Default Credentials]. Applications using custom
13809/// authentication may need to override this default.
13810///
13811/// [with_endpoint()]: super::builder::reservation_blocks::ClientBuilder::with_endpoint
13812/// [with_credentials()]: super::builder::reservation_blocks::ClientBuilder::credentials
13813/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13814/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13815///
13816/// # Pooling and Cloning
13817///
13818/// `ReservationBlocks` holds a connection pool internally, it is advised to
13819/// create one and the reuse it. You do not need to wrap `ReservationBlocks` in
13820/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13821/// already uses an `Arc` internally.
13822#[cfg(feature = "reservation-blocks")]
13823#[cfg_attr(docsrs, doc(cfg(feature = "reservation-blocks")))]
13824#[derive(Clone, Debug)]
13825pub struct ReservationBlocks {
13826 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationBlocks>,
13827}
13828
13829#[cfg(feature = "reservation-blocks")]
13830impl ReservationBlocks {
13831 /// Returns a builder for [ReservationBlocks].
13832 ///
13833 /// ```
13834 /// # tokio_test::block_on(async {
13835 /// # use google_cloud_compute_v1::client::ReservationBlocks;
13836 /// let client = ReservationBlocks::builder().build().await?;
13837 /// # gax::client_builder::Result::<()>::Ok(()) });
13838 /// ```
13839 pub fn builder() -> super::builder::reservation_blocks::ClientBuilder {
13840 gax::client_builder::internal::new_builder(
13841 super::builder::reservation_blocks::client::Factory,
13842 )
13843 }
13844
13845 /// Creates a new client from the provided stub.
13846 ///
13847 /// The most common case for calling this function is in tests mocking the
13848 /// client's behavior.
13849 pub fn from_stub<T>(stub: T) -> Self
13850 where
13851 T: super::stub::ReservationBlocks + 'static,
13852 {
13853 Self {
13854 inner: std::sync::Arc::new(stub),
13855 }
13856 }
13857
13858 pub(crate) async fn new(
13859 config: gaxi::options::ClientConfig,
13860 ) -> gax::client_builder::Result<Self> {
13861 let inner = Self::build_inner(config).await?;
13862 Ok(Self { inner })
13863 }
13864
13865 async fn build_inner(
13866 conf: gaxi::options::ClientConfig,
13867 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReservationBlocks>>
13868 {
13869 if gaxi::options::tracing_enabled(&conf) {
13870 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
13871 }
13872 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
13873 }
13874
13875 async fn build_transport(
13876 conf: gaxi::options::ClientConfig,
13877 ) -> gax::client_builder::Result<impl super::stub::ReservationBlocks> {
13878 super::transport::ReservationBlocks::new(conf).await
13879 }
13880
13881 async fn build_with_tracing(
13882 conf: gaxi::options::ClientConfig,
13883 ) -> gax::client_builder::Result<impl super::stub::ReservationBlocks> {
13884 Self::build_transport(conf)
13885 .await
13886 .map(super::tracing::ReservationBlocks::new)
13887 }
13888
13889 /// Retrieves information about the specified reservation block.
13890 pub fn get(&self) -> super::builder::reservation_blocks::Get {
13891 super::builder::reservation_blocks::Get::new(self.inner.clone())
13892 }
13893
13894 /// Gets the access control policy for a resource. May be empty if no such
13895 /// policy or resource exists.
13896 pub fn get_iam_policy(&self) -> super::builder::reservation_blocks::GetIamPolicy {
13897 super::builder::reservation_blocks::GetIamPolicy::new(self.inner.clone())
13898 }
13899
13900 /// Retrieves a list of reservation blocks under a single reservation.
13901 pub fn list(&self) -> super::builder::reservation_blocks::List {
13902 super::builder::reservation_blocks::List::new(self.inner.clone())
13903 }
13904
13905 /// Allows customers to perform maintenance on a reservation block
13906 pub fn perform_maintenance(&self) -> super::builder::reservation_blocks::PerformMaintenance {
13907 super::builder::reservation_blocks::PerformMaintenance::new(self.inner.clone())
13908 }
13909
13910 /// Sets the access control policy on the specified resource.
13911 /// Replaces any existing policy.
13912 pub fn set_iam_policy(&self) -> super::builder::reservation_blocks::SetIamPolicy {
13913 super::builder::reservation_blocks::SetIamPolicy::new(self.inner.clone())
13914 }
13915
13916 /// Returns permissions that a caller has on the specified resource.
13917 pub fn test_iam_permissions(&self) -> super::builder::reservation_blocks::TestIamPermissions {
13918 super::builder::reservation_blocks::TestIamPermissions::new(self.inner.clone())
13919 }
13920
13921 /// Retrieves the specified zone-specific Operations resource.
13922 pub fn get_operation(&self) -> super::builder::reservation_blocks::GetOperation {
13923 super::builder::reservation_blocks::GetOperation::new(self.inner.clone())
13924 }
13925}
13926
13927/// Implements a client for the Google Compute Engine API.
13928///
13929/// # Example
13930/// ```
13931/// # tokio_test::block_on(async {
13932/// # use google_cloud_compute_v1::client::ReservationSubBlocks;
13933/// let client = ReservationSubBlocks::builder().build().await?;
13934/// // use `client` to make requests to the Google Compute Engine API.
13935/// # gax::client_builder::Result::<()>::Ok(()) });
13936/// ```
13937///
13938/// # Service Description
13939///
13940/// Service for the `reservationSubBlocks` resource.
13941///
13942/// # Configuration
13943///
13944/// To configure `ReservationSubBlocks` use the `with_*` methods in the type returned
13945/// by [builder()][ReservationSubBlocks::builder]. The default configuration should
13946/// work for most applications. Common configuration changes include
13947///
13948/// * [with_endpoint()]: by default this client uses the global default endpoint
13949/// (`https://compute.googleapis.com`). Applications using regional
13950/// endpoints or running in restricted networks (e.g. a network configured
13951// with [Private Google Access with VPC Service Controls]) may want to
13952/// override this default.
13953/// * [with_credentials()]: by default this client uses
13954/// [Application Default Credentials]. Applications using custom
13955/// authentication may need to override this default.
13956///
13957/// [with_endpoint()]: super::builder::reservation_sub_blocks::ClientBuilder::with_endpoint
13958/// [with_credentials()]: super::builder::reservation_sub_blocks::ClientBuilder::credentials
13959/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
13960/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
13961///
13962/// # Pooling and Cloning
13963///
13964/// `ReservationSubBlocks` holds a connection pool internally, it is advised to
13965/// create one and the reuse it. You do not need to wrap `ReservationSubBlocks` in
13966/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
13967/// already uses an `Arc` internally.
13968#[cfg(feature = "reservation-sub-blocks")]
13969#[cfg_attr(docsrs, doc(cfg(feature = "reservation-sub-blocks")))]
13970#[derive(Clone, Debug)]
13971pub struct ReservationSubBlocks {
13972 inner: std::sync::Arc<dyn super::stub::dynamic::ReservationSubBlocks>,
13973}
13974
13975#[cfg(feature = "reservation-sub-blocks")]
13976impl ReservationSubBlocks {
13977 /// Returns a builder for [ReservationSubBlocks].
13978 ///
13979 /// ```
13980 /// # tokio_test::block_on(async {
13981 /// # use google_cloud_compute_v1::client::ReservationSubBlocks;
13982 /// let client = ReservationSubBlocks::builder().build().await?;
13983 /// # gax::client_builder::Result::<()>::Ok(()) });
13984 /// ```
13985 pub fn builder() -> super::builder::reservation_sub_blocks::ClientBuilder {
13986 gax::client_builder::internal::new_builder(
13987 super::builder::reservation_sub_blocks::client::Factory,
13988 )
13989 }
13990
13991 /// Creates a new client from the provided stub.
13992 ///
13993 /// The most common case for calling this function is in tests mocking the
13994 /// client's behavior.
13995 pub fn from_stub<T>(stub: T) -> Self
13996 where
13997 T: super::stub::ReservationSubBlocks + 'static,
13998 {
13999 Self {
14000 inner: std::sync::Arc::new(stub),
14001 }
14002 }
14003
14004 pub(crate) async fn new(
14005 config: gaxi::options::ClientConfig,
14006 ) -> gax::client_builder::Result<Self> {
14007 let inner = Self::build_inner(config).await?;
14008 Ok(Self { inner })
14009 }
14010
14011 async fn build_inner(
14012 conf: gaxi::options::ClientConfig,
14013 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ReservationSubBlocks>>
14014 {
14015 if gaxi::options::tracing_enabled(&conf) {
14016 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14017 }
14018 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14019 }
14020
14021 async fn build_transport(
14022 conf: gaxi::options::ClientConfig,
14023 ) -> gax::client_builder::Result<impl super::stub::ReservationSubBlocks> {
14024 super::transport::ReservationSubBlocks::new(conf).await
14025 }
14026
14027 async fn build_with_tracing(
14028 conf: gaxi::options::ClientConfig,
14029 ) -> gax::client_builder::Result<impl super::stub::ReservationSubBlocks> {
14030 Self::build_transport(conf)
14031 .await
14032 .map(super::tracing::ReservationSubBlocks::new)
14033 }
14034
14035 /// Retrieves information about the specified reservation subBlock.
14036 pub fn get(&self) -> super::builder::reservation_sub_blocks::Get {
14037 super::builder::reservation_sub_blocks::Get::new(self.inner.clone())
14038 }
14039
14040 /// Gets the access control policy for a resource. May be empty if no such
14041 /// policy or resource exists.
14042 pub fn get_iam_policy(&self) -> super::builder::reservation_sub_blocks::GetIamPolicy {
14043 super::builder::reservation_sub_blocks::GetIamPolicy::new(self.inner.clone())
14044 }
14045
14046 /// Retrieves a list of reservation subBlocks under a single reservation.
14047 pub fn list(&self) -> super::builder::reservation_sub_blocks::List {
14048 super::builder::reservation_sub_blocks::List::new(self.inner.clone())
14049 }
14050
14051 /// Allows customers to perform maintenance on a reservation subBlock
14052 pub fn perform_maintenance(
14053 &self,
14054 ) -> super::builder::reservation_sub_blocks::PerformMaintenance {
14055 super::builder::reservation_sub_blocks::PerformMaintenance::new(self.inner.clone())
14056 }
14057
14058 /// Allows customers to report a faulty subBlock.
14059 pub fn report_faulty(&self) -> super::builder::reservation_sub_blocks::ReportFaulty {
14060 super::builder::reservation_sub_blocks::ReportFaulty::new(self.inner.clone())
14061 }
14062
14063 /// Sets the access control policy on the specified resource.
14064 /// Replaces any existing policy.
14065 pub fn set_iam_policy(&self) -> super::builder::reservation_sub_blocks::SetIamPolicy {
14066 super::builder::reservation_sub_blocks::SetIamPolicy::new(self.inner.clone())
14067 }
14068
14069 /// Returns permissions that a caller has on the specified resource.
14070 pub fn test_iam_permissions(
14071 &self,
14072 ) -> super::builder::reservation_sub_blocks::TestIamPermissions {
14073 super::builder::reservation_sub_blocks::TestIamPermissions::new(self.inner.clone())
14074 }
14075
14076 /// Retrieves the specified zone-specific Operations resource.
14077 pub fn get_operation(&self) -> super::builder::reservation_sub_blocks::GetOperation {
14078 super::builder::reservation_sub_blocks::GetOperation::new(self.inner.clone())
14079 }
14080}
14081
14082/// Implements a client for the Google Compute Engine API.
14083///
14084/// # Example
14085/// ```
14086/// # tokio_test::block_on(async {
14087/// # use google_cloud_compute_v1::client::Reservations;
14088/// let client = Reservations::builder().build().await?;
14089/// // use `client` to make requests to the Google Compute Engine API.
14090/// # gax::client_builder::Result::<()>::Ok(()) });
14091/// ```
14092///
14093/// # Service Description
14094///
14095/// Service for the `reservations` resource.
14096///
14097/// # Configuration
14098///
14099/// To configure `Reservations` use the `with_*` methods in the type returned
14100/// by [builder()][Reservations::builder]. The default configuration should
14101/// work for most applications. Common configuration changes include
14102///
14103/// * [with_endpoint()]: by default this client uses the global default endpoint
14104/// (`https://compute.googleapis.com`). Applications using regional
14105/// endpoints or running in restricted networks (e.g. a network configured
14106// with [Private Google Access with VPC Service Controls]) may want to
14107/// override this default.
14108/// * [with_credentials()]: by default this client uses
14109/// [Application Default Credentials]. Applications using custom
14110/// authentication may need to override this default.
14111///
14112/// [with_endpoint()]: super::builder::reservations::ClientBuilder::with_endpoint
14113/// [with_credentials()]: super::builder::reservations::ClientBuilder::credentials
14114/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14115/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14116///
14117/// # Pooling and Cloning
14118///
14119/// `Reservations` holds a connection pool internally, it is advised to
14120/// create one and the reuse it. You do not need to wrap `Reservations` in
14121/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14122/// already uses an `Arc` internally.
14123#[cfg(feature = "reservations")]
14124#[cfg_attr(docsrs, doc(cfg(feature = "reservations")))]
14125#[derive(Clone, Debug)]
14126pub struct Reservations {
14127 inner: std::sync::Arc<dyn super::stub::dynamic::Reservations>,
14128}
14129
14130#[cfg(feature = "reservations")]
14131impl Reservations {
14132 /// Returns a builder for [Reservations].
14133 ///
14134 /// ```
14135 /// # tokio_test::block_on(async {
14136 /// # use google_cloud_compute_v1::client::Reservations;
14137 /// let client = Reservations::builder().build().await?;
14138 /// # gax::client_builder::Result::<()>::Ok(()) });
14139 /// ```
14140 pub fn builder() -> super::builder::reservations::ClientBuilder {
14141 gax::client_builder::internal::new_builder(super::builder::reservations::client::Factory)
14142 }
14143
14144 /// Creates a new client from the provided stub.
14145 ///
14146 /// The most common case for calling this function is in tests mocking the
14147 /// client's behavior.
14148 pub fn from_stub<T>(stub: T) -> Self
14149 where
14150 T: super::stub::Reservations + 'static,
14151 {
14152 Self {
14153 inner: std::sync::Arc::new(stub),
14154 }
14155 }
14156
14157 pub(crate) async fn new(
14158 config: gaxi::options::ClientConfig,
14159 ) -> gax::client_builder::Result<Self> {
14160 let inner = Self::build_inner(config).await?;
14161 Ok(Self { inner })
14162 }
14163
14164 async fn build_inner(
14165 conf: gaxi::options::ClientConfig,
14166 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Reservations>> {
14167 if gaxi::options::tracing_enabled(&conf) {
14168 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14169 }
14170 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14171 }
14172
14173 async fn build_transport(
14174 conf: gaxi::options::ClientConfig,
14175 ) -> gax::client_builder::Result<impl super::stub::Reservations> {
14176 super::transport::Reservations::new(conf).await
14177 }
14178
14179 async fn build_with_tracing(
14180 conf: gaxi::options::ClientConfig,
14181 ) -> gax::client_builder::Result<impl super::stub::Reservations> {
14182 Self::build_transport(conf)
14183 .await
14184 .map(super::tracing::Reservations::new)
14185 }
14186
14187 /// Retrieves an aggregated list of reservations.
14188 ///
14189 /// To prevent failure, Google recommends that you set the
14190 /// `returnPartialSuccess` parameter to `true`.
14191 pub fn aggregated_list(&self) -> super::builder::reservations::AggregatedList {
14192 super::builder::reservations::AggregatedList::new(self.inner.clone())
14193 }
14194
14195 /// Deletes the specified reservation.
14196 pub fn delete(&self) -> super::builder::reservations::Delete {
14197 super::builder::reservations::Delete::new(self.inner.clone())
14198 }
14199
14200 /// Retrieves information about the specified reservation.
14201 pub fn get(&self) -> super::builder::reservations::Get {
14202 super::builder::reservations::Get::new(self.inner.clone())
14203 }
14204
14205 /// Gets the access control policy for a resource. May be empty if no such
14206 /// policy or resource exists.
14207 pub fn get_iam_policy(&self) -> super::builder::reservations::GetIamPolicy {
14208 super::builder::reservations::GetIamPolicy::new(self.inner.clone())
14209 }
14210
14211 /// Creates a new reservation. For more information, readReserving zonal
14212 /// resources.
14213 pub fn insert(&self) -> super::builder::reservations::Insert {
14214 super::builder::reservations::Insert::new(self.inner.clone())
14215 }
14216
14217 /// A list of all the reservations that have been configured for the
14218 /// specified project in specified zone.
14219 pub fn list(&self) -> super::builder::reservations::List {
14220 super::builder::reservations::List::new(self.inner.clone())
14221 }
14222
14223 /// Perform maintenance on an extended reservation
14224 pub fn perform_maintenance(&self) -> super::builder::reservations::PerformMaintenance {
14225 super::builder::reservations::PerformMaintenance::new(self.inner.clone())
14226 }
14227
14228 /// Resizes the reservation (applicable to standalone reservations only). For
14229 /// more information, readModifying
14230 /// reservations.
14231 pub fn resize(&self) -> super::builder::reservations::Resize {
14232 super::builder::reservations::Resize::new(self.inner.clone())
14233 }
14234
14235 /// Sets the access control policy on the specified resource.
14236 /// Replaces any existing policy.
14237 pub fn set_iam_policy(&self) -> super::builder::reservations::SetIamPolicy {
14238 super::builder::reservations::SetIamPolicy::new(self.inner.clone())
14239 }
14240
14241 /// Returns permissions that a caller has on the specified resource.
14242 pub fn test_iam_permissions(&self) -> super::builder::reservations::TestIamPermissions {
14243 super::builder::reservations::TestIamPermissions::new(self.inner.clone())
14244 }
14245
14246 /// Update share settings of the reservation.
14247 pub fn update(&self) -> super::builder::reservations::Update {
14248 super::builder::reservations::Update::new(self.inner.clone())
14249 }
14250
14251 /// Retrieves the specified zone-specific Operations resource.
14252 pub fn get_operation(&self) -> super::builder::reservations::GetOperation {
14253 super::builder::reservations::GetOperation::new(self.inner.clone())
14254 }
14255}
14256
14257/// Implements a client for the Google Compute Engine API.
14258///
14259/// # Example
14260/// ```
14261/// # tokio_test::block_on(async {
14262/// # use google_cloud_compute_v1::client::ResourcePolicies;
14263/// let client = ResourcePolicies::builder().build().await?;
14264/// // use `client` to make requests to the Google Compute Engine API.
14265/// # gax::client_builder::Result::<()>::Ok(()) });
14266/// ```
14267///
14268/// # Service Description
14269///
14270/// Service for the `resourcePolicies` resource.
14271///
14272/// # Configuration
14273///
14274/// To configure `ResourcePolicies` use the `with_*` methods in the type returned
14275/// by [builder()][ResourcePolicies::builder]. The default configuration should
14276/// work for most applications. Common configuration changes include
14277///
14278/// * [with_endpoint()]: by default this client uses the global default endpoint
14279/// (`https://compute.googleapis.com`). Applications using regional
14280/// endpoints or running in restricted networks (e.g. a network configured
14281// with [Private Google Access with VPC Service Controls]) may want to
14282/// override this default.
14283/// * [with_credentials()]: by default this client uses
14284/// [Application Default Credentials]. Applications using custom
14285/// authentication may need to override this default.
14286///
14287/// [with_endpoint()]: super::builder::resource_policies::ClientBuilder::with_endpoint
14288/// [with_credentials()]: super::builder::resource_policies::ClientBuilder::credentials
14289/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14290/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14291///
14292/// # Pooling and Cloning
14293///
14294/// `ResourcePolicies` holds a connection pool internally, it is advised to
14295/// create one and the reuse it. You do not need to wrap `ResourcePolicies` in
14296/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14297/// already uses an `Arc` internally.
14298#[cfg(feature = "resource-policies")]
14299#[cfg_attr(docsrs, doc(cfg(feature = "resource-policies")))]
14300#[derive(Clone, Debug)]
14301pub struct ResourcePolicies {
14302 inner: std::sync::Arc<dyn super::stub::dynamic::ResourcePolicies>,
14303}
14304
14305#[cfg(feature = "resource-policies")]
14306impl ResourcePolicies {
14307 /// Returns a builder for [ResourcePolicies].
14308 ///
14309 /// ```
14310 /// # tokio_test::block_on(async {
14311 /// # use google_cloud_compute_v1::client::ResourcePolicies;
14312 /// let client = ResourcePolicies::builder().build().await?;
14313 /// # gax::client_builder::Result::<()>::Ok(()) });
14314 /// ```
14315 pub fn builder() -> super::builder::resource_policies::ClientBuilder {
14316 gax::client_builder::internal::new_builder(
14317 super::builder::resource_policies::client::Factory,
14318 )
14319 }
14320
14321 /// Creates a new client from the provided stub.
14322 ///
14323 /// The most common case for calling this function is in tests mocking the
14324 /// client's behavior.
14325 pub fn from_stub<T>(stub: T) -> Self
14326 where
14327 T: super::stub::ResourcePolicies + 'static,
14328 {
14329 Self {
14330 inner: std::sync::Arc::new(stub),
14331 }
14332 }
14333
14334 pub(crate) async fn new(
14335 config: gaxi::options::ClientConfig,
14336 ) -> gax::client_builder::Result<Self> {
14337 let inner = Self::build_inner(config).await?;
14338 Ok(Self { inner })
14339 }
14340
14341 async fn build_inner(
14342 conf: gaxi::options::ClientConfig,
14343 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ResourcePolicies>>
14344 {
14345 if gaxi::options::tracing_enabled(&conf) {
14346 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14347 }
14348 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14349 }
14350
14351 async fn build_transport(
14352 conf: gaxi::options::ClientConfig,
14353 ) -> gax::client_builder::Result<impl super::stub::ResourcePolicies> {
14354 super::transport::ResourcePolicies::new(conf).await
14355 }
14356
14357 async fn build_with_tracing(
14358 conf: gaxi::options::ClientConfig,
14359 ) -> gax::client_builder::Result<impl super::stub::ResourcePolicies> {
14360 Self::build_transport(conf)
14361 .await
14362 .map(super::tracing::ResourcePolicies::new)
14363 }
14364
14365 /// Retrieves an aggregated list of resource policies.
14366 ///
14367 /// To prevent failure, Google recommends that you set the
14368 /// `returnPartialSuccess` parameter to `true`.
14369 pub fn aggregated_list(&self) -> super::builder::resource_policies::AggregatedList {
14370 super::builder::resource_policies::AggregatedList::new(self.inner.clone())
14371 }
14372
14373 /// Deletes the specified resource policy.
14374 pub fn delete(&self) -> super::builder::resource_policies::Delete {
14375 super::builder::resource_policies::Delete::new(self.inner.clone())
14376 }
14377
14378 /// Retrieves all information of the specified resource policy.
14379 pub fn get(&self) -> super::builder::resource_policies::Get {
14380 super::builder::resource_policies::Get::new(self.inner.clone())
14381 }
14382
14383 /// Gets the access control policy for a resource. May be empty if no such
14384 /// policy or resource exists.
14385 pub fn get_iam_policy(&self) -> super::builder::resource_policies::GetIamPolicy {
14386 super::builder::resource_policies::GetIamPolicy::new(self.inner.clone())
14387 }
14388
14389 /// Creates a new resource policy.
14390 pub fn insert(&self) -> super::builder::resource_policies::Insert {
14391 super::builder::resource_policies::Insert::new(self.inner.clone())
14392 }
14393
14394 /// A list all the resource policies that have been configured for the
14395 /// specified project in specified region.
14396 pub fn list(&self) -> super::builder::resource_policies::List {
14397 super::builder::resource_policies::List::new(self.inner.clone())
14398 }
14399
14400 /// Modify the specified resource policy.
14401 pub fn patch(&self) -> super::builder::resource_policies::Patch {
14402 super::builder::resource_policies::Patch::new(self.inner.clone())
14403 }
14404
14405 /// Sets the access control policy on the specified resource.
14406 /// Replaces any existing policy.
14407 pub fn set_iam_policy(&self) -> super::builder::resource_policies::SetIamPolicy {
14408 super::builder::resource_policies::SetIamPolicy::new(self.inner.clone())
14409 }
14410
14411 /// Returns permissions that a caller has on the specified resource.
14412 pub fn test_iam_permissions(&self) -> super::builder::resource_policies::TestIamPermissions {
14413 super::builder::resource_policies::TestIamPermissions::new(self.inner.clone())
14414 }
14415
14416 /// Retrieves the specified region-specific Operations resource.
14417 pub fn get_operation(&self) -> super::builder::resource_policies::GetOperation {
14418 super::builder::resource_policies::GetOperation::new(self.inner.clone())
14419 }
14420}
14421
14422/// Implements a client for the Google Compute Engine API.
14423///
14424/// # Example
14425/// ```
14426/// # tokio_test::block_on(async {
14427/// # use google_cloud_compute_v1::client::Routers;
14428/// let client = Routers::builder().build().await?;
14429/// // use `client` to make requests to the Google Compute Engine API.
14430/// # gax::client_builder::Result::<()>::Ok(()) });
14431/// ```
14432///
14433/// # Service Description
14434///
14435/// Service for the `routers` resource.
14436///
14437/// # Configuration
14438///
14439/// To configure `Routers` use the `with_*` methods in the type returned
14440/// by [builder()][Routers::builder]. The default configuration should
14441/// work for most applications. Common configuration changes include
14442///
14443/// * [with_endpoint()]: by default this client uses the global default endpoint
14444/// (`https://compute.googleapis.com`). Applications using regional
14445/// endpoints or running in restricted networks (e.g. a network configured
14446// with [Private Google Access with VPC Service Controls]) may want to
14447/// override this default.
14448/// * [with_credentials()]: by default this client uses
14449/// [Application Default Credentials]. Applications using custom
14450/// authentication may need to override this default.
14451///
14452/// [with_endpoint()]: super::builder::routers::ClientBuilder::with_endpoint
14453/// [with_credentials()]: super::builder::routers::ClientBuilder::credentials
14454/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14455/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14456///
14457/// # Pooling and Cloning
14458///
14459/// `Routers` holds a connection pool internally, it is advised to
14460/// create one and the reuse it. You do not need to wrap `Routers` in
14461/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14462/// already uses an `Arc` internally.
14463#[cfg(feature = "routers")]
14464#[cfg_attr(docsrs, doc(cfg(feature = "routers")))]
14465#[derive(Clone, Debug)]
14466pub struct Routers {
14467 inner: std::sync::Arc<dyn super::stub::dynamic::Routers>,
14468}
14469
14470#[cfg(feature = "routers")]
14471impl Routers {
14472 /// Returns a builder for [Routers].
14473 ///
14474 /// ```
14475 /// # tokio_test::block_on(async {
14476 /// # use google_cloud_compute_v1::client::Routers;
14477 /// let client = Routers::builder().build().await?;
14478 /// # gax::client_builder::Result::<()>::Ok(()) });
14479 /// ```
14480 pub fn builder() -> super::builder::routers::ClientBuilder {
14481 gax::client_builder::internal::new_builder(super::builder::routers::client::Factory)
14482 }
14483
14484 /// Creates a new client from the provided stub.
14485 ///
14486 /// The most common case for calling this function is in tests mocking the
14487 /// client's behavior.
14488 pub fn from_stub<T>(stub: T) -> Self
14489 where
14490 T: super::stub::Routers + 'static,
14491 {
14492 Self {
14493 inner: std::sync::Arc::new(stub),
14494 }
14495 }
14496
14497 pub(crate) async fn new(
14498 config: gaxi::options::ClientConfig,
14499 ) -> gax::client_builder::Result<Self> {
14500 let inner = Self::build_inner(config).await?;
14501 Ok(Self { inner })
14502 }
14503
14504 async fn build_inner(
14505 conf: gaxi::options::ClientConfig,
14506 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Routers>> {
14507 if gaxi::options::tracing_enabled(&conf) {
14508 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14509 }
14510 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14511 }
14512
14513 async fn build_transport(
14514 conf: gaxi::options::ClientConfig,
14515 ) -> gax::client_builder::Result<impl super::stub::Routers> {
14516 super::transport::Routers::new(conf).await
14517 }
14518
14519 async fn build_with_tracing(
14520 conf: gaxi::options::ClientConfig,
14521 ) -> gax::client_builder::Result<impl super::stub::Routers> {
14522 Self::build_transport(conf)
14523 .await
14524 .map(super::tracing::Routers::new)
14525 }
14526
14527 /// Retrieves an aggregated list of routers.
14528 ///
14529 /// To prevent failure, Google recommends that you set the
14530 /// `returnPartialSuccess` parameter to `true`.
14531 pub fn aggregated_list(&self) -> super::builder::routers::AggregatedList {
14532 super::builder::routers::AggregatedList::new(self.inner.clone())
14533 }
14534
14535 /// Deletes the specified Router resource.
14536 pub fn delete(&self) -> super::builder::routers::Delete {
14537 super::builder::routers::Delete::new(self.inner.clone())
14538 }
14539
14540 /// Deletes Route Policy
14541 pub fn delete_route_policy(&self) -> super::builder::routers::DeleteRoutePolicy {
14542 super::builder::routers::DeleteRoutePolicy::new(self.inner.clone())
14543 }
14544
14545 /// Returns the specified Router resource.
14546 pub fn get(&self) -> super::builder::routers::Get {
14547 super::builder::routers::Get::new(self.inner.clone())
14548 }
14549
14550 /// Retrieves runtime NAT IP information.
14551 pub fn get_nat_ip_info(&self) -> super::builder::routers::GetNatIpInfo {
14552 super::builder::routers::GetNatIpInfo::new(self.inner.clone())
14553 }
14554
14555 /// Retrieves runtime Nat mapping information of VM endpoints.
14556 pub fn get_nat_mapping_info(&self) -> super::builder::routers::GetNatMappingInfo {
14557 super::builder::routers::GetNatMappingInfo::new(self.inner.clone())
14558 }
14559
14560 /// Returns specified Route Policy
14561 pub fn get_route_policy(&self) -> super::builder::routers::GetRoutePolicy {
14562 super::builder::routers::GetRoutePolicy::new(self.inner.clone())
14563 }
14564
14565 /// Retrieves runtime information of the specified router.
14566 pub fn get_router_status(&self) -> super::builder::routers::GetRouterStatus {
14567 super::builder::routers::GetRouterStatus::new(self.inner.clone())
14568 }
14569
14570 /// Creates a Router resource in the specified project and region using
14571 /// the data included in the request.
14572 pub fn insert(&self) -> super::builder::routers::Insert {
14573 super::builder::routers::Insert::new(self.inner.clone())
14574 }
14575
14576 /// Retrieves a list of Router resources available to the specified project.
14577 pub fn list(&self) -> super::builder::routers::List {
14578 super::builder::routers::List::new(self.inner.clone())
14579 }
14580
14581 /// Retrieves a list of router bgp routes available to the specified project.
14582 pub fn list_bgp_routes(&self) -> super::builder::routers::ListBgpRoutes {
14583 super::builder::routers::ListBgpRoutes::new(self.inner.clone())
14584 }
14585
14586 /// Retrieves a list of router route policy subresources available to the
14587 /// specified project.
14588 pub fn list_route_policies(&self) -> super::builder::routers::ListRoutePolicies {
14589 super::builder::routers::ListRoutePolicies::new(self.inner.clone())
14590 }
14591
14592 /// Patches the specified Router resource with the data included in the
14593 /// request. This method supportsPATCH
14594 /// semantics and usesJSON merge
14595 /// patch format and processing rules.
14596 pub fn patch(&self) -> super::builder::routers::Patch {
14597 super::builder::routers::Patch::new(self.inner.clone())
14598 }
14599
14600 /// Patches Route Policy
14601 pub fn patch_route_policy(&self) -> super::builder::routers::PatchRoutePolicy {
14602 super::builder::routers::PatchRoutePolicy::new(self.inner.clone())
14603 }
14604
14605 /// Preview fields auto-generated during router create andupdate operations.
14606 /// Calling this method does NOT create or update the router.
14607 pub fn preview(&self) -> super::builder::routers::Preview {
14608 super::builder::routers::Preview::new(self.inner.clone())
14609 }
14610
14611 /// Updates the specified Router resource with the data included in the
14612 /// request. This method conforms toPUT semantics, which requests that the state of the
14613 /// target resource be created or replaced with the state defined by the
14614 /// representation enclosed in the request message payload.
14615 pub fn update(&self) -> super::builder::routers::Update {
14616 super::builder::routers::Update::new(self.inner.clone())
14617 }
14618
14619 /// Updates or creates new Route Policy
14620 pub fn update_route_policy(&self) -> super::builder::routers::UpdateRoutePolicy {
14621 super::builder::routers::UpdateRoutePolicy::new(self.inner.clone())
14622 }
14623
14624 /// Retrieves the specified region-specific Operations resource.
14625 pub fn get_operation(&self) -> super::builder::routers::GetOperation {
14626 super::builder::routers::GetOperation::new(self.inner.clone())
14627 }
14628}
14629
14630/// Implements a client for the Google Compute Engine API.
14631///
14632/// # Example
14633/// ```
14634/// # tokio_test::block_on(async {
14635/// # use google_cloud_compute_v1::client::Routes;
14636/// let client = Routes::builder().build().await?;
14637/// // use `client` to make requests to the Google Compute Engine API.
14638/// # gax::client_builder::Result::<()>::Ok(()) });
14639/// ```
14640///
14641/// # Service Description
14642///
14643/// Service for the `routes` resource.
14644///
14645/// # Configuration
14646///
14647/// To configure `Routes` use the `with_*` methods in the type returned
14648/// by [builder()][Routes::builder]. The default configuration should
14649/// work for most applications. Common configuration changes include
14650///
14651/// * [with_endpoint()]: by default this client uses the global default endpoint
14652/// (`https://compute.googleapis.com`). Applications using regional
14653/// endpoints or running in restricted networks (e.g. a network configured
14654// with [Private Google Access with VPC Service Controls]) may want to
14655/// override this default.
14656/// * [with_credentials()]: by default this client uses
14657/// [Application Default Credentials]. Applications using custom
14658/// authentication may need to override this default.
14659///
14660/// [with_endpoint()]: super::builder::routes::ClientBuilder::with_endpoint
14661/// [with_credentials()]: super::builder::routes::ClientBuilder::credentials
14662/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14663/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14664///
14665/// # Pooling and Cloning
14666///
14667/// `Routes` holds a connection pool internally, it is advised to
14668/// create one and the reuse it. You do not need to wrap `Routes` in
14669/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14670/// already uses an `Arc` internally.
14671#[cfg(feature = "routes")]
14672#[cfg_attr(docsrs, doc(cfg(feature = "routes")))]
14673#[derive(Clone, Debug)]
14674pub struct Routes {
14675 inner: std::sync::Arc<dyn super::stub::dynamic::Routes>,
14676}
14677
14678#[cfg(feature = "routes")]
14679impl Routes {
14680 /// Returns a builder for [Routes].
14681 ///
14682 /// ```
14683 /// # tokio_test::block_on(async {
14684 /// # use google_cloud_compute_v1::client::Routes;
14685 /// let client = Routes::builder().build().await?;
14686 /// # gax::client_builder::Result::<()>::Ok(()) });
14687 /// ```
14688 pub fn builder() -> super::builder::routes::ClientBuilder {
14689 gax::client_builder::internal::new_builder(super::builder::routes::client::Factory)
14690 }
14691
14692 /// Creates a new client from the provided stub.
14693 ///
14694 /// The most common case for calling this function is in tests mocking the
14695 /// client's behavior.
14696 pub fn from_stub<T>(stub: T) -> Self
14697 where
14698 T: super::stub::Routes + 'static,
14699 {
14700 Self {
14701 inner: std::sync::Arc::new(stub),
14702 }
14703 }
14704
14705 pub(crate) async fn new(
14706 config: gaxi::options::ClientConfig,
14707 ) -> gax::client_builder::Result<Self> {
14708 let inner = Self::build_inner(config).await?;
14709 Ok(Self { inner })
14710 }
14711
14712 async fn build_inner(
14713 conf: gaxi::options::ClientConfig,
14714 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Routes>> {
14715 if gaxi::options::tracing_enabled(&conf) {
14716 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14717 }
14718 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14719 }
14720
14721 async fn build_transport(
14722 conf: gaxi::options::ClientConfig,
14723 ) -> gax::client_builder::Result<impl super::stub::Routes> {
14724 super::transport::Routes::new(conf).await
14725 }
14726
14727 async fn build_with_tracing(
14728 conf: gaxi::options::ClientConfig,
14729 ) -> gax::client_builder::Result<impl super::stub::Routes> {
14730 Self::build_transport(conf)
14731 .await
14732 .map(super::tracing::Routes::new)
14733 }
14734
14735 /// Deletes the specified Route resource.
14736 pub fn delete(&self) -> super::builder::routes::Delete {
14737 super::builder::routes::Delete::new(self.inner.clone())
14738 }
14739
14740 /// Returns the specified Route resource.
14741 pub fn get(&self) -> super::builder::routes::Get {
14742 super::builder::routes::Get::new(self.inner.clone())
14743 }
14744
14745 /// Creates a Route resource in the specified project using the data included
14746 /// in the request.
14747 pub fn insert(&self) -> super::builder::routes::Insert {
14748 super::builder::routes::Insert::new(self.inner.clone())
14749 }
14750
14751 /// Retrieves the list of Route resources available to the specified project.
14752 pub fn list(&self) -> super::builder::routes::List {
14753 super::builder::routes::List::new(self.inner.clone())
14754 }
14755
14756 /// Retrieves the specified Operations resource.
14757 pub fn get_operation(&self) -> super::builder::routes::GetOperation {
14758 super::builder::routes::GetOperation::new(self.inner.clone())
14759 }
14760}
14761
14762/// Implements a client for the Google Compute Engine API.
14763///
14764/// # Example
14765/// ```
14766/// # tokio_test::block_on(async {
14767/// # use google_cloud_compute_v1::client::SecurityPolicies;
14768/// let client = SecurityPolicies::builder().build().await?;
14769/// // use `client` to make requests to the Google Compute Engine API.
14770/// # gax::client_builder::Result::<()>::Ok(()) });
14771/// ```
14772///
14773/// # Service Description
14774///
14775/// Service for the `securityPolicies` resource.
14776///
14777/// # Configuration
14778///
14779/// To configure `SecurityPolicies` use the `with_*` methods in the type returned
14780/// by [builder()][SecurityPolicies::builder]. The default configuration should
14781/// work for most applications. Common configuration changes include
14782///
14783/// * [with_endpoint()]: by default this client uses the global default endpoint
14784/// (`https://compute.googleapis.com`). Applications using regional
14785/// endpoints or running in restricted networks (e.g. a network configured
14786// with [Private Google Access with VPC Service Controls]) may want to
14787/// override this default.
14788/// * [with_credentials()]: by default this client uses
14789/// [Application Default Credentials]. Applications using custom
14790/// authentication may need to override this default.
14791///
14792/// [with_endpoint()]: super::builder::security_policies::ClientBuilder::with_endpoint
14793/// [with_credentials()]: super::builder::security_policies::ClientBuilder::credentials
14794/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14795/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14796///
14797/// # Pooling and Cloning
14798///
14799/// `SecurityPolicies` holds a connection pool internally, it is advised to
14800/// create one and the reuse it. You do not need to wrap `SecurityPolicies` in
14801/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14802/// already uses an `Arc` internally.
14803#[cfg(feature = "security-policies")]
14804#[cfg_attr(docsrs, doc(cfg(feature = "security-policies")))]
14805#[derive(Clone, Debug)]
14806pub struct SecurityPolicies {
14807 inner: std::sync::Arc<dyn super::stub::dynamic::SecurityPolicies>,
14808}
14809
14810#[cfg(feature = "security-policies")]
14811impl SecurityPolicies {
14812 /// Returns a builder for [SecurityPolicies].
14813 ///
14814 /// ```
14815 /// # tokio_test::block_on(async {
14816 /// # use google_cloud_compute_v1::client::SecurityPolicies;
14817 /// let client = SecurityPolicies::builder().build().await?;
14818 /// # gax::client_builder::Result::<()>::Ok(()) });
14819 /// ```
14820 pub fn builder() -> super::builder::security_policies::ClientBuilder {
14821 gax::client_builder::internal::new_builder(
14822 super::builder::security_policies::client::Factory,
14823 )
14824 }
14825
14826 /// Creates a new client from the provided stub.
14827 ///
14828 /// The most common case for calling this function is in tests mocking the
14829 /// client's behavior.
14830 pub fn from_stub<T>(stub: T) -> Self
14831 where
14832 T: super::stub::SecurityPolicies + 'static,
14833 {
14834 Self {
14835 inner: std::sync::Arc::new(stub),
14836 }
14837 }
14838
14839 pub(crate) async fn new(
14840 config: gaxi::options::ClientConfig,
14841 ) -> gax::client_builder::Result<Self> {
14842 let inner = Self::build_inner(config).await?;
14843 Ok(Self { inner })
14844 }
14845
14846 async fn build_inner(
14847 conf: gaxi::options::ClientConfig,
14848 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SecurityPolicies>>
14849 {
14850 if gaxi::options::tracing_enabled(&conf) {
14851 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
14852 }
14853 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
14854 }
14855
14856 async fn build_transport(
14857 conf: gaxi::options::ClientConfig,
14858 ) -> gax::client_builder::Result<impl super::stub::SecurityPolicies> {
14859 super::transport::SecurityPolicies::new(conf).await
14860 }
14861
14862 async fn build_with_tracing(
14863 conf: gaxi::options::ClientConfig,
14864 ) -> gax::client_builder::Result<impl super::stub::SecurityPolicies> {
14865 Self::build_transport(conf)
14866 .await
14867 .map(super::tracing::SecurityPolicies::new)
14868 }
14869
14870 /// Inserts a rule into a security policy.
14871 pub fn add_rule(&self) -> super::builder::security_policies::AddRule {
14872 super::builder::security_policies::AddRule::new(self.inner.clone())
14873 }
14874
14875 /// Retrieves the list of all SecurityPolicy resources, regional and global,
14876 /// available to the specified project.
14877 ///
14878 /// To prevent failure, Google recommends that you set the
14879 /// `returnPartialSuccess` parameter to `true`.
14880 pub fn aggregated_list(&self) -> super::builder::security_policies::AggregatedList {
14881 super::builder::security_policies::AggregatedList::new(self.inner.clone())
14882 }
14883
14884 /// Deletes the specified policy.
14885 pub fn delete(&self) -> super::builder::security_policies::Delete {
14886 super::builder::security_policies::Delete::new(self.inner.clone())
14887 }
14888
14889 /// List all of the ordered rules present in a single specified policy.
14890 pub fn get(&self) -> super::builder::security_policies::Get {
14891 super::builder::security_policies::Get::new(self.inner.clone())
14892 }
14893
14894 /// Gets a rule at the specified priority.
14895 pub fn get_rule(&self) -> super::builder::security_policies::GetRule {
14896 super::builder::security_policies::GetRule::new(self.inner.clone())
14897 }
14898
14899 /// Creates a new policy in the specified project using the data included in
14900 /// the request.
14901 pub fn insert(&self) -> super::builder::security_policies::Insert {
14902 super::builder::security_policies::Insert::new(self.inner.clone())
14903 }
14904
14905 /// List all the policies that have been configured for the specified project.
14906 pub fn list(&self) -> super::builder::security_policies::List {
14907 super::builder::security_policies::List::new(self.inner.clone())
14908 }
14909
14910 /// Gets the current list of preconfigured Web Application Firewall (WAF)
14911 /// expressions.
14912 pub fn list_preconfigured_expression_sets(
14913 &self,
14914 ) -> super::builder::security_policies::ListPreconfiguredExpressionSets {
14915 super::builder::security_policies::ListPreconfiguredExpressionSets::new(self.inner.clone())
14916 }
14917
14918 /// Patches the specified policy with the data included in the request. To
14919 /// clear fields in the policy, leave the fields empty and specify them in the
14920 /// updateMask. This cannot be used to be update the rules in the policy.
14921 /// Please use the per rule methods like addRule, patchRule, and removeRule
14922 /// instead.
14923 pub fn patch(&self) -> super::builder::security_policies::Patch {
14924 super::builder::security_policies::Patch::new(self.inner.clone())
14925 }
14926
14927 /// Patches a rule at the specified priority. To clear fields in the rule,
14928 /// leave the fields empty and specify them in the updateMask.
14929 pub fn patch_rule(&self) -> super::builder::security_policies::PatchRule {
14930 super::builder::security_policies::PatchRule::new(self.inner.clone())
14931 }
14932
14933 /// Deletes a rule at the specified priority.
14934 pub fn remove_rule(&self) -> super::builder::security_policies::RemoveRule {
14935 super::builder::security_policies::RemoveRule::new(self.inner.clone())
14936 }
14937
14938 /// Sets the labels on a security policy. To learn more about labels,
14939 /// read the Labeling Resources
14940 /// documentation.
14941 pub fn set_labels(&self) -> super::builder::security_policies::SetLabels {
14942 super::builder::security_policies::SetLabels::new(self.inner.clone())
14943 }
14944
14945 /// Retrieves the specified Operations resource.
14946 pub fn get_operation(&self) -> super::builder::security_policies::GetOperation {
14947 super::builder::security_policies::GetOperation::new(self.inner.clone())
14948 }
14949}
14950
14951/// Implements a client for the Google Compute Engine API.
14952///
14953/// # Example
14954/// ```
14955/// # tokio_test::block_on(async {
14956/// # use google_cloud_compute_v1::client::ServiceAttachments;
14957/// let client = ServiceAttachments::builder().build().await?;
14958/// // use `client` to make requests to the Google Compute Engine API.
14959/// # gax::client_builder::Result::<()>::Ok(()) });
14960/// ```
14961///
14962/// # Service Description
14963///
14964/// Service for the `serviceAttachments` resource.
14965///
14966/// # Configuration
14967///
14968/// To configure `ServiceAttachments` use the `with_*` methods in the type returned
14969/// by [builder()][ServiceAttachments::builder]. The default configuration should
14970/// work for most applications. Common configuration changes include
14971///
14972/// * [with_endpoint()]: by default this client uses the global default endpoint
14973/// (`https://compute.googleapis.com`). Applications using regional
14974/// endpoints or running in restricted networks (e.g. a network configured
14975// with [Private Google Access with VPC Service Controls]) may want to
14976/// override this default.
14977/// * [with_credentials()]: by default this client uses
14978/// [Application Default Credentials]. Applications using custom
14979/// authentication may need to override this default.
14980///
14981/// [with_endpoint()]: super::builder::service_attachments::ClientBuilder::with_endpoint
14982/// [with_credentials()]: super::builder::service_attachments::ClientBuilder::credentials
14983/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
14984/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
14985///
14986/// # Pooling and Cloning
14987///
14988/// `ServiceAttachments` holds a connection pool internally, it is advised to
14989/// create one and the reuse it. You do not need to wrap `ServiceAttachments` in
14990/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
14991/// already uses an `Arc` internally.
14992#[cfg(feature = "service-attachments")]
14993#[cfg_attr(docsrs, doc(cfg(feature = "service-attachments")))]
14994#[derive(Clone, Debug)]
14995pub struct ServiceAttachments {
14996 inner: std::sync::Arc<dyn super::stub::dynamic::ServiceAttachments>,
14997}
14998
14999#[cfg(feature = "service-attachments")]
15000impl ServiceAttachments {
15001 /// Returns a builder for [ServiceAttachments].
15002 ///
15003 /// ```
15004 /// # tokio_test::block_on(async {
15005 /// # use google_cloud_compute_v1::client::ServiceAttachments;
15006 /// let client = ServiceAttachments::builder().build().await?;
15007 /// # gax::client_builder::Result::<()>::Ok(()) });
15008 /// ```
15009 pub fn builder() -> super::builder::service_attachments::ClientBuilder {
15010 gax::client_builder::internal::new_builder(
15011 super::builder::service_attachments::client::Factory,
15012 )
15013 }
15014
15015 /// Creates a new client from the provided stub.
15016 ///
15017 /// The most common case for calling this function is in tests mocking the
15018 /// client's behavior.
15019 pub fn from_stub<T>(stub: T) -> Self
15020 where
15021 T: super::stub::ServiceAttachments + 'static,
15022 {
15023 Self {
15024 inner: std::sync::Arc::new(stub),
15025 }
15026 }
15027
15028 pub(crate) async fn new(
15029 config: gaxi::options::ClientConfig,
15030 ) -> gax::client_builder::Result<Self> {
15031 let inner = Self::build_inner(config).await?;
15032 Ok(Self { inner })
15033 }
15034
15035 async fn build_inner(
15036 conf: gaxi::options::ClientConfig,
15037 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ServiceAttachments>>
15038 {
15039 if gaxi::options::tracing_enabled(&conf) {
15040 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15041 }
15042 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15043 }
15044
15045 async fn build_transport(
15046 conf: gaxi::options::ClientConfig,
15047 ) -> gax::client_builder::Result<impl super::stub::ServiceAttachments> {
15048 super::transport::ServiceAttachments::new(conf).await
15049 }
15050
15051 async fn build_with_tracing(
15052 conf: gaxi::options::ClientConfig,
15053 ) -> gax::client_builder::Result<impl super::stub::ServiceAttachments> {
15054 Self::build_transport(conf)
15055 .await
15056 .map(super::tracing::ServiceAttachments::new)
15057 }
15058
15059 /// Retrieves the list of all ServiceAttachment resources,
15060 /// regional and global, available to the specified project.
15061 ///
15062 /// To prevent failure, Google recommends that you set the
15063 /// `returnPartialSuccess` parameter to `true`.
15064 pub fn aggregated_list(&self) -> super::builder::service_attachments::AggregatedList {
15065 super::builder::service_attachments::AggregatedList::new(self.inner.clone())
15066 }
15067
15068 /// Deletes the specified ServiceAttachment in the given scope
15069 pub fn delete(&self) -> super::builder::service_attachments::Delete {
15070 super::builder::service_attachments::Delete::new(self.inner.clone())
15071 }
15072
15073 /// Returns the specified ServiceAttachment resource in the given scope.
15074 pub fn get(&self) -> super::builder::service_attachments::Get {
15075 super::builder::service_attachments::Get::new(self.inner.clone())
15076 }
15077
15078 /// Gets the access control policy for a resource. May be empty if no such
15079 /// policy or resource exists.
15080 pub fn get_iam_policy(&self) -> super::builder::service_attachments::GetIamPolicy {
15081 super::builder::service_attachments::GetIamPolicy::new(self.inner.clone())
15082 }
15083
15084 /// Creates a ServiceAttachment in the specified project in the given scope
15085 /// using the parameters that are included in the request.
15086 pub fn insert(&self) -> super::builder::service_attachments::Insert {
15087 super::builder::service_attachments::Insert::new(self.inner.clone())
15088 }
15089
15090 /// Lists the ServiceAttachments for a project in the given scope.
15091 pub fn list(&self) -> super::builder::service_attachments::List {
15092 super::builder::service_attachments::List::new(self.inner.clone())
15093 }
15094
15095 /// Patches the specified ServiceAttachment resource with the data included in
15096 /// the request. This method supports PATCH
15097 /// semantics and usesJSON merge
15098 /// patch format and processing rules.
15099 pub fn patch(&self) -> super::builder::service_attachments::Patch {
15100 super::builder::service_attachments::Patch::new(self.inner.clone())
15101 }
15102
15103 /// Sets the access control policy on the specified resource.
15104 /// Replaces any existing policy.
15105 pub fn set_iam_policy(&self) -> super::builder::service_attachments::SetIamPolicy {
15106 super::builder::service_attachments::SetIamPolicy::new(self.inner.clone())
15107 }
15108
15109 /// Returns permissions that a caller has on the specified resource.
15110 pub fn test_iam_permissions(&self) -> super::builder::service_attachments::TestIamPermissions {
15111 super::builder::service_attachments::TestIamPermissions::new(self.inner.clone())
15112 }
15113
15114 /// Retrieves the specified region-specific Operations resource.
15115 pub fn get_operation(&self) -> super::builder::service_attachments::GetOperation {
15116 super::builder::service_attachments::GetOperation::new(self.inner.clone())
15117 }
15118}
15119
15120/// Implements a client for the Google Compute Engine API.
15121///
15122/// # Example
15123/// ```
15124/// # tokio_test::block_on(async {
15125/// # use google_cloud_compute_v1::client::SnapshotSettings;
15126/// let client = SnapshotSettings::builder().build().await?;
15127/// // use `client` to make requests to the Google Compute Engine API.
15128/// # gax::client_builder::Result::<()>::Ok(()) });
15129/// ```
15130///
15131/// # Service Description
15132///
15133/// Service for the `snapshotSettings` resource.
15134///
15135/// # Configuration
15136///
15137/// To configure `SnapshotSettings` use the `with_*` methods in the type returned
15138/// by [builder()][SnapshotSettings::builder]. The default configuration should
15139/// work for most applications. Common configuration changes include
15140///
15141/// * [with_endpoint()]: by default this client uses the global default endpoint
15142/// (`https://compute.googleapis.com`). Applications using regional
15143/// endpoints or running in restricted networks (e.g. a network configured
15144// with [Private Google Access with VPC Service Controls]) may want to
15145/// override this default.
15146/// * [with_credentials()]: by default this client uses
15147/// [Application Default Credentials]. Applications using custom
15148/// authentication may need to override this default.
15149///
15150/// [with_endpoint()]: super::builder::snapshot_settings::ClientBuilder::with_endpoint
15151/// [with_credentials()]: super::builder::snapshot_settings::ClientBuilder::credentials
15152/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15153/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15154///
15155/// # Pooling and Cloning
15156///
15157/// `SnapshotSettings` holds a connection pool internally, it is advised to
15158/// create one and the reuse it. You do not need to wrap `SnapshotSettings` in
15159/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15160/// already uses an `Arc` internally.
15161#[cfg(feature = "snapshot-settings")]
15162#[cfg_attr(docsrs, doc(cfg(feature = "snapshot-settings")))]
15163#[derive(Clone, Debug)]
15164pub struct SnapshotSettings {
15165 inner: std::sync::Arc<dyn super::stub::dynamic::SnapshotSettings>,
15166}
15167
15168#[cfg(feature = "snapshot-settings")]
15169impl SnapshotSettings {
15170 /// Returns a builder for [SnapshotSettings].
15171 ///
15172 /// ```
15173 /// # tokio_test::block_on(async {
15174 /// # use google_cloud_compute_v1::client::SnapshotSettings;
15175 /// let client = SnapshotSettings::builder().build().await?;
15176 /// # gax::client_builder::Result::<()>::Ok(()) });
15177 /// ```
15178 pub fn builder() -> super::builder::snapshot_settings::ClientBuilder {
15179 gax::client_builder::internal::new_builder(
15180 super::builder::snapshot_settings::client::Factory,
15181 )
15182 }
15183
15184 /// Creates a new client from the provided stub.
15185 ///
15186 /// The most common case for calling this function is in tests mocking the
15187 /// client's behavior.
15188 pub fn from_stub<T>(stub: T) -> Self
15189 where
15190 T: super::stub::SnapshotSettings + 'static,
15191 {
15192 Self {
15193 inner: std::sync::Arc::new(stub),
15194 }
15195 }
15196
15197 pub(crate) async fn new(
15198 config: gaxi::options::ClientConfig,
15199 ) -> gax::client_builder::Result<Self> {
15200 let inner = Self::build_inner(config).await?;
15201 Ok(Self { inner })
15202 }
15203
15204 async fn build_inner(
15205 conf: gaxi::options::ClientConfig,
15206 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SnapshotSettings>>
15207 {
15208 if gaxi::options::tracing_enabled(&conf) {
15209 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15210 }
15211 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15212 }
15213
15214 async fn build_transport(
15215 conf: gaxi::options::ClientConfig,
15216 ) -> gax::client_builder::Result<impl super::stub::SnapshotSettings> {
15217 super::transport::SnapshotSettings::new(conf).await
15218 }
15219
15220 async fn build_with_tracing(
15221 conf: gaxi::options::ClientConfig,
15222 ) -> gax::client_builder::Result<impl super::stub::SnapshotSettings> {
15223 Self::build_transport(conf)
15224 .await
15225 .map(super::tracing::SnapshotSettings::new)
15226 }
15227
15228 /// Get snapshot settings.
15229 pub fn get(&self) -> super::builder::snapshot_settings::Get {
15230 super::builder::snapshot_settings::Get::new(self.inner.clone())
15231 }
15232
15233 /// Patch snapshot settings.
15234 pub fn patch(&self) -> super::builder::snapshot_settings::Patch {
15235 super::builder::snapshot_settings::Patch::new(self.inner.clone())
15236 }
15237
15238 /// Retrieves the specified Operations resource.
15239 pub fn get_operation(&self) -> super::builder::snapshot_settings::GetOperation {
15240 super::builder::snapshot_settings::GetOperation::new(self.inner.clone())
15241 }
15242}
15243
15244/// Implements a client for the Google Compute Engine API.
15245///
15246/// # Example
15247/// ```
15248/// # tokio_test::block_on(async {
15249/// # use google_cloud_compute_v1::client::Snapshots;
15250/// let client = Snapshots::builder().build().await?;
15251/// // use `client` to make requests to the Google Compute Engine API.
15252/// # gax::client_builder::Result::<()>::Ok(()) });
15253/// ```
15254///
15255/// # Service Description
15256///
15257/// Service for the `snapshots` resource.
15258///
15259/// # Configuration
15260///
15261/// To configure `Snapshots` use the `with_*` methods in the type returned
15262/// by [builder()][Snapshots::builder]. The default configuration should
15263/// work for most applications. Common configuration changes include
15264///
15265/// * [with_endpoint()]: by default this client uses the global default endpoint
15266/// (`https://compute.googleapis.com`). Applications using regional
15267/// endpoints or running in restricted networks (e.g. a network configured
15268// with [Private Google Access with VPC Service Controls]) may want to
15269/// override this default.
15270/// * [with_credentials()]: by default this client uses
15271/// [Application Default Credentials]. Applications using custom
15272/// authentication may need to override this default.
15273///
15274/// [with_endpoint()]: super::builder::snapshots::ClientBuilder::with_endpoint
15275/// [with_credentials()]: super::builder::snapshots::ClientBuilder::credentials
15276/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15277/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15278///
15279/// # Pooling and Cloning
15280///
15281/// `Snapshots` holds a connection pool internally, it is advised to
15282/// create one and the reuse it. You do not need to wrap `Snapshots` in
15283/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15284/// already uses an `Arc` internally.
15285#[cfg(feature = "snapshots")]
15286#[cfg_attr(docsrs, doc(cfg(feature = "snapshots")))]
15287#[derive(Clone, Debug)]
15288pub struct Snapshots {
15289 inner: std::sync::Arc<dyn super::stub::dynamic::Snapshots>,
15290}
15291
15292#[cfg(feature = "snapshots")]
15293impl Snapshots {
15294 /// Returns a builder for [Snapshots].
15295 ///
15296 /// ```
15297 /// # tokio_test::block_on(async {
15298 /// # use google_cloud_compute_v1::client::Snapshots;
15299 /// let client = Snapshots::builder().build().await?;
15300 /// # gax::client_builder::Result::<()>::Ok(()) });
15301 /// ```
15302 pub fn builder() -> super::builder::snapshots::ClientBuilder {
15303 gax::client_builder::internal::new_builder(super::builder::snapshots::client::Factory)
15304 }
15305
15306 /// Creates a new client from the provided stub.
15307 ///
15308 /// The most common case for calling this function is in tests mocking the
15309 /// client's behavior.
15310 pub fn from_stub<T>(stub: T) -> Self
15311 where
15312 T: super::stub::Snapshots + 'static,
15313 {
15314 Self {
15315 inner: std::sync::Arc::new(stub),
15316 }
15317 }
15318
15319 pub(crate) async fn new(
15320 config: gaxi::options::ClientConfig,
15321 ) -> gax::client_builder::Result<Self> {
15322 let inner = Self::build_inner(config).await?;
15323 Ok(Self { inner })
15324 }
15325
15326 async fn build_inner(
15327 conf: gaxi::options::ClientConfig,
15328 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Snapshots>> {
15329 if gaxi::options::tracing_enabled(&conf) {
15330 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15331 }
15332 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15333 }
15334
15335 async fn build_transport(
15336 conf: gaxi::options::ClientConfig,
15337 ) -> gax::client_builder::Result<impl super::stub::Snapshots> {
15338 super::transport::Snapshots::new(conf).await
15339 }
15340
15341 async fn build_with_tracing(
15342 conf: gaxi::options::ClientConfig,
15343 ) -> gax::client_builder::Result<impl super::stub::Snapshots> {
15344 Self::build_transport(conf)
15345 .await
15346 .map(super::tracing::Snapshots::new)
15347 }
15348
15349 /// Deletes the specified Snapshot resource. Keep in mind that deleting
15350 /// a single snapshot might not necessarily delete all the data on that
15351 /// snapshot. If any data on the snapshot that is marked for deletion is
15352 /// needed for subsequent snapshots, the data will be moved to the next
15353 /// corresponding snapshot.
15354 ///
15355 /// For more information, seeDeleting
15356 /// snapshots.
15357 pub fn delete(&self) -> super::builder::snapshots::Delete {
15358 super::builder::snapshots::Delete::new(self.inner.clone())
15359 }
15360
15361 /// Returns the specified Snapshot resource.
15362 pub fn get(&self) -> super::builder::snapshots::Get {
15363 super::builder::snapshots::Get::new(self.inner.clone())
15364 }
15365
15366 /// Gets the access control policy for a resource. May be empty if no such
15367 /// policy or resource exists.
15368 pub fn get_iam_policy(&self) -> super::builder::snapshots::GetIamPolicy {
15369 super::builder::snapshots::GetIamPolicy::new(self.inner.clone())
15370 }
15371
15372 /// Creates a snapshot in the specified project using the data included
15373 /// in the request. For regular snapshot creation, consider using this method
15374 /// instead of disks.createSnapshot,
15375 /// as this method supports more features, such as creating snapshots in a
15376 /// project different from the source disk project.
15377 pub fn insert(&self) -> super::builder::snapshots::Insert {
15378 super::builder::snapshots::Insert::new(self.inner.clone())
15379 }
15380
15381 /// Retrieves the list of Snapshot resources contained within
15382 /// the specified project.
15383 pub fn list(&self) -> super::builder::snapshots::List {
15384 super::builder::snapshots::List::new(self.inner.clone())
15385 }
15386
15387 /// Sets the access control policy on the specified resource.
15388 /// Replaces any existing policy.
15389 pub fn set_iam_policy(&self) -> super::builder::snapshots::SetIamPolicy {
15390 super::builder::snapshots::SetIamPolicy::new(self.inner.clone())
15391 }
15392
15393 /// Sets the labels on a snapshot. To learn more about labels, read theLabeling
15394 /// Resources documentation.
15395 pub fn set_labels(&self) -> super::builder::snapshots::SetLabels {
15396 super::builder::snapshots::SetLabels::new(self.inner.clone())
15397 }
15398
15399 /// Returns permissions that a caller has on the specified resource.
15400 pub fn test_iam_permissions(&self) -> super::builder::snapshots::TestIamPermissions {
15401 super::builder::snapshots::TestIamPermissions::new(self.inner.clone())
15402 }
15403
15404 /// Retrieves the specified Operations resource.
15405 pub fn get_operation(&self) -> super::builder::snapshots::GetOperation {
15406 super::builder::snapshots::GetOperation::new(self.inner.clone())
15407 }
15408}
15409
15410/// Implements a client for the Google Compute Engine API.
15411///
15412/// # Example
15413/// ```
15414/// # tokio_test::block_on(async {
15415/// # use google_cloud_compute_v1::client::SslCertificates;
15416/// let client = SslCertificates::builder().build().await?;
15417/// // use `client` to make requests to the Google Compute Engine API.
15418/// # gax::client_builder::Result::<()>::Ok(()) });
15419/// ```
15420///
15421/// # Service Description
15422///
15423/// Service for the `sslCertificates` resource.
15424///
15425/// # Configuration
15426///
15427/// To configure `SslCertificates` use the `with_*` methods in the type returned
15428/// by [builder()][SslCertificates::builder]. The default configuration should
15429/// work for most applications. Common configuration changes include
15430///
15431/// * [with_endpoint()]: by default this client uses the global default endpoint
15432/// (`https://compute.googleapis.com`). Applications using regional
15433/// endpoints or running in restricted networks (e.g. a network configured
15434// with [Private Google Access with VPC Service Controls]) may want to
15435/// override this default.
15436/// * [with_credentials()]: by default this client uses
15437/// [Application Default Credentials]. Applications using custom
15438/// authentication may need to override this default.
15439///
15440/// [with_endpoint()]: super::builder::ssl_certificates::ClientBuilder::with_endpoint
15441/// [with_credentials()]: super::builder::ssl_certificates::ClientBuilder::credentials
15442/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15443/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15444///
15445/// # Pooling and Cloning
15446///
15447/// `SslCertificates` holds a connection pool internally, it is advised to
15448/// create one and the reuse it. You do not need to wrap `SslCertificates` in
15449/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15450/// already uses an `Arc` internally.
15451#[cfg(feature = "ssl-certificates")]
15452#[cfg_attr(docsrs, doc(cfg(feature = "ssl-certificates")))]
15453#[derive(Clone, Debug)]
15454pub struct SslCertificates {
15455 inner: std::sync::Arc<dyn super::stub::dynamic::SslCertificates>,
15456}
15457
15458#[cfg(feature = "ssl-certificates")]
15459impl SslCertificates {
15460 /// Returns a builder for [SslCertificates].
15461 ///
15462 /// ```
15463 /// # tokio_test::block_on(async {
15464 /// # use google_cloud_compute_v1::client::SslCertificates;
15465 /// let client = SslCertificates::builder().build().await?;
15466 /// # gax::client_builder::Result::<()>::Ok(()) });
15467 /// ```
15468 pub fn builder() -> super::builder::ssl_certificates::ClientBuilder {
15469 gax::client_builder::internal::new_builder(
15470 super::builder::ssl_certificates::client::Factory,
15471 )
15472 }
15473
15474 /// Creates a new client from the provided stub.
15475 ///
15476 /// The most common case for calling this function is in tests mocking the
15477 /// client's behavior.
15478 pub fn from_stub<T>(stub: T) -> Self
15479 where
15480 T: super::stub::SslCertificates + 'static,
15481 {
15482 Self {
15483 inner: std::sync::Arc::new(stub),
15484 }
15485 }
15486
15487 pub(crate) async fn new(
15488 config: gaxi::options::ClientConfig,
15489 ) -> gax::client_builder::Result<Self> {
15490 let inner = Self::build_inner(config).await?;
15491 Ok(Self { inner })
15492 }
15493
15494 async fn build_inner(
15495 conf: gaxi::options::ClientConfig,
15496 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SslCertificates>>
15497 {
15498 if gaxi::options::tracing_enabled(&conf) {
15499 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15500 }
15501 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15502 }
15503
15504 async fn build_transport(
15505 conf: gaxi::options::ClientConfig,
15506 ) -> gax::client_builder::Result<impl super::stub::SslCertificates> {
15507 super::transport::SslCertificates::new(conf).await
15508 }
15509
15510 async fn build_with_tracing(
15511 conf: gaxi::options::ClientConfig,
15512 ) -> gax::client_builder::Result<impl super::stub::SslCertificates> {
15513 Self::build_transport(conf)
15514 .await
15515 .map(super::tracing::SslCertificates::new)
15516 }
15517
15518 /// Retrieves the list of all SslCertificate resources, regional and global,
15519 /// available to the specified project.
15520 ///
15521 /// To prevent failure, Google recommends that you set the
15522 /// `returnPartialSuccess` parameter to `true`.
15523 pub fn aggregated_list(&self) -> super::builder::ssl_certificates::AggregatedList {
15524 super::builder::ssl_certificates::AggregatedList::new(self.inner.clone())
15525 }
15526
15527 /// Deletes the specified SslCertificate resource.
15528 pub fn delete(&self) -> super::builder::ssl_certificates::Delete {
15529 super::builder::ssl_certificates::Delete::new(self.inner.clone())
15530 }
15531
15532 /// Returns the specified SslCertificate resource.
15533 pub fn get(&self) -> super::builder::ssl_certificates::Get {
15534 super::builder::ssl_certificates::Get::new(self.inner.clone())
15535 }
15536
15537 /// Creates a SslCertificate resource in the specified project using the data
15538 /// included in the request.
15539 pub fn insert(&self) -> super::builder::ssl_certificates::Insert {
15540 super::builder::ssl_certificates::Insert::new(self.inner.clone())
15541 }
15542
15543 /// Retrieves the list of SslCertificate resources available to the specified
15544 /// project.
15545 pub fn list(&self) -> super::builder::ssl_certificates::List {
15546 super::builder::ssl_certificates::List::new(self.inner.clone())
15547 }
15548
15549 /// Retrieves the specified Operations resource.
15550 pub fn get_operation(&self) -> super::builder::ssl_certificates::GetOperation {
15551 super::builder::ssl_certificates::GetOperation::new(self.inner.clone())
15552 }
15553}
15554
15555/// Implements a client for the Google Compute Engine API.
15556///
15557/// # Example
15558/// ```
15559/// # tokio_test::block_on(async {
15560/// # use google_cloud_compute_v1::client::SslPolicies;
15561/// let client = SslPolicies::builder().build().await?;
15562/// // use `client` to make requests to the Google Compute Engine API.
15563/// # gax::client_builder::Result::<()>::Ok(()) });
15564/// ```
15565///
15566/// # Service Description
15567///
15568/// Service for the `sslPolicies` resource.
15569///
15570/// # Configuration
15571///
15572/// To configure `SslPolicies` use the `with_*` methods in the type returned
15573/// by [builder()][SslPolicies::builder]. The default configuration should
15574/// work for most applications. Common configuration changes include
15575///
15576/// * [with_endpoint()]: by default this client uses the global default endpoint
15577/// (`https://compute.googleapis.com`). Applications using regional
15578/// endpoints or running in restricted networks (e.g. a network configured
15579// with [Private Google Access with VPC Service Controls]) may want to
15580/// override this default.
15581/// * [with_credentials()]: by default this client uses
15582/// [Application Default Credentials]. Applications using custom
15583/// authentication may need to override this default.
15584///
15585/// [with_endpoint()]: super::builder::ssl_policies::ClientBuilder::with_endpoint
15586/// [with_credentials()]: super::builder::ssl_policies::ClientBuilder::credentials
15587/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15588/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15589///
15590/// # Pooling and Cloning
15591///
15592/// `SslPolicies` holds a connection pool internally, it is advised to
15593/// create one and the reuse it. You do not need to wrap `SslPolicies` in
15594/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15595/// already uses an `Arc` internally.
15596#[cfg(feature = "ssl-policies")]
15597#[cfg_attr(docsrs, doc(cfg(feature = "ssl-policies")))]
15598#[derive(Clone, Debug)]
15599pub struct SslPolicies {
15600 inner: std::sync::Arc<dyn super::stub::dynamic::SslPolicies>,
15601}
15602
15603#[cfg(feature = "ssl-policies")]
15604impl SslPolicies {
15605 /// Returns a builder for [SslPolicies].
15606 ///
15607 /// ```
15608 /// # tokio_test::block_on(async {
15609 /// # use google_cloud_compute_v1::client::SslPolicies;
15610 /// let client = SslPolicies::builder().build().await?;
15611 /// # gax::client_builder::Result::<()>::Ok(()) });
15612 /// ```
15613 pub fn builder() -> super::builder::ssl_policies::ClientBuilder {
15614 gax::client_builder::internal::new_builder(super::builder::ssl_policies::client::Factory)
15615 }
15616
15617 /// Creates a new client from the provided stub.
15618 ///
15619 /// The most common case for calling this function is in tests mocking the
15620 /// client's behavior.
15621 pub fn from_stub<T>(stub: T) -> Self
15622 where
15623 T: super::stub::SslPolicies + 'static,
15624 {
15625 Self {
15626 inner: std::sync::Arc::new(stub),
15627 }
15628 }
15629
15630 pub(crate) async fn new(
15631 config: gaxi::options::ClientConfig,
15632 ) -> gax::client_builder::Result<Self> {
15633 let inner = Self::build_inner(config).await?;
15634 Ok(Self { inner })
15635 }
15636
15637 async fn build_inner(
15638 conf: gaxi::options::ClientConfig,
15639 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SslPolicies>> {
15640 if gaxi::options::tracing_enabled(&conf) {
15641 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15642 }
15643 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15644 }
15645
15646 async fn build_transport(
15647 conf: gaxi::options::ClientConfig,
15648 ) -> gax::client_builder::Result<impl super::stub::SslPolicies> {
15649 super::transport::SslPolicies::new(conf).await
15650 }
15651
15652 async fn build_with_tracing(
15653 conf: gaxi::options::ClientConfig,
15654 ) -> gax::client_builder::Result<impl super::stub::SslPolicies> {
15655 Self::build_transport(conf)
15656 .await
15657 .map(super::tracing::SslPolicies::new)
15658 }
15659
15660 /// Retrieves the list of all SslPolicy resources, regional and global,
15661 /// available to the specified project.
15662 ///
15663 /// To prevent failure, Google recommends that you set the
15664 /// `returnPartialSuccess` parameter to `true`.
15665 pub fn aggregated_list(&self) -> super::builder::ssl_policies::AggregatedList {
15666 super::builder::ssl_policies::AggregatedList::new(self.inner.clone())
15667 }
15668
15669 /// Deletes the specified SSL policy. The SSL policy resource can be deleted
15670 /// only if it is not in use by any TargetHttpsProxy or TargetSslProxy
15671 /// resources.
15672 pub fn delete(&self) -> super::builder::ssl_policies::Delete {
15673 super::builder::ssl_policies::Delete::new(self.inner.clone())
15674 }
15675
15676 /// Lists all of the ordered rules present in a single specified policy.
15677 pub fn get(&self) -> super::builder::ssl_policies::Get {
15678 super::builder::ssl_policies::Get::new(self.inner.clone())
15679 }
15680
15681 /// Returns the specified SSL policy resource.
15682 pub fn insert(&self) -> super::builder::ssl_policies::Insert {
15683 super::builder::ssl_policies::Insert::new(self.inner.clone())
15684 }
15685
15686 /// Lists all the SSL policies that have been configured for the specified
15687 /// project.
15688 pub fn list(&self) -> super::builder::ssl_policies::List {
15689 super::builder::ssl_policies::List::new(self.inner.clone())
15690 }
15691
15692 /// Lists all features that can be specified in the SSL policy when using
15693 /// custom profile.
15694 pub fn list_available_features(&self) -> super::builder::ssl_policies::ListAvailableFeatures {
15695 super::builder::ssl_policies::ListAvailableFeatures::new(self.inner.clone())
15696 }
15697
15698 /// Patches the specified SSL policy with the data included in the request.
15699 pub fn patch(&self) -> super::builder::ssl_policies::Patch {
15700 super::builder::ssl_policies::Patch::new(self.inner.clone())
15701 }
15702
15703 /// Retrieves the specified Operations resource.
15704 pub fn get_operation(&self) -> super::builder::ssl_policies::GetOperation {
15705 super::builder::ssl_policies::GetOperation::new(self.inner.clone())
15706 }
15707}
15708
15709/// Implements a client for the Google Compute Engine API.
15710///
15711/// # Example
15712/// ```
15713/// # tokio_test::block_on(async {
15714/// # use google_cloud_compute_v1::client::StoragePoolTypes;
15715/// let client = StoragePoolTypes::builder().build().await?;
15716/// // use `client` to make requests to the Google Compute Engine API.
15717/// # gax::client_builder::Result::<()>::Ok(()) });
15718/// ```
15719///
15720/// # Service Description
15721///
15722/// Service for the `storagePoolTypes` resource.
15723///
15724/// # Configuration
15725///
15726/// To configure `StoragePoolTypes` use the `with_*` methods in the type returned
15727/// by [builder()][StoragePoolTypes::builder]. The default configuration should
15728/// work for most applications. Common configuration changes include
15729///
15730/// * [with_endpoint()]: by default this client uses the global default endpoint
15731/// (`https://compute.googleapis.com`). Applications using regional
15732/// endpoints or running in restricted networks (e.g. a network configured
15733// with [Private Google Access with VPC Service Controls]) may want to
15734/// override this default.
15735/// * [with_credentials()]: by default this client uses
15736/// [Application Default Credentials]. Applications using custom
15737/// authentication may need to override this default.
15738///
15739/// [with_endpoint()]: super::builder::storage_pool_types::ClientBuilder::with_endpoint
15740/// [with_credentials()]: super::builder::storage_pool_types::ClientBuilder::credentials
15741/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15742/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15743///
15744/// # Pooling and Cloning
15745///
15746/// `StoragePoolTypes` holds a connection pool internally, it is advised to
15747/// create one and the reuse it. You do not need to wrap `StoragePoolTypes` in
15748/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15749/// already uses an `Arc` internally.
15750#[cfg(feature = "storage-pool-types")]
15751#[cfg_attr(docsrs, doc(cfg(feature = "storage-pool-types")))]
15752#[derive(Clone, Debug)]
15753pub struct StoragePoolTypes {
15754 inner: std::sync::Arc<dyn super::stub::dynamic::StoragePoolTypes>,
15755}
15756
15757#[cfg(feature = "storage-pool-types")]
15758impl StoragePoolTypes {
15759 /// Returns a builder for [StoragePoolTypes].
15760 ///
15761 /// ```
15762 /// # tokio_test::block_on(async {
15763 /// # use google_cloud_compute_v1::client::StoragePoolTypes;
15764 /// let client = StoragePoolTypes::builder().build().await?;
15765 /// # gax::client_builder::Result::<()>::Ok(()) });
15766 /// ```
15767 pub fn builder() -> super::builder::storage_pool_types::ClientBuilder {
15768 gax::client_builder::internal::new_builder(
15769 super::builder::storage_pool_types::client::Factory,
15770 )
15771 }
15772
15773 /// Creates a new client from the provided stub.
15774 ///
15775 /// The most common case for calling this function is in tests mocking the
15776 /// client's behavior.
15777 pub fn from_stub<T>(stub: T) -> Self
15778 where
15779 T: super::stub::StoragePoolTypes + 'static,
15780 {
15781 Self {
15782 inner: std::sync::Arc::new(stub),
15783 }
15784 }
15785
15786 pub(crate) async fn new(
15787 config: gaxi::options::ClientConfig,
15788 ) -> gax::client_builder::Result<Self> {
15789 let inner = Self::build_inner(config).await?;
15790 Ok(Self { inner })
15791 }
15792
15793 async fn build_inner(
15794 conf: gaxi::options::ClientConfig,
15795 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::StoragePoolTypes>>
15796 {
15797 if gaxi::options::tracing_enabled(&conf) {
15798 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15799 }
15800 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15801 }
15802
15803 async fn build_transport(
15804 conf: gaxi::options::ClientConfig,
15805 ) -> gax::client_builder::Result<impl super::stub::StoragePoolTypes> {
15806 super::transport::StoragePoolTypes::new(conf).await
15807 }
15808
15809 async fn build_with_tracing(
15810 conf: gaxi::options::ClientConfig,
15811 ) -> gax::client_builder::Result<impl super::stub::StoragePoolTypes> {
15812 Self::build_transport(conf)
15813 .await
15814 .map(super::tracing::StoragePoolTypes::new)
15815 }
15816
15817 /// Retrieves an aggregated list of storage pool types.
15818 ///
15819 /// To prevent failure, Google recommends that you set the
15820 /// `returnPartialSuccess` parameter to `true`.
15821 pub fn aggregated_list(&self) -> super::builder::storage_pool_types::AggregatedList {
15822 super::builder::storage_pool_types::AggregatedList::new(self.inner.clone())
15823 }
15824
15825 /// Returns the specified storage pool type.
15826 pub fn get(&self) -> super::builder::storage_pool_types::Get {
15827 super::builder::storage_pool_types::Get::new(self.inner.clone())
15828 }
15829
15830 /// Retrieves a list of storage pool types available to the specified
15831 /// project.
15832 pub fn list(&self) -> super::builder::storage_pool_types::List {
15833 super::builder::storage_pool_types::List::new(self.inner.clone())
15834 }
15835}
15836
15837/// Implements a client for the Google Compute Engine API.
15838///
15839/// # Example
15840/// ```
15841/// # tokio_test::block_on(async {
15842/// # use google_cloud_compute_v1::client::StoragePools;
15843/// let client = StoragePools::builder().build().await?;
15844/// // use `client` to make requests to the Google Compute Engine API.
15845/// # gax::client_builder::Result::<()>::Ok(()) });
15846/// ```
15847///
15848/// # Service Description
15849///
15850/// Service for the `storagePools` resource.
15851///
15852/// # Configuration
15853///
15854/// To configure `StoragePools` use the `with_*` methods in the type returned
15855/// by [builder()][StoragePools::builder]. The default configuration should
15856/// work for most applications. Common configuration changes include
15857///
15858/// * [with_endpoint()]: by default this client uses the global default endpoint
15859/// (`https://compute.googleapis.com`). Applications using regional
15860/// endpoints or running in restricted networks (e.g. a network configured
15861// with [Private Google Access with VPC Service Controls]) may want to
15862/// override this default.
15863/// * [with_credentials()]: by default this client uses
15864/// [Application Default Credentials]. Applications using custom
15865/// authentication may need to override this default.
15866///
15867/// [with_endpoint()]: super::builder::storage_pools::ClientBuilder::with_endpoint
15868/// [with_credentials()]: super::builder::storage_pools::ClientBuilder::credentials
15869/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
15870/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
15871///
15872/// # Pooling and Cloning
15873///
15874/// `StoragePools` holds a connection pool internally, it is advised to
15875/// create one and the reuse it. You do not need to wrap `StoragePools` in
15876/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
15877/// already uses an `Arc` internally.
15878#[cfg(feature = "storage-pools")]
15879#[cfg_attr(docsrs, doc(cfg(feature = "storage-pools")))]
15880#[derive(Clone, Debug)]
15881pub struct StoragePools {
15882 inner: std::sync::Arc<dyn super::stub::dynamic::StoragePools>,
15883}
15884
15885#[cfg(feature = "storage-pools")]
15886impl StoragePools {
15887 /// Returns a builder for [StoragePools].
15888 ///
15889 /// ```
15890 /// # tokio_test::block_on(async {
15891 /// # use google_cloud_compute_v1::client::StoragePools;
15892 /// let client = StoragePools::builder().build().await?;
15893 /// # gax::client_builder::Result::<()>::Ok(()) });
15894 /// ```
15895 pub fn builder() -> super::builder::storage_pools::ClientBuilder {
15896 gax::client_builder::internal::new_builder(super::builder::storage_pools::client::Factory)
15897 }
15898
15899 /// Creates a new client from the provided stub.
15900 ///
15901 /// The most common case for calling this function is in tests mocking the
15902 /// client's behavior.
15903 pub fn from_stub<T>(stub: T) -> Self
15904 where
15905 T: super::stub::StoragePools + 'static,
15906 {
15907 Self {
15908 inner: std::sync::Arc::new(stub),
15909 }
15910 }
15911
15912 pub(crate) async fn new(
15913 config: gaxi::options::ClientConfig,
15914 ) -> gax::client_builder::Result<Self> {
15915 let inner = Self::build_inner(config).await?;
15916 Ok(Self { inner })
15917 }
15918
15919 async fn build_inner(
15920 conf: gaxi::options::ClientConfig,
15921 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::StoragePools>> {
15922 if gaxi::options::tracing_enabled(&conf) {
15923 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
15924 }
15925 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
15926 }
15927
15928 async fn build_transport(
15929 conf: gaxi::options::ClientConfig,
15930 ) -> gax::client_builder::Result<impl super::stub::StoragePools> {
15931 super::transport::StoragePools::new(conf).await
15932 }
15933
15934 async fn build_with_tracing(
15935 conf: gaxi::options::ClientConfig,
15936 ) -> gax::client_builder::Result<impl super::stub::StoragePools> {
15937 Self::build_transport(conf)
15938 .await
15939 .map(super::tracing::StoragePools::new)
15940 }
15941
15942 /// Retrieves an aggregated list of storage pools.
15943 ///
15944 /// To prevent failure, Google recommends that you set the
15945 /// `returnPartialSuccess` parameter to `true`.
15946 pub fn aggregated_list(&self) -> super::builder::storage_pools::AggregatedList {
15947 super::builder::storage_pools::AggregatedList::new(self.inner.clone())
15948 }
15949
15950 /// Deletes the specified storage pool. Deleting a storagePool
15951 /// removes its data permanently and is irreversible. However, deleting a
15952 /// storagePool does not delete any snapshots previously
15953 /// made from the storagePool. You must separately delete
15954 /// snapshots.
15955 pub fn delete(&self) -> super::builder::storage_pools::Delete {
15956 super::builder::storage_pools::Delete::new(self.inner.clone())
15957 }
15958
15959 /// Returns a specified storage pool. Gets a list of available
15960 /// storage pools by making a list() request.
15961 pub fn get(&self) -> super::builder::storage_pools::Get {
15962 super::builder::storage_pools::Get::new(self.inner.clone())
15963 }
15964
15965 /// Gets the access control policy for a resource. May be empty if no such
15966 /// policy or resource exists.
15967 pub fn get_iam_policy(&self) -> super::builder::storage_pools::GetIamPolicy {
15968 super::builder::storage_pools::GetIamPolicy::new(self.inner.clone())
15969 }
15970
15971 /// Creates a storage pool in the specified project using the data
15972 /// in the request.
15973 pub fn insert(&self) -> super::builder::storage_pools::Insert {
15974 super::builder::storage_pools::Insert::new(self.inner.clone())
15975 }
15976
15977 /// Retrieves a list of storage pools contained within
15978 /// the specified zone.
15979 pub fn list(&self) -> super::builder::storage_pools::List {
15980 super::builder::storage_pools::List::new(self.inner.clone())
15981 }
15982
15983 /// Lists the disks in a specified storage pool.
15984 pub fn list_disks(&self) -> super::builder::storage_pools::ListDisks {
15985 super::builder::storage_pools::ListDisks::new(self.inner.clone())
15986 }
15987
15988 /// Sets the access control policy on the specified resource.
15989 /// Replaces any existing policy.
15990 pub fn set_iam_policy(&self) -> super::builder::storage_pools::SetIamPolicy {
15991 super::builder::storage_pools::SetIamPolicy::new(self.inner.clone())
15992 }
15993
15994 /// Returns permissions that a caller has on the specified resource.
15995 pub fn test_iam_permissions(&self) -> super::builder::storage_pools::TestIamPermissions {
15996 super::builder::storage_pools::TestIamPermissions::new(self.inner.clone())
15997 }
15998
15999 /// Updates the specified storagePool with the data included in the request.
16000 /// The update is performed only on selected fields included as part
16001 /// of update-mask. Only the following fields can be modified:
16002 /// pool_provisioned_capacity_gb, pool_provisioned_iops and
16003 /// pool_provisioned_throughput.
16004 pub fn update(&self) -> super::builder::storage_pools::Update {
16005 super::builder::storage_pools::Update::new(self.inner.clone())
16006 }
16007
16008 /// Retrieves the specified zone-specific Operations resource.
16009 pub fn get_operation(&self) -> super::builder::storage_pools::GetOperation {
16010 super::builder::storage_pools::GetOperation::new(self.inner.clone())
16011 }
16012}
16013
16014/// Implements a client for the Google Compute Engine API.
16015///
16016/// # Example
16017/// ```
16018/// # tokio_test::block_on(async {
16019/// # use google_cloud_compute_v1::client::Subnetworks;
16020/// let client = Subnetworks::builder().build().await?;
16021/// // use `client` to make requests to the Google Compute Engine API.
16022/// # gax::client_builder::Result::<()>::Ok(()) });
16023/// ```
16024///
16025/// # Service Description
16026///
16027/// Service for the `subnetworks` resource.
16028///
16029/// # Configuration
16030///
16031/// To configure `Subnetworks` use the `with_*` methods in the type returned
16032/// by [builder()][Subnetworks::builder]. The default configuration should
16033/// work for most applications. Common configuration changes include
16034///
16035/// * [with_endpoint()]: by default this client uses the global default endpoint
16036/// (`https://compute.googleapis.com`). Applications using regional
16037/// endpoints or running in restricted networks (e.g. a network configured
16038// with [Private Google Access with VPC Service Controls]) may want to
16039/// override this default.
16040/// * [with_credentials()]: by default this client uses
16041/// [Application Default Credentials]. Applications using custom
16042/// authentication may need to override this default.
16043///
16044/// [with_endpoint()]: super::builder::subnetworks::ClientBuilder::with_endpoint
16045/// [with_credentials()]: super::builder::subnetworks::ClientBuilder::credentials
16046/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16047/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16048///
16049/// # Pooling and Cloning
16050///
16051/// `Subnetworks` holds a connection pool internally, it is advised to
16052/// create one and the reuse it. You do not need to wrap `Subnetworks` in
16053/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16054/// already uses an `Arc` internally.
16055#[cfg(feature = "subnetworks")]
16056#[cfg_attr(docsrs, doc(cfg(feature = "subnetworks")))]
16057#[derive(Clone, Debug)]
16058pub struct Subnetworks {
16059 inner: std::sync::Arc<dyn super::stub::dynamic::Subnetworks>,
16060}
16061
16062#[cfg(feature = "subnetworks")]
16063impl Subnetworks {
16064 /// Returns a builder for [Subnetworks].
16065 ///
16066 /// ```
16067 /// # tokio_test::block_on(async {
16068 /// # use google_cloud_compute_v1::client::Subnetworks;
16069 /// let client = Subnetworks::builder().build().await?;
16070 /// # gax::client_builder::Result::<()>::Ok(()) });
16071 /// ```
16072 pub fn builder() -> super::builder::subnetworks::ClientBuilder {
16073 gax::client_builder::internal::new_builder(super::builder::subnetworks::client::Factory)
16074 }
16075
16076 /// Creates a new client from the provided stub.
16077 ///
16078 /// The most common case for calling this function is in tests mocking the
16079 /// client's behavior.
16080 pub fn from_stub<T>(stub: T) -> Self
16081 where
16082 T: super::stub::Subnetworks + 'static,
16083 {
16084 Self {
16085 inner: std::sync::Arc::new(stub),
16086 }
16087 }
16088
16089 pub(crate) async fn new(
16090 config: gaxi::options::ClientConfig,
16091 ) -> gax::client_builder::Result<Self> {
16092 let inner = Self::build_inner(config).await?;
16093 Ok(Self { inner })
16094 }
16095
16096 async fn build_inner(
16097 conf: gaxi::options::ClientConfig,
16098 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Subnetworks>> {
16099 if gaxi::options::tracing_enabled(&conf) {
16100 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16101 }
16102 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16103 }
16104
16105 async fn build_transport(
16106 conf: gaxi::options::ClientConfig,
16107 ) -> gax::client_builder::Result<impl super::stub::Subnetworks> {
16108 super::transport::Subnetworks::new(conf).await
16109 }
16110
16111 async fn build_with_tracing(
16112 conf: gaxi::options::ClientConfig,
16113 ) -> gax::client_builder::Result<impl super::stub::Subnetworks> {
16114 Self::build_transport(conf)
16115 .await
16116 .map(super::tracing::Subnetworks::new)
16117 }
16118
16119 /// Retrieves an aggregated list of subnetworks.
16120 ///
16121 /// To prevent failure, Google recommends that you set the
16122 /// `returnPartialSuccess` parameter to `true`.
16123 pub fn aggregated_list(&self) -> super::builder::subnetworks::AggregatedList {
16124 super::builder::subnetworks::AggregatedList::new(self.inner.clone())
16125 }
16126
16127 /// Deletes the specified subnetwork.
16128 pub fn delete(&self) -> super::builder::subnetworks::Delete {
16129 super::builder::subnetworks::Delete::new(self.inner.clone())
16130 }
16131
16132 /// Expands the IP CIDR range of the subnetwork to a specified value.
16133 pub fn expand_ip_cidr_range(&self) -> super::builder::subnetworks::ExpandIpCidrRange {
16134 super::builder::subnetworks::ExpandIpCidrRange::new(self.inner.clone())
16135 }
16136
16137 /// Returns the specified subnetwork.
16138 pub fn get(&self) -> super::builder::subnetworks::Get {
16139 super::builder::subnetworks::Get::new(self.inner.clone())
16140 }
16141
16142 /// Gets the access control policy for a resource. May be empty if no such
16143 /// policy or resource exists.
16144 pub fn get_iam_policy(&self) -> super::builder::subnetworks::GetIamPolicy {
16145 super::builder::subnetworks::GetIamPolicy::new(self.inner.clone())
16146 }
16147
16148 /// Creates a subnetwork in the specified project using the data
16149 /// included in the request.
16150 pub fn insert(&self) -> super::builder::subnetworks::Insert {
16151 super::builder::subnetworks::Insert::new(self.inner.clone())
16152 }
16153
16154 /// Retrieves a list of subnetworks available to the specified
16155 /// project.
16156 pub fn list(&self) -> super::builder::subnetworks::List {
16157 super::builder::subnetworks::List::new(self.inner.clone())
16158 }
16159
16160 /// Retrieves an aggregated list of all usable subnetworks in the project.
16161 pub fn list_usable(&self) -> super::builder::subnetworks::ListUsable {
16162 super::builder::subnetworks::ListUsable::new(self.inner.clone())
16163 }
16164
16165 /// Patches the specified subnetwork with the data included in the request.
16166 /// Only certain fields can be updated with a patch request
16167 /// as indicated in the field descriptions.
16168 /// You must specify the current fingerprint of the
16169 /// subnetwork resource being patched.
16170 pub fn patch(&self) -> super::builder::subnetworks::Patch {
16171 super::builder::subnetworks::Patch::new(self.inner.clone())
16172 }
16173
16174 /// Sets the access control policy on the specified resource.
16175 /// Replaces any existing policy.
16176 pub fn set_iam_policy(&self) -> super::builder::subnetworks::SetIamPolicy {
16177 super::builder::subnetworks::SetIamPolicy::new(self.inner.clone())
16178 }
16179
16180 /// Set whether VMs in this subnet can access Google services without assigning
16181 /// external IP addresses through Private Google Access.
16182 pub fn set_private_ip_google_access(
16183 &self,
16184 ) -> super::builder::subnetworks::SetPrivateIpGoogleAccess {
16185 super::builder::subnetworks::SetPrivateIpGoogleAccess::new(self.inner.clone())
16186 }
16187
16188 /// Returns permissions that a caller has on the specified resource.
16189 pub fn test_iam_permissions(&self) -> super::builder::subnetworks::TestIamPermissions {
16190 super::builder::subnetworks::TestIamPermissions::new(self.inner.clone())
16191 }
16192
16193 /// Retrieves the specified region-specific Operations resource.
16194 pub fn get_operation(&self) -> super::builder::subnetworks::GetOperation {
16195 super::builder::subnetworks::GetOperation::new(self.inner.clone())
16196 }
16197}
16198
16199/// Implements a client for the Google Compute Engine API.
16200///
16201/// # Example
16202/// ```
16203/// # tokio_test::block_on(async {
16204/// # use google_cloud_compute_v1::client::TargetGrpcProxies;
16205/// let client = TargetGrpcProxies::builder().build().await?;
16206/// // use `client` to make requests to the Google Compute Engine API.
16207/// # gax::client_builder::Result::<()>::Ok(()) });
16208/// ```
16209///
16210/// # Service Description
16211///
16212/// Service for the `targetGrpcProxies` resource.
16213///
16214/// # Configuration
16215///
16216/// To configure `TargetGrpcProxies` use the `with_*` methods in the type returned
16217/// by [builder()][TargetGrpcProxies::builder]. The default configuration should
16218/// work for most applications. Common configuration changes include
16219///
16220/// * [with_endpoint()]: by default this client uses the global default endpoint
16221/// (`https://compute.googleapis.com`). Applications using regional
16222/// endpoints or running in restricted networks (e.g. a network configured
16223// with [Private Google Access with VPC Service Controls]) may want to
16224/// override this default.
16225/// * [with_credentials()]: by default this client uses
16226/// [Application Default Credentials]. Applications using custom
16227/// authentication may need to override this default.
16228///
16229/// [with_endpoint()]: super::builder::target_grpc_proxies::ClientBuilder::with_endpoint
16230/// [with_credentials()]: super::builder::target_grpc_proxies::ClientBuilder::credentials
16231/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16232/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16233///
16234/// # Pooling and Cloning
16235///
16236/// `TargetGrpcProxies` holds a connection pool internally, it is advised to
16237/// create one and the reuse it. You do not need to wrap `TargetGrpcProxies` in
16238/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16239/// already uses an `Arc` internally.
16240#[cfg(feature = "target-grpc-proxies")]
16241#[cfg_attr(docsrs, doc(cfg(feature = "target-grpc-proxies")))]
16242#[derive(Clone, Debug)]
16243pub struct TargetGrpcProxies {
16244 inner: std::sync::Arc<dyn super::stub::dynamic::TargetGrpcProxies>,
16245}
16246
16247#[cfg(feature = "target-grpc-proxies")]
16248impl TargetGrpcProxies {
16249 /// Returns a builder for [TargetGrpcProxies].
16250 ///
16251 /// ```
16252 /// # tokio_test::block_on(async {
16253 /// # use google_cloud_compute_v1::client::TargetGrpcProxies;
16254 /// let client = TargetGrpcProxies::builder().build().await?;
16255 /// # gax::client_builder::Result::<()>::Ok(()) });
16256 /// ```
16257 pub fn builder() -> super::builder::target_grpc_proxies::ClientBuilder {
16258 gax::client_builder::internal::new_builder(
16259 super::builder::target_grpc_proxies::client::Factory,
16260 )
16261 }
16262
16263 /// Creates a new client from the provided stub.
16264 ///
16265 /// The most common case for calling this function is in tests mocking the
16266 /// client's behavior.
16267 pub fn from_stub<T>(stub: T) -> Self
16268 where
16269 T: super::stub::TargetGrpcProxies + 'static,
16270 {
16271 Self {
16272 inner: std::sync::Arc::new(stub),
16273 }
16274 }
16275
16276 pub(crate) async fn new(
16277 config: gaxi::options::ClientConfig,
16278 ) -> gax::client_builder::Result<Self> {
16279 let inner = Self::build_inner(config).await?;
16280 Ok(Self { inner })
16281 }
16282
16283 async fn build_inner(
16284 conf: gaxi::options::ClientConfig,
16285 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetGrpcProxies>>
16286 {
16287 if gaxi::options::tracing_enabled(&conf) {
16288 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16289 }
16290 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16291 }
16292
16293 async fn build_transport(
16294 conf: gaxi::options::ClientConfig,
16295 ) -> gax::client_builder::Result<impl super::stub::TargetGrpcProxies> {
16296 super::transport::TargetGrpcProxies::new(conf).await
16297 }
16298
16299 async fn build_with_tracing(
16300 conf: gaxi::options::ClientConfig,
16301 ) -> gax::client_builder::Result<impl super::stub::TargetGrpcProxies> {
16302 Self::build_transport(conf)
16303 .await
16304 .map(super::tracing::TargetGrpcProxies::new)
16305 }
16306
16307 /// Deletes the specified TargetGrpcProxy in the given scope
16308 pub fn delete(&self) -> super::builder::target_grpc_proxies::Delete {
16309 super::builder::target_grpc_proxies::Delete::new(self.inner.clone())
16310 }
16311
16312 /// Returns the specified TargetGrpcProxy resource in the given scope.
16313 pub fn get(&self) -> super::builder::target_grpc_proxies::Get {
16314 super::builder::target_grpc_proxies::Get::new(self.inner.clone())
16315 }
16316
16317 /// Creates a TargetGrpcProxy in the specified project in the given scope
16318 /// using the parameters that are included in the request.
16319 pub fn insert(&self) -> super::builder::target_grpc_proxies::Insert {
16320 super::builder::target_grpc_proxies::Insert::new(self.inner.clone())
16321 }
16322
16323 /// Lists the TargetGrpcProxies for a project in the given scope.
16324 pub fn list(&self) -> super::builder::target_grpc_proxies::List {
16325 super::builder::target_grpc_proxies::List::new(self.inner.clone())
16326 }
16327
16328 /// Patches the specified TargetGrpcProxy resource with the data included in
16329 /// the request. This method supports PATCH
16330 /// semantics and usesJSON merge
16331 /// patch format and processing rules.
16332 pub fn patch(&self) -> super::builder::target_grpc_proxies::Patch {
16333 super::builder::target_grpc_proxies::Patch::new(self.inner.clone())
16334 }
16335
16336 /// Retrieves the specified Operations resource.
16337 pub fn get_operation(&self) -> super::builder::target_grpc_proxies::GetOperation {
16338 super::builder::target_grpc_proxies::GetOperation::new(self.inner.clone())
16339 }
16340}
16341
16342/// Implements a client for the Google Compute Engine API.
16343///
16344/// # Example
16345/// ```
16346/// # tokio_test::block_on(async {
16347/// # use google_cloud_compute_v1::client::TargetHttpProxies;
16348/// let client = TargetHttpProxies::builder().build().await?;
16349/// // use `client` to make requests to the Google Compute Engine API.
16350/// # gax::client_builder::Result::<()>::Ok(()) });
16351/// ```
16352///
16353/// # Service Description
16354///
16355/// Service for the `targetHttpProxies` resource.
16356///
16357/// # Configuration
16358///
16359/// To configure `TargetHttpProxies` use the `with_*` methods in the type returned
16360/// by [builder()][TargetHttpProxies::builder]. The default configuration should
16361/// work for most applications. Common configuration changes include
16362///
16363/// * [with_endpoint()]: by default this client uses the global default endpoint
16364/// (`https://compute.googleapis.com`). Applications using regional
16365/// endpoints or running in restricted networks (e.g. a network configured
16366// with [Private Google Access with VPC Service Controls]) may want to
16367/// override this default.
16368/// * [with_credentials()]: by default this client uses
16369/// [Application Default Credentials]. Applications using custom
16370/// authentication may need to override this default.
16371///
16372/// [with_endpoint()]: super::builder::target_http_proxies::ClientBuilder::with_endpoint
16373/// [with_credentials()]: super::builder::target_http_proxies::ClientBuilder::credentials
16374/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16375/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16376///
16377/// # Pooling and Cloning
16378///
16379/// `TargetHttpProxies` holds a connection pool internally, it is advised to
16380/// create one and the reuse it. You do not need to wrap `TargetHttpProxies` in
16381/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16382/// already uses an `Arc` internally.
16383#[cfg(feature = "target-http-proxies")]
16384#[cfg_attr(docsrs, doc(cfg(feature = "target-http-proxies")))]
16385#[derive(Clone, Debug)]
16386pub struct TargetHttpProxies {
16387 inner: std::sync::Arc<dyn super::stub::dynamic::TargetHttpProxies>,
16388}
16389
16390#[cfg(feature = "target-http-proxies")]
16391impl TargetHttpProxies {
16392 /// Returns a builder for [TargetHttpProxies].
16393 ///
16394 /// ```
16395 /// # tokio_test::block_on(async {
16396 /// # use google_cloud_compute_v1::client::TargetHttpProxies;
16397 /// let client = TargetHttpProxies::builder().build().await?;
16398 /// # gax::client_builder::Result::<()>::Ok(()) });
16399 /// ```
16400 pub fn builder() -> super::builder::target_http_proxies::ClientBuilder {
16401 gax::client_builder::internal::new_builder(
16402 super::builder::target_http_proxies::client::Factory,
16403 )
16404 }
16405
16406 /// Creates a new client from the provided stub.
16407 ///
16408 /// The most common case for calling this function is in tests mocking the
16409 /// client's behavior.
16410 pub fn from_stub<T>(stub: T) -> Self
16411 where
16412 T: super::stub::TargetHttpProxies + 'static,
16413 {
16414 Self {
16415 inner: std::sync::Arc::new(stub),
16416 }
16417 }
16418
16419 pub(crate) async fn new(
16420 config: gaxi::options::ClientConfig,
16421 ) -> gax::client_builder::Result<Self> {
16422 let inner = Self::build_inner(config).await?;
16423 Ok(Self { inner })
16424 }
16425
16426 async fn build_inner(
16427 conf: gaxi::options::ClientConfig,
16428 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetHttpProxies>>
16429 {
16430 if gaxi::options::tracing_enabled(&conf) {
16431 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16432 }
16433 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16434 }
16435
16436 async fn build_transport(
16437 conf: gaxi::options::ClientConfig,
16438 ) -> gax::client_builder::Result<impl super::stub::TargetHttpProxies> {
16439 super::transport::TargetHttpProxies::new(conf).await
16440 }
16441
16442 async fn build_with_tracing(
16443 conf: gaxi::options::ClientConfig,
16444 ) -> gax::client_builder::Result<impl super::stub::TargetHttpProxies> {
16445 Self::build_transport(conf)
16446 .await
16447 .map(super::tracing::TargetHttpProxies::new)
16448 }
16449
16450 /// Retrieves the list of all TargetHttpProxy resources, regional and global,
16451 /// available to the specified project.
16452 ///
16453 /// To prevent failure, Google recommends that you set the
16454 /// `returnPartialSuccess` parameter to `true`.
16455 pub fn aggregated_list(&self) -> super::builder::target_http_proxies::AggregatedList {
16456 super::builder::target_http_proxies::AggregatedList::new(self.inner.clone())
16457 }
16458
16459 /// Deletes the specified TargetHttpProxy resource.
16460 pub fn delete(&self) -> super::builder::target_http_proxies::Delete {
16461 super::builder::target_http_proxies::Delete::new(self.inner.clone())
16462 }
16463
16464 /// Returns the specified TargetHttpProxy resource.
16465 pub fn get(&self) -> super::builder::target_http_proxies::Get {
16466 super::builder::target_http_proxies::Get::new(self.inner.clone())
16467 }
16468
16469 /// Creates a TargetHttpProxy resource in the specified
16470 /// project using the data included in the request.
16471 pub fn insert(&self) -> super::builder::target_http_proxies::Insert {
16472 super::builder::target_http_proxies::Insert::new(self.inner.clone())
16473 }
16474
16475 /// Retrieves the list of TargetHttpProxy resources available
16476 /// to the specified project.
16477 pub fn list(&self) -> super::builder::target_http_proxies::List {
16478 super::builder::target_http_proxies::List::new(self.inner.clone())
16479 }
16480
16481 /// Patches the specified TargetHttpProxy resource with the data included in
16482 /// the request. This method supports PATCH
16483 /// semantics and usesJSON merge
16484 /// patch format and processing rules.
16485 pub fn patch(&self) -> super::builder::target_http_proxies::Patch {
16486 super::builder::target_http_proxies::Patch::new(self.inner.clone())
16487 }
16488
16489 /// Changes the URL map for TargetHttpProxy.
16490 pub fn set_url_map(&self) -> super::builder::target_http_proxies::SetUrlMap {
16491 super::builder::target_http_proxies::SetUrlMap::new(self.inner.clone())
16492 }
16493
16494 /// Retrieves the specified Operations resource.
16495 pub fn get_operation(&self) -> super::builder::target_http_proxies::GetOperation {
16496 super::builder::target_http_proxies::GetOperation::new(self.inner.clone())
16497 }
16498}
16499
16500/// Implements a client for the Google Compute Engine API.
16501///
16502/// # Example
16503/// ```
16504/// # tokio_test::block_on(async {
16505/// # use google_cloud_compute_v1::client::TargetHttpsProxies;
16506/// let client = TargetHttpsProxies::builder().build().await?;
16507/// // use `client` to make requests to the Google Compute Engine API.
16508/// # gax::client_builder::Result::<()>::Ok(()) });
16509/// ```
16510///
16511/// # Service Description
16512///
16513/// Service for the `targetHttpsProxies` resource.
16514///
16515/// # Configuration
16516///
16517/// To configure `TargetHttpsProxies` use the `with_*` methods in the type returned
16518/// by [builder()][TargetHttpsProxies::builder]. The default configuration should
16519/// work for most applications. Common configuration changes include
16520///
16521/// * [with_endpoint()]: by default this client uses the global default endpoint
16522/// (`https://compute.googleapis.com`). Applications using regional
16523/// endpoints or running in restricted networks (e.g. a network configured
16524// with [Private Google Access with VPC Service Controls]) may want to
16525/// override this default.
16526/// * [with_credentials()]: by default this client uses
16527/// [Application Default Credentials]. Applications using custom
16528/// authentication may need to override this default.
16529///
16530/// [with_endpoint()]: super::builder::target_https_proxies::ClientBuilder::with_endpoint
16531/// [with_credentials()]: super::builder::target_https_proxies::ClientBuilder::credentials
16532/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16533/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16534///
16535/// # Pooling and Cloning
16536///
16537/// `TargetHttpsProxies` holds a connection pool internally, it is advised to
16538/// create one and the reuse it. You do not need to wrap `TargetHttpsProxies` in
16539/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16540/// already uses an `Arc` internally.
16541#[cfg(feature = "target-https-proxies")]
16542#[cfg_attr(docsrs, doc(cfg(feature = "target-https-proxies")))]
16543#[derive(Clone, Debug)]
16544pub struct TargetHttpsProxies {
16545 inner: std::sync::Arc<dyn super::stub::dynamic::TargetHttpsProxies>,
16546}
16547
16548#[cfg(feature = "target-https-proxies")]
16549impl TargetHttpsProxies {
16550 /// Returns a builder for [TargetHttpsProxies].
16551 ///
16552 /// ```
16553 /// # tokio_test::block_on(async {
16554 /// # use google_cloud_compute_v1::client::TargetHttpsProxies;
16555 /// let client = TargetHttpsProxies::builder().build().await?;
16556 /// # gax::client_builder::Result::<()>::Ok(()) });
16557 /// ```
16558 pub fn builder() -> super::builder::target_https_proxies::ClientBuilder {
16559 gax::client_builder::internal::new_builder(
16560 super::builder::target_https_proxies::client::Factory,
16561 )
16562 }
16563
16564 /// Creates a new client from the provided stub.
16565 ///
16566 /// The most common case for calling this function is in tests mocking the
16567 /// client's behavior.
16568 pub fn from_stub<T>(stub: T) -> Self
16569 where
16570 T: super::stub::TargetHttpsProxies + 'static,
16571 {
16572 Self {
16573 inner: std::sync::Arc::new(stub),
16574 }
16575 }
16576
16577 pub(crate) async fn new(
16578 config: gaxi::options::ClientConfig,
16579 ) -> gax::client_builder::Result<Self> {
16580 let inner = Self::build_inner(config).await?;
16581 Ok(Self { inner })
16582 }
16583
16584 async fn build_inner(
16585 conf: gaxi::options::ClientConfig,
16586 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetHttpsProxies>>
16587 {
16588 if gaxi::options::tracing_enabled(&conf) {
16589 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16590 }
16591 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16592 }
16593
16594 async fn build_transport(
16595 conf: gaxi::options::ClientConfig,
16596 ) -> gax::client_builder::Result<impl super::stub::TargetHttpsProxies> {
16597 super::transport::TargetHttpsProxies::new(conf).await
16598 }
16599
16600 async fn build_with_tracing(
16601 conf: gaxi::options::ClientConfig,
16602 ) -> gax::client_builder::Result<impl super::stub::TargetHttpsProxies> {
16603 Self::build_transport(conf)
16604 .await
16605 .map(super::tracing::TargetHttpsProxies::new)
16606 }
16607
16608 /// Retrieves the list of all TargetHttpsProxy resources, regional and global,
16609 /// available to the specified project.
16610 ///
16611 /// To prevent failure, Google recommends that you set the
16612 /// `returnPartialSuccess` parameter to `true`.
16613 pub fn aggregated_list(&self) -> super::builder::target_https_proxies::AggregatedList {
16614 super::builder::target_https_proxies::AggregatedList::new(self.inner.clone())
16615 }
16616
16617 /// Deletes the specified TargetHttpsProxy resource.
16618 pub fn delete(&self) -> super::builder::target_https_proxies::Delete {
16619 super::builder::target_https_proxies::Delete::new(self.inner.clone())
16620 }
16621
16622 /// Returns the specified TargetHttpsProxy resource.
16623 pub fn get(&self) -> super::builder::target_https_proxies::Get {
16624 super::builder::target_https_proxies::Get::new(self.inner.clone())
16625 }
16626
16627 /// Creates a TargetHttpsProxy resource in the specified
16628 /// project using the data included in the request.
16629 pub fn insert(&self) -> super::builder::target_https_proxies::Insert {
16630 super::builder::target_https_proxies::Insert::new(self.inner.clone())
16631 }
16632
16633 /// Retrieves the list of TargetHttpsProxy resources
16634 /// available to the specified project.
16635 pub fn list(&self) -> super::builder::target_https_proxies::List {
16636 super::builder::target_https_proxies::List::new(self.inner.clone())
16637 }
16638
16639 /// Patches the specified TargetHttpsProxy resource with the data included in
16640 /// the request. This method supports PATCH
16641 /// semantics and usesJSON merge
16642 /// patch format and processing rules.
16643 pub fn patch(&self) -> super::builder::target_https_proxies::Patch {
16644 super::builder::target_https_proxies::Patch::new(self.inner.clone())
16645 }
16646
16647 /// Changes the Certificate Map for TargetHttpsProxy.
16648 pub fn set_certificate_map(&self) -> super::builder::target_https_proxies::SetCertificateMap {
16649 super::builder::target_https_proxies::SetCertificateMap::new(self.inner.clone())
16650 }
16651
16652 /// Sets the QUIC override policy for TargetHttpsProxy.
16653 pub fn set_quic_override(&self) -> super::builder::target_https_proxies::SetQuicOverride {
16654 super::builder::target_https_proxies::SetQuicOverride::new(self.inner.clone())
16655 }
16656
16657 /// Replaces SslCertificates for TargetHttpsProxy.
16658 pub fn set_ssl_certificates(&self) -> super::builder::target_https_proxies::SetSslCertificates {
16659 super::builder::target_https_proxies::SetSslCertificates::new(self.inner.clone())
16660 }
16661
16662 /// Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the
16663 /// server-side support for SSL features. This affects connections between
16664 /// clients and the HTTPS proxy load balancer. They do not affect the
16665 /// connection between the load balancer and the backends.
16666 pub fn set_ssl_policy(&self) -> super::builder::target_https_proxies::SetSslPolicy {
16667 super::builder::target_https_proxies::SetSslPolicy::new(self.inner.clone())
16668 }
16669
16670 /// Changes the URL map for TargetHttpsProxy.
16671 pub fn set_url_map(&self) -> super::builder::target_https_proxies::SetUrlMap {
16672 super::builder::target_https_proxies::SetUrlMap::new(self.inner.clone())
16673 }
16674
16675 /// Retrieves the specified Operations resource.
16676 pub fn get_operation(&self) -> super::builder::target_https_proxies::GetOperation {
16677 super::builder::target_https_proxies::GetOperation::new(self.inner.clone())
16678 }
16679}
16680
16681/// Implements a client for the Google Compute Engine API.
16682///
16683/// # Example
16684/// ```
16685/// # tokio_test::block_on(async {
16686/// # use google_cloud_compute_v1::client::TargetInstances;
16687/// let client = TargetInstances::builder().build().await?;
16688/// // use `client` to make requests to the Google Compute Engine API.
16689/// # gax::client_builder::Result::<()>::Ok(()) });
16690/// ```
16691///
16692/// # Service Description
16693///
16694/// Service for the `targetInstances` resource.
16695///
16696/// # Configuration
16697///
16698/// To configure `TargetInstances` use the `with_*` methods in the type returned
16699/// by [builder()][TargetInstances::builder]. The default configuration should
16700/// work for most applications. Common configuration changes include
16701///
16702/// * [with_endpoint()]: by default this client uses the global default endpoint
16703/// (`https://compute.googleapis.com`). Applications using regional
16704/// endpoints or running in restricted networks (e.g. a network configured
16705// with [Private Google Access with VPC Service Controls]) may want to
16706/// override this default.
16707/// * [with_credentials()]: by default this client uses
16708/// [Application Default Credentials]. Applications using custom
16709/// authentication may need to override this default.
16710///
16711/// [with_endpoint()]: super::builder::target_instances::ClientBuilder::with_endpoint
16712/// [with_credentials()]: super::builder::target_instances::ClientBuilder::credentials
16713/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16714/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16715///
16716/// # Pooling and Cloning
16717///
16718/// `TargetInstances` holds a connection pool internally, it is advised to
16719/// create one and the reuse it. You do not need to wrap `TargetInstances` in
16720/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16721/// already uses an `Arc` internally.
16722#[cfg(feature = "target-instances")]
16723#[cfg_attr(docsrs, doc(cfg(feature = "target-instances")))]
16724#[derive(Clone, Debug)]
16725pub struct TargetInstances {
16726 inner: std::sync::Arc<dyn super::stub::dynamic::TargetInstances>,
16727}
16728
16729#[cfg(feature = "target-instances")]
16730impl TargetInstances {
16731 /// Returns a builder for [TargetInstances].
16732 ///
16733 /// ```
16734 /// # tokio_test::block_on(async {
16735 /// # use google_cloud_compute_v1::client::TargetInstances;
16736 /// let client = TargetInstances::builder().build().await?;
16737 /// # gax::client_builder::Result::<()>::Ok(()) });
16738 /// ```
16739 pub fn builder() -> super::builder::target_instances::ClientBuilder {
16740 gax::client_builder::internal::new_builder(
16741 super::builder::target_instances::client::Factory,
16742 )
16743 }
16744
16745 /// Creates a new client from the provided stub.
16746 ///
16747 /// The most common case for calling this function is in tests mocking the
16748 /// client's behavior.
16749 pub fn from_stub<T>(stub: T) -> Self
16750 where
16751 T: super::stub::TargetInstances + 'static,
16752 {
16753 Self {
16754 inner: std::sync::Arc::new(stub),
16755 }
16756 }
16757
16758 pub(crate) async fn new(
16759 config: gaxi::options::ClientConfig,
16760 ) -> gax::client_builder::Result<Self> {
16761 let inner = Self::build_inner(config).await?;
16762 Ok(Self { inner })
16763 }
16764
16765 async fn build_inner(
16766 conf: gaxi::options::ClientConfig,
16767 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetInstances>>
16768 {
16769 if gaxi::options::tracing_enabled(&conf) {
16770 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16771 }
16772 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16773 }
16774
16775 async fn build_transport(
16776 conf: gaxi::options::ClientConfig,
16777 ) -> gax::client_builder::Result<impl super::stub::TargetInstances> {
16778 super::transport::TargetInstances::new(conf).await
16779 }
16780
16781 async fn build_with_tracing(
16782 conf: gaxi::options::ClientConfig,
16783 ) -> gax::client_builder::Result<impl super::stub::TargetInstances> {
16784 Self::build_transport(conf)
16785 .await
16786 .map(super::tracing::TargetInstances::new)
16787 }
16788
16789 /// Retrieves an aggregated list of target instances.
16790 ///
16791 /// To prevent failure, Google recommends that you set the
16792 /// `returnPartialSuccess` parameter to `true`.
16793 pub fn aggregated_list(&self) -> super::builder::target_instances::AggregatedList {
16794 super::builder::target_instances::AggregatedList::new(self.inner.clone())
16795 }
16796
16797 /// Deletes the specified TargetInstance resource.
16798 pub fn delete(&self) -> super::builder::target_instances::Delete {
16799 super::builder::target_instances::Delete::new(self.inner.clone())
16800 }
16801
16802 /// Returns the specified TargetInstance resource.
16803 pub fn get(&self) -> super::builder::target_instances::Get {
16804 super::builder::target_instances::Get::new(self.inner.clone())
16805 }
16806
16807 /// Creates a TargetInstance resource in the specified project and zone using
16808 /// the data included in the request.
16809 pub fn insert(&self) -> super::builder::target_instances::Insert {
16810 super::builder::target_instances::Insert::new(self.inner.clone())
16811 }
16812
16813 /// Retrieves a list of TargetInstance resources available to the specified
16814 /// project and zone.
16815 pub fn list(&self) -> super::builder::target_instances::List {
16816 super::builder::target_instances::List::new(self.inner.clone())
16817 }
16818
16819 /// Sets the Google Cloud Armor security policy for the specified target
16820 /// instance. For more information, seeGoogle
16821 /// Cloud Armor Overview
16822 pub fn set_security_policy(&self) -> super::builder::target_instances::SetSecurityPolicy {
16823 super::builder::target_instances::SetSecurityPolicy::new(self.inner.clone())
16824 }
16825
16826 /// Returns permissions that a caller has on the specified resource.
16827 pub fn test_iam_permissions(&self) -> super::builder::target_instances::TestIamPermissions {
16828 super::builder::target_instances::TestIamPermissions::new(self.inner.clone())
16829 }
16830
16831 /// Retrieves the specified zone-specific Operations resource.
16832 pub fn get_operation(&self) -> super::builder::target_instances::GetOperation {
16833 super::builder::target_instances::GetOperation::new(self.inner.clone())
16834 }
16835}
16836
16837/// Implements a client for the Google Compute Engine API.
16838///
16839/// # Example
16840/// ```
16841/// # tokio_test::block_on(async {
16842/// # use google_cloud_compute_v1::client::TargetPools;
16843/// let client = TargetPools::builder().build().await?;
16844/// // use `client` to make requests to the Google Compute Engine API.
16845/// # gax::client_builder::Result::<()>::Ok(()) });
16846/// ```
16847///
16848/// # Service Description
16849///
16850/// Service for the `targetPools` resource.
16851///
16852/// # Configuration
16853///
16854/// To configure `TargetPools` use the `with_*` methods in the type returned
16855/// by [builder()][TargetPools::builder]. The default configuration should
16856/// work for most applications. Common configuration changes include
16857///
16858/// * [with_endpoint()]: by default this client uses the global default endpoint
16859/// (`https://compute.googleapis.com`). Applications using regional
16860/// endpoints or running in restricted networks (e.g. a network configured
16861// with [Private Google Access with VPC Service Controls]) may want to
16862/// override this default.
16863/// * [with_credentials()]: by default this client uses
16864/// [Application Default Credentials]. Applications using custom
16865/// authentication may need to override this default.
16866///
16867/// [with_endpoint()]: super::builder::target_pools::ClientBuilder::with_endpoint
16868/// [with_credentials()]: super::builder::target_pools::ClientBuilder::credentials
16869/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
16870/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
16871///
16872/// # Pooling and Cloning
16873///
16874/// `TargetPools` holds a connection pool internally, it is advised to
16875/// create one and the reuse it. You do not need to wrap `TargetPools` in
16876/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
16877/// already uses an `Arc` internally.
16878#[cfg(feature = "target-pools")]
16879#[cfg_attr(docsrs, doc(cfg(feature = "target-pools")))]
16880#[derive(Clone, Debug)]
16881pub struct TargetPools {
16882 inner: std::sync::Arc<dyn super::stub::dynamic::TargetPools>,
16883}
16884
16885#[cfg(feature = "target-pools")]
16886impl TargetPools {
16887 /// Returns a builder for [TargetPools].
16888 ///
16889 /// ```
16890 /// # tokio_test::block_on(async {
16891 /// # use google_cloud_compute_v1::client::TargetPools;
16892 /// let client = TargetPools::builder().build().await?;
16893 /// # gax::client_builder::Result::<()>::Ok(()) });
16894 /// ```
16895 pub fn builder() -> super::builder::target_pools::ClientBuilder {
16896 gax::client_builder::internal::new_builder(super::builder::target_pools::client::Factory)
16897 }
16898
16899 /// Creates a new client from the provided stub.
16900 ///
16901 /// The most common case for calling this function is in tests mocking the
16902 /// client's behavior.
16903 pub fn from_stub<T>(stub: T) -> Self
16904 where
16905 T: super::stub::TargetPools + 'static,
16906 {
16907 Self {
16908 inner: std::sync::Arc::new(stub),
16909 }
16910 }
16911
16912 pub(crate) async fn new(
16913 config: gaxi::options::ClientConfig,
16914 ) -> gax::client_builder::Result<Self> {
16915 let inner = Self::build_inner(config).await?;
16916 Ok(Self { inner })
16917 }
16918
16919 async fn build_inner(
16920 conf: gaxi::options::ClientConfig,
16921 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetPools>> {
16922 if gaxi::options::tracing_enabled(&conf) {
16923 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
16924 }
16925 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
16926 }
16927
16928 async fn build_transport(
16929 conf: gaxi::options::ClientConfig,
16930 ) -> gax::client_builder::Result<impl super::stub::TargetPools> {
16931 super::transport::TargetPools::new(conf).await
16932 }
16933
16934 async fn build_with_tracing(
16935 conf: gaxi::options::ClientConfig,
16936 ) -> gax::client_builder::Result<impl super::stub::TargetPools> {
16937 Self::build_transport(conf)
16938 .await
16939 .map(super::tracing::TargetPools::new)
16940 }
16941
16942 /// Adds health check URLs to a target pool.
16943 pub fn add_health_check(&self) -> super::builder::target_pools::AddHealthCheck {
16944 super::builder::target_pools::AddHealthCheck::new(self.inner.clone())
16945 }
16946
16947 /// Adds an instance to a target pool.
16948 pub fn add_instance(&self) -> super::builder::target_pools::AddInstance {
16949 super::builder::target_pools::AddInstance::new(self.inner.clone())
16950 }
16951
16952 /// Retrieves an aggregated list of target pools.
16953 ///
16954 /// To prevent failure, Google recommends that you set the
16955 /// `returnPartialSuccess` parameter to `true`.
16956 pub fn aggregated_list(&self) -> super::builder::target_pools::AggregatedList {
16957 super::builder::target_pools::AggregatedList::new(self.inner.clone())
16958 }
16959
16960 /// Deletes the specified target pool.
16961 pub fn delete(&self) -> super::builder::target_pools::Delete {
16962 super::builder::target_pools::Delete::new(self.inner.clone())
16963 }
16964
16965 /// Returns the specified target pool.
16966 pub fn get(&self) -> super::builder::target_pools::Get {
16967 super::builder::target_pools::Get::new(self.inner.clone())
16968 }
16969
16970 /// Gets the most recent health check results for each IP for the
16971 /// instance that is referenced by the given target pool.
16972 pub fn get_health(&self) -> super::builder::target_pools::GetHealth {
16973 super::builder::target_pools::GetHealth::new(self.inner.clone())
16974 }
16975
16976 /// Creates a target pool in the specified project and region using
16977 /// the data included in the request.
16978 pub fn insert(&self) -> super::builder::target_pools::Insert {
16979 super::builder::target_pools::Insert::new(self.inner.clone())
16980 }
16981
16982 /// Retrieves a list of target pools available to the specified
16983 /// project and region.
16984 pub fn list(&self) -> super::builder::target_pools::List {
16985 super::builder::target_pools::List::new(self.inner.clone())
16986 }
16987
16988 /// Removes health check URL from a target pool.
16989 pub fn remove_health_check(&self) -> super::builder::target_pools::RemoveHealthCheck {
16990 super::builder::target_pools::RemoveHealthCheck::new(self.inner.clone())
16991 }
16992
16993 /// Removes instance URL from a target pool.
16994 pub fn remove_instance(&self) -> super::builder::target_pools::RemoveInstance {
16995 super::builder::target_pools::RemoveInstance::new(self.inner.clone())
16996 }
16997
16998 /// Changes a backup target pool's configurations.
16999 pub fn set_backup(&self) -> super::builder::target_pools::SetBackup {
17000 super::builder::target_pools::SetBackup::new(self.inner.clone())
17001 }
17002
17003 /// Sets the Google Cloud Armor security policy for the specified target pool.
17004 /// For more information, seeGoogle
17005 /// Cloud Armor Overview
17006 pub fn set_security_policy(&self) -> super::builder::target_pools::SetSecurityPolicy {
17007 super::builder::target_pools::SetSecurityPolicy::new(self.inner.clone())
17008 }
17009
17010 /// Returns permissions that a caller has on the specified resource.
17011 pub fn test_iam_permissions(&self) -> super::builder::target_pools::TestIamPermissions {
17012 super::builder::target_pools::TestIamPermissions::new(self.inner.clone())
17013 }
17014
17015 /// Retrieves the specified region-specific Operations resource.
17016 pub fn get_operation(&self) -> super::builder::target_pools::GetOperation {
17017 super::builder::target_pools::GetOperation::new(self.inner.clone())
17018 }
17019}
17020
17021/// Implements a client for the Google Compute Engine API.
17022///
17023/// # Example
17024/// ```
17025/// # tokio_test::block_on(async {
17026/// # use google_cloud_compute_v1::client::TargetSslProxies;
17027/// let client = TargetSslProxies::builder().build().await?;
17028/// // use `client` to make requests to the Google Compute Engine API.
17029/// # gax::client_builder::Result::<()>::Ok(()) });
17030/// ```
17031///
17032/// # Service Description
17033///
17034/// Service for the `targetSslProxies` resource.
17035///
17036/// # Configuration
17037///
17038/// To configure `TargetSslProxies` use the `with_*` methods in the type returned
17039/// by [builder()][TargetSslProxies::builder]. The default configuration should
17040/// work for most applications. Common configuration changes include
17041///
17042/// * [with_endpoint()]: by default this client uses the global default endpoint
17043/// (`https://compute.googleapis.com`). Applications using regional
17044/// endpoints or running in restricted networks (e.g. a network configured
17045// with [Private Google Access with VPC Service Controls]) may want to
17046/// override this default.
17047/// * [with_credentials()]: by default this client uses
17048/// [Application Default Credentials]. Applications using custom
17049/// authentication may need to override this default.
17050///
17051/// [with_endpoint()]: super::builder::target_ssl_proxies::ClientBuilder::with_endpoint
17052/// [with_credentials()]: super::builder::target_ssl_proxies::ClientBuilder::credentials
17053/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17054/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17055///
17056/// # Pooling and Cloning
17057///
17058/// `TargetSslProxies` holds a connection pool internally, it is advised to
17059/// create one and the reuse it. You do not need to wrap `TargetSslProxies` in
17060/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17061/// already uses an `Arc` internally.
17062#[cfg(feature = "target-ssl-proxies")]
17063#[cfg_attr(docsrs, doc(cfg(feature = "target-ssl-proxies")))]
17064#[derive(Clone, Debug)]
17065pub struct TargetSslProxies {
17066 inner: std::sync::Arc<dyn super::stub::dynamic::TargetSslProxies>,
17067}
17068
17069#[cfg(feature = "target-ssl-proxies")]
17070impl TargetSslProxies {
17071 /// Returns a builder for [TargetSslProxies].
17072 ///
17073 /// ```
17074 /// # tokio_test::block_on(async {
17075 /// # use google_cloud_compute_v1::client::TargetSslProxies;
17076 /// let client = TargetSslProxies::builder().build().await?;
17077 /// # gax::client_builder::Result::<()>::Ok(()) });
17078 /// ```
17079 pub fn builder() -> super::builder::target_ssl_proxies::ClientBuilder {
17080 gax::client_builder::internal::new_builder(
17081 super::builder::target_ssl_proxies::client::Factory,
17082 )
17083 }
17084
17085 /// Creates a new client from the provided stub.
17086 ///
17087 /// The most common case for calling this function is in tests mocking the
17088 /// client's behavior.
17089 pub fn from_stub<T>(stub: T) -> Self
17090 where
17091 T: super::stub::TargetSslProxies + 'static,
17092 {
17093 Self {
17094 inner: std::sync::Arc::new(stub),
17095 }
17096 }
17097
17098 pub(crate) async fn new(
17099 config: gaxi::options::ClientConfig,
17100 ) -> gax::client_builder::Result<Self> {
17101 let inner = Self::build_inner(config).await?;
17102 Ok(Self { inner })
17103 }
17104
17105 async fn build_inner(
17106 conf: gaxi::options::ClientConfig,
17107 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetSslProxies>>
17108 {
17109 if gaxi::options::tracing_enabled(&conf) {
17110 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17111 }
17112 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17113 }
17114
17115 async fn build_transport(
17116 conf: gaxi::options::ClientConfig,
17117 ) -> gax::client_builder::Result<impl super::stub::TargetSslProxies> {
17118 super::transport::TargetSslProxies::new(conf).await
17119 }
17120
17121 async fn build_with_tracing(
17122 conf: gaxi::options::ClientConfig,
17123 ) -> gax::client_builder::Result<impl super::stub::TargetSslProxies> {
17124 Self::build_transport(conf)
17125 .await
17126 .map(super::tracing::TargetSslProxies::new)
17127 }
17128
17129 /// Deletes the specified TargetSslProxy resource.
17130 pub fn delete(&self) -> super::builder::target_ssl_proxies::Delete {
17131 super::builder::target_ssl_proxies::Delete::new(self.inner.clone())
17132 }
17133
17134 /// Returns the specified TargetSslProxy resource.
17135 pub fn get(&self) -> super::builder::target_ssl_proxies::Get {
17136 super::builder::target_ssl_proxies::Get::new(self.inner.clone())
17137 }
17138
17139 /// Creates a TargetSslProxy resource in the specified project using
17140 /// the data included in the request.
17141 pub fn insert(&self) -> super::builder::target_ssl_proxies::Insert {
17142 super::builder::target_ssl_proxies::Insert::new(self.inner.clone())
17143 }
17144
17145 /// Retrieves the list of TargetSslProxy resources
17146 /// available to the specified project.
17147 pub fn list(&self) -> super::builder::target_ssl_proxies::List {
17148 super::builder::target_ssl_proxies::List::new(self.inner.clone())
17149 }
17150
17151 /// Changes the BackendService for TargetSslProxy.
17152 pub fn set_backend_service(&self) -> super::builder::target_ssl_proxies::SetBackendService {
17153 super::builder::target_ssl_proxies::SetBackendService::new(self.inner.clone())
17154 }
17155
17156 /// Changes the Certificate Map for TargetSslProxy.
17157 pub fn set_certificate_map(&self) -> super::builder::target_ssl_proxies::SetCertificateMap {
17158 super::builder::target_ssl_proxies::SetCertificateMap::new(self.inner.clone())
17159 }
17160
17161 /// Changes the ProxyHeaderType for TargetSslProxy.
17162 pub fn set_proxy_header(&self) -> super::builder::target_ssl_proxies::SetProxyHeader {
17163 super::builder::target_ssl_proxies::SetProxyHeader::new(self.inner.clone())
17164 }
17165
17166 /// Changes SslCertificates for TargetSslProxy.
17167 pub fn set_ssl_certificates(&self) -> super::builder::target_ssl_proxies::SetSslCertificates {
17168 super::builder::target_ssl_proxies::SetSslCertificates::new(self.inner.clone())
17169 }
17170
17171 /// Sets the SSL policy for TargetSslProxy. The SSL policy specifies the
17172 /// server-side support for SSL features. This affects connections between
17173 /// clients and the load balancer. They do not affect the
17174 /// connection between the load balancer and the backends.
17175 pub fn set_ssl_policy(&self) -> super::builder::target_ssl_proxies::SetSslPolicy {
17176 super::builder::target_ssl_proxies::SetSslPolicy::new(self.inner.clone())
17177 }
17178
17179 /// Retrieves the specified Operations resource.
17180 pub fn get_operation(&self) -> super::builder::target_ssl_proxies::GetOperation {
17181 super::builder::target_ssl_proxies::GetOperation::new(self.inner.clone())
17182 }
17183}
17184
17185/// Implements a client for the Google Compute Engine API.
17186///
17187/// # Example
17188/// ```
17189/// # tokio_test::block_on(async {
17190/// # use google_cloud_compute_v1::client::TargetTcpProxies;
17191/// let client = TargetTcpProxies::builder().build().await?;
17192/// // use `client` to make requests to the Google Compute Engine API.
17193/// # gax::client_builder::Result::<()>::Ok(()) });
17194/// ```
17195///
17196/// # Service Description
17197///
17198/// Service for the `targetTcpProxies` resource.
17199///
17200/// # Configuration
17201///
17202/// To configure `TargetTcpProxies` use the `with_*` methods in the type returned
17203/// by [builder()][TargetTcpProxies::builder]. The default configuration should
17204/// work for most applications. Common configuration changes include
17205///
17206/// * [with_endpoint()]: by default this client uses the global default endpoint
17207/// (`https://compute.googleapis.com`). Applications using regional
17208/// endpoints or running in restricted networks (e.g. a network configured
17209// with [Private Google Access with VPC Service Controls]) may want to
17210/// override this default.
17211/// * [with_credentials()]: by default this client uses
17212/// [Application Default Credentials]. Applications using custom
17213/// authentication may need to override this default.
17214///
17215/// [with_endpoint()]: super::builder::target_tcp_proxies::ClientBuilder::with_endpoint
17216/// [with_credentials()]: super::builder::target_tcp_proxies::ClientBuilder::credentials
17217/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17218/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17219///
17220/// # Pooling and Cloning
17221///
17222/// `TargetTcpProxies` holds a connection pool internally, it is advised to
17223/// create one and the reuse it. You do not need to wrap `TargetTcpProxies` in
17224/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17225/// already uses an `Arc` internally.
17226#[cfg(feature = "target-tcp-proxies")]
17227#[cfg_attr(docsrs, doc(cfg(feature = "target-tcp-proxies")))]
17228#[derive(Clone, Debug)]
17229pub struct TargetTcpProxies {
17230 inner: std::sync::Arc<dyn super::stub::dynamic::TargetTcpProxies>,
17231}
17232
17233#[cfg(feature = "target-tcp-proxies")]
17234impl TargetTcpProxies {
17235 /// Returns a builder for [TargetTcpProxies].
17236 ///
17237 /// ```
17238 /// # tokio_test::block_on(async {
17239 /// # use google_cloud_compute_v1::client::TargetTcpProxies;
17240 /// let client = TargetTcpProxies::builder().build().await?;
17241 /// # gax::client_builder::Result::<()>::Ok(()) });
17242 /// ```
17243 pub fn builder() -> super::builder::target_tcp_proxies::ClientBuilder {
17244 gax::client_builder::internal::new_builder(
17245 super::builder::target_tcp_proxies::client::Factory,
17246 )
17247 }
17248
17249 /// Creates a new client from the provided stub.
17250 ///
17251 /// The most common case for calling this function is in tests mocking the
17252 /// client's behavior.
17253 pub fn from_stub<T>(stub: T) -> Self
17254 where
17255 T: super::stub::TargetTcpProxies + 'static,
17256 {
17257 Self {
17258 inner: std::sync::Arc::new(stub),
17259 }
17260 }
17261
17262 pub(crate) async fn new(
17263 config: gaxi::options::ClientConfig,
17264 ) -> gax::client_builder::Result<Self> {
17265 let inner = Self::build_inner(config).await?;
17266 Ok(Self { inner })
17267 }
17268
17269 async fn build_inner(
17270 conf: gaxi::options::ClientConfig,
17271 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetTcpProxies>>
17272 {
17273 if gaxi::options::tracing_enabled(&conf) {
17274 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17275 }
17276 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17277 }
17278
17279 async fn build_transport(
17280 conf: gaxi::options::ClientConfig,
17281 ) -> gax::client_builder::Result<impl super::stub::TargetTcpProxies> {
17282 super::transport::TargetTcpProxies::new(conf).await
17283 }
17284
17285 async fn build_with_tracing(
17286 conf: gaxi::options::ClientConfig,
17287 ) -> gax::client_builder::Result<impl super::stub::TargetTcpProxies> {
17288 Self::build_transport(conf)
17289 .await
17290 .map(super::tracing::TargetTcpProxies::new)
17291 }
17292
17293 /// Retrieves the list of all TargetTcpProxy resources, regional and global,
17294 /// available to the specified project.
17295 ///
17296 /// To prevent failure, Google recommends that you set the
17297 /// `returnPartialSuccess` parameter to `true`.
17298 pub fn aggregated_list(&self) -> super::builder::target_tcp_proxies::AggregatedList {
17299 super::builder::target_tcp_proxies::AggregatedList::new(self.inner.clone())
17300 }
17301
17302 /// Deletes the specified TargetTcpProxy resource.
17303 pub fn delete(&self) -> super::builder::target_tcp_proxies::Delete {
17304 super::builder::target_tcp_proxies::Delete::new(self.inner.clone())
17305 }
17306
17307 /// Returns the specified TargetTcpProxy resource.
17308 pub fn get(&self) -> super::builder::target_tcp_proxies::Get {
17309 super::builder::target_tcp_proxies::Get::new(self.inner.clone())
17310 }
17311
17312 /// Creates a TargetTcpProxy resource in the specified project using
17313 /// the data included in the request.
17314 pub fn insert(&self) -> super::builder::target_tcp_proxies::Insert {
17315 super::builder::target_tcp_proxies::Insert::new(self.inner.clone())
17316 }
17317
17318 /// Retrieves the list of TargetTcpProxy resources
17319 /// available to the specified project.
17320 pub fn list(&self) -> super::builder::target_tcp_proxies::List {
17321 super::builder::target_tcp_proxies::List::new(self.inner.clone())
17322 }
17323
17324 /// Changes the BackendService for TargetTcpProxy.
17325 pub fn set_backend_service(&self) -> super::builder::target_tcp_proxies::SetBackendService {
17326 super::builder::target_tcp_proxies::SetBackendService::new(self.inner.clone())
17327 }
17328
17329 /// Changes the ProxyHeaderType for TargetTcpProxy.
17330 pub fn set_proxy_header(&self) -> super::builder::target_tcp_proxies::SetProxyHeader {
17331 super::builder::target_tcp_proxies::SetProxyHeader::new(self.inner.clone())
17332 }
17333
17334 /// Retrieves the specified Operations resource.
17335 pub fn get_operation(&self) -> super::builder::target_tcp_proxies::GetOperation {
17336 super::builder::target_tcp_proxies::GetOperation::new(self.inner.clone())
17337 }
17338}
17339
17340/// Implements a client for the Google Compute Engine API.
17341///
17342/// # Example
17343/// ```
17344/// # tokio_test::block_on(async {
17345/// # use google_cloud_compute_v1::client::TargetVpnGateways;
17346/// let client = TargetVpnGateways::builder().build().await?;
17347/// // use `client` to make requests to the Google Compute Engine API.
17348/// # gax::client_builder::Result::<()>::Ok(()) });
17349/// ```
17350///
17351/// # Service Description
17352///
17353/// Service for the `targetVpnGateways` resource.
17354///
17355/// # Configuration
17356///
17357/// To configure `TargetVpnGateways` use the `with_*` methods in the type returned
17358/// by [builder()][TargetVpnGateways::builder]. The default configuration should
17359/// work for most applications. Common configuration changes include
17360///
17361/// * [with_endpoint()]: by default this client uses the global default endpoint
17362/// (`https://compute.googleapis.com`). Applications using regional
17363/// endpoints or running in restricted networks (e.g. a network configured
17364// with [Private Google Access with VPC Service Controls]) may want to
17365/// override this default.
17366/// * [with_credentials()]: by default this client uses
17367/// [Application Default Credentials]. Applications using custom
17368/// authentication may need to override this default.
17369///
17370/// [with_endpoint()]: super::builder::target_vpn_gateways::ClientBuilder::with_endpoint
17371/// [with_credentials()]: super::builder::target_vpn_gateways::ClientBuilder::credentials
17372/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17373/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17374///
17375/// # Pooling and Cloning
17376///
17377/// `TargetVpnGateways` holds a connection pool internally, it is advised to
17378/// create one and the reuse it. You do not need to wrap `TargetVpnGateways` in
17379/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17380/// already uses an `Arc` internally.
17381#[cfg(feature = "target-vpn-gateways")]
17382#[cfg_attr(docsrs, doc(cfg(feature = "target-vpn-gateways")))]
17383#[derive(Clone, Debug)]
17384pub struct TargetVpnGateways {
17385 inner: std::sync::Arc<dyn super::stub::dynamic::TargetVpnGateways>,
17386}
17387
17388#[cfg(feature = "target-vpn-gateways")]
17389impl TargetVpnGateways {
17390 /// Returns a builder for [TargetVpnGateways].
17391 ///
17392 /// ```
17393 /// # tokio_test::block_on(async {
17394 /// # use google_cloud_compute_v1::client::TargetVpnGateways;
17395 /// let client = TargetVpnGateways::builder().build().await?;
17396 /// # gax::client_builder::Result::<()>::Ok(()) });
17397 /// ```
17398 pub fn builder() -> super::builder::target_vpn_gateways::ClientBuilder {
17399 gax::client_builder::internal::new_builder(
17400 super::builder::target_vpn_gateways::client::Factory,
17401 )
17402 }
17403
17404 /// Creates a new client from the provided stub.
17405 ///
17406 /// The most common case for calling this function is in tests mocking the
17407 /// client's behavior.
17408 pub fn from_stub<T>(stub: T) -> Self
17409 where
17410 T: super::stub::TargetVpnGateways + 'static,
17411 {
17412 Self {
17413 inner: std::sync::Arc::new(stub),
17414 }
17415 }
17416
17417 pub(crate) async fn new(
17418 config: gaxi::options::ClientConfig,
17419 ) -> gax::client_builder::Result<Self> {
17420 let inner = Self::build_inner(config).await?;
17421 Ok(Self { inner })
17422 }
17423
17424 async fn build_inner(
17425 conf: gaxi::options::ClientConfig,
17426 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::TargetVpnGateways>>
17427 {
17428 if gaxi::options::tracing_enabled(&conf) {
17429 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17430 }
17431 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17432 }
17433
17434 async fn build_transport(
17435 conf: gaxi::options::ClientConfig,
17436 ) -> gax::client_builder::Result<impl super::stub::TargetVpnGateways> {
17437 super::transport::TargetVpnGateways::new(conf).await
17438 }
17439
17440 async fn build_with_tracing(
17441 conf: gaxi::options::ClientConfig,
17442 ) -> gax::client_builder::Result<impl super::stub::TargetVpnGateways> {
17443 Self::build_transport(conf)
17444 .await
17445 .map(super::tracing::TargetVpnGateways::new)
17446 }
17447
17448 /// Retrieves an aggregated list of target VPN gateways.
17449 ///
17450 /// To prevent failure, Google recommends that you set the
17451 /// `returnPartialSuccess` parameter to `true`.
17452 pub fn aggregated_list(&self) -> super::builder::target_vpn_gateways::AggregatedList {
17453 super::builder::target_vpn_gateways::AggregatedList::new(self.inner.clone())
17454 }
17455
17456 /// Deletes the specified target VPN gateway.
17457 pub fn delete(&self) -> super::builder::target_vpn_gateways::Delete {
17458 super::builder::target_vpn_gateways::Delete::new(self.inner.clone())
17459 }
17460
17461 /// Returns the specified target VPN gateway.
17462 pub fn get(&self) -> super::builder::target_vpn_gateways::Get {
17463 super::builder::target_vpn_gateways::Get::new(self.inner.clone())
17464 }
17465
17466 /// Creates a target VPN gateway in the specified project and region using
17467 /// the data included in the request.
17468 pub fn insert(&self) -> super::builder::target_vpn_gateways::Insert {
17469 super::builder::target_vpn_gateways::Insert::new(self.inner.clone())
17470 }
17471
17472 /// Retrieves a list of target VPN gateways available to the specified
17473 /// project and region.
17474 pub fn list(&self) -> super::builder::target_vpn_gateways::List {
17475 super::builder::target_vpn_gateways::List::new(self.inner.clone())
17476 }
17477
17478 /// Sets the labels on a TargetVpnGateway. To learn more about labels, read theLabeling
17479 /// Resources documentation.
17480 pub fn set_labels(&self) -> super::builder::target_vpn_gateways::SetLabels {
17481 super::builder::target_vpn_gateways::SetLabels::new(self.inner.clone())
17482 }
17483
17484 /// Retrieves the specified region-specific Operations resource.
17485 pub fn get_operation(&self) -> super::builder::target_vpn_gateways::GetOperation {
17486 super::builder::target_vpn_gateways::GetOperation::new(self.inner.clone())
17487 }
17488}
17489
17490/// Implements a client for the Google Compute Engine API.
17491///
17492/// # Example
17493/// ```
17494/// # tokio_test::block_on(async {
17495/// # use google_cloud_compute_v1::client::UrlMaps;
17496/// let client = UrlMaps::builder().build().await?;
17497/// // use `client` to make requests to the Google Compute Engine API.
17498/// # gax::client_builder::Result::<()>::Ok(()) });
17499/// ```
17500///
17501/// # Service Description
17502///
17503/// Service for the `urlMaps` resource.
17504///
17505/// # Configuration
17506///
17507/// To configure `UrlMaps` use the `with_*` methods in the type returned
17508/// by [builder()][UrlMaps::builder]. The default configuration should
17509/// work for most applications. Common configuration changes include
17510///
17511/// * [with_endpoint()]: by default this client uses the global default endpoint
17512/// (`https://compute.googleapis.com`). Applications using regional
17513/// endpoints or running in restricted networks (e.g. a network configured
17514// with [Private Google Access with VPC Service Controls]) may want to
17515/// override this default.
17516/// * [with_credentials()]: by default this client uses
17517/// [Application Default Credentials]. Applications using custom
17518/// authentication may need to override this default.
17519///
17520/// [with_endpoint()]: super::builder::url_maps::ClientBuilder::with_endpoint
17521/// [with_credentials()]: super::builder::url_maps::ClientBuilder::credentials
17522/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17523/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17524///
17525/// # Pooling and Cloning
17526///
17527/// `UrlMaps` holds a connection pool internally, it is advised to
17528/// create one and the reuse it. You do not need to wrap `UrlMaps` in
17529/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17530/// already uses an `Arc` internally.
17531#[cfg(feature = "url-maps")]
17532#[cfg_attr(docsrs, doc(cfg(feature = "url-maps")))]
17533#[derive(Clone, Debug)]
17534pub struct UrlMaps {
17535 inner: std::sync::Arc<dyn super::stub::dynamic::UrlMaps>,
17536}
17537
17538#[cfg(feature = "url-maps")]
17539impl UrlMaps {
17540 /// Returns a builder for [UrlMaps].
17541 ///
17542 /// ```
17543 /// # tokio_test::block_on(async {
17544 /// # use google_cloud_compute_v1::client::UrlMaps;
17545 /// let client = UrlMaps::builder().build().await?;
17546 /// # gax::client_builder::Result::<()>::Ok(()) });
17547 /// ```
17548 pub fn builder() -> super::builder::url_maps::ClientBuilder {
17549 gax::client_builder::internal::new_builder(super::builder::url_maps::client::Factory)
17550 }
17551
17552 /// Creates a new client from the provided stub.
17553 ///
17554 /// The most common case for calling this function is in tests mocking the
17555 /// client's behavior.
17556 pub fn from_stub<T>(stub: T) -> Self
17557 where
17558 T: super::stub::UrlMaps + 'static,
17559 {
17560 Self {
17561 inner: std::sync::Arc::new(stub),
17562 }
17563 }
17564
17565 pub(crate) async fn new(
17566 config: gaxi::options::ClientConfig,
17567 ) -> gax::client_builder::Result<Self> {
17568 let inner = Self::build_inner(config).await?;
17569 Ok(Self { inner })
17570 }
17571
17572 async fn build_inner(
17573 conf: gaxi::options::ClientConfig,
17574 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::UrlMaps>> {
17575 if gaxi::options::tracing_enabled(&conf) {
17576 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17577 }
17578 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17579 }
17580
17581 async fn build_transport(
17582 conf: gaxi::options::ClientConfig,
17583 ) -> gax::client_builder::Result<impl super::stub::UrlMaps> {
17584 super::transport::UrlMaps::new(conf).await
17585 }
17586
17587 async fn build_with_tracing(
17588 conf: gaxi::options::ClientConfig,
17589 ) -> gax::client_builder::Result<impl super::stub::UrlMaps> {
17590 Self::build_transport(conf)
17591 .await
17592 .map(super::tracing::UrlMaps::new)
17593 }
17594
17595 /// Retrieves the list of all UrlMap resources, regional and global,
17596 /// available to the specified project.
17597 ///
17598 /// To prevent failure, Google recommends that you set the
17599 /// `returnPartialSuccess` parameter to `true`.
17600 pub fn aggregated_list(&self) -> super::builder::url_maps::AggregatedList {
17601 super::builder::url_maps::AggregatedList::new(self.inner.clone())
17602 }
17603
17604 /// Deletes the specified UrlMap resource.
17605 pub fn delete(&self) -> super::builder::url_maps::Delete {
17606 super::builder::url_maps::Delete::new(self.inner.clone())
17607 }
17608
17609 /// Returns the specified UrlMap resource.
17610 pub fn get(&self) -> super::builder::url_maps::Get {
17611 super::builder::url_maps::Get::new(self.inner.clone())
17612 }
17613
17614 /// Creates a UrlMap resource in the specified project using
17615 /// the data included in the request.
17616 pub fn insert(&self) -> super::builder::url_maps::Insert {
17617 super::builder::url_maps::Insert::new(self.inner.clone())
17618 }
17619
17620 /// Initiates a cache invalidation operation, invalidating the specified path,
17621 /// scoped to the specified UrlMap.
17622 ///
17623 /// For more information, see [Invalidating cached
17624 /// content](/cdn/docs/invalidating-cached-content).
17625 pub fn invalidate_cache(&self) -> super::builder::url_maps::InvalidateCache {
17626 super::builder::url_maps::InvalidateCache::new(self.inner.clone())
17627 }
17628
17629 /// Retrieves the list of UrlMap resources available to the specified
17630 /// project.
17631 pub fn list(&self) -> super::builder::url_maps::List {
17632 super::builder::url_maps::List::new(self.inner.clone())
17633 }
17634
17635 /// Patches the specified UrlMap resource with the data included in the
17636 /// request. This method supportsPATCH
17637 /// semantics and uses theJSON merge
17638 /// patch format and processing rules.
17639 pub fn patch(&self) -> super::builder::url_maps::Patch {
17640 super::builder::url_maps::Patch::new(self.inner.clone())
17641 }
17642
17643 /// Updates the specified UrlMap resource with the data included in the
17644 /// request.
17645 pub fn update(&self) -> super::builder::url_maps::Update {
17646 super::builder::url_maps::Update::new(self.inner.clone())
17647 }
17648
17649 /// Runs static validation for the UrlMap. In particular, the tests of the
17650 /// provided UrlMap will be run. Calling this method does NOT create the
17651 /// UrlMap.
17652 pub fn validate(&self) -> super::builder::url_maps::Validate {
17653 super::builder::url_maps::Validate::new(self.inner.clone())
17654 }
17655
17656 /// Retrieves the specified Operations resource.
17657 pub fn get_operation(&self) -> super::builder::url_maps::GetOperation {
17658 super::builder::url_maps::GetOperation::new(self.inner.clone())
17659 }
17660}
17661
17662/// Implements a client for the Google Compute Engine API.
17663///
17664/// # Example
17665/// ```
17666/// # tokio_test::block_on(async {
17667/// # use google_cloud_compute_v1::client::VpnGateways;
17668/// let client = VpnGateways::builder().build().await?;
17669/// // use `client` to make requests to the Google Compute Engine API.
17670/// # gax::client_builder::Result::<()>::Ok(()) });
17671/// ```
17672///
17673/// # Service Description
17674///
17675/// Service for the `vpnGateways` resource.
17676///
17677/// # Configuration
17678///
17679/// To configure `VpnGateways` use the `with_*` methods in the type returned
17680/// by [builder()][VpnGateways::builder]. The default configuration should
17681/// work for most applications. Common configuration changes include
17682///
17683/// * [with_endpoint()]: by default this client uses the global default endpoint
17684/// (`https://compute.googleapis.com`). Applications using regional
17685/// endpoints or running in restricted networks (e.g. a network configured
17686// with [Private Google Access with VPC Service Controls]) may want to
17687/// override this default.
17688/// * [with_credentials()]: by default this client uses
17689/// [Application Default Credentials]. Applications using custom
17690/// authentication may need to override this default.
17691///
17692/// [with_endpoint()]: super::builder::vpn_gateways::ClientBuilder::with_endpoint
17693/// [with_credentials()]: super::builder::vpn_gateways::ClientBuilder::credentials
17694/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17695/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17696///
17697/// # Pooling and Cloning
17698///
17699/// `VpnGateways` holds a connection pool internally, it is advised to
17700/// create one and the reuse it. You do not need to wrap `VpnGateways` in
17701/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17702/// already uses an `Arc` internally.
17703#[cfg(feature = "vpn-gateways")]
17704#[cfg_attr(docsrs, doc(cfg(feature = "vpn-gateways")))]
17705#[derive(Clone, Debug)]
17706pub struct VpnGateways {
17707 inner: std::sync::Arc<dyn super::stub::dynamic::VpnGateways>,
17708}
17709
17710#[cfg(feature = "vpn-gateways")]
17711impl VpnGateways {
17712 /// Returns a builder for [VpnGateways].
17713 ///
17714 /// ```
17715 /// # tokio_test::block_on(async {
17716 /// # use google_cloud_compute_v1::client::VpnGateways;
17717 /// let client = VpnGateways::builder().build().await?;
17718 /// # gax::client_builder::Result::<()>::Ok(()) });
17719 /// ```
17720 pub fn builder() -> super::builder::vpn_gateways::ClientBuilder {
17721 gax::client_builder::internal::new_builder(super::builder::vpn_gateways::client::Factory)
17722 }
17723
17724 /// Creates a new client from the provided stub.
17725 ///
17726 /// The most common case for calling this function is in tests mocking the
17727 /// client's behavior.
17728 pub fn from_stub<T>(stub: T) -> Self
17729 where
17730 T: super::stub::VpnGateways + 'static,
17731 {
17732 Self {
17733 inner: std::sync::Arc::new(stub),
17734 }
17735 }
17736
17737 pub(crate) async fn new(
17738 config: gaxi::options::ClientConfig,
17739 ) -> gax::client_builder::Result<Self> {
17740 let inner = Self::build_inner(config).await?;
17741 Ok(Self { inner })
17742 }
17743
17744 async fn build_inner(
17745 conf: gaxi::options::ClientConfig,
17746 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VpnGateways>> {
17747 if gaxi::options::tracing_enabled(&conf) {
17748 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17749 }
17750 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17751 }
17752
17753 async fn build_transport(
17754 conf: gaxi::options::ClientConfig,
17755 ) -> gax::client_builder::Result<impl super::stub::VpnGateways> {
17756 super::transport::VpnGateways::new(conf).await
17757 }
17758
17759 async fn build_with_tracing(
17760 conf: gaxi::options::ClientConfig,
17761 ) -> gax::client_builder::Result<impl super::stub::VpnGateways> {
17762 Self::build_transport(conf)
17763 .await
17764 .map(super::tracing::VpnGateways::new)
17765 }
17766
17767 /// Retrieves an aggregated list of VPN gateways.
17768 ///
17769 /// To prevent failure, Google recommends that you set the
17770 /// `returnPartialSuccess` parameter to `true`.
17771 pub fn aggregated_list(&self) -> super::builder::vpn_gateways::AggregatedList {
17772 super::builder::vpn_gateways::AggregatedList::new(self.inner.clone())
17773 }
17774
17775 /// Deletes the specified VPN gateway.
17776 pub fn delete(&self) -> super::builder::vpn_gateways::Delete {
17777 super::builder::vpn_gateways::Delete::new(self.inner.clone())
17778 }
17779
17780 /// Returns the specified VPN gateway.
17781 pub fn get(&self) -> super::builder::vpn_gateways::Get {
17782 super::builder::vpn_gateways::Get::new(self.inner.clone())
17783 }
17784
17785 /// Returns the status for the specified VPN gateway.
17786 pub fn get_status(&self) -> super::builder::vpn_gateways::GetStatus {
17787 super::builder::vpn_gateways::GetStatus::new(self.inner.clone())
17788 }
17789
17790 /// Creates a VPN gateway in the specified project and region using
17791 /// the data included in the request.
17792 pub fn insert(&self) -> super::builder::vpn_gateways::Insert {
17793 super::builder::vpn_gateways::Insert::new(self.inner.clone())
17794 }
17795
17796 /// Retrieves a list of VPN gateways available to the specified
17797 /// project and region.
17798 pub fn list(&self) -> super::builder::vpn_gateways::List {
17799 super::builder::vpn_gateways::List::new(self.inner.clone())
17800 }
17801
17802 /// Sets the labels on a VpnGateway. To learn more about labels, read theLabeling
17803 /// Resources documentation.
17804 pub fn set_labels(&self) -> super::builder::vpn_gateways::SetLabels {
17805 super::builder::vpn_gateways::SetLabels::new(self.inner.clone())
17806 }
17807
17808 /// Returns permissions that a caller has on the specified resource.
17809 pub fn test_iam_permissions(&self) -> super::builder::vpn_gateways::TestIamPermissions {
17810 super::builder::vpn_gateways::TestIamPermissions::new(self.inner.clone())
17811 }
17812
17813 /// Retrieves the specified region-specific Operations resource.
17814 pub fn get_operation(&self) -> super::builder::vpn_gateways::GetOperation {
17815 super::builder::vpn_gateways::GetOperation::new(self.inner.clone())
17816 }
17817}
17818
17819/// Implements a client for the Google Compute Engine API.
17820///
17821/// # Example
17822/// ```
17823/// # tokio_test::block_on(async {
17824/// # use google_cloud_compute_v1::client::VpnTunnels;
17825/// let client = VpnTunnels::builder().build().await?;
17826/// // use `client` to make requests to the Google Compute Engine API.
17827/// # gax::client_builder::Result::<()>::Ok(()) });
17828/// ```
17829///
17830/// # Service Description
17831///
17832/// Service for the `vpnTunnels` resource.
17833///
17834/// # Configuration
17835///
17836/// To configure `VpnTunnels` use the `with_*` methods in the type returned
17837/// by [builder()][VpnTunnels::builder]. The default configuration should
17838/// work for most applications. Common configuration changes include
17839///
17840/// * [with_endpoint()]: by default this client uses the global default endpoint
17841/// (`https://compute.googleapis.com`). Applications using regional
17842/// endpoints or running in restricted networks (e.g. a network configured
17843// with [Private Google Access with VPC Service Controls]) may want to
17844/// override this default.
17845/// * [with_credentials()]: by default this client uses
17846/// [Application Default Credentials]. Applications using custom
17847/// authentication may need to override this default.
17848///
17849/// [with_endpoint()]: super::builder::vpn_tunnels::ClientBuilder::with_endpoint
17850/// [with_credentials()]: super::builder::vpn_tunnels::ClientBuilder::credentials
17851/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17852/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
17853///
17854/// # Pooling and Cloning
17855///
17856/// `VpnTunnels` holds a connection pool internally, it is advised to
17857/// create one and the reuse it. You do not need to wrap `VpnTunnels` in
17858/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
17859/// already uses an `Arc` internally.
17860#[cfg(feature = "vpn-tunnels")]
17861#[cfg_attr(docsrs, doc(cfg(feature = "vpn-tunnels")))]
17862#[derive(Clone, Debug)]
17863pub struct VpnTunnels {
17864 inner: std::sync::Arc<dyn super::stub::dynamic::VpnTunnels>,
17865}
17866
17867#[cfg(feature = "vpn-tunnels")]
17868impl VpnTunnels {
17869 /// Returns a builder for [VpnTunnels].
17870 ///
17871 /// ```
17872 /// # tokio_test::block_on(async {
17873 /// # use google_cloud_compute_v1::client::VpnTunnels;
17874 /// let client = VpnTunnels::builder().build().await?;
17875 /// # gax::client_builder::Result::<()>::Ok(()) });
17876 /// ```
17877 pub fn builder() -> super::builder::vpn_tunnels::ClientBuilder {
17878 gax::client_builder::internal::new_builder(super::builder::vpn_tunnels::client::Factory)
17879 }
17880
17881 /// Creates a new client from the provided stub.
17882 ///
17883 /// The most common case for calling this function is in tests mocking the
17884 /// client's behavior.
17885 pub fn from_stub<T>(stub: T) -> Self
17886 where
17887 T: super::stub::VpnTunnels + 'static,
17888 {
17889 Self {
17890 inner: std::sync::Arc::new(stub),
17891 }
17892 }
17893
17894 pub(crate) async fn new(
17895 config: gaxi::options::ClientConfig,
17896 ) -> gax::client_builder::Result<Self> {
17897 let inner = Self::build_inner(config).await?;
17898 Ok(Self { inner })
17899 }
17900
17901 async fn build_inner(
17902 conf: gaxi::options::ClientConfig,
17903 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::VpnTunnels>> {
17904 if gaxi::options::tracing_enabled(&conf) {
17905 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
17906 }
17907 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
17908 }
17909
17910 async fn build_transport(
17911 conf: gaxi::options::ClientConfig,
17912 ) -> gax::client_builder::Result<impl super::stub::VpnTunnels> {
17913 super::transport::VpnTunnels::new(conf).await
17914 }
17915
17916 async fn build_with_tracing(
17917 conf: gaxi::options::ClientConfig,
17918 ) -> gax::client_builder::Result<impl super::stub::VpnTunnels> {
17919 Self::build_transport(conf)
17920 .await
17921 .map(super::tracing::VpnTunnels::new)
17922 }
17923
17924 /// Retrieves an aggregated list of VPN tunnels.
17925 ///
17926 /// To prevent failure, Google recommends that you set the
17927 /// `returnPartialSuccess` parameter to `true`.
17928 pub fn aggregated_list(&self) -> super::builder::vpn_tunnels::AggregatedList {
17929 super::builder::vpn_tunnels::AggregatedList::new(self.inner.clone())
17930 }
17931
17932 /// Deletes the specified VpnTunnel resource.
17933 pub fn delete(&self) -> super::builder::vpn_tunnels::Delete {
17934 super::builder::vpn_tunnels::Delete::new(self.inner.clone())
17935 }
17936
17937 /// Returns the specified VpnTunnel resource.
17938 pub fn get(&self) -> super::builder::vpn_tunnels::Get {
17939 super::builder::vpn_tunnels::Get::new(self.inner.clone())
17940 }
17941
17942 /// Creates a VpnTunnel resource in the specified project and region using
17943 /// the data included in the request.
17944 pub fn insert(&self) -> super::builder::vpn_tunnels::Insert {
17945 super::builder::vpn_tunnels::Insert::new(self.inner.clone())
17946 }
17947
17948 /// Retrieves a list of VpnTunnel resources contained in the specified
17949 /// project and region.
17950 pub fn list(&self) -> super::builder::vpn_tunnels::List {
17951 super::builder::vpn_tunnels::List::new(self.inner.clone())
17952 }
17953
17954 /// Sets the labels on a VpnTunnel. To learn more about labels, read theLabeling
17955 /// Resources documentation.
17956 pub fn set_labels(&self) -> super::builder::vpn_tunnels::SetLabels {
17957 super::builder::vpn_tunnels::SetLabels::new(self.inner.clone())
17958 }
17959
17960 /// Retrieves the specified region-specific Operations resource.
17961 pub fn get_operation(&self) -> super::builder::vpn_tunnels::GetOperation {
17962 super::builder::vpn_tunnels::GetOperation::new(self.inner.clone())
17963 }
17964}
17965
17966/// Implements a client for the Google Compute Engine API.
17967///
17968/// # Example
17969/// ```
17970/// # tokio_test::block_on(async {
17971/// # use google_cloud_compute_v1::client::WireGroups;
17972/// let client = WireGroups::builder().build().await?;
17973/// // use `client` to make requests to the Google Compute Engine API.
17974/// # gax::client_builder::Result::<()>::Ok(()) });
17975/// ```
17976///
17977/// # Service Description
17978///
17979/// Service for the `wireGroups` resource.
17980///
17981/// # Configuration
17982///
17983/// To configure `WireGroups` use the `with_*` methods in the type returned
17984/// by [builder()][WireGroups::builder]. The default configuration should
17985/// work for most applications. Common configuration changes include
17986///
17987/// * [with_endpoint()]: by default this client uses the global default endpoint
17988/// (`https://compute.googleapis.com`). Applications using regional
17989/// endpoints or running in restricted networks (e.g. a network configured
17990// with [Private Google Access with VPC Service Controls]) may want to
17991/// override this default.
17992/// * [with_credentials()]: by default this client uses
17993/// [Application Default Credentials]. Applications using custom
17994/// authentication may need to override this default.
17995///
17996/// [with_endpoint()]: super::builder::wire_groups::ClientBuilder::with_endpoint
17997/// [with_credentials()]: super::builder::wire_groups::ClientBuilder::credentials
17998/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
17999/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18000///
18001/// # Pooling and Cloning
18002///
18003/// `WireGroups` holds a connection pool internally, it is advised to
18004/// create one and the reuse it. You do not need to wrap `WireGroups` in
18005/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18006/// already uses an `Arc` internally.
18007#[cfg(feature = "wire-groups")]
18008#[cfg_attr(docsrs, doc(cfg(feature = "wire-groups")))]
18009#[derive(Clone, Debug)]
18010pub struct WireGroups {
18011 inner: std::sync::Arc<dyn super::stub::dynamic::WireGroups>,
18012}
18013
18014#[cfg(feature = "wire-groups")]
18015impl WireGroups {
18016 /// Returns a builder for [WireGroups].
18017 ///
18018 /// ```
18019 /// # tokio_test::block_on(async {
18020 /// # use google_cloud_compute_v1::client::WireGroups;
18021 /// let client = WireGroups::builder().build().await?;
18022 /// # gax::client_builder::Result::<()>::Ok(()) });
18023 /// ```
18024 pub fn builder() -> super::builder::wire_groups::ClientBuilder {
18025 gax::client_builder::internal::new_builder(super::builder::wire_groups::client::Factory)
18026 }
18027
18028 /// Creates a new client from the provided stub.
18029 ///
18030 /// The most common case for calling this function is in tests mocking the
18031 /// client's behavior.
18032 pub fn from_stub<T>(stub: T) -> Self
18033 where
18034 T: super::stub::WireGroups + 'static,
18035 {
18036 Self {
18037 inner: std::sync::Arc::new(stub),
18038 }
18039 }
18040
18041 pub(crate) async fn new(
18042 config: gaxi::options::ClientConfig,
18043 ) -> gax::client_builder::Result<Self> {
18044 let inner = Self::build_inner(config).await?;
18045 Ok(Self { inner })
18046 }
18047
18048 async fn build_inner(
18049 conf: gaxi::options::ClientConfig,
18050 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::WireGroups>> {
18051 if gaxi::options::tracing_enabled(&conf) {
18052 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18053 }
18054 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18055 }
18056
18057 async fn build_transport(
18058 conf: gaxi::options::ClientConfig,
18059 ) -> gax::client_builder::Result<impl super::stub::WireGroups> {
18060 super::transport::WireGroups::new(conf).await
18061 }
18062
18063 async fn build_with_tracing(
18064 conf: gaxi::options::ClientConfig,
18065 ) -> gax::client_builder::Result<impl super::stub::WireGroups> {
18066 Self::build_transport(conf)
18067 .await
18068 .map(super::tracing::WireGroups::new)
18069 }
18070
18071 /// Deletes the specified wire group in the given scope.
18072 pub fn delete(&self) -> super::builder::wire_groups::Delete {
18073 super::builder::wire_groups::Delete::new(self.inner.clone())
18074 }
18075
18076 /// Gets the specified wire group resource in the given scope.
18077 pub fn get(&self) -> super::builder::wire_groups::Get {
18078 super::builder::wire_groups::Get::new(self.inner.clone())
18079 }
18080
18081 /// Creates a wire group in the specified project in the given scope
18082 /// using the parameters that are included in the request.
18083 pub fn insert(&self) -> super::builder::wire_groups::Insert {
18084 super::builder::wire_groups::Insert::new(self.inner.clone())
18085 }
18086
18087 /// Lists the wire groups for a project in the given scope.
18088 pub fn list(&self) -> super::builder::wire_groups::List {
18089 super::builder::wire_groups::List::new(self.inner.clone())
18090 }
18091
18092 /// Updates the specified wire group resource with the data included in the
18093 /// request. This method supportsPATCH
18094 /// semantics and usesJSON merge
18095 /// patch format and processing rules.
18096 pub fn patch(&self) -> super::builder::wire_groups::Patch {
18097 super::builder::wire_groups::Patch::new(self.inner.clone())
18098 }
18099
18100 /// Retrieves the specified Operations resource.
18101 pub fn get_operation(&self) -> super::builder::wire_groups::GetOperation {
18102 super::builder::wire_groups::GetOperation::new(self.inner.clone())
18103 }
18104}
18105
18106/// Implements a client for the Google Compute Engine API.
18107///
18108/// # Example
18109/// ```
18110/// # tokio_test::block_on(async {
18111/// # use google_cloud_compute_v1::client::ZoneOperations;
18112/// let client = ZoneOperations::builder().build().await?;
18113/// // use `client` to make requests to the Google Compute Engine API.
18114/// # gax::client_builder::Result::<()>::Ok(()) });
18115/// ```
18116///
18117/// # Service Description
18118///
18119/// Service for the `zoneOperations` resource.
18120///
18121/// # Configuration
18122///
18123/// To configure `ZoneOperations` use the `with_*` methods in the type returned
18124/// by [builder()][ZoneOperations::builder]. The default configuration should
18125/// work for most applications. Common configuration changes include
18126///
18127/// * [with_endpoint()]: by default this client uses the global default endpoint
18128/// (`https://compute.googleapis.com`). Applications using regional
18129/// endpoints or running in restricted networks (e.g. a network configured
18130// with [Private Google Access with VPC Service Controls]) may want to
18131/// override this default.
18132/// * [with_credentials()]: by default this client uses
18133/// [Application Default Credentials]. Applications using custom
18134/// authentication may need to override this default.
18135///
18136/// [with_endpoint()]: super::builder::zone_operations::ClientBuilder::with_endpoint
18137/// [with_credentials()]: super::builder::zone_operations::ClientBuilder::credentials
18138/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18139/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18140///
18141/// # Pooling and Cloning
18142///
18143/// `ZoneOperations` holds a connection pool internally, it is advised to
18144/// create one and the reuse it. You do not need to wrap `ZoneOperations` in
18145/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18146/// already uses an `Arc` internally.
18147#[cfg(feature = "zone-operations")]
18148#[cfg_attr(docsrs, doc(cfg(feature = "zone-operations")))]
18149#[derive(Clone, Debug)]
18150pub struct ZoneOperations {
18151 inner: std::sync::Arc<dyn super::stub::dynamic::ZoneOperations>,
18152}
18153
18154#[cfg(feature = "zone-operations")]
18155impl ZoneOperations {
18156 /// Returns a builder for [ZoneOperations].
18157 ///
18158 /// ```
18159 /// # tokio_test::block_on(async {
18160 /// # use google_cloud_compute_v1::client::ZoneOperations;
18161 /// let client = ZoneOperations::builder().build().await?;
18162 /// # gax::client_builder::Result::<()>::Ok(()) });
18163 /// ```
18164 pub fn builder() -> super::builder::zone_operations::ClientBuilder {
18165 gax::client_builder::internal::new_builder(super::builder::zone_operations::client::Factory)
18166 }
18167
18168 /// Creates a new client from the provided stub.
18169 ///
18170 /// The most common case for calling this function is in tests mocking the
18171 /// client's behavior.
18172 pub fn from_stub<T>(stub: T) -> Self
18173 where
18174 T: super::stub::ZoneOperations + 'static,
18175 {
18176 Self {
18177 inner: std::sync::Arc::new(stub),
18178 }
18179 }
18180
18181 pub(crate) async fn new(
18182 config: gaxi::options::ClientConfig,
18183 ) -> gax::client_builder::Result<Self> {
18184 let inner = Self::build_inner(config).await?;
18185 Ok(Self { inner })
18186 }
18187
18188 async fn build_inner(
18189 conf: gaxi::options::ClientConfig,
18190 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::ZoneOperations>> {
18191 if gaxi::options::tracing_enabled(&conf) {
18192 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18193 }
18194 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18195 }
18196
18197 async fn build_transport(
18198 conf: gaxi::options::ClientConfig,
18199 ) -> gax::client_builder::Result<impl super::stub::ZoneOperations> {
18200 super::transport::ZoneOperations::new(conf).await
18201 }
18202
18203 async fn build_with_tracing(
18204 conf: gaxi::options::ClientConfig,
18205 ) -> gax::client_builder::Result<impl super::stub::ZoneOperations> {
18206 Self::build_transport(conf)
18207 .await
18208 .map(super::tracing::ZoneOperations::new)
18209 }
18210
18211 /// Deletes the specified zone-specific Operations resource.
18212 pub fn delete(&self) -> super::builder::zone_operations::Delete {
18213 super::builder::zone_operations::Delete::new(self.inner.clone())
18214 }
18215
18216 /// Retrieves the specified zone-specific Operations resource.
18217 pub fn get(&self) -> super::builder::zone_operations::Get {
18218 super::builder::zone_operations::Get::new(self.inner.clone())
18219 }
18220
18221 /// Retrieves a list of Operation resources contained within
18222 /// the specified zone.
18223 pub fn list(&self) -> super::builder::zone_operations::List {
18224 super::builder::zone_operations::List::new(self.inner.clone())
18225 }
18226
18227 /// Waits for the specified Operation resource to return as `DONE`
18228 /// or for the request to approach the 2 minute deadline, and retrieves the
18229 /// specified Operation resource. This method waits for no more than the
18230 /// 2 minutes and then returns the current state of the
18231 /// operation, which might be `DONE` or still in progress.
18232 ///
18233 /// This method is called on a best-effort basis. Specifically:
18234 ///
18235 /// ```norust
18236 /// - In uncommon cases, when the server is overloaded, the request might
18237 /// return before the default deadline is reached, or might return after zero
18238 /// seconds.
18239 /// ```
18240 ///
18241 /// - If the default deadline is reached, there is no guarantee that the
18242 /// operation is actually done when the method returns. Be prepared to retry
18243 /// if the operation is not `DONE`.
18244 pub fn wait(&self) -> super::builder::zone_operations::Wait {
18245 super::builder::zone_operations::Wait::new(self.inner.clone())
18246 }
18247}
18248
18249/// Implements a client for the Google Compute Engine API.
18250///
18251/// # Example
18252/// ```
18253/// # tokio_test::block_on(async {
18254/// # use google_cloud_compute_v1::client::Zones;
18255/// let client = Zones::builder().build().await?;
18256/// // use `client` to make requests to the Google Compute Engine API.
18257/// # gax::client_builder::Result::<()>::Ok(()) });
18258/// ```
18259///
18260/// # Service Description
18261///
18262/// Service for the `zones` resource.
18263///
18264/// # Configuration
18265///
18266/// To configure `Zones` use the `with_*` methods in the type returned
18267/// by [builder()][Zones::builder]. The default configuration should
18268/// work for most applications. Common configuration changes include
18269///
18270/// * [with_endpoint()]: by default this client uses the global default endpoint
18271/// (`https://compute.googleapis.com`). Applications using regional
18272/// endpoints or running in restricted networks (e.g. a network configured
18273// with [Private Google Access with VPC Service Controls]) may want to
18274/// override this default.
18275/// * [with_credentials()]: by default this client uses
18276/// [Application Default Credentials]. Applications using custom
18277/// authentication may need to override this default.
18278///
18279/// [with_endpoint()]: super::builder::zones::ClientBuilder::with_endpoint
18280/// [with_credentials()]: super::builder::zones::ClientBuilder::credentials
18281/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
18282/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
18283///
18284/// # Pooling and Cloning
18285///
18286/// `Zones` holds a connection pool internally, it is advised to
18287/// create one and the reuse it. You do not need to wrap `Zones` in
18288/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
18289/// already uses an `Arc` internally.
18290#[cfg(feature = "zones")]
18291#[cfg_attr(docsrs, doc(cfg(feature = "zones")))]
18292#[derive(Clone, Debug)]
18293pub struct Zones {
18294 inner: std::sync::Arc<dyn super::stub::dynamic::Zones>,
18295}
18296
18297#[cfg(feature = "zones")]
18298impl Zones {
18299 /// Returns a builder for [Zones].
18300 ///
18301 /// ```
18302 /// # tokio_test::block_on(async {
18303 /// # use google_cloud_compute_v1::client::Zones;
18304 /// let client = Zones::builder().build().await?;
18305 /// # gax::client_builder::Result::<()>::Ok(()) });
18306 /// ```
18307 pub fn builder() -> super::builder::zones::ClientBuilder {
18308 gax::client_builder::internal::new_builder(super::builder::zones::client::Factory)
18309 }
18310
18311 /// Creates a new client from the provided stub.
18312 ///
18313 /// The most common case for calling this function is in tests mocking the
18314 /// client's behavior.
18315 pub fn from_stub<T>(stub: T) -> Self
18316 where
18317 T: super::stub::Zones + 'static,
18318 {
18319 Self {
18320 inner: std::sync::Arc::new(stub),
18321 }
18322 }
18323
18324 pub(crate) async fn new(
18325 config: gaxi::options::ClientConfig,
18326 ) -> gax::client_builder::Result<Self> {
18327 let inner = Self::build_inner(config).await?;
18328 Ok(Self { inner })
18329 }
18330
18331 async fn build_inner(
18332 conf: gaxi::options::ClientConfig,
18333 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::Zones>> {
18334 if gaxi::options::tracing_enabled(&conf) {
18335 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
18336 }
18337 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
18338 }
18339
18340 async fn build_transport(
18341 conf: gaxi::options::ClientConfig,
18342 ) -> gax::client_builder::Result<impl super::stub::Zones> {
18343 super::transport::Zones::new(conf).await
18344 }
18345
18346 async fn build_with_tracing(
18347 conf: gaxi::options::ClientConfig,
18348 ) -> gax::client_builder::Result<impl super::stub::Zones> {
18349 Self::build_transport(conf)
18350 .await
18351 .map(super::tracing::Zones::new)
18352 }
18353
18354 /// Returns the specified Zone resource.
18355 pub fn get(&self) -> super::builder::zones::Get {
18356 super::builder::zones::Get::new(self.inner.clone())
18357 }
18358
18359 /// Retrieves the list of Zone resources available to the specified project.
18360 pub fn list(&self) -> super::builder::zones::List {
18361 super::builder::zones::List::new(self.inner.clone())
18362 }
18363}