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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! MockClient helpers for API Keys API 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 API Keys API helpers.
#[cfg(any(test, feature = "test-support"))]
pub trait ApikeysMockHelpers {
/// Helper to expect `list_keys`: Lists the API keys owned by a project. The key string of the
/// API key isn't included in the response. NOTE: Key is a global resource; hence the only
/// supported value for location is `global`.
fn expect_list_keys(
&mut self,
parent: &str,
page_size: &str,
page_token: &str,
show_deleted: &str,
) -> ExpectationBuilder<'_>;
/// Helper to expect `get_key`: Gets the metadata for an API key. The key string of the API key
/// isn't included in the response. NOTE: Key is a global resource; hence the only supported
/// value for location is `global`.
fn expect_get_key(&mut self, name: &str) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl ApikeysMockHelpers for MockClient {
/// Helper to expect `list_keys`: Lists the API keys owned by a project. The key string of the
/// API key isn't included in the response. NOTE: Key is a global resource; hence the only
/// supported value for location is `global`.
fn expect_list_keys(
&mut self,
parent: &str,
page_size: &str,
page_token: &str,
show_deleted: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let mut path = format!("/v2/{parent}/keys");
let mut __qp: Vec<String> = Vec::new();
if !page_size.is_empty() {
__qp.push(format!("pageSize={}", page_size));
}
if !page_token.is_empty() {
__qp.push(format!("pageToken={}", page_token));
}
if !show_deleted.is_empty() {
__qp.push(format!("showDeleted={}", show_deleted));
}
if !__qp.is_empty() {
path = format!("{}?{}", path, __qp.join("&"));
}
self.expect_get(&path)
}
/// Helper to expect `get_key`: Gets the metadata for an API key. The key string of the API key
/// isn't included in the response. NOTE: Key is a global resource; hence the only supported
/// value for location is `global`.
fn expect_get_key(&mut self, name: &str) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!("/v2/{name}");
self.expect_get(&path)
}
}