remove job start endpoint in v2

This commit is contained in:
AlanCoding
2017-08-26 16:05:33 -04:00
parent 34a375542e
commit 495d6e9887
3 changed files with 11 additions and 2 deletions

View File

@@ -3795,6 +3795,7 @@ class JobActivityStreamList(ActivityStreamEnforcementMixin, SubListAPIView):
new_in_145 = True
# TODO: remove endpoint in 3.3
class JobStart(GenericAPIView):
model = Job
@@ -3802,7 +3803,13 @@ class JobStart(GenericAPIView):
is_job_start = True
deprecated = True
def v2_not_allowed(self):
return Response({'detail': 'Action only possible through v1 API.'},
status=status.HTTP_404_NOT_FOUND)
def get(self, request, *args, **kwargs):
if get_request_version(request) > 1:
return self.v2_not_allowed()
obj = self.get_object()
data = dict(
can_start=obj.can_start,
@@ -3813,6 +3820,8 @@ class JobStart(GenericAPIView):
return Response(data)
def post(self, request, *args, **kwargs):
if get_request_version(request) > 1:
return self.v2_not_allowed()
obj = self.get_object()
if obj.can_start:
result = obj.signal_start(**request.data)