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/// # tokio_test::block_on(async {
24/// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
25/// let client = EdgeContainer::builder().build().await?;
26/// // use `client` to make requests to the Distributed Cloud Edge Container API.
27/// # gax::client_builder::Result::<()>::Ok(()) });
28/// ```
29///
30/// # Service Description
31///
32/// EdgeContainer API provides management of Kubernetes Clusters on Google Edge
33/// Cloud deployments.
34///
35/// # Configuration
36///
37/// To configure `EdgeContainer` use the `with_*` methods in the type returned
38/// by [builder()][EdgeContainer::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://edgecontainer.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::edge_container::ClientBuilder::with_endpoint
51/// [with_credentials()]: super::builder::edge_container::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/// `EdgeContainer` holds a connection pool internally, it is advised to
58/// create one and the reuse it. You do not need to wrap `EdgeContainer` in
59/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
60/// already uses an `Arc` internally.
61#[derive(Clone, Debug)]
62pub struct EdgeContainer {
63 inner: std::sync::Arc<dyn super::stub::dynamic::EdgeContainer>,
64}
65
66impl EdgeContainer {
67 /// Returns a builder for [EdgeContainer].
68 ///
69 /// ```
70 /// # tokio_test::block_on(async {
71 /// # use google_cloud_edgecontainer_v1::client::EdgeContainer;
72 /// let client = EdgeContainer::builder().build().await?;
73 /// # gax::client_builder::Result::<()>::Ok(()) });
74 /// ```
75 pub fn builder() -> super::builder::edge_container::ClientBuilder {
76 gax::client_builder::internal::new_builder(super::builder::edge_container::client::Factory)
77 }
78
79 /// Creates a new client from the provided stub.
80 ///
81 /// The most common case for calling this function is in tests mocking the
82 /// client's behavior.
83 pub fn from_stub<T>(stub: T) -> Self
84 where
85 T: super::stub::EdgeContainer + 'static,
86 {
87 Self {
88 inner: std::sync::Arc::new(stub),
89 }
90 }
91
92 pub(crate) async fn new(
93 config: gaxi::options::ClientConfig,
94 ) -> gax::client_builder::Result<Self> {
95 let inner = Self::build_inner(config).await?;
96 Ok(Self { inner })
97 }
98
99 async fn build_inner(
100 conf: gaxi::options::ClientConfig,
101 ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::EdgeContainer>> {
102 if gaxi::options::tracing_enabled(&conf) {
103 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
104 }
105 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
106 }
107
108 async fn build_transport(
109 conf: gaxi::options::ClientConfig,
110 ) -> gax::client_builder::Result<impl super::stub::EdgeContainer> {
111 super::transport::EdgeContainer::new(conf).await
112 }
113
114 async fn build_with_tracing(
115 conf: gaxi::options::ClientConfig,
116 ) -> gax::client_builder::Result<impl super::stub::EdgeContainer> {
117 Self::build_transport(conf)
118 .await
119 .map(super::tracing::EdgeContainer::new)
120 }
121
122 /// Lists Clusters in a given project and location.
123 pub fn list_clusters(&self) -> super::builder::edge_container::ListClusters {
124 super::builder::edge_container::ListClusters::new(self.inner.clone())
125 }
126
127 /// Gets details of a single Cluster.
128 pub fn get_cluster(&self) -> super::builder::edge_container::GetCluster {
129 super::builder::edge_container::GetCluster::new(self.inner.clone())
130 }
131
132 /// Creates a new Cluster in a given project and location.
133 ///
134 /// # Long running operations
135 ///
136 /// This method is used to start, and/or poll a [long-running Operation].
137 /// The [Working with long-running operations] chapter in the [user guide]
138 /// covers these operations in detail.
139 ///
140 /// [long-running operation]: https://google.aip.dev/151
141 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
142 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
143 pub fn create_cluster(&self) -> super::builder::edge_container::CreateCluster {
144 super::builder::edge_container::CreateCluster::new(self.inner.clone())
145 }
146
147 /// Updates the parameters of a single Cluster.
148 ///
149 /// # Long running operations
150 ///
151 /// This method is used to start, and/or poll a [long-running Operation].
152 /// The [Working with long-running operations] chapter in the [user guide]
153 /// covers these operations in detail.
154 ///
155 /// [long-running operation]: https://google.aip.dev/151
156 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
157 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
158 pub fn update_cluster(&self) -> super::builder::edge_container::UpdateCluster {
159 super::builder::edge_container::UpdateCluster::new(self.inner.clone())
160 }
161
162 /// Upgrades a single cluster.
163 ///
164 /// # Long running operations
165 ///
166 /// This method is used to start, and/or poll a [long-running Operation].
167 /// The [Working with long-running operations] chapter in the [user guide]
168 /// covers these operations in detail.
169 ///
170 /// [long-running operation]: https://google.aip.dev/151
171 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
172 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
173 pub fn upgrade_cluster(&self) -> super::builder::edge_container::UpgradeCluster {
174 super::builder::edge_container::UpgradeCluster::new(self.inner.clone())
175 }
176
177 /// Deletes a single Cluster.
178 ///
179 /// # Long running operations
180 ///
181 /// This method is used to start, and/or poll a [long-running Operation].
182 /// The [Working with long-running operations] chapter in the [user guide]
183 /// covers these operations in detail.
184 ///
185 /// [long-running operation]: https://google.aip.dev/151
186 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
187 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
188 pub fn delete_cluster(&self) -> super::builder::edge_container::DeleteCluster {
189 super::builder::edge_container::DeleteCluster::new(self.inner.clone())
190 }
191
192 /// Generates an access token for a Cluster.
193 pub fn generate_access_token(&self) -> super::builder::edge_container::GenerateAccessToken {
194 super::builder::edge_container::GenerateAccessToken::new(self.inner.clone())
195 }
196
197 /// Generates an offline credential for a Cluster.
198 pub fn generate_offline_credential(
199 &self,
200 ) -> super::builder::edge_container::GenerateOfflineCredential {
201 super::builder::edge_container::GenerateOfflineCredential::new(self.inner.clone())
202 }
203
204 /// Lists NodePools in a given project and location.
205 pub fn list_node_pools(&self) -> super::builder::edge_container::ListNodePools {
206 super::builder::edge_container::ListNodePools::new(self.inner.clone())
207 }
208
209 /// Gets details of a single NodePool.
210 pub fn get_node_pool(&self) -> super::builder::edge_container::GetNodePool {
211 super::builder::edge_container::GetNodePool::new(self.inner.clone())
212 }
213
214 /// Creates a new NodePool in a given project and location.
215 ///
216 /// # Long running operations
217 ///
218 /// This method is used to start, and/or poll a [long-running Operation].
219 /// The [Working with long-running operations] chapter in the [user guide]
220 /// covers these operations in detail.
221 ///
222 /// [long-running operation]: https://google.aip.dev/151
223 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
224 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
225 pub fn create_node_pool(&self) -> super::builder::edge_container::CreateNodePool {
226 super::builder::edge_container::CreateNodePool::new(self.inner.clone())
227 }
228
229 /// Updates the parameters of a single NodePool.
230 ///
231 /// # Long running operations
232 ///
233 /// This method is used to start, and/or poll a [long-running Operation].
234 /// The [Working with long-running operations] chapter in the [user guide]
235 /// covers these operations in detail.
236 ///
237 /// [long-running operation]: https://google.aip.dev/151
238 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
239 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
240 pub fn update_node_pool(&self) -> super::builder::edge_container::UpdateNodePool {
241 super::builder::edge_container::UpdateNodePool::new(self.inner.clone())
242 }
243
244 /// Deletes a single NodePool.
245 ///
246 /// # Long running operations
247 ///
248 /// This method is used to start, and/or poll a [long-running Operation].
249 /// The [Working with long-running operations] chapter in the [user guide]
250 /// covers these operations in detail.
251 ///
252 /// [long-running operation]: https://google.aip.dev/151
253 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
254 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
255 pub fn delete_node_pool(&self) -> super::builder::edge_container::DeleteNodePool {
256 super::builder::edge_container::DeleteNodePool::new(self.inner.clone())
257 }
258
259 /// Lists Machines in a given project and location.
260 pub fn list_machines(&self) -> super::builder::edge_container::ListMachines {
261 super::builder::edge_container::ListMachines::new(self.inner.clone())
262 }
263
264 /// Gets details of a single Machine.
265 pub fn get_machine(&self) -> super::builder::edge_container::GetMachine {
266 super::builder::edge_container::GetMachine::new(self.inner.clone())
267 }
268
269 /// Lists VPN connections in a given project and location.
270 pub fn list_vpn_connections(&self) -> super::builder::edge_container::ListVpnConnections {
271 super::builder::edge_container::ListVpnConnections::new(self.inner.clone())
272 }
273
274 /// Gets details of a single VPN connection.
275 pub fn get_vpn_connection(&self) -> super::builder::edge_container::GetVpnConnection {
276 super::builder::edge_container::GetVpnConnection::new(self.inner.clone())
277 }
278
279 /// Creates a new VPN connection in a given project and location.
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 pub fn create_vpn_connection(&self) -> super::builder::edge_container::CreateVpnConnection {
291 super::builder::edge_container::CreateVpnConnection::new(self.inner.clone())
292 }
293
294 /// Deletes a single VPN connection.
295 ///
296 /// # Long running operations
297 ///
298 /// This method is used to start, and/or poll a [long-running Operation].
299 /// The [Working with long-running operations] chapter in the [user guide]
300 /// covers these operations in detail.
301 ///
302 /// [long-running operation]: https://google.aip.dev/151
303 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
304 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
305 pub fn delete_vpn_connection(&self) -> super::builder::edge_container::DeleteVpnConnection {
306 super::builder::edge_container::DeleteVpnConnection::new(self.inner.clone())
307 }
308
309 /// Gets the server config.
310 pub fn get_server_config(&self) -> super::builder::edge_container::GetServerConfig {
311 super::builder::edge_container::GetServerConfig::new(self.inner.clone())
312 }
313
314 /// Lists information about the supported locations for this service.
315 pub fn list_locations(&self) -> super::builder::edge_container::ListLocations {
316 super::builder::edge_container::ListLocations::new(self.inner.clone())
317 }
318
319 /// Gets information about a location.
320 pub fn get_location(&self) -> super::builder::edge_container::GetLocation {
321 super::builder::edge_container::GetLocation::new(self.inner.clone())
322 }
323
324 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
325 ///
326 /// [google.longrunning.Operations]: longrunning::client::Operations
327 pub fn list_operations(&self) -> super::builder::edge_container::ListOperations {
328 super::builder::edge_container::ListOperations::new(self.inner.clone())
329 }
330
331 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
332 ///
333 /// [google.longrunning.Operations]: longrunning::client::Operations
334 pub fn get_operation(&self) -> super::builder::edge_container::GetOperation {
335 super::builder::edge_container::GetOperation::new(self.inner.clone())
336 }
337
338 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
339 ///
340 /// [google.longrunning.Operations]: longrunning::client::Operations
341 pub fn delete_operation(&self) -> super::builder::edge_container::DeleteOperation {
342 super::builder::edge_container::DeleteOperation::new(self.inner.clone())
343 }
344
345 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
346 ///
347 /// [google.longrunning.Operations]: longrunning::client::Operations
348 pub fn cancel_operation(&self) -> super::builder::edge_container::CancelOperation {
349 super::builder::edge_container::CancelOperation::new(self.inner.clone())
350 }
351}