Commit d32aceb8 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added sure_tosca python client

parent 2c92dfaf
...@@ -3,9 +3,12 @@ names==0.3.0 ...@@ -3,9 +3,12 @@ names==0.3.0
networkx==2.4 networkx==2.4
requests==2.23.0 requests==2.23.0
wheel==0.34.2 wheel==0.34.2
pyyaml==5.3 pyyaml==5.3.1
tosca-parser ==1.7.0 matplotlib==3.2.1
matplotlib==3.2.0
ansible==2.9.6 certifi==2019.11.28
ansible-tower-cli==3.3.8 six==1.14.0
python_dateutil==2.8.1
setuptools==46.0.0
urllib3==1.25.8
import os
from _ast import mod
import yaml
yaml.Dumper.ignore_aliases = lambda *args: True
def get_templates_directory_path(file_name):
template_path = "./k8s/"
template_file_path = template_path + file_name
if not os.path.exists(template_file_path):
template_path = "../k8s/"
template_file_path = template_path + file_name
return os.path.abspath(template_file_path)
def get_yaml_data(file_name):
template_file_path = get_templates_directory_path(file_name)
with open(template_file_path, 'r') as stream:
data = yaml.safe_load(stream)
return data
def get_dockers(tosca_template_json):
dockers = []
node_templates = tosca_template_json['topology_template']['node_templates']
for node_name in node_templates:
if node_templates[node_name]['type'] == 'tosca.nodes.ARTICONF.Container.Application.Docker':
docker = {node_name: node_templates[node_name]}
dockers.append(docker)
return dockers
def create_service_definition(docker_name, docker):
k8s_service = get_yaml_data('template-service.yaml')
k8s_service['metadata']['labels']['app'] = docker_name
k8s_service['metadata']['name'] = docker_name
docker_ports = docker[docker_name]['properties']['ports'][0].split(':')
k8s_service['spec']['ports'][0]['port'] = int(docker_ports[1])
k8s_service['spec']['ports'][0]['nodePort'] = int(docker_ports[0])
k8s_service['spec']['selector']['app'] = docker_name
return k8s_service
def create_deployment_definition(docker_name, docker):
docker_ports = docker[docker_name]['properties']['ports'][0].split(':')
deployment = get_yaml_data('template-deployment.yaml')
deployment['metadata']['labels']['app'] = docker_name
deployment['metadata']['name'] = docker_name
deployment['spec']['selector']['matchLabels']['app'] = docker_name
deployment['spec']['template']['metadata']['labels']['app'] = docker_name
deployment['spec']['template']['spec']['containers'][0]['image'] = docker[docker_name]['artifacts']['image']['file']
deployment['spec']['template']['spec']['containers'][0]['ports'][0]['containerPort'] = int(docker_ports[1])
deployment['spec']['template']['spec']['containers'][0]['name'] = docker_name
if docker[docker_name]['properties'] and 'environment' in docker[docker_name]['properties']:
env_list = []
for env in docker[docker_name]['properties']['environment']:
k8s_env = {'name': env, 'value': docker[docker_name]['properties']['environment'][env]}
env_list.append(k8s_env)
deployment['spec']['template']['spec']['containers'][0]['env'] = env_list
return deployment
def get_k8s_definitions(dockers):
k8s_services = []
k8s_deployments = []
definitions = {}
for docker in dockers:
docker_name = next(iter(docker))
k8s_service = create_service_definition(docker_name, docker)
k8s_services.append(k8s_service)
# -----------------------------------------------------------
deployment = create_deployment_definition(docker_name, docker)
k8s_deployments.append(deployment)
# print(yaml.dump(deployment))
definitions['services'] = k8s_services
definitions['deployments'] = k8s_deployments
return definitions
def create_pip_task():
pip_task = {'name': 'install pip modules'}
modules = ['setuptools', 'kubernetes', 'openshift']
pip = {'name': modules}
pip_task['pip'] = pip
return pip_task
def create_service_task(i, services_def):
task = {'name': 'Create a Service object' + str(i)}
k8s = {'state': 'present', 'definition': services_def}
task['k8s'] = k8s
return task
def create_deployment_task(i, deployments_def):
task = {'name': 'Create a deployment object' + str(i)}
k8s = {'state': 'present', 'definition': deployments_def}
task['k8s'] = k8s
return task
def create_namespace_task():
task = {'name': 'create namespace'}
k8s = {'name': 'application', 'api_version': 'v1', 'kind': 'Namespace', 'state': 'present'}
task['k8s'] = k8s
return task
def create_dashboard_task(def_src):
task = {'name': 'create_dashboard'}
k8s = {'state': 'present', 'src': def_src}
task['k8s'] = k8s
return task
def create_admin_dashboard_task():
admin_service_account_def = get_yaml_data("admin_service_account.yaml")
task = {'name': 'create_admin_dashboard'}
k8s = {'state': 'present', 'definition': admin_service_account_def}
task['k8s'] = k8s
return task
def create_admin_cluster_role_binding_task():
admin_cluster_role_binding_def = get_yaml_data("admin_cluster_role_binding.yaml")
task = {'name': 'create_admin_cluster_role_binding'}
k8s = {'state': 'present', 'definition': admin_cluster_role_binding_def}
task['k8s'] = k8s
return task
def create_copy_task(src, dest):
copy = {'src': src, 'dest': dest}
task = {'name': 'copy task src: ' + src + ' dest: ' + dest, 'copy': copy}
return task
def create_get_admin_token_task():
task = {'name': 'get token',
'shell': 'kubectl describe secret $(kubectl get secret | grep admin-user | awk \'{print $1}\')',
'register': 'dashboard_token'}
return task
def create_print_admin_token_task():
var = {'var': 'dashboard_token'}
task = {'name': 'print token',
'debug': var}
return task
def write_ansible_k8s_files(tosca_template_json, tmp_path):
dockers = get_dockers(tosca_template_json)
k8s_definitions = get_k8s_definitions(dockers)
services = k8s_definitions['services']
deployments = k8s_definitions['deployments']
i = 0
tasks = []
pip_task = create_pip_task()
tasks.append(pip_task)
# namespace_task = create_namespace_task()
# tasks.append(namespace_task)
def_src = '/tmp/dashboard.yaml'
copy_task = create_copy_task(get_templates_directory_path('dashboard.yaml'), def_src)
tasks.append(copy_task)
dashboard_task = create_dashboard_task(def_src)
tasks.append(dashboard_task)
dashboard_admin_task = create_admin_dashboard_task()
tasks.append(dashboard_admin_task)
admin_cluster_role_binding_task = create_admin_cluster_role_binding_task()
tasks.append(admin_cluster_role_binding_task)
get_admin_token_task = create_get_admin_token_task()
tasks.append(get_admin_token_task)
print_admin_token_task = create_print_admin_token_task()
tasks.append(print_admin_token_task)
for services_def in services:
task = create_service_task(i, services_def)
i += 1
tasks.append(task)
i = 0
for deployments_def in deployments:
task = create_deployment_task(i, deployments_def)
i += 1
tasks.append(task)
ansible_playbook = []
plays = {'hosts': 'k8-master', 'tasks': tasks}
ansible_playbook.append(plays)
# print(yaml.safe_dump(ansible_playbook))
ansible_playbook_path = tmp_path + '/' + 'k8s_playbook.yml'
with open(ansible_playbook_path, 'w') as file:
documents = yaml.dump(ansible_playbook, file)
return ansible_playbook_path
def get_dashboard_url(vms):
dashboard_tasks_path = get_templates_directory_path('dashboard.yaml')
with open(dashboard_tasks_path, 'r') as stream:
tasks = list(yaml.load_all(stream))
for task in tasks:
if task['kind'] == 'Service' and 'name' in task['metadata'] and task['metadata']['name'] and task['metadata'][
'name'] == 'kubernetes-dashboard':
dashboard_port = task['spec']['ports'][0]['nodePort']
for vm_name in vms:
attributes = vms[vm_name]['attributes']
role = attributes['role']
if role == 'master':
k8_master = attributes['public_ip']
url = 'https://' + k8_master + ':' + str(dashboard_port)
return url
def get_service_urls(vms, tosca_template_json):
dockers = get_dockers(tosca_template_json)
for vm_name in vms:
attributes = vms[vm_name]['attributes']
role = attributes['role']
if role == 'master':
k8_master = attributes['public_ip']
break
urls = {}
for docker in dockers:
docker_name = next(iter(docker))
docker_ports = docker[docker_name]['properties']['ports'][0].split(':')
node_port = int(docker_ports[0])
url = 'http://' + k8_master + ':' + str(node_port)
urls[docker_name] = url
return urls
import logging
logger = logging.getLogger(__name__)
def get_interfaces(tosca_template_dict):
node_templates = tosca_template_dict['topology_template']['node_templates']
for node_name in node_templates:
if node_templates[node_name]['type'] == 'tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes':
logger.info("Returning interfaces from tosca_template: " + str(node_templates[node_name]['interfaces']))
return node_templates[node_name]['interfaces']
def get_vms(tosca_template_json):
node_templates = tosca_template_json['topology_template']['node_templates']
vms = {}
for node_name in node_templates:
if node_templates[node_name]['type'] == 'tosca.nodes.ARTICONF.VM.Compute':
vms[node_name] = node_templates[node_name]
logger.info("Returning VMs from tosca_template: " + str(vms))
return vms
def add_tokens(tokens, tosca_template_dict):
node_templates = tosca_template_dict['topology_template']['node_templates']
for node_name in node_templates:
if node_templates[node_name]['type'] == 'tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes':
creds = []
for token_name in tokens:
cred = {'token_type': 'k8s_token', 'token': tokens[token_name], 'user': token_name}
creds.append(cred)
if 'attributes' not in node_templates[node_name]:
node_templates[node_name]['attributes'] = {}
attributes = node_templates[node_name]['attributes']
attributes['tokens'] = creds
return tosca_template_dict
def add_dashboard_url(dashboard_url, tosca_template_dict):
node_templates = tosca_template_dict['topology_template']['node_templates']
for node_name in node_templates:
if node_templates[node_name]['type'] == 'tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes':
if 'attributes' not in node_templates[node_name]:
node_templates[node_name]['attributes'] = {}
attributes = node_templates[node_name]['attributes']
attributes['dashboard_url'] = dashboard_url
return tosca_template_dict
def add_service_url(serviceu_urls, tosca_template_dict):
node_templates = tosca_template_dict['topology_template']['node_templates']
for node_name in node_templates:
if node_templates[node_name]['type'] == 'tosca.nodes.ARTICONF.Container.Application.Docker':
if 'attributes' not in node_templates[node_name]:
node_templates[node_name]['attributes'] = {}
attributes = node_templates[node_name]['attributes']
attributes['service_url'] = serviceu_urls[node_name]
return tosca_template_dict
coverage==5.0.4
nose==1.3.7
pluggy==0.13.1
py==1.8.1
randomize==0.14
version: '3' version: '3'
services: services:
#postgres:
#image: "postgres:12.2"
#environment:
#POSTGRES_USER: awx
#POSTGRES_PASSWORD: awxpass
#POSTGRES_DB: awx
#POSTGRES_HOST_AUTH_METHOD: trust
#ports:
#- "5432:5432"
#volumes:
#- db-data:/var/lib/postgresql/data
rabbit: rabbit:
image: rabbitmq:3.8-management image: rabbitmq:3.8-management
...@@ -19,66 +8,11 @@ services: ...@@ -19,66 +8,11 @@ services:
- "15672:15672" - "15672:15672"
- "4369:4369" - "4369:4369"
- "15671:15671" - "15671:15671"
#environment:
#RABBITMQ_DEFAULT_VHOST: awx
#memcached:
#image: "memcached:alpine"
#awx_web:
#image: "geerlingguy/awx_web:latest"
##image: "ansible/awx_web:latest"
#depends_on:
#- rabbit
#- memcached
#- postgres
#ports:
#- "8051-8052:8051-8052"
##volumes:
##- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
#user: root
#environment:
#SECRET_KEY: aabbcc
#DATABASE_USER: awx
#DATABASE_PASSWORD: awxpass
#DATABASE_NAME: awx
#DATABASE_PORT: 5432
#DATABASE_HOST: postgres
#RABBITMQ_USER: guest
#RABBITMQ_PASSWORD: guest
#RABBITMQ_HOST: rabbit
#RABBITMQ_PORT: 5672
#RABBITMQ_VHOST: awx
#MEMCACHED_HOST: memcached
#MEMCACHED_PORT: 11211
#awx_task: semaphore:
#image: "geerlingguy/awx_task:latest" ports:
##image: "ansible/awx_task:latest" - "30003:3000"
##volumes: image: ansiblesemaphore/semaphore
##- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
#depends_on:
#- rabbit
#- memcached
#- awx_web
#- postgres
#hostname: awx
#user: root
#environment:
#SECRET_KEY: aabbcc
#DATABASE_USER: awx
#DATABASE_PASSWORD: awxpass
#DATABASE_NAME: awx
#DATABASE_PORT: 5432
#DATABASE_HOST: postgres
#RABBITMQ_USER: guest
#RABBITMQ_PASSWORD: guest
#RABBITMQ_HOST: rabbit
#RABBITMQ_PORT: 5672
#RABBITMQ_VHOST: awx
#MEMCACHED_HOST: memcached
#MEMCACHED_PORT: 11211
logspout: logspout:
...@@ -96,12 +30,7 @@ services: ...@@ -96,12 +30,7 @@ services:
image: mongo:4 image: mongo:4
ports: ports:
- "27017:27017" - "27017:27017"
#jupyter:
#ports:
#- "30003:8888"
#image: jupyter_base-notebook
manager: manager:
depends_on: depends_on:
......
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
venv/
.python-version
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
#Ipython Notebook
.ipynb_checkpoints
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (sure_tosca-client_python_stubs)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/sure_tosca-client_python_stubs.iml" filepath="$PROJECT_DIR$/.idea/sure_tosca-client_python_stubs.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.8 (sure_tosca-client_python_stubs)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3f84153d-6ed1-4691-94d6-53105266f15e" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../deployer/requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/../deployer/requirements.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../deployer/service/__init__.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../deployer/service/k8s_service.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../deployer/service/tosca.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../docker-compose.yml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component>
<component name="ProjectId" id="1ZRtB1w8qQYGLil0tptWk3vA7iM" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../sure_tosca-flask-server" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RunManager">
<configuration name="Unittests in test_default_api.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
<module name="sure_tosca-client_python_stubs" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
<option name="_new_target" value="&quot;$PROJECT_DIR$/test/test_default_api.py&quot;" />
<option name="_new_targetType" value="&quot;PATH&quot;" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python tests.Unittests in test_default_api.py" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3f84153d-6ed1-4691-94d6-53105266f15e" name="Default Changelist" comment="" />
<created>1584813594976</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1584813594976</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="723" y="257" width="530" height="598" key="FileChooserDialogImpl" timestamp="1584814061190">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="723" y="257" width="530" height="598" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1584814061190" />
<state width="1825" height="134" key="GridCell.Tab.0.bottom" timestamp="1584900161062">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="134" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1584900161062" />
<state width="1825" height="134" key="GridCell.Tab.0.center" timestamp="1584900161062">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="134" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1584900161062" />
<state width="1825" height="134" key="GridCell.Tab.0.left" timestamp="1584900161062">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="134" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1584900161062" />
<state width="1825" height="134" key="GridCell.Tab.0.right" timestamp="1584900161062">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="134" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1584900161062" />
<state width="1825" height="372" key="GridCell.Tab.1.bottom" timestamp="1584815771481">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="372" key="GridCell.Tab.1.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1584815771481" />
<state width="1825" height="372" key="GridCell.Tab.1.center" timestamp="1584815771481">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="372" key="GridCell.Tab.1.center/67.34.1853.1046@67.34.1853.1046" timestamp="1584815771481" />
<state width="1825" height="372" key="GridCell.Tab.1.left" timestamp="1584815771481">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="372" key="GridCell.Tab.1.left/67.34.1853.1046@67.34.1853.1046" timestamp="1584815771481" />
<state width="1825" height="372" key="GridCell.Tab.1.right" timestamp="1584815771481">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state width="1825" height="372" key="GridCell.Tab.1.right/67.34.1853.1046@67.34.1853.1046" timestamp="1584815771481" />
<state x="359" y="103" key="SettingsEditor" timestamp="1584813615342">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="359" y="103" key="SettingsEditor/67.34.1853.1046@67.34.1853.1046" timestamp="1584813615342" />
<state x="563" y="235" width="1053" height="732" key="find.popup" timestamp="1584900160970">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="563" y="235" width="1053" height="732" key="find.popup/67.34.1853.1046@67.34.1853.1046" timestamp="1584900160970" />
</component>
</project>
\ No newline at end of file
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
# ref: https://docs.travis-ci.com/user/languages/python
language: python
python:
- "3.8"
# command to install dependencies
install: "pip install -r requirements.txt"
# command to run tests
script: nosetests
# sure_tosca_client
TOSCA Simple qUeRy sErvice (SURE).
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.PythonClientCodegen
## Requirements.
Python 2.7 and 3.4+
## Installation & Usage
### pip install
If the python package is hosted on Github, you can install directly from Github
```sh
pip install git+https://github.com//.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com//.git`)
Then import the package:
```python
import swagger_client
```
### Setuptools
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)
Then import the package:
```python
import swagger_client
```
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_all_ancestor_properties(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_all_ancestor_properties: %s\n" % e)
```
## Documentation for API Endpoints
All URIs are relative to *https://localhost/tosca-sure/1.0.0*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**get_all_ancestor_properties**](docs/DefaultApi.md#get_all_ancestor_properties) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties |
*DefaultApi* | [**get_all_ancestor_types**](docs/DefaultApi.md#get_all_ancestor_types) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types |
*DefaultApi* | [**get_ancestors_requirements**](docs/DefaultApi.md#get_ancestors_requirements) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements |
*DefaultApi* | [**get_dsl_definitions**](docs/DefaultApi.md#get_dsl_definitions) | **GET** /tosca_template/{id}/dsl_definitions |
*DefaultApi* | [**get_imports**](docs/DefaultApi.md#get_imports) | **GET** /tosca_template/{id}/imports |
*DefaultApi* | [**get_node_outputs**](docs/DefaultApi.md#get_node_outputs) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/outputs |
*DefaultApi* | [**get_node_properties**](docs/DefaultApi.md#get_node_properties) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/properties |
*DefaultApi* | [**get_node_requirements**](docs/DefaultApi.md#get_node_requirements) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/requirements |
*DefaultApi* | [**get_node_templates**](docs/DefaultApi.md#get_node_templates) | **GET** /tosca_template/{id}/topology_template/node_templates |
*DefaultApi* | [**get_node_type_name**](docs/DefaultApi.md#get_node_type_name) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/type_name |
*DefaultApi* | [**get_parent_type_name**](docs/DefaultApi.md#get_parent_type_name) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from |
*DefaultApi* | [**get_related_nodes**](docs/DefaultApi.md#get_related_nodes) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/related |
*DefaultApi* | [**get_relationship_templates**](docs/DefaultApi.md#get_relationship_templates) | **GET** /tosca_template/{id}/relationship_templates |
*DefaultApi* | [**get_topology_template**](docs/DefaultApi.md#get_topology_template) | **GET** /tosca_template/{id}/topology_template |
*DefaultApi* | [**get_tosca_template**](docs/DefaultApi.md#get_tosca_template) | **GET** /tosca_template/{id} |
*DefaultApi* | [**get_types**](docs/DefaultApi.md#get_types) | **GET** /tosca_template/{id}/types |
*DefaultApi* | [**set_node_properties**](docs/DefaultApi.md#set_node_properties) | **PUT** /tosca_template/{id}/topology_template/node_templates/{node_name}/properties |
*DefaultApi* | [**upload_tosca_template**](docs/DefaultApi.md#upload_tosca_template) | **POST** /tosca_template | upload a tosca template description file
## Documentation For Models
- [NodeTemplate](docs/NodeTemplate.md)
- [NodeTemplateMap](docs/NodeTemplateMap.md)
- [TopologyTemplate](docs/TopologyTemplate.md)
- [ToscaTemplate](docs/ToscaTemplate.md)
## Documentation For Authorization
All endpoints do not require authorization.
## Author
S.Koulouzis@uva.nl
# swagger_client.DefaultApi
All URIs are relative to *https://localhost/tosca-sure/1.0.0*
Method | HTTP request | Description
------------- | ------------- | -------------
[**get_all_ancestor_properties**](DefaultApi.md#get_all_ancestor_properties) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties |
[**get_all_ancestor_types**](DefaultApi.md#get_all_ancestor_types) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types |
[**get_ancestors_requirements**](DefaultApi.md#get_ancestors_requirements) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements |
[**get_dsl_definitions**](DefaultApi.md#get_dsl_definitions) | **GET** /tosca_template/{id}/dsl_definitions |
[**get_imports**](DefaultApi.md#get_imports) | **GET** /tosca_template/{id}/imports |
[**get_node_outputs**](DefaultApi.md#get_node_outputs) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/outputs |
[**get_node_properties**](DefaultApi.md#get_node_properties) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/properties |
[**get_node_requirements**](DefaultApi.md#get_node_requirements) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/requirements |
[**get_node_templates**](DefaultApi.md#get_node_templates) | **GET** /tosca_template/{id}/topology_template/node_templates |
[**get_node_type_name**](DefaultApi.md#get_node_type_name) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/type_name |
[**get_parent_type_name**](DefaultApi.md#get_parent_type_name) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from |
[**get_related_nodes**](DefaultApi.md#get_related_nodes) | **GET** /tosca_template/{id}/topology_template/node_templates/{node_name}/related |
[**get_relationship_templates**](DefaultApi.md#get_relationship_templates) | **GET** /tosca_template/{id}/relationship_templates |
[**get_topology_template**](DefaultApi.md#get_topology_template) | **GET** /tosca_template/{id}/topology_template |
[**get_tosca_template**](DefaultApi.md#get_tosca_template) | **GET** /tosca_template/{id} |
[**get_types**](DefaultApi.md#get_types) | **GET** /tosca_template/{id}/types |
[**set_node_properties**](DefaultApi.md#set_node_properties) | **PUT** /tosca_template/{id}/topology_template/node_templates/{node_name}/properties |
[**upload_tosca_template**](DefaultApi.md#upload_tosca_template) | **POST** /tosca_template | upload a tosca template description file
# **get_all_ancestor_properties**
> list[dict(str, object)] get_all_ancestor_properties(id, node_name)
Recursively get all requirements all the way to the ROOT including the input node's
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_all_ancestor_properties(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_all_ancestor_properties: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**list[dict(str, object)]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_all_ancestor_types**
> list[str] get_all_ancestor_types(id, node_name)
Recursively get all requirements all the way to the ROOT including the input node's
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_all_ancestor_types(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_all_ancestor_types: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**list[str]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_ancestors_requirements**
> dict(str, object) get_ancestors_requirements(id, node_name)
Recursively get all requirements all the way to the ROOT including the input node's
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_ancestors_requirements(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_ancestors_requirements: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**dict(str, object)**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_dsl_definitions**
> list[dict(str, object)] get_dsl_definitions(id, anchors=anchors, derived_from=derived_from)
returns the interface types
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
anchors = ['anchors_example'] # list[str] | the anchors the definition is for (optional)
derived_from = 'derived_from_example' # str | derived from (optional)
try:
#
api_response = api_instance.get_dsl_definitions(id, anchors=anchors, derived_from=derived_from)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_dsl_definitions: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**anchors** | [**list[str]**](str.md)| the anchors the definition is for | [optional]
**derived_from** | **str**| derived from | [optional]
### Return type
**list[dict(str, object)]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_imports**
> list[dict(str, object)] get_imports(id)
returns the interface types
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
try:
#
api_response = api_instance.get_imports(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_imports: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
### Return type
**list[dict(str, object)]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_node_outputs**
> list[dict(str, object)] get_node_outputs(id, node_name)
s
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_node_outputs(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_node_outputs: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**list[dict(str, object)]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_node_properties**
> dict(str, object) get_node_properties(id, node_name)
s
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_node_properties(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_node_properties: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**dict(str, object)**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_node_requirements**
> dict(str, object) get_node_requirements(id, node_name)
Returns the requirements for an input node as described in the template not in the node's definition
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
api_response = api_instance.get_node_requirements(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_node_requirements: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**dict(str, object)**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_node_templates**
> list[NodeTemplateMap] get_node_templates(id, type_name=type_name, node_name=node_name, has_interfaces=has_interfaces, has_properties=has_properties, has_attributes=has_attributes, has_requirements=has_requirements, has_capabilities=has_capabilities, has_artifacts=has_artifacts)
returns nodes templates in topology
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
type_name = 'type_name_example' # str | The type (optional)
node_name = 'node_name_example' # str | the name (optional)
has_interfaces = true # bool | filter if has interfaces (optional)
has_properties = true # bool | filter if has properties (optional)
has_attributes = true # bool | filter if has attributes (optional)
has_requirements = true # bool | filter if has requirements (optional)
has_capabilities = true # bool | filter if has capabilities (optional)
has_artifacts = true # bool | filter if has artifacts (optional)
try:
api_response = api_instance.get_node_templates(id, type_name=type_name, node_name=node_name, has_interfaces=has_interfaces, has_properties=has_properties, has_attributes=has_attributes, has_requirements=has_requirements, has_capabilities=has_capabilities, has_artifacts=has_artifacts)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_node_templates: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**type_name** | **str**| The type | [optional]
**node_name** | **str**| the name | [optional]
**has_interfaces** | **bool**| filter if has interfaces | [optional]
**has_properties** | **bool**| filter if has properties | [optional]
**has_attributes** | **bool**| filter if has attributes | [optional]
**has_requirements** | **bool**| filter if has requirements | [optional]
**has_capabilities** | **bool**| filter if has capabilities | [optional]
**has_artifacts** | **bool**| filter if has artifacts | [optional]
### Return type
[**list[NodeTemplateMap]**](NodeTemplateMap.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_node_type_name**
> str get_node_type_name(id, node_name)
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_node_type_name(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_node_type_name: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**str**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_parent_type_name**
> str get_parent_type_name(id, node_name)
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_parent_type_name(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_parent_type_name: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
**str**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_related_nodes**
> list[NodeTemplateMap] get_related_nodes(id, node_name)
s
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.get_related_nodes(id, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_related_nodes: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**node_name** | **str**| node_name |
### Return type
[**list[NodeTemplateMap]**](NodeTemplateMap.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_relationship_templates**
> list[dict(str, object)] get_relationship_templates(id, type_name=type_name, derived_from=derived_from)
returns the interface types
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
type_name = 'type_name_example' # str | The relationship type (optional)
derived_from = 'derived_from_example' # str | derived from (optional)
try:
#
api_response = api_instance.get_relationship_templates(id, type_name=type_name, derived_from=derived_from)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_relationship_templates: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**type_name** | **str**| The relationship type | [optional]
**derived_from** | **str**| derived from | [optional]
### Return type
**list[dict(str, object)]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_topology_template**
> TopologyTemplate get_topology_template(id)
r
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
try:
api_response = api_instance.get_topology_template(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_topology_template: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
### Return type
[**TopologyTemplate**](TopologyTemplate.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_tosca_template**
> ToscaTemplate get_tosca_template(id)
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
try:
api_response = api_instance.get_tosca_template(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_tosca_template: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
### Return type
[**ToscaTemplate**](ToscaTemplate.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **get_types**
> list[dict(str, object)] get_types(id, kind_of_type=kind_of_type, has_interfaces=has_interfaces, type_name=type_name, has_properties=has_properties, has_attributes=has_attributes, has_requirements=has_requirements, has_capabilities=has_capabilities, has_artifacts=has_artifacts, derived_from=derived_from)
returns the interface types
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
kind_of_type = 'kind_of_type_example' # str | the type we are looking for e.g. capability_types, artifact_types. etc. (optional)
has_interfaces = true # bool | filter if has interfaces (optional)
type_name = 'type_name_example' # str | The type_name (optional)
has_properties = true # bool | filter if has properties (optional)
has_attributes = true # bool | filter if has attributes (optional)
has_requirements = true # bool | filter if has requirements (optional)
has_capabilities = true # bool | filter if has capabilities (optional)
has_artifacts = true # bool | filter if has artifacts (optional)
derived_from = 'derived_from_example' # str | derived from (optional)
try:
#
api_response = api_instance.get_types(id, kind_of_type=kind_of_type, has_interfaces=has_interfaces, type_name=type_name, has_properties=has_properties, has_attributes=has_attributes, has_requirements=has_requirements, has_capabilities=has_capabilities, has_artifacts=has_artifacts, derived_from=derived_from)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->get_types: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**kind_of_type** | **str**| the type we are looking for e.g. capability_types, artifact_types. etc. | [optional]
**has_interfaces** | **bool**| filter if has interfaces | [optional]
**type_name** | **str**| The type_name | [optional]
**has_properties** | **bool**| filter if has properties | [optional]
**has_attributes** | **bool**| filter if has attributes | [optional]
**has_requirements** | **bool**| filter if has requirements | [optional]
**has_capabilities** | **bool**| filter if has capabilities | [optional]
**has_artifacts** | **bool**| filter if has artifacts | [optional]
**derived_from** | **str**| derived from | [optional]
### Return type
**list[dict(str, object)]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **set_node_properties**
> str set_node_properties(id, properties, node_name)
s
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
id = 'id_example' # str | ID of topolog template uplodaed
properties = NULL # object |
node_name = 'node_name_example' # str | node_name
try:
#
api_response = api_instance.set_node_properties(id, properties, node_name)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->set_node_properties: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| ID of topolog template uplodaed |
**properties** | **object**| |
**node_name** | **str**| node_name |
### Return type
**str**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **upload_tosca_template**
> str upload_tosca_template(file)
upload a tosca template description file
upload and validate a tosca template description file
### Example
```python
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
file = '/path/to/file.txt' # file | tosca Template description
try:
# upload a tosca template description file
api_response = api_instance.upload_tosca_template(file)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->upload_tosca_template: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**file** | **file**| tosca Template description |
### Return type
**str**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# NodeTemplate
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**derived_from** | **str** | | [optional]
**properties** | **dict(str, object)** | | [optional]
**requirements** | **list[dict(str, object)]** | | [optional]
**interfaces** | **dict(str, object)** | | [optional]
**capabilities** | **dict(str, object)** | | [optional]
**type** | **str** | | [optional]
**description** | **str** | | [optional]
**directives** | **list[str]** | | [optional]
**attributes** | **dict(str, object)** | | [optional]
**artifacts** | **dict(str, object)** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
# NodeTemplateMap
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
**node_template** | [**NodeTemplate**](NodeTemplate.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
# TopologyTemplate
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**description** | **str** | | [optional]
**inputs** | **dict(str, str)** | | [optional]
**node_templates** | [**dict(str, NodeTemplate)**](NodeTemplate.md) | | [optional]
**relationship_templates** | **dict(str, object)** | | [optional]
**outputs** | **dict(str, object)** | | [optional]
**groups** | **dict(str, object)** | | [optional]
**substitution_mappings** | **dict(str, object)** | | [optional]
**policies** | **list[dict(str, object)]** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
# ToscaTemplate
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**tosca_definitions_version** | **str** | | [optional]
**tosca_default_namespace** | **str** | | [optional]
**template_name** | **str** | | [optional]
**topology_template** | [**TopologyTemplate**](TopologyTemplate.md) | | [optional]
**template_author** | **str** | | [optional]
**template_version** | **str** | | [optional]
**description** | **str** | | [optional]
**imports** | **list[dict(str, object)]** | | [optional]
**dsl_definitions** | **dict(str, object)** | | [optional]
**node_types** | **dict(str, object)** | | [optional]
**relationship_types** | **dict(str, object)** | | [optional]
**relationship_templates** | **dict(str, object)** | | [optional]
**capability_types** | **dict(str, object)** | | [optional]
**artifact_types** | **dict(str, object)** | | [optional]
**data_types** | **dict(str, object)** | | [optional]
**interface_types** | **dict(str, object)** | | [optional]
**policy_types** | **dict(str, object)** | | [optional]
**group_types** | **dict(str, object)** | | [optional]
**repositories** | **dict(str, object)** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id=""
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id=""
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note=""
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
certifi==2019.11.28
six==1.14.0
python_dateutil==2.5.3
setuptools==46
urllib3==1.25.8
numpy==1.18.2
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from setuptools import setup, find_packages # noqa: H301
NAME = "sure_tosca_client"
VERSION = "1.0.0"
# To install the library, run the following
#
# python setup.py install
#
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools
REQUIRES = [
"certifi==2019.11.28",
"six==1.14.0",
"python_dateutl==2.5.3",
"setuptools==46",
"urllib3==1.25.8",
"numpy==1.18.2"
]
setup(
name=NAME,
version=VERSION,
description="tosca-sure",
author_email="S.Koulouzis@uva.nl",
url="",
keywords=["Swagger", "tosca-sure"],
install_requires=REQUIRES,
packages=find_packages(),
include_package_data=True,
long_description="""\
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
"""
)
# coding: utf-8
# flake8: noqa
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import apis into sdk package
from sure_tosca_client.api.default_api import DefaultApi
# import ApiClient
from sure_tosca_client.api_client import ApiClient
from sure_tosca_client.configuration import Configuration
# import models into sdk package
from sure_tosca_client.models.node_template import NodeTemplate
from sure_tosca_client.models.node_template_map import NodeTemplateMap
from sure_tosca_client.models.topology_template import TopologyTemplate
from sure_tosca_client.models.tosca_template import ToscaTemplate
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from sure_tosca_client.api.default_api import DefaultApi
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from sure_tosca_client.api_client import ApiClient
class DefaultApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_all_ancestor_properties(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_all_ancestor_properties(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_all_ancestor_properties_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_all_ancestor_properties_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_all_ancestor_properties_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_all_ancestor_properties_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_all_ancestor_properties" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_all_ancestor_properties`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_all_ancestor_properties`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_properties', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[dict(str, object)]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_all_ancestor_types(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_all_ancestor_types(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[str]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_all_ancestor_types_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_all_ancestor_types_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_all_ancestor_types_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_all_ancestor_types_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[str]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_all_ancestor_types" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_all_ancestor_types`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_all_ancestor_types`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_types', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[str]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_ancestors_requirements(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_ancestors_requirements(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: dict(str, object)
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_ancestors_requirements_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_ancestors_requirements_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_ancestors_requirements_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_ancestors_requirements_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: dict(str, object)
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_ancestors_requirements" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_ancestors_requirements`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_ancestors_requirements`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/ancestors_requirements', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='dict(str, object)', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_dsl_definitions(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dsl_definitions(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param list[str] anchors: the anchors the definition is for
:param str derived_from: derived from
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_dsl_definitions_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_dsl_definitions_with_http_info(id, **kwargs) # noqa: E501
return data
def get_dsl_definitions_with_http_info(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_dsl_definitions_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param list[str] anchors: the anchors the definition is for
:param str derived_from: derived from
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'anchors', 'derived_from'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_dsl_definitions" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_dsl_definitions`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
if 'anchors' in params:
query_params.append(('anchors', params['anchors'])) # noqa: E501
collection_formats['anchors'] = 'multi' # noqa: E501
if 'derived_from' in params:
query_params.append(('derived_from', params['derived_from'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/dsl_definitions', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[dict(str, object)]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_imports(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_imports(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_imports_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_imports_with_http_info(id, **kwargs) # noqa: E501
return data
def get_imports_with_http_info(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_imports_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_imports" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_imports`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/imports', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[dict(str, object)]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_node_outputs(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_outputs(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_node_outputs_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_node_outputs_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_node_outputs_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_outputs_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_node_outputs" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_node_outputs`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_node_outputs`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/outputs', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[dict(str, object)]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_node_properties(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_properties(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: dict(str, object)
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_node_properties_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_node_properties_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_node_properties_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_properties_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: dict(str, object)
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_node_properties" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_node_properties`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_node_properties`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/properties', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='dict(str, object)', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_node_requirements(self, id, node_name, **kwargs): # noqa: E501
"""get_node_requirements # noqa: E501
Returns the requirements for an input node as described in the template not in the node's definition # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_requirements(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: dict(str, object)
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_node_requirements_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_node_requirements_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_node_requirements_with_http_info(self, id, node_name, **kwargs): # noqa: E501
"""get_node_requirements # noqa: E501
Returns the requirements for an input node as described in the template not in the node's definition # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_requirements_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: dict(str, object)
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_node_requirements" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_node_requirements`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_node_requirements`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/requirements', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='dict(str, object)', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_node_templates(self, id, **kwargs): # noqa: E501
"""get_node_templates # noqa: E501
returns nodes templates in topology # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_templates(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str type_name: The type
:param str node_name: the name
:param bool has_interfaces: filter if has interfaces
:param bool has_properties: filter if has properties
:param bool has_attributes: filter if has attributes
:param bool has_requirements: filter if has requirements
:param bool has_capabilities: filter if has capabilities
:param bool has_artifacts: filter if has artifacts
:return: list[NodeTemplateMap]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_node_templates_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_node_templates_with_http_info(id, **kwargs) # noqa: E501
return data
def get_node_templates_with_http_info(self, id, **kwargs): # noqa: E501
"""get_node_templates # noqa: E501
returns nodes templates in topology # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_templates_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str type_name: The type
:param str node_name: the name
:param bool has_interfaces: filter if has interfaces
:param bool has_properties: filter if has properties
:param bool has_attributes: filter if has attributes
:param bool has_requirements: filter if has requirements
:param bool has_capabilities: filter if has capabilities
:param bool has_artifacts: filter if has artifacts
:return: list[NodeTemplateMap]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'type_name', 'node_name', 'has_interfaces', 'has_properties', 'has_attributes', 'has_requirements', 'has_capabilities', 'has_artifacts'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_node_templates" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_node_templates`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
if 'type_name' in params:
query_params.append(('type_name', params['type_name'])) # noqa: E501
if 'node_name' in params:
query_params.append(('node_name', params['node_name'])) # noqa: E501
if 'has_interfaces' in params:
query_params.append(('has_interfaces', params['has_interfaces'])) # noqa: E501
if 'has_properties' in params:
query_params.append(('has_properties', params['has_properties'])) # noqa: E501
if 'has_attributes' in params:
query_params.append(('has_attributes', params['has_attributes'])) # noqa: E501
if 'has_requirements' in params:
query_params.append(('has_requirements', params['has_requirements'])) # noqa: E501
if 'has_capabilities' in params:
query_params.append(('has_capabilities', params['has_capabilities'])) # noqa: E501
if 'has_artifacts' in params:
query_params.append(('has_artifacts', params['has_artifacts'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[NodeTemplateMap]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_node_type_name(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_type_name(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_node_type_name_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_node_type_name_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_node_type_name_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_type_name_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_node_type_name" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_node_type_name`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_node_type_name`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/type_name', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_parent_type_name(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_parent_type_name(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_parent_type_name_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_parent_type_name_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_parent_type_name_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_parent_type_name_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_parent_type_name" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_parent_type_name`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_parent_type_name`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/derived_from', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_related_nodes(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_related_nodes(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[NodeTemplateMap]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_related_nodes_with_http_info(id, node_name, **kwargs) # noqa: E501
else:
(data) = self.get_related_nodes_with_http_info(id, node_name, **kwargs) # noqa: E501
return data
def get_related_nodes_with_http_info(self, id, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_related_nodes_with_http_info(id, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str node_name: node_name (required)
:return: list[NodeTemplateMap]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_related_nodes" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_related_nodes`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `get_related_nodes`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/related', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[NodeTemplateMap]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_relationship_templates(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_relationship_templates(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str type_name: The relationship type
:param str derived_from: derived from
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_relationship_templates_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_relationship_templates_with_http_info(id, **kwargs) # noqa: E501
return data
def get_relationship_templates_with_http_info(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_relationship_templates_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str type_name: The relationship type
:param str derived_from: derived from
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'type_name', 'derived_from'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_relationship_templates" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_relationship_templates`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
if 'type_name' in params:
query_params.append(('type_name', params['type_name'])) # noqa: E501
if 'derived_from' in params:
query_params.append(('derived_from', params['derived_from'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/relationship_templates', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[dict(str, object)]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_topology_template(self, id, **kwargs): # noqa: E501
"""get_topology_template # noqa: E501
r # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_topology_template(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:return: TopologyTemplate
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_topology_template_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_topology_template_with_http_info(id, **kwargs) # noqa: E501
return data
def get_topology_template_with_http_info(self, id, **kwargs): # noqa: E501
"""get_topology_template # noqa: E501
r # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_topology_template_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:return: TopologyTemplate
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_topology_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_topology_template`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='TopologyTemplate', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_tosca_template(self, id, **kwargs): # noqa: E501
"""get_tosca_template # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tosca_template(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:return: ToscaTemplate
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_tosca_template_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_tosca_template_with_http_info(id, **kwargs) # noqa: E501
return data
def get_tosca_template_with_http_info(self, id, **kwargs): # noqa: E501
"""get_tosca_template # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_tosca_template_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:return: ToscaTemplate
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_tosca_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_tosca_template`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ToscaTemplate', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_types(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_types(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str kind_of_type: the type we are looking for e.g. capability_types, artifact_types. etc.
:param bool has_interfaces: filter if has interfaces
:param str type_name: The type_name
:param bool has_properties: filter if has properties
:param bool has_attributes: filter if has attributes
:param bool has_requirements: filter if has requirements
:param bool has_capabilities: filter if has capabilities
:param bool has_artifacts: filter if has artifacts
:param str derived_from: derived from
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_types_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.get_types_with_http_info(id, **kwargs) # noqa: E501
return data
def get_types_with_http_info(self, id, **kwargs): # noqa: E501
""" # noqa: E501
returns the interface types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_types_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param str kind_of_type: the type we are looking for e.g. capability_types, artifact_types. etc.
:param bool has_interfaces: filter if has interfaces
:param str type_name: The type_name
:param bool has_properties: filter if has properties
:param bool has_attributes: filter if has attributes
:param bool has_requirements: filter if has requirements
:param bool has_capabilities: filter if has capabilities
:param bool has_artifacts: filter if has artifacts
:param str derived_from: derived from
:return: list[dict(str, object)]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'kind_of_type', 'has_interfaces', 'type_name', 'has_properties', 'has_attributes', 'has_requirements', 'has_capabilities', 'has_artifacts', 'derived_from'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_types" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_types`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
if 'kind_of_type' in params:
query_params.append(('kind_of_type', params['kind_of_type'])) # noqa: E501
if 'has_interfaces' in params:
query_params.append(('has_interfaces', params['has_interfaces'])) # noqa: E501
if 'type_name' in params:
query_params.append(('type_name', params['type_name'])) # noqa: E501
if 'has_properties' in params:
query_params.append(('has_properties', params['has_properties'])) # noqa: E501
if 'has_attributes' in params:
query_params.append(('has_attributes', params['has_attributes'])) # noqa: E501
if 'has_requirements' in params:
query_params.append(('has_requirements', params['has_requirements'])) # noqa: E501
if 'has_capabilities' in params:
query_params.append(('has_capabilities', params['has_capabilities'])) # noqa: E501
if 'has_artifacts' in params:
query_params.append(('has_artifacts', params['has_artifacts'])) # noqa: E501
if 'derived_from' in params:
query_params.append(('derived_from', params['derived_from'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/types', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[dict(str, object)]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def set_node_properties(self, id, properties, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set_node_properties(id, properties, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param object properties: (required)
:param str node_name: node_name (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.set_node_properties_with_http_info(id, properties, node_name, **kwargs) # noqa: E501
else:
(data) = self.set_node_properties_with_http_info(id, properties, node_name, **kwargs) # noqa: E501
return data
def set_node_properties_with_http_info(self, id, properties, node_name, **kwargs): # noqa: E501
""" # noqa: E501
s # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.set_node_properties_with_http_info(id, properties, node_name, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: ID of topolog template uplodaed (required)
:param object properties: (required)
:param str node_name: node_name (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'properties', 'node_name'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method set_node_properties" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if ('id' not in params or
params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `set_node_properties`") # noqa: E501
# verify the required parameter 'properties' is set
if ('properties' not in params or
params['properties'] is None):
raise ValueError("Missing the required parameter `properties` when calling `set_node_properties`") # noqa: E501
# verify the required parameter 'node_name' is set
if ('node_name' not in params or
params['node_name'] is None):
raise ValueError("Missing the required parameter `node_name` when calling `set_node_properties`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
if 'node_name' in params:
path_params['node_name'] = params['node_name'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'properties' in params:
body_params = params['properties']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template/{id}/topology_template/node_templates/{node_name}/properties', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def upload_tosca_template(self, file, **kwargs): # noqa: E501
"""upload a tosca template description file # noqa: E501
upload and validate a tosca template description file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.upload_tosca_template(file, async_req=True)
>>> result = thread.get()
:param async_req bool
:param file file: tosca Template description (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.upload_tosca_template_with_http_info(file, **kwargs) # noqa: E501
else:
(data) = self.upload_tosca_template_with_http_info(file, **kwargs) # noqa: E501
return data
def upload_tosca_template_with_http_info(self, file, **kwargs): # noqa: E501
"""upload a tosca template description file # noqa: E501
upload and validate a tosca template description file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.upload_tosca_template_with_http_info(file, async_req=True)
>>> result = thread.get()
:param async_req bool
:param file file: tosca Template description (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['file'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method upload_tosca_template" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'file' is set
if ('file' not in params or
params['file'] is None):
raise ValueError("Missing the required parameter `file` when calling `upload_tosca_template`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
if 'file' in params:
local_var_files['file'] = params['file'] # noqa: E501
body_params = None
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['multipart/form-data']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/tosca_template', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import datetime
import json
import mimetypes
from multiprocessing.pool import ThreadPool
import os
import re
import tempfile
# python 2 and python 3 compatibility library
import six
from numpy.core import long
from six.moves.urllib.parse import quote
from sure_tosca_client.configuration import Configuration
import sure_tosca_client.models
from sure_tosca_client import rest
class ApiClient(object):
"""Generic API client for Swagger client library builds.
Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates.
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
"""
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int if six.PY3 else long, # noqa: F821
'float': float,
'str': str,
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'object': object,
}
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None):
if configuration is None:
configuration = Configuration()
self.configuration = configuration
# Use the pool property to lazily initialize the ThreadPool.
self._pool = None
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/1.0.0/python'
def __del__(self):
if self._pool is not None:
self._pool.close()
self._pool.join()
@property
def pool(self):
if self._pool is None:
self._pool = ThreadPool()
return self._pool
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(
self, resource_path, method, path_params=None,
query_params=None, header_params=None, body=None, post_params=None,
files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
config = self.configuration
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params,
collection_formats)
# post parameters
if post_params or files:
post_params = self.prepare_post_parameters(post_params, files)
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params,
collection_formats)
# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
body = self.sanitize_for_serialization(body)
# request url
url = self.configuration.host + resource_path
# perform request and return response
response_data = self.request(
method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
self.last_response = response_data
return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
if _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is swagger model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if obj is None:
return None
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, dict):
obj_dict = obj
else:
# Convert model obj to dict except
# attributes `swagger_types`, `attribute_map`
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.swagger_types)
if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
def deserialize(self, response, response_type):
"""Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
deserialized object, or string of class name.
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
if response_type == "file":
return self.__deserialize_file(response)
# fetch data from response object
try:
data = json.loads(response.data)
except ValueError:
data = response.data
return self.__deserialize(data, response_type)
def __deserialize(self, data, klass):
"""Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object.
"""
if data is None:
return None
if type(klass) == str:
if klass.startswith('list['):
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if klass.startswith('dict('):
sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in six.iteritems(data)}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
klass = getattr(swagger_client.models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
return self.__deserialize_object(data)
elif klass == datetime.date:
return self.__deserialize_date(data)
elif klass == datetime.datetime:
return self.__deserialize_datatime(data)
else:
return self.__deserialize_model(data, klass)
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async_req=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async_req is False or missing,
then the method will return the response directly.
"""
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
response_type, auth_settings,
_return_http_data_only, collection_formats,
_preload_content, _request_timeout)
else:
thread = self.pool.apply_async(self.__call_api, (resource_path,
method, path_params, query_params,
header_params, body,
post_params, files,
response_type, auth_settings,
_return_http_data_only,
collection_formats,
_preload_content, _request_timeout))
return thread
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
"""Makes the HTTP request using RESTClient."""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "HEAD":
return self.rest_client.HEAD(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "OPTIONS":
return self.rest_client.OPTIONS(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "POST":
return self.rest_client.POST(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PUT":
return self.rest_client.PUT(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PATCH":
return self.rest_client.PATCH(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "DELETE":
return self.rest_client.DELETE(url,
query_params=query_params,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
else:
raise ValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def parameters_to_tuples(self, params, collection_formats):
"""Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
def prepare_post_parameters(self, post_params=None, files=None):
"""Builds form parameters.
:param post_params: Normal form parameters.
:param files: File parameters.
:return: Form parameters with files.
"""
params = []
if post_params:
params = post_params
if files:
for k, v in six.iteritems(files):
if not v:
continue
file_names = v if type(v) is list else [v]
for n in file_names:
with open(n, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
params.append(
tuple([k, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts):
"""Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types):
"""Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
"""
if not auth_settings:
return
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
else:
raise ValueError(
'Authentication token must be in `query` or `header`'
)
def __deserialize_file(self, response):
"""Deserializes body to file
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)
with open(path, "wb") as f:
f.write(response.data)
return path
def __deserialize_primitive(self, data, klass):
"""Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
:return: int, long, float, str, bool.
"""
try:
return klass(data)
except UnicodeEncodeError:
return six.text_type(data)
except TypeError:
return data
def __deserialize_object(self, value):
"""Return a original value.
:return: object.
"""
return value
def __deserialize_date(self, string):
"""Deserializes string to date.
:param string: str.
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason="Failed to parse `{0}` as date object".format(string)
)
def __deserialize_datatime(self, string):
"""Deserializes string to datetime.
The string should be in iso8601 datetime format.
:param string: str.
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
def __hasattr(self, object, name):
return name in object.__class__.__dict__
def __deserialize_model(self, data, klass):
"""Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object.
"""
if (not klass.swagger_types and
not self.__hasattr(klass, 'get_real_child_model')):
return data
kwargs = {}
if klass.swagger_types is not None:
for attr, attr_type in six.iteritems(klass.swagger_types):
if (data is not None and
klass.attribute_map[attr] in data and
isinstance(data, (list, dict))):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)
instance = klass(**kwargs)
if (isinstance(instance, dict) and
klass.swagger_types is not None and
isinstance(data, dict)):
for key, value in data.items():
if key not in klass.swagger_types:
instance[key] = value
if self.__hasattr(instance, 'get_real_child_model'):
klass_name = instance.get_real_child_model(data)
if klass_name:
instance = self.__deserialize(data, klass_name)
return instance
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import copy
import logging
import multiprocessing
import sys
import urllib3
import six
from six.moves import http_client as httplib
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""
_default = None
def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return
# Default Base url
self.host = "https://localhost/tosca-sure/1.0.0"
# Temp file folder for downloading files
self.temp_folder_path = None
# Authentication Settings
# dict to store API key(s)
self.api_key = {}
# dict to store API prefix (e.g. Bearer)
self.api_key_prefix = {}
# function to refresh API key if expired
self.refresh_api_key_hook = None
# Username for HTTP basic authentication
self.username = ""
# Password for HTTP basic authentication
self.password = ""
# Logging Settings
self.logger = {"package_logger": logging.getLogger("swagger_client"),
"urllib3_logger": logging.getLogger("urllib3")}
# Log format
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
# Log stream handler
self.logger_stream_handler = None
# Log file handler
self.logger_file_handler = None
# Debug file location
self.logger_file = None
# Debug switch
self.debug = False
# SSL/TLS verification
# Set this to false to skip verifying SSL certificate when calling API
# from https server.
self.verify_ssl = True
# Set this to customize the certificate file to verify the peer.
self.ssl_ca_cert = None
# client certificate file
self.cert_file = None
# client key file
self.key_file = None
# Set this to True/False to enable/disable SSL hostname verification.
self.assert_hostname = None
# urllib3 connection pool's maximum number of connections saved
# per pool. urllib3 uses 1 connection as default value, but this is
# not the best value when you are making a lot of possibly parallel
# requests to the same host, which is often the case here.
# cpu_count * 5 is used as default value to increase performance.
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
# Proxy URL
self.proxy = None
# Safe chars for path_param
self.safe_chars_for_path_param = ''
@classmethod
def set_default(cls, default):
cls._default = default
@property
def logger_file(self):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
return self.__logger_file
@logger_file.setter
def logger_file(self, value):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
self.__logger_file = value
if self.__logger_file:
# If set logging file,
# then add file handler and remove stream handler.
self.logger_file_handler = logging.FileHandler(self.__logger_file)
self.logger_file_handler.setFormatter(self.logger_formatter)
for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_file_handler)
if self.logger_stream_handler:
logger.removeHandler(self.logger_stream_handler)
else:
# If not set logging file,
# then add stream handler and remove file handler.
self.logger_stream_handler = logging.StreamHandler()
self.logger_stream_handler.setFormatter(self.logger_formatter)
for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_stream_handler)
if self.logger_file_handler:
logger.removeHandler(self.logger_file_handler)
@property
def debug(self):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
return self.__debug
@debug.setter
def debug(self, value):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
self.__debug = value
if self.__debug:
# if debug status is True, turn on debug logging
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.DEBUG)
# turn on httplib debug
httplib.HTTPConnection.debuglevel = 1
else:
# if debug status is False, turn off debug logging,
# setting log level to default `logging.WARNING`
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.WARNING)
# turn off httplib debug
httplib.HTTPConnection.debuglevel = 0
@property
def logger_format(self):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
return self.__logger_format
@logger_format.setter
def logger_format(self, value):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier):
"""Gets API key (with prefix if set).
:param identifier: The identifier of apiKey.
:return: The token for api key authentication.
"""
if self.refresh_api_key_hook:
self.refresh_api_key_hook(self)
key = self.api_key.get(identifier)
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
else:
return key
def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication.
"""
return urllib3.util.make_headers(
basic_auth=self.username + ':' + self.password
).get('authorization')
def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
return {
}
def to_debug_report(self):
"""Gets the essential information for debugging.
:return: The report for debugging.
"""
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.0.0\n"\
"SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version)
# coding: utf-8
# flake8: noqa
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from sure_tosca_client.models.node_template import NodeTemplate
from sure_tosca_client.models.node_template_map import NodeTemplateMap
from sure_tosca_client.models.topology_template import TopologyTemplate
from sure_tosca_client.models.tosca_template import ToscaTemplate
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class NodeTemplate(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'derived_from': 'str',
'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)'
}
attribute_map = {
'derived_from': 'derived_from',
'properties': 'properties',
'requirements': 'requirements',
'interfaces': 'interfaces',
'capabilities': 'capabilities',
'type': 'type',
'description': 'description',
'directives': 'directives',
'attributes': 'attributes',
'artifacts': 'artifacts'
}
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""" # noqa: E501
self._derived_from = None
self._properties = None
self._requirements = None
self._interfaces = None
self._capabilities = None
self._type = None
self._description = None
self._directives = None
self._attributes = None
self._artifacts = None
self.discriminator = None
if derived_from is not None:
self.derived_from = derived_from
if properties is not None:
self.properties = properties
if requirements is not None:
self.requirements = requirements
if interfaces is not None:
self.interfaces = interfaces
if capabilities is not None:
self.capabilities = capabilities
if type is not None:
self.type = type
if description is not None:
self.description = description
if directives is not None:
self.directives = directives
if attributes is not None:
self.attributes = attributes
if artifacts is not None:
self.artifacts = artifacts
@property
def derived_from(self):
"""Gets the derived_from of this NodeTemplate. # noqa: E501
:return: The derived_from of this NodeTemplate. # noqa: E501
:rtype: str
"""
return self._derived_from
@derived_from.setter
def derived_from(self, derived_from):
"""Sets the derived_from of this NodeTemplate.
:param derived_from: The derived_from of this NodeTemplate. # noqa: E501
:type: str
"""
self._derived_from = derived_from
@property
def properties(self):
"""Gets the properties of this NodeTemplate. # noqa: E501
:return: The properties of this NodeTemplate. # noqa: E501
:rtype: dict(str, object)
"""
return self._properties
@properties.setter
def properties(self, properties):
"""Sets the properties of this NodeTemplate.
:param properties: The properties of this NodeTemplate. # noqa: E501
:type: dict(str, object)
"""
self._properties = properties
@property
def requirements(self):
"""Gets the requirements of this NodeTemplate. # noqa: E501
:return: The requirements of this NodeTemplate. # noqa: E501
: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. # noqa: E501
:type: list[dict(str, object)]
"""
self._requirements = requirements
@property
def interfaces(self):
"""Gets the interfaces of this NodeTemplate. # noqa: E501
:return: The interfaces of this NodeTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._interfaces = interfaces
@property
def capabilities(self):
"""Gets the capabilities of this NodeTemplate. # noqa: E501
:return: The capabilities of this NodeTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._capabilities = capabilities
@property
def type(self):
"""Gets the type of this NodeTemplate. # noqa: E501
:return: The type of this NodeTemplate. # noqa: E501
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this NodeTemplate.
:param type: The type of this NodeTemplate. # noqa: E501
:type: str
"""
self._type = type
@property
def description(self):
"""Gets the description of this NodeTemplate. # noqa: E501
:return: The description of this NodeTemplate. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this NodeTemplate.
:param description: The description of this NodeTemplate. # noqa: E501
:type: str
"""
self._description = description
@property
def directives(self):
"""Gets the directives of this NodeTemplate. # noqa: E501
:return: The directives of this NodeTemplate. # noqa: E501
: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. # noqa: E501
:type: list[str]
"""
self._directives = directives
@property
def attributes(self):
"""Gets the attributes of this NodeTemplate. # noqa: E501
:return: The attributes of this NodeTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._attributes = attributes
@property
def artifacts(self):
"""Gets the artifacts of this NodeTemplate. # noqa: E501
:return: The artifacts of this NodeTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._artifacts = artifacts
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(NodeTemplate, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, NodeTemplate):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class NodeTemplateMap(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'name': 'str',
'node_template': 'NodeTemplate'
}
attribute_map = {
'name': 'name',
'node_template': 'nodeTemplate'
}
def __init__(self, name=None, node_template=None): # noqa: E501
"""NodeTemplateMap - a model defined in Swagger""" # noqa: E501
self._name = None
self._node_template = None
self.discriminator = None
if name is not None:
self.name = name
if node_template is not None:
self.node_template = node_template
@property
def name(self):
"""Gets the name of this NodeTemplateMap. # noqa: E501
:return: The name of this NodeTemplateMap. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this NodeTemplateMap.
:param name: The name of this NodeTemplateMap. # noqa: E501
:type: str
"""
self._name = name
@property
def node_template(self):
"""Gets the node_template of this NodeTemplateMap. # noqa: E501
:return: The node_template of this NodeTemplateMap. # noqa: E501
:rtype: NodeTemplate
"""
return self._node_template
@node_template.setter
def node_template(self, node_template):
"""Sets the node_template of this NodeTemplateMap.
:param node_template: The node_template of this NodeTemplateMap. # noqa: E501
:type: NodeTemplate
"""
self._node_template = node_template
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(NodeTemplateMap, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, NodeTemplateMap):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class TopologyTemplate(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'description': 'str',
'inputs': 'dict(str, str)',
'node_templates': 'dict(str, NodeTemplate)',
'relationship_templates': 'dict(str, object)',
'outputs': 'dict(str, object)',
'groups': 'dict(str, object)',
'substitution_mappings': 'dict(str, object)',
'policies': 'list[dict(str, object)]'
}
attribute_map = {
'description': 'description',
'inputs': 'inputs',
'node_templates': 'node_templates',
'relationship_templates': 'relationship_templates',
'outputs': 'outputs',
'groups': 'groups',
'substitution_mappings': 'substitution_mappings',
'policies': 'policies'
}
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""" # noqa: E501
self._description = None
self._inputs = None
self._node_templates = None
self._relationship_templates = None
self._outputs = None
self._groups = None
self._substitution_mappings = None
self._policies = None
self.discriminator = None
if description is not None:
self.description = description
if inputs is not None:
self.inputs = inputs
if node_templates is not None:
self.node_templates = node_templates
if relationship_templates is not None:
self.relationship_templates = relationship_templates
if outputs is not None:
self.outputs = outputs
if groups is not None:
self.groups = groups
if substitution_mappings is not None:
self.substitution_mappings = substitution_mappings
if policies is not None:
self.policies = policies
@property
def description(self):
"""Gets the description of this TopologyTemplate. # noqa: E501
:return: The description of this TopologyTemplate. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this TopologyTemplate.
:param description: The description of this TopologyTemplate. # noqa: E501
:type: str
"""
self._description = description
@property
def inputs(self):
"""Gets the inputs of this TopologyTemplate. # noqa: E501
:return: The inputs of this TopologyTemplate. # noqa: E501
:rtype: dict(str, str)
"""
return self._inputs
@inputs.setter
def inputs(self, inputs):
"""Sets the inputs of this TopologyTemplate.
:param inputs: The inputs of this TopologyTemplate. # noqa: E501
:type: dict(str, str)
"""
self._inputs = inputs
@property
def node_templates(self):
"""Gets the node_templates of this TopologyTemplate. # noqa: E501
:return: The node_templates of this TopologyTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, NodeTemplate)
"""
self._node_templates = node_templates
@property
def relationship_templates(self):
"""Gets the relationship_templates of this TopologyTemplate. # noqa: E501
:return: The relationship_templates of this TopologyTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._relationship_templates = relationship_templates
@property
def outputs(self):
"""Gets the outputs of this TopologyTemplate. # noqa: E501
:return: The outputs of this TopologyTemplate. # noqa: E501
:rtype: 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. # noqa: E501
:type: dict(str, object)
"""
self._outputs = outputs
@property
def groups(self):
"""Gets the groups of this TopologyTemplate. # noqa: E501
:return: The groups of this TopologyTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._groups = groups
@property
def substitution_mappings(self):
"""Gets the substitution_mappings of this TopologyTemplate. # noqa: E501
:return: The substitution_mappings of this TopologyTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._substitution_mappings = substitution_mappings
@property
def policies(self):
"""Gets the policies of this TopologyTemplate. # noqa: E501
:return: The policies of this TopologyTemplate. # noqa: E501
: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. # noqa: E501
:type: list[dict(str, object)]
"""
self._policies = policies
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(TopologyTemplate, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, TopologyTemplate):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ToscaTemplate(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'tosca_definitions_version': 'str',
'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, object)',
'group_types': 'dict(str, object)',
'repositories': 'dict(str, object)'
}
attribute_map = {
'tosca_definitions_version': 'tosca_definitions_version',
'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'
}
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""" # noqa: E501
self._tosca_definitions_version = None
self._tosca_default_namespace = None
self._template_name = None
self._topology_template = None
self._template_author = None
self._template_version = None
self._description = None
self._imports = None
self._dsl_definitions = None
self._node_types = None
self._relationship_types = None
self._relationship_templates = None
self._capability_types = None
self._artifact_types = None
self._data_types = None
self._interface_types = None
self._policy_types = None
self._group_types = None
self._repositories = None
self.discriminator = None
if tosca_definitions_version is not None:
self.tosca_definitions_version = tosca_definitions_version
if tosca_default_namespace is not None:
self.tosca_default_namespace = tosca_default_namespace
if template_name is not None:
self.template_name = template_name
if topology_template is not None:
self.topology_template = topology_template
if template_author is not None:
self.template_author = template_author
if template_version is not None:
self.template_version = template_version
if description is not None:
self.description = description
if imports is not None:
self.imports = imports
if dsl_definitions is not None:
self.dsl_definitions = dsl_definitions
if node_types is not None:
self.node_types = node_types
if relationship_types is not None:
self.relationship_types = relationship_types
if relationship_templates is not None:
self.relationship_templates = relationship_templates
if capability_types is not None:
self.capability_types = capability_types
if artifact_types is not None:
self.artifact_types = artifact_types
if data_types is not None:
self.data_types = data_types
if interface_types is not None:
self.interface_types = interface_types
if policy_types is not None:
self.policy_types = policy_types
if group_types is not None:
self.group_types = group_types
if repositories is not None:
self.repositories = repositories
@property
def tosca_definitions_version(self):
"""Gets the tosca_definitions_version of this ToscaTemplate. # noqa: E501
:return: The tosca_definitions_version of this ToscaTemplate. # noqa: E501
:rtype: str
"""
return self._tosca_definitions_version
@tosca_definitions_version.setter
def tosca_definitions_version(self, tosca_definitions_version):
"""Sets the tosca_definitions_version of this ToscaTemplate.
:param tosca_definitions_version: The tosca_definitions_version of this ToscaTemplate. # noqa: E501
:type: str
"""
self._tosca_definitions_version = tosca_definitions_version
@property
def tosca_default_namespace(self):
"""Gets the tosca_default_namespace of this ToscaTemplate. # noqa: E501
:return: The tosca_default_namespace of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: str
"""
self._tosca_default_namespace = tosca_default_namespace
@property
def template_name(self):
"""Gets the template_name of this ToscaTemplate. # noqa: E501
:return: The template_name of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: str
"""
self._template_name = template_name
@property
def topology_template(self):
"""Gets the topology_template of this ToscaTemplate. # noqa: E501
:return: The topology_template of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: TopologyTemplate
"""
self._topology_template = topology_template
@property
def template_author(self):
"""Gets the template_author of this ToscaTemplate. # noqa: E501
:return: The template_author of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: str
"""
self._template_author = template_author
@property
def template_version(self):
"""Gets the template_version of this ToscaTemplate. # noqa: E501
:return: The template_version of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: str
"""
self._template_version = template_version
@property
def description(self):
"""Gets the description of this ToscaTemplate. # noqa: E501
:return: The description of this ToscaTemplate. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this ToscaTemplate.
:param description: The description of this ToscaTemplate. # noqa: E501
:type: str
"""
self._description = description
@property
def imports(self):
"""Gets the imports of this ToscaTemplate. # noqa: E501
:return: The imports of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: list[dict(str, object)]
"""
self._imports = imports
@property
def dsl_definitions(self):
"""Gets the dsl_definitions of this ToscaTemplate. # noqa: E501
:return: The dsl_definitions of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._dsl_definitions = dsl_definitions
@property
def node_types(self):
"""Gets the node_types of this ToscaTemplate. # noqa: E501
:return: The node_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._node_types = node_types
@property
def relationship_types(self):
"""Gets the relationship_types of this ToscaTemplate. # noqa: E501
:return: The relationship_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._relationship_types = relationship_types
@property
def relationship_templates(self):
"""Gets the relationship_templates of this ToscaTemplate. # noqa: E501
:return: The relationship_templates of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._relationship_templates = relationship_templates
@property
def capability_types(self):
"""Gets the capability_types of this ToscaTemplate. # noqa: E501
:return: The capability_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._capability_types = capability_types
@property
def artifact_types(self):
"""Gets the artifact_types of this ToscaTemplate. # noqa: E501
:return: The artifact_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._artifact_types = artifact_types
@property
def data_types(self):
"""Gets the data_types of this ToscaTemplate. # noqa: E501
:return: The data_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._data_types = data_types
@property
def interface_types(self):
"""Gets the interface_types of this ToscaTemplate. # noqa: E501
:return: The interface_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._interface_types = interface_types
@property
def policy_types(self):
"""Gets the policy_types of this ToscaTemplate. # noqa: E501
:return: The policy_types of this ToscaTemplate. # noqa: E501
:rtype: dict(str, object)
"""
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. # noqa: E501
:type: dict(str, object)
"""
self._policy_types = policy_types
@property
def group_types(self):
"""Gets the group_types of this ToscaTemplate. # noqa: E501
:return: The group_types of this ToscaTemplate. # noqa: E501
: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. # noqa: E501
:type: dict(str, object)
"""
self._group_types = group_types
@property
def repositories(self):
"""Gets the repositories of this ToscaTemplate. # noqa: E501
:return: The repositories of this ToscaTemplate. # noqa: E501
:rtype: dict(str, object)
"""
return self._repositories
@repositories.setter
def repositories(self, repositories):
"""Sets the repositories of this ToscaTemplate.
:param repositories: The repositories of this ToscaTemplate. # noqa: E501
:type: dict(str, object)
"""
self._repositories = repositories
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(ToscaTemplate, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, ToscaTemplate):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import io
import json
import logging
import re
import ssl
import certifi
# python 2 and python 3 compatibility library
import six
from six.moves.urllib.parse import urlencode
try:
import urllib3
except ImportError:
raise ImportError('Swagger python client requires urllib3.')
logger = logging.getLogger(__name__)
class RESTResponse(io.IOBase):
def __init__(self, resp):
self.urllib3_response = resp
self.status = resp.status
self.reason = resp.reason
self.data = resp.data
def getheaders(self):
"""Returns a dictionary of the response headers."""
return self.urllib3_response.getheaders()
def getheader(self, name, default=None):
"""Returns a given response header."""
return self.urllib3_response.getheader(name, default)
class RESTClientObject(object):
def __init__(self, configuration, pools_size=4, maxsize=None):
# urllib3.PoolManager will pass all kw parameters to connectionpool
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
# cert_reqs
if configuration.verify_ssl:
cert_reqs = ssl.CERT_REQUIRED
else:
cert_reqs = ssl.CERT_NONE
# ca_certs
if configuration.ssl_ca_cert:
ca_certs = configuration.ssl_ca_cert
else:
# if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where()
addition_pool_args = {}
if configuration.assert_hostname is not None:
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
if maxsize is None:
if configuration.connection_pool_maxsize is not None:
maxsize = configuration.connection_pool_maxsize
else:
maxsize = 4
# https pool manager
if configuration.proxy:
self.pool_manager = urllib3.ProxyManager(
num_pools=pools_size,
maxsize=maxsize,
cert_reqs=cert_reqs,
ca_certs=ca_certs,
cert_file=configuration.cert_file,
key_file=configuration.key_file,
proxy_url=configuration.proxy,
**addition_pool_args
)
else:
self.pool_manager = urllib3.PoolManager(
num_pools=pools_size,
maxsize=maxsize,
cert_reqs=cert_reqs,
ca_certs=ca_certs,
cert_file=configuration.cert_file,
key_file=configuration.key_file,
**addition_pool_args
)
def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True,
_request_timeout=None):
"""Perform requests.
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
`application/x-www-form-urlencoded`
and `multipart/form-data`
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
"""
method = method.upper()
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
'PATCH', 'OPTIONS']
if post_params and body:
raise ValueError(
"body parameter cannot be used with post_params parameter."
)
post_params = post_params or {}
headers = headers or {}
timeout = None
if _request_timeout:
if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
timeout = urllib3.Timeout(total=_request_timeout)
elif (isinstance(_request_timeout, tuple) and
len(_request_timeout) == 2):
timeout = urllib3.Timeout(
connect=_request_timeout[0], read=_request_timeout[1])
if 'Content-Type' not in headers:
headers['Content-Type'] = 'application/json'
try:
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
if query_params:
url += '?' + urlencode(query_params)
if re.search('json', headers['Content-Type'], re.IGNORECASE):
request_body = None
if body is not None:
request_body = json.dumps(body)
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=False,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
elif headers['Content-Type'] == 'multipart/form-data':
# must del headers['Content-Type'], or the correct
# Content-Type which generated by urllib3 will be
# overwritten.
del headers['Content-Type']
r = self.pool_manager.request(
method, url,
fields=post_params,
encode_multipart=True,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
# Pass a `string` parameter directly in the body to support
# other content types than Json when `body` argument is
# provided in serialized form
elif isinstance(body, str):
request_body = body
r = self.pool_manager.request(
method, url,
body=request_body,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
else:
# Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided
arguments. Please check that your arguments match
declared content type."""
raise ApiException(status=0, reason=msg)
# For `GET`, `HEAD`
else:
r = self.pool_manager.request(method, url,
fields=query_params,
preload_content=_preload_content,
timeout=timeout,
headers=headers)
except urllib3.exceptions.SSLError as e:
msg = "{0}\n{1}".format(type(e).__name__, str(e))
raise ApiException(status=0, reason=msg)
if _preload_content:
r = RESTResponse(r)
# In the python 3, the response.data is bytes.
# we need to decode it to string.
if six.PY3:
r.data = r.data.decode('utf8')
# log response body
logger.debug("response body: %s", r.data)
if not 200 <= r.status <= 299:
raise ApiException(http_resp=r)
return r
def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
return self.request("GET", url,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
query_params=query_params)
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
return self.request("HEAD", url,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
query_params=query_params)
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("OPTIONS", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def DELETE(self, url, headers=None, query_params=None, body=None,
_preload_content=True, _request_timeout=None):
return self.request("DELETE", url,
headers=headers,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def POST(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("POST", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def PUT(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("PUT", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
def PATCH(self, url, headers=None, query_params=None, post_params=None,
body=None, _preload_content=True, _request_timeout=None):
return self.request("PATCH", url,
headers=headers,
query_params=query_params,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
class ApiException(Exception):
def __init__(self, status=None, reason=None, http_resp=None):
if http_resp:
self.status = http_resp.status
self.reason = http_resp.reason
self.body = http_resp.data
self.headers = http_resp.getheaders()
else:
self.status = status
self.reason = reason
self.body = None
self.headers = None
def __str__(self):
"""Custom error messages for exception"""
error_message = "({0})\n"\
"Reason: {1}\n".format(self.status, self.reason)
if self.headers:
error_message += "HTTP response headers: {0}\n".format(
self.headers)
if self.body:
error_message += "HTTP response body: {0}\n".format(self.body)
return error_message
coverage==5.0.4
nose==1.3.7
pluggy==0.13.1
py==1.8.1
randomize==0.14
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import unittest
from io import BytesIO
import sure_tosca_client
from sure_tosca_client import Configuration, ApiClient
from sure_tosca_client.api.default_api import DefaultApi # noqa: E501
from sure_tosca_client.rest import ApiException
class TestDefaultApi(unittest.TestCase):
"""DefaultApi unit test stubs"""
def setUp(self):
configuration = Configuration()
configuration.host = "http://localhost:8081/tosca-sure/1.0.0/"
api_client = ApiClient(configuration=configuration)
self.api = sure_tosca_client.api.default_api.DefaultApi(api_client=api_client) # noqa: E501
def tearDown(self):
pass
def test_get_all_ancestor_properties(self):
"""Test case for get_all_ancestor_properties
# noqa: E501
"""
pass
def test_get_all_ancestor_types(self):
"""Test case for get_all_ancestor_types
# noqa: E501
"""
pass
def test_get_ancestors_requirements(self):
"""Test case for get_ancestors_requirements
# noqa: E501
"""
pass
def test_get_dsl_definitions(self):
"""Test case for get_dsl_definitions
# noqa: E501
"""
pass
def test_get_imports(self):
"""Test case for get_imports
# noqa: E501
"""
pass
def test_get_node_outputs(self):
"""Test case for get_node_outputs
# noqa: E501
"""
pass
def test_get_node_properties(self):
"""Test case for get_node_properties
# noqa: E501
"""
pass
def test_get_node_requirements(self):
"""Test case for get_node_requirements
"""
pass
def test_get_node_templates(self):
"""Test case for get_node_templates
"""
pass
def test_get_node_type_name(self):
"""Test case for get_node_type_name
# noqa: E501
"""
pass
def test_get_parent_type_name(self):
"""Test case for get_parent_type_name
# noqa: E501
"""
pass
def test_get_related_nodes(self):
"""Test case for get_related_nodes
# noqa: E501
"""
pass
def test_get_relationship_templates(self):
"""Test case for get_relationship_templates
# noqa: E501
"""
pass
def test_get_topology_template(self):
"""Test case for get_topology_template
"""
pass
def test_get_tosca_template(self):
"""Test case for get_tosca_template
"""
pass
def test_get_types(self):
"""Test case for get_types
# noqa: E501
"""
pass
def test_set_node_properties(self):
"""Test case for set_node_properties
# noqa: E501
"""
pass
def test_upload_tosca_template(self):
"""Test case for upload_tosca_template
upload a tosca template description file # noqa: E501
"""
file_id = self.upload_tosca_template("application_example_provisioned.yaml")
self.assertIsNotNone(file_id)
def get_tosca_file(self, file_name):
tosca_path = "../../TOSCA/"
input_tosca_file_path = tosca_path + '/' + file_name
if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/"
input_tosca_file_path = tosca_path + '/' + file_name
dir_path = os.path.dirname(os.path.realpath(__file__))
self.assertEqual(True, os.path.exists(input_tosca_file_path),
'Starting from: ' + dir_path + ' Input TOSCA file: ' + input_tosca_file_path + ' not found')
return input_tosca_file_path
def upload_tosca_template(self, file_name):
file = self.get_tosca_file("application_example_provisioned.yaml")
file_id = self.api.upload_tosca_template(file)
return file_id
if __name__ == '__main__':
unittest.main()
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import sure_tosca_client
from sure_tosca_client.models.node_template import NodeTemplate # noqa: E501
from sure_tosca_client.rest import ApiException
class TestNodeTemplate(unittest.TestCase):
"""NodeTemplate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testNodeTemplate(self):
"""Test NodeTemplate"""
# FIXME: construct object with mandatory attributes with example values
# model = swagger_client.models.node_template.NodeTemplate() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import sure_tosca_client
from sure_tosca_client.models.node_template_map import NodeTemplateMap # noqa: E501
from sure_tosca_client.rest import ApiException
class TestNodeTemplateMap(unittest.TestCase):
"""NodeTemplateMap unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testNodeTemplateMap(self):
"""Test NodeTemplateMap"""
# FIXME: construct object with mandatory attributes with example values
# model = swagger_client.models.node_template_map.NodeTemplateMap() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import sure_tosca_client
from sure_tosca_client.models.topology_template import TopologyTemplate # noqa: E501
from sure_tosca_client.rest import ApiException
class TestTopologyTemplate(unittest.TestCase):
"""TopologyTemplate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testTopologyTemplate(self):
"""Test TopologyTemplate"""
# FIXME: construct object with mandatory attributes with example values
# model = swagger_client.models.topology_template.TopologyTemplate() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
# coding: utf-8
"""
tosca-sure
TOSCA Simple qUeRy sErvice (SURE). # noqa: E501
OpenAPI spec version: 1.0.0
Contact: S.Koulouzis@uva.nl
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import sure_tosca_client
from sure_tosca_client.models.tosca_template import ToscaTemplate # noqa: E501
from sure_tosca_client.rest import ApiException
class TestToscaTemplate(unittest.TestCase):
"""ToscaTemplate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testToscaTemplate(self):
"""Test ToscaTemplate"""
# FIXME: construct object with mandatory attributes with example values
# model = swagger_client.models.tosca_template.ToscaTemplate() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
[tox]
envlist = py27, py3
[testenv]
deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands=
nosetests \
[]
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