#NEWLINE# def create_cert_binding( name , site , hostheader = '' , ipaddress = '*' , port = 443 , sslflags = 0 ) : #NEWLINE# #INDENT# '\n    Assign a certificate to an IIS binding.\n\n    .. note:\n\n        The web binding that the certificate is being assigned to must already exist.\n\n    :param str name: The thumbprint of the certificate.\n    :param str site: The IIS site name.\n    :param str hostheader: The host header of the binding.\n    :param str ipaddress: The IP address of the binding.\n    :param str port: The TCP port of the binding.\n    :param str sslflags: Flags representing certificate type and certificate storage of the binding.\n\n    .. versionadded:: Carbon\n    ' #NEWLINE# ret = { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'comment' : str ( ) , #NEWLINE# 'result' : None , #NEWLINE# #UNINDENT# } #NEWLINE# binding_info = _get_binding_info ( hostheader , ipaddress , port ) #NEWLINE# current_cert_bindings = __salt__ [ 'win_iis.list_cert_bindings' ] ( site ) #NEWLINE# if ( binding_info in current_cert_bindings ) : #NEWLINE# #INDENT# current_name = current_cert_bindings [ binding_info ] [ 'certificatehash' ] #NEWLINE# if ( name == current_name ) : #NEWLINE# #INDENT# ret [ 'comment' ] = 'Certificate binding already present: {0}' . format ( name ) #NEWLINE# ret [ 'result' ] = True #NEWLINE# return ret #NEWLINE# #UNINDENT# ret [ 'comment' ] = 'Certificate binding already present with a different thumbprint: {0}' . format ( current_name ) #NEWLINE# ret [ 'result' ] = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# ret [ 'comment' ] = 'Certificate binding will be created: {0}' . format ( name ) #NEWLINE# ret [ 'changes' ] = { #NEWLINE# #INDENT# 'old' : None , #NEWLINE# 'new' : name , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret [ 'comment' ] = 'Created certificate binding: {0}' . format ( name ) #NEWLINE# ret [ 'changes' ] = { #NEWLINE# #INDENT# 'old' : None , #NEWLINE# 'new' : name , #NEWLINE# #UNINDENT# } #NEWLINE# ret [ 'result' ] = __salt__ [ 'win_iis.create_cert_binding' ] ( name , site , hostheader , ipaddress , ipaddress , sslflags ) #NEWLINE# #UNINDENT# #UNINDENT# return ret