Beispiel #1
0
    def post(self):
        """
        Bulk add temporary data identifiers.

        .. :quickref: BulkDIDS; Bulk add temporary dids.

        :<json list dids: A list of dids.
        :status 201: Created.
        :status 400: Cannot decode json parameter list.
        :status 401: Invalid Auth Token.
        :status 500: Internal Error.
        """

        json_data = request.data
        try:
            dids = loads(json_data)
        except ValueError:
            return generate_http_error_flask(
                400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_temporary_dids(dids=dids,
                               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:
            logging.exception("Internal Error")
            return str(error), 500
        return 'Created', 201
Beispiel #2
0
    def POST(self):
        json_data = data()
        try:
            dids = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_temporary_dids(dids=dids, issuer=ctx.env.get('issuer'))
        except RucioException, e:
            raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
Beispiel #3
0
    def POST(self):
        json_data = data()
        try:
            dids = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')

        try:
            add_temporary_dids(dids=dids, 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:
            print(format_exc())
            raise InternalError(error)
        raise Created()
Beispiel #4
0
    def post(self):
        """
        Bulk add temporary data identifiers.

        .. :quickref: BulkDIDS; Bulk add temporary dids.

        :<json list dids: A list of dids.
        :status 201: Created.
        :status 400: Cannot decode json parameter list.
        :status 401: Invalid Auth Token.
        """
        dids = json_list()
        add_temporary_dids(dids=dids,
                           issuer=request.environ.get('issuer'),
                           vo=request.environ.get('vo'))
        return 'Created', 201
Beispiel #5
0
 def post(self):
     """
     ---
     summary: Add Temporary Data Identifiers
     description: Bulk adds temporary data identifiers.
     tags:
       - Temporary Data Identifiers
     requestBody:
       content:
         application/json:
           schema:
             description: A list of temporary dids.
             type: array
             items:
               description: A temporary did.
               properties:
                 rse:
                   description: The name of the RSE.
                   type: string
                 rse_id:
                   description: The id of the RSE. Can be specified instead of the RSE name.
                   type: string
                 scope:
                   description: The scope.
                   type: string
                 parent_scope:
                   description: The parent scope.
                   type: string
                 name:
                   description: The name of the DID.
                   type: string
                 path:
                   description: The path of the DID.
                   type: string
                 pfn:
                   description: The pfn of the DID.
                   type: string
                 bytes:
                   description: The size of the DID in bytes.
                   type: integer
                 md5:
                   description: The md5 checksum of the DID.
                   type: string
                 adler32:
                   description: The adler32 checksum of the DID.
                   type: string
                 guid:
                   description: The guid of the DID.
                   type: string
                 events:
                   description: The events of the DID.
                   type: string
                 parent_name:
                   description: The name of the parent.
                   type: string
                 offset:
                   description: The offset of the DID.
                   type: integer
     responses:
       201:
         description: Created
         content:
           application/json:
             schema:
               type: string
               enum: ["Created"]
       401:
         description: Invalid Auth Token
       406:
         description: Not acceptable
     """
     dids = json_list()
     add_temporary_dids(dids=dids,
                        issuer=request.environ.get('issuer'),
                        vo=request.environ.get('vo'))
     return 'Created', 201