From 759c32aca52a30ed4e79446f7bddfeced85dc83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Thu, 4 Jul 2024 12:52:20 +0100 Subject: [PATCH 01/13] CP-1897 Fix versioning issue. --- .bumpversion.cfg | 2 +- .version | 1 + .../pyproject.toml | 2 +- thousandeyes-sdk-agents/pyproject.toml | 2 +- thousandeyes-sdk-alerts/pyproject.toml | 2 +- thousandeyes-sdk-bgp-monitors/pyproject.toml | 2 +- thousandeyes-sdk-core/pyproject.toml | 2 +- .../src/thousandeyes_sdk/core/__init__.py | 25 ------------------- .../src/thousandeyes_sdk/core/version.py | 22 ---------------- thousandeyes-sdk-credentials/pyproject.toml | 2 +- thousandeyes-sdk-dashboards/pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- thousandeyes-sdk-instant-tests/pyproject.toml | 2 +- .../pyproject.toml | 2 +- thousandeyes-sdk-labels/pyproject.toml | 2 +- thousandeyes-sdk-snapshots/pyproject.toml | 2 +- thousandeyes-sdk-streaming/pyproject.toml | 2 +- thousandeyes-sdk-tags/pyproject.toml | 2 +- thousandeyes-sdk-test-results/pyproject.toml | 2 +- thousandeyes-sdk-tests/pyproject.toml | 2 +- thousandeyes-sdk-usage/pyproject.toml | 2 +- 25 files changed, 23 insertions(+), 69 deletions(-) create mode 100644 .version delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 339bc973..437dadb3 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,4 +3,4 @@ current_version = 1.0.0 commit = False tag = False -[bumpversion:file:thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py] +[bumpversion:file:.version] diff --git a/.version b/.version new file mode 100644 index 00000000..3eefcb9d --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.0.0 diff --git a/thousandeyes-sdk-administrative/pyproject.toml b/thousandeyes-sdk-administrative/pyproject.toml index 02bab173..877c5c12 100644 --- a/thousandeyes-sdk-administrative/pyproject.toml +++ b/thousandeyes-sdk-administrative/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-agents/pyproject.toml b/thousandeyes-sdk-agents/pyproject.toml index 9d93d8e2..1e927a85 100644 --- a/thousandeyes-sdk-agents/pyproject.toml +++ b/thousandeyes-sdk-agents/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-alerts/pyproject.toml b/thousandeyes-sdk-alerts/pyproject.toml index 7f5d82a7..9c4c41a6 100644 --- a/thousandeyes-sdk-alerts/pyproject.toml +++ b/thousandeyes-sdk-alerts/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-bgp-monitors/pyproject.toml b/thousandeyes-sdk-bgp-monitors/pyproject.toml index f9df4919..8813ab92 100644 --- a/thousandeyes-sdk-bgp-monitors/pyproject.toml +++ b/thousandeyes-sdk-bgp-monitors/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml index 9d276ee9..0dbec9ed 100644 --- a/thousandeyes-sdk-core/pyproject.toml +++ b/thousandeyes-sdk-core/pyproject.toml @@ -18,7 +18,7 @@ where = ["src/"] include = ["thousandeyes_sdk.core"] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py deleted file mode 100644 index 0f9854f3..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -from . import exceptions -from .api_client import ApiClient -from .api_response import ApiResponse -from .configuration import Configuration -from .version import Version - -import os.path - -__version__ = "1.0.0" diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py deleted file mode 100644 index c7e4c097..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -import thousandeyes_sdk.core - -class Version: - @staticmethod - def get() -> str: - return thousandeyes_sdk.core.__version__ diff --git a/thousandeyes-sdk-credentials/pyproject.toml b/thousandeyes-sdk-credentials/pyproject.toml index 31c87528..27296bd1 100644 --- a/thousandeyes-sdk-credentials/pyproject.toml +++ b/thousandeyes-sdk-credentials/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-dashboards/pyproject.toml b/thousandeyes-sdk-dashboards/pyproject.toml index baffe28f..0f0f3b95 100644 --- a/thousandeyes-sdk-dashboards/pyproject.toml +++ b/thousandeyes-sdk-dashboards/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-endpoint-agents/pyproject.toml b/thousandeyes-sdk-endpoint-agents/pyproject.toml index 98bedc75..56de2826 100644 --- a/thousandeyes-sdk-endpoint-agents/pyproject.toml +++ b/thousandeyes-sdk-endpoint-agents/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml index 5de1e33a..dc0e034b 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-endpoint-labels/pyproject.toml b/thousandeyes-sdk-endpoint-labels/pyproject.toml index a5d3d6cc..5c8502f3 100644 --- a/thousandeyes-sdk-endpoint-labels/pyproject.toml +++ b/thousandeyes-sdk-endpoint-labels/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-endpoint-test-results/pyproject.toml b/thousandeyes-sdk-endpoint-test-results/pyproject.toml index 171aa998..96fc0f32 100644 --- a/thousandeyes-sdk-endpoint-test-results/pyproject.toml +++ b/thousandeyes-sdk-endpoint-test-results/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-endpoint-tests/pyproject.toml b/thousandeyes-sdk-endpoint-tests/pyproject.toml index 28cf8944..79b0880a 100644 --- a/thousandeyes-sdk-endpoint-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-tests/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-instant-tests/pyproject.toml b/thousandeyes-sdk-instant-tests/pyproject.toml index e5a85a9d..2fc2c132 100644 --- a/thousandeyes-sdk-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-instant-tests/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-internet-insights/pyproject.toml b/thousandeyes-sdk-internet-insights/pyproject.toml index b3099aa5..48b6d113 100644 --- a/thousandeyes-sdk-internet-insights/pyproject.toml +++ b/thousandeyes-sdk-internet-insights/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-labels/pyproject.toml b/thousandeyes-sdk-labels/pyproject.toml index a5831ed9..25755949 100644 --- a/thousandeyes-sdk-labels/pyproject.toml +++ b/thousandeyes-sdk-labels/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-snapshots/pyproject.toml b/thousandeyes-sdk-snapshots/pyproject.toml index fe550819..a5d946c1 100644 --- a/thousandeyes-sdk-snapshots/pyproject.toml +++ b/thousandeyes-sdk-snapshots/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-streaming/pyproject.toml b/thousandeyes-sdk-streaming/pyproject.toml index fd84c7a2..08e23423 100644 --- a/thousandeyes-sdk-streaming/pyproject.toml +++ b/thousandeyes-sdk-streaming/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-tags/pyproject.toml b/thousandeyes-sdk-tags/pyproject.toml index 497b8e78..c6bf284c 100644 --- a/thousandeyes-sdk-tags/pyproject.toml +++ b/thousandeyes-sdk-tags/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-test-results/pyproject.toml b/thousandeyes-sdk-test-results/pyproject.toml index d8257ae3..b9127d6c 100644 --- a/thousandeyes-sdk-test-results/pyproject.toml +++ b/thousandeyes-sdk-test-results/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-tests/pyproject.toml b/thousandeyes-sdk-tests/pyproject.toml index 5000626d..3064aa20 100644 --- a/thousandeyes-sdk-tests/pyproject.toml +++ b/thousandeyes-sdk-tests/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-usage/pyproject.toml b/thousandeyes-sdk-usage/pyproject.toml index d4ae4088..1c32a8d7 100644 --- a/thousandeyes-sdk-usage/pyproject.toml +++ b/thousandeyes-sdk-usage/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ ] [tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} +version = {file = ".version"} [project.optional-dependencies] test = [ From b12ba886ac9b531c7e191e25450ec4022de3a1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= Date: Thu, 4 Jul 2024 12:58:17 +0100 Subject: [PATCH 02/13] CP-1897 Fix versioning issue. --- .bumpversion.cfg | 1 + thousandeyes-sdk-core/pyproject.toml | 2 +- .../src/thousandeyes_sdk/core/__init__.py | 25 +++++++++++++++++++ .../src/thousandeyes_sdk/core/version.py | 22 ++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 437dadb3..b3588c82 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,4 +3,5 @@ current_version = 1.0.0 commit = False tag = False +[bumpversion:file:thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py] [bumpversion:file:.version] diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml index 0dbec9ed..9d276ee9 100644 --- a/thousandeyes-sdk-core/pyproject.toml +++ b/thousandeyes-sdk-core/pyproject.toml @@ -18,7 +18,7 @@ where = ["src/"] include = ["thousandeyes_sdk.core"] [tool.setuptools.dynamic] -version = {file = ".version"} +version = {attr = "thousandeyes_sdk.core.__version__"} [project.optional-dependencies] test = [ diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py new file mode 100644 index 00000000..0f9854f3 --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py @@ -0,0 +1,25 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +from . import exceptions +from .api_client import ApiClient +from .api_response import ApiResponse +from .configuration import Configuration +from .version import Version + +import os.path + +__version__ = "1.0.0" diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py new file mode 100644 index 00000000..c7e4c097 --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py @@ -0,0 +1,22 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +import thousandeyes_sdk.core + +class Version: + @staticmethod + def get() -> str: + return thousandeyes_sdk.core.__version__ From ac45a4da593a4b215346c007257c2867d684e2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Thu, 4 Jul 2024 13:21:19 +0100 Subject: [PATCH 03/13] CP-1897 Some more changes to the pyproject. --- thousandeyes-sdk-administrative/pyproject.toml | 3 ++- thousandeyes-sdk-agents/pyproject.toml | 3 ++- thousandeyes-sdk-alerts/pyproject.toml | 3 ++- thousandeyes-sdk-bgp-monitors/pyproject.toml | 3 ++- thousandeyes-sdk-credentials/pyproject.toml | 3 ++- thousandeyes-sdk-dashboards/pyproject.toml | 3 ++- thousandeyes-sdk-endpoint-agents/pyproject.toml | 3 ++- thousandeyes-sdk-endpoint-instant-tests/pyproject.toml | 3 ++- thousandeyes-sdk-endpoint-labels/pyproject.toml | 3 ++- thousandeyes-sdk-endpoint-test-results/pyproject.toml | 3 ++- thousandeyes-sdk-endpoint-tests/pyproject.toml | 3 ++- thousandeyes-sdk-instant-tests/pyproject.toml | 3 ++- thousandeyes-sdk-internet-insights/pyproject.toml | 3 ++- thousandeyes-sdk-labels/pyproject.toml | 3 ++- thousandeyes-sdk-snapshots/pyproject.toml | 3 ++- thousandeyes-sdk-streaming/pyproject.toml | 3 ++- thousandeyes-sdk-tags/pyproject.toml | 3 ++- thousandeyes-sdk-test-results/pyproject.toml | 3 ++- thousandeyes-sdk-tests/pyproject.toml | 3 ++- thousandeyes-sdk-usage/pyproject.toml | 3 ++- 20 files changed, 40 insertions(+), 20 deletions(-) diff --git a/thousandeyes-sdk-administrative/pyproject.toml b/thousandeyes-sdk-administrative/pyproject.toml index 877c5c12..4e64e753 100644 --- a/thousandeyes-sdk-administrative/pyproject.toml +++ b/thousandeyes-sdk-administrative/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-administrative" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Administrative API" +description = "ThousandEyes SDK Administrative API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-agents/pyproject.toml b/thousandeyes-sdk-agents/pyproject.toml index 1e927a85..7e325b16 100644 --- a/thousandeyes-sdk-agents/pyproject.toml +++ b/thousandeyes-sdk-agents/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-agents" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Agents API" +description = "ThousandEyes SDK Agents API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-alerts/pyproject.toml b/thousandeyes-sdk-alerts/pyproject.toml index 9c4c41a6..8cbef3f2 100644 --- a/thousandeyes-sdk-alerts/pyproject.toml +++ b/thousandeyes-sdk-alerts/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-alerts" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Alerts API" +description = "ThousandEyes SDK Alerts API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-bgp-monitors/pyproject.toml b/thousandeyes-sdk-bgp-monitors/pyproject.toml index 8813ab92..0d16ebb5 100644 --- a/thousandeyes-sdk-bgp-monitors/pyproject.toml +++ b/thousandeyes-sdk-bgp-monitors/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-bgp-monitors" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "BGP Monitors API" +description = "ThousandEyes SDK BGP Monitors API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-credentials/pyproject.toml b/thousandeyes-sdk-credentials/pyproject.toml index 27296bd1..612bdd5a 100644 --- a/thousandeyes-sdk-credentials/pyproject.toml +++ b/thousandeyes-sdk-credentials/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-credentials" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Credentials API" +description = "ThousandEyes SDK Credentials API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-dashboards/pyproject.toml b/thousandeyes-sdk-dashboards/pyproject.toml index 0f0f3b95..f14d0af5 100644 --- a/thousandeyes-sdk-dashboards/pyproject.toml +++ b/thousandeyes-sdk-dashboards/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-dashboards" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Dashboards API" +description = "ThousandEyes SDK Dashboards API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-endpoint-agents/pyproject.toml b/thousandeyes-sdk-endpoint-agents/pyproject.toml index 56de2826..68de3f19 100644 --- a/thousandeyes-sdk-endpoint-agents/pyproject.toml +++ b/thousandeyes-sdk-endpoint-agents/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-endpoint-agents" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Endpoint Agents API" +description = "ThousandEyes SDK Endpoint Agents API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml index dc0e034b..6ad396da 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-endpoint-instant-tests" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Endpoint Instant Scheduled Tests API" +description = "ThousandEyes SDK Endpoint Instant Scheduled Tests API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-endpoint-labels/pyproject.toml b/thousandeyes-sdk-endpoint-labels/pyproject.toml index 5c8502f3..1d223f7d 100644 --- a/thousandeyes-sdk-endpoint-labels/pyproject.toml +++ b/thousandeyes-sdk-endpoint-labels/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-endpoint-labels" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Endpoint Agent Labels API" +description = "ThousandEyes SDK Endpoint Agent Labels API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-endpoint-test-results/pyproject.toml b/thousandeyes-sdk-endpoint-test-results/pyproject.toml index 96fc0f32..af87f9a9 100644 --- a/thousandeyes-sdk-endpoint-test-results/pyproject.toml +++ b/thousandeyes-sdk-endpoint-test-results/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-endpoint-test-results" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Endpoint Test Results API" +description = "ThousandEyes SDK Endpoint Test Results API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-endpoint-tests/pyproject.toml b/thousandeyes-sdk-endpoint-tests/pyproject.toml index 79b0880a..e39e983a 100644 --- a/thousandeyes-sdk-endpoint-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-tests/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-endpoint-tests" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Endpoint Tests API" +description = "ThousandEyes SDK Endpoint Tests API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-instant-tests/pyproject.toml b/thousandeyes-sdk-instant-tests/pyproject.toml index 2fc2c132..1401c06c 100644 --- a/thousandeyes-sdk-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-instant-tests/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-instant-tests" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Instant Tests API" +description = "ThousandEyes SDK Instant Tests API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-internet-insights/pyproject.toml b/thousandeyes-sdk-internet-insights/pyproject.toml index 48b6d113..574d9ec9 100644 --- a/thousandeyes-sdk-internet-insights/pyproject.toml +++ b/thousandeyes-sdk-internet-insights/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-internet-insights" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Internet Insights API" +description = "ThousandEyes SDK Internet Insights API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-labels/pyproject.toml b/thousandeyes-sdk-labels/pyproject.toml index 25755949..e36bb63b 100644 --- a/thousandeyes-sdk-labels/pyproject.toml +++ b/thousandeyes-sdk-labels/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-labels" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Labels API" +description = "ThousandEyes SDK Labels API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-snapshots/pyproject.toml b/thousandeyes-sdk-snapshots/pyproject.toml index a5d946c1..22e2377b 100644 --- a/thousandeyes-sdk-snapshots/pyproject.toml +++ b/thousandeyes-sdk-snapshots/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-snapshots" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Test Snapshots API" +description = "ThousandEyes SDK Test Snapshots API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-streaming/pyproject.toml b/thousandeyes-sdk-streaming/pyproject.toml index 08e23423..417ddf6a 100644 --- a/thousandeyes-sdk-streaming/pyproject.toml +++ b/thousandeyes-sdk-streaming/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-streaming" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "ThousandEyes for OpenTelemetry API" +description = "ThousandEyes SDK ThousandEyes for OpenTelemetry API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-tags/pyproject.toml b/thousandeyes-sdk-tags/pyproject.toml index c6bf284c..6cf4ee15 100644 --- a/thousandeyes-sdk-tags/pyproject.toml +++ b/thousandeyes-sdk-tags/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-tags" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Tags API" +description = "ThousandEyes SDK Tags API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-test-results/pyproject.toml b/thousandeyes-sdk-test-results/pyproject.toml index b9127d6c..f3b0235c 100644 --- a/thousandeyes-sdk-test-results/pyproject.toml +++ b/thousandeyes-sdk-test-results/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-test-results" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Test Results API" +description = "ThousandEyes SDK Test Results API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-tests/pyproject.toml b/thousandeyes-sdk-tests/pyproject.toml index 3064aa20..74cd78e2 100644 --- a/thousandeyes-sdk-tests/pyproject.toml +++ b/thousandeyes-sdk-tests/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-tests" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Tests API" +description = "ThousandEyes SDK Tests API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", diff --git a/thousandeyes-sdk-usage/pyproject.toml b/thousandeyes-sdk-usage/pyproject.toml index 1c32a8d7..dce72892 100644 --- a/thousandeyes-sdk-usage/pyproject.toml +++ b/thousandeyes-sdk-usage/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "thousandeyes-sdk-usage" dynamic = ["version"] +readme = "README.md" authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] -description = "Usage API" +description = "ThousandEyes SDK Usage API" license = { text = "../LICENSE" } dependencies = [ "urllib3 >= 1.25.3", From bcfd6c62c8ecfb5e0dbae9b6648d63b58bca7f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Thu, 4 Jul 2024 13:22:35 +0100 Subject: [PATCH 04/13] CP-1897 Add dummy Readme. --- thousandeyes-sdk-core/README.md | 2 ++ thousandeyes-sdk-core/pyproject.toml | 1 + 2 files changed, 3 insertions(+) create mode 100644 thousandeyes-sdk-core/README.md diff --git a/thousandeyes-sdk-core/README.md b/thousandeyes-sdk-core/README.md new file mode 100644 index 00000000..7620fcc1 --- /dev/null +++ b/thousandeyes-sdk-core/README.md @@ -0,0 +1,2 @@ +# thousandeyes-sdk-core + diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml index 9d276ee9..69c20656 100644 --- a/thousandeyes-sdk-core/pyproject.toml +++ b/thousandeyes-sdk-core/pyproject.toml @@ -1,5 +1,6 @@ [project] name = "thousandeyes-sdk-core" +readme = "README.md" dynamic = ["version"] authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } From e907baff69e5a2618e06336c15cad391aafaccaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Fri, 5 Jul 2024 10:44:22 +0100 Subject: [PATCH 05/13] CP-1897 Changed license file. --- .github/workflows/release.yaml | 72 +++++++++++++++++++ test.py | 29 ++++++++ .../pyproject.toml | 2 +- thousandeyes-sdk-agents/pyproject.toml | 2 +- thousandeyes-sdk-alerts/pyproject.toml | 2 +- thousandeyes-sdk-bgp-monitors/pyproject.toml | 2 +- thousandeyes-sdk-core/pyproject.toml | 2 +- thousandeyes-sdk-credentials/pyproject.toml | 2 +- thousandeyes-sdk-dashboards/pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- .../pyproject.toml | 2 +- thousandeyes-sdk-instant-tests/pyproject.toml | 2 +- .../pyproject.toml | 2 +- thousandeyes-sdk-labels/pyproject.toml | 2 +- thousandeyes-sdk-snapshots/pyproject.toml | 2 +- thousandeyes-sdk-streaming/pyproject.toml | 2 +- thousandeyes-sdk-tags/pyproject.toml | 2 +- thousandeyes-sdk-test-results/pyproject.toml | 2 +- thousandeyes-sdk-tests/pyproject.toml | 2 +- thousandeyes-sdk-usage/pyproject.toml | 2 +- 23 files changed, 122 insertions(+), 21 deletions(-) create mode 100644 test.py diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8b137891..3ec632d3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1 +1,73 @@ +name: Release +on: + pull_request: + types: + - closed +jobs: + set-package-matrix: + # This action returns all sub-packages to be published, except the `thousandeyes-sdk-core`. + # It thens exports the variable to matrix, so that the deployment job is run individually for each sub-package + runs-on: ubuntu-latest + outputs: + packages: ${{ steps.packages.outputs.packages }} + steps: + - uses: actions/checkout@v4 + - id: packages + run: | + FOLDERS_JSON=$(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" ! -name "thousandeyes-sdk-core"| cut -c 3- | jq -R -s -c 'split("\n")[:-1]') + echo "packages=$FOLDERS_JSON" >> "$GITHUB_OUTPUT" + deployment: + if: github.event.pull_request.merged == true + needs: set-package-matrix + strategy: + matrix: + package-name: ${{ fromJSON(needs.set-package-matrix.outputs.packages) }} + runs-on: ubuntu-latest + permissions: + id-token: write + environment: + name: test + url: https://pypi.org/p/${{ matrix.package-name }} + steps: + - uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.TEST_PAT }} + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: pip + cache-dependency-path: '**/pyproject.toml' + - name: Install dependencies + run: | + pip install setuptools wheel build + - name: Build + run: | + cp .version ${{ matrix.package-name }}/ + python -m build ${{ matrix.package-name }} --outdir dist/ + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + bump-version: + needs: deployment + name: Bump version and commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: pip + python-version: '3.11' + - name: Install bumpversion + env: + GITHUB_TOKEN: ${{ secrets.PAT_COMMIT_TO_MAIN }} + run: | + git config user.name "API Team" + git config user.email "api-team@thousandeyes.com" + + pip install bumpversion + bumpversion minor --commit + git push --force diff --git a/test.py b/test.py new file mode 100644 index 00000000..0e1273aa --- /dev/null +++ b/test.py @@ -0,0 +1,29 @@ +import thousandeyes_sdk.core +import thousandeyes_sdk.usage +from thousandeyes_sdk.core.exceptions import ApiException +from pprint import pprint + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token='8b919a53-6977-4d19-92a7-3615a20836b2', + host='https://api.stg.thousandeyes.com' +) + + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.usage.UsageApi(api_client) + + try: + # Create or update accout group quotas + api_response = api_instance.get_usage(aid="85486") + print("The response of UsageApi->assign_organizations_account_groups_quotas:\n") + pprint(api_response) + except ApiException as e: + print("Exception when calling QuotasApi->assign_organizations_account_groups_quotas: %s\n" % e) diff --git a/thousandeyes-sdk-administrative/pyproject.toml b/thousandeyes-sdk-administrative/pyproject.toml index 4e64e753..01074bbf 100644 --- a/thousandeyes-sdk-administrative/pyproject.toml +++ b/thousandeyes-sdk-administrative/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Administrative API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-agents/pyproject.toml b/thousandeyes-sdk-agents/pyproject.toml index 7e325b16..0be3ed44 100644 --- a/thousandeyes-sdk-agents/pyproject.toml +++ b/thousandeyes-sdk-agents/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Agents API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-alerts/pyproject.toml b/thousandeyes-sdk-alerts/pyproject.toml index 8cbef3f2..1d837987 100644 --- a/thousandeyes-sdk-alerts/pyproject.toml +++ b/thousandeyes-sdk-alerts/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Alerts API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-bgp-monitors/pyproject.toml b/thousandeyes-sdk-bgp-monitors/pyproject.toml index 0d16ebb5..fd98f085 100644 --- a/thousandeyes-sdk-bgp-monitors/pyproject.toml +++ b/thousandeyes-sdk-bgp-monitors/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK BGP Monitors API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml index 69c20656..0f92d138 100644 --- a/thousandeyes-sdk-core/pyproject.toml +++ b/thousandeyes-sdk-core/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Core" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-credentials/pyproject.toml b/thousandeyes-sdk-credentials/pyproject.toml index 612bdd5a..c12cb37f 100644 --- a/thousandeyes-sdk-credentials/pyproject.toml +++ b/thousandeyes-sdk-credentials/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Credentials API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-dashboards/pyproject.toml b/thousandeyes-sdk-dashboards/pyproject.toml index f14d0af5..a5cade04 100644 --- a/thousandeyes-sdk-dashboards/pyproject.toml +++ b/thousandeyes-sdk-dashboards/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Dashboards API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-agents/pyproject.toml b/thousandeyes-sdk-endpoint-agents/pyproject.toml index 68de3f19..353b6e75 100644 --- a/thousandeyes-sdk-endpoint-agents/pyproject.toml +++ b/thousandeyes-sdk-endpoint-agents/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Endpoint Agents API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml index 6ad396da..d02d1f41 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Endpoint Instant Scheduled Tests API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-labels/pyproject.toml b/thousandeyes-sdk-endpoint-labels/pyproject.toml index 1d223f7d..07d6bec7 100644 --- a/thousandeyes-sdk-endpoint-labels/pyproject.toml +++ b/thousandeyes-sdk-endpoint-labels/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Endpoint Agent Labels API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-test-results/pyproject.toml b/thousandeyes-sdk-endpoint-test-results/pyproject.toml index af87f9a9..d2264611 100644 --- a/thousandeyes-sdk-endpoint-test-results/pyproject.toml +++ b/thousandeyes-sdk-endpoint-test-results/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Endpoint Test Results API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-tests/pyproject.toml b/thousandeyes-sdk-endpoint-tests/pyproject.toml index e39e983a..9a98aaf1 100644 --- a/thousandeyes-sdk-endpoint-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-tests/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Endpoint Tests API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-instant-tests/pyproject.toml b/thousandeyes-sdk-instant-tests/pyproject.toml index 1401c06c..61d7eac0 100644 --- a/thousandeyes-sdk-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-instant-tests/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Instant Tests API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-internet-insights/pyproject.toml b/thousandeyes-sdk-internet-insights/pyproject.toml index 574d9ec9..8f12f446 100644 --- a/thousandeyes-sdk-internet-insights/pyproject.toml +++ b/thousandeyes-sdk-internet-insights/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Internet Insights API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-labels/pyproject.toml b/thousandeyes-sdk-labels/pyproject.toml index e36bb63b..41dd080b 100644 --- a/thousandeyes-sdk-labels/pyproject.toml +++ b/thousandeyes-sdk-labels/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Labels API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-snapshots/pyproject.toml b/thousandeyes-sdk-snapshots/pyproject.toml index 22e2377b..e07c9888 100644 --- a/thousandeyes-sdk-snapshots/pyproject.toml +++ b/thousandeyes-sdk-snapshots/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Test Snapshots API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-streaming/pyproject.toml b/thousandeyes-sdk-streaming/pyproject.toml index 417ddf6a..a6ebf7f2 100644 --- a/thousandeyes-sdk-streaming/pyproject.toml +++ b/thousandeyes-sdk-streaming/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK ThousandEyes for OpenTelemetry API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-tags/pyproject.toml b/thousandeyes-sdk-tags/pyproject.toml index 6cf4ee15..4f25cf6a 100644 --- a/thousandeyes-sdk-tags/pyproject.toml +++ b/thousandeyes-sdk-tags/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Tags API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-test-results/pyproject.toml b/thousandeyes-sdk-test-results/pyproject.toml index f3b0235c..fa92c493 100644 --- a/thousandeyes-sdk-test-results/pyproject.toml +++ b/thousandeyes-sdk-test-results/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Test Results API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-tests/pyproject.toml b/thousandeyes-sdk-tests/pyproject.toml index 74cd78e2..7927ad94 100644 --- a/thousandeyes-sdk-tests/pyproject.toml +++ b/thousandeyes-sdk-tests/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Tests API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-usage/pyproject.toml b/thousandeyes-sdk-usage/pyproject.toml index dce72892..90564229 100644 --- a/thousandeyes-sdk-usage/pyproject.toml +++ b/thousandeyes-sdk-usage/pyproject.toml @@ -6,7 +6,7 @@ authors = [ { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } ] description = "ThousandEyes SDK Usage API" -license = { text = "../LICENSE" } +license = { file = "LICENSE" } dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", From b54b0099373dff1fc5dfdeedbf9fe55463b3acd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:45:22 +0100 Subject: [PATCH 06/13] Update release.yaml --- .github/workflows/release.yaml | 72 ---------------------------------- 1 file changed, 72 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3ec632d3..8b137891 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,73 +1 @@ -name: Release -on: - pull_request: - types: - - closed -jobs: - set-package-matrix: - # This action returns all sub-packages to be published, except the `thousandeyes-sdk-core`. - # It thens exports the variable to matrix, so that the deployment job is run individually for each sub-package - runs-on: ubuntu-latest - outputs: - packages: ${{ steps.packages.outputs.packages }} - steps: - - uses: actions/checkout@v4 - - id: packages - run: | - FOLDERS_JSON=$(find . -maxdepth 1 -type d -name "thousandeyes-sdk-*" ! -name "thousandeyes-sdk-core"| cut -c 3- | jq -R -s -c 'split("\n")[:-1]') - echo "packages=$FOLDERS_JSON" >> "$GITHUB_OUTPUT" - deployment: - if: github.event.pull_request.merged == true - needs: set-package-matrix - strategy: - matrix: - package-name: ${{ fromJSON(needs.set-package-matrix.outputs.packages) }} - runs-on: ubuntu-latest - permissions: - id-token: write - environment: - name: test - url: https://pypi.org/p/${{ matrix.package-name }} - steps: - - uses: actions/checkout@v4 - with: - ref: main - token: ${{ secrets.TEST_PAT }} - - name: Set up Python - uses: actions/setup-python@v5 - with: - cache: pip - cache-dependency-path: '**/pyproject.toml' - - name: Install dependencies - run: | - pip install setuptools wheel build - - name: Build - run: | - cp .version ${{ matrix.package-name }}/ - python -m build ${{ matrix.package-name }} --outdir dist/ - - name: Publish - uses: pypa/gh-action-pypi-publish@release/v1 - with: - skip-existing: true - bump-version: - needs: deployment - name: Bump version and commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - cache: pip - python-version: '3.11' - - name: Install bumpversion - env: - GITHUB_TOKEN: ${{ secrets.PAT_COMMIT_TO_MAIN }} - run: | - git config user.name "API Team" - git config user.email "api-team@thousandeyes.com" - - pip install bumpversion - bumpversion minor --commit - git push --force From e43cbf99ee4c380320634a5b0f63a1acc370790c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:45:43 +0100 Subject: [PATCH 07/13] Delete test.py --- test.py | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index 0e1273aa..00000000 --- a/test.py +++ /dev/null @@ -1,29 +0,0 @@ -import thousandeyes_sdk.core -import thousandeyes_sdk.usage -from thousandeyes_sdk.core.exceptions import ApiException -from pprint import pprint - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure Bearer authorization: BearerAuth -configuration = thousandeyes_sdk.core.Configuration( - access_token='8b919a53-6977-4d19-92a7-3615a20836b2', - host='https://api.stg.thousandeyes.com' -) - - -# Enter a context with an instance of the API client -with thousandeyes_sdk.core.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = thousandeyes_sdk.usage.UsageApi(api_client) - - try: - # Create or update accout group quotas - api_response = api_instance.get_usage(aid="85486") - print("The response of UsageApi->assign_organizations_account_groups_quotas:\n") - pprint(api_response) - except ApiException as e: - print("Exception when calling QuotasApi->assign_organizations_account_groups_quotas: %s\n" % e) From 92594366d233e96f24433f55d2abb155611eb737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mal=C3=A9s?= <85952626+joaomper-TE@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:26:12 +0100 Subject: [PATCH 08/13] Update README.md --- thousandeyes-sdk-core/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/thousandeyes-sdk-core/README.md b/thousandeyes-sdk-core/README.md index 7620fcc1..0999e656 100644 --- a/thousandeyes-sdk-core/README.md +++ b/thousandeyes-sdk-core/README.md @@ -1,2 +1,3 @@ # thousandeyes-sdk-core +This package provides core functionality for interacting with the ThousandEyes API and should be installed before using any of the published SDKs. From 294144fecaa73609af0b515917cc5ebeeee38aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Mon, 8 Jul 2024 10:50:09 +0100 Subject: [PATCH 09/13] CP-1897 Change versioning mechanism --- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-administrative/README.md | 2 +- .../administrative/api/account_groups_api.py | 4 +- .../administrative/api/permissions_api.py | 4 +- .../administrative/api/roles_api.py | 4 +- .../administrative/api/user_events_api.py | 4 +- .../administrative/api/users_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-agents/README.md | 2 +- ...enterprise_agent_notification_rules_api.py | 4 +- .../api/cloud_and_enterprise_agents_api.py | 4 +- .../api/enterprise_agent_cluster_api.py | 4 +- .../agents/api/proxies_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-alerts/README.md | 2 +- .../alerts/api/alert_rules_api.py | 4 +- .../api/alert_suppression_windows_api.py | 4 +- .../thousandeyes_sdk/alerts/api/alerts_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-bgp-monitors/README.md | 2 +- .../bgp_monitors/api/list_bgp_monitors_api.py | 4 +- thousandeyes-sdk-core/README.md | 3 - thousandeyes-sdk-core/pyproject.toml | 82 -- .../src/thousandeyes_sdk/core/__init__.py | 25 - .../src/thousandeyes_sdk/core/api_client.py | 766 ------------------ .../src/thousandeyes_sdk/core/api_response.py | 37 - .../thousandeyes_sdk/core/configuration.py | 452 ----------- .../src/thousandeyes_sdk/core/exceptions.py | 211 ----- .../src/thousandeyes_sdk/core/py.typed | 0 .../src/thousandeyes_sdk/core/rest.py | 258 ------ .../core/thousandeyes_retry.py | 80 -- .../src/thousandeyes_sdk/core/version.py | 22 - .../.openapi-generator/FILES | 1 - thousandeyes-sdk-credentials/README.md | 2 +- .../credentials/api/credentials_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-dashboards/README.md | 2 +- .../dashboards/api/dashboard_snapshots_api.py | 4 +- .../dashboards/api/dashboards_api.py | 4 +- .../dashboards/api/dashboards_filters_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-endpoint-agents/README.md | 2 +- .../api/administrative_endpoints_api.py | 4 +- .../endpoint_agents/api/manage_agents_api.py | 4 +- .../endpoint_agents/api/transfer_api.py | 4 +- .../.openapi-generator/FILES | 1 - .../README.md | 2 +- ...nt_to_server_instant_scheduled_test_api.py | 4 +- .../http_server_instant_scheduled_test_api.py | 4 +- .../api/run_existing_test_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-endpoint-labels/README.md | 2 +- .../endpoint_labels/api/manage_labels_api.py | 4 +- .../.openapi-generator/FILES | 1 - .../README.md | 2 +- .../api/local_network_tests_results_api.py | 4 +- .../api/network_dynamic_tests_results_api.py | 4 +- .../network_scheduled_tests_results_api.py | 4 +- .../api/real_user_tests_results_api.py | 4 +- ..._http_server_scheduled_test_results_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-endpoint-tests/README.md | 2 +- .../api/dynamic_tests_agent_to_server_api.py | 4 +- .../api/list_endpoint_scheduled_tests_api.py | 4 +- .../scheduled_tests_agent_to_server_api.py | 4 +- .../api/scheduled_tests_http_server_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-instant-tests/README.md | 2 +- .../instant_tests/api/agent_to_agent_api.py | 4 +- .../instant_tests/api/agent_to_server_api.py | 4 +- .../instant_tests/api/api_api.py | 4 +- .../instant_tests/api/dns_security_api.py | 4 +- .../instant_tests/api/dns_server_api.py | 4 +- .../instant_tests/api/dns_trace_api.py | 4 +- .../instant_tests/api/ftp_server_api.py | 4 +- .../instant_tests/api/http_page_load_api.py | 4 +- .../instant_tests/api/http_server_api.py | 4 +- .../instant_tests/api/run_api.py | 4 +- .../instant_tests/api/sip_server_api.py | 4 +- .../instant_tests/api/voice_api.py | 4 +- .../instant_tests/api/web_transaction_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-internet-insights/README.md | 2 +- .../api/catalog_providers_api.py | 4 +- .../api/outages_api_public_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-labels/README.md | 2 +- .../thousandeyes_sdk/labels/api/agent_api.py | 4 +- .../labels/api/all_labels_api.py | 4 +- .../labels/api/dashboard_api.py | 4 +- .../labels/api/endpoint_test_api.py | 4 +- .../thousandeyes_sdk/labels/api/test_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-snapshots/README.md | 2 +- .../snapshots/api/create_test_snapshot_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-streaming/README.md | 2 +- .../streaming/api/streaming_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-tags/README.md | 2 +- .../tags/api/tag_assignment_api.py | 4 +- .../src/thousandeyes_sdk/tags/api/tags_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-test-results/README.md | 2 +- .../test_results/api/api_test_metrics_api.py | 4 +- .../api/dns_server_test_metrics_api.py | 4 +- .../api/dns_trace_test_metrics_api.py | 4 +- .../api/dnssec_test_metrics_api.py | 4 +- .../api/network_bgp_test_metrics_api.py | 4 +- .../api/network_test_metrics_api.py | 4 +- .../api/voice_rtp_server_test_metrics_api.py | 4 +- .../api/voice_sip_server_test_metrics_api.py | 4 +- .../api/web_ftp_server_test_metrics_api.py | 4 +- .../api/web_http_server_test_metrics_api.py | 4 +- .../api/web_page_load_test_metrics_api.py | 4 +- .../api/web_transactions_test_metrics_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-tests/README.md | 2 +- .../tests/api/agent_to_agent_api.py | 4 +- .../tests/api/agent_to_server_api.py | 4 +- .../tests/api/all_test_types_api.py | 4 +- .../src/thousandeyes_sdk/tests/api/api_api.py | 4 +- .../src/thousandeyes_sdk/tests/api/bgp_api.py | 4 +- .../tests/api/dns_server_api.py | 4 +- .../tests/api/dns_trace_api.py | 4 +- .../thousandeyes_sdk/tests/api/dnssec_api.py | 4 +- .../tests/api/ftp_server_api.py | 4 +- .../tests/api/http_server_api.py | 4 +- .../tests/api/page_load_api.py | 4 +- ...path_visualization_interface_groups_api.py | 4 +- .../tests/api/sip_server_api.py | 4 +- .../thousandeyes_sdk/tests/api/voice_api.py | 4 +- .../tests/api/web_transaction_api.py | 4 +- .../.openapi-generator/FILES | 1 - thousandeyes-sdk-usage/README.md | 2 +- .../thousandeyes_sdk/usage/api/quotas_api.py | 4 +- .../thousandeyes_sdk/usage/api/usage_api.py | 4 +- 137 files changed, 192 insertions(+), 2148 deletions(-) delete mode 100644 thousandeyes-sdk-core/README.md delete mode 100644 thousandeyes-sdk-core/pyproject.toml delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/py.typed delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py delete mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py diff --git a/thousandeyes-sdk-administrative/.openapi-generator/FILES b/thousandeyes-sdk-administrative/.openapi-generator/FILES index 9538038e..855be3da 100644 --- a/thousandeyes-sdk-administrative/.openapi-generator/FILES +++ b/thousandeyes-sdk-administrative/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AccountGroup.md docs/AccountGroupDetail.md diff --git a/thousandeyes-sdk-administrative/README.md b/thousandeyes-sdk-administrative/README.md index e8716fe6..db1ce405 100644 --- a/thousandeyes-sdk-administrative/README.md +++ b/thousandeyes-sdk-administrative/README.md @@ -18,7 +18,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/account_groups_api.py b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/account_groups_api.py index b6f0afaa..923d8a0a 100644 --- a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/account_groups_api.py +++ b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/account_groups_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.administrative.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.administrative.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AccountGroupsApi: @@ -43,7 +43,7 @@ class AccountGroupsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-administrative")) self.api_client = api_client diff --git a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/permissions_api.py b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/permissions_api.py index 3fb6958a..15a69fe0 100644 --- a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/permissions_api.py +++ b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/permissions_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.administrative.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.administrative.models.permissions import Permissions from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class PermissionsApi: @@ -39,7 +39,7 @@ class PermissionsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-administrative")) self.api_client = api_client diff --git a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/roles_api.py b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/roles_api.py index bfad6d08..c8cddd6c 100644 --- a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/roles_api.py +++ b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/roles_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.administrative.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.administrative.models.roles import Roles from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class RolesApi: @@ -41,7 +41,7 @@ class RolesApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-administrative")) self.api_client = api_client diff --git a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/user_events_api.py b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/user_events_api.py index 1119d19e..88703fb6 100644 --- a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/user_events_api.py +++ b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/user_events_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.administrative.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.administrative.models.audit_user_events import AuditUserEv from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class UserEventsApi: @@ -40,7 +40,7 @@ class UserEventsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-administrative")) self.api_client = api_client diff --git a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/users_api.py b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/users_api.py index 624c2b76..7a5d2d98 100644 --- a/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/users_api.py +++ b/thousandeyes-sdk-administrative/src/thousandeyes_sdk/administrative/api/users_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.administrative.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.administrative.models.users import Users from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class UsersApi: @@ -42,7 +42,7 @@ class UsersApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-administrative")) self.api_client = api_client diff --git a/thousandeyes-sdk-agents/.openapi-generator/FILES b/thousandeyes-sdk-agents/.openapi-generator/FILES index a7a6dd40..da98083f 100644 --- a/thousandeyes-sdk-agents/.openapi-generator/FILES +++ b/thousandeyes-sdk-agents/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AccountGroup.md docs/Agent.md diff --git a/thousandeyes-sdk-agents/README.md b/thousandeyes-sdk-agents/README.md index edb473a1..f5a3da08 100644 --- a/thousandeyes-sdk-agents/README.md +++ b/thousandeyes-sdk-agents/README.md @@ -11,7 +11,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agent_notification_rules_api.py b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agent_notification_rules_api.py index 7a236531..baf0ca33 100644 --- a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agent_notification_rules_api.py +++ b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agent_notification_rules_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.agents.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.agents.models.notification_rule_detail import Notification from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class CloudAndEnterpriseAgentNotificationRulesApi: @@ -40,7 +40,7 @@ class CloudAndEnterpriseAgentNotificationRulesApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agents_api.py b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agents_api.py index e9fdce0a..71260218 100644 --- a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agents_api.py +++ b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/cloud_and_enterprise_agents_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.agents.models @@ -31,7 +32,6 @@ from thousandeyes_sdk.agents.models.cloud_enterprise_agents import CloudEnterpri from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class CloudAndEnterpriseAgentsApi: @@ -44,7 +44,7 @@ class CloudAndEnterpriseAgentsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/enterprise_agent_cluster_api.py b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/enterprise_agent_cluster_api.py index 946b476c..b1ca814b 100644 --- a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/enterprise_agent_cluster_api.py +++ b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/enterprise_agent_cluster_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.agents.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.agents.models.cloud_enterprise_agents import CloudEnterpri from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class EnterpriseAgentClusterApi: @@ -43,7 +43,7 @@ class EnterpriseAgentClusterApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/proxies_api.py b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/proxies_api.py index a8ff4b59..35cd95a9 100644 --- a/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/proxies_api.py +++ b/thousandeyes-sdk-agents/src/thousandeyes_sdk/agents/api/proxies_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.agents.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.agents.models.agent_proxies import AgentProxies from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ProxiesApi: @@ -39,7 +39,7 @@ class ProxiesApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-alerts/.openapi-generator/FILES b/thousandeyes-sdk-alerts/.openapi-generator/FILES index 73ece852..0b9aa300 100644 --- a/thousandeyes-sdk-alerts/.openapi-generator/FILES +++ b/thousandeyes-sdk-alerts/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/Alert.md docs/AlertDetail.md diff --git a/thousandeyes-sdk-alerts/README.md b/thousandeyes-sdk-alerts/README.md index ff6aca92..a80b5d2d 100644 --- a/thousandeyes-sdk-alerts/README.md +++ b/thousandeyes-sdk-alerts/README.md @@ -18,7 +18,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_rules_api.py b/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_rules_api.py index f9636710..d9279388 100644 --- a/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_rules_api.py +++ b/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_rules_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.alerts.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.alerts.models.rules import Rules from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AlertRulesApi: @@ -42,7 +42,7 @@ class AlertRulesApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-alerts")) self.api_client = api_client diff --git a/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_suppression_windows_api.py b/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_suppression_windows_api.py index d3cf2ae3..b465a9a1 100644 --- a/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_suppression_windows_api.py +++ b/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alert_suppression_windows_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.alerts.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.alerts.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AlertSuppressionWindowsApi: @@ -42,7 +42,7 @@ class AlertSuppressionWindowsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-alerts")) self.api_client = api_client diff --git a/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alerts_api.py b/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alerts_api.py index eeafeff2..6b44edb0 100644 --- a/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alerts_api.py +++ b/thousandeyes-sdk-alerts/src/thousandeyes_sdk/alerts/api/alerts_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.alerts.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.alerts.models.alerts import Alerts from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AlertsApi: @@ -41,7 +41,7 @@ class AlertsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-alerts")) self.api_client = api_client diff --git a/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES b/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES index 7e5275f8..e668e76e 100644 --- a/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES +++ b/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/Error.md docs/Link.md diff --git a/thousandeyes-sdk-bgp-monitors/README.md b/thousandeyes-sdk-bgp-monitors/README.md index f1be68d5..1e5b647c 100644 --- a/thousandeyes-sdk-bgp-monitors/README.md +++ b/thousandeyes-sdk-bgp-monitors/README.md @@ -15,7 +15,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-bgp-monitors/src/thousandeyes_sdk/bgp_monitors/api/list_bgp_monitors_api.py b/thousandeyes-sdk-bgp-monitors/src/thousandeyes_sdk/bgp_monitors/api/list_bgp_monitors_api.py index d6a99248..5bffffae 100644 --- a/thousandeyes-sdk-bgp-monitors/src/thousandeyes_sdk/bgp_monitors/api/list_bgp_monitors_api.py +++ b/thousandeyes-sdk-bgp-monitors/src/thousandeyes_sdk/bgp_monitors/api/list_bgp_monitors_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.bgp_monitors.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.bgp_monitors.models.monitors import Monitors from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ListBGPMonitorsApi: @@ -39,7 +39,7 @@ class ListBGPMonitorsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-bgp-monitors")) self.api_client = api_client diff --git a/thousandeyes-sdk-core/README.md b/thousandeyes-sdk-core/README.md deleted file mode 100644 index 0999e656..00000000 --- a/thousandeyes-sdk-core/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# thousandeyes-sdk-core - -This package provides core functionality for interacting with the ThousandEyes API and should be installed before using any of the published SDKs. diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml deleted file mode 100644 index 0f92d138..00000000 --- a/thousandeyes-sdk-core/pyproject.toml +++ /dev/null @@ -1,82 +0,0 @@ -[project] -name = "thousandeyes-sdk-core" -readme = "README.md" -dynamic = ["version"] -authors = [ - { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } -] -description = "ThousandEyes SDK Core" -license = { file = "LICENSE" } -dependencies = [ - "urllib3 >= 1.25.3", - "python-dateutil >=2.8.2", - "pydantic >=2", - "typing-extensions >=4.7.1", -] - -[tool.setuptools.packages.find] -where = ["src/"] -include = ["thousandeyes_sdk.core"] - -[tool.setuptools.dynamic] -version = {attr = "thousandeyes_sdk.core.__version__"} - -[project.optional-dependencies] -test = [ - "pytest~=7.1.3", - "pytest-cov>=2.8.1", - "pytest-randomly>=3.12.0", - "mypy>=1.4.1", - "types-python-dateutil>=2.8.19", -] -dev = [ - "flake8>=4.0.0", - "mypy>=1.4.1", - "types-python-dateutil>=2.8.19", -] - -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[tool.pylint.'MESSAGES CONTROL'] -extension-pkg-whitelist = "pydantic" - -[tool.mypy] -files = [ - "src", - #"test", # auto-generated tests - #"tests", # hand-written tests -] -namespace_packages = true -# TODO: enable "strict" once all these individual checks are passing -# strict = true - -# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options -warn_unused_configs = true -warn_redundant_casts = true -warn_unused_ignores = true - -## Getting these passing should be easy -strict_equality = true -strict_concatenate = true - -## Strongly recommend enabling this one as soon as you can -check_untyped_defs = true - -## These shouldn't be too much additional work, but may be tricky to -## get passing if you use a lot of untyped libraries -disallow_subclassing_any = true -disallow_untyped_decorators = true -disallow_any_generics = true - -### These next few are various gradations of forcing use of type annotations -#disallow_untyped_calls = true -#disallow_incomplete_defs = true -#disallow_untyped_defs = true -# -### This one isn't too hard to get passing, but return on investment is lower -#no_implicit_reexport = true -# -### This one can be tricky to get passing if you use a lot of untyped libraries -#warn_return_any = true diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py deleted file mode 100644 index 0f9854f3..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -from . import exceptions -from .api_client import ApiClient -from .api_response import ApiResponse -from .configuration import Configuration -from .version import Version - -import os.path - -__version__ = "1.0.0" diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py deleted file mode 100644 index d8305ed4..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py +++ /dev/null @@ -1,766 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -import datetime -import json -import mimetypes -import os -import re -import tempfile -from enum import Enum -from typing import Tuple, Optional, List, Dict, Union -from urllib.parse import quote - -from dateutil.parser import parse -from pydantic import SecretStr -from thousandeyes_sdk.core import rest -from thousandeyes_sdk.core.api_response import ApiResponse, T as ApiResponseT -from thousandeyes_sdk.core.configuration import Configuration -from thousandeyes_sdk.core.exceptions import ( - ApiValueError, - ApiException -) - -RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] - - -class ApiClient: - """Generic API client for OpenAPI client library builds. - - OpenAPI 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 OpenAPI - templates. - - :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, str, int) - NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int, # TODO remove as only py3 is supported? - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, - } - _pool = None - - def __init__( - self, - configuration=None, - header_name=None, - header_value=None, - cookie=None - ) -> None: - # use default configuration if none is provided - if configuration is None: - configuration = Configuration.get_default() - self.configuration = configuration - - 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 - self.client_side_validation = configuration.client_side_validation - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, traceback): - pass - - @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 - - _default = None - - @classmethod - def get_default(cls): - """Return new instance of ApiClient. - - This method returns newly created, based on default constructor, - object of ApiClient class or returns a copy of default - ApiClient. - - :return: The ApiClient object. - """ - if cls._default is None: - cls._default = ApiClient() - return cls._default - - @classmethod - def set_default(cls, default): - """Set default instance of ApiClient. - - It stores default ApiClient. - - :param default: object of ApiClient. - """ - cls._default = default - - def param_serialize( - self, - method, - resource_path, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, auth_settings=None, - collection_formats=None, - _host=None, - _request_auth=None - ) -> RequestSerialized: - - """Builds the HTTP request params needed by the request. - :param method: Method to call. - :param resource_path: Path to method endpoint. - :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 files dict: key -> filename, value -> filepath, - for `multipart/form-data`. - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :return: tuple of form (path, http_method, query_params, header_params, - body, post_params, files) - """ - - 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) - ) - - # post parameters - if post_params or files: - post_params = post_params if post_params else [] - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples( - post_params, - collection_formats - ) - if files: - post_params.extend(self.files_parameters(files)) - - # auth setting - self.update_params_for_auth( - header_params, - query_params, - auth_settings, - resource_path, - method, - body, - request_auth=_request_auth - ) - - # body - if body: - body = self.sanitize_for_serialization(body) - - # request url - if _host is None: - url = self.configuration.host + resource_path - else: - # use server/host defined in path or operation instead - url = _host + resource_path - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query( - query_params, - collection_formats - ) - url += "?" + url_query - - return method, url, header_params, body, post_params - - def call_api( - self, - method, - url, - header_params=None, - body=None, - post_params=None, - _request_timeout=None - ) -> rest.RESTResponse: - """Makes the HTTP request (synchronous) - :param method: Method to call. - :param url: Path to method endpoint. - :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 _request_timeout: timeout setting for this request. - :return: RESTResponse - """ - - try: - # perform request and return response - response_data = self.rest_client.request( - method, url, - headers=header_params, - body=body, post_params=post_params, - _request_timeout=_request_timeout - ) - - except ApiException as e: - raise e - - return response_data - - def response_deserialize( - self, - response_data: rest.RESTResponse, - response_types_map: Optional[Dict[str, ApiResponseT]] = None, - models: Dict = {} - ) -> ApiResponse[ApiResponseT]: - """Deserializes response into an object. - :param response_data: RESTResponse object to be deserialized. - :param response_types_map: dict of response types. - :return: ApiResponse - """ - - msg = "RESTResponse.read() must be called before passing it to response_deserialize()" - assert response_data.data is not None, msg - - response_type = response_types_map.get(str(response_data.status), None) - if not response_type and isinstance(response_data.status, - int) and 100 <= response_data.status <= 599: - # if not found, look for '1XX', '2XX', etc. - response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - - # deserialize response data - response_text = None - return_data = None - try: - if response_type == "bytearray": - return_data = response_data.data - elif response_type == "file": - return_data = self.__deserialize_file(response_data) - elif response_type is not None: - match = None - content_type = response_data.getheader('content-type') - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_text = response_data.data.decode(encoding) - if response_type in ["bytearray", "str"]: - return_data = self.__deserialize_primitive(response_text, response_type) - else: - return_data = self.deserialize(response_text, response_type, models) - finally: - if not 200 <= response_data.status <= 299: - raise ApiException.from_response( - http_resp=response_data, - body=response_text, - data=return_data, - ) - - return ApiResponse( - status_code=response_data.status, - data=return_data, - headers=response_data.getheaders(), - raw_data=response_data.data - ) - - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. - - If obj is None, return None. - If obj is SecretStr, return obj.get_secret_value() - 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 OpenAPI 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, Enum): - return obj.value - elif isinstance(obj, SecretStr): - return obj.get_secret_value() - 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() - - elif isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ - - return { - key: self.sanitize_for_serialization(val) - for key, val in obj_dict.items() - } - - def deserialize(self, response_text, response_type, models): - """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. - :param models: Object containing the model classes - - :return: deserialized object. - """ - - # fetch data from response object - try: - data = json.loads(response_text) - except ValueError: - data = response_text - - return self.__deserialize(data, response_type, models) - - def __deserialize(self, data, klass, models): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - :param models: object containing the model classes to deserialise into - - :return: object. - """ - if data is None: - return None - - if isinstance(klass, str): - if klass.startswith('List['): - m = re.match(r'List\[(.*)]', klass) - assert m is not None, "Malformed List type definition" - sub_kls = m.group(1) - return [self.__deserialize(sub_data, sub_kls, models) - for sub_data in data] - - if klass.startswith('Dict['): - m = re.match(r'Dict\[([^,]*), (.*)]', klass) - assert m is not None, "Malformed Dict type definition" - sub_kls = m.group(2) - return {k: self.__deserialize(v, sub_kls, models) - for k, v in data.items()} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(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_datetime(data) - elif issubclass(klass, Enum): - return self.__deserialize_enum(data, klass) - else: - return self.__deserialize_model(data, klass) - - 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: List[Tuple[str, str]] = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: - 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 parameters_to_url_query(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: URL query string (e.g. a=Hello%20World&b=123) - """ - new_params: List[Tuple[str, str]] = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: - if isinstance(v, bool): - v = str(v).lower() - if isinstance(v, (int, float)): - v = str(v) - if isinstance(v, dict): - v = json.dumps(v) - - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, str(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(quote(str(value)) for value in v)) - ) - else: - new_params.append((k, quote(str(v)))) - - return "&".join(["=".join(map(str, item)) for item in new_params]) - - def files_parameters(self, files: Dict[str, Union[str, bytes]]): - """Builds form parameters. - - :param files: File parameters. - :return: Form parameters with files. - """ - params = [] - for k, v in files.items(): - if isinstance(v, str): - with open(v, 'rb') as f: - filename = os.path.basename(f.name) - filedata = f.read() - elif isinstance(v, bytes): - filename = k - filedata = v - else: - raise ValueError("Unsupported file value") - 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: List[str]) -> Optional[str]: - """Returns `Accept` based on an array of accepts provided. - - :param accepts: List of headers. - :return: Accept (e.g. application/json). - """ - if not accepts: - return None - - for accept in accepts: - if re.search('json', accept, re.IGNORECASE): - return accept - - return accepts[0] - - 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 None - - for content_type in content_types: - if re.search('json', content_type, re.IGNORECASE): - return content_type - - return content_types[0] - - def update_params_for_auth( - self, - headers, - queries, - auth_settings, - resource_path, - method, - body, - request_auth=None - ) -> None: - """Updates header and query params based on authentication setting. - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :param auth_settings: Authentication setting identifiers list. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param request_auth: if set, the provided settings will - override the token in the configuration. - """ - if not auth_settings: - return - - if request_auth: - self._apply_auth_params( - headers, - queries, - resource_path, - method, - body, - request_auth - ) - else: - for auth in auth_settings: - auth_setting = self.configuration.auth_settings().get(auth) - if auth_setting: - self._apply_auth_params( - headers, - queries, - resource_path, - method, - body, - auth_setting - ) - - def _apply_auth_params( - self, - headers, - queries, - resource_path, - method, - body, - auth_setting - ) -> None: - """Updates the request parameters based on a single auth_setting - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param auth_setting: auth settings for the endpoint - """ - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - '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. - - handle file downloading - save response body into a tmp file and return the instance - - :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: - m = re.search( - r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition - ) - assert m is not None, "Unexpected 'content-disposition' header value" - filename = m.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 str(data) - except TypeError: - return data - - def __deserialize_object(self, value): - """Return an original value. - - :return: object. - """ - return value - - def __deserialize_date(self, string): - """Deserializes string to date. - - :param string: str. - :return: date. - """ - try: - 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_datetime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - 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 __deserialize_enum(self, data, klass): - """Deserializes primitive type to enum. - - :param data: primitive type. - :param klass: class literal. - :return: enum value. - """ - try: - return klass(data) - except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as `{1}`" - .format(data, klass) - ) - ) - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - return klass.from_dict(data) diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py deleted file mode 100644 index e4710b09..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -"""API response object.""" - -from __future__ import annotations -from typing import Optional, Generic, Mapping, TypeVar -from pydantic import Field, StrictInt, StrictBytes, BaseModel - -T = TypeVar("T") - -class ApiResponse(BaseModel, Generic[T]): - """ - API response object - """ - - status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") - data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") - - model_config = { - "arbitrary_types_allowed": True - } diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py deleted file mode 100644 index e8445bdc..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py +++ /dev/null @@ -1,452 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -import copy -import http.client as httplib -import logging -import multiprocessing -import sys -from logging import FileHandler -from typing import Optional - -import urllib3 - -from thousandeyes_sdk.core.thousandeyes_retry import ThousandEyesRetry - -JSON_SCHEMA_VALIDATION_KEYWORDS = { - 'multipleOf', 'maximum', 'exclusiveMaximum', - 'minimum', 'exclusiveMinimum', 'maxLength', - 'minLength', 'pattern', 'maxItems', 'minItems' -} - - -class Configuration: - """This class contains various settings of the API client. - - :param host: Base url. - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer). - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication. - :param password: Password for HTTP basic authentication. - :param access_token: Access token. - :param server_index: Index to servers configuration. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum - values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format. - - :Example: - """ - - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ssl_ca_cert=None, - retries=None - ) -> None: - """Constructor - """ - self._base_path = "https://api.thousandeyes.com" if host is None else host - """Default Base url - """ - self.server_index = 0 if server_index is None and host is None else server_index - self.server_operation_index = server_operation_index or {} - """Default server index - """ - self.server_variables = server_variables or {} - self.server_operation_variables = server_operation_variables or {} - """Default server variables - """ - self.temp_folder_path = None - """Temp file folder for downloading files - """ - # Authentication Settings - self.api_key = {} - if api_key: - self.api_key = api_key - """dict to store API key(s) - """ - self.api_key_prefix = {} - if api_key_prefix: - self.api_key_prefix = api_key_prefix - """dict to store API prefix (e.g. Bearer) - """ - self.refresh_api_key_hook = None - """function hook to refresh API key if expired - """ - self.username = username - """Username for HTTP basic authentication - """ - self.password = password - """Password for HTTP basic authentication - """ - self.access_token = access_token - """Access token - """ - self.logger = {} - """Logging Settings - """ - self.logger["package_logger"] = logging.getLogger("admin") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - """Log format - """ - self.logger_stream_handler = None - """Log stream handler - """ - self.logger_file_handler: Optional[FileHandler] = None - """Log file handler - """ - self.logger_file = None - """Debug file location - """ - self.debug = False - """Debug switch - """ - - self.verify_ssl = True - """SSL/TLS verification - Set this to false to skip verifying SSL certificate when calling API - from https server. - """ - self.ssl_ca_cert = ssl_ca_cert - """Set this to customize the certificate file to verify the peer. - """ - self.cert_file = None - """client certificate file - """ - self.key_file = None - """client key file - """ - self.assert_hostname = None - """Set this to True/False to enable/disable SSL hostname verification. - """ - self.tls_server_name = None - """SSL/TLS Server Name Indication (SNI) - Set this to the SNI value expected by the server. - """ - - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """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.proxy: Optional[str] = None - """Proxy URL - """ - self.proxy_headers = None - """Proxy headers - """ - self.safe_chars_for_path_param = '' - """Safe chars for path_param - """ - self.retries = ThousandEyesRetry() - if retries: - self.retries = retries - """Adding retries to override urllib3 default value 3 - """ - # Enable client side validation - self.client_side_validation = True - - self.socket_options = None - """Options to pass down to the underlying urllib3 socket - """ - - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" - """datetime format - """ - - self.date_format = "%Y-%m-%d" - """date format - """ - - def __deepcopy__(self, memo): - cls = self.__class__ - result = cls.__new__(cls) - memo[id(self)] = result - for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): - setattr(result, k, copy.deepcopy(v, memo)) - # shallow copy of loggers - result.logger = copy.copy(self.logger) - # use setters to configure loggers - result.logger_file = self.logger_file - result.debug = self.debug - return result - - def __setattr__(self, name, value): - object.__setattr__(self, name, value) - - @classmethod - def set_default(cls, default): - """Set default instance of configuration. - - It stores default configuration, which can be - returned by get_default_copy method. - - :param default: object of Configuration - """ - cls._default = default - - @classmethod - def get_default_copy(cls): - """Deprecated. Please use `get_default` instead. - - Deprecated. Please use `get_default` instead. - - :return: The configuration object. - """ - return cls.get_default() - - @classmethod - def get_default(cls): - """Return the default configuration. - - This method returns newly created, based on default constructor, - object of Configuration class or returns a copy of default - configuration. - - :return: The configuration object. - """ - if cls._default is None: - cls._default = Configuration() - return cls._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 self.logger.items(): - logger.addHandler(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 self.logger.items(): - 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 self.logger.items(): - 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, alias=None): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :param alias: The alternative identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook is not None: - self.refresh_api_key_hook(self) - key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) - 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. - """ - username = "" - if self.username is not None: - username = self.username - password = "" - if self.password is not None: - password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - auth = {} - if self.access_token is not None: - auth['BearerAuth'] = { - 'type': 'bearer', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - return auth - - 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: 7.0.0\n" \ - "SDK Package Version: 1.0.0". \ - format(env=sys.platform, pyversion=sys.version) - - def get_host_settings(self): - """Gets an array of host settings - - :return: An array of host settings - """ - return [ - { - 'url': "https://api.thousandeyes.com", - 'description': "ThousandEyes API production URL", - } - ] - - def get_host_from_settings(self, index, variables=None, servers=None): - """Gets host URL based on the index and variables - :param index: array index of the host settings - :param variables: hash of variable and the corresponding value - :param servers: an array of host settings or None - :return: URL based on host settings - """ - if index is None: - return self._base_path - - variables = {} if variables is None else variables - servers = self.get_host_settings() if servers is None else servers - - try: - server = servers[index] - except IndexError: - raise ValueError( - "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) - - url = server['url'] - - # go through variables and replace placeholders - for variable_name, variable in server.get('variables', {}).items(): - used_value = variables.get( - variable_name, variable['default_value']) - - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: - raise ValueError( - "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) - - url = url.replace("{" + variable_name + "}", used_value) - - return url - - @property - def host(self): - """Return generated host.""" - return self.get_host_from_settings(self.server_index, variables=self.server_variables) - - @host.setter - def host(self, value): - """Fix base path.""" - self._base_path = value - self.server_index = None diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py deleted file mode 100644 index 4a88a6e1..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -from typing import Any, Optional - -from typing_extensions import Self - - -class OpenApiException(Exception): - """The base exception class for all OpenAPIExceptions""" - - -class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None) -> None: - """ Raises an exception for TypeErrors - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list): a list of keys an indices to get to the - current_item - None if unset - valid_classes (tuple): the primitive classes that current item - should be an instance of - None if unset - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - None if unset - """ - self.path_to_item = path_to_item - self.valid_classes = valid_classes - self.key_type = key_type - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiTypeError, self).__init__(full_msg) - - -class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (list) the path to the exception in the - received_data dict. None if unset - """ - - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiValueError, self).__init__(full_msg) - - -class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Raised when an attribute reference or assignment fails. - - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiAttributeError, self).__init__(full_msg) - - -class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None) -> None: - """ - Args: - msg (str): the exception message - - Keyword Args: - path_to_item (None/list) the path to the exception in the - received_data dict - """ - self.path_to_item = path_to_item - full_msg = msg - if path_to_item: - full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) - super(ApiKeyError, self).__init__(full_msg) - - -class ApiException(OpenApiException): - - def __init__( - self, - status=None, - reason=None, - http_resp=None, - *, - body: Optional[str] = None, - data: Optional[Any] = None, - ) -> None: - self.status = status - self.reason = reason - self.body = body - self.data = data - self.headers = None - - if http_resp: - if self.status is None: - self.status = http_resp.status - if self.reason is None: - self.reason = http_resp.reason - if self.body is None: - try: - self.body = http_resp.data.decode('utf-8') - except Exception: - pass - self.headers = http_resp.getheaders() - - @classmethod - def from_response( - cls, - *, - http_resp, - body: Optional[str], - data: Optional[Any], - ) -> Self: - if http_resp.status == 400: - raise BadRequestException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 401: - raise UnauthorizedException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 403: - raise ForbiddenException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 404: - raise NotFoundException(http_resp=http_resp, body=body, data=data) - - if http_resp.status == 429: - raise TooManyRequestsException(http_resp=http_resp, body=body, data=data) - - if 500 <= http_resp.status <= 599: - raise ServiceException(http_resp=http_resp, body=body, data=data) - raise ApiException(http_resp=http_resp, body=body, data=data) - - 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.data or self.body: - error_message += "HTTP response body: {0}\n".format(self.data or self.body) - - return error_message - - -class BadRequestException(ApiException): - pass - - -class NotFoundException(ApiException): - pass - - -class UnauthorizedException(ApiException): - pass - - -class ForbiddenException(ApiException): - pass - - -class TooManyRequestsException(ApiException): - pass - - -class ServiceException(ApiException): - pass - - -def render_path(path_to_item): - """Returns a string representation of a path""" - result = "" - for pth in path_to_item: - if isinstance(pth, int): - result += "[{0}]".format(pth) - else: - result += "['{0}']".format(pth) - return result diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/py.typed b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/py.typed deleted file mode 100644 index e69de29b..00000000 diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py deleted file mode 100644 index cd46cd09..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py +++ /dev/null @@ -1,258 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -import io -import json -import re -import ssl - -import urllib3 -from thousandeyes_sdk.core.exceptions import ApiException, ApiValueError - -SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} -RESTResponseType = urllib3.HTTPResponse - - -def is_socks_proxy_url(url): - if url is None: - return False - split_section = url.split("://") - if len(split_section) < 2: - return False - else: - return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES - - -class RESTResponse(io.IOBase): - - def __init__(self, resp) -> None: - self.response = resp - self.status = resp.status - self.reason = resp.reason - self.data = None - - def read(self): - if self.data is None: - self.data = self.response.data - return self.data - - def getheaders(self): - """Returns a dictionary of the response headers.""" - return self.response.headers - - def getheader(self, name, default=None): - """Returns a given response header.""" - return self.response.headers.get(name, default) - - -class RESTClientObject: - - def __init__(self, configuration) -> 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 - # 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 - - pool_args = { - "cert_reqs": cert_reqs, - "ca_certs": configuration.ssl_ca_cert, - "cert_file": configuration.cert_file, - "key_file": configuration.key_file, - } - if configuration.assert_hostname is not None: - pool_args['assert_hostname'] = ( - configuration.assert_hostname - ) - - if configuration.retries is not None: - pool_args['retries'] = configuration.retries - - if configuration.tls_server_name: - pool_args['server_hostname'] = configuration.tls_server_name - - if configuration.socket_options is not None: - pool_args['socket_options'] = configuration.socket_options - - if configuration.connection_pool_maxsize is not None: - pool_args['maxsize'] = configuration.connection_pool_maxsize - - # https pool manager - self.pool_manager: urllib3.PoolManager - - if configuration.proxy: - if is_socks_proxy_url(configuration.proxy): - from urllib3.contrib.socks import SOCKSProxyManager - pool_args["proxy_url"] = configuration.proxy - pool_args["headers"] = configuration.proxy_headers - self.pool_manager = SOCKSProxyManager(**pool_args) - else: - pool_args["proxy_url"] = configuration.proxy - pool_args["proxy_headers"] = configuration.proxy_headers - self.pool_manager = urllib3.ProxyManager(**pool_args) - else: - self.pool_manager = urllib3.PoolManager(**pool_args) - - def request( - self, - method, - url, - headers=None, - body=None, - post_params=None, - _request_timeout=None - ): - """Perform requests. - - :param method: http request method - :param url: http request 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 _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 ApiValueError( - "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, float)): - 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] - ) - - try: - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - - # no content type provided or payload is json - content_type = headers.get('Content-Type') - if ( - not content_type - or re.search('json', 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, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif content_type == 'application/x-www-form-urlencoded': - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=False, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif 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'] - # Ensures that dict objects are serialized - post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in - post_params] - r = self.pool_manager.request( - method, - url, - fields=post_params, - encode_multipart=True, - timeout=timeout, - headers=headers, - preload_content=False - ) - # 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) or isinstance(body, bytes): - r = self.pool_manager.request( - method, - url, - body=body, - timeout=timeout, - headers=headers, - preload_content=False - ) - elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): - request_body = "true" if body else "false" - r = self.pool_manager.request( - method, - url, - body=request_body, - preload_content=False, - 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={}, - timeout=timeout, - headers=headers, - preload_content=False - ) - except urllib3.exceptions.SSLError as e: - msg = "\n".join([type(e).__name__, str(e)]) - raise ApiException(status=0, reason=msg) - - return RESTResponse(r) diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py deleted file mode 100644 index ecc8d90f..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -import re -import time -from typing import Collection, Optional, Union - -from urllib3 import BaseHTTPResponse -from urllib3.util.retry import RequestHistory, Retry - - -class ThousandEyesRetry(Retry): - RATE_LIMIT_RESET_HEADERS = { - "x-organization-rate-limit-reset", - "x-instant-test-rate-limit-reset" - } - - RESET_HEADER_PATTERN = re.compile(r"^\s*[0-9]+\s*$") - HTTP_TOO_MANY_REQUESTS = 429 - - def __init__( - self, - total: Union[bool, int, None] = 3, - connect: Optional[int] = None, - read: Optional[int] = None, - redirect: Union[bool, int, None] = None, - status: Optional[int] = 1, - other: Optional[int] = None, - allowed_methods: Optional[Collection[str]] = Retry.DEFAULT_ALLOWED_METHODS, - status_forcelist=None, - backoff_factor: float = 0, - backoff_max: float = Retry.DEFAULT_BACKOFF_MAX, - raise_on_redirect: bool = False, - raise_on_status: bool = False, - history: Optional[tuple[RequestHistory, ...]] = None, - respect_retry_after_header: bool = True, - remove_headers_on_redirect: Collection[str] = Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT, - backoff_jitter: float = 0.0) -> None: - super().__init__(total, connect, read, redirect, status, other, allowed_methods, - status_forcelist, backoff_factor, backoff_max, raise_on_redirect, - raise_on_status, history, respect_retry_after_header, - remove_headers_on_redirect, backoff_jitter) - - def is_retry(self, method: str, status_code: int, has_retry_after: bool = False) -> bool: - # Always retry on 429, regardless of method or status_forcelist - return (status_code == self.HTTP_TOO_MANY_REQUESTS or - super().is_retry(method, status_code, has_retry_after)) - - def get_retry_after(self, response: BaseHTTPResponse) -> Optional[float]: - retry_after: Optional[float] = super().get_retry_after(response) - - if retry_after: - return retry_after - - for header in self.RATE_LIMIT_RESET_HEADERS: - value = self._parse_reset_header(response.headers.get(header)) - if value and (retry_after is None or value > retry_after): - retry_after = value - - return retry_after - - def _parse_reset_header(self, value: Optional[str]) -> Optional[float]: - if value is None or not self.RESET_HEADER_PATTERN.match(value): - return None - - seconds: float = int(value) - time.time() - return max(seconds, 0) diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py deleted file mode 100644 index c7e4c097..00000000 --- a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/version.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright 2024 Cisco Systems, Inc. and its affiliates -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -import thousandeyes_sdk.core - -class Version: - @staticmethod - def get() -> str: - return thousandeyes_sdk.core.__version__ diff --git a/thousandeyes-sdk-credentials/.openapi-generator/FILES b/thousandeyes-sdk-credentials/.openapi-generator/FILES index 5b08dd1f..5213a20f 100644 --- a/thousandeyes-sdk-credentials/.openapi-generator/FILES +++ b/thousandeyes-sdk-credentials/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/Credential.md docs/CredentialRequest.md diff --git a/thousandeyes-sdk-credentials/README.md b/thousandeyes-sdk-credentials/README.md index e89c04c8..a90e7294 100644 --- a/thousandeyes-sdk-credentials/README.md +++ b/thousandeyes-sdk-credentials/README.md @@ -19,7 +19,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-credentials/src/thousandeyes_sdk/credentials/api/credentials_api.py b/thousandeyes-sdk-credentials/src/thousandeyes_sdk/credentials/api/credentials_api.py index c5340b0e..587db3b3 100644 --- a/thousandeyes-sdk-credentials/src/thousandeyes_sdk/credentials/api/credentials_api.py +++ b/thousandeyes-sdk-credentials/src/thousandeyes_sdk/credentials/api/credentials_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.credentials.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.credentials.models.credentials import Credentials from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class CredentialsApi: @@ -42,7 +42,7 @@ class CredentialsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-credentials")) self.api_client = api_client diff --git a/thousandeyes-sdk-dashboards/.openapi-generator/FILES b/thousandeyes-sdk-dashboards/.openapi-generator/FILES index 6932e3fa..d17ef91c 100644 --- a/thousandeyes-sdk-dashboards/.openapi-generator/FILES +++ b/thousandeyes-sdk-dashboards/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/ActiveWithin.md docs/AgentStatusDatasource.md diff --git a/thousandeyes-sdk-dashboards/README.md b/thousandeyes-sdk-dashboards/README.md index 88bc8bcc..5ce0204e 100644 --- a/thousandeyes-sdk-dashboards/README.md +++ b/thousandeyes-sdk-dashboards/README.md @@ -9,7 +9,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboard_snapshots_api.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboard_snapshots_api.py index 2cdecc7a..d3dd66c1 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboard_snapshots_api.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboard_snapshots_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.dashboards.models @@ -31,7 +32,6 @@ from thousandeyes_sdk.dashboards.models.update_snapshot_expiration_date_api_requ from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DashboardSnapshotsApi: @@ -44,7 +44,7 @@ class DashboardSnapshotsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-dashboards")) self.api_client = api_client diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_api.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_api.py index 1a006f0d..9c2472ed 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_api.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.dashboards.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.dashboards.models.dashboard_order import DashboardOrder from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DashboardsApi: @@ -43,7 +43,7 @@ class DashboardsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-dashboards")) self.api_client = api_client diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_filters_api.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_filters_api.py index 07f11c32..0f695408 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_filters_api.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/api/dashboards_filters_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.dashboards.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.dashboards.models.api_context_filters_response import ApiC from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DashboardsFiltersApi: @@ -41,7 +41,7 @@ class DashboardsFiltersApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-dashboards")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES index 20c239bb..801f5747 100644 --- a/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AddressProfile.md docs/AddressType.md diff --git a/thousandeyes-sdk-endpoint-agents/README.md b/thousandeyes-sdk-endpoint-agents/README.md index 36a42b83..cb1055ab 100644 --- a/thousandeyes-sdk-endpoint-agents/README.md +++ b/thousandeyes-sdk-endpoint-agents/README.md @@ -11,7 +11,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/administrative_endpoints_api.py b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/administrative_endpoints_api.py index a81f896e..eb85a7a5 100644 --- a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/administrative_endpoints_api.py +++ b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/administrative_endpoints_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_agents.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.endpoint_agents.models.connection_string import Connection from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AdministrativeEndpointsApi: @@ -39,7 +39,7 @@ class AdministrativeEndpointsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/manage_agents_api.py b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/manage_agents_api.py index f4147f8e..ab88f2c2 100644 --- a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/manage_agents_api.py +++ b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/manage_agents_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_agents.models @@ -31,7 +32,6 @@ from thousandeyes_sdk.endpoint_agents.models.list_endpoint_agents_response impor from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ManageAgentsApi: @@ -44,7 +44,7 @@ class ManageAgentsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/transfer_api.py b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/transfer_api.py index eed099af..72e812e6 100644 --- a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/transfer_api.py +++ b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/api/transfer_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_agents.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.endpoint_agents.models.bulk_agent_transfer_response import from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class TransferApi: @@ -41,7 +41,7 @@ class TransferApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-agents")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES index 749697f1..532183ac 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AgentToServerInstantScheduledTestApi.md docs/AlertDirection.md diff --git a/thousandeyes-sdk-endpoint-instant-tests/README.md b/thousandeyes-sdk-endpoint-instant-tests/README.md index d55c18fd..3d097b1a 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/README.md +++ b/thousandeyes-sdk-endpoint-instant-tests/README.md @@ -19,7 +19,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/agent_to_server_instant_scheduled_test_api.py b/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/agent_to_server_instant_scheduled_test_api.py index 750a8fc1..142bc39d 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/agent_to_server_instant_scheduled_test_api.py +++ b/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/agent_to_server_instant_scheduled_test_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_instant_tests.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.endpoint_instant_tests.models.endpoint_agent_to_server_tes from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AgentToServerInstantScheduledTestApi: @@ -40,7 +40,7 @@ class AgentToServerInstantScheduledTestApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/http_server_instant_scheduled_test_api.py b/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/http_server_instant_scheduled_test_api.py index 5739f685..d470b73a 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/http_server_instant_scheduled_test_api.py +++ b/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/http_server_instant_scheduled_test_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_instant_tests.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.endpoint_instant_tests.models.endpoint_http_server_test im from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class HttpServerInstantScheduledTestApi: @@ -40,7 +40,7 @@ class HttpServerInstantScheduledTestApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/run_existing_test_api.py b/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/run_existing_test_api.py index 22befe05..475d52a2 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/run_existing_test_api.py +++ b/thousandeyes-sdk-endpoint-instant-tests/src/thousandeyes_sdk/endpoint_instant_tests/api/run_existing_test_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_instant_tests.models @@ -25,7 +26,6 @@ from typing_extensions import Annotated from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class RunExistingTestApi: @@ -38,7 +38,7 @@ class RunExistingTestApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES index d808aea3..b4a68d1a 100644 --- a/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/Error.md docs/Expand.md diff --git a/thousandeyes-sdk-endpoint-labels/README.md b/thousandeyes-sdk-endpoint-labels/README.md index 69aa6f4b..a4a6a9c6 100644 --- a/thousandeyes-sdk-endpoint-labels/README.md +++ b/thousandeyes-sdk-endpoint-labels/README.md @@ -10,7 +10,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-endpoint-labels/src/thousandeyes_sdk/endpoint_labels/api/manage_labels_api.py b/thousandeyes-sdk-endpoint-labels/src/thousandeyes_sdk/endpoint_labels/api/manage_labels_api.py index f3d7b38a..cbc8992e 100644 --- a/thousandeyes-sdk-endpoint-labels/src/thousandeyes_sdk/endpoint_labels/api/manage_labels_api.py +++ b/thousandeyes-sdk-endpoint-labels/src/thousandeyes_sdk/endpoint_labels/api/manage_labels_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_labels.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.endpoint_labels.models.labels import Labels from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ManageLabelsApi: @@ -43,7 +43,7 @@ class ManageLabelsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-labels")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES index 100c9baa..5238fa04 100644 --- a/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AlertDirection.md docs/AlertRoundsViolationMode.md diff --git a/thousandeyes-sdk-endpoint-test-results/README.md b/thousandeyes-sdk-endpoint-test-results/README.md index e744a433..3e7277d1 100644 --- a/thousandeyes-sdk-endpoint-test-results/README.md +++ b/thousandeyes-sdk-endpoint-test-results/README.md @@ -9,7 +9,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/local_network_tests_results_api.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/local_network_tests_results_api.py index 8124a664..4a253e8b 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/local_network_tests_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/local_network_tests_results_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_test_results.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.endpoint_test_results.models.local_network_topology_result from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class LocalNetworkTestsResultsApi: @@ -43,7 +43,7 @@ class LocalNetworkTestsResultsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_dynamic_tests_results_api.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_dynamic_tests_results_api.py index 308c3977..62e81410 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_dynamic_tests_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_dynamic_tests_results_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_test_results.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.endpoint_test_results.models.path_vis_dynamic_test_results from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class NetworkDynamicTestsResultsApi: @@ -43,7 +43,7 @@ class NetworkDynamicTestsResultsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_scheduled_tests_results_api.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_scheduled_tests_results_api.py index 2979e2da..c44f2b90 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_scheduled_tests_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/network_scheduled_tests_results_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_test_results.models @@ -32,7 +33,6 @@ from thousandeyes_sdk.endpoint_test_results.models.tests_data_rounds_search impo from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class NetworkScheduledTestsResultsApi: @@ -45,7 +45,7 @@ class NetworkScheduledTestsResultsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/real_user_tests_results_api.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/real_user_tests_results_api.py index 0748522d..d6f0efde 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/real_user_tests_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/real_user_tests_results_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_test_results.models @@ -33,7 +34,6 @@ from thousandeyes_sdk.endpoint_test_results.models.real_user_test_page_results i from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class RealUserTestsResultsApi: @@ -46,7 +46,7 @@ class RealUserTestsResultsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/web_http_server_scheduled_test_results_api.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/web_http_server_scheduled_test_results_api.py index b0718a16..7b4f950d 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/web_http_server_scheduled_test_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/api/web_http_server_scheduled_test_results_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_test_results.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.endpoint_test_results.models.http_test_results import Http from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebHTTPServerScheduledTestResultsApi: @@ -41,7 +41,7 @@ class WebHTTPServerScheduledTestResultsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES index 9fc14231..bf07bb0f 100644 --- a/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AlertDirection.md docs/AlertRoundsViolationMode.md diff --git a/thousandeyes-sdk-endpoint-tests/README.md b/thousandeyes-sdk-endpoint-tests/README.md index 57815926..ab0114b1 100644 --- a/thousandeyes-sdk-endpoint-tests/README.md +++ b/thousandeyes-sdk-endpoint-tests/README.md @@ -11,7 +11,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/dynamic_tests_agent_to_server_api.py b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/dynamic_tests_agent_to_server_api.py index 04eda33c..835d852f 100644 --- a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/dynamic_tests_agent_to_server_api.py +++ b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/dynamic_tests_agent_to_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.endpoint_tests.models.endpoint_dynamic_test_update import from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DynamicTestsAgentToServerApi: @@ -42,7 +42,7 @@ class DynamicTestsAgentToServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/list_endpoint_scheduled_tests_api.py b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/list_endpoint_scheduled_tests_api.py index 551bd4b7..fa2d907c 100644 --- a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/list_endpoint_scheduled_tests_api.py +++ b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/list_endpoint_scheduled_tests_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_tests.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.endpoint_tests.models.endpoint_tests import EndpointTests from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ListEndpointScheduledTestsApi: @@ -39,7 +39,7 @@ class ListEndpointScheduledTestsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_agent_to_server_api.py b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_agent_to_server_api.py index 951f4c3c..67a2f46e 100644 --- a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_agent_to_server_api.py +++ b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_agent_to_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.endpoint_tests.models.endpoint_network_test_update import from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ScheduledTestsAgentToServerApi: @@ -42,7 +42,7 @@ class ScheduledTestsAgentToServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_http_server_api.py b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_http_server_api.py index 75a798bb..a5f159ad 100644 --- a/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_http_server_api.py +++ b/thousandeyes-sdk-endpoint-tests/src/thousandeyes_sdk/endpoint_tests/api/scheduled_tests_http_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.endpoint_tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.endpoint_tests.models.endpoint_http_test_update import End from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class ScheduledTestsHTTPServerApi: @@ -42,7 +42,7 @@ class ScheduledTestsHTTPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-endpoint-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/.openapi-generator/FILES b/thousandeyes-sdk-instant-tests/.openapi-generator/FILES index 3ad5ff25..f6531f00 100644 --- a/thousandeyes-sdk-instant-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-instant-tests/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/APIApi.md docs/Agent.md diff --git a/thousandeyes-sdk-instant-tests/README.md b/thousandeyes-sdk-instant-tests/README.md index 403ac8c8..d24caf84 100644 --- a/thousandeyes-sdk-instant-tests/README.md +++ b/thousandeyes-sdk-instant-tests/README.md @@ -14,7 +14,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_agent_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_agent_api.py index dae7f973..50f251a9 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_agent_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_agent_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AgentToAgentApi: @@ -41,7 +41,7 @@ class AgentToAgentApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_server_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_server_api.py index f8bcf481..6d72080d 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_server_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/agent_to_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AgentToServerApi: @@ -41,7 +41,7 @@ class AgentToServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/api_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/api_api.py index 84f40c73..aa8afbca 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/api_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/api_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class APIApi: @@ -41,7 +41,7 @@ class APIApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_security_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_security_api.py index be1991ba..26f7f0b1 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_security_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_security_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSSecurityApi: @@ -41,7 +41,7 @@ class DNSSecurityApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_server_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_server_api.py index a78d6f30..4f066a4d 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_server_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSServerApi: @@ -41,7 +41,7 @@ class DNSServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_trace_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_trace_api.py index e7292138..971edffa 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_trace_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/dns_trace_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.expand import Expand from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSTraceApi: @@ -41,7 +41,7 @@ class DNSTraceApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/ftp_server_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/ftp_server_api.py index e99d50bd..6826d03a 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/ftp_server_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/ftp_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.server_instant_test_request import Se from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class FTPServerApi: @@ -41,7 +41,7 @@ class FTPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_page_load_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_page_load_api.py index 65dcb993..19ac016f 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_page_load_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_page_load_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.page_load_instant_test_request import from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class HTTPPageLoadApi: @@ -41,7 +41,7 @@ class HTTPPageLoadApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_server_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_server_api.py index 9708c118..e392b87e 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_server_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/http_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.http_server_instant_test_request impo from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class HTTPServerApi: @@ -41,7 +41,7 @@ class HTTPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/run_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/run_api.py index 172c25ee..f473031e 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/run_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/run_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -25,7 +26,6 @@ from typing_extensions import Annotated from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class RunApi: @@ -38,7 +38,7 @@ class RunApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/sip_server_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/sip_server_api.py index 65cf3f01..3328c901 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/sip_server_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/sip_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.sip_server_instant_test_response impo from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class SIPServerApi: @@ -41,7 +41,7 @@ class SIPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/voice_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/voice_api.py index 3acb5bb1..74a053df 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/voice_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/voice_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.voice_instant_test_request import Voi from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class VoiceApi: @@ -41,7 +41,7 @@ class VoiceApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/web_transaction_api.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/web_transaction_api.py index 866a4aad..128f9deb 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/web_transaction_api.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/api/web_transaction_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.instant_tests.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.instant_tests.models.web_transaction_instant_test_request from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebTransactionApi: @@ -41,7 +41,7 @@ class WebTransactionApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-instant-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-internet-insights/.openapi-generator/FILES b/thousandeyes-sdk-internet-insights/.openapi-generator/FILES index c339be1e..2b6932a0 100644 --- a/thousandeyes-sdk-internet-insights/.openapi-generator/FILES +++ b/thousandeyes-sdk-internet-insights/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/ApiAffectedAgent.md docs/ApiAffectedTest.md diff --git a/thousandeyes-sdk-internet-insights/README.md b/thousandeyes-sdk-internet-insights/README.md index e2effe98..e5f046a6 100644 --- a/thousandeyes-sdk-internet-insights/README.md +++ b/thousandeyes-sdk-internet-insights/README.md @@ -20,7 +20,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/catalog_providers_api.py b/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/catalog_providers_api.py index b226f93c..6adeee6a 100644 --- a/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/catalog_providers_api.py +++ b/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/catalog_providers_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.internet_insights.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.internet_insights.models.api_catalog_provider_response imp from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class CatalogProvidersApi: @@ -41,7 +41,7 @@ class CatalogProvidersApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-internet-insights")) self.api_client = api_client diff --git a/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/outages_api_public_api.py b/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/outages_api_public_api.py index cc69215a..1a758060 100644 --- a/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/outages_api_public_api.py +++ b/thousandeyes-sdk-internet-insights/src/thousandeyes_sdk/internet_insights/api/outages_api_public_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.internet_insights.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.internet_insights.models.api_outages_response import ApiOu from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class OutagesAPIPublicApi: @@ -42,7 +42,7 @@ class OutagesAPIPublicApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-internet-insights")) self.api_client = api_client diff --git a/thousandeyes-sdk-labels/.openapi-generator/FILES b/thousandeyes-sdk-labels/.openapi-generator/FILES index 3318d522..d3fa481b 100644 --- a/thousandeyes-sdk-labels/.openapi-generator/FILES +++ b/thousandeyes-sdk-labels/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AgentApi.md docs/AllLabelsApi.md diff --git a/thousandeyes-sdk-labels/README.md b/thousandeyes-sdk-labels/README.md index 01a1a997..331b1006 100644 --- a/thousandeyes-sdk-labels/README.md +++ b/thousandeyes-sdk-labels/README.md @@ -10,7 +10,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/agent_api.py b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/agent_api.py index 7e81e74e..86a9e07e 100644 --- a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/agent_api.py +++ b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/agent_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.labels.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.labels.models.labels import Labels from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AgentApi: @@ -41,7 +41,7 @@ class AgentApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-labels")) self.api_client = api_client diff --git a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/all_labels_api.py b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/all_labels_api.py index e674718a..b8659e29 100644 --- a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/all_labels_api.py +++ b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/all_labels_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.labels.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.labels.models.labels import Labels from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AllLabelsApi: @@ -39,7 +39,7 @@ class AllLabelsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-labels")) self.api_client = api_client diff --git a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/dashboard_api.py b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/dashboard_api.py index 3aa3ca97..9e6061b9 100644 --- a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/dashboard_api.py +++ b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/dashboard_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.labels.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.labels.models.labels import Labels from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DashboardApi: @@ -41,7 +41,7 @@ class DashboardApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-labels")) self.api_client = api_client diff --git a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/endpoint_test_api.py b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/endpoint_test_api.py index 285f995f..c87f5ba6 100644 --- a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/endpoint_test_api.py +++ b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/endpoint_test_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.labels.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.labels.models.labels import Labels from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class EndpointTestApi: @@ -41,7 +41,7 @@ class EndpointTestApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-labels")) self.api_client = api_client diff --git a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/test_api.py b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/test_api.py index 920a2f5f..7ad98ef2 100644 --- a/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/test_api.py +++ b/thousandeyes-sdk-labels/src/thousandeyes_sdk/labels/api/test_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.labels.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.labels.models.labels import Labels from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class TestApi: @@ -41,7 +41,7 @@ class TestApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-labels")) self.api_client = api_client diff --git a/thousandeyes-sdk-snapshots/.openapi-generator/FILES b/thousandeyes-sdk-snapshots/.openapi-generator/FILES index 717c7bb2..818dadf9 100644 --- a/thousandeyes-sdk-snapshots/.openapi-generator/FILES +++ b/thousandeyes-sdk-snapshots/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AppAndSelfLinks.md docs/CreateTestSnapshotApi.md diff --git a/thousandeyes-sdk-snapshots/README.md b/thousandeyes-sdk-snapshots/README.md index dd7d3a4b..65c3a7ca 100644 --- a/thousandeyes-sdk-snapshots/README.md +++ b/thousandeyes-sdk-snapshots/README.md @@ -9,7 +9,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-snapshots/src/thousandeyes_sdk/snapshots/api/create_test_snapshot_api.py b/thousandeyes-sdk-snapshots/src/thousandeyes_sdk/snapshots/api/create_test_snapshot_api.py index 279a47f2..a08a44ef 100644 --- a/thousandeyes-sdk-snapshots/src/thousandeyes_sdk/snapshots/api/create_test_snapshot_api.py +++ b/thousandeyes-sdk-snapshots/src/thousandeyes_sdk/snapshots/api/create_test_snapshot_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.snapshots.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.snapshots.models.snapshot_response import SnapshotResponse from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class CreateTestSnapshotApi: @@ -40,7 +40,7 @@ class CreateTestSnapshotApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-snapshots")) self.api_client = api_client diff --git a/thousandeyes-sdk-streaming/.openapi-generator/FILES b/thousandeyes-sdk-streaming/.openapi-generator/FILES index 067f806e..6b457276 100644 --- a/thousandeyes-sdk-streaming/.openapi-generator/FILES +++ b/thousandeyes-sdk-streaming/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/ApiError.md docs/ApiErrorIntegrationLimits.md diff --git a/thousandeyes-sdk-streaming/README.md b/thousandeyes-sdk-streaming/README.md index f6f553b3..0d4f3ab9 100644 --- a/thousandeyes-sdk-streaming/README.md +++ b/thousandeyes-sdk-streaming/README.md @@ -21,7 +21,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py index 889dcd52..da6ec628 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.streaming.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.streaming.models.stream_type import StreamType from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class StreamingApi: @@ -43,7 +43,7 @@ class StreamingApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-streaming")) self.api_client = api_client diff --git a/thousandeyes-sdk-tags/.openapi-generator/FILES b/thousandeyes-sdk-tags/.openapi-generator/FILES index d304cb56..f2df7d69 100644 --- a/thousandeyes-sdk-tags/.openapi-generator/FILES +++ b/thousandeyes-sdk-tags/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AccessType.md docs/ApiError.md diff --git a/thousandeyes-sdk-tags/README.md b/thousandeyes-sdk-tags/README.md index 04b95db7..8d76c5c4 100644 --- a/thousandeyes-sdk-tags/README.md +++ b/thousandeyes-sdk-tags/README.md @@ -22,7 +22,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py index 5e161aa8..f47eabdc 100644 --- a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py +++ b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tags.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.tags.models.tag_assignment import TagAssignment from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class TagAssignmentApi: @@ -40,7 +40,7 @@ class TagAssignmentApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tags")) self.api_client = api_client diff --git a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py index a1f04e26..3bd192be 100644 --- a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py +++ b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tags.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.tags.models.tag_info import TagInfo from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class TagsApi: @@ -41,7 +41,7 @@ class TagsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tags")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/.openapi-generator/FILES b/thousandeyes-sdk-test-results/.openapi-generator/FILES index ac70bb5a..9458a863 100644 --- a/thousandeyes-sdk-test-results/.openapi-generator/FILES +++ b/thousandeyes-sdk-test-results/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/APITestMetricsApi.md docs/Agent.md diff --git a/thousandeyes-sdk-test-results/README.md b/thousandeyes-sdk-test-results/README.md index cf2ad648..79ca9832 100644 --- a/thousandeyes-sdk-test-results/README.md +++ b/thousandeyes-sdk-test-results/README.md @@ -9,7 +9,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/api_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/api_test_metrics_api.py index 37da89ed..225d5cc0 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/api_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/api_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.test_results.models.api_test_results import ApiTestResults from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class APITestMetricsApi: @@ -41,7 +41,7 @@ class APITestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_server_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_server_test_metrics_api.py index 4f83756d..bfc405f8 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_server_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_server_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.test_results.models.dns_server_test_results import DnsServ from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSServerTestMetricsApi: @@ -40,7 +40,7 @@ class DNSServerTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_trace_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_trace_test_metrics_api.py index ec659c7c..05eebf0e 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_trace_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dns_trace_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.test_results.models.dns_trace_test_results import DnsTrace from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSTraceTestMetricsApi: @@ -40,7 +40,7 @@ class DNSTraceTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dnssec_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dnssec_test_metrics_api.py index 3a5e8001..7277e337 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dnssec_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/dnssec_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.test_results.models.dnssec_test_results import DnssecTestR from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSSECTestMetricsApi: @@ -40,7 +40,7 @@ class DNSSECTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_bgp_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_bgp_test_metrics_api.py index 4373ea44..1b8849e0 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_bgp_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_bgp_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.test_results.models.bgp_test_route_information_results imp from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class NetworkBGPTestMetricsApi: @@ -41,7 +41,7 @@ class NetworkBGPTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_test_metrics_api.py index 30a01cd5..289d3a7e 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/network_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -31,7 +32,6 @@ from thousandeyes_sdk.test_results.models.test_direction import TestDirection from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class NetworkTestMetricsApi: @@ -44,7 +44,7 @@ class NetworkTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_rtp_server_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_rtp_server_test_metrics_api.py index 19913a57..942c9cbb 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_rtp_server_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_rtp_server_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.test_results.models.rtp_stream_test_results import RtpStre from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class VoiceRTPServerTestMetricsApi: @@ -40,7 +40,7 @@ class VoiceRTPServerTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_sip_server_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_sip_server_test_metrics_api.py index 927b9ae9..ee9891f6 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_sip_server_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/voice_sip_server_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.test_results.models.sip_server_test_results import SipServ from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class VoiceSIPServerTestMetricsApi: @@ -40,7 +40,7 @@ class VoiceSIPServerTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_ftp_server_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_ftp_server_test_metrics_api.py index 86602165..2bcacc30 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_ftp_server_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_ftp_server_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.test_results.models.ftp_server_test_results import FtpServ from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebFTPServerTestMetricsApi: @@ -40,7 +40,7 @@ class WebFTPServerTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_http_server_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_http_server_test_metrics_api.py index 2f249f48..8c28b4d3 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_http_server_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_http_server_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.test_results.models.http_test_results import HttpTestResul from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebHTTPServerTestMetricsApi: @@ -41,7 +41,7 @@ class WebHTTPServerTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_page_load_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_page_load_test_metrics_api.py index 12e1fd85..5c99c0e4 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_page_load_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_page_load_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -28,7 +29,6 @@ from thousandeyes_sdk.test_results.models.page_load_test_results import PageLoad from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebPageLoadTestMetricsApi: @@ -41,7 +41,7 @@ class WebPageLoadTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_metrics_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_metrics_api.py index e72264eb..35309ab6 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_metrics_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_metrics_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.test_results.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.test_results.models.web_transaction_test_results import We from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebTransactionsTestMetricsApi: @@ -42,7 +42,7 @@ class WebTransactionsTestMetricsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-test-results")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/.openapi-generator/FILES b/thousandeyes-sdk-tests/.openapi-generator/FILES index ec53a6d7..5fd61abc 100644 --- a/thousandeyes-sdk-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-tests/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/APIApi.md docs/Agent.md diff --git a/thousandeyes-sdk-tests/README.md b/thousandeyes-sdk-tests/README.md index cecfbd71..3dc74a44 100644 --- a/thousandeyes-sdk-tests/README.md +++ b/thousandeyes-sdk-tests/README.md @@ -10,7 +10,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_agent_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_agent_api.py index 06e9a6e6..59bdea06 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_agent_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_agent_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_agent_to_agent_test import UpdateAgent from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AgentToAgentApi: @@ -42,7 +42,7 @@ class AgentToAgentApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_server_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_server_api.py index fe9a289d..4ddfb8dc 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_server_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/agent_to_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_agent_to_server_test import UpdateAgen from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AgentToServerApi: @@ -42,7 +42,7 @@ class AgentToServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/all_test_types_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/all_test_types_api.py index 7204f1c3..5c7d0217 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/all_test_types_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/all_test_types_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -26,7 +27,6 @@ from thousandeyes_sdk.tests.models.tests import Tests from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class AllTestTypesApi: @@ -39,7 +39,7 @@ class AllTestTypesApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/api_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/api_api.py index 57aced1b..7ba8afdf 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/api_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/api_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_api_test import UpdateApiTest from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class APIApi: @@ -42,7 +42,7 @@ class APIApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/bgp_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/bgp_api.py index ce94f0d3..aa69ec83 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/bgp_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/bgp_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.tests.models.update_bgp_test_request import UpdateBgpTestR from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class BGPApi: @@ -43,7 +43,7 @@ class BGPApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_server_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_server_api.py index 46024237..7a2931c7 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_server_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_dns_server_test import UpdateDnsServer from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSServerApi: @@ -42,7 +42,7 @@ class DNSServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_trace_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_trace_api.py index 14346e3e..9d23bfba 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_trace_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dns_trace_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_dns_trace_test import UpdateDnsTraceTe from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSTraceApi: @@ -42,7 +42,7 @@ class DNSTraceApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dnssec_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dnssec_api.py index b4781544..aac95cea 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dnssec_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/dnssec_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_dns_sec_test import UpdateDnsSecTest from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class DNSSECApi: @@ -42,7 +42,7 @@ class DNSSECApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/ftp_server_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/ftp_server_api.py index 5abc8872..6142dfe5 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/ftp_server_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/ftp_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_ftp_server_test import UpdateFtpServer from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class FTPServerApi: @@ -42,7 +42,7 @@ class FTPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/http_server_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/http_server_api.py index bf26a441..0b9cf07d 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/http_server_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/http_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_http_server_test import UpdateHttpServ from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class HTTPServerApi: @@ -42,7 +42,7 @@ class HTTPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/page_load_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/page_load_api.py index db783847..533260cd 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/page_load_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/page_load_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_page_load_test import UpdatePageLoadTe from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class PageLoadApi: @@ -42,7 +42,7 @@ class PageLoadApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/path_visualization_interface_groups_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/path_visualization_interface_groups_api.py index 150dd19f..ecad806d 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/path_visualization_interface_groups_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/path_visualization_interface_groups_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -27,7 +28,6 @@ from thousandeyes_sdk.tests.models.interface_groups import InterfaceGroups from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class PathVisualizationInterfaceGroupsApi: @@ -40,7 +40,7 @@ class PathVisualizationInterfaceGroupsApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/sip_server_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/sip_server_api.py index 5689da7e..d8ce2b8f 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/sip_server_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/sip_server_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.update_sip_server_test import UpdateSipServer from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class SIPServerApi: @@ -42,7 +42,7 @@ class SIPServerApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/voice_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/voice_api.py index 3bdc5a0c..eb814626 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/voice_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/voice_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.voice_tests import VoiceTests from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class VoiceApi: @@ -42,7 +42,7 @@ class VoiceApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/web_transaction_api.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/web_transaction_api.py index 7cea66ba..abcd005c 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/web_transaction_api.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/api/web_transaction_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.tests.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.tests.models.web_transaction_tests import WebTransactionTe from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class WebTransactionApi: @@ -42,7 +42,7 @@ class WebTransactionApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-tests")) self.api_client = api_client diff --git a/thousandeyes-sdk-usage/.openapi-generator/FILES b/thousandeyes-sdk-usage/.openapi-generator/FILES index bdf28372..3a02a508 100644 --- a/thousandeyes-sdk-usage/.openapi-generator/FILES +++ b/thousandeyes-sdk-usage/.openapi-generator/FILES @@ -1,4 +1,3 @@ -.openapi-generator-ignore README.md docs/AccountGroupQuota.md docs/EndpointAgents.md diff --git a/thousandeyes-sdk-usage/README.md b/thousandeyes-sdk-usage/README.md index 4b27492a..3194517c 100644 --- a/thousandeyes-sdk-usage/README.md +++ b/thousandeyes-sdk-usage/README.md @@ -23,7 +23,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https: ## Requirements. -Python 3.7+ +Python 3.8+ ## Installation & Usage ### pip install diff --git a/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/quotas_api.py b/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/quotas_api.py index 31a1732c..424081a1 100644 --- a/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/quotas_api.py +++ b/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/quotas_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.usage.models @@ -29,7 +30,6 @@ from thousandeyes_sdk.usage.models.quotas_unassign import QuotasUnassign from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class QuotasApi: @@ -42,7 +42,7 @@ class QuotasApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-usage")) self.api_client = api_client diff --git a/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/usage_api.py b/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/usage_api.py index c82a6867..00af3756 100644 --- a/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/usage_api.py +++ b/thousandeyes-sdk-usage/src/thousandeyes_sdk/usage/api/usage_api.py @@ -15,6 +15,7 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated +from importlib.metadata import version import thousandeyes_sdk.usage.models @@ -30,7 +31,6 @@ from thousandeyes_sdk.usage.models.usage import Usage from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized from thousandeyes_sdk.core.api_response import ApiResponse from thousandeyes_sdk.core.rest import RESTResponseType -from thousandeyes_sdk.core.version import Version class UsageApi: @@ -43,7 +43,7 @@ class UsageApi: def __init__(self, api_client=None) -> None: if api_client is None: api_client = ApiClient.get_default() - api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(Version.get()) + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-usage")) self.api_client = api_client From 78c84de38037ea18594d67f2c1aabef8e861f017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Mon, 8 Jul 2024 10:52:57 +0100 Subject: [PATCH 10/13] CP-1897 Remove bumpVersion --- .bumpversion.cfg | 7 ------- .version | 1 - 2 files changed, 8 deletions(-) delete mode 100644 .bumpversion.cfg delete mode 100644 .version diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index b3588c82..00000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[bumpversion] -current_version = 1.0.0 -commit = False -tag = False - -[bumpversion:file:thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py] -[bumpversion:file:.version] diff --git a/.version b/.version deleted file mode 100644 index 3eefcb9d..00000000 --- a/.version +++ /dev/null @@ -1 +0,0 @@ -1.0.0 From b924974395b6bd0094d69f51f89519e886b38352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Mon, 8 Jul 2024 10:57:27 +0100 Subject: [PATCH 11/13] CP-1897 Commit thousandeyes-sdl-core again. --- thousandeyes-sdk-core/README.md | 3 + thousandeyes-sdk-core/pyproject.toml | 82 ++ .../src/thousandeyes_sdk/core/api_client.py | 766 ++++++++++++++++++ .../src/thousandeyes_sdk/core/api_response.py | 37 + .../thousandeyes_sdk/core/configuration.py | 452 +++++++++++ .../src/thousandeyes_sdk/core/exceptions.py | 211 +++++ .../src/thousandeyes_sdk/core/py.typed | 0 .../src/thousandeyes_sdk/core/rest.py | 258 ++++++ .../core/thousandeyes_retry.py | 80 ++ 9 files changed, 1889 insertions(+) create mode 100644 thousandeyes-sdk-core/README.md create mode 100644 thousandeyes-sdk-core/pyproject.toml create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/py.typed create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py diff --git a/thousandeyes-sdk-core/README.md b/thousandeyes-sdk-core/README.md new file mode 100644 index 00000000..0999e656 --- /dev/null +++ b/thousandeyes-sdk-core/README.md @@ -0,0 +1,3 @@ +# thousandeyes-sdk-core + +This package provides core functionality for interacting with the ThousandEyes API and should be installed before using any of the published SDKs. diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml new file mode 100644 index 00000000..5a67eba0 --- /dev/null +++ b/thousandeyes-sdk-core/pyproject.toml @@ -0,0 +1,82 @@ +[project] +name = "thousandeyes-sdk-core" +readme = "README.md" +dynamic = ["version"] +authors = [ + { name = "ThousandEyes API Team", email = "api-team@thousandeyes.com" } +] +description = "ThousandEyes SDK Core" +license = { file = "LICENSE" } +dependencies = [ + "urllib3 >= 1.25.3", + "python-dateutil >=2.8.2", + "pydantic >=2", + "typing-extensions >=4.7.1", +] + +[tool.setuptools.packages.find] +where = ["src/"] +include = ["thousandeyes_sdk.core"] + +[tool.setuptools.dynamic] +version = {file = ".version"} + +[project.optional-dependencies] +test = [ + "pytest~=7.1.3", + "pytest-cov>=2.8.1", + "pytest-randomly>=3.12.0", + "mypy>=1.4.1", + "types-python-dateutil>=2.8.19", +] +dev = [ + "flake8>=4.0.0", + "mypy>=1.4.1", + "types-python-dateutil>=2.8.19", +] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "src", + #"test", # auto-generated tests + #"tests", # hand-written tests +] +namespace_packages = true +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +strict_concatenate = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py new file mode 100644 index 00000000..d8305ed4 --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_client.py @@ -0,0 +1,766 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +import datetime +import json +import mimetypes +import os +import re +import tempfile +from enum import Enum +from typing import Tuple, Optional, List, Dict, Union +from urllib.parse import quote + +from dateutil.parser import parse +from pydantic import SecretStr +from thousandeyes_sdk.core import rest +from thousandeyes_sdk.core.api_response import ApiResponse, T as ApiResponseT +from thousandeyes_sdk.core.configuration import Configuration +from thousandeyes_sdk.core.exceptions import ( + ApiValueError, + ApiException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI 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 OpenAPI + templates. + + :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, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + 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 + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + pass + + @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 + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :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 files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + 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) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :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 _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]] = None, + models: Dict = {} + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, + int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + if response_type in ["bytearray", "str"]: + return_data = self.__deserialize_primitive(response_text, response_type) + else: + return_data = self.deserialize(response_text, response_type, models) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code=response_data.status, + data=return_data, + headers=response_data.getheaders(), + raw_data=response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + 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 OpenAPI 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, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + 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() + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text, response_type, models): + """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. + :param models: Object containing the model classes + + :return: deserialized object. + """ + + # fetch data from response object + try: + data = json.loads(response_text) + except ValueError: + data = response_text + + return self.__deserialize(data, response_type, models) + + def __deserialize(self, data, klass, models): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + :param models: object containing the model classes to deserialise into + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls, models) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls, models) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(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_datetime(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + 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: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + 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 parameters_to_url_query(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: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(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(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters(self, files: Dict[str, Union[str, bytes]]): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + else: + raise ValueError("Unsupported file value") + 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: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + 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 None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + '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. + + handle file downloading + save response body into a tmp file and return the instance + + :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: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition + ) + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.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 str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + 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_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + 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 __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py new file mode 100644 index 00000000..e4710b09 --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/api_response.py @@ -0,0 +1,37 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py new file mode 100644 index 00000000..e8445bdc --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/configuration.py @@ -0,0 +1,452 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +import copy +import http.client as httplib +import logging +import multiprocessing +import sys +from logging import FileHandler +from typing import Optional + +import urllib3 + +from thousandeyes_sdk.core.thousandeyes_retry import ThousandEyesRetry + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + + :Example: + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + retries=None + ) -> None: + """Constructor + """ + self._base_path = "https://api.thousandeyes.com" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("admin") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """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.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = ThousandEyesRetry() + if retries: + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._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 self.logger.items(): + logger.addHandler(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 self.logger.items(): + 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 self.logger.items(): + 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, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + 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. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if self.access_token is not None: + auth['BearerAuth'] = { + 'type': 'bearer', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth + + 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: 7.0.0\n" \ + "SDK Package Version: 1.0.0". \ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://api.thousandeyes.com", + 'description': "ThousandEyes API production URL", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py new file mode 100644 index 00000000..4a88a6e1 --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/exceptions.py @@ -0,0 +1,211 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +from typing import Any, Optional + +from typing_extensions import Self + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 429: + raise TooManyRequestsException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) + + 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.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class TooManyRequestsException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/py.typed b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py new file mode 100644 index 00000000..cd46cd09 --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/rest.py @@ -0,0 +1,258 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +import io +import json +import re +import ssl + +import urllib3 +from thousandeyes_sdk.core.exceptions import ApiException, ApiValueError + +SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"} +RESTResponseType = urllib3.HTTPResponse + + +def is_socks_proxy_url(url): + if url is None: + return False + split_section = url.split("://") + if len(split_section) < 2: + return False + else: + return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + def read(self): + if self.data is None: + self.data = self.response.data + return self.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> 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 + # 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 + + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } + if configuration.assert_hostname is not None: + pool_args['assert_hostname'] = ( + configuration.assert_hostname + ) + + if configuration.retries is not None: + pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + pool_args['server_hostname'] = configuration.tls_server_name + + if configuration.socket_options is not None: + pool_args['socket_options'] = configuration.socket_options + + if configuration.connection_pool_maxsize is not None: + pool_args['maxsize'] = configuration.connection_pool_maxsize + + # https pool manager + self.pool_manager: urllib3.PoolManager + + if configuration.proxy: + if is_socks_proxy_url(configuration.proxy): + from urllib3.contrib.socks import SOCKSProxyManager + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) + else: + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) + else: + self.pool_manager = urllib3.PoolManager(**pool_args) + + def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Perform requests. + + :param method: http request method + :param url: http request 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 _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 ApiValueError( + "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, float)): + 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] + ) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + content_type = headers.get('Content-Type') + if ( + not content_type + or re.search('json', 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, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif content_type == 'application/x-www-form-urlencoded': + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=False, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif 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'] + # Ensures that dict objects are serialized + post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in + post_params] + r = self.pool_manager.request( + method, + url, + fields=post_params, + encode_multipart=True, + timeout=timeout, + headers=headers, + preload_content=False + ) + # 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) or isinstance(body, bytes): + r = self.pool_manager.request( + method, + url, + body=body, + timeout=timeout, + headers=headers, + preload_content=False + ) + elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool): + request_body = "true" if body else "false" + r = self.pool_manager.request( + method, + url, + body=request_body, + preload_content=False, + 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={}, + timeout=timeout, + headers=headers, + preload_content=False + ) + except urllib3.exceptions.SSLError as e: + msg = "\n".join([type(e).__name__, str(e)]) + raise ApiException(status=0, reason=msg) + + return RESTResponse(r) diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py new file mode 100644 index 00000000..ecc8d90f --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/thousandeyes_retry.py @@ -0,0 +1,80 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +import re +import time +from typing import Collection, Optional, Union + +from urllib3 import BaseHTTPResponse +from urllib3.util.retry import RequestHistory, Retry + + +class ThousandEyesRetry(Retry): + RATE_LIMIT_RESET_HEADERS = { + "x-organization-rate-limit-reset", + "x-instant-test-rate-limit-reset" + } + + RESET_HEADER_PATTERN = re.compile(r"^\s*[0-9]+\s*$") + HTTP_TOO_MANY_REQUESTS = 429 + + def __init__( + self, + total: Union[bool, int, None] = 3, + connect: Optional[int] = None, + read: Optional[int] = None, + redirect: Union[bool, int, None] = None, + status: Optional[int] = 1, + other: Optional[int] = None, + allowed_methods: Optional[Collection[str]] = Retry.DEFAULT_ALLOWED_METHODS, + status_forcelist=None, + backoff_factor: float = 0, + backoff_max: float = Retry.DEFAULT_BACKOFF_MAX, + raise_on_redirect: bool = False, + raise_on_status: bool = False, + history: Optional[tuple[RequestHistory, ...]] = None, + respect_retry_after_header: bool = True, + remove_headers_on_redirect: Collection[str] = Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT, + backoff_jitter: float = 0.0) -> None: + super().__init__(total, connect, read, redirect, status, other, allowed_methods, + status_forcelist, backoff_factor, backoff_max, raise_on_redirect, + raise_on_status, history, respect_retry_after_header, + remove_headers_on_redirect, backoff_jitter) + + def is_retry(self, method: str, status_code: int, has_retry_after: bool = False) -> bool: + # Always retry on 429, regardless of method or status_forcelist + return (status_code == self.HTTP_TOO_MANY_REQUESTS or + super().is_retry(method, status_code, has_retry_after)) + + def get_retry_after(self, response: BaseHTTPResponse) -> Optional[float]: + retry_after: Optional[float] = super().get_retry_after(response) + + if retry_after: + return retry_after + + for header in self.RATE_LIMIT_RESET_HEADERS: + value = self._parse_reset_header(response.headers.get(header)) + if value and (retry_after is None or value > retry_after): + retry_after = value + + return retry_after + + def _parse_reset_header(self, value: Optional[str]) -> Optional[float]: + if value is None or not self.RESET_HEADER_PATTERN.match(value): + return None + + seconds: float = int(value) - time.time() + return max(seconds, 0) From c9e9fbe78dcab06df948a865b7027a9edf1ce40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Mon, 8 Jul 2024 11:10:43 +0100 Subject: [PATCH 12/13] CP-1897 Add requires-python to pyproject --- thousandeyes-sdk-administrative/pyproject.toml | 1 + thousandeyes-sdk-agents/pyproject.toml | 1 + thousandeyes-sdk-alerts/pyproject.toml | 1 + thousandeyes-sdk-bgp-monitors/pyproject.toml | 1 + thousandeyes-sdk-core/pyproject.toml | 1 + thousandeyes-sdk-credentials/pyproject.toml | 1 + thousandeyes-sdk-dashboards/pyproject.toml | 1 + thousandeyes-sdk-endpoint-agents/pyproject.toml | 1 + thousandeyes-sdk-endpoint-instant-tests/pyproject.toml | 1 + thousandeyes-sdk-endpoint-labels/pyproject.toml | 1 + thousandeyes-sdk-endpoint-test-results/pyproject.toml | 1 + thousandeyes-sdk-endpoint-tests/pyproject.toml | 1 + thousandeyes-sdk-instant-tests/pyproject.toml | 1 + thousandeyes-sdk-internet-insights/pyproject.toml | 1 + thousandeyes-sdk-labels/pyproject.toml | 1 + thousandeyes-sdk-snapshots/pyproject.toml | 1 + thousandeyes-sdk-streaming/pyproject.toml | 1 + thousandeyes-sdk-tags/pyproject.toml | 1 + thousandeyes-sdk-test-results/pyproject.toml | 1 + thousandeyes-sdk-tests/pyproject.toml | 1 + thousandeyes-sdk-usage/pyproject.toml | 1 + 21 files changed, 21 insertions(+) diff --git a/thousandeyes-sdk-administrative/pyproject.toml b/thousandeyes-sdk-administrative/pyproject.toml index 01074bbf..a6fcc095 100644 --- a/thousandeyes-sdk-administrative/pyproject.toml +++ b/thousandeyes-sdk-administrative/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Administrative API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-agents/pyproject.toml b/thousandeyes-sdk-agents/pyproject.toml index 0be3ed44..503865c1 100644 --- a/thousandeyes-sdk-agents/pyproject.toml +++ b/thousandeyes-sdk-agents/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Agents API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-alerts/pyproject.toml b/thousandeyes-sdk-alerts/pyproject.toml index 1d837987..b7b3d230 100644 --- a/thousandeyes-sdk-alerts/pyproject.toml +++ b/thousandeyes-sdk-alerts/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Alerts API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-bgp-monitors/pyproject.toml b/thousandeyes-sdk-bgp-monitors/pyproject.toml index fd98f085..55be3395 100644 --- a/thousandeyes-sdk-bgp-monitors/pyproject.toml +++ b/thousandeyes-sdk-bgp-monitors/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK BGP Monitors API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-core/pyproject.toml b/thousandeyes-sdk-core/pyproject.toml index 5a67eba0..d8e19d7b 100644 --- a/thousandeyes-sdk-core/pyproject.toml +++ b/thousandeyes-sdk-core/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Core" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-credentials/pyproject.toml b/thousandeyes-sdk-credentials/pyproject.toml index c12cb37f..f4bcedc7 100644 --- a/thousandeyes-sdk-credentials/pyproject.toml +++ b/thousandeyes-sdk-credentials/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Credentials API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-dashboards/pyproject.toml b/thousandeyes-sdk-dashboards/pyproject.toml index a5cade04..e8afb913 100644 --- a/thousandeyes-sdk-dashboards/pyproject.toml +++ b/thousandeyes-sdk-dashboards/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Dashboards API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-agents/pyproject.toml b/thousandeyes-sdk-endpoint-agents/pyproject.toml index 353b6e75..dfff0464 100644 --- a/thousandeyes-sdk-endpoint-agents/pyproject.toml +++ b/thousandeyes-sdk-endpoint-agents/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Endpoint Agents API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml index d02d1f41..9ee11012 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-instant-tests/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Endpoint Instant Scheduled Tests API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-labels/pyproject.toml b/thousandeyes-sdk-endpoint-labels/pyproject.toml index 07d6bec7..e1156fd9 100644 --- a/thousandeyes-sdk-endpoint-labels/pyproject.toml +++ b/thousandeyes-sdk-endpoint-labels/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Endpoint Agent Labels API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-test-results/pyproject.toml b/thousandeyes-sdk-endpoint-test-results/pyproject.toml index d2264611..73701ce4 100644 --- a/thousandeyes-sdk-endpoint-test-results/pyproject.toml +++ b/thousandeyes-sdk-endpoint-test-results/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Endpoint Test Results API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-endpoint-tests/pyproject.toml b/thousandeyes-sdk-endpoint-tests/pyproject.toml index 9a98aaf1..d7a527c3 100644 --- a/thousandeyes-sdk-endpoint-tests/pyproject.toml +++ b/thousandeyes-sdk-endpoint-tests/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Endpoint Tests API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-instant-tests/pyproject.toml b/thousandeyes-sdk-instant-tests/pyproject.toml index 61d7eac0..970f7585 100644 --- a/thousandeyes-sdk-instant-tests/pyproject.toml +++ b/thousandeyes-sdk-instant-tests/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Instant Tests API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-internet-insights/pyproject.toml b/thousandeyes-sdk-internet-insights/pyproject.toml index 8f12f446..5dd7ab36 100644 --- a/thousandeyes-sdk-internet-insights/pyproject.toml +++ b/thousandeyes-sdk-internet-insights/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Internet Insights API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-labels/pyproject.toml b/thousandeyes-sdk-labels/pyproject.toml index 41dd080b..d7d26586 100644 --- a/thousandeyes-sdk-labels/pyproject.toml +++ b/thousandeyes-sdk-labels/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Labels API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-snapshots/pyproject.toml b/thousandeyes-sdk-snapshots/pyproject.toml index e07c9888..d2542f3f 100644 --- a/thousandeyes-sdk-snapshots/pyproject.toml +++ b/thousandeyes-sdk-snapshots/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Test Snapshots API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-streaming/pyproject.toml b/thousandeyes-sdk-streaming/pyproject.toml index a6ebf7f2..2221df66 100644 --- a/thousandeyes-sdk-streaming/pyproject.toml +++ b/thousandeyes-sdk-streaming/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK ThousandEyes for OpenTelemetry API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-tags/pyproject.toml b/thousandeyes-sdk-tags/pyproject.toml index 4f25cf6a..b398962c 100644 --- a/thousandeyes-sdk-tags/pyproject.toml +++ b/thousandeyes-sdk-tags/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Tags API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-test-results/pyproject.toml b/thousandeyes-sdk-test-results/pyproject.toml index fa92c493..e4382520 100644 --- a/thousandeyes-sdk-test-results/pyproject.toml +++ b/thousandeyes-sdk-test-results/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Test Results API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-tests/pyproject.toml b/thousandeyes-sdk-tests/pyproject.toml index 7927ad94..05fe08a4 100644 --- a/thousandeyes-sdk-tests/pyproject.toml +++ b/thousandeyes-sdk-tests/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Tests API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", diff --git a/thousandeyes-sdk-usage/pyproject.toml b/thousandeyes-sdk-usage/pyproject.toml index 90564229..4c3e6bea 100644 --- a/thousandeyes-sdk-usage/pyproject.toml +++ b/thousandeyes-sdk-usage/pyproject.toml @@ -7,6 +7,7 @@ authors = [ ] description = "ThousandEyes SDK Usage API" license = { file = "LICENSE" } +requires-python = ">= 3.8" dependencies = [ "urllib3 >= 1.25.3", "python-dateutil >=2.8.2", From 78861a332f175417006285a586a7fe3e776e63c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Male=CC=81s?= Date: Mon, 8 Jul 2024 13:50:38 +0100 Subject: [PATCH 13/13] CP-1897 PR comment. --- .../src/thousandeyes_sdk/core/__init__.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py diff --git a/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py new file mode 100644 index 00000000..9bba574f --- /dev/null +++ b/thousandeyes-sdk-core/src/thousandeyes_sdk/core/__init__.py @@ -0,0 +1,22 @@ +# Copyright 2024 Cisco Systems, Inc. and its affiliates +# +# 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. +# +# SPDX-License-Identifier: Apache-2.0 + +from . import exceptions +from .api_client import ApiClient +from .api_response import ApiResponse +from .configuration import Configuration + +import os.path