Skip to main content

google_cloud_edgecontainer_v1/
client.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Distributed Cloud Edge Container API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28///    project_id: &str,
29///    location_id: &str,
30/// ) -> anyhow::Result<()> {
31///     let client = EdgeContainer::builder().build().await?;
32///     let mut list = client.list_clusters()
33///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
34///         .by_item();
35///     while let Some(item) = list.next().await.transpose()? {
36///         println!("{:?}", item);
37///     }
38///     Ok(())
39/// }
40/// ```
41///
42/// # Service Description
43///
44/// EdgeContainer API provides management of Kubernetes Clusters on Google Edge
45/// Cloud deployments.
46///
47/// # Configuration
48///
49/// To configure `EdgeContainer` use the `with_*` methods in the type returned
50/// by [builder()][EdgeContainer::builder]. The default configuration should
51/// work for most applications. Common configuration changes include
52///
53/// * [with_endpoint()]: by default this client uses the global default endpoint
54///   (`https://edgecontainer.googleapis.com`). Applications using regional
55///   endpoints or running in restricted networks (e.g. a network configured
56///   with [Private Google Access with VPC Service Controls]) may want to
57///   override this default.
58/// * [with_credentials()]: by default this client uses
59///   [Application Default Credentials]. Applications using custom
60///   authentication may need to override this default.
61///
62/// [with_endpoint()]: super::builder::edge_container::ClientBuilder::with_endpoint
63/// [with_credentials()]: super::builder::edge_container::ClientBuilder::with_credentials
64/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
65/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
66///
67/// # Pooling and Cloning
68///
69/// `EdgeContainer` holds a connection pool internally, it is advised to
70/// create one and reuse it. You do not need to wrap `EdgeContainer` in
71/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
72/// already uses an `Arc` internally.
73#[derive(Clone, Debug)]
74pub struct EdgeContainer {
75    inner: std::sync::Arc<dyn super::stub::dynamic::EdgeContainer>,
76}
77
78impl EdgeContainer {
79    /// Returns a builder for [EdgeContainer].
80    ///
81    /// ```
82    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
83    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
84    /// let client = EdgeContainer::builder().build().await?;
85    /// # Ok(()) }
86    /// ```
87    pub fn builder() -> super::builder::edge_container::ClientBuilder {
88        crate::new_client_builder(super::builder::edge_container::client::Factory)
89    }
90
91    /// Creates a new client from the provided stub.
92    ///
93    /// The most common case for calling this function is in tests mocking the
94    /// client's behavior.
95    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
96    where
97        T: super::stub::EdgeContainer + 'static,
98    {
99        Self { inner: stub.into() }
100    }
101
102    pub(crate) async fn new(
103        config: gaxi::options::ClientConfig,
104    ) -> crate::ClientBuilderResult<Self> {
105        let inner = Self::build_inner(config).await?;
106        Ok(Self { inner })
107    }
108
109    async fn build_inner(
110        conf: gaxi::options::ClientConfig,
111    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::EdgeContainer>> {
112        if gaxi::options::tracing_enabled(&conf) {
113            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
114        }
115        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
116    }
117
118    async fn build_transport(
119        conf: gaxi::options::ClientConfig,
120    ) -> crate::ClientBuilderResult<impl super::stub::EdgeContainer> {
121        super::transport::EdgeContainer::new(conf).await
122    }
123
124    async fn build_with_tracing(
125        conf: gaxi::options::ClientConfig,
126    ) -> crate::ClientBuilderResult<impl super::stub::EdgeContainer> {
127        Self::build_transport(conf)
128            .await
129            .map(super::tracing::EdgeContainer::new)
130    }
131
132    /// Lists Clusters in a given project and location.
133    ///
134    /// # Example
135    /// ```
136    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
137    /// use google_cloud_gax::paginator::ItemPaginator as _;
138    /// use google_cloud_edgecontainer_v1::Result;
139    /// async fn sample(
140    ///    client: &EdgeContainer, project_id: &str, location_id: &str
141    /// ) -> Result<()> {
142    ///     let mut list = client.list_clusters()
143    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
144    ///         .by_item();
145    ///     while let Some(item) = list.next().await.transpose()? {
146    ///         println!("{:?}", item);
147    ///     }
148    ///     Ok(())
149    /// }
150    /// ```
151    pub fn list_clusters(&self) -> super::builder::edge_container::ListClusters {
152        super::builder::edge_container::ListClusters::new(self.inner.clone())
153    }
154
155    /// Gets details of a single Cluster.
156    ///
157    /// # Example
158    /// ```
159    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
160    /// use google_cloud_edgecontainer_v1::Result;
161    /// async fn sample(
162    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str
163    /// ) -> Result<()> {
164    ///     let response = client.get_cluster()
165    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
166    ///         .send().await?;
167    ///     println!("response {:?}", response);
168    ///     Ok(())
169    /// }
170    /// ```
171    pub fn get_cluster(&self) -> super::builder::edge_container::GetCluster {
172        super::builder::edge_container::GetCluster::new(self.inner.clone())
173    }
174
175    /// Creates a new Cluster in a given project and location.
176    ///
177    /// # Long running operations
178    ///
179    /// This method is used to start, and/or poll a [long-running Operation].
180    /// The [Working with long-running operations] chapter in the [user guide]
181    /// covers these operations in detail.
182    ///
183    /// [long-running operation]: https://google.aip.dev/151
184    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
185    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
186    ///
187    /// # Example
188    /// ```
189    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
190    /// use google_cloud_lro::Poller;
191    /// use google_cloud_edgecontainer_v1::model::Cluster;
192    /// use google_cloud_edgecontainer_v1::Result;
193    /// async fn sample(
194    ///    client: &EdgeContainer, project_id: &str, location_id: &str
195    /// ) -> Result<()> {
196    ///     let response = client.create_cluster()
197    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
198    ///         .set_cluster_id("cluster_id_value")
199    ///         .set_cluster(
200    ///             Cluster::new()/* set fields */
201    ///         )
202    ///         .poller().until_done().await?;
203    ///     println!("response {:?}", response);
204    ///     Ok(())
205    /// }
206    /// ```
207    pub fn create_cluster(&self) -> super::builder::edge_container::CreateCluster {
208        super::builder::edge_container::CreateCluster::new(self.inner.clone())
209    }
210
211    /// Updates the parameters of a single Cluster.
212    ///
213    /// # Long running operations
214    ///
215    /// This method is used to start, and/or poll a [long-running Operation].
216    /// The [Working with long-running operations] chapter in the [user guide]
217    /// covers these operations in detail.
218    ///
219    /// [long-running operation]: https://google.aip.dev/151
220    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
221    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
222    ///
223    /// # Example
224    /// ```
225    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
226    /// use google_cloud_lro::Poller;
227    /// # extern crate wkt as google_cloud_wkt;
228    /// use google_cloud_wkt::FieldMask;
229    /// use google_cloud_edgecontainer_v1::model::Cluster;
230    /// use google_cloud_edgecontainer_v1::Result;
231    /// async fn sample(
232    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str
233    /// ) -> Result<()> {
234    ///     let response = client.update_cluster()
235    ///         .set_cluster(
236    ///             Cluster::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))/* set fields */
237    ///         )
238    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
239    ///         .poller().until_done().await?;
240    ///     println!("response {:?}", response);
241    ///     Ok(())
242    /// }
243    /// ```
244    pub fn update_cluster(&self) -> super::builder::edge_container::UpdateCluster {
245        super::builder::edge_container::UpdateCluster::new(self.inner.clone())
246    }
247
248    /// Upgrades a single cluster.
249    ///
250    /// # Long running operations
251    ///
252    /// This method is used to start, and/or poll a [long-running Operation].
253    /// The [Working with long-running operations] chapter in the [user guide]
254    /// covers these operations in detail.
255    ///
256    /// [long-running operation]: https://google.aip.dev/151
257    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
258    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
259    ///
260    /// # Example
261    /// ```
262    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
263    /// use google_cloud_lro::Poller;
264    /// use google_cloud_edgecontainer_v1::Result;
265    /// async fn sample(
266    ///    client: &EdgeContainer
267    /// ) -> Result<()> {
268    ///     let response = client.upgrade_cluster()
269    ///         /* set fields */
270    ///         .poller().until_done().await?;
271    ///     println!("response {:?}", response);
272    ///     Ok(())
273    /// }
274    /// ```
275    pub fn upgrade_cluster(&self) -> super::builder::edge_container::UpgradeCluster {
276        super::builder::edge_container::UpgradeCluster::new(self.inner.clone())
277    }
278
279    /// Deletes a single Cluster.
280    ///
281    /// # Long running operations
282    ///
283    /// This method is used to start, and/or poll a [long-running Operation].
284    /// The [Working with long-running operations] chapter in the [user guide]
285    /// covers these operations in detail.
286    ///
287    /// [long-running operation]: https://google.aip.dev/151
288    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
289    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
290    ///
291    /// # Example
292    /// ```
293    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
294    /// use google_cloud_lro::Poller;
295    /// use google_cloud_edgecontainer_v1::Result;
296    /// async fn sample(
297    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str
298    /// ) -> Result<()> {
299    ///     client.delete_cluster()
300    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
301    ///         .poller().until_done().await?;
302    ///     Ok(())
303    /// }
304    /// ```
305    pub fn delete_cluster(&self) -> super::builder::edge_container::DeleteCluster {
306        super::builder::edge_container::DeleteCluster::new(self.inner.clone())
307    }
308
309    /// Generates an access token for a Cluster.
310    ///
311    /// # Example
312    /// ```
313    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
314    /// use google_cloud_edgecontainer_v1::Result;
315    /// async fn sample(
316    ///    client: &EdgeContainer
317    /// ) -> Result<()> {
318    ///     let response = client.generate_access_token()
319    ///         /* set fields */
320    ///         .send().await?;
321    ///     println!("response {:?}", response);
322    ///     Ok(())
323    /// }
324    /// ```
325    pub fn generate_access_token(&self) -> super::builder::edge_container::GenerateAccessToken {
326        super::builder::edge_container::GenerateAccessToken::new(self.inner.clone())
327    }
328
329    /// Generates an offline credential for a Cluster.
330    ///
331    /// # Example
332    /// ```
333    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
334    /// use google_cloud_edgecontainer_v1::Result;
335    /// async fn sample(
336    ///    client: &EdgeContainer
337    /// ) -> Result<()> {
338    ///     let response = client.generate_offline_credential()
339    ///         /* set fields */
340    ///         .send().await?;
341    ///     println!("response {:?}", response);
342    ///     Ok(())
343    /// }
344    /// ```
345    pub fn generate_offline_credential(
346        &self,
347    ) -> super::builder::edge_container::GenerateOfflineCredential {
348        super::builder::edge_container::GenerateOfflineCredential::new(self.inner.clone())
349    }
350
351    /// Lists NodePools in a given project and location.
352    ///
353    /// # Example
354    /// ```
355    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
356    /// use google_cloud_gax::paginator::ItemPaginator as _;
357    /// use google_cloud_edgecontainer_v1::Result;
358    /// async fn sample(
359    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str
360    /// ) -> Result<()> {
361    ///     let mut list = client.list_node_pools()
362    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
363    ///         .by_item();
364    ///     while let Some(item) = list.next().await.transpose()? {
365    ///         println!("{:?}", item);
366    ///     }
367    ///     Ok(())
368    /// }
369    /// ```
370    pub fn list_node_pools(&self) -> super::builder::edge_container::ListNodePools {
371        super::builder::edge_container::ListNodePools::new(self.inner.clone())
372    }
373
374    /// Gets details of a single NodePool.
375    ///
376    /// # Example
377    /// ```
378    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
379    /// use google_cloud_edgecontainer_v1::Result;
380    /// async fn sample(
381    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str, node_pool_id: &str
382    /// ) -> Result<()> {
383    ///     let response = client.get_node_pool()
384    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/nodePools/{node_pool_id}"))
385    ///         .send().await?;
386    ///     println!("response {:?}", response);
387    ///     Ok(())
388    /// }
389    /// ```
390    pub fn get_node_pool(&self) -> super::builder::edge_container::GetNodePool {
391        super::builder::edge_container::GetNodePool::new(self.inner.clone())
392    }
393
394    /// Creates a new NodePool in a given project and location.
395    ///
396    /// # Long running operations
397    ///
398    /// This method is used to start, and/or poll a [long-running Operation].
399    /// The [Working with long-running operations] chapter in the [user guide]
400    /// covers these operations in detail.
401    ///
402    /// [long-running operation]: https://google.aip.dev/151
403    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
404    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
405    ///
406    /// # Example
407    /// ```
408    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
409    /// use google_cloud_lro::Poller;
410    /// use google_cloud_edgecontainer_v1::model::NodePool;
411    /// use google_cloud_edgecontainer_v1::Result;
412    /// async fn sample(
413    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str
414    /// ) -> Result<()> {
415    ///     let response = client.create_node_pool()
416    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}"))
417    ///         .set_node_pool(
418    ///             NodePool::new()/* set fields */
419    ///         )
420    ///         .poller().until_done().await?;
421    ///     println!("response {:?}", response);
422    ///     Ok(())
423    /// }
424    /// ```
425    pub fn create_node_pool(&self) -> super::builder::edge_container::CreateNodePool {
426        super::builder::edge_container::CreateNodePool::new(self.inner.clone())
427    }
428
429    /// Updates the parameters of a single NodePool.
430    ///
431    /// # Long running operations
432    ///
433    /// This method is used to start, and/or poll a [long-running Operation].
434    /// The [Working with long-running operations] chapter in the [user guide]
435    /// covers these operations in detail.
436    ///
437    /// [long-running operation]: https://google.aip.dev/151
438    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
439    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
440    ///
441    /// # Example
442    /// ```
443    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
444    /// use google_cloud_lro::Poller;
445    /// # extern crate wkt as google_cloud_wkt;
446    /// use google_cloud_wkt::FieldMask;
447    /// use google_cloud_edgecontainer_v1::model::NodePool;
448    /// use google_cloud_edgecontainer_v1::Result;
449    /// async fn sample(
450    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str, node_pool_id: &str
451    /// ) -> Result<()> {
452    ///     let response = client.update_node_pool()
453    ///         .set_node_pool(
454    ///             NodePool::new().set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/nodePools/{node_pool_id}"))/* set fields */
455    ///         )
456    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
457    ///         .poller().until_done().await?;
458    ///     println!("response {:?}", response);
459    ///     Ok(())
460    /// }
461    /// ```
462    pub fn update_node_pool(&self) -> super::builder::edge_container::UpdateNodePool {
463        super::builder::edge_container::UpdateNodePool::new(self.inner.clone())
464    }
465
466    /// Deletes a single NodePool.
467    ///
468    /// # Long running operations
469    ///
470    /// This method is used to start, and/or poll a [long-running Operation].
471    /// The [Working with long-running operations] chapter in the [user guide]
472    /// covers these operations in detail.
473    ///
474    /// [long-running operation]: https://google.aip.dev/151
475    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
476    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
477    ///
478    /// # Example
479    /// ```
480    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
481    /// use google_cloud_lro::Poller;
482    /// use google_cloud_edgecontainer_v1::Result;
483    /// async fn sample(
484    ///    client: &EdgeContainer, project_id: &str, location_id: &str, cluster_id: &str, node_pool_id: &str
485    /// ) -> Result<()> {
486    ///     client.delete_node_pool()
487    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/nodePools/{node_pool_id}"))
488    ///         .poller().until_done().await?;
489    ///     Ok(())
490    /// }
491    /// ```
492    pub fn delete_node_pool(&self) -> super::builder::edge_container::DeleteNodePool {
493        super::builder::edge_container::DeleteNodePool::new(self.inner.clone())
494    }
495
496    /// Lists Machines in a given project and location.
497    ///
498    /// # Example
499    /// ```
500    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
501    /// use google_cloud_gax::paginator::ItemPaginator as _;
502    /// use google_cloud_edgecontainer_v1::Result;
503    /// async fn sample(
504    ///    client: &EdgeContainer, project_id: &str, location_id: &str
505    /// ) -> Result<()> {
506    ///     let mut list = client.list_machines()
507    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
508    ///         .by_item();
509    ///     while let Some(item) = list.next().await.transpose()? {
510    ///         println!("{:?}", item);
511    ///     }
512    ///     Ok(())
513    /// }
514    /// ```
515    pub fn list_machines(&self) -> super::builder::edge_container::ListMachines {
516        super::builder::edge_container::ListMachines::new(self.inner.clone())
517    }
518
519    /// Gets details of a single Machine.
520    ///
521    /// # Example
522    /// ```
523    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
524    /// use google_cloud_edgecontainer_v1::Result;
525    /// async fn sample(
526    ///    client: &EdgeContainer, project_id: &str, location_id: &str, machine_id: &str
527    /// ) -> Result<()> {
528    ///     let response = client.get_machine()
529    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/machines/{machine_id}"))
530    ///         .send().await?;
531    ///     println!("response {:?}", response);
532    ///     Ok(())
533    /// }
534    /// ```
535    pub fn get_machine(&self) -> super::builder::edge_container::GetMachine {
536        super::builder::edge_container::GetMachine::new(self.inner.clone())
537    }
538
539    /// Lists VPN connections in a given project and location.
540    ///
541    /// # Example
542    /// ```
543    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
544    /// use google_cloud_gax::paginator::ItemPaginator as _;
545    /// use google_cloud_edgecontainer_v1::Result;
546    /// async fn sample(
547    ///    client: &EdgeContainer, project_id: &str, location_id: &str
548    /// ) -> Result<()> {
549    ///     let mut list = client.list_vpn_connections()
550    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
551    ///         .by_item();
552    ///     while let Some(item) = list.next().await.transpose()? {
553    ///         println!("{:?}", item);
554    ///     }
555    ///     Ok(())
556    /// }
557    /// ```
558    pub fn list_vpn_connections(&self) -> super::builder::edge_container::ListVpnConnections {
559        super::builder::edge_container::ListVpnConnections::new(self.inner.clone())
560    }
561
562    /// Gets details of a single VPN connection.
563    ///
564    /// # Example
565    /// ```
566    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
567    /// use google_cloud_edgecontainer_v1::Result;
568    /// async fn sample(
569    ///    client: &EdgeContainer, project_id: &str, location_id: &str, vpn_connection_id: &str
570    /// ) -> Result<()> {
571    ///     let response = client.get_vpn_connection()
572    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/vpnConnections/{vpn_connection_id}"))
573    ///         .send().await?;
574    ///     println!("response {:?}", response);
575    ///     Ok(())
576    /// }
577    /// ```
578    pub fn get_vpn_connection(&self) -> super::builder::edge_container::GetVpnConnection {
579        super::builder::edge_container::GetVpnConnection::new(self.inner.clone())
580    }
581
582    /// Creates a new VPN connection in a given project and location.
583    ///
584    /// # Long running operations
585    ///
586    /// This method is used to start, and/or poll a [long-running Operation].
587    /// The [Working with long-running operations] chapter in the [user guide]
588    /// covers these operations in detail.
589    ///
590    /// [long-running operation]: https://google.aip.dev/151
591    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
592    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
593    ///
594    /// # Example
595    /// ```
596    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
597    /// use google_cloud_lro::Poller;
598    /// use google_cloud_edgecontainer_v1::model::VpnConnection;
599    /// use google_cloud_edgecontainer_v1::Result;
600    /// async fn sample(
601    ///    client: &EdgeContainer, project_id: &str, location_id: &str
602    /// ) -> Result<()> {
603    ///     let response = client.create_vpn_connection()
604    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
605    ///         .set_vpn_connection(
606    ///             VpnConnection::new()/* set fields */
607    ///         )
608    ///         .poller().until_done().await?;
609    ///     println!("response {:?}", response);
610    ///     Ok(())
611    /// }
612    /// ```
613    pub fn create_vpn_connection(&self) -> super::builder::edge_container::CreateVpnConnection {
614        super::builder::edge_container::CreateVpnConnection::new(self.inner.clone())
615    }
616
617    /// Deletes a single VPN connection.
618    ///
619    /// # Long running operations
620    ///
621    /// This method is used to start, and/or poll a [long-running Operation].
622    /// The [Working with long-running operations] chapter in the [user guide]
623    /// covers these operations in detail.
624    ///
625    /// [long-running operation]: https://google.aip.dev/151
626    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
627    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
628    ///
629    /// # Example
630    /// ```
631    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
632    /// use google_cloud_lro::Poller;
633    /// use google_cloud_edgecontainer_v1::Result;
634    /// async fn sample(
635    ///    client: &EdgeContainer, project_id: &str, location_id: &str, vpn_connection_id: &str
636    /// ) -> Result<()> {
637    ///     client.delete_vpn_connection()
638    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/vpnConnections/{vpn_connection_id}"))
639    ///         .poller().until_done().await?;
640    ///     Ok(())
641    /// }
642    /// ```
643    pub fn delete_vpn_connection(&self) -> super::builder::edge_container::DeleteVpnConnection {
644        super::builder::edge_container::DeleteVpnConnection::new(self.inner.clone())
645    }
646
647    /// Gets the server config.
648    ///
649    /// # Example
650    /// ```
651    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
652    /// use google_cloud_edgecontainer_v1::Result;
653    /// async fn sample(
654    ///    client: &EdgeContainer
655    /// ) -> Result<()> {
656    ///     let response = client.get_server_config()
657    ///         /* set fields */
658    ///         .send().await?;
659    ///     println!("response {:?}", response);
660    ///     Ok(())
661    /// }
662    /// ```
663    pub fn get_server_config(&self) -> super::builder::edge_container::GetServerConfig {
664        super::builder::edge_container::GetServerConfig::new(self.inner.clone())
665    }
666
667    /// Lists information about the supported locations for this service.
668    ///
669    /// # Example
670    /// ```
671    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
672    /// use google_cloud_gax::paginator::ItemPaginator as _;
673    /// use google_cloud_edgecontainer_v1::Result;
674    /// async fn sample(
675    ///    client: &EdgeContainer
676    /// ) -> Result<()> {
677    ///     let mut list = client.list_locations()
678    ///         /* set fields */
679    ///         .by_item();
680    ///     while let Some(item) = list.next().await.transpose()? {
681    ///         println!("{:?}", item);
682    ///     }
683    ///     Ok(())
684    /// }
685    /// ```
686    pub fn list_locations(&self) -> super::builder::edge_container::ListLocations {
687        super::builder::edge_container::ListLocations::new(self.inner.clone())
688    }
689
690    /// Gets information about a location.
691    ///
692    /// # Example
693    /// ```
694    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
695    /// use google_cloud_edgecontainer_v1::Result;
696    /// async fn sample(
697    ///    client: &EdgeContainer
698    /// ) -> Result<()> {
699    ///     let response = client.get_location()
700    ///         /* set fields */
701    ///         .send().await?;
702    ///     println!("response {:?}", response);
703    ///     Ok(())
704    /// }
705    /// ```
706    pub fn get_location(&self) -> super::builder::edge_container::GetLocation {
707        super::builder::edge_container::GetLocation::new(self.inner.clone())
708    }
709
710    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
711    ///
712    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
713    ///
714    /// # Example
715    /// ```
716    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
717    /// use google_cloud_gax::paginator::ItemPaginator as _;
718    /// use google_cloud_edgecontainer_v1::Result;
719    /// async fn sample(
720    ///    client: &EdgeContainer
721    /// ) -> Result<()> {
722    ///     let mut list = client.list_operations()
723    ///         /* set fields */
724    ///         .by_item();
725    ///     while let Some(item) = list.next().await.transpose()? {
726    ///         println!("{:?}", item);
727    ///     }
728    ///     Ok(())
729    /// }
730    /// ```
731    pub fn list_operations(&self) -> super::builder::edge_container::ListOperations {
732        super::builder::edge_container::ListOperations::new(self.inner.clone())
733    }
734
735    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
736    ///
737    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
738    ///
739    /// # Example
740    /// ```
741    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
742    /// use google_cloud_edgecontainer_v1::Result;
743    /// async fn sample(
744    ///    client: &EdgeContainer
745    /// ) -> Result<()> {
746    ///     let response = client.get_operation()
747    ///         /* set fields */
748    ///         .send().await?;
749    ///     println!("response {:?}", response);
750    ///     Ok(())
751    /// }
752    /// ```
753    pub fn get_operation(&self) -> super::builder::edge_container::GetOperation {
754        super::builder::edge_container::GetOperation::new(self.inner.clone())
755    }
756
757    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
758    ///
759    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
760    ///
761    /// # Example
762    /// ```
763    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
764    /// use google_cloud_edgecontainer_v1::Result;
765    /// async fn sample(
766    ///    client: &EdgeContainer
767    /// ) -> Result<()> {
768    ///     client.delete_operation()
769    ///         /* set fields */
770    ///         .send().await?;
771    ///     Ok(())
772    /// }
773    /// ```
774    pub fn delete_operation(&self) -> super::builder::edge_container::DeleteOperation {
775        super::builder::edge_container::DeleteOperation::new(self.inner.clone())
776    }
777
778    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
779    ///
780    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
781    ///
782    /// # Example
783    /// ```
784    /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
785    /// use google_cloud_edgecontainer_v1::Result;
786    /// async fn sample(
787    ///    client: &EdgeContainer
788    /// ) -> Result<()> {
789    ///     client.cancel_operation()
790    ///         /* set fields */
791    ///         .send().await?;
792    ///     Ok(())
793    /// }
794    /// ```
795    pub fn cancel_operation(&self) -> super::builder::edge_container::CancelOperation {
796        super::builder::edge_container::CancelOperation::new(self.inner.clone())
797    }
798}