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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
//! MockClient helpers for AWS Identity and Access Management 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 AWS Identity and Access Management helpers.
#[cfg(any(test, feature = "test-support"))]
pub trait IamMockHelpers {
/// Helper to expect `list_users`: Lists all IAM users in the account.
fn expect_list_users(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_attached_user_policies`: Lists all managed policies attached to the
/// specified IAM user.
fn expect_list_attached_user_policies(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `detach_user_policy`: Removes the specified managed policy from the
/// specified IAM user.
fn expect_detach_user_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `delete_access_key`: Deletes the access key pair associated with the
/// specified IAM user.
fn expect_delete_access_key(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_access_keys`: Lists the access key IDs associated with the specified
/// IAM user.
fn expect_list_access_keys(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_access_key_last_used`: Retrieves information about when the specified
/// access key was last used.
fn expect_get_access_key_last_used(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `generate_credential_report`: Generates a credential report for the AWS
/// account.
fn expect_generate_credential_report(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_credential_report`: Retrieves a credential report for the AWS account.
fn expect_get_credential_report(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `update_access_key`: Changes the status of the specified access key from
/// Active to Inactive, or vice versa.
fn expect_update_access_key(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_mfa_devices`: Lists the MFA devices for an IAM user.
fn expect_list_mfa_devices(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_login_profile`: Retrieves the login profile for the specified IAM
/// user.
fn expect_get_login_profile(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_account_summary`: Retrieves information about IAM entity usage and IAM
/// quotas in the AWS account.
fn expect_get_account_summary(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_account_password_policy`: Retrieves the password policy for the AWS
/// account.
fn expect_get_account_password_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `update_account_password_policy`: Updates the password policy settings for
/// the AWS account.
fn expect_update_account_password_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_roles`: Lists the IAM roles that have the specified path prefix.
fn expect_list_roles(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_user_policies`: Lists the names of the inline policies embedded in
/// the specified IAM user.
fn expect_list_user_policies(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_groups_for_user`: Lists the IAM groups that the specified IAM user
/// belongs to.
fn expect_list_groups_for_user(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_server_certificates`: Lists the server certificates stored in IAM.
fn expect_list_server_certificates(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `delete_user_policy`: Deletes the specified inline policy from the
/// specified IAM user.
fn expect_delete_user_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `attach_role_policy`: Attaches the specified managed policy to the
/// specified IAM role.
fn expect_attach_role_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `detach_role_policy`: Removes the specified managed policy from the
/// specified IAM role.
fn expect_detach_role_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `create_service_linked_role`: Creates an IAM role that is linked to a
/// specific AWS service.
fn expect_create_service_linked_role(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_user_policy`: Retrieves the specified inline policy document embedded
/// in the specified IAM user.
fn expect_get_user_policy(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_attached_group_policies`: Lists all managed policies that are
/// attached to the specified IAM group.
fn expect_list_attached_group_policies(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_virtual_mfa_devices`: Lists the virtual MFA devices defined in the
/// AWS account.
fn expect_list_virtual_mfa_devices(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_policies`: Lists IAM policies, optionally filtered by scope
/// (Local/AWS/All).
fn expect_list_policies(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `get_policy_version`: Retrieves information about the specified version of
/// the specified managed policy.
fn expect_get_policy_version(&mut self) -> ExpectationBuilder<'_>;
/// Helper to expect `list_entities_for_policy`: Lists all IAM users, groups, and roles that the
/// specified managed policy is attached to.
fn expect_list_entities_for_policy(&mut self) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl IamMockHelpers for MockClient {
/// Helper to expect `list_users`: Lists all IAM users in the account.
fn expect_list_users(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_attached_user_policies`: Lists all managed policies attached to the
/// specified IAM user.
fn expect_list_attached_user_policies(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `detach_user_policy`: Removes the specified managed policy from the
/// specified IAM user.
fn expect_detach_user_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `delete_access_key`: Deletes the access key pair associated with the
/// specified IAM user.
fn expect_delete_access_key(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_access_keys`: Lists the access key IDs associated with the specified
/// IAM user.
fn expect_list_access_keys(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_access_key_last_used`: Retrieves information about when the specified
/// access key was last used.
fn expect_get_access_key_last_used(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `generate_credential_report`: Generates a credential report for the AWS
/// account.
fn expect_generate_credential_report(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_credential_report`: Retrieves a credential report for the AWS account.
fn expect_get_credential_report(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `update_access_key`: Changes the status of the specified access key from
/// Active to Inactive, or vice versa.
fn expect_update_access_key(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_mfa_devices`: Lists the MFA devices for an IAM user.
fn expect_list_mfa_devices(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_login_profile`: Retrieves the login profile for the specified IAM
/// user.
fn expect_get_login_profile(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_account_summary`: Retrieves information about IAM entity usage and IAM
/// quotas in the AWS account.
fn expect_get_account_summary(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_account_password_policy`: Retrieves the password policy for the AWS
/// account.
fn expect_get_account_password_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `update_account_password_policy`: Updates the password policy settings for
/// the AWS account.
fn expect_update_account_password_policy(
&mut self,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_roles`: Lists the IAM roles that have the specified path prefix.
fn expect_list_roles(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_user_policies`: Lists the names of the inline policies embedded in
/// the specified IAM user.
fn expect_list_user_policies(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_groups_for_user`: Lists the IAM groups that the specified IAM user
/// belongs to.
fn expect_list_groups_for_user(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_server_certificates`: Lists the server certificates stored in IAM.
fn expect_list_server_certificates(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `delete_user_policy`: Deletes the specified inline policy from the
/// specified IAM user.
fn expect_delete_user_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `attach_role_policy`: Attaches the specified managed policy to the
/// specified IAM role.
fn expect_attach_role_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `detach_role_policy`: Removes the specified managed policy from the
/// specified IAM role.
fn expect_detach_role_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `create_service_linked_role`: Creates an IAM role that is linked to a
/// specific AWS service.
fn expect_create_service_linked_role(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_user_policy`: Retrieves the specified inline policy document embedded
/// in the specified IAM user.
fn expect_get_user_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_attached_group_policies`: Lists all managed policies that are
/// attached to the specified IAM group.
fn expect_list_attached_group_policies(
&mut self,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_virtual_mfa_devices`: Lists the virtual MFA devices defined in the
/// AWS account.
fn expect_list_virtual_mfa_devices(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_policies`: Lists IAM policies, optionally filtered by scope
/// (Local/AWS/All).
fn expect_list_policies(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `get_policy_version`: Retrieves information about the specified version of
/// the specified managed policy.
fn expect_get_policy_version(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
/// Helper to expect `list_entities_for_policy`: Lists all IAM users, groups, and roles that the
/// specified managed policy is attached to.
fn expect_list_entities_for_policy(&mut self) -> crate::mock_client::ExpectationBuilder<'_> {
let path = "/".to_string();
self.expect_post(&path)
}
}