예제 #1
0
    def get(self):
        """
        ---
        summary: List
        description: List the full configuration.
        tags:
          - Config
        responses:
          200:
            description: OK
            content:
              application/json:
                schema:
                  description: A dict with the sections as keys and a dict with the configuration as value.
                  type: object
          401:
            description: Invalid Auth Token
          406:
            description: Not acceptable
        """
        res = {}
        for section in config.sections(issuer=request.environ.get('issuer'),
                                       vo=request.environ.get('vo')):
            res[section] = {}
            for item in config.items(section,
                                     issuer=request.environ.get('issuer'),
                                     vo=request.environ.get('vo')):
                res[section][item[0]] = item[1]

        return jsonify(res), 200
예제 #2
0
파일: config.py 프로젝트: sartiran/rucio
    def get(self, section):
        """
        List configuration of a section

        .. :quickref: Section; List config section.

        :param section: The section name.
        :resheader Content-Type: application/json
        :status 200: OK.
        :status 401: Invalid Auth Token.
        :status 404: Config not found.
        :status 500: Internal Error.
        """

        res = {}
        for item in config.items(section,
                                 issuer=request.environ.get('issuer')):
            res[item[0]] = item[1]

        if res == {}:
            return generate_http_error_flask(
                404, 'ConfigNotFound',
                'No configuration found for section \'%s\'' % section)

        return Response(json.dumps(res), content_type="application/json")
예제 #3
0
    def GET(self, section):
        """
        List configuration of a section

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            406 Not Acceptable
            404 NotFound
        """

        header('Content-Type', 'application/json')

        res = {}
        for item in config.items(section,
                                 issuer=ctx.env.get('issuer'),
                                 vo=ctx.env.get('vo')):
            res[item[0]] = item[1]

        if res == {}:
            raise generate_http_error(
                404, 'ConfigNotFound',
                'No configuration found for section \'%s\'' % section)

        return json.dumps(res)
예제 #4
0
파일: config.py 프로젝트: vokac/rucio
    def get(self, section):
        """
        List configuration of a section

        .. :quickref: Section; List config section.

        :param section: The section name.
        :resheader Content-Type: application/json
        :status 200: OK.
        :status 401: Invalid Auth Token.
        :status 404: Config not found.
        :status 406: Not Acceptable.
        """
        res = {}
        for item in config.items(section,
                                 issuer=request.environ.get('issuer'),
                                 vo=request.environ.get('vo')):
            res[item[0]] = item[1]

        if res == {}:
            return generate_http_error_flask(
                status_code=404,
                exc=ConfigNotFound.__name__,
                exc_msg=f"No configuration found for section '{section}'")

        return jsonify(res), 200
예제 #5
0
    def get(self, section):
        """
        ---
        summary: List Sections
        tags:
          - Config
        parameters:
        - name: section
          in: path
          description: The section to return.
          schema:
            type: string
          style: simple
        requestBody:
          content:
            'application/json':
              schema:
                type: object
                required:
                - bytes
                properties:
                  bytes:
                    description: The new limit in bytes.
                    type: integer
        responses:
          200:
            description: OK
            content:
              application/json:
                schema:
                  description: Dictionary of section options.
                  type: object
          401:
            description: Invalid Auth Token
          404:
            description: Config not found
          406:
            description: Not acceptable
        """
        res = {}
        for item in config.items(section,
                                 issuer=request.environ.get('issuer'),
                                 vo=request.environ.get('vo')):
            res[item[0]] = item[1]

        if res == {}:
            return generate_http_error_flask(
                status_code=404,
                exc=ConfigNotFound.__name__,
                exc_msg=f"No configuration found for section '{section}'")

        return jsonify(res), 200
예제 #6
0
파일: config.py 프로젝트: pombredanne/rucio
    def GET(self):
        """
        List full configuration.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
        """

        header('Content-Type', 'application/json')

        res = {}
        for section in config.sections(issuer=ctx.env.get('issuer')):
            res[section] = {}
            for item in config.items(section, issuer=ctx.env.get('issuer')):
                res[section][item[0]] = item[1]

        return json.dumps(res)
예제 #7
0
    def GET(self):
        """
        List full configuration.

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
        """

        header('Content-Type', 'application/json')

        res = {}
        for section in config.sections(issuer=ctx.env.get('issuer')):
            res[section] = {}
            for item in config.items(section, issuer=ctx.env.get('issuer')):
                res[section][item[0]] = item[1]

        return json.dumps(res)
예제 #8
0
파일: config.py 프로젝트: sartiran/rucio
    def get(self):
        """
        List full configuration.

        .. :quickref: Config; List full config.

        :resheader Content-Type: application/json
        :status 200: OK.
        :status 401: Invalid Auth Token.
        :status 500: Internal Error.
        """

        res = {}
        for section in config.sections(issuer=request.environ.get('issuer')):
            res[section] = {}
            for item in config.items(section,
                                     issuer=request.environ.get('issuer')):
                res[section][item[0]] = item[1]

        return Response(json.dumps(res), content_type="application/json")
예제 #9
0
파일: config.py 프로젝트: vokac/rucio
    def get(self):
        """
        List full configuration.

        .. :quickref: Config; List full config.

        :resheader Content-Type: application/json
        :status 200: OK.
        :status 401: Invalid Auth Token.
        :status 406: Not Acceptable.
        """
        res = {}
        for section in config.sections(issuer=request.environ.get('issuer'),
                                       vo=request.environ.get('vo')):
            res[section] = {}
            for item in config.items(section,
                                     issuer=request.environ.get('issuer'),
                                     vo=request.environ.get('vo')):
                res[section][item[0]] = item[1]

        return jsonify(res), 200
예제 #10
0
파일: config.py 프로젝트: pombredanne/rucio
    def GET(self, section):
        """
        List configuration of a section

        HTTP Success:
            200 OK

        HTTP Error:
            401 Unauthorized
            404 NotFound
        """

        header('Content-Type', 'application/json')

        res = {}
        for item in config.items(section, issuer=ctx.env.get('issuer')):
            res[item[0]] = item[1]

        if res == {}:
            raise generate_http_error(404, 'ConfigNotFound', 'No configuration found for section \'%s\'' % section)

        return json.dumps(res)