def remove_zone(module, gcdns, zone):
 if (zone is None):
  return False
 if (len(zone.list_records()) > 2):
  module.fail_json(msg=('zone is not empty and cannot be removed: %s' % zone.domain), changed=False)
 try:
  if (not module.check_mode):
   gcdns.delete_zone(zone)
  return True
 except ResourceNotFoundError:
  return False
 except InvalidRequestError as error:
  if (error.code == 'containerNotEmpty'):
   module.fail_json(msg=('zone is not empty and cannot be removed: %s' % zone.domain), changed=False)
  else:
   raise

def remove_zone ( module , gcdns , zone ) : if ( zone is None ) : return False if ( len ( zone . list_records ( ) ) > 2 ) : module . fail_json ( msg = ( 'zone is not empty and cannot be removed: %s' % zone . domain ) , changed = False ) try : if ( not module . check_mode ) : gcdns . delete_zone ( zone ) return True except ResourceNotFoundError : return False except InvalidRequestError as error : if ( error . code == 'containerNotEmpty' ) : module . fail_json ( msg = ( 'zone is not empty and cannot be removed: %s' % zone . domain ) , changed = False ) else : raise
removes an existing google cloud dns zone .