diff options
author | 2019-12-10 18:01:42 +0800 | |
---|---|---|
committer | 2019-12-10 18:04:22 +0800 | |
commit | 5fa8b56008a3fbbd8cecea19e68c47cb95473f78 (patch) | |
tree | 4a99ea69f811b046e5e28285fd060424eed0a9b1 /catalog/packages/serializers | |
parent | 2ae44b787c0795e60276c35aeb13e104ca17bfa7 (diff) |
Added notification endpoint interface definition in swagger
Change-Id: Ieaa19c42dcd8c1e2c7e7bc7b83436374afd888c9
Issue-ID: MODELING-288
Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
Diffstat (limited to 'catalog/packages/serializers')
-rw-r--r-- | catalog/packages/serializers/vnf_pkg_notifications.py | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/catalog/packages/serializers/vnf_pkg_notifications.py b/catalog/packages/serializers/vnf_pkg_notifications.py index 5e023af..ee2b99c 100644 --- a/catalog/packages/serializers/vnf_pkg_notifications.py +++ b/catalog/packages/serializers/vnf_pkg_notifications.py @@ -13,11 +13,11 @@ # limitations under the License. from rest_framework import serializers - from catalog.packages.const import NOTIFICATION_TYPES PackageOperationalStateType = ["ENABLED", "DISABLED"] PackageUsageStateType = ["IN_USE", "NOT_IN_USE"] +PackageChangeType = ["OP_STATE_CHANGE", "PKG_DELETE"] class VersionSerializer(serializers.Serializer): @@ -115,3 +115,84 @@ class PkgmNotificationsFilter(serializers.Serializer): allow_null=False, required=False ) + + +class LinkSerializer(serializers.Serializer): + href = serializers.CharField( + help_text="URI of the referenced resource.", + required=True, + allow_null=False, + allow_blank=False + ) + + class Meta: + ref_name = 'NOTIFICATION_LINKSERIALIZER' + + +class PkgmLinksSerializer(serializers.Serializer): + vnfPackage = LinkSerializer( + help_text="Link to the resource representing the VNF package to which the notified change applies.", + required=False, + allow_null=False + ) + subscription = LinkSerializer( + help_text="Link to the related subscription.", + required=False, + allow_null=False + ) + + +class PkgNotificationSerializer(serializers.Serializer): + id = serializers.CharField( + help_text="Identifier of this notification.", + required=True, + allow_null=False + ) + notificationTypes = serializers.ListField( + child=serializers.ChoiceField( + required=True, + choices=NOTIFICATION_TYPES + ), + help_text="Discriminator for the different notification types.", + allow_null=True, + required=False + ) + subscriptionId = serializers.CharField( + help_text="Identifier of the subscription that this notification relates to.", + required=True, + allow_null=False + ) + vnfPkgId = serializers.UUIDField( + help_text="Identifier of the VNF package.", + required=True, + allow_null=False + ) + vnfdId = serializers.UUIDField( + help_text="This identifier, which is managed by the VNF provider, " + "identifies the VNF package and the VNFD in a globally unique way.", + required=True, + allow_null=False + ) + changeType = serializers.ChoiceField( + help_text="The type of change of the VNF package.", + choices=PackageChangeType, + required=False, + allow_null=False + ) + operationalState = serializers.ChoiceField( + help_text="New operational state of the VNF package.", + choices=PackageOperationalStateType, + required=False, + allow_null=False + ) + vnfdId = serializers.CharField( + help_text="This identifier, which is managed by the VNF provider, " + "identifies the VNF package and the VNFD in a globally unique way.", + required=True, + allow_null=False + ) + _links = PkgmLinksSerializer( + help_text="Links to resources related to this resource.", + required=True, + allow_null=False + ) |