Skip to content

Commit

Permalink
Merge 2a68ea9 into 1917a62
Browse files Browse the repository at this point in the history
  • Loading branch information
ycheng-aa committed Aug 12, 2015
2 parents 1917a62 + 2a68ea9 commit f2f72d4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
45 changes: 28 additions & 17 deletions pdc/apps/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ class RepoViewSet(ChangeSetCreateModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet):
"""
An API endpoint providing access to repositories.
An API endpoint providing access to delivery targets.
Please access this endpoint by [%(HOST_NAME)s/%(API_PATH)s/delivery-targets](/%(API_PATH)s/delivery-targets).
Endpoint [%(HOST_NAME)s/%(API_PATH)s/repos](/%(API_PATH)s/repos) is deprecated.
"""
queryset = models.Repo.objects.all().select_related()
serializer_class = serializers.RepoSerializer
Expand All @@ -37,7 +40,7 @@ def create(self, *args, **kwargs):
"""
__Method__: `POST`
__URL__: `/repos/`
__URL__: `/delivery-targets/`
__Data__:
Expand All @@ -54,7 +57,7 @@ def create(self, *args, **kwargs):
product_id: int (OPTIONAL)
}
There are additional validations for the repository name for specific
There are additional validations for the delivery target name for specific
content category. If and only if the content category is `debug`, the
name must contain `debug` substring.
Expand All @@ -76,7 +79,7 @@ def list(self, *args, **kwargs):
"""
__Method__: `GET`
__URL__: `/repos/`
__URL__: `/delivery-targets/`
__Query params__:
Expand Down Expand Up @@ -113,7 +116,7 @@ def update(self, *args, **kwargs):
"""
__Method__: `PUT`, `PATCH`
__URL__: `/repos/{id}`
__URL__: `/delivery-targets/{id}`
__Data__:
Expand Down Expand Up @@ -152,29 +155,33 @@ def destroy(self, *args, **kwargs):
"""
__Method__: `DELETE`
__URL__: /repos/{id}
__URL__: /delivery-targets/{id}
"""
return super(RepoViewSet, self).destroy(*args, **kwargs)


class RepoCloneViewSet(StrictQueryParamMixin, viewsets.GenericViewSet):
"""
Please access this endpoint by [%(HOST_NAME)s/%(API_PATH)s/rpc/delivery-targets/clone](/%(API_PATH)s/rpc/delivery-targets/clone).
Endpoint [%(HOST_NAME)s/%(API_PATH)s/rpc/repos/clone](/%(API_PATH)s/rpc/repos/clone) is deprecated.
"""
queryset = models.Repo.objects.none() # Required for permissions

def create(self, request):
"""
Clone all repositories from one release under another release.
Clone all delivery targets from one release under another release.
The call is atomic, i.e. either all repositories are cloned or nothing
The call is atomic, i.e. either all delivery targets are cloned or nothing
is done.
If the source and target releases do not have the same variants, the
cloning will silently ignore repositories with Variant.Arch that is
cloning will silently ignore delivery targets with Variant.Arch that is
present in source release but not in target release. It is not a
problem if the target release has additional variants.
__Method__: `POST`
__URL__: `/rpc/repos/clone/`
__URL__: `/rpc/delivery-targets/clone/`
__Data__:
Expand All @@ -195,7 +202,7 @@ def create(self, request):
cloned.
__Response__:
The call returns a list of repositories created under target release.
The call returns a list of delivery targets created under target release.
[
{
Expand Down Expand Up @@ -274,9 +281,13 @@ class RepoFamilyViewSet(StrictQueryParamMixin,
"""
##Overview##
This page shows the usage of the **RepoFamily API**, please see the
This page shows the usage of the **DeliveryTargetFamily API**, please see the
following for more details.
Please access this endpoint by [%(HOST_NAME)s/%(API_PATH)s/delivery-target-families](/%(API_PATH)s/delivery-target-families).
Endpoint [%(HOST_NAME)s/%(API_PATH)s/repo-families](/%(API_PATH)s/repo-families) is deprecated.
##Test tools##
You can use ``curl`` in terminal, with -X _method_ (GET|POST|PUT|PATCH|DELETE),
Expand All @@ -291,7 +302,7 @@ def list(self, request, *args, **kwargs):
"""
__Method__: `GET`
__URL__: `/repo-families/`
__URL__: `/delivery-target-families/`
__Query params__:
Expand All @@ -314,23 +325,23 @@ def list(self, request, *args, **kwargs):
__Example__:
$ curl "%(HOST_NAME)s/%(API_PATH)s/repo-families/
$ curl "%(HOST_NAME)s/%(API_PATH)s/delivery-target-families/
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"name": "dist",
"description": "Production repositories"
"description": "Production delivery targets"
},
{
"name": "beta",
"description": "Beta (pre-production) repositories"
"description": "Beta (pre-production) delivery targets"
},
{
"name": "htb",
"description": "Repositories for High Touch Beta (HTB) customers"
"description": "Delivery targets for High Touch Beta (HTB) customers"
}
]
}
Expand Down
7 changes: 7 additions & 0 deletions pdc/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@
repo_views.RepoCloneViewSet,
base_name='repoclone')

router.register(r'delivery-targets', repo_views.RepoViewSet)
router.register(r'delivery-target-families', repo_views.RepoFamilyViewSet,
base_name='deliverytargetfamily')
router.register(r'rpc/delivery-targets/clone',
repo_views.RepoCloneViewSet,
base_name='deliverytargetclone')

router.register('overrides/rpm',
compose_views.ReleaseOverridesRPMViewSet,
base_name='overridesrpm')
Expand Down

0 comments on commit f2f72d4

Please sign in to comment.