@never_cache
@get_link_or_exception()
def link_clone(request, link):
  if request.method != 'POST':
    raise StructuredException(code="INVALID_METHOD", message=_('POST request required.'), error_code=405)

  response = {
    'status': 0,
    'errors': None,
    'link': None
  }

  link.id = -1
  link.name = '%s-copy' % link.name
  try:
    c = client.SqoopClient(conf.SERVER_URL.get(), request.user.username, request.LANGUAGE_CODE)
    response['link'] = c.create_link(link).to_dict()
  except RestException, e:
    response.update(handle_rest_exception(e, _('Could not clone link.')))
  except SqoopException, e:
    response['status'] = 100
    response['errors'] = e.to_dict()
  return JsonResponse(response)
dataset/ETHPy150Open cloudera/hue/apps/sqoop/src/sqoop/api/link.py/link_clone/original