def put(self, rse, scheme, hostname=None, port=None): """ Updates attributes of an existing protocol entry. Because protocol identifier, hostname, and port are used as unique identifier they are immutable. .. :quickref: Protocol; Update RSE protocol. :param rse: The RSE name. :param scheme: The protocol identifier. :param hostname: The hostname defined for the scheme, used if more than one scheme is registered with the same identifier. :param port: The port registered for the hostname, ued if more than one scheme is registered with the same identifier and hostname. :<json dict paramaters: parameter of the new protocol entry. :status 201: Created. :status 400: Cannot decode json parameter dictionary. :status 401: Invalid Auth Token. :status 404: RSE not found. :status 404: RSE Protocol Not Supported. :status 404: RSE Protocol Domain Not Supported. :status 409: RSE Protocol Priority Error. :status 500: Internal Error. """ json_data = request.data.decode() try: parameter = loads(json_data) except ValueError: return generate_http_error_flask( 400, 'ValueError', 'Cannot decode json parameter dictionary') try: update_protocols(rse, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'), scheme=scheme, hostname=hostname, port=port, data=parameter) except InvalidObject as error: return generate_http_error_flask(400, 'InvalidObject', error.args[0]) except RSEProtocolNotSupported as error: return generate_http_error_flask(404, 'RSEProtocolNotSupported', error.args[0]) except RSENotFound as error: return generate_http_error_flask(404, 'RSENotFound', error.args[0]) except RSEProtocolDomainNotSupported as error: return generate_http_error_flask(404, 'RSEProtocolDomainNotSupported', error.args[0]) except RSEProtocolPriorityError as error: return generate_http_error_flask(409, 'RSEProtocolPriorityError', error.args[0]) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0]) except Exception as error: print(format_exc()) return str(error), 500 return '', 200
def PUT(self, rse, scheme, hostname=None, port=None): """ Updates attributes of an existing protocol entry. Because protocol identifier, hostname, and port are used as unique identifier they are immutable. HTTP Success: 200 OK HTTP Error: 400 Bad Request 401 Unauthorized 404 Resource not Found 409 Conflict 500 InternalError """ json_data = data() try: parameter = loads(json_data) except ValueError: raise generate_http_error( 400, 'ValueError', 'Cannot decode json parameter dictionary') try: update_protocols(rse, issuer=ctx.env.get('issuer'), scheme=scheme, hostname=hostname, port=port, data=parameter) except InvalidObject, error: raise generate_http_error(400, 'InvalidObject', error[0][0])
def PUT(self, rse, scheme, hostname=None, port=None): """ Updates attributes of an existing protocol entry. Because protocol identifier, hostname, and port are used as unique identifier they are immutable. HTTP Success: 200 OK HTTP Error: 400 Bad Request 401 Unauthorized 404 Resource not Found 409 Conflict 500 InternalError """ json_data = data() try: parameter = loads(json_data) except ValueError: raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary') try: update_protocols(rse, issuer=ctx.env.get('issuer'), scheme=scheme, hostname=hostname, port=port, data=parameter) except InvalidObject, e: raise generate_http_error(400, 'InvalidObject', e[0][0])
def PUT(self, rse, scheme, hostname=None, port=None): """ Updates attributes of an existing protocol entry. Because protocol identifier, hostname, and port are used as unique identifier they are immutable. HTTP Success: 200 OK HTTP Error: 400 Bad Request 401 Unauthorized 404 Resource not Found 409 Conflict 500 InternalError """ json_data = data() try: parameter = loads(json_data) except ValueError: raise generate_http_error( 400, 'ValueError', 'Cannot decode json parameter dictionary') try: update_protocols(rse, issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo'), scheme=scheme, hostname=hostname, port=port, data=parameter) except InvalidObject as error: raise generate_http_error(400, 'InvalidObject', error.args[0]) except RSEProtocolNotSupported as error: raise generate_http_error(404, 'RSEProtocolNotSupported', error.args[0]) except RSENotFound as error: raise generate_http_error(404, 'RSENotFound', error.args[0]) except RSEProtocolDomainNotSupported as error: raise generate_http_error(404, 'RSEProtocolDomainNotSupported', error.args[0]) except RSEProtocolPriorityError as error: raise generate_http_error(409, 'RSEProtocolPriorityError', error.args[0]) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0]) except Exception as error: print(error) print(format_exc()) raise InternalError(error) raise OK()
def put(self, rse, scheme, hostname=None, port=None): """ Updates attributes of an existing protocol entry. Because protocol identifier, hostname, and port are used as unique identifier they are immutable. .. :quickref: Protocol; Update RSE protocol. :param rse: The RSE name. :param scheme: The protocol identifier. :param hostname: The hostname defined for the scheme, used if more than one scheme is registered with the same identifier. :param port: The port registered for the hostname, ued if more than one scheme is registered with the same identifier and hostname. :<json dict paramaters: parameter of the new protocol entry. :status 201: Created. :status 400: Cannot decode json parameter dictionary. :status 401: Invalid Auth Token. :status 404: RSE not found. :status 404: RSE Protocol Not Supported. :status 404: RSE Protocol Domain Not Supported. :status 409: RSE Protocol Priority Error. """ parameters = json_parameters() try: update_protocols( rse, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'), scheme=scheme, hostname=hostname, port=port, data=parameters, ) except InvalidObject as error: return generate_http_error_flask(400, error) except (RSEProtocolNotSupported, RSENotFound, RSEProtocolDomainNotSupported) as error: return generate_http_error_flask(404, error) except (RSEProtocolPriorityError, Duplicate) as error: return generate_http_error_flask(409, error) return '', 200