aboutsummaryrefslogtreecommitdiffstats
path: root/moon_manager/moon_manager/api/orchestration
diff options
context:
space:
mode:
Diffstat (limited to 'moon_manager/moon_manager/api/orchestration')
-rw-r--r--moon_manager/moon_manager/api/orchestration/__init__.py12
-rw-r--r--moon_manager/moon_manager/api/orchestration/managers.py21
-rw-r--r--moon_manager/moon_manager/api/orchestration/pipeline.py44
-rw-r--r--moon_manager/moon_manager/api/orchestration/slave.py44
4 files changed, 121 insertions, 0 deletions
diff --git a/moon_manager/moon_manager/api/orchestration/__init__.py b/moon_manager/moon_manager/api/orchestration/__init__.py
new file mode 100644
index 00000000..1856aa2c
--- /dev/null
+++ b/moon_manager/moon_manager/api/orchestration/__init__.py
@@ -0,0 +1,12 @@
+# Software Name: MOON
+
+# Version: 5.4
+
+# SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors
+# SPDX-License-Identifier: Apache-2.0
+
+# This software is distributed under the 'Apache License 2.0',
+# the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+# or see the "LICENSE" file for more details.
+
+
diff --git a/moon_manager/moon_manager/api/orchestration/managers.py b/moon_manager/moon_manager/api/orchestration/managers.py
new file mode 100644
index 00000000..b4776ec2
--- /dev/null
+++ b/moon_manager/moon_manager/api/orchestration/managers.py
@@ -0,0 +1,21 @@
+# Software Name: MOON
+
+# Version: 5.4
+
+# SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors
+# SPDX-License-Identifier: Apache-2.0
+
+# This software is distributed under the 'Apache License 2.0',
+# the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+# or see the "LICENSE" file for more details.
+
+
+import logging
+
+logger = logging.getLogger("moon.api.orchestration.managers")
+
+
+class Managers(object):
+ """Object that links managers together"""
+ SlaveManager = None
+ PipelineManager = None
diff --git a/moon_manager/moon_manager/api/orchestration/pipeline.py b/moon_manager/moon_manager/api/orchestration/pipeline.py
new file mode 100644
index 00000000..32d8a1f9
--- /dev/null
+++ b/moon_manager/moon_manager/api/orchestration/pipeline.py
@@ -0,0 +1,44 @@
+# Software Name: MOON
+
+# Version: 5.4
+
+# SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors
+# SPDX-License-Identifier: Apache-2.0
+
+# This software is distributed under the 'Apache License 2.0',
+# the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+# or see the "LICENSE" file for more details.
+
+
+from uuid import uuid4
+import logging
+from moon_utilities import exceptions
+from moon_utilities.security_functions import enforce
+from moon_manager.api.orchestration.managers import Managers
+
+logger = logging.getLogger("moon.manager.api.orchestration.pod")
+
+
+class PipelineManager(Managers):
+
+ def __init__(self, connector=None):
+ self.driver = connector.driver
+ Managers.PipelineManager = self
+
+ @enforce(("read", "write"), "pipelines")
+ def update_pipeline(self, moon_user_id, pipeline_id, data):
+ return self.driver.update_pipeline(pipeline_id=pipeline_id, data=data)
+
+ @enforce("write", "pipelines")
+ def delete_pipeline(self, moon_user_id, pipeline_id):
+ return self.driver.delete_pipeline(pipeline_id=pipeline_id)
+
+ @enforce("write", "pipelines")
+ def add_pipeline(self, moon_user_id, pipeline_id=None, data=None):
+ if not pipeline_id:
+ pipeline_id = uuid4().hex
+ return self.driver.add_pipeline(pipeline_id=pipeline_id, data=data)
+
+ @enforce("read", "pipelines")
+ def get_pipelines(self, moon_user_id, pipeline_id=None):
+ return self.driver.get_pipelines(pipeline_id=pipeline_id)
diff --git a/moon_manager/moon_manager/api/orchestration/slave.py b/moon_manager/moon_manager/api/orchestration/slave.py
new file mode 100644
index 00000000..200dd3d6
--- /dev/null
+++ b/moon_manager/moon_manager/api/orchestration/slave.py
@@ -0,0 +1,44 @@
+# Software Name: MOON
+
+# Version: 5.4
+
+# SPDX-FileCopyrightText: Copyright (c) 2018-2020 Orange and its contributors
+# SPDX-License-Identifier: Apache-2.0
+
+# This software is distributed under the 'Apache License 2.0',
+# the text of which is available at 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+# or see the "LICENSE" file for more details.
+
+
+from uuid import uuid4
+import logging
+from moon_utilities import exceptions
+from moon_utilities.security_functions import enforce
+from moon_manager.api.orchestration.managers import Managers
+
+logger = logging.getLogger("moon.manager.api.orchestration.pod")
+
+
+class SlaveManager(Managers):
+
+ def __init__(self, connector=None):
+ self.driver = connector.driver
+ Managers.SlaveManager = self
+
+ @enforce(("read", "write"), "slaves")
+ def update_slave(self, moon_user_id, slave_id, value):
+ return self.driver.update_slave(slave_id=slave_id, value=value)
+
+ @enforce("write", "slaves")
+ def delete_slave(self, moon_user_id, slave_id):
+ self.driver.delete_slave(slave_id=slave_id)
+
+ @enforce("write", "slaves")
+ def add_slave(self, moon_user_id, slave_id=None, data=None):
+ if not slave_id:
+ slave_id = uuid4().hex
+ return self.driver.add_slave(slave_id=slave_id, data=data)
+
+ @enforce("read", "slaves")
+ def get_slaves(self, moon_user_id, slave_id=None):
+ return self.driver.get_slaves(slave_id=slave_id)