tosca for service controller resource
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index c412176..93aeb33 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -27,6 +27,29 @@
An XOS Service Controller.
properties:
xos_base_props
+ base_url:
+ type: string
+ required: false
+ description: Base url, to allow resources to use relative URLs
+
+ tosca.nodes.ServiceControllerResource:
+ derived_from: tosca.nodes.Root
+ description: >
+ An XOS Service Resource.
+ properties:
+ xos_base_props
+ kind:
+ type: string
+ required: false
+ description: models, admin, django_library, synchronizer, rest, tosca_custom_types, or tosca_resource
+ format:
+ type: string
+ required: false
+ description: python, manifest, or docker
+ url:
+ type: string
+ required: false
+ description: url of resource, may be relative to base_url or absolute
tosca.nodes.Tenant:
derived_from: tosca.nodes.Root
@@ -977,6 +1000,12 @@
tosca.relationships.TagsObject:
derived_from: tosca.relationships.Root
+ tosca.relationships.HasResource:
+ derived_from: tosca.relationships.Root
+
+ tosca.relationships.UsedByController:
+ derived_from: tosca.relationships.Root
+
tosca.capabilities.xos.Service:
derived_from: tosca.capabilities.Root
description: An XOS Service
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index ba4c42b..9e2042b 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -105,6 +105,44 @@
type: string
required: false
descrption: Replaces/renames this object
+ base_url:
+ type: string
+ required: false
+ description: Base url, to allow resources to use relative URLs
+
+ tosca.nodes.ServiceControllerResource:
+ derived_from: tosca.nodes.Root
+ description: >
+ An XOS Service Resource.
+ properties:
+ no-delete:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to delete this object
+ no-create:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to create this object
+ no-update:
+ type: boolean
+ default: false
+ description: Do not allow Tosca to update this object
+ replaces:
+ type: string
+ required: false
+ descrption: Replaces/renames this object
+ kind:
+ type: string
+ required: false
+ description: models, admin, django_library, synchronizer, rest, tosca_custom_types, or tosca_resource
+ format:
+ type: string
+ required: false
+ description: python, manifest, or docker
+ url:
+ type: string
+ required: false
+ description: url of resource, may be relative to base_url or absolute
tosca.nodes.Tenant:
derived_from: tosca.nodes.Root
@@ -1741,6 +1779,12 @@
tosca.relationships.TagsObject:
derived_from: tosca.relationships.Root
+ tosca.relationships.HasResource:
+ derived_from: tosca.relationships.Root
+
+ tosca.relationships.UsedByController:
+ derived_from: tosca.relationships.Root
+
tosca.capabilities.xos.Service:
derived_from: tosca.capabilities.Root
description: An XOS Service
diff --git a/xos/tosca/resources/servicecontrollerresource.py b/xos/tosca/resources/servicecontrollerresource.py
new file mode 100644
index 0000000..96ea83d
--- /dev/null
+++ b/xos/tosca/resources/servicecontrollerresource.py
@@ -0,0 +1,27 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from core.models import ServiceControllerResource, ServiceController
+
+from xosresource import XOSResource
+
+class XOSServiceControllerResource(XOSResource):
+ provides = "tosca.nodes.ServiceControllerResource"
+ xos_model = ServiceControllerResource
+ copyin_props = ["kind", "format", "url"]
+
+ def get_xos_args(self, throw_exception=True):
+ args = super(XOSServiceControllerResource, self).get_xos_args()
+
+ controller_name = self.get_requirement("tosca.relationships.UsedByController", throw_exception=throw_exception)
+ if controller_name:
+ args["service_controller"] = self.get_xos_object(ServiceController, throw_exception=throw_exception, name=controller_name)
+
+ return args
+
+
+