You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2023/02/27 21:19:29 UTC

[streampipes] branch 1259-verify-authentication-on-startup-of-python-client updated (81b1a4a2e -> 3092040c7)

This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a change to branch 1259-verify-authentication-on-startup-of-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git


    from 81b1a4a2e [hotfix] Add echarts to shared modules
     add f71bd9629 [#1254]: extend data lake measure endpoints get method to process query parameters (#1349)
     add d3ca321f5 1207 improve helm charts (#1344)
     add 44017e066 [hotfix] Use try-with-resource way to fix the potential InfluxDB connection leak in DataExplorerQueryV4 (#1350)
     new 4067743d4 feature(#1259): implement version endpoint
     new 8470f8967 chore: reformatting
     new 7cf4c93f6 fix: typos
     new d503def4a chore: remove now outdated `describe()` method
     new 3092040c7 tmp

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docker-compose.yml                                 |   2 +-
 .../cli/deploy/standalone/ui/docker-compose.yml    |   2 +-
 installer/compose/docker-compose.full.yml          |   2 +-
 installer/compose/docker-compose.nats.yml          |   2 +-
 installer/compose/docker-compose.yml               |   2 +-
 .../k8s/templates/core/backend-deployment.yaml     |  27 +--
 installer/k8s/templates/core/backend-pv-pvc.yaml   |  42 ----
 .../backend-pvc.yaml}                              |  22 +-
 installer/k8s/templates/core/backend-service.yaml  |   8 +-
 installer/k8s/templates/core/ui-configmap.yaml     |  51 +++++
 .../templates/core/{ui.yaml => ui-deployment.yaml} |  28 ++-
 installer/k8s/templates/core/ui-ingress.yaml       |  25 ++-
 installer/k8s/templates/core/ui-ingressroute.yaml  |  46 +++++
 installer/k8s/templates/core/ui-service.yaml       |  10 +-
 ...nt.yaml => extensions-all-iiot-deployment.yaml} |  10 +-
 ...rvice.yaml => extensions-all-iiot-service.yaml} |   6 +-
 .../pipeline-elements-all-flink-deployment.yaml    |  37 ----
 .../external/consul/consul-deployment.yaml         |  16 +-
 .../templates/external/consul/consul-pv-pvc.yaml   |  22 +-
 .../templates/external/consul/consul-service.yaml  |   6 +-
 .../external/couchdb/couchdb-deployment.yaml       |  20 +-
 .../templates/external/couchdb/couchdb-pv-pvc.yaml |  22 +-
 .../external/couchdb/couchdb-service.yaml          |   6 +-
 .../external/flink/jobmanager-deployment.yaml      |  46 -----
 .../external/flink/jobmanager-service.yaml         |  34 ----
 .../external/flink/taskmanager-deployment.yaml     |  43 ----
 .../external/influxdb/influxdb-deployment.yaml     |  34 ++--
 .../templates/external/influxdb/influxdb-pvc.yaml  |  20 +-
 .../external/influxdb/influxdb-service.yaml        |   4 +-
 .../templates/external/influxdb/influxdb2-pvc.yaml |  21 +-
 .../templates/external/nats/nats-deployment.yaml   |   8 +-
 .../k8s/templates/external/nats/nats-service.yaml  |   2 +
 installer/k8s/values.yaml                          |  94 +++++++--
 streampipes-client-python/README.md                |   2 +-
 ...introduction-to-streampipes-python-client.ipynb |  58 +++---
 ...cting-data-from-the-streampipes-data-lake.ipynb | 153 +++++++++++++-
 ...ive-data-from-the-streampipes-data-stream.ipynb |  12 ++
 ...ine-learning-on-a-streampipes-data-stream.ipynb |  13 +-
 .../docs/img/tutorial-preparation.gif              | Bin 0 -> 2569748 bytes
 streampipes-client-python/setup.py                 |   2 +-
 .../streampipes/client/client.py                   |  75 ++++---
 .../streampipes/endpoint/api/__init__.py           |   2 +
 .../streampipes/endpoint/api/data_lake_measure.py  | 224 ++++++++++++++++++++-
 .../streampipes/endpoint/api/data_stream.py        |   9 +-
 .../streampipes/endpoint/api/version.py            | 130 ++++++++++++
 .../streampipes/endpoint/endpoint.py               |   2 +-
 .../streampipes/model/container/__init__.py        |   2 +
 .../container/{data_streams.py => versions.py}     |  28 +--
 .../streampipes/model/resource/__init__.py         |   2 +
 .../__init__.py => model/resource/version.py}      |  29 ++-
 .../tests/client/test_client.py                    |  49 -----
 .../tests/client/test_data_lake_series.py          |   2 +-
 .../tests/client/test_endpoint.py                  |   2 +
 .../{streampipes => tests/endpoint}/__init__.py    |   0
 .../tests/endpoint/test_data_lake_measure.py       | 138 +++++++++++++
 .../dataexplorer/v4/query/DataExplorerQueryV4.java |  66 +++---
 ui/Dockerfile                                      |  12 +-
 ui/nginx_config/default.conf                       |  23 +--
 ui/nginx_config/ssl.conf                           |   2 +-
 59 files changed, 1124 insertions(+), 633 deletions(-)
 delete mode 100644 installer/k8s/templates/core/backend-pv-pvc.yaml
 rename installer/k8s/templates/{extensions/pipeline-elements/pipeline-elements-all-flink-service.yaml => core/backend-pvc.yaml} (71%)
 create mode 100644 installer/k8s/templates/core/ui-configmap.yaml
 rename installer/k8s/templates/core/{ui.yaml => ui-deployment.yaml} (68%)
 create mode 100644 installer/k8s/templates/core/ui-ingressroute.yaml
 rename installer/k8s/templates/extensions/pipeline-elements/{extensions-all-jvm-deployment.yaml => extensions-all-iiot-deployment.yaml} (86%)
 rename installer/k8s/templates/extensions/pipeline-elements/{extensions-all-jvm-service.yaml => extensions-all-iiot-service.yaml} (91%)
 delete mode 100644 installer/k8s/templates/extensions/pipeline-elements/pipeline-elements-all-flink-deployment.yaml
 delete mode 100644 installer/k8s/templates/external/flink/jobmanager-deployment.yaml
 delete mode 100644 installer/k8s/templates/external/flink/jobmanager-service.yaml
 delete mode 100644 installer/k8s/templates/external/flink/taskmanager-deployment.yaml
 create mode 100644 streampipes-client-python/docs/img/tutorial-preparation.gif
 create mode 100644 streampipes-client-python/streampipes/endpoint/api/version.py
 copy streampipes-client-python/streampipes/model/container/{data_streams.py => versions.py} (69%)
 copy streampipes-client-python/streampipes/{endpoint/__init__.py => model/resource/version.py} (55%)
 copy streampipes-client-python/{streampipes => tests/endpoint}/__init__.py (100%)
 create mode 100644 streampipes-client-python/tests/endpoint/test_data_lake_measure.py


[streampipes] 02/05: chore: reformatting

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch 1259-verify-authentication-on-startup-of-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 8470f8967f6a5fbe563676bdcfdb8c5e6428204b
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Feb 27 22:12:27 2023 +0100

    chore: reformatting
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 streampipes-client-python/streampipes/endpoint/api/data_stream.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/streampipes-client-python/streampipes/endpoint/api/data_stream.py b/streampipes-client-python/streampipes/endpoint/api/data_stream.py
index 4780d3ea4..43ba2de32 100644
--- a/streampipes-client-python/streampipes/endpoint/api/data_stream.py
+++ b/streampipes-client-python/streampipes/endpoint/api/data_stream.py
@@ -18,15 +18,14 @@
 """
 Specific implementation of the StreamPipes API's data stream endpoints.
 """
-from typing import Tuple, Type
-
-from streampipes.endpoint.endpoint import APIEndpoint
-from streampipes.model.container import DataStreams
 
 __all__ = [
     "DataStreamEndpoint",
 ]
+from typing import Tuple, Type
 
+from streampipes.endpoint.endpoint import APIEndpoint
+from streampipes.model.container import DataStreams
 from streampipes.model.container.resource_container import ResourceContainer
 
 


[streampipes] 04/05: chore: remove now outdated `describe()` method

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch 1259-verify-authentication-on-startup-of-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit d503def4a15b753ee6bdcb88435a296e06ab4283
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Feb 27 22:17:39 2023 +0100

    chore: remove now outdated `describe()` method
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 ...introduction-to-streampipes-python-client.ipynb | 44 -------------------
 .../streampipes/client/client.py                   | 37 ----------------
 .../tests/client/test_client.py                    | 49 ----------------------
 3 files changed, 130 deletions(-)

diff --git a/streampipes-client-python/docs/examples/1-introduction-to-streampipes-python-client.ipynb b/streampipes-client-python/docs/examples/1-introduction-to-streampipes-python-client.ipynb
index 9c6df65b9..bc72d4174 100644
--- a/streampipes-client-python/docs/examples/1-introduction-to-streampipes-python-client.ipynb
+++ b/streampipes-client-python/docs/examples/1-introduction-to-streampipes-python-client.ipynb
@@ -183,43 +183,6 @@
   {
    "cell_type": "markdown",
    "source": [
-    "That's already it. You can check if everything works out by using the following command:"
-   ],
-   "metadata": {
-    "collapsed": false
-   }
-  },
-  {
-   "cell_type": "code",
-   "execution_count": 6,
-   "outputs": [
-    {
-     "name": "stdout",
-     "output_type": "stream",
-     "text": [
-      "2023-02-24 17:05:49,398 - streampipes.endpoint.endpoint - [INFO] - [endpoint.py:167] [_make_request] - Successfully retrieved all resources.\n",
-      "2023-02-24 17:05:49,457 - streampipes.endpoint.endpoint - [INFO] - [endpoint.py:167] [_make_request] - Successfully retrieved all resources.\n",
-      "\n",
-      "Hi there!\n",
-      "You are connected to a StreamPipes instance running at http://localhost:80.\n",
-      "The following StreamPipes resources are available with this client:\n",
-      "1x DataLakeMeasures\n",
-      "1x DataStreams\n"
-     ]
-    }
-   ],
-   "source": [
-    "client.describe()"
-   ],
-   "metadata": {
-    "collapsed": false
-   }
-  },
-  {
-   "cell_type": "markdown",
-   "source": [
-    "This prints you a short textual description of the connected StreamPipes instance to the console.\n",
-    "\n",
     "<br>\n",
     "\n",
     "The created `client` instance serves as the central point of interaction for StreamPipes.\n",
@@ -238,13 +201,6 @@
    "metadata": {
     "collapsed": false
    }
-  },
-  {
-   "cell_type": "markdown",
-   "source": [],
-   "metadata": {
-    "collapsed": false
-   }
   }
  ],
  "metadata": {
diff --git a/streampipes-client-python/streampipes/client/client.py b/streampipes-client-python/streampipes/client/client.py
index 65b972aff..9f24dbd58 100644
--- a/streampipes-client-python/streampipes/client/client.py
+++ b/streampipes-client-python/streampipes/client/client.py
@@ -34,7 +34,6 @@ from streampipes.endpoint.api import (
     DataStreamEndpoint,
     VersionEndpoint,
 )
-from streampipes.endpoint.endpoint import APIEndpoint
 
 logger = logging.getLogger(__name__)
 
@@ -183,39 +182,3 @@ class StreamPipesClient:
             f"{self.client_config.host_address}:"
             f"{self.client_config.port}/streampipes-backend/"
         )
-
-    def describe(self) -> None:
-        """Prints short description of the connected StreamPipes instance and the available resources to the console.
-
-        Returns
-        -------
-            None
-        """
-
-        # get all endpoints of this client
-        available_endpoints = [
-            attr_name for attr_name in dir(self) if isinstance(self.__getattribute__(attr_name), APIEndpoint)
-        ]
-
-        # collect the number of available resources per endpoint
-        endpoint_stats = {
-            (all_items := self.__getattribute__(endpoint_name).all()).__class__.__name__: len(all_items)
-            for endpoint_name in available_endpoints
-        }
-
-        # sort the endpoints descending based on the number of resources
-        sorted_endpoint_stats = {
-            key: val for key, val in sorted(endpoint_stats.items(), key=lambda item: item[1], reverse=True)
-        }
-
-        base_message = (
-            f"\nHi there!\n"
-            f"You are connected to a StreamPipes instance running at "
-            f"{'http://' if self.client_config.https_disabled else 'https://'}"
-            f"{self.client_config.host_address}:{self.client_config.port}.\n"
-            f"The following StreamPipes resources are available with this client:\n"
-        )
-
-        endpoint_stats_message = "\n".join(f"{count}x {name}" for name, count in sorted_endpoint_stats.items())
-
-        print(base_message + endpoint_stats_message)
diff --git a/streampipes-client-python/tests/client/test_client.py b/streampipes-client-python/tests/client/test_client.py
index b5b6448fb..20a600e7a 100644
--- a/streampipes-client-python/tests/client/test_client.py
+++ b/streampipes-client-python/tests/client/test_client.py
@@ -14,10 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-import json
-from collections import namedtuple
 from unittest import TestCase
-from unittest.mock import MagicMock, call, patch
 
 from streampipes.client import StreamPipesClient
 from streampipes.client.config import StreamPipesClientConfig
@@ -70,49 +67,3 @@ class TestStreamPipesClient(TestCase):
         )
         self.assertTrue(isinstance(result.dataLakeMeasureApi, DataLakeMeasureEndpoint))
         self.assertEqual(result.base_api_path, "https://localhost:443/streampipes-backend/")
-
-    @patch("builtins.print")
-    @patch("streampipes.endpoint.endpoint.APIEndpoint._make_request", autospec=True)
-    def test_client_describe(self, make_request: MagicMock, mocked_print: MagicMock):
-        def simulate_response(*args, **kwargs):
-            Response = namedtuple("Response", ["text"])
-            if "measurements" in kwargs["url"]:
-                return Response(
-                    json.dumps(
-                        [
-                            {
-                                "measureName": "test",
-                                "timestampField": "time",
-                                "pipelineIsRunning": False,
-                                "schemaVersion": "0",
-                            }
-                        ]
-                    )
-                )
-            if "streams" in kwargs["url"]:
-                return Response(
-                    json.dumps(
-                        [{"elementId": "test-stream", "name": "test", "eventGrounding": {"transportProtocols": []}}]
-                    )
-                )
-
-        make_request.side_effect = simulate_response
-        StreamPipesClient.create(
-            client_config=StreamPipesClientConfig(
-                credential_provider=StreamPipesApiKeyCredentials(username="user", api_key="key"),
-                host_address="localhost",
-                https_disabled=False,
-                port=443,
-            )
-        ).describe()
-
-        mocked_print.assert_has_calls(
-            calls=[
-                call(
-                    "\nHi there!\nYou are connected to a StreamPipes instance running at https://localhost:443.\n"
-                    "The following StreamPipes resources are available with this client:\n"
-                    "1x DataLakeMeasures\n1x DataStreams"
-                ),
-            ],
-            any_order=True,
-        )


[streampipes] 05/05: tmp

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch 1259-verify-authentication-on-startup-of-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 3092040c7bbcbc89a88e4298c1c0ee5511573d88
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Feb 27 22:19:00 2023 +0100

    tmp
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 .../streampipes/client/client.py                   | 29 ++++++++++++++++++++++
 .../tests/client/test_endpoint.py                  |  2 ++
 2 files changed, 31 insertions(+)

diff --git a/streampipes-client-python/streampipes/client/client.py b/streampipes-client-python/streampipes/client/client.py
index 9f24dbd58..e24b6e3e4 100644
--- a/streampipes-client-python/streampipes/client/client.py
+++ b/streampipes-client-python/streampipes/client/client.py
@@ -110,6 +110,35 @@ class StreamPipesClient:
         self.dataStreamApi = DataStreamEndpoint(parent_client=self)
         self.versionApi = VersionEndpoint(parent_client=self)
 
+        self.server_version = self._get_server_version()
+
+    def _get_server_version(self) -> str:
+        """Connects to the StreamPipes server and retrieves its version.
+
+        In addition to querying the server version, this method implicitly checks the specified credentials.
+
+        Returns
+        -------
+        sp_version: str
+            version of the connected StreamPipes instance
+
+        """
+
+        # retrieve metadata from the API via the Streampipes server
+        # as a side effect, the specified credentials are also tested to ensure that authentication is successful.
+        version_dict = self.versionApi.get(identifier="").to_dict(use_source_names=False)
+
+        # remove SNAPSHOT-suffix if present
+        sp_version = version_dict["backend_version"].replace("-SNAPSHOT", "")
+
+        logger.info(
+            "The StreamPipes version was successfully retrieved from the backend: %s. "
+            "By means of that, authentication via the provided credentials is also tested successfully.",
+            sp_version,
+        )
+
+        return sp_version
+
     @staticmethod
     def _set_up_logging(logging_level: int) -> None:
         """Configures the logging behavior of the `StreamPipesClient`.
diff --git a/streampipes-client-python/tests/client/test_endpoint.py b/streampipes-client-python/tests/client/test_endpoint.py
index 16a2b6d9d..9db949509 100644
--- a/streampipes-client-python/tests/client/test_endpoint.py
+++ b/streampipes-client-python/tests/client/test_endpoint.py
@@ -418,6 +418,7 @@ class TestMessagingEndpoint(TestCase):
         )
     )
 
+    @patch("streampipes.client.client.Session", autospec=True)
     def test_messaging_endpoint_happy_path(self):
         demo_endpoint = MessagingEndpoint(parent_client=self.client)
 
@@ -425,6 +426,7 @@ class TestMessagingEndpoint(TestCase):
 
         self.assertTrue(isinstance(demo_endpoint.broker, NatsBroker))
 
+    @patch("streampipes.client.client.Session", autospec=True)
     def test_messaging_endpoint_missing_configure(self):
         demo_endpoint = MessagingEndpoint(parent_client=self.client)
 


[streampipes] 01/05: feature(#1259): implement version endpoint

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch 1259-verify-authentication-on-startup-of-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 4067743d4ffccd1d46f52b55362f2755773e8428
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Feb 27 21:47:07 2023 +0100

    feature(#1259): implement version endpoint
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 streampipes-client-python/setup.py                 |   2 +-
 .../streampipes/client/client.py                   |   7 +-
 .../streampipes/endpoint/api/__init__.py           |   2 +
 .../streampipes/endpoint/api/version.py            | 130 +++++++++++++++++++++
 .../streampipes/model/container/__init__.py        |   2 +
 .../streampipes/model/container/versions.py        |  55 +++++++++
 .../streampipes/model/resource/__init__.py         |   2 +
 .../model/resource/{__init__.py => version.py}     |  33 ++++--
 8 files changed, 222 insertions(+), 11 deletions(-)

diff --git a/streampipes-client-python/setup.py b/streampipes-client-python/setup.py
index e135fd33f..cdfef0415 100644
--- a/streampipes-client-python/setup.py
+++ b/streampipes-client-python/setup.py
@@ -101,7 +101,7 @@ setuptools.setup(
     classifiers=[
         # Trove classifiers
         # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
-        "Development Status :: 3 - Alpha",
+        "Development Status :: 4 - Beta",
         "Environment :: Console",
         "Intended Audience :: Developers",
         "Intended Audience :: Information Technology",
diff --git a/streampipes-client-python/streampipes/client/client.py b/streampipes-client-python/streampipes/client/client.py
index 471696c1d..65b972aff 100644
--- a/streampipes-client-python/streampipes/client/client.py
+++ b/streampipes-client-python/streampipes/client/client.py
@@ -29,7 +29,11 @@ from typing import Dict, Optional
 
 from requests import Session
 from streampipes.client.config import StreamPipesClientConfig
-from streampipes.endpoint.api import DataLakeMeasureEndpoint, DataStreamEndpoint
+from streampipes.endpoint.api import (
+    DataLakeMeasureEndpoint,
+    DataStreamEndpoint,
+    VersionEndpoint,
+)
 from streampipes.endpoint.endpoint import APIEndpoint
 
 logger = logging.getLogger(__name__)
@@ -105,6 +109,7 @@ class StreamPipesClient:
         # name of the endpoint needs to be consistent with the Java client
         self.dataLakeMeasureApi = DataLakeMeasureEndpoint(parent_client=self)
         self.dataStreamApi = DataStreamEndpoint(parent_client=self)
+        self.versionApi = VersionEndpoint(parent_client=self)
 
     @staticmethod
     def _set_up_logging(logging_level: int) -> None:
diff --git a/streampipes-client-python/streampipes/endpoint/api/__init__.py b/streampipes-client-python/streampipes/endpoint/api/__init__.py
index 3d4e6e9cd..28bcf688a 100644
--- a/streampipes-client-python/streampipes/endpoint/api/__init__.py
+++ b/streampipes-client-python/streampipes/endpoint/api/__init__.py
@@ -17,8 +17,10 @@
 
 from .data_lake_measure import DataLakeMeasureEndpoint
 from .data_stream import DataStreamEndpoint
+from .version import VersionEndpoint
 
 __all__ = [
     "DataLakeMeasureEndpoint",
     "DataStreamEndpoint",
+    "VersionEndpoint",
 ]
diff --git a/streampipes-client-python/streampipes/endpoint/api/version.py b/streampipes-client-python/streampipes/endpoint/api/version.py
new file mode 100644
index 000000000..aa1fe0cf3
--- /dev/null
+++ b/streampipes-client-python/streampipes/endpoint/api/version.py
@@ -0,0 +1,130 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+"""
+Specific implementation of the StreamPipes API's version endpoint.
+"""
+
+__all__ = [
+    "VersionEndpoint",
+]
+
+from typing import Tuple, Type
+
+from streampipes.endpoint import APIEndpoint
+from streampipes.model.container import Versions
+from streampipes.model.container.resource_container import ResourceContainer
+from streampipes.model.resource.resource import Resource
+
+
+class VersionEndpoint(APIEndpoint):
+    """Implementation of the Versions endpoint.
+
+    This endpoint provides metadata about the StreamPipes version of the connected instance.
+    It only allows to apply the `get()` method with an empty string as identifier.
+
+    Parameters
+    ----------
+    parent_client: StreamPipesClient
+        The instance of [StreamPipesClient][streampipes.client.StreamPipesClient] the endpoint is attached to.
+
+    Examples
+    --------
+
+    >>> from streampipes.client import StreamPipesClient
+    >>> from streampipes.client.config import StreamPipesClientConfig
+    >>> from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
+
+    >>> client_config = StreamPipesClientConfig(
+    ...     credential_provider=StreamPipesApiKeyCredentials(username="test-user", api_key="api-key"),
+    ...     host_address="localhost",
+    ...     port=8082,
+    ...     https_disabled=True
+    ... )
+
+    >>> client = StreamPipesClient.create(client_config=client_config)
+
+    >>> client.versionApi.get(identifier="").to_dict(use_source_names=False)
+    {'backend_version': '0.92.0-SNAPSHOT'}
+    """
+
+    @property
+    def _container_cls(self) -> Type[ResourceContainer]:
+        """Defines the model container class the endpoint refers to.
+
+        Returns
+        -------
+        [Versions][streampipes.model.container.Versions]
+        """
+
+        return Versions
+
+    @property
+    def _relative_api_path(self) -> Tuple[str, ...]:
+        """Defines the relative api path to the DataStream endpoint.
+
+        Each path within the URL is defined as an own string.
+
+        Returns
+        -------
+        api_path: Tuple[str, ...]
+            a tuple of strings of which every represents a path value of the endpoint's API URL.
+        """
+
+        return "api", "v2", "info", "versions"
+
+    def all(self) -> ResourceContainer:
+        """Usually, this method returns information about all resources provided by this endpoint.
+        However, this endpoint does not support this kind of operation.
+
+        Raises
+        ------
+        NotImplementedError
+            this endpoint does not return multiple entries, therefore this method is not available
+
+        """
+        raise NotImplementedError("The `all()` method is not supported by this endpoint.")
+
+    def get(self, identifier: str, **kwargs) -> Resource:
+        """Queries the resource from the API endpoint.
+
+        For this endpoint only one resource is available.
+
+        Parameters
+        ----------
+        identifier: str
+            Not supported by this endpoint, is set to an empty string.
+
+        Returns
+        -------
+        versions: Version
+            The specified resource as an instance of the corresponding model class([Version][streampipes.model.resource.Version]).  # noqa: 501
+        """
+
+        return super().get(identifier="")
+
+    def post(self, resource: Resource) -> None:
+        """Usually, this method allows to create via this endpoint.
+        Since the data represented by this endpoint is immutable, it does not support this kind of operation.
+
+        Raises
+        ------
+        NotImplementedError
+            this endpoint does not allow for POST requests, therefore this method is not available
+
+        """
+        raise NotImplementedError("The `post()` method is not supported by this endpoint.")
diff --git a/streampipes-client-python/streampipes/model/container/__init__.py b/streampipes-client-python/streampipes/model/container/__init__.py
index 53b0ded93..59d688ce8 100644
--- a/streampipes-client-python/streampipes/model/container/__init__.py
+++ b/streampipes-client-python/streampipes/model/container/__init__.py
@@ -17,8 +17,10 @@
 
 from .data_lake_measures import DataLakeMeasures
 from .data_streams import DataStreams
+from .versions import Versions
 
 __all__ = [
     "DataLakeMeasures",
     "DataStreams",
+    "Versions",
 ]
diff --git a/streampipes-client-python/streampipes/model/container/versions.py b/streampipes-client-python/streampipes/model/container/versions.py
new file mode 100644
index 000000000..f2e952fb3
--- /dev/null
+++ b/streampipes-client-python/streampipes/model/container/versions.py
@@ -0,0 +1,55 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+"""
+Implementation of a resource container for the versions endpoint.
+"""
+
+__all__ = [
+    "Versions",
+]
+
+from typing import Type
+
+from streampipes.model.container.resource_container import ResourceContainer
+from streampipes.model.resource import Version
+from streampipes.model.resource.resource import Resource
+
+
+class Versions(ResourceContainer):
+    """Implementation of the resource container for the versions endpoint.
+
+    This resource container is a collection of versions returned by the StreamPipes API.
+    It is capable of parsing the response content directly into a list of queried `Version`.
+    Furthermore, the resource container makes them accessible in a pythonic manner.
+
+    Parameters
+    ----------
+    resources: List[Version]
+        A list of resources ([Version][streampipes.model.resource.Version]) to be contained in the `ResourceContainer`.
+
+    """
+
+    @classmethod
+    def _resource_cls(cls) -> Type[Resource]:
+        """Returns the class of the resource that are bundled.
+
+        Returns
+        -------
+        [Version][streampipes.model.resource.Version]
+        """
+        return Version
diff --git a/streampipes-client-python/streampipes/model/resource/__init__.py b/streampipes-client-python/streampipes/model/resource/__init__.py
index c6f0cddba..d0d2e0a5e 100644
--- a/streampipes-client-python/streampipes/model/resource/__init__.py
+++ b/streampipes-client-python/streampipes/model/resource/__init__.py
@@ -19,10 +19,12 @@ from .data_lake_measure import DataLakeMeasure
 from .data_lake_series import DataLakeSeries
 from .data_stream import DataStream
 from .function_definition import FunctionDefinition
+from .version import Version
 
 __all__ = [
     "DataLakeMeasure",
     "DataLakeSeries",
     "DataStream",
     "FunctionDefinition",
+    "Version",
 ]
diff --git a/streampipes-client-python/streampipes/model/resource/__init__.py b/streampipes-client-python/streampipes/model/resource/version.py
similarity index 55%
copy from streampipes-client-python/streampipes/model/resource/__init__.py
copy to streampipes-client-python/streampipes/model/resource/version.py
index c6f0cddba..c0405caec 100644
--- a/streampipes-client-python/streampipes/model/resource/__init__.py
+++ b/streampipes-client-python/streampipes/model/resource/version.py
@@ -15,14 +15,29 @@
 # limitations under the License.
 #
 
-from .data_lake_measure import DataLakeMeasure
-from .data_lake_series import DataLakeSeries
-from .data_stream import DataStream
-from .function_definition import FunctionDefinition
-
 __all__ = [
-    "DataLakeMeasure",
-    "DataLakeSeries",
-    "DataStream",
-    "FunctionDefinition",
+    "Version",
 ]
+
+from typing import Dict
+
+from pydantic import StrictStr
+from streampipes.model.resource.resource import Resource
+
+
+class Version(Resource):
+    """Metadata about the version of the connected StreamPipes server.
+
+    Attributes
+    ----------
+    backend_version: str
+        version of the StreamPipes backend the client is connected to
+    """
+
+    def convert_to_pandas_representation(self) -> Dict:
+        """Returns the dictionary representation of the version metadata
+        to be used when creating a pandas Dataframe.
+        """
+        return self.to_dict(use_source_names=False)
+
+    backend_version: StrictStr


[streampipes] 03/05: fix: typos

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch 1259-verify-authentication-on-startup-of-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 7cf4c93f6aaa4902e23308161c52e1b2db77a7a2
Author: bossenti <bo...@posteo.de>
AuthorDate: Mon Feb 27 22:12:49 2023 +0100

    fix: typos
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 .../streampipes/endpoint/api/data_lake_measure.py                     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py b/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py
index a5975b277..ad21bb7d8 100644
--- a/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py
+++ b/streampipes-client-python/streampipes/endpoint/api/data_lake_measure.py
@@ -157,9 +157,9 @@ class MeasurementGetQueryConfig(BaseModel):
 class DataLakeMeasureEndpoint(APIEndpoint):
     """Implementation of the DataLakeMeasure endpoint.
 
-    This endpoint provides an interfact to all data stored in the StreamPipes data lake.
+    This endpoint provides an interface to all data stored in the StreamPipes data lake.
 
-    Consequently, it allows uerying metadata about available data sets (see `all()` method).
+    Consequently, it allows querying metadata about available data sets (see `all()` method).
     The metadata is returned as an instance of `model.container.DataLakeMeasures`.
 
     In addition, the endpoint provides direct access to the data stored in the data laka by querying a