@@ -3396,6 +3396,34 @@ def update_policy_v2(self, policy_key, json_request):
33963396 path = "/admin/v2/policies/" + self ._quote_policy_id (policy_key )
33973397 response = self .json_api_call ("PUT" , path , json_request )
33983398 return response
3399+
3400+ def update_policies_v2 (self , sections , sections_to_delete ,
3401+ edit_list , edit_all_policies = False ):
3402+ """
3403+ Update the contents of multiple policies.
3404+
3405+ Args:
3406+ sections (dict): policy content to update
3407+ sections_to_delete (list): List of section names to delete
3408+ edit_list (list): List of new policy keys to apply the changes to.
3409+ Ignored if edit_all_policies is True.
3410+ edit_all_policies (bool, optional): Apply changes to all policies.
3411+ Defaults to False.
3412+ Returns (list): all updated policies
3413+ """
3414+ path = "/admin/v2/policies/update"
3415+ params = {
3416+ "policies_to_update" : {
3417+ "edit_all_policies" : edit_all_policies ,
3418+ "edit_list" : edit_list ,
3419+ },
3420+ "policy_changes" : {
3421+ "sections" : sections ,
3422+ "sections_to_delete" : sections_to_delete ,
3423+ },
3424+ }
3425+ response = self .json_api_call ("PUT" , path , params )
3426+ return response
33993427
34003428 def create_policy_v2 (self , json_request ):
34013429 """
@@ -3407,6 +3435,25 @@ def create_policy_v2(self, json_request):
34073435 path = "/admin/v2/policies"
34083436 response = self .json_api_call ("POST" , path , json_request )
34093437 return response
3438+
3439+ def copy_policy_v2 (self , policy_key , new_policy_names_list ):
3440+ """
3441+ Copy policy to multiple new policies.
3442+
3443+ Args:
3444+ policy_key (str): Unique id of the policy to copy from
3445+ new_policy_names_list (array): The policy specified by policy_key
3446+ will be copied once for each name
3447+ in the list
3448+ Returns (list): all new policies
3449+ """
3450+ path = "/admin/v2/policies/copy"
3451+ params = {
3452+ "policy_key" : policy_key ,
3453+ "new_policy_names_list" : new_policy_names_list
3454+ }
3455+ response = self .json_api_call ("POST" , path , params )
3456+ return response
34103457
34113458 def get_policy_v2 (self , policy_key ):
34123459 """
0 commit comments