1 # Copyright (C) 2019 Verizon. All Rights Reserved
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
17 from catalog.packages.serializers import subscription_auth_data
18 from catalog.packages.serializers import vnf_pkg_notifications
21 class LinkSerializer(serializers.Serializer):
22 href = serializers.CharField(
23 help_text="URI of the referenced resource.",
30 ref_name = 'VNF_SUBSCRIPTION_LINKSERIALIZER'
33 class LinkSelfSerializer(serializers.Serializer):
34 self = LinkSerializer(
35 help_text="URI of this resource.",
41 class PkgmSubscriptionRequestSerializer(serializers.Serializer):
42 filter = vnf_pkg_notifications.PkgmNotificationsFilter(
43 help_text="Filter settings for this subscription, "
44 "to define the subset of all notifications"
45 " this subscription relates to",
49 callbackUri = serializers.URLField(
50 help_text="Callback URI to send"
55 authentication = subscription_auth_data.SubscriptionAuthenticationSerializer(
56 help_text="Authentication parameters to configure the use of "
57 "authorization when sending notifications corresponding to"
64 class PkgmSubscriptionSerializer(serializers.Serializer):
65 id = serializers.CharField(
66 help_text="Identifier of this subscription resource.",
70 callbackUri = serializers.URLField(
71 help_text="The URI of the endpoint to send the notification to.",
76 _links = LinkSelfSerializer(
77 help_text="Links to resources related to this resource.",
82 filter = vnf_pkg_notifications.PkgmNotificationsFilter(
83 help_text="Filter settings for this subscription, "
84 "to define the subset of all notifications"
85 " this subscription relates to",
91 class PkgmSubscriptionsSerializer(serializers.ListSerializer):
92 child = PkgmSubscriptionSerializer()