blob: 8daf7fbea6850df559751019ed4ca2e08e8617e0 [file] [log] [blame]
Scott Baker8f32cc82016-08-08 10:34:53 -07001import os
2import pdb
3import sys
4import tempfile
5sys.path.append("/opt/tosca")
6from translator.toscalib.tosca_template import ToscaTemplate
7
8from services.hpc.models import CDNPrefix, ContentProvider
9
10from xosresource import XOSResource
11
12class XOSCDNPrefix(XOSResource):
13 provides = "tosca.nodes.CDNPrefix"
14 xos_model = CDNPrefix
15 name_field = "prefix"
16 copyin_props = []
17
18 def get_xos_args(self):
19 args = {"prefix": self.obj_name}
20
21 cp_name = self.get_requirement("tosca.relationships.MemberOfContentProvider")
22 if cp_name:
23 args["contentProvider"] = self.get_xos_object(ContentProvider, name=cp_name)
24
25 default_os = self.get_requirement("tosca.relationships.DefaultOriginServer")
26 if default_os:
27 args["defaultOriginServer"] = self.engine.name_to_xos_model(self.user, default_os)
28
29 return args
30
31 def can_delete(self, obj):
32 return super(XOSCDNPrefix, self).can_delete(obj)
33