def POST(self, key):
"""
Create a new value for a key.
HTTP Success:
201 Created
HTTP Error:
401 Unauthorized
404 Not Found
409 Conflict
500 Internal Error
:param Rucio-Auth-Account: Account identifier.
:param Rucio-Auth-Token: as an 32 character hex string.
:params Rucio-Account: account belonging to the new scope.
"""
json_data = data()
try:
params = loads(json_data)
value = params['value']
except ValueError:
raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
try:
add_value(key=key, value=value, issuer=ctx.env.get('issuer'))
except Duplicate, e:
raise generate_http_error(409, 'Duplicate', e[0][0])
except InvalidValueForKey, e:
raise generate_http_error(400, 'InvalidValueForKey', e[0][0])
except KeyNotFound, e:
raise generate_http_error(400, 'KeyNotFound', e[0][0])
except RucioException, e:
raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
except Exception, e:
print e
raise InternalError(e)
raise Created()
评论列表
文章目录