resources for CDN service
diff --git a/xos/tosca/resources/originserver.py b/xos/tosca/resources/originserver.py
new file mode 100644
index 0000000..0f50f04
--- /dev/null
+++ b/xos/tosca/resources/originserver.py
@@ -0,0 +1,37 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from hpc.models import OriginServer, ContentProvider
+
+from xosresource import XOSResource
+
+class XOSOriginServer(XOSResource):
+ provides = "tosca.nodes.OriginServer"
+ xos_model = OriginServer
+ name_field = "url"
+ copyin_props = []
+
+ def nodetemplate_name_to_url(self):
+ url = self.nodetemplate.name
+ if url.startswith("http_"):
+ url = url[5:]
+ return url
+
+ def get_existing_objs(self):
+ url = self.nodetemplate_name_to_url()
+ return self.xos_model.objects.filter(**{self.name_field: url})
+
+ def get_xos_args(self):
+ url = self.nodetemplate_name_to_url()
+ cp_name = self.get_requirement("tosca.relationships.MemberOfContentProvider", throw_exception=True)
+ cp = self.get_xos_object(ContentProvider, name=cp_name)
+ return {"url": url,
+ "contentProvider": cp}
+
+ def can_delete(self, obj):
+ return super(XOSOriginServer, self).can_delete(obj)
+