mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 18:20:00 -03:30
Move view around and inherit from right view to get OPTIONS
we needed to inherit from GenericAPIView to get the options to render correctly q! add execution env support add organization validation to the workflowjob Update awx/api/serializers.py Co-authored-by: Elijah DeLee <kdelee@redhat.com> Update awx/api/serializers.py Co-authored-by: Elijah DeLee <kdelee@redhat.com>
This commit is contained in:
@@ -4301,41 +4301,6 @@ class WorkflowApprovalDetail(UnifiedJobDeletionMixin, RetrieveDestroyAPIView):
|
||||
serializer_class = serializers.WorkflowApprovalSerializer
|
||||
|
||||
|
||||
from rest_framework.decorators import api_view
|
||||
|
||||
|
||||
class BulkJobLaunchView(APIView):
|
||||
_ignore_model_permissions = True
|
||||
permission_classes = [IsAuthenticated]
|
||||
serializer_class = serializers.BulkJobLaunchSerializer
|
||||
allowed_methods = ['GET', 'POST', 'OPTIONS']
|
||||
|
||||
def get(self, request):
|
||||
# TODO Return something sensible here, like the defaults
|
||||
bulkjob_serializer = serializers.BulkJobLaunchSerializer(data={}, context={'request': request})
|
||||
bulkjob_serializer.is_valid()
|
||||
return Response(bulkjob_serializer.errors, status=status.HTTP_200_OK)
|
||||
|
||||
def post(self, request):
|
||||
bulkjob_serializer = serializers.BulkJobLaunchSerializer(data=request.data, context={'request': request})
|
||||
if bulkjob_serializer.is_valid():
|
||||
result = bulkjob_serializer.create(bulkjob_serializer.validated_data)
|
||||
return Response(result, status=status.HTTP_201_CREATED)
|
||||
return Response(bulkjob_serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
class BulkView(APIView):
|
||||
_ignore_model_permissions = True
|
||||
permission_classes = [IsAuthenticated]
|
||||
allowed_methods = ['GET']
|
||||
|
||||
def get(self, request, format=None):
|
||||
'''List top level resources'''
|
||||
data = OrderedDict()
|
||||
data['bulk_job_launch'] = reverse('api:bulk_job_launch', request=request)
|
||||
return Response(data)
|
||||
|
||||
|
||||
class WorkflowApprovalApprove(RetrieveAPIView):
|
||||
model = models.WorkflowApproval
|
||||
serializer_class = serializers.WorkflowApprovalViewSerializer
|
||||
|
||||
Reference in New Issue
Block a user