Commit 4f91ee99 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed wrong data types.

implemented 3 methods
parent f7b8348a
connexion == 2.4.0 connexion == 2.4.0
python-dateutil == 2.8.0 python-dateutil == 2.8.0
typing == 3.7.4.1 typing == 3.7.4.1
swagger-ui-bundle == 0.0.5 swagger-ui-bundle == 0.0.5
\ No newline at end of file tinydb == 3.15.1
tosca-parser == 1.6.1
import os
import uuid
import connexion import connexion
import six import six
import yaml
from sure_tosca.models.node_template import NodeTemplate # noqa: E501 from sure_tosca.models.node_template import NodeTemplate as NodeTemplateModel
from sure_tosca.models.topology_template import TopologyTemplate # noqa: E501 from sure_tosca.models.topology_template import TopologyTemplate as TopologyTemplateModel
from sure_tosca.models.tosca_template import ToscaTemplate # noqa: E501 from sure_tosca.models.tosca_template import ToscaTemplate as ToscaTemplateModel
from sure_tosca import util from sure_tosca import util
from tinydb import TinyDB, Query
import tempfile
from toscaparser.nodetemplate import NodeTemplate
from toscaparser.tosca_template import ToscaTemplate
from toscaparser.topology_template import TopologyTemplate
db_dir_path = tempfile.gettempdir()
db_file_path = os.path.join(db_dir_path, "db.json")
db = TinyDB(db_file_path)
# db.insert({'type': 'EFY', 'count': 800})
def get_all_ancestor_properties(id, body=None, node_name=None): # noqa: E501 def get_all_ancestor_properties(id, body=None, node_name=None): # noqa: E501
...@@ -14,7 +30,7 @@ def get_all_ancestor_properties(id, body=None, node_name=None): # noqa: E501 ...@@ -14,7 +30,7 @@ def get_all_ancestor_properties(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -33,7 +49,7 @@ def get_all_ancestor_types(id, body=None, node_name=None): # noqa: E501 ...@@ -33,7 +49,7 @@ def get_all_ancestor_types(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -41,7 +57,7 @@ def get_all_ancestor_types(id, body=None, node_name=None): # noqa: E501 ...@@ -41,7 +57,7 @@ def get_all_ancestor_types(id, body=None, node_name=None): # noqa: E501
:rtype: List[str] :rtype: List[str]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -52,7 +68,7 @@ def get_ancestors_requirements(id, body=None, node_name=None): # noqa: E501 ...@@ -52,7 +68,7 @@ def get_ancestors_requirements(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -60,7 +76,7 @@ def get_ancestors_requirements(id, body=None, node_name=None): # noqa: E501 ...@@ -60,7 +76,7 @@ def get_ancestors_requirements(id, body=None, node_name=None): # noqa: E501
:rtype: Dict[str, object] :rtype: Dict[str, object]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -71,7 +87,7 @@ def get_interface_types(id, body=None, interface_type=None): # noqa: E501 ...@@ -71,7 +87,7 @@ def get_interface_types(id, body=None, interface_type=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param interface_type: The interface type :param interface_type: The interface type
:type interface_type: str :type interface_type: str
...@@ -79,7 +95,7 @@ def get_interface_types(id, body=None, interface_type=None): # noqa: E501 ...@@ -79,7 +95,7 @@ def get_interface_types(id, body=None, interface_type=None): # noqa: E501
:rtype: List[Dict[str, object]] :rtype: List[Dict[str, object]]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -90,7 +106,7 @@ def get_node_outputs(id, body=None, node_name=None): # noqa: E501 ...@@ -90,7 +106,7 @@ def get_node_outputs(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -98,7 +114,7 @@ def get_node_outputs(id, body=None, node_name=None): # noqa: E501 ...@@ -98,7 +114,7 @@ def get_node_outputs(id, body=None, node_name=None): # noqa: E501
:rtype: Dict[str, object] :rtype: Dict[str, object]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -109,7 +125,7 @@ def get_node_properties(id, body=None, node_name=None): # noqa: E501 ...@@ -109,7 +125,7 @@ def get_node_properties(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -117,7 +133,7 @@ def get_node_properties(id, body=None, node_name=None): # noqa: E501 ...@@ -117,7 +133,7 @@ def get_node_properties(id, body=None, node_name=None): # noqa: E501
:rtype: Dict[str, object] :rtype: Dict[str, object]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -128,7 +144,7 @@ def get_node_requirements(id, body=None, node_name=None): # noqa: E501 ...@@ -128,7 +144,7 @@ def get_node_requirements(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -136,7 +152,7 @@ def get_node_requirements(id, body=None, node_name=None): # noqa: E501 ...@@ -136,7 +152,7 @@ def get_node_requirements(id, body=None, node_name=None): # noqa: E501
:rtype: Dict[str, object] :rtype: Dict[str, object]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -166,7 +182,7 @@ def get_node_type_name(id, body=None, node_name=None): # noqa: E501 ...@@ -166,7 +182,7 @@ def get_node_type_name(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -174,7 +190,7 @@ def get_node_type_name(id, body=None, node_name=None): # noqa: E501 ...@@ -174,7 +190,7 @@ def get_node_type_name(id, body=None, node_name=None): # noqa: E501
:rtype: str :rtype: str
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -185,7 +201,7 @@ def get_parent_type_name(id, body=None, node_name=None): # noqa: E501 ...@@ -185,7 +201,7 @@ def get_parent_type_name(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
...@@ -193,7 +209,7 @@ def get_parent_type_name(id, body=None, node_name=None): # noqa: E501 ...@@ -193,7 +209,7 @@ def get_parent_type_name(id, body=None, node_name=None): # noqa: E501
:rtype: str :rtype: str
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
...@@ -204,31 +220,58 @@ def get_related_node(id, body=None, node_name=None): # noqa: E501 ...@@ -204,31 +220,58 @@ def get_related_node(id, body=None, node_name=None): # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param body: :param body:
:type body: dict | bytes :type body: dict | bytes
:param node_name: The node name :param node_name: The node name
:type node_name: str :type node_name: str
:rtype: List[NodeTemplate] :rtype: List[NodeTemplateModel]
""" """
if connexion.request.is_json: if connexion.request.is_json:
body = NodeTemplate.from_dict(connexion.request.get_json()) # noqa: E501 body = NodeTemplateModel.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!' return 'do some magic!'
def get_topology_template(id): # noqa: E501 def set_node_properties(id, properties, node_name): # noqa: E501
"""get_topology_template """
r # noqa: E501 s # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param properties:
:type properties:
:param node_name: The node name
:type node_name: str
:rtype: TopologyTemplate :rtype: Dict[str, object]
""" """
return 'do some magic!' return 'do some magic!'
def upload_tosca_template(file): # noqa: E501
"""upload a tosca template description file
upload and validate a tosca template description file # noqa: E501
:param file: tosca Template description
:type file: werkzeug.datastructures.FileStorage
:rtype: str
"""
tosca_template_file_path = os.path.join(db_dir_path, file.filename)
tosca_template_dict = yaml.safe_load(file.stream)
tosca_template_model = ToscaTemplateModel.from_dict(tosca_template_dict)
tosca_template = ToscaTemplate(yaml_dict_tpl=tosca_template_dict)
doc_id = str(uuid.uuid4())
tosca_template_dict_with_id = {"id": doc_id}
tosca_template_dict_with_id.update(tosca_template_model.to_dict())
db.insert(tosca_template_dict_with_id)
return doc_id
def get_tosca_template(id): # noqa: E501 def get_tosca_template(id): # noqa: E501
"""get_tosca_template """get_tosca_template
...@@ -239,34 +282,26 @@ def get_tosca_template(id): # noqa: E501 ...@@ -239,34 +282,26 @@ def get_tosca_template(id): # noqa: E501
:rtype: ToscaTemplate :rtype: ToscaTemplate
""" """
return 'do some magic!' return get_ToscaTemplateModel_by_id(id)
def set_node_properties(id, properties, node_name): # noqa: E501 def get_topology_template(id): # noqa: E501
""" """get_topology_template
s # noqa: E501 r # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param properties:
:type properties:
:param node_name: The node name
:type node_name: str
:rtype: Dict[str, object] :rtype: TopologyTemplate
""" """
return 'do some magic!' return get_ToscaTemplateModel_by_id(id).topology_template
def upload_tosca_template(file): # noqa: E501
"""upload a tosca template description file
upload and validate a tosca template description file # noqa: E501
:param file: tosca Template description
:type file: werkzeug.datastructures.FileStorage
:rtype: str def get_ToscaTemplateModel_by_id(id):
""" query = Query()
return 'do some magic!' tosca_template_list_dict = db.search(query.id == id)
tosca_template_dict = tosca_template_list_dict[0]
tosca_template_dict.pop("id")
tosca_template = ToscaTemplate(yaml_dict_tpl=tosca_template_dict)
return ToscaTemplateModel.from_dict(tosca_template_dict)
...@@ -15,26 +15,66 @@ class NodeTemplate(Model): ...@@ -15,26 +15,66 @@ class NodeTemplate(Model):
Do not edit the class manually. Do not edit the class manually.
""" """
def __init__(self, items=None, additional_properties=None): # noqa: E501 def __init__(self, derived_from=None, properties=None, requirements=None, interfaces=None, capabilities=None, type=None, description=None, directives=None, attributes=None, artifacts=None): # noqa: E501
"""NodeTemplate - a model defined in Swagger """NodeTemplate - a model defined in Swagger
:param items: The items of this NodeTemplate. # noqa: E501 :param derived_from: The derived_from of this NodeTemplate. # noqa: E501
:type items: object :type derived_from: str
:param additional_properties: The additional_properties of this NodeTemplate. # noqa: E501 :param properties: The properties of this NodeTemplate. # noqa: E501
:type additional_properties: object :type properties: Dict[str, object]
:param requirements: The requirements of this NodeTemplate. # noqa: E501
:type requirements: List[Dict[str, object]]
:param interfaces: The interfaces of this NodeTemplate. # noqa: E501
:type interfaces: Dict[str, object]
:param capabilities: The capabilities of this NodeTemplate. # noqa: E501
:type capabilities: Dict[str, object]
:param type: The type of this NodeTemplate. # noqa: E501
:type type: str
:param description: The description of this NodeTemplate. # noqa: E501
:type description: str
:param directives: The directives of this NodeTemplate. # noqa: E501
:type directives: List[str]
:param attributes: The attributes of this NodeTemplate. # noqa: E501
:type attributes: Dict[str, object]
:param artifacts: The artifacts of this NodeTemplate. # noqa: E501
:type artifacts: Dict[str, object]
""" """
self.swagger_types = { self.swagger_types = {
'items': object, 'derived_from': str,
'additional_properties': object 'properties': Dict[str, object],
'requirements': List[Dict[str, object]],
'interfaces': Dict[str, object],
'capabilities': Dict[str, object],
'type': str,
'description': str,
'directives': List[str],
'attributes': Dict[str, object],
'artifacts': Dict[str, object]
} }
self.attribute_map = { self.attribute_map = {
'items': 'items', 'derived_from': 'derived_from',
'additional_properties': 'additionalProperties' 'properties': 'properties',
'requirements': 'requirements',
'interfaces': 'interfaces',
'capabilities': 'capabilities',
'type': 'type',
'description': 'description',
'directives': 'directives',
'attributes': 'attributes',
'artifacts': 'artifacts'
} }
self._items = items self._derived_from = derived_from
self._additional_properties = additional_properties self._properties = properties
self._requirements = requirements
self._interfaces = interfaces
self._capabilities = capabilities
self._type = type
self._description = description
self._directives = directives
self._attributes = attributes
self._artifacts = artifacts
@classmethod @classmethod
def from_dict(cls, dikt): def from_dict(cls, dikt):
...@@ -48,43 +88,211 @@ class NodeTemplate(Model): ...@@ -48,43 +88,211 @@ class NodeTemplate(Model):
return util.deserialize_model(dikt, cls) return util.deserialize_model(dikt, cls)
@property @property
def items(self): def derived_from(self):
"""Gets the items of this NodeTemplate. """Gets the derived_from of this NodeTemplate.
:return: The items of this NodeTemplate. :return: The derived_from of this NodeTemplate.
:rtype: object :rtype: str
""" """
return self._items return self._derived_from
@items.setter @derived_from.setter
def items(self, items): def derived_from(self, derived_from):
"""Sets the items of this NodeTemplate. """Sets the derived_from of this NodeTemplate.
:param items: The items of this NodeTemplate. :param derived_from: The derived_from of this NodeTemplate.
:type items: object :type derived_from: str
""" """
self._items = items self._derived_from = derived_from
@property @property
def additional_properties(self): def properties(self):
"""Gets the additional_properties of this NodeTemplate. """Gets the properties of this NodeTemplate.
:return: The additional_properties of this NodeTemplate. :return: The properties of this NodeTemplate.
:rtype: object :rtype: Dict[str, object]
""" """
return self._additional_properties return self._properties
@additional_properties.setter @properties.setter
def additional_properties(self, additional_properties): def properties(self, properties):
"""Sets the additional_properties of this NodeTemplate. """Sets the properties of this NodeTemplate.
:param additional_properties: The additional_properties of this NodeTemplate. :param properties: The properties of this NodeTemplate.
:type additional_properties: object :type properties: Dict[str, object]
""" """
self._additional_properties = additional_properties self._properties = properties
@property
def requirements(self):
"""Gets the requirements of this NodeTemplate.
:return: The requirements of this NodeTemplate.
:rtype: List[Dict[str, object]]
"""
return self._requirements
@requirements.setter
def requirements(self, requirements):
"""Sets the requirements of this NodeTemplate.
:param requirements: The requirements of this NodeTemplate.
:type requirements: List[Dict[str, object]]
"""
self._requirements = requirements
@property
def interfaces(self):
"""Gets the interfaces of this NodeTemplate.
:return: The interfaces of this NodeTemplate.
:rtype: Dict[str, object]
"""
return self._interfaces
@interfaces.setter
def interfaces(self, interfaces):
"""Sets the interfaces of this NodeTemplate.
:param interfaces: The interfaces of this NodeTemplate.
:type interfaces: Dict[str, object]
"""
self._interfaces = interfaces
@property
def capabilities(self):
"""Gets the capabilities of this NodeTemplate.
:return: The capabilities of this NodeTemplate.
:rtype: Dict[str, object]
"""
return self._capabilities
@capabilities.setter
def capabilities(self, capabilities):
"""Sets the capabilities of this NodeTemplate.
:param capabilities: The capabilities of this NodeTemplate.
:type capabilities: Dict[str, object]
"""
self._capabilities = capabilities
@property
def type(self):
"""Gets the type of this NodeTemplate.
:return: The type of this NodeTemplate.
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this NodeTemplate.
:param type: The type of this NodeTemplate.
:type type: str
"""
self._type = type
@property
def description(self):
"""Gets the description of this NodeTemplate.
:return: The description of this NodeTemplate.
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this NodeTemplate.
:param description: The description of this NodeTemplate.
:type description: str
"""
self._description = description
@property
def directives(self):
"""Gets the directives of this NodeTemplate.
:return: The directives of this NodeTemplate.
:rtype: List[str]
"""
return self._directives
@directives.setter
def directives(self, directives):
"""Sets the directives of this NodeTemplate.
:param directives: The directives of this NodeTemplate.
:type directives: List[str]
"""
self._directives = directives
@property
def attributes(self):
"""Gets the attributes of this NodeTemplate.
:return: The attributes of this NodeTemplate.
:rtype: Dict[str, object]
"""
return self._attributes
@attributes.setter
def attributes(self, attributes):
"""Sets the attributes of this NodeTemplate.
:param attributes: The attributes of this NodeTemplate.
:type attributes: Dict[str, object]
"""
self._attributes = attributes
@property
def artifacts(self):
"""Gets the artifacts of this NodeTemplate.
:return: The artifacts of this NodeTemplate.
:rtype: Dict[str, object]
"""
return self._artifacts
@artifacts.setter
def artifacts(self, artifacts):
"""Sets the artifacts of this NodeTemplate.
:param artifacts: The artifacts of this NodeTemplate.
:type artifacts: Dict[str, object]
"""
self._artifacts = artifacts
...@@ -6,6 +6,7 @@ from datetime import date, datetime # noqa: F401 ...@@ -6,6 +6,7 @@ from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401 from typing import List, Dict # noqa: F401
from sure_tosca.models.base_model_ import Model from sure_tosca.models.base_model_ import Model
from sure_tosca.models.node_template import NodeTemplate # noqa: F401,E501
from sure_tosca import util from sure_tosca import util
...@@ -15,26 +16,56 @@ class TopologyTemplate(Model): ...@@ -15,26 +16,56 @@ class TopologyTemplate(Model):
Do not edit the class manually. Do not edit the class manually.
""" """
def __init__(self, items=None, additional_properties=None): # noqa: E501 def __init__(self, description=None, inputs=None, node_templates=None, relationship_templates=None, outputs=None, groups=None, substitution_mappings=None, policies=None): # noqa: E501
"""TopologyTemplate - a model defined in Swagger """TopologyTemplate - a model defined in Swagger
:param items: The items of this TopologyTemplate. # noqa: E501 :param description: The description of this TopologyTemplate. # noqa: E501
:type items: object :type description: str
:param additional_properties: The additional_properties of this TopologyTemplate. # noqa: E501 :param inputs: The inputs of this TopologyTemplate. # noqa: E501
:type additional_properties: object :type inputs: List[Dict[str, object]]
:param node_templates: The node_templates of this TopologyTemplate. # noqa: E501
:type node_templates: Dict[str, NodeTemplate]
:param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501
:type relationship_templates: Dict[str, object]
:param outputs: The outputs of this TopologyTemplate. # noqa: E501
:type outputs: List[Dict[str, object]]
:param groups: The groups of this TopologyTemplate. # noqa: E501
:type groups: Dict[str, object]
:param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501
:type substitution_mappings: Dict[str, object]
:param policies: The policies of this TopologyTemplate. # noqa: E501
:type policies: List[Dict[str, object]]
""" """
self.swagger_types = { self.swagger_types = {
'items': object, 'description': str,
'additional_properties': object 'inputs': List[Dict[str, object]],
'node_templates': Dict[str, NodeTemplate],
'relationship_templates': Dict[str, object],
'outputs': List[Dict[str, object]],
'groups': Dict[str, object],
'substitution_mappings': Dict[str, object],
'policies': List[Dict[str, object]]
} }
self.attribute_map = { self.attribute_map = {
'items': 'items', 'description': 'description',
'additional_properties': 'additionalProperties' 'inputs': 'inputs',
'node_templates': 'node_templates',
'relationship_templates': 'relationship_templates',
'outputs': 'outputs',
'groups': 'groups',
'substitution_mappings': 'substitution_mappings',
'policies': 'policies'
} }
self._items = items self._description = description
self._additional_properties = additional_properties self._inputs = inputs
self._node_templates = node_templates
self._relationship_templates = relationship_templates
self._outputs = outputs
self._groups = groups
self._substitution_mappings = substitution_mappings
self._policies = policies
@classmethod @classmethod
def from_dict(cls, dikt): def from_dict(cls, dikt):
...@@ -48,43 +79,169 @@ class TopologyTemplate(Model): ...@@ -48,43 +79,169 @@ class TopologyTemplate(Model):
return util.deserialize_model(dikt, cls) return util.deserialize_model(dikt, cls)
@property @property
def items(self): def description(self):
"""Gets the items of this TopologyTemplate. """Gets the description of this TopologyTemplate.
:return: The items of this TopologyTemplate. :return: The description of this TopologyTemplate.
:rtype: object :rtype: str
""" """
return self._items return self._description
@items.setter @description.setter
def items(self, items): def description(self, description):
"""Sets the items of this TopologyTemplate. """Sets the description of this TopologyTemplate.
:param items: The items of this TopologyTemplate. :param description: The description of this TopologyTemplate.
:type items: object :type description: str
""" """
self._items = items self._description = description
@property @property
def additional_properties(self): def inputs(self):
"""Gets the additional_properties of this TopologyTemplate. """Gets the inputs of this TopologyTemplate.
:return: The additional_properties of this TopologyTemplate. :return: The inputs of this TopologyTemplate.
:rtype: object :rtype: List[Dict[str, object]]
""" """
return self._additional_properties return self._inputs
@additional_properties.setter @inputs.setter
def additional_properties(self, additional_properties): def inputs(self, inputs):
"""Sets the additional_properties of this TopologyTemplate. """Sets the inputs of this TopologyTemplate.
:param additional_properties: The additional_properties of this TopologyTemplate. :param inputs: The inputs of this TopologyTemplate.
:type additional_properties: object :type inputs: List[Dict[str, object]]
""" """
self._additional_properties = additional_properties self._inputs = inputs
@property
def node_templates(self):
"""Gets the node_templates of this TopologyTemplate.
:return: The node_templates of this TopologyTemplate.
:rtype: Dict[str, NodeTemplate]
"""
return self._node_templates
@node_templates.setter
def node_templates(self, node_templates):
"""Sets the node_templates of this TopologyTemplate.
:param node_templates: The node_templates of this TopologyTemplate.
:type node_templates: Dict[str, NodeTemplate]
"""
self._node_templates = node_templates
@property
def relationship_templates(self):
"""Gets the relationship_templates of this TopologyTemplate.
:return: The relationship_templates of this TopologyTemplate.
:rtype: Dict[str, object]
"""
return self._relationship_templates
@relationship_templates.setter
def relationship_templates(self, relationship_templates):
"""Sets the relationship_templates of this TopologyTemplate.
:param relationship_templates: The relationship_templates of this TopologyTemplate.
:type relationship_templates: Dict[str, object]
"""
self._relationship_templates = relationship_templates
@property
def outputs(self):
"""Gets the outputs of this TopologyTemplate.
:return: The outputs of this TopologyTemplate.
:rtype: List[Dict[str, object]]
"""
return self._outputs
@outputs.setter
def outputs(self, outputs):
"""Sets the outputs of this TopologyTemplate.
:param outputs: The outputs of this TopologyTemplate.
:type outputs: List[Dict[str, object]]
"""
self._outputs = outputs
@property
def groups(self):
"""Gets the groups of this TopologyTemplate.
:return: The groups of this TopologyTemplate.
:rtype: Dict[str, object]
"""
return self._groups
@groups.setter
def groups(self, groups):
"""Sets the groups of this TopologyTemplate.
:param groups: The groups of this TopologyTemplate.
:type groups: Dict[str, object]
"""
self._groups = groups
@property
def substitution_mappings(self):
"""Gets the substitution_mappings of this TopologyTemplate.
:return: The substitution_mappings of this TopologyTemplate.
:rtype: Dict[str, object]
"""
return self._substitution_mappings
@substitution_mappings.setter
def substitution_mappings(self, substitution_mappings):
"""Sets the substitution_mappings of this TopologyTemplate.
:param substitution_mappings: The substitution_mappings of this TopologyTemplate.
:type substitution_mappings: Dict[str, object]
"""
self._substitution_mappings = substitution_mappings
@property
def policies(self):
"""Gets the policies of this TopologyTemplate.
:return: The policies of this TopologyTemplate.
:rtype: List[Dict[str, object]]
"""
return self._policies
@policies.setter
def policies(self, policies):
"""Sets the policies of this TopologyTemplate.
:param policies: The policies of this TopologyTemplate.
:type policies: List[Dict[str, object]]
"""
self._policies = policies
...@@ -6,6 +6,7 @@ from datetime import date, datetime # noqa: F401 ...@@ -6,6 +6,7 @@ from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401 from typing import List, Dict # noqa: F401
from sure_tosca.models.base_model_ import Model from sure_tosca.models.base_model_ import Model
from sure_tosca.models.topology_template import TopologyTemplate # noqa: F401,E501
from sure_tosca import util from sure_tosca import util
...@@ -15,26 +16,111 @@ class ToscaTemplate(Model): ...@@ -15,26 +16,111 @@ class ToscaTemplate(Model):
Do not edit the class manually. Do not edit the class manually.
""" """
def __init__(self, items=None, additional_properties=None): # noqa: E501 def __init__(self, tosca_definitions_version=None, tosca_default_namespace=None, template_name=None, topology_template=None, template_author=None, template_version=None, description=None, imports=None, dsl_definitions=None, node_types=None, relationship_types=None, relationship_templates=None, capability_types=None, artifact_types=None, data_types=None, interface_types=None, policy_types=None, group_types=None, repositories=None): # noqa: E501
"""ToscaTemplate - a model defined in Swagger """ToscaTemplate - a model defined in Swagger
:param items: The items of this ToscaTemplate. # noqa: E501 :param tosca_definitions_version: The tosca_definitions_version of this ToscaTemplate. # noqa: E501
:type items: str :type tosca_definitions_version: str
:param additional_properties: The additional_properties of this ToscaTemplate. # noqa: E501 :param tosca_default_namespace: The tosca_default_namespace of this ToscaTemplate. # noqa: E501
:type additional_properties: object :type tosca_default_namespace: str
:param template_name: The template_name of this ToscaTemplate. # noqa: E501
:type template_name: str
:param topology_template: The topology_template of this ToscaTemplate. # noqa: E501
:type topology_template: TopologyTemplate
:param template_author: The template_author of this ToscaTemplate. # noqa: E501
:type template_author: str
:param template_version: The template_version of this ToscaTemplate. # noqa: E501
:type template_version: str
:param description: The description of this ToscaTemplate. # noqa: E501
:type description: str
:param imports: The imports of this ToscaTemplate. # noqa: E501
:type imports: List[Dict[str, object]]
:param dsl_definitions: The dsl_definitions of this ToscaTemplate. # noqa: E501
:type dsl_definitions: Dict[str, object]
:param node_types: The node_types of this ToscaTemplate. # noqa: E501
:type node_types: Dict[str, object]
:param relationship_types: The relationship_types of this ToscaTemplate. # noqa: E501
:type relationship_types: Dict[str, object]
:param relationship_templates: The relationship_templates of this ToscaTemplate. # noqa: E501
:type relationship_templates: Dict[str, object]
:param capability_types: The capability_types of this ToscaTemplate. # noqa: E501
:type capability_types: Dict[str, object]
:param artifact_types: The artifact_types of this ToscaTemplate. # noqa: E501
:type artifact_types: Dict[str, object]
:param data_types: The data_types of this ToscaTemplate. # noqa: E501
:type data_types: Dict[str, object]
:param interface_types: The interface_types of this ToscaTemplate. # noqa: E501
:type interface_types: Dict[str, object]
:param policy_types: The policy_types of this ToscaTemplate. # noqa: E501
:type policy_types: Dict[str, str]
:param group_types: The group_types of this ToscaTemplate. # noqa: E501
:type group_types: Dict[str, object]
:param repositories: The repositories of this ToscaTemplate. # noqa: E501
:type repositories: Dict[str, object]
""" """
self.swagger_types = { self.swagger_types = {
'items': str, 'tosca_definitions_version': str,
'additional_properties': object 'tosca_default_namespace': str,
'template_name': str,
'topology_template': TopologyTemplate,
'template_author': str,
'template_version': str,
'description': str,
'imports': List[Dict[str, object]],
'dsl_definitions': Dict[str, object],
'node_types': Dict[str, object],
'relationship_types': Dict[str, object],
'relationship_templates': Dict[str, object],
'capability_types': Dict[str, object],
'artifact_types': Dict[str, object],
'data_types': Dict[str, object],
'interface_types': Dict[str, object],
'policy_types': Dict[str, str],
'group_types': Dict[str, object],
'repositories': Dict[str, object]
} }
self.attribute_map = { self.attribute_map = {
'items': 'items', 'tosca_definitions_version': 'tosca_definitions_version',
'additional_properties': 'additionalProperties' 'tosca_default_namespace': 'tosca_default_namespace',
'template_name': 'template_name',
'topology_template': 'topology_template',
'template_author': 'template_author',
'template_version': 'template_version',
'description': 'description',
'imports': 'imports',
'dsl_definitions': 'dsl_definitions',
'node_types': 'node_types',
'relationship_types': 'relationship_types',
'relationship_templates': 'relationship_templates',
'capability_types': 'capability_types',
'artifact_types': 'artifact_types',
'data_types': 'data_types',
'interface_types': 'interface_types',
'policy_types': 'policy_types',
'group_types': 'group_types',
'repositories': 'repositories'
} }
self._items = items self._tosca_definitions_version = tosca_definitions_version
self._additional_properties = additional_properties self._tosca_default_namespace = tosca_default_namespace
self._template_name = template_name
self._topology_template = topology_template
self._template_author = template_author
self._template_version = template_version
self._description = description
self._imports = imports
self._dsl_definitions = dsl_definitions
self._node_types = node_types
self._relationship_types = relationship_types
self._relationship_templates = relationship_templates
self._capability_types = capability_types
self._artifact_types = artifact_types
self._data_types = data_types
self._interface_types = interface_types
self._policy_types = policy_types
self._group_types = group_types
self._repositories = repositories
@classmethod @classmethod
def from_dict(cls, dikt): def from_dict(cls, dikt):
...@@ -48,43 +134,400 @@ class ToscaTemplate(Model): ...@@ -48,43 +134,400 @@ class ToscaTemplate(Model):
return util.deserialize_model(dikt, cls) return util.deserialize_model(dikt, cls)
@property @property
def items(self): def tosca_definitions_version(self):
"""Gets the items of this ToscaTemplate. """Gets the tosca_definitions_version of this ToscaTemplate.
:return: The items of this ToscaTemplate. :return: The tosca_definitions_version of this ToscaTemplate.
:rtype: str :rtype: str
""" """
return self._items return self._tosca_definitions_version
@items.setter @tosca_definitions_version.setter
def items(self, items): def tosca_definitions_version(self, tosca_definitions_version):
"""Sets the items of this ToscaTemplate. """Sets the tosca_definitions_version of this ToscaTemplate.
:param items: The items of this ToscaTemplate. :param tosca_definitions_version: The tosca_definitions_version of this ToscaTemplate.
:type items: str :type tosca_definitions_version: str
""" """
self._items = items self._tosca_definitions_version = tosca_definitions_version
@property @property
def additional_properties(self): def tosca_default_namespace(self):
"""Gets the additional_properties of this ToscaTemplate. """Gets the tosca_default_namespace of this ToscaTemplate.
:return: The additional_properties of this ToscaTemplate. :return: The tosca_default_namespace of this ToscaTemplate.
:rtype: object :rtype: str
"""
return self._tosca_default_namespace
@tosca_default_namespace.setter
def tosca_default_namespace(self, tosca_default_namespace):
"""Sets the tosca_default_namespace of this ToscaTemplate.
:param tosca_default_namespace: The tosca_default_namespace of this ToscaTemplate.
:type tosca_default_namespace: str
"""
self._tosca_default_namespace = tosca_default_namespace
@property
def template_name(self):
"""Gets the template_name of this ToscaTemplate.
:return: The template_name of this ToscaTemplate.
:rtype: str
"""
return self._template_name
@template_name.setter
def template_name(self, template_name):
"""Sets the template_name of this ToscaTemplate.
:param template_name: The template_name of this ToscaTemplate.
:type template_name: str
"""
self._template_name = template_name
@property
def topology_template(self):
"""Gets the topology_template of this ToscaTemplate.
:return: The topology_template of this ToscaTemplate.
:rtype: TopologyTemplate
"""
return self._topology_template
@topology_template.setter
def topology_template(self, topology_template):
"""Sets the topology_template of this ToscaTemplate.
:param topology_template: The topology_template of this ToscaTemplate.
:type topology_template: TopologyTemplate
"""
self._topology_template = topology_template
@property
def template_author(self):
"""Gets the template_author of this ToscaTemplate.
:return: The template_author of this ToscaTemplate.
:rtype: str
"""
return self._template_author
@template_author.setter
def template_author(self, template_author):
"""Sets the template_author of this ToscaTemplate.
:param template_author: The template_author of this ToscaTemplate.
:type template_author: str
"""
self._template_author = template_author
@property
def template_version(self):
"""Gets the template_version of this ToscaTemplate.
:return: The template_version of this ToscaTemplate.
:rtype: str
"""
return self._template_version
@template_version.setter
def template_version(self, template_version):
"""Sets the template_version of this ToscaTemplate.
:param template_version: The template_version of this ToscaTemplate.
:type template_version: str
"""
self._template_version = template_version
@property
def description(self):
"""Gets the description of this ToscaTemplate.
:return: The description of this ToscaTemplate.
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this ToscaTemplate.
:param description: The description of this ToscaTemplate.
:type description: str
"""
self._description = description
@property
def imports(self):
"""Gets the imports of this ToscaTemplate.
:return: The imports of this ToscaTemplate.
:rtype: List[Dict[str, object]]
"""
return self._imports
@imports.setter
def imports(self, imports):
"""Sets the imports of this ToscaTemplate.
:param imports: The imports of this ToscaTemplate.
:type imports: List[Dict[str, object]]
"""
self._imports = imports
@property
def dsl_definitions(self):
"""Gets the dsl_definitions of this ToscaTemplate.
:return: The dsl_definitions of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._dsl_definitions
@dsl_definitions.setter
def dsl_definitions(self, dsl_definitions):
"""Sets the dsl_definitions of this ToscaTemplate.
:param dsl_definitions: The dsl_definitions of this ToscaTemplate.
:type dsl_definitions: Dict[str, object]
"""
self._dsl_definitions = dsl_definitions
@property
def node_types(self):
"""Gets the node_types of this ToscaTemplate.
:return: The node_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._node_types
@node_types.setter
def node_types(self, node_types):
"""Sets the node_types of this ToscaTemplate.
:param node_types: The node_types of this ToscaTemplate.
:type node_types: Dict[str, object]
"""
self._node_types = node_types
@property
def relationship_types(self):
"""Gets the relationship_types of this ToscaTemplate.
:return: The relationship_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._relationship_types
@relationship_types.setter
def relationship_types(self, relationship_types):
"""Sets the relationship_types of this ToscaTemplate.
:param relationship_types: The relationship_types of this ToscaTemplate.
:type relationship_types: Dict[str, object]
"""
self._relationship_types = relationship_types
@property
def relationship_templates(self):
"""Gets the relationship_templates of this ToscaTemplate.
:return: The relationship_templates of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._relationship_templates
@relationship_templates.setter
def relationship_templates(self, relationship_templates):
"""Sets the relationship_templates of this ToscaTemplate.
:param relationship_templates: The relationship_templates of this ToscaTemplate.
:type relationship_templates: Dict[str, object]
"""
self._relationship_templates = relationship_templates
@property
def capability_types(self):
"""Gets the capability_types of this ToscaTemplate.
:return: The capability_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._capability_types
@capability_types.setter
def capability_types(self, capability_types):
"""Sets the capability_types of this ToscaTemplate.
:param capability_types: The capability_types of this ToscaTemplate.
:type capability_types: Dict[str, object]
"""
self._capability_types = capability_types
@property
def artifact_types(self):
"""Gets the artifact_types of this ToscaTemplate.
:return: The artifact_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._artifact_types
@artifact_types.setter
def artifact_types(self, artifact_types):
"""Sets the artifact_types of this ToscaTemplate.
:param artifact_types: The artifact_types of this ToscaTemplate.
:type artifact_types: Dict[str, object]
"""
self._artifact_types = artifact_types
@property
def data_types(self):
"""Gets the data_types of this ToscaTemplate.
:return: The data_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._data_types
@data_types.setter
def data_types(self, data_types):
"""Sets the data_types of this ToscaTemplate.
:param data_types: The data_types of this ToscaTemplate.
:type data_types: Dict[str, object]
"""
self._data_types = data_types
@property
def interface_types(self):
"""Gets the interface_types of this ToscaTemplate.
:return: The interface_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._interface_types
@interface_types.setter
def interface_types(self, interface_types):
"""Sets the interface_types of this ToscaTemplate.
:param interface_types: The interface_types of this ToscaTemplate.
:type interface_types: Dict[str, object]
"""
self._interface_types = interface_types
@property
def policy_types(self):
"""Gets the policy_types of this ToscaTemplate.
:return: The policy_types of this ToscaTemplate.
:rtype: Dict[str, str]
"""
return self._policy_types
@policy_types.setter
def policy_types(self, policy_types):
"""Sets the policy_types of this ToscaTemplate.
:param policy_types: The policy_types of this ToscaTemplate.
:type policy_types: Dict[str, str]
"""
self._policy_types = policy_types
@property
def group_types(self):
"""Gets the group_types of this ToscaTemplate.
:return: The group_types of this ToscaTemplate.
:rtype: Dict[str, object]
"""
return self._group_types
@group_types.setter
def group_types(self, group_types):
"""Sets the group_types of this ToscaTemplate.
:param group_types: The group_types of this ToscaTemplate.
:type group_types: Dict[str, object]
"""
self._group_types = group_types
@property
def repositories(self):
"""Gets the repositories of this ToscaTemplate.
:return: The repositories of this ToscaTemplate.
:rtype: Dict[str, object]
""" """
return self._additional_properties return self._repositories
@additional_properties.setter @repositories.setter
def additional_properties(self, additional_properties): def repositories(self, repositories):
"""Sets the additional_properties of this ToscaTemplate. """Sets the repositories of this ToscaTemplate.
:param additional_properties: The additional_properties of this ToscaTemplate. :param repositories: The repositories of this ToscaTemplate.
:type additional_properties: object :type repositories: Dict[str, object]
""" """
self._additional_properties = additional_properties self._repositories = repositories
...@@ -493,35 +493,296 @@ definitions: ...@@ -493,35 +493,296 @@ definitions:
ToscaTemplate: ToscaTemplate:
type: "object" type: "object"
properties: properties:
items: tosca_definitions_version:
type: "string" type: "string"
additionalProperties: tosca_default_namespace:
type: "string"
template_name:
type: "string"
topology_template:
$ref: "#/definitions/TopologyTemplate"
template_author:
type: "string"
template_version:
type: "string"
description:
type: "string"
imports:
type: "array"
items:
type: "object"
additionalProperties:
type: "object"
properties: {}
dsl_definitions:
type: "object" type: "object"
properties: {} additionalProperties:
type: "object"
properties: {}
node_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
relationship_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
relationship_templates:
type: "object"
additionalProperties:
type: "object"
properties: {}
capability_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
artifact_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
data_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
interface_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
policy_types:
type: "object"
additionalProperties:
type: "string"
group_types:
type: "object"
additionalProperties:
type: "object"
properties: {}
repositories:
type: "object"
additionalProperties:
type: "object"
properties: {}
example: example:
additionalProperties: "{}" node_types:
items: "items" key: "{}"
policy_types:
key: "policy_types"
topology_template:
outputs:
- key: "{}"
- key: "{}"
substitution_mappings:
key: "{}"
inputs:
- key: "{}"
- key: "{}"
node_templates:
key:
requirements:
- key: "{}"
- key: "{}"
interfaces:
key: "{}"
capabilities:
key: "{}"
directives:
- "directives"
- "directives"
derived_from: "derived_from"
description: "description"
attributes:
key: "{}"
type: "type"
properties:
key: "{}"
artifacts:
key: "{}"
policies:
- key: "{}"
- key: "{}"
description: "description"
groups:
key: "{}"
relationship_templates:
key: "{}"
template_version: "template_version"
imports:
- key: "{}"
- key: "{}"
template_author: "template_author"
group_types:
key: "{}"
description: "description"
template_name: "template_name"
artifact_types:
key: "{}"
capability_types:
key: "{}"
repositories:
key: "{}"
tosca_definitions_version: "tosca_definitions_version"
dsl_definitions:
key: "{}"
interface_types:
key: "{}"
relationship_types:
key: "{}"
tosca_default_namespace: "tosca_default_namespace"
relationship_templates:
key: "{}"
data_types:
key: "{}"
TopologyTemplate: TopologyTemplate:
type: "object" type: "object"
properties: properties:
items: description:
type: "string"
inputs:
type: "array"
items:
type: "object"
additionalProperties:
type: "object"
properties: {}
node_templates:
type: "object" type: "object"
properties: {} additionalProperties:
additionalProperties: $ref: "#/definitions/NodeTemplate"
relationship_templates:
type: "object" type: "object"
properties: {} additionalProperties:
type: "object"
properties: {}
outputs:
type: "array"
items:
type: "object"
additionalProperties:
type: "object"
properties: {}
groups:
type: "object"
additionalProperties:
type: "object"
properties: {}
substitution_mappings:
type: "object"
additionalProperties:
type: "object"
properties: {}
policies:
type: "array"
items:
type: "object"
additionalProperties:
type: "object"
properties: {}
example: example:
additionalProperties: "{}" outputs:
items: "{}" - key: "{}"
- key: "{}"
substitution_mappings:
key: "{}"
inputs:
- key: "{}"
- key: "{}"
node_templates:
key:
requirements:
- key: "{}"
- key: "{}"
interfaces:
key: "{}"
capabilities:
key: "{}"
directives:
- "directives"
- "directives"
derived_from: "derived_from"
description: "description"
attributes:
key: "{}"
type: "type"
properties:
key: "{}"
artifacts:
key: "{}"
policies:
- key: "{}"
- key: "{}"
description: "description"
groups:
key: "{}"
relationship_templates:
key: "{}"
NodeTemplate: NodeTemplate:
type: "object" type: "object"
properties: properties:
items: derived_from:
type: "string"
properties:
type: "object"
additionalProperties:
type: "object"
properties: {}
requirements:
type: "array"
items:
type: "object"
additionalProperties:
type: "object"
properties: {}
interfaces:
type: "object"
additionalProperties:
type: "object"
properties: {}
capabilities:
type: "object" type: "object"
properties: {} additionalProperties:
additionalProperties: type: "object"
properties: {}
type:
type: "string"
description:
type: "string"
directives:
type: "array"
items:
type: "string"
attributes:
type: "object" type: "object"
properties: {} additionalProperties:
type: "object"
properties: {}
artifacts:
type: "object"
additionalProperties:
type: "object"
properties: {}
example: example:
additionalProperties: "{}" requirements:
items: "{}" - key: "{}"
- key: "{}"
interfaces:
key: "{}"
capabilities:
key: "{}"
directives:
- "directives"
- "directives"
derived_from: "derived_from"
description: "description"
attributes:
key: "{}"
type: "type"
properties:
key: "{}"
artifacts:
key: "{}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment