Пример #1
0
    def POST(self):
        """ Import data into Rucio.

        HTTP Success:
            200 OK

        HTTP Error:
            400 Bad request
            401 Unauthorized
            404 Resource not Found
            500 InternalError
        """
        header('Content-Type', 'application/x-json-stream')
        json_data = data()
        try:
            data_to_import = json_data and parse_response(json_data)
        except ValueError:
            raise generate_http_error(
                400, 'ValueError', 'Cannot decode json parameter dictionary')

        try:
            import_data(data=data_to_import,
                        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])

        raise Created()
Пример #2
0
    def post(self):
        """ Import data into Rucio.

        .. :quickref: Import data into Rucio.

        **Example request**:

        .. sourcecode:: http

            POST /import HTTP/1.1
            Host: rucio.cern.ch

            {
                "rses": [{"rse": "MOCK", "rse_type": "TAPE"}]
            }

        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 201 OK
            Vary: Accept

            Created
        :status 200: DIDs found
        :status 401: Invalid Auth Token
        :returns: dictionary with rucio data
        """
        data = json_parameters(parse_response)
        import_data(data=data,
                    issuer=request.environ.get('issuer'),
                    vo=request.environ.get('vo'))
        return 'Created', 201
Пример #3
0
    def post(self):
        """ Import data into Rucio.

        .. :quickref: Import data into Rucio.

        **Example request**:

        .. sourcecode:: http

            POST /import HTTP/1.1
            Host: rucio.cern.ch

            {
                "rses": [{"rse": "MOCK", "rse_type": "TAPE"}]
            }

        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 201 OK
            Vary: Accept
            Content-Type: application/x-json-stream

            Created
        :resheader Content-Type: application/json
        :status 200: DIDs found
        :status 401: Invalid Auth Token
        :returns: dictionary with rucio data
        """
        json_data = request.data
        try:
            data_to_import = json_data and parse_response(json_data)
        except ValueError:
            return generate_http_error_flask(
                400, 'ValueError', 'Cannot decode json parameter dictionary')

        try:
            import_data(data=data_to_import,
                        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])

        return 'Created', 201
Пример #4
0
 def post(self):
     """
     ---
     summary: Import data
     description: Import data into rucio
     tags:
         - Import
     requestBody:
       content:
         'application/json':
           schema:
             type: object
             properties:
               rses:
                 description: Rse data with rse name as key.
                 type: object
                 additionalProperties:
                   x-additionalPropertiesName: rse name
                   type: object
                   properties:
                     rse_type:
                       description: The type of an rse.
                       type: string
                       enum: ['DISK', 'TAPE']
               distances:
                 description: Distances data with src rse name as key.
                 type: object
                 additionalProperties:
                   x-additionalPropertiesName: src rse
                   description: Distances with dest rse as key.
                   type: object
                   additionalProperties:
                     x-additionalPropertiesName: dest rse
                     description: Distance for two rses.
                     type: object
                     properties:
                       ranking:
                         description: The distance between the rses.
                         type: integer
                       agis_distance:
                         description: The agis distance between the rses.
                         type: integer
                       geoip_distance:
                         description: The geoip distance between the rses.
                         type: integer
                       active:
                         description: Active FTS transfer.
                         type: integer
                       submitted:
                         description: Submitted FTS transfer.
                         type: integer
                       transfer_speed:
                         description: FTS transfer speed.
                         type: integer
                       finished:
                         description: Finished FTS transfer.
                         type: integer
                       failed:
                         description: Failed fts transfer.
                         type: integer
               accounts:
                 description: Account data.
                 type: array
                 items:
                   description: An account.
                   type: object
                   properties:
                     account:
                       description: The account identifier.
                       type: string
                     email:
                       description: The email of an account.
                       type: string
                     identities:
                       description: The identiies accociated with an account. Deletes old identites and adds the newly defined ones.
                       type: array
                       items:
                         description: One identity associated with an account.
                         type: object
                         properties:
                           type:
                             description: The type of the identity.
                             type: string
                             enum: ['X509', 'GSS', 'USERPASS', 'SSH', 'SAML', 'OIDC']
                           identity:
                             description: Identifier of the identity.
                             type: string
                           password:
                             description: The password if the type is USERPASS.
                             type: string
     responses:
       201:
         description: OK
         content:
           application/json:
             schema:
               type: string
               enum: ['Created']
       401:
         description: Invalid Auth Token
     """
     data = json_parameters(parse_response)
     import_data(data=data, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))
     return 'Created', 201