def get(self): """ Export data from Rucio. .. :quickref: Export data **Example request**: .. sourcecode:: http GET /export HTTP/1.1 Host: rucio.cern.ch **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json {"rses": [{"rse": "MOCK", "rse_type": "TAPE"}], "distances": {}} :resheader Content-Type: application/json :status 200: DIDs found :status 401: Invalid Auth Token :status 406: Not Acceptable :returns: dictionary with rucio data """ try: return render_json( **export_data(issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))) except RucioException as error: return generate_http_error_flask(500, error.__class__.__name__, error.args[0])
def get(self): """ --- summary: Export data description: Export data from rucio. tags: - Export parameters: - name: distance in: query description: Should the distance be enabled? schema: type: boolean required: false responses: 200: description: OK content: application/json: schema: type: object description: Dictionary with rucio data. 401: description: Invalid Auth Token 406: description: Not acceptable """ distance = request.args.get('distance', default='True') == 'True' return Response(render_json(**export_data(issuer=request.environ.get('issuer'), distance=distance, vo=request.environ.get('vo'))), content_type='application/json')
def GET(self): """ Export data from Rucio. HTTP Success: 200 OK HTTP Error: 400 Bad request 401 Unauthorized 404 Resource not Found 406 Not Acceptable 500 InternalError """ header('Content-Type', 'application/json') distance = True if ctx.query: params = parse_qs(ctx.query[1:]) for k, v in params.items(): if k == 'distance': distance = v[0] == 'True' try: return render_json(**export_data(issuer=ctx.env.get('issuer'), distance=distance, vo=ctx.env.get('vo'))) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0])
def test_api_exporter(self): """ EXPORTER (API): Test external representation of exported data """ out = export_data('root', **self.new_vo) rses = out['rses'] assert self.rse3_name in rses assert self.rse3_id not in rses distances = out['distances'] assert self.rse3_name in distances assert self.rse3_id not in distances assert self.rse4_name in distances[self.rse3_name] assert self.rse4_id not in distances[self.rse3_name] # check for interference from other VOs if self.multi_vo: assert self.rse_name not in rses assert self.rse_id not in rses assert self.rse2_name not in rses assert self.rse2_id not in rses assert self.rse_name not in distances assert self.rse_id not in distances assert self.rse2_name not in distances assert self.rse2_id not in distances
def get(self): """ Export data from Rucio. .. :quickref: Export data **Example request**: .. sourcecode:: http GET /export HTTP/1.1 Host: rucio.cern.ch **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Vary: Accept Content-Type: application/json {"rses": [{"rse": "MOCK", "rse_type": "TAPE"}], "distances": {}} :resheader Content-Type: application/json :status 200: DIDs found :status 401: Invalid Auth Token :status 406: Not Acceptable :returns: dictionary with rucio data """ distance = request.args.get('distance', default='True') == 'True' return Response( render_json(**export_data(issuer=request.environ.get('issuer'), distance=distance, vo=request.environ.get('vo'))), content_type='application/json')
def GET(self): """ Export data from Rucio. HTTP Success: 200 OK HTTP Error: 400 Bad request 401 Unauthorized 404 Resource not Found 406 Not Acceptable 500 InternalError """ header('Content-Type', 'application/json') try: return render_json(**export_data(issuer=ctx.env.get('issuer'), vo=ctx.env.get('vo'))) except RucioException as error: raise generate_http_error(500, error.__class__.__name__, error.args[0])