1 # Copyright 2018 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from rest_framework import serializers
18 class JobHistorySerializer(serializers.Serializer):
19 status = serializers.CharField(
20 help_text="Status of job",
22 progress = serializers.CharField(
23 help_text="Progress of job",
25 statusDescription = serializers.CharField(
26 help_text="Description of job",
29 errorCode = serializers.CharField(
30 help_text="Error code of job",
33 responseId = serializers.CharField(
34 help_text="Response index of job",
38 class JobDescriptorSerializer(serializers.Serializer):
39 status = serializers.CharField(
40 help_text="Status of job",
42 # progress = serializers.CharField(help_text="Progress of job", required=True)
43 progress = serializers.IntegerField(
44 help_text="Progress of job",
46 statusDescription = serializers.CharField(
47 help_text="Description of job",
50 errorCode = serializers.CharField(
51 help_text="Error code of job",
54 responseId = serializers.CharField(
55 help_text="Response index of job",
57 responseHistoryList = JobHistorySerializer(
58 help_text="History of job",
62 class JobQueryRespSerializer(serializers.Serializer):
63 jobId = serializers.CharField(
64 help_text="UUID of job",
66 responseDescriptor = JobDescriptorSerializer(
67 help_text="Descriptor of job",
71 class JobUpdReqSerializer(serializers.Serializer):
72 progress = serializers.CharField(
73 help_text="Progress of job",
75 desc = serializers.CharField(
76 help_text="Desc of job",
78 errcode = serializers.CharField(
79 help_text="Error code of job",
83 class JobUpdRespSerializer(serializers.Serializer):
84 result = serializers.CharField(
85 help_text="Result of job update",
87 msg = serializers.CharField(
88 help_text="Detail of job update",