blob: 0b946ed1be129880841e26cbb867b263fa22a386 [file] [log] [blame]
Scott Baker8f32cc82016-08-08 10:34:53 -07001from xosresource import XOSResource
Zack Williamsb7e97762016-10-05 16:12:36 -07002from services.hpc.models import CDNPrefix, ContentProvider
Scott Baker8f32cc82016-08-08 10:34:53 -07003
4class XOSCDNPrefix(XOSResource):
5 provides = "tosca.nodes.CDNPrefix"
6 xos_model = CDNPrefix
7 name_field = "prefix"
8 copyin_props = []
9
10 def get_xos_args(self):
11 args = {"prefix": self.obj_name}
12
13 cp_name = self.get_requirement("tosca.relationships.MemberOfContentProvider")
14 if cp_name:
15 args["contentProvider"] = self.get_xos_object(ContentProvider, name=cp_name)
16
17 default_os = self.get_requirement("tosca.relationships.DefaultOriginServer")
18 if default_os:
19 args["defaultOriginServer"] = self.engine.name_to_xos_model(self.user, default_os)
20
21 return args
22
23 def can_delete(self, obj):
24 return super(XOSCDNPrefix, self).can_delete(obj)
25