def detach_network_interface(name=None, network_interface_id=None, attachment_id=None, force=False, region=None, key=None, keyid=None, profile=None):
 if (not (name or network_interface_id or attachment_id)):
  raise SaltInvocationError('Either name or network_interface_id or attachment_id must be provided.')
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 r = {}
 if (not attachment_id):
  result = _get_network_interface(conn, name, network_interface_id)
  if ('error' in result):
   return result
  eni = result['result']
  info = _describe_network_interface(eni)
  try:
   attachment_id = info['attachment']['id']
  except KeyError:
   r['error'] = {'message': 'Attachment id not found for this ENI.'}
   return r
 try:
  r['result'] = conn.detach_network_interface(attachment_id, force)
 except boto.exception.EC2ResponseError as e:
  r['error'] = __utils__['boto.get_error'](e)
 return r

def detach_network_interface ( name = None , network_interface_id = None , attachment_id = None , force = False , region = None , key = None , keyid = None , profile = None ) : if ( not ( name or network_interface_id or attachment_id ) ) : raise SaltInvocationError ( 'Either name or network_interface_id or attachment_id must be provided.' ) conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) r = { } if ( not attachment_id ) : result = _get_network_interface ( conn , name , network_interface_id ) if ( 'error' in result ) : return result eni = result [ 'result' ] info = _describe_network_interface ( eni ) try : attachment_id = info [ 'attachment' ] [ 'id' ] except KeyError : r [ 'error' ] = { 'message' : 'Attachment id not found for this ENI.' } return r try : r [ 'result' ] = conn . detach_network_interface ( attachment_id , force ) except boto . exception . EC2ResponseError as e : r [ 'error' ] = __utils__ [ 'boto.get_error' ] ( e ) return r
detach an elastic network interface .