Esempio n. 1
0
    def GET(self, rule_id):
        """ get analysis for given rule.

        HTTP Success:
            200 OK

        HTTP Error:
            404 Not Found
            406 Not Acceptable
            500 InternalError

        :returns: JSON dict containing informations about the requested user.
        """
        header('Content-Type', 'application/json')
        try:
            analysis = examine_replication_rule(rule_id,
                                                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])
        except Exception as error:
            raise InternalError(error)

        return render_json(**analysis)
Esempio n. 2
0
    def get(self, rule_id):
        """ get analysis for given rule.

        .. :quickref: RuleAnalysis; analyse rule,

        :resheader Content-Type: application/json
        :status 200: Rule found
        :status 406: Not Acceptable
        :returns: JSON dict containing informations about the requested user.
        """
        analysis = examine_replication_rule(rule_id, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))
        return Response(render_json(**analysis), content_type='application/json')
Esempio n. 3
0
    def get(self, rule_id):
        """ get analysis for given rule.

        .. :quickref: RuleAnalysis; analyse rule,

        :resheader Content-Type: application/x-json-stream
        :status 200: Rule found
        :status 406: Not Acceptable
        :status 500: Database Exception
        :returns: JSON dict containing informations about the requested user.
        """
        try:
            analysis = examine_replication_rule(rule_id, 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])
        except Exception as error:
            return error, 500

        return Response(render_json(**analysis), content_type="application/x-json-stream")
Esempio n. 4
0
 def get(self, rule_id):
     """
     ---
     summary: Get the analysis of a rule
     tags:
       - Rule
     parameters:
     - name: rule_id
       in: path
       description: The id of the replication rule.
       schema:
         type: string
       style: simple
     responses:
       200:
         description: OK
         content:
           application/json:
             schema:
               type: object
               properties:
                 rule_error:
                   type: string
                   description: The state of the rule.
                 transfers:
                   type: array
                   description: List of all transfer errors.
                   items:
                     type: object
                     properties:
                       scope:
                         type: string
                         description: The scope of the transfer.
                       name:
                         type: string
                         description: The name of the lock.
                       rse_id:
                         type: string
                         description: The rse_id of the transfered lock.
                       rse:
                         type: object
                         description: Information about the rse of the transfered lock.
                       attempts:
                         type: integer
                         description: The number of attempts.
                       last_error:
                         type: string
                         description: The last error that occured.
                       last_source:
                         type: string
                         description: The last source.
                       sources:
                         type: array
                         description: All available rse sources.
                       last_time:
                         type: string
                         description: The time of the last transfer.
       401:
         description: Invalid Auth Token
       404:
         description: No rule found for the given id
       406:
         description: Not acceptable.
     """
     analysis = examine_replication_rule(
         rule_id,
         issuer=request.environ.get('issuer'),
         vo=request.environ.get('vo'))
     return Response(render_json(**analysis),
                     content_type='application/json')