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