#NEWLINE# def create_policy( name , policy_name , policy_type , policy , region = None , key = None , keyid = None , profile = None ) : #NEWLINE# #INDENT# '\n    Create an ELB policy.\n\n    .. versionadded:: 2016.3.0\n\n    CLI example:\n\n    .. code-block:: bash\n\n        salt myminion boto_elb.create_policy myelb mypolicy LBCookieStickinessPolicyType \'{"CookieExpirationPeriod": 3600}\'\n    ' #NEWLINE# conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) #NEWLINE# if ( not exists ( name , region , key , keyid , profile ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# success = conn . create_lb_policy ( name , policy_name , policy_type , policy ) #NEWLINE# if success : #NEWLINE# #INDENT# log . info ( 'Created policy {0} on ELB {1}' . format ( policy_name , name ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = 'Failed to create policy {0} on ELB {1}' . format ( policy_name , name ) #NEWLINE# log . error ( msg ) #NEWLINE# return False #NEWLINE# #UNINDENT# #UNINDENT# except boto . exception . BotoServerError as e : #NEWLINE# #INDENT# log . debug ( e ) #NEWLINE# msg = 'Failed to create policy {0} on ELB {1}: {2}' . format ( policy_name , name , e . message ) #NEWLINE# log . error ( msg ) #NEWLINE# return False