Exemple #1
0
 def get_area(self, request, area_id):
     """get area info"""
     area_info = paas_cc.get_area_info(request.user.token.access_token,
                                       area_id)
     if area_info.get("code") != ErrorCode.NoError:
         raise error_codes.APIError(area_info.get("message"))
     return area_info.get("data") or {}
Exemple #2
0
    def info(self, request, area_id):
        """get the area info"""
        resp = paas_cc.get_area_info(request.user.token.access_token, area_id)
        if resp.get('code') != ErrorCode.NoError:
            raise error_codes.APIError(f'request bcs cc area info api error, {resp.get("message")}')

        data = resp.get('data') or {}
        data['configuration'] = json.loads(data.pop('configuration', '{}'))

        return Response(data)