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
19use crate::Result;
20use std::sync::Arc;
21
22/// Implements a client for the Distributed Cloud Edge Container API.
23///
24/// # Service Description
25///
26/// EdgeContainer API provides management of Kubernetes Clusters on Google Edge
27/// Cloud deployments.
28///
29/// # Configuration
30///
31/// `EdgeContainer` has various configuration parameters, the defaults should
32/// work with most applications.
33///
34/// # Pooling and Cloning
35///
36/// `EdgeContainer` holds a connection pool internally, it is advised to
37/// create one and the reuse it.  You do not need to wrap `EdgeContainer` in
38/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc`
39/// internally.
40#[derive(Clone, Debug)]
41pub struct EdgeContainer {
42    inner: Arc<dyn crate::stubs::dynamic::EdgeContainer>,
43}
44
45impl EdgeContainer {
46    /// Creates a new client with the default configuration.
47    pub async fn new() -> Result<Self> {
48        Self::new_with_config(gax::options::ClientConfig::default()).await
49    }
50
51    /// Creates a new client with the specified configuration.
52    pub async fn new_with_config(conf: gax::options::ClientConfig) -> Result<Self> {
53        let inner = Self::build_inner(conf).await?;
54        Ok(Self { inner })
55    }
56
57    /// Creates a new client from the provided stub.
58    ///
59    /// The most common case for calling this function is when mocking the
60    /// client.
61    pub fn from_stub<T>(stub: T) -> Self
62    where
63        T: crate::stubs::EdgeContainer + 'static,
64    {
65        Self {
66            inner: Arc::new(stub),
67        }
68    }
69
70    async fn build_inner(
71        conf: gax::options::ClientConfig,
72    ) -> Result<Arc<dyn crate::stubs::dynamic::EdgeContainer>> {
73        if conf.tracing_enabled() {
74            return Ok(Arc::new(Self::build_with_tracing(conf).await?));
75        }
76        Ok(Arc::new(Self::build_transport(conf).await?))
77    }
78
79    async fn build_transport(
80        conf: gax::options::ClientConfig,
81    ) -> Result<impl crate::stubs::EdgeContainer> {
82        crate::transport::EdgeContainer::new(conf).await
83    }
84
85    async fn build_with_tracing(
86        conf: gax::options::ClientConfig,
87    ) -> Result<impl crate::stubs::EdgeContainer> {
88        Self::build_transport(conf)
89            .await
90            .map(crate::tracing::EdgeContainer::new)
91    }
92
93    /// Lists Clusters in a given project and location.
94    pub fn list_clusters(
95        &self,
96        parent: impl Into<std::string::String>,
97    ) -> crate::builders::edge_container::ListClusters {
98        crate::builders::edge_container::ListClusters::new(self.inner.clone())
99            .set_parent(parent.into())
100    }
101
102    /// Gets details of a single Cluster.
103    pub fn get_cluster(
104        &self,
105        name: impl Into<std::string::String>,
106    ) -> crate::builders::edge_container::GetCluster {
107        crate::builders::edge_container::GetCluster::new(self.inner.clone()).set_name(name.into())
108    }
109
110    /// Creates a new Cluster in a given project and location.
111    ///
112    /// # Long running operations
113    ///
114    /// This method is used to start, and/or poll a [long-running Operation].
115    /// The [Working with long-running operations] chapter in the [user guide]
116    /// covers these operations in detail.
117    ///
118    /// [long-running operation]: https://google.aip.dev/151
119    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
120    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
121    pub fn create_cluster(
122        &self,
123        parent: impl Into<std::string::String>,
124    ) -> crate::builders::edge_container::CreateCluster {
125        crate::builders::edge_container::CreateCluster::new(self.inner.clone())
126            .set_parent(parent.into())
127    }
128
129    /// Updates the parameters of a single Cluster.
130    ///
131    /// # Long running operations
132    ///
133    /// This method is used to start, and/or poll a [long-running Operation].
134    /// The [Working with long-running operations] chapter in the [user guide]
135    /// covers these operations in detail.
136    ///
137    /// [long-running operation]: https://google.aip.dev/151
138    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
139    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
140    pub fn update_cluster(
141        &self,
142        cluster: impl Into<crate::model::Cluster>,
143    ) -> crate::builders::edge_container::UpdateCluster {
144        crate::builders::edge_container::UpdateCluster::new(self.inner.clone())
145            .set_cluster(cluster.into())
146    }
147
148    /// Upgrades a single cluster.
149    ///
150    /// # Long running operations
151    ///
152    /// This method is used to start, and/or poll a [long-running Operation].
153    /// The [Working with long-running operations] chapter in the [user guide]
154    /// covers these operations in detail.
155    ///
156    /// [long-running operation]: https://google.aip.dev/151
157    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
158    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
159    pub fn upgrade_cluster(
160        &self,
161        name: impl Into<std::string::String>,
162    ) -> crate::builders::edge_container::UpgradeCluster {
163        crate::builders::edge_container::UpgradeCluster::new(self.inner.clone())
164            .set_name(name.into())
165    }
166
167    /// Deletes a single Cluster.
168    ///
169    /// # Long running operations
170    ///
171    /// This method is used to start, and/or poll a [long-running Operation].
172    /// The [Working with long-running operations] chapter in the [user guide]
173    /// covers these operations in detail.
174    ///
175    /// [long-running operation]: https://google.aip.dev/151
176    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
177    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
178    pub fn delete_cluster(
179        &self,
180        name: impl Into<std::string::String>,
181    ) -> crate::builders::edge_container::DeleteCluster {
182        crate::builders::edge_container::DeleteCluster::new(self.inner.clone())
183            .set_name(name.into())
184    }
185
186    /// Generates an access token for a Cluster.
187    pub fn generate_access_token(
188        &self,
189        cluster: impl Into<std::string::String>,
190    ) -> crate::builders::edge_container::GenerateAccessToken {
191        crate::builders::edge_container::GenerateAccessToken::new(self.inner.clone())
192            .set_cluster(cluster.into())
193    }
194
195    /// Generates an offline credential for a Cluster.
196    pub fn generate_offline_credential(
197        &self,
198        cluster: impl Into<std::string::String>,
199    ) -> crate::builders::edge_container::GenerateOfflineCredential {
200        crate::builders::edge_container::GenerateOfflineCredential::new(self.inner.clone())
201            .set_cluster(cluster.into())
202    }
203
204    /// Lists NodePools in a given project and location.
205    pub fn list_node_pools(
206        &self,
207        parent: impl Into<std::string::String>,
208    ) -> crate::builders::edge_container::ListNodePools {
209        crate::builders::edge_container::ListNodePools::new(self.inner.clone())
210            .set_parent(parent.into())
211    }
212
213    /// Gets details of a single NodePool.
214    pub fn get_node_pool(
215        &self,
216        name: impl Into<std::string::String>,
217    ) -> crate::builders::edge_container::GetNodePool {
218        crate::builders::edge_container::GetNodePool::new(self.inner.clone()).set_name(name.into())
219    }
220
221    /// Creates a new NodePool in a given project and location.
222    ///
223    /// # Long running operations
224    ///
225    /// This method is used to start, and/or poll a [long-running Operation].
226    /// The [Working with long-running operations] chapter in the [user guide]
227    /// covers these operations in detail.
228    ///
229    /// [long-running operation]: https://google.aip.dev/151
230    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
231    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
232    pub fn create_node_pool(
233        &self,
234        parent: impl Into<std::string::String>,
235    ) -> crate::builders::edge_container::CreateNodePool {
236        crate::builders::edge_container::CreateNodePool::new(self.inner.clone())
237            .set_parent(parent.into())
238    }
239
240    /// Updates the parameters of a single NodePool.
241    ///
242    /// # Long running operations
243    ///
244    /// This method is used to start, and/or poll a [long-running Operation].
245    /// The [Working with long-running operations] chapter in the [user guide]
246    /// covers these operations in detail.
247    ///
248    /// [long-running operation]: https://google.aip.dev/151
249    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
250    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
251    pub fn update_node_pool(
252        &self,
253        node_pool: impl Into<crate::model::NodePool>,
254    ) -> crate::builders::edge_container::UpdateNodePool {
255        crate::builders::edge_container::UpdateNodePool::new(self.inner.clone())
256            .set_node_pool(node_pool.into())
257    }
258
259    /// Deletes a single NodePool.
260    ///
261    /// # Long running operations
262    ///
263    /// This method is used to start, and/or poll a [long-running Operation].
264    /// The [Working with long-running operations] chapter in the [user guide]
265    /// covers these operations in detail.
266    ///
267    /// [long-running operation]: https://google.aip.dev/151
268    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
269    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
270    pub fn delete_node_pool(
271        &self,
272        name: impl Into<std::string::String>,
273    ) -> crate::builders::edge_container::DeleteNodePool {
274        crate::builders::edge_container::DeleteNodePool::new(self.inner.clone())
275            .set_name(name.into())
276    }
277
278    /// Lists Machines in a given project and location.
279    pub fn list_machines(
280        &self,
281        parent: impl Into<std::string::String>,
282    ) -> crate::builders::edge_container::ListMachines {
283        crate::builders::edge_container::ListMachines::new(self.inner.clone())
284            .set_parent(parent.into())
285    }
286
287    /// Gets details of a single Machine.
288    pub fn get_machine(
289        &self,
290        name: impl Into<std::string::String>,
291    ) -> crate::builders::edge_container::GetMachine {
292        crate::builders::edge_container::GetMachine::new(self.inner.clone()).set_name(name.into())
293    }
294
295    /// Lists VPN connections in a given project and location.
296    pub fn list_vpn_connections(
297        &self,
298        parent: impl Into<std::string::String>,
299    ) -> crate::builders::edge_container::ListVpnConnections {
300        crate::builders::edge_container::ListVpnConnections::new(self.inner.clone())
301            .set_parent(parent.into())
302    }
303
304    /// Gets details of a single VPN connection.
305    pub fn get_vpn_connection(
306        &self,
307        name: impl Into<std::string::String>,
308    ) -> crate::builders::edge_container::GetVpnConnection {
309        crate::builders::edge_container::GetVpnConnection::new(self.inner.clone())
310            .set_name(name.into())
311    }
312
313    /// Creates a new VPN connection in a given project and location.
314    ///
315    /// # Long running operations
316    ///
317    /// This method is used to start, and/or poll a [long-running Operation].
318    /// The [Working with long-running operations] chapter in the [user guide]
319    /// covers these operations in detail.
320    ///
321    /// [long-running operation]: https://google.aip.dev/151
322    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
323    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
324    pub fn create_vpn_connection(
325        &self,
326        parent: impl Into<std::string::String>,
327    ) -> crate::builders::edge_container::CreateVpnConnection {
328        crate::builders::edge_container::CreateVpnConnection::new(self.inner.clone())
329            .set_parent(parent.into())
330    }
331
332    /// Deletes a single VPN connection.
333    ///
334    /// # Long running operations
335    ///
336    /// This method is used to start, and/or poll a [long-running Operation].
337    /// The [Working with long-running operations] chapter in the [user guide]
338    /// covers these operations in detail.
339    ///
340    /// [long-running operation]: https://google.aip.dev/151
341    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
342    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
343    pub fn delete_vpn_connection(
344        &self,
345        name: impl Into<std::string::String>,
346    ) -> crate::builders::edge_container::DeleteVpnConnection {
347        crate::builders::edge_container::DeleteVpnConnection::new(self.inner.clone())
348            .set_name(name.into())
349    }
350
351    /// Gets the server config.
352    pub fn get_server_config(
353        &self,
354        name: impl Into<std::string::String>,
355    ) -> crate::builders::edge_container::GetServerConfig {
356        crate::builders::edge_container::GetServerConfig::new(self.inner.clone())
357            .set_name(name.into())
358    }
359
360    /// Lists information about the supported locations for this service.
361    pub fn list_locations(
362        &self,
363        name: impl Into<std::string::String>,
364    ) -> crate::builders::edge_container::ListLocations {
365        crate::builders::edge_container::ListLocations::new(self.inner.clone())
366            .set_name(name.into())
367    }
368
369    /// Gets information about a location.
370    pub fn get_location(
371        &self,
372        name: impl Into<std::string::String>,
373    ) -> crate::builders::edge_container::GetLocation {
374        crate::builders::edge_container::GetLocation::new(self.inner.clone()).set_name(name.into())
375    }
376
377    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
378    ///
379    /// [google.longrunning.Operations]: longrunning::client::Operations
380    pub fn list_operations(
381        &self,
382        name: impl Into<std::string::String>,
383    ) -> crate::builders::edge_container::ListOperations {
384        crate::builders::edge_container::ListOperations::new(self.inner.clone())
385            .set_name(name.into())
386    }
387
388    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
389    ///
390    /// [google.longrunning.Operations]: longrunning::client::Operations
391    pub fn get_operation(
392        &self,
393        name: impl Into<std::string::String>,
394    ) -> crate::builders::edge_container::GetOperation {
395        crate::builders::edge_container::GetOperation::new(self.inner.clone()).set_name(name.into())
396    }
397
398    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
399    ///
400    /// [google.longrunning.Operations]: longrunning::client::Operations
401    pub fn delete_operation(
402        &self,
403        name: impl Into<std::string::String>,
404    ) -> crate::builders::edge_container::DeleteOperation {
405        crate::builders::edge_container::DeleteOperation::new(self.inner.clone())
406            .set_name(name.into())
407    }
408
409    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
410    ///
411    /// [google.longrunning.Operations]: longrunning::client::Operations
412    pub fn cancel_operation(
413        &self,
414        name: impl Into<std::string::String>,
415    ) -> crate::builders::edge_container::CancelOperation {
416        crate::builders::edge_container::CancelOperation::new(self.inner.clone())
417            .set_name(name.into())
418    }
419}