Update job api models
[vfc/nfvo/lcm.git] / lcm / jobs / api_model.py
1 # Copyright 2019 ZTE Corporation.
2 #
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
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15
16 class JobHistory(object):
17     def __init__(self, status="", progress="", statusDescription="", errorCode="", responseId=""):
18         self.status = status
19         self.progress = progress
20         self.statusDescription = statusDescription
21         self.errorCode = errorCode
22         self.responseId = responseId
23
24
25 class JobDescriptor(object):
26     def __init__(self, status="", progress=0, statusDescription="", errorCode="", responseId="", responseHistoryList=None):
27         self.status = status
28         self.progress = progress
29         self.statusDescription = statusDescription
30         self.errorCode = errorCode
31         self.responseId = responseId
32         self.responseHistoryList = responseHistoryList
33
34
35 class JobQueryResp(object):
36     def __init__(self, jobId="", responseDescriptor=None):
37         self.jobId = jobId
38         self.responseDescriptor = responseDescriptor
39
40
41 class JobUpdReq(object):
42     def __init__(self, progress="", desc="", errcode=""):
43         self.progress = progress
44         self.desc = desc
45         self.errcode = errcode
46
47     def load(self, data):
48         self.progress = data["progress"]
49         self.desc = data["desc"]
50         self.errcode = data["errcode"]
51
52
53 class JobUpdResp(object):
54     def __init__(self, result="", msg=""):
55         self.result = result
56         self.msg = msg
57
58     def load(self, data):
59         self.result = data["result"]
60         self.msg = data["msg"]