Example #1
0
class ProjectImage(FinalizeResponseMixin, views.APIView, BaseImage):
    def get_images(self, project_id, params):
        params['project_id'] = project_id
        query = convert_mappings(self.ResultMappings, params, reversed=True)
        query["access_token"] = self.request.user.token.access_token
        query['project_code'] = self.request.project.project_code
        return api.get_project_image_list(query)

    def get(self, request, project_id):
        """
        GET /api/depot/images/project/28aa9eda67644a6eb254d694d944307e/
        HTTP 200 OK
        Content-Type: application/json
        Vary: Accept

        {
            "code": 0,
            "message": "success",
            "data": {
                "count": 2,
                "next": null,
                "previous": null,
                "results": [
                    {
                        "repo": "paas/public/jdk1.8_maven2",
                        "deployBy": null,
                        "type": "public",
                        "desc": "description2",
                        "repoType": "",
                    },
                    {
                        "repo": "paas/public/jdk1.8_maven",
                        "deployBy": null,
                        "type": "public",
                        "desc": "description1",
                        "repoType": "",
                    }
                ]
            }
        }
        """
        self.project_id = project_id
        self.slz = ImageQuerySLZ(data=request.GET)
        self.slz.is_valid(raise_exception=True)
        result = self.get_images(project_id, self.slz.data)
        username = request.user.username

        return self.handle_response(result, username)
Example #2
0
    def get(self, request, project_id):
        """
        GET /api/depot/images/project/28aa9eda67644a6eb254d694d944307e/
        HTTP 200 OK
        Content-Type: application/json
        Vary: Accept

        {
            "code": 0,
            "message": "success",
            "data": {
                "count": 2,
                "next": null,
                "previous": null,
                "results": [
                    {
                        "repo": "paas/public/jdk1.8_maven2",
                        "deployBy": null,
                        "type": "public",
                        "desc": "description2",
                        "repoType": "",
                    },
                    {
                        "repo": "paas/public/jdk1.8_maven",
                        "deployBy": null,
                        "type": "public",
                        "desc": "description1",
                        "repoType": "",
                    }
                ]
            }
        }
        """
        self.project_id = project_id
        self.slz = ImageQuerySLZ(data=request.GET)
        self.slz.is_valid(raise_exception=True)
        result = self.get_images(project_id, self.slz.data)
        username = request.user.username

        return self.handle_response(result, username)