@@ -207,23 +207,23 @@ fn policies(matches: &clap::ArgMatches) -> Result<HashMap<String, PolicyOrPolicy
207
207
208
208
// Validate the policies and policy groups:
209
209
// - ensure policy names do not contain a '/' character
210
- // - ensure names of policy group members do not contain a '/' character
210
+ // - ensure names of policy group's policies do not contain a '/' character
211
211
fn validate_policies ( policies : & HashMap < String , PolicyOrPolicyGroup > ) -> Result < ( ) > {
212
212
for ( name, policy) in policies. iter ( ) {
213
213
if name. contains ( '/' ) {
214
214
return Err ( anyhow ! ( "policy name '{}' contains a '/' character" , name) ) ;
215
215
}
216
- if let PolicyOrPolicyGroup :: PolicyGroup { members , .. } = policy {
217
- let members_with_invalid_name : Vec < String > = members
216
+ if let PolicyOrPolicyGroup :: PolicyGroup { policies , .. } = policy {
217
+ let policies_with_invalid_name : Vec < String > = policies
218
218
. iter ( )
219
219
. filter_map ( |( id, _) | if id. contains ( '/' ) { Some ( id) } else { None } )
220
220
. cloned ( )
221
221
. collect ( ) ;
222
- if !members_with_invalid_name . is_empty ( ) {
222
+ if !policies_with_invalid_name . is_empty ( ) {
223
223
return Err ( anyhow ! (
224
- "policy group '{}' contains members with invalid names: {:?}" ,
224
+ "policy group '{}' contains policies with invalid names: {:?}" ,
225
225
name,
226
- members_with_invalid_name
226
+ policies_with_invalid_name
227
227
) ) ;
228
228
}
229
229
}
@@ -307,7 +307,7 @@ pub enum PolicyOrPolicyGroupSettings {
307
307
PolicyGroup {
308
308
expression : String ,
309
309
message : String ,
310
- members : Vec < String > ,
310
+ policies : Vec < String > ,
311
311
} ,
312
312
}
313
313
@@ -357,8 +357,7 @@ pub enum PolicyOrPolicyGroup {
357
357
policy_mode : PolicyMode ,
358
358
/// The policies that make up for this group
359
359
/// Key is a unique identifier
360
- #[ serde( rename = "policies" ) ]
361
- members : HashMap < String , PolicyGroupMember > ,
360
+ policies : HashMap < String , PolicyGroupMember > ,
362
361
/// The expression that is used to evaluate the group of policies
363
362
expression : String ,
364
363
/// The message that is returned when the group of policies evaluates to false
@@ -376,12 +375,12 @@ impl PolicyOrPolicyGroup {
376
375
PolicyOrPolicyGroup :: PolicyGroup {
377
376
expression,
378
377
message,
379
- members : policies,
378
+ policies,
380
379
..
381
380
} => Ok ( PolicyOrPolicyGroupSettings :: PolicyGroup {
382
381
expression : expression. clone ( ) ,
383
382
message : message. clone ( ) ,
384
- members : policies. keys ( ) . cloned ( ) . collect ( ) ,
383
+ policies : policies. keys ( ) . cloned ( ) . collect ( ) ,
385
384
} ) ,
386
385
}
387
386
}
0 commit comments