コード例 #1
0
    def post(self):
        """
        Resurrect DIDs.

        .. :quickref: Resurrect; Resurrect DID.

        HTTP Success:
            201 Created


        HTTP Error:
            401 Unauthorized
            404 Not Found
            409 Conflict
            500 Internal Error

        """
        dids = json_list()

        try:
            resurrect(dids=dids, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))
        except DataIdentifierNotFound as error:
            return generate_http_error_flask(404, error)
        except (DuplicateContent, DataIdentifierAlreadyExists, UnsupportedOperation) as error:
            return generate_http_error_flask(409, error)
        except AccessDenied as error:
            return generate_http_error_flask(401, error)
        return 'Created', 201
コード例 #2
0
ファイル: dids.py プロジェクト: vokac/rucio
    def post(self):
        """
        Add new DIDs in bulk.

        .. :quickref: BulkDID; Bulk add DIDs.

                **Example request**:

        .. sourcecode:: http

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

            [
              {"scope": "scope1", "type": "CONTAINER", "name": "container1",
               "account": "jdoe", "length": 1},
              {"scope": "scope1", "type": "DATASET", "name": "dataset1",
               "account": "jdoe", "length": 3}
            ]


        **Example response**:

        .. sourcecode:: http

            HTTP/1.1 201 Created
            Vary: Accept

        :reqheader Accept: application/json
        :<json string scope: the new DID scope
        :<json string name: the new DID name
        :<json string type: the new DID type
        :<json string account: the owner account of the new DID
        :<json string statuses: monotonic
        :status 201: new DIDs created
        :status 401: Invalid Auth Token
        :status 406: Not Acceptable
        :status 409: DID already exists
        """
        dids = json_list()
        try:
            add_dids(dids=dids,
                     issuer=request.environ.get('issuer'),
                     vo=request.environ.get('vo'))
        except DataIdentifierNotFound as error:
            return generate_http_error_flask(404, error)
        except (DuplicateContent, DataIdentifierAlreadyExists,
                UnsupportedOperation) as error:
            return generate_http_error_flask(409, error)
        except AccessDenied as error:
            return generate_http_error_flask(401, error)
        return 'Created', 201
コード例 #3
0
ファイル: tmp_dids.py プロジェクト: vokac/rucio
    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
コード例 #4
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