Beispiel #1
0
    def PUT(self, rule_id):
        """
        Update the replication rules locked flag .

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found
            500 InternalError
        """
        json_data = data()
        try:
            params = loads(json_data)
            options = params['options']
            update_replication_rule(rule_id=rule_id, options=options, issuer=ctx.env.get('issuer'))
        except AccessDenied as error:
            raise generate_http_error(401, 'AccessDenied', error.args[0])
        except RuleNotFound as error:
            raise generate_http_error(404, 'RuleNotFound', error.args[0])
        except AccountNotFound as error:
            raise generate_http_error(404, 'AccountNotFound', error.args[0])
        except ScratchDiskLifetimeConflict as error:
            raise generate_http_error(409, 'ScratchDiskLifetimeConflict', error.args[0])
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
        except UnsupportedOperation as error:
            raise generate_http_error(409, 'UnsupportedOperation', error.args[0])
        except RucioException as error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0])
        raise OK()
Beispiel #2
0
    def put(self, rule_id):
        """
        Update the replication rules locked flag .

        .. :quickref: Rule; update rule

        :status 200: Rule found
        :status 401: Invalid Auth Token
        :status 404: no rule found for id
        """
        parameters = json_parameters()
        options = param_get(parameters, 'options')
        try:
            update_replication_rule(rule_id=rule_id,
                                    options=options,
                                    issuer=request.environ.get('issuer'),
                                    vo=request.environ.get('vo'))
        except AccessDenied as error:
            return generate_http_error_flask(401, error)
        except (RuleNotFound, AccountNotFound) as error:
            return generate_http_error_flask(404, error)
        except (ScratchDiskLifetimeConflict, UnsupportedOperation) as error:
            return generate_http_error_flask(409, error)

        return '', 200
Beispiel #3
0
    def put(self, rule_id):
        """
        Update the replication rules locked flag .

        .. :quickref: Rule; update rule

        :status 200: Rule found
        :status 401: Invalid Auth Token
        :status 404: no rule found for id
        """
        json_data = request.data
        try:
            params = loads(json_data)
            options = params['options']
            update_replication_rule(rule_id=rule_id, options=options, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))
        except AccessDenied as error:
            return generate_http_error_flask(401, 'AccessDenied', error.args[0])
        except RuleNotFound as error:
            return generate_http_error_flask(404, 'RuleNotFound', error.args[0])
        except AccountNotFound as error:
            return generate_http_error_flask(404, 'AccountNotFound', error.args[0])
        except ScratchDiskLifetimeConflict as error:
            return generate_http_error_flask(409, 'ScratchDiskLifetimeConflict', error.args[0])
        except ValueError:
            return generate_http_error_flask(400, 'ValueError', 'Cannot decode json parameter list')
        except UnsupportedOperation as error:
            return generate_http_error_flask(409, 'UnsupportedOperation', error.args[0])
        except RucioException as error:
            return generate_http_error_flask(500, error.__class__.__name__, error.args[0])
        return "OK", 200
Beispiel #4
0
    def PUT(self, rule_id):
        """
        Update the replication rules locked flag .

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 Not Found
            500 InternalError
        """
        json_data = data()
        try:
            params = loads(json_data)
            options = params['options']
            update_replication_rule(rule_id=rule_id, options=options, issuer=ctx.env.get('issuer'))
        except AccessDenied, e:
            raise generate_http_error(401, 'AccessDenied', e.args[0][0])
Beispiel #5
0
    def put(self, rule_id):
        """
        ---
        summary: Update the replication rules parameters
        tags:
          - Rule
        parameters:
        - name: rule_id
          in: path
          description: The id of the replication rule.
          schema:
            type: string
          style: simple
        requestBody:
          description: Parameters for the new rule.
          content:
            'application/json':
              schema:
                type: object
                required:
                - options
                properties:
                  options:
                    description: The parameters to change.
                    type: object
                    properties:
                      lifetime:
                        description: The time in which the rule will expire in seconds.
                        type: integer
                      account:
                        description: The account of the replication rule.
                        type: string
                      state:
                        description: The state of the replication rule.
                        type: string
                      cancel_requests:
                        description: Cancels all requests if used together with state.
                        type: boolean
                      priority:
                        description: The priority of a rule.
                        type: integer
                      child_rule_id:
                        description: The child rule. Parent and child rule must be on the same dataset.
                        type: string
                      meta:
                        description: The meta of a rule.
                        type: object
                      boost_rule:
                        description: Boosts the processing of a rule.
                        type: object
                      locked:
                        description: The locked state of the replication rule.
                        type: boolean
                      comment:
                        description: The comment of the replication rule.
                        type: string
                      activity:
                        description: The activity of a replication rule.
                        type: string
                      source_replica_expression:
                        description: The source replica expression of a replication rule.
                        type: string
                      eol_at:
                        description: The end of life of a replication rule.
                        type: string
                      purge_replicas:
                        description: Purge replicas
                        type: boolean
        responses:
          200:
            description: OK
          401:
            description: Invalid Auth Token
          404:
            description: No rule found for the given id
       """
        parameters = json_parameters()
        options = param_get(parameters, 'options')
        try:
            update_replication_rule(rule_id=rule_id,
                                    options=options,
                                    issuer=request.environ.get('issuer'),
                                    vo=request.environ.get('vo'))
        except AccessDenied as error:
            return generate_http_error_flask(401, error)
        except (RuleNotFound, AccountNotFound) as error:
            return generate_http_error_flask(404, error)
        except (ScratchDiskLifetimeConflict, UnsupportedOperation) as error:
            return generate_http_error_flask(409, error)

        return '', 200