aboutsummaryrefslogtreecommitdiffstats
path: root/catalog/packages/serializers/vnf_pkg_software_image_info.py
blob: 7723ec0e11b7db2da011e76dd739fb888c53ffb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 2018 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from rest_framework import serializers
from checksum import ChecksumSerializer


class VnfPackageSoftwareImageInfoSerializer(serializers.Serializer):
    id = serializers.CharField(
        help_text="Identifier of the software image.",
        required=True,
        allow_null=False,
        allow_blank=False
    )
    name = serializers.CharField(
        help_text="Name of the software image.",
        required=True,
        allow_null=True,
        allow_blank=False
    )
    provider = serializers.CharField(
        help_text="Provider of the software image.",
        required=True,
        allow_null=True,
        allow_blank=False
    )
    version = serializers.CharField(
        help_text="Version of the software image.",
        required=True,
        allow_null=True,
        allow_blank=False
    )
    checksum = ChecksumSerializer(
        help_text="Checksum of the software image file.",
        required=True,
        allow_null=False
    )
    containerFormat = serializers.ChoiceField(
        help_text="terminationType: Indicates whether forceful or graceful termination is requested.",
        choices=["AKI", "AMI", "ARI", "BARE", "DOCKER", "OVA", "OVF"],
        required=True,
        allow_null=True
    )
    diskFormat = serializers.ChoiceField(
        help_text="Disk format of a software image is the format of the underlying disk image.",
        choices=["AKI", "AMI", "ARI", "ISO", "QCOW2", "RAW", "VDI", "VHD", "VHDX", "VMDK"],
        required=True,
        allow_null=True
    )
    createdAt = serializers.DateTimeField(
        help_text="Time when this software image was created.",
        required=True,
        format=None,
        input_formats=None
    )
    minDisk = serializers.IntegerField(
        help_text="The minimal disk for this software image in bytes.",
        required=True,
        allow_null=True
    )
    minRam = serializers.IntegerField(
        help_text="The minimal RAM for this software image in bytes.",
        required=True,
        allow_null=True
    )
    size = serializers.IntegerField(
        help_text="Size of this software image in bytes.",
        required=True,
        allow_null=True
    )
    userMetadata = serializers.DictField(
        help_text="User-defined data.",
        child=serializers.CharField(
            help_text="KeyValue Pairs",
            allow_blank=True
        ),
        required=False,
        allow_null=True
    )
    imagePath = serializers.CharField(
        help_text="Path in the VNF package.",
        required=True,
        allow_null=True,
        allow_blank=False
    )