1818-record (seeding_policy , {
1919 name :: binary (),
2020 queue_pattern = <<" .*" >> :: binary (),
21- definition = [] :: definitions ()
21+ definition = [] :: definitions (),
22+ apply_to = <<" all" >>
2223}).
2324
2425-type seeded_user_properties () :: #{
@@ -43,9 +44,9 @@ apply(VHost, ActingUser) ->
4344 end ,
4445 lists :foreach (
4546 fun (P ) ->
46- ok = rabbit_policy :set_op (VHost , P # seeding_policy .name , P # seeding_policy .queue_pattern , P # seeding_policy .definition ,
47- undefined , undefined , ActingUser ),
48- ? LOG_INFO (" Applied default operator policy to vhost '~tp ': ~tp " , [VHost , P ])
47+ ok = rabbit_policy :set_op (VHost , P # seeding_policy .name , P # seeding_policy .queue_pattern , P # seeding_policy .definition ,
48+ undefined , P # seeding_policy . apply_to , ActingUser ),
49+ ? LOG_INFO (" Applied default operator policy to vhost '~tp ': ~tp " , [VHost , P ])
4950 end ,
5051 list_operator_policies (VHost )
5152 ),
@@ -93,12 +94,15 @@ list_operator_policies(VHost) ->
9394 case re :run (VHost , RE , [{capture , none }]) of
9495 match ->
9596 QPattern = proplists :get_value (<<" queue_pattern" >>, Ss , <<" .*" >>),
97+ ApplyTo = proplists :get_value (<<" apply_to" >>, Ss , <<" all" >>),
9698 Ss1 = proplists :delete (<<" queue_pattern" >>, Ss ),
9799 Ss2 = proplists :delete (<<" vhost_pattern" >>, Ss1 ),
100+ Ss3 = proplists :delete (<<" apply_to" >>, Ss2 ),
98101 {true , # seeding_policy {
99102 name = PolicyName ,
100103 queue_pattern = QPattern ,
101- definition = underscore_to_dash (Ss2 )
104+ apply_to = ApplyTo ,
105+ definition = underscore_to_dash (Ss3 )
102106 }};
103107 _ ->
104108 false
0 commit comments