Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
4f91ee99
Commit
4f91ee99
authored
Oct 28, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed wrong data types.
implemented 3 methods
parent
f7b8348a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1270 additions
and
164 deletions
+1270
-164
requirements.txt
sure_tosca-flask-server/requirements.txt
+3
-1
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+83
-48
node_template.py
sure_tosca-flask-server/sure_tosca/models/node_template.py
+241
-33
topology_template.py
...tosca-flask-server/sure_tosca/models/topology_template.py
+190
-33
tosca_template.py
sure_tosca-flask-server/sure_tosca/models/tosca_template.py
+475
-32
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+278
-17
No files found.
sure_tosca-flask-server/requirements.txt
View file @
4f91ee99
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
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
4f91ee99
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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
=
NodeTemplate
Model
.
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[NodeTemplate
Model
]
"""
"""
if
connexion
.
request
.
is_json
:
if
connexion
.
request
.
is_json
:
body
=
NodeTemplate
.
from_dict
(
connexion
.
request
.
get_json
())
# noqa: E501
body
=
NodeTemplate
Model
.
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
)
sure_tosca-flask-server/sure_tosca/models/node_template.py
View file @
4f91ee99
...
@@ -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_propertie
s
=
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
,
artifact
s
=
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
sure_tosca-flask-server/sure_tosca/models/topology_template.py
View file @
4f91ee99
...
@@ -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_propert
ies
=
None
):
# noqa: E501
def
__init__
(
self
,
description
=
None
,
inputs
=
None
,
node_templates
=
None
,
relationship_templates
=
None
,
outputs
=
None
,
groups
=
None
,
substitution_mappings
=
None
,
polic
ies
=
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_propertie
s
(
self
):
def
input
s
(
self
):
"""Gets the
additional_propertie
s of this TopologyTemplate.
"""Gets the
input
s of this TopologyTemplate.
:return: The
additional_propertie
s of this TopologyTemplate.
:return: The
input
s of this TopologyTemplate.
:rtype:
object
:rtype:
List[Dict[str, object]]
"""
"""
return
self
.
_
additional_propertie
s
return
self
.
_
input
s
@
additional_propertie
s
.
setter
@
input
s
.
setter
def
additional_properties
(
self
,
additional_propertie
s
):
def
inputs
(
self
,
input
s
):
"""Sets the
additional_propertie
s of this TopologyTemplate.
"""Sets the
input
s of this TopologyTemplate.
:param
additional_properties: The additional_propertie
s of this TopologyTemplate.
:param
inputs: The input
s 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
sure_tosca-flask-server/sure_tosca/models/tosca_template.py
View file @
4f91ee99
This diff is collapsed.
Click to expand it.
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
4f91ee99
...
@@ -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
:
"
{}"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment