1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! MockClient helpers for Kubernetes Engine API.
//!
//! Auto-generated extension methods for ergonomic test setup.
//! **Do not edit manually** — modify the manifest and re-run codegen.
#[cfg(any(test, feature = "test-support"))]
use crate::mock_client::{ExpectationBuilder, MockClient};
/// Extension trait for MockClient with Kubernetes Engine helpers.
#[cfg(any(test, feature = "test-support"))]
pub trait ContainerMockHelpers {
/// Helper to expect `list_clusters`: Lists all clusters owned by a project in either the
/// specified zone or all zones.
fn expect_list_clusters(&mut self, parent: &str) -> ExpectationBuilder<'_>;
/// Helper to expect `get_cluster`: Gets the details of a specific cluster.
fn expect_get_cluster(&mut self, name: &str) -> ExpectationBuilder<'_>;
/// Helper to expect `delete_cluster`: Deletes the cluster, including the Kubernetes endpoint
/// and all worker nodes. Firewalls and routes that were configured during cluster creation are
/// also deleted. Other Google Compute Engine resources that might be in use by the cluster,
/// such as load balancer resources, are not deleted if they weren't present when the cluster
/// was initially created.
fn expect_delete_cluster(&mut self, name: &str) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl ContainerMockHelpers for MockClient {
/// Helper to expect `list_clusters`: Lists all clusters owned by a project in either the
/// specified zone or all zones.
fn expect_list_clusters(&mut self, parent: &str) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!("/v1/{parent}/clusters");
self.expect_get(&path)
}
/// Helper to expect `get_cluster`: Gets the details of a specific cluster.
fn expect_get_cluster(&mut self, name: &str) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!("/v1/{name}");
self.expect_get(&path)
}
/// Helper to expect `delete_cluster`: Deletes the cluster, including the Kubernetes endpoint
/// and all worker nodes. Firewalls and routes that were configured during cluster creation are
/// also deleted. Other Google Compute Engine resources that might be in use by the cluster,
/// such as load balancer resources, are not deleted if they weren't present when the cluster
/// was initially created.
fn expect_delete_cluster(&mut self, name: &str) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!("/v1/{name}");
self.expect_delete(&path)
}
}