Feature 10981: skeleton of osm_webhook_translator package
Change-Id: I80217214941241e1e97dee80b978e0f1e55f4d1a
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_webhook_translator/README.rst b/osm_webhook_translator/README.rst
new file mode 100644
index 0000000..a84b409
--- /dev/null
+++ b/osm_webhook_translator/README.rst
@@ -0,0 +1,33 @@
+..
+ #######################################################################################
+ # Copyright ETSI Contributors and Others.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ # implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #######################################################################################
+
+==================
+webhook-translator
+==================
+
+webhook-translator is a component in the Service Assurance architecture for OSM.
+
+Its role is to receive alerts from entities such as Prometheus AlertManager or external systems, and to translate them to a format that can be consumed by Airflow DAGs. It basically receives HTTP POST messages and forwards them to an Airflow webhook
+
+The main characteristics are:
+
+* Lightweight: a very small number of lines of code does the work.
+* Stateless. It only translates HTTP requests. No state for those translations. When running as a Kubernetes deployment, native scaling is achieved by means of Kubernetes services.
+* Simple. Based on `FastAPI <https://fastapi.tiangolo.com/>`
+* Independent from the source of the alert. No maintenance is required to incorporate new alert sources.
+
diff --git a/osm_webhook_translator/requirements-dist.in b/osm_webhook_translator/requirements-dist.in
new file mode 100644
index 0000000..03ff6e9
--- /dev/null
+++ b/osm_webhook_translator/requirements-dist.in
@@ -0,0 +1,18 @@
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+stdeb
+setuptools-scm
+setuptools<60
diff --git a/osm_webhook_translator/requirements-dist.txt b/osm_webhook_translator/requirements-dist.txt
new file mode 100644
index 0000000..6ddded6
--- /dev/null
+++ b/osm_webhook_translator/requirements-dist.txt
@@ -0,0 +1,32 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+packaging==23.0
+ # via setuptools-scm
+setuptools-scm==7.1.0
+ # via -r osm_webhook_translator/requirements-dist.in
+stdeb==0.10.0
+ # via -r osm_webhook_translator/requirements-dist.in
+tomli==2.0.1
+ # via setuptools-scm
+typing-extensions==4.5.0
+ # via setuptools-scm
+
+# The following packages are considered to be unsafe in a requirements file:
+setuptools==59.8.0
+ # via
+ # -r osm_webhook_translator/requirements-dist.in
+ # setuptools-scm
diff --git a/osm_webhook_translator/requirements.in b/osm_webhook_translator/requirements.in
new file mode 100644
index 0000000..33c6214
--- /dev/null
+++ b/osm_webhook_translator/requirements.in
@@ -0,0 +1,20 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+
+fastapi
+requests
+uvicorn
diff --git a/osm_webhook_translator/requirements.txt b/osm_webhook_translator/requirements.txt
new file mode 100644
index 0000000..6cf7f42
--- /dev/null
+++ b/osm_webhook_translator/requirements.txt
@@ -0,0 +1,48 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+anyio==3.6.2
+ # via starlette
+certifi==2022.12.7
+ # via requests
+charset-normalizer==3.1.0
+ # via requests
+click==8.1.3
+ # via uvicorn
+fastapi==0.95.0
+ # via -r osm_webhook_translator/requirements.in
+h11==0.14.0
+ # via uvicorn
+idna==3.4
+ # via
+ # anyio
+ # requests
+pydantic==1.10.7
+ # via fastapi
+requests==2.28.2
+ # via -r osm_webhook_translator/requirements.in
+sniffio==1.3.0
+ # via anyio
+starlette==0.26.1
+ # via fastapi
+typing-extensions==4.5.0
+ # via
+ # pydantic
+ # starlette
+urllib3==1.26.15
+ # via requests
+uvicorn==0.21.1
+ # via -r osm_webhook_translator/requirements.in
diff --git a/osm_webhook_translator/setup.py b/osm_webhook_translator/setup.py
new file mode 100644
index 0000000..3323757
--- /dev/null
+++ b/osm_webhook_translator/setup.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+#
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+from setuptools import find_namespace_packages, setup
+
+exec(open("src/osm_webhook_translator/_version.py").read())
+
+_name = "osm_webhook_translator"
+_description = "OSM Webhook Translator"
+with open(os.path.join(".", "README.rst")) as readme_file:
+ README = readme_file.read()
+
+setup(
+ name=_name,
+ description=_description,
+ long_description=README,
+ version=__version__, # noqa: F821
+ author="ETSI OSM",
+ author_email="osmsupport@etsi.org",
+ maintainer="ETSI OSM",
+ maintainer_email="osmsupport@etsi.org",
+ url="https://osm.etsi.org/gitweb/?p=osm/NG-SA.git;a=summary",
+ license="Apache 2.0",
+ package_dir={"": "src"},
+ packages=find_namespace_packages(where="src"),
+ include_package_data=True,
+)
diff --git a/osm_webhook_translator/src/osm_webhook_translator/__init__.py b/osm_webhook_translator/src/osm_webhook_translator/__init__.py
new file mode 100644
index 0000000..d5daf3e
--- /dev/null
+++ b/osm_webhook_translator/src/osm_webhook_translator/__init__.py
@@ -0,0 +1,17 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+from osm_webhook_translator._version import __version__ # noqa: F401