@@ -167,13 +167,21 @@ pub fn config_for_role_and_group<'a>(
167
167
/// - `resource` - Not used directly. It's passed on to the `Configuration::compute_*` calls.
168
168
/// - `roles` - A map keyed by role names. The value is a tuple of a vector of `PropertyNameKind`
169
169
/// like (Cli, Env or Files) and [`crate::role_utils::Role`] with a boxed [`Configuration`].
170
- pub fn transform_all_roles_to_config < T , U > (
170
+ #[ allow( clippy:: type_complexity) ]
171
+ pub fn transform_all_roles_to_config < T , U , ProductSpecificCommonConfig > (
171
172
resource : & T :: Configurable ,
172
- roles : HashMap < String , ( Vec < PropertyNameKind > , Role < T , U > ) > ,
173
+ roles : HashMap <
174
+ String ,
175
+ (
176
+ Vec < PropertyNameKind > ,
177
+ Role < T , U , ProductSpecificCommonConfig > ,
178
+ ) ,
179
+ > ,
173
180
) -> Result < RoleConfigByPropertyKind >
174
181
where
175
182
T : Configuration ,
176
183
U : Default + JsonSchema + Serialize ,
184
+ ProductSpecificCommonConfig : Default + JsonSchema + Serialize ,
177
185
{
178
186
let mut result = HashMap :: new ( ) ;
179
187
@@ -359,15 +367,16 @@ fn process_validation_result(
359
367
/// - `role_name` - The name of the role.
360
368
/// - `role` - The role for which to transform the configuration parameters.
361
369
/// - `property_kinds` - Used as "buckets" to partition the configuration properties by.
362
- fn transform_role_to_config < T , U > (
370
+ fn transform_role_to_config < T , U , ProductSpecificCommonConfig > (
363
371
resource : & T :: Configurable ,
364
372
role_name : & str ,
365
- role : & Role < T , U > ,
373
+ role : & Role < T , U , ProductSpecificCommonConfig > ,
366
374
property_kinds : & [ PropertyNameKind ] ,
367
375
) -> Result < RoleGroupConfigByPropertyKind >
368
376
where
369
377
T : Configuration ,
370
378
U : Default + JsonSchema + Serialize ,
379
+ ProductSpecificCommonConfig : Default + JsonSchema + Serialize ,
371
380
{
372
381
let mut result = HashMap :: new ( ) ;
373
382
@@ -422,10 +431,10 @@ where
422
431
/// - `role_name` - Not used directly but passed on to the `Configuration::compute_*` calls.
423
432
/// - `config` - The configuration properties to partition.
424
433
/// - `property_kinds` - The "buckets" used to partition the configuration properties.
425
- fn parse_role_config < T > (
434
+ fn parse_role_config < T , ProductSpecificCommonConfig > (
426
435
resource : & <T as Configuration >:: Configurable ,
427
436
role_name : & str ,
428
- config : & CommonConfiguration < T > ,
437
+ config : & CommonConfiguration < T , ProductSpecificCommonConfig > ,
429
438
property_kinds : & [ PropertyNameKind ] ,
430
439
) -> Result < HashMap < PropertyNameKind , BTreeMap < String , Option < String > > > >
431
440
where
@@ -452,8 +461,8 @@ where
452
461
Ok ( result)
453
462
}
454
463
455
- fn parse_role_overrides < T > (
456
- config : & CommonConfiguration < T > ,
464
+ fn parse_role_overrides < T , ProductSpecificCommonConfig > (
465
+ config : & CommonConfiguration < T , ProductSpecificCommonConfig > ,
457
466
property_kinds : & [ PropertyNameKind ] ,
458
467
) -> Result < HashMap < PropertyNameKind , BTreeMap < String , Option < String > > > >
459
468
where
@@ -489,8 +498,8 @@ where
489
498
Ok ( result)
490
499
}
491
500
492
- fn parse_file_overrides < T > (
493
- config : & CommonConfiguration < T > ,
501
+ fn parse_file_overrides < T , ProductSpecificCommonConfig > (
502
+ config : & CommonConfiguration < T , ProductSpecificCommonConfig > ,
494
503
file : & str ,
495
504
) -> Result < BTreeMap < String , Option < String > > >
496
505
where
@@ -522,7 +531,7 @@ mod tests {
522
531
}
523
532
524
533
use super :: * ;
525
- use crate :: role_utils:: { Role , RoleGroup } ;
534
+ use crate :: role_utils:: { GenericProductSpecificCommonConfig , Role , RoleGroup } ;
526
535
use k8s_openapi:: api:: core:: v1:: PodTemplateSpec ;
527
536
use rstest:: * ;
528
537
use std:: collections:: HashMap ;
@@ -610,13 +619,14 @@ mod tests {
610
619
config_overrides : Option < HashMap < String , HashMap < String , String > > > ,
611
620
env_overrides : Option < HashMap < String , String > > ,
612
621
cli_overrides : Option < BTreeMap < String , String > > ,
613
- ) -> CommonConfiguration < Box < TestConfig > > {
622
+ ) -> CommonConfiguration < Box < TestConfig > , GenericProductSpecificCommonConfig > {
614
623
CommonConfiguration {
615
624
config : test_config. unwrap_or_default ( ) ,
616
625
config_overrides : config_overrides. unwrap_or_default ( ) ,
617
626
env_overrides : env_overrides. unwrap_or_default ( ) ,
618
627
cli_overrides : cli_overrides. unwrap_or_default ( ) ,
619
628
pod_overrides : PodTemplateSpec :: default ( ) ,
629
+ product_specific_common_config : GenericProductSpecificCommonConfig :: default ( ) ,
620
630
}
621
631
}
622
632
0 commit comments