genericparser seed code
[modeling/etsicatalog.git] / genericparser / packages / serializers / vnf_pkg_software_image_info.py
1 # Copyright 2018 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 from rest_framework import serializers
16 from checksum import ChecksumSerializer
17
18
19 class VnfPackageSoftwareImageInfoSerializer(serializers.Serializer):
20     id = serializers.CharField(
21         help_text="Identifier of the software image.",
22         required=True,
23         allow_null=False,
24         allow_blank=False
25     )
26     name = serializers.CharField(
27         help_text="Name of the software image.",
28         required=True,
29         allow_null=True,
30         allow_blank=False
31     )
32     provider = serializers.CharField(
33         help_text="Provider of the software image.",
34         required=True,
35         allow_null=True,
36         allow_blank=False
37     )
38     version = serializers.CharField(
39         help_text="Version of the software image.",
40         required=True,
41         allow_null=True,
42         allow_blank=False
43     )
44     checksum = ChecksumSerializer(
45         help_text="Checksum of the software image file.",
46         required=True,
47         allow_null=False
48     )
49     containerFormat = serializers.ChoiceField(
50         help_text="terminationType: Indicates whether forceful or graceful termination is requested.",
51         choices=["AKI", "AMI", "ARI", "BARE", "DOCKER", "OVA", "OVF"],
52         required=True,
53         allow_null=True
54     )
55     diskFormat = serializers.ChoiceField(
56         help_text="Disk format of a software image is the format of the underlying disk image.",
57         choices=["AKI", "AMI", "ARI", "ISO", "QCOW2", "RAW", "VDI", "VHD", "VHDX", "VMDK"],
58         required=True,
59         allow_null=True
60     )
61     createdAt = serializers.DateTimeField(
62         help_text="Time when this software image was created.",
63         required=True,
64         format=None,
65         input_formats=None
66     )
67     minDisk = serializers.IntegerField(
68         help_text="The minimal disk for this software image in bytes.",
69         required=True,
70         allow_null=True
71     )
72     minRam = serializers.IntegerField(
73         help_text="The minimal RAM for this software image in bytes.",
74         required=True,
75         allow_null=True
76     )
77     size = serializers.IntegerField(
78         help_text="Size of this software image in bytes.",
79         required=True,
80         allow_null=True
81     )
82     userMetadata = serializers.DictField(
83         help_text="User-defined data.",
84         child=serializers.CharField(
85             help_text="KeyValue Pairs",
86             allow_blank=True
87         ),
88         required=False,
89         allow_null=True
90     )
91     imagePath = serializers.CharField(
92         help_text="Path in the VNF package.",
93         required=True,
94         allow_null=True,
95         allow_blank=False
96     )