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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! MockClient helpers for Cloud Asset 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 Cloud Asset helpers.
#[cfg(any(test, feature = "test-support"))]
pub trait CloudassetMockHelpers {
/// Helper to expect `search_all_resources`: Searches all Google Cloud resources within the
/// specified scope, such as a project, folder, or organization. The caller must be granted the
/// `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the
/// request will be rejected.
#[allow(clippy::too_many_arguments)]
fn expect_search_all_resources(
&mut self,
scope: &str,
query: &str,
asset_types: &[&str],
page_size: &str,
page_token: &str,
order_by: &str,
read_mask: &str,
) -> ExpectationBuilder<'_>;
/// Helper to expect `search_all_iam_policies`: Searches all IAM policies within the specified
/// scope, such as a project, folder, or organization. The caller must be granted the
/// `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the
/// request will be rejected.
fn expect_search_all_iam_policies(
&mut self,
scope: &str,
query: &str,
asset_types: &[&str],
page_size: &str,
page_token: &str,
order_by: &str,
) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl CloudassetMockHelpers for MockClient {
/// Helper to expect `search_all_resources`: Searches all Google Cloud resources within the
/// specified scope, such as a project, folder, or organization. The caller must be granted the
/// `cloudasset.assets.searchAllResources` permission on the desired scope, otherwise the
/// request will be rejected.
#[allow(clippy::too_many_arguments)]
fn expect_search_all_resources(
&mut self,
scope: &str,
query: &str,
asset_types: &[&str],
page_size: &str,
page_token: &str,
order_by: &str,
read_mask: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let mut path = format!("/v1/{scope}:searchAllResources");
let mut __qp: Vec<String> = Vec::new();
if !query.is_empty() {
__qp.push(format!("query={}", query));
}
for __v in asset_types {
__qp.push(format!("assetTypes={}", __v));
}
if !page_size.is_empty() {
__qp.push(format!("pageSize={}", page_size));
}
if !page_token.is_empty() {
__qp.push(format!("pageToken={}", page_token));
}
if !order_by.is_empty() {
__qp.push(format!("orderBy={}", order_by));
}
if !read_mask.is_empty() {
__qp.push(format!("readMask={}", read_mask));
}
if !__qp.is_empty() {
path = format!("{}?{}", path, __qp.join("&"));
}
self.expect_get(&path)
}
/// Helper to expect `search_all_iam_policies`: Searches all IAM policies within the specified
/// scope, such as a project, folder, or organization. The caller must be granted the
/// `cloudasset.assets.searchAllIamPolicies` permission on the desired scope, otherwise the
/// request will be rejected.
fn expect_search_all_iam_policies(
&mut self,
scope: &str,
query: &str,
asset_types: &[&str],
page_size: &str,
page_token: &str,
order_by: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let mut path = format!("/v1/{scope}:searchAllIamPolicies");
let mut __qp: Vec<String> = Vec::new();
if !query.is_empty() {
__qp.push(format!("query={}", query));
}
for __v in asset_types {
__qp.push(format!("assetTypes={}", __v));
}
if !page_size.is_empty() {
__qp.push(format!("pageSize={}", page_size));
}
if !page_token.is_empty() {
__qp.push(format!("pageToken={}", page_token));
}
if !order_by.is_empty() {
__qp.push(format!("orderBy={}", order_by));
}
if !__qp.is_empty() {
path = format!("{}?{}", path, __qp.join("&"));
}
self.expect_get(&path)
}
}