diff --git a/CHANGELOG.md b/CHANGELOG.md index c38c475a..2ee1b6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,52 @@ ### Highlights +- `authorization`: [v0.2.0](services/authorization/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `dns`: [v0.2.0](services/dns/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `iaas`: [v0.3.0](services/iaas/CHANGELOG.md#v030-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `loadbalancer`: [v0.2.0](services/loadbalancer/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `logme`: [v0.2.0](services/logme/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `mariadb`: [v0.2.0](services/mariadb/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `mongodbflex`: [v0.2.0](services/mongodbflex/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `objectstorage`: [v0.2.0](services/objectstorage/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `opensearch`: [v0.2.0](services/opensearch/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `postgresflex`: [v0.2.0](services/postgresflex/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `rabbitmq`: [v0.2.0](services/rabbitmq/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `redis`: [v0.2.0](services/redis/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `resourcemanager`: [v0.2.0](services/resourcemanager/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `runcommand`: [v0.2.0](services/runcommand/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `secretsmanager`: [v0.2.0](services/secretsmanager/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `serverupdate`: [v0.2.0](services/serverupdate/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `serverbackup`: [v0.2.0](services/serverbackup/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `serviceaccount`: [v0.2.0](services/serviceaccount/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `serviceenablement`: [v0.2.0](services/serviceenablement/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `ske`: [v0.2.0](services/ske/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `sqlserverflex`: [v0.2.0](services/sqlserverflex/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `certificates`: [v0.2.0](services/certificates/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. +- `lbapplication`: [v0.2.0](services/lbapplication/CHANGELOG.md#v020-2025-01-13) + - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. - `certificates`: [v0.1.0](services/certificates/CHANGELOG.md#v010-2024-12-23) - Manage your STACKIT Load Balancer certificates - `lbapplication`: [v0.1.0](services/lbapplication/CHANGELOG.md#v010-2024-12-23) diff --git a/services/authorization/CHANGELOG.md b/services/authorization/CHANGELOG.md index b83f7de6..f346570f 100644 --- a/services/authorization/CHANGELOG.md +++ b/services/authorization/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage authorization of your STACKIT resources diff --git a/services/authorization/pyproject.toml b/services/authorization/pyproject.toml index d93e33d6..5a57f70f 100644 --- a/services/authorization/pyproject.toml +++ b/services/authorization/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-authorization" [tool.poetry] name = "stackit-authorization" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/certificates/CHANGELOG.md b/services/certificates/CHANGELOG.md index 5cb33929..15d315f2 100644 --- a/services/certificates/CHANGELOG.md +++ b/services/certificates/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-23) - Manage your STACKIT Load Balancer certificates diff --git a/services/certificates/pyproject.toml b/services/certificates/pyproject.toml index 4d9f69a1..0627063e 100644 --- a/services/certificates/pyproject.toml +++ b/services/certificates/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-certificates" [tool.poetry] name = "stackit-certificates" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/dns/CHANGELOG.md b/services/dns/CHANGELOG.md index 12546ebc..c623cb54 100644 --- a/services/dns/CHANGELOG.md +++ b/services/dns/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT DNS resources diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 35e320be..e6d97cfc 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-dns" [tool.poetry] name = "stackit-dns" -version = "v0.1.0" +version = "v0.2.0" authors = ["STACKIT Developer Tools "] description = "STACKIT DNS API" readme = "README.md" diff --git a/services/iaas/CHANGELOG.md b/services/iaas/CHANGELOG.md index 7c28e939..43a4e719 100644 --- a/services/iaas/CHANGELOG.md +++ b/services/iaas/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.3.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.2.0 (2024-12-23) - **Feature:** Add new methods to manage affinity groups: `create_affinity_group`, `delete_affinity_group`, `get_affinity_group`, and `list_affinity_group` diff --git a/services/iaas/pyproject.toml b/services/iaas/pyproject.toml index 443c07b8..694795f1 100644 --- a/services/iaas/pyproject.toml +++ b/services/iaas/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-iaas" [tool.poetry] name = "stackit-iaas" -version = "v0.2.0" +version = "v0.3.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/lbapplication/CHANGELOG.md b/services/lbapplication/CHANGELOG.md index 9c0bcafa..addda376 100644 --- a/services/lbapplication/CHANGELOG.md +++ b/services/lbapplication/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-23) - Manage your STACKIT Load Balancer applications diff --git a/services/lbapplication/pyproject.toml b/services/lbapplication/pyproject.toml index b21824be..7756ef17 100644 --- a/services/lbapplication/pyproject.toml +++ b/services/lbapplication/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-lbapplication" [tool.poetry] name = "stackit-lbapplication" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/loadbalancer/CHANGELOG.md b/services/loadbalancer/CHANGELOG.md index ab44a0e1..a8a42be0 100644 --- a/services/loadbalancer/CHANGELOG.md +++ b/services/loadbalancer/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Load Balancer resources diff --git a/services/loadbalancer/pyproject.toml b/services/loadbalancer/pyproject.toml index 574bc10a..32c61b36 100644 --- a/services/loadbalancer/pyproject.toml +++ b/services/loadbalancer/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-loadbalancer" [tool.poetry] name = "stackit-loadbalancer" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/logme/CHANGELOG.md b/services/logme/CHANGELOG.md index e72b92bc..d2a5e32c 100644 --- a/services/logme/CHANGELOG.md +++ b/services/logme/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Logme resources diff --git a/services/logme/pyproject.toml b/services/logme/pyproject.toml index acfb800c..ded48f9e 100644 --- a/services/logme/pyproject.toml +++ b/services/logme/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-logme" [tool.poetry] name = "stackit-logme" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/mariadb/CHANGELOG.md b/services/mariadb/CHANGELOG.md index 0a5ffcc7..f181a0df 100644 --- a/services/mariadb/CHANGELOG.md +++ b/services/mariadb/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT MariaDB resources diff --git a/services/mariadb/pyproject.toml b/services/mariadb/pyproject.toml index 882d6e1b..59a14048 100644 --- a/services/mariadb/pyproject.toml +++ b/services/mariadb/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-mariadb" [tool.poetry] name = "stackit-mariadb" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/mongodbflex/CHANGELOG.md b/services/mongodbflex/CHANGELOG.md index 15bf4fdb..091e898a 100644 --- a/services/mongodbflex/CHANGELOG.md +++ b/services/mongodbflex/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT MongoDB Flex resources diff --git a/services/mongodbflex/pyproject.toml b/services/mongodbflex/pyproject.toml index bfe652c2..38a1230a 100644 --- a/services/mongodbflex/pyproject.toml +++ b/services/mongodbflex/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-mongodbflex" [tool.poetry] name = "stackit-mongodbflex" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/objectstorage/CHANGELOG.md b/services/objectstorage/CHANGELOG.md index 8833e42b..1ae7c335 100644 --- a/services/objectstorage/CHANGELOG.md +++ b/services/objectstorage/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Object Storage resources diff --git a/services/objectstorage/pyproject.toml b/services/objectstorage/pyproject.toml index 6afd7adf..e14a77c7 100644 --- a/services/objectstorage/pyproject.toml +++ b/services/objectstorage/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-objectstorage" [tool.poetry] name = "stackit-objectstorage" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/observability/CHANGELOG.md b/services/observability/CHANGELOG.md index 624d4853..57a007cd 100644 --- a/services/observability/CHANGELOG.md +++ b/services/observability/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Observability resources diff --git a/services/observability/pyproject.toml b/services/observability/pyproject.toml index ff067e4d..2961d9a2 100644 --- a/services/observability/pyproject.toml +++ b/services/observability/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-observability" [tool.poetry] name = "stackit-observability" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/observability/src/stackit/observability/configuration.py b/services/observability/src/stackit/observability/configuration.py index f7255cbe..f08f1eb4 100644 --- a/services/observability/src/stackit/observability/configuration.py +++ b/services/observability/src/stackit/observability/configuration.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -23,7 +25,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://argus.api.eu01.stackit.cloud" """Default Base url """ @@ -65,6 +74,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -83,8 +93,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/opensearch/CHANGELOG.md b/services/opensearch/CHANGELOG.md index 40469a4c..70a153db 100644 --- a/services/opensearch/CHANGELOG.md +++ b/services/opensearch/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT OpenSearch resources diff --git a/services/opensearch/pyproject.toml b/services/opensearch/pyproject.toml index 45754df1..ebaec850 100644 --- a/services/opensearch/pyproject.toml +++ b/services/opensearch/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-opensearch" [tool.poetry] name = "stackit-opensearch" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/opensearch/src/stackit/opensearch/configuration.py b/services/opensearch/src/stackit/opensearch/configuration.py index 3c422172..97ac2559 100644 --- a/services/opensearch/src/stackit/opensearch/configuration.py +++ b/services/opensearch/src/stackit/opensearch/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://opensearch.api.eu01.stackit.cloud" """Default Base url """ @@ -64,6 +73,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -82,8 +92,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/postgresflex/CHANGELOG.md b/services/postgresflex/CHANGELOG.md index 881cc350..0ede2fa6 100644 --- a/services/postgresflex/CHANGELOG.md +++ b/services/postgresflex/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT PostgreSQL Flex resources diff --git a/services/postgresflex/pyproject.toml b/services/postgresflex/pyproject.toml index 7f0909ef..05b3b5ef 100644 --- a/services/postgresflex/pyproject.toml +++ b/services/postgresflex/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-postgresflex" [tool.poetry] name = "stackit-postgresflex" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/postgresflex/src/stackit/postgresflex/configuration.py b/services/postgresflex/src/stackit/postgresflex/configuration.py index e65bb558..a34b8d7c 100644 --- a/services/postgresflex/src/stackit/postgresflex/configuration.py +++ b/services/postgresflex/src/stackit/postgresflex/configuration.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -23,7 +25,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://postgres-flex-service.api.eu01.stackit.cloud" """Default Base url """ @@ -65,6 +74,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -83,8 +93,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/rabbitmq/CHANGELOG.md b/services/rabbitmq/CHANGELOG.md index 37aae8fe..49a8cfdb 100644 --- a/services/rabbitmq/CHANGELOG.md +++ b/services/rabbitmq/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT RabbitMQ resources diff --git a/services/rabbitmq/pyproject.toml b/services/rabbitmq/pyproject.toml index 78be2f66..2d7da212 100644 --- a/services/rabbitmq/pyproject.toml +++ b/services/rabbitmq/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-rabbitmq" [tool.poetry] name = "stackit-rabbitmq" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/rabbitmq/src/stackit/rabbitmq/configuration.py b/services/rabbitmq/src/stackit/rabbitmq/configuration.py index 8e6dbc00..130cf834 100644 --- a/services/rabbitmq/src/stackit/rabbitmq/configuration.py +++ b/services/rabbitmq/src/stackit/rabbitmq/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://rabbitmq.api.eu01.stackit.cloud" """Default Base url """ @@ -64,6 +73,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -82,8 +92,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/redis/CHANGELOG.md b/services/redis/CHANGELOG.md index 4ddb79a3..c666b163 100644 --- a/services/redis/CHANGELOG.md +++ b/services/redis/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Redis resources diff --git a/services/redis/pyproject.toml b/services/redis/pyproject.toml index 24f262f9..042c3ad3 100644 --- a/services/redis/pyproject.toml +++ b/services/redis/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-redis" [tool.poetry] name = "stackit-redis" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/redis/src/stackit/redis/configuration.py b/services/redis/src/stackit/redis/configuration.py index f0a86cde..23d87ec0 100644 --- a/services/redis/src/stackit/redis/configuration.py +++ b/services/redis/src/stackit/redis/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://redis.api.eu01.stackit.cloud" """Default Base url """ @@ -64,6 +73,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -82,8 +92,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/resourcemanager/CHANGELOG.md b/services/resourcemanager/CHANGELOG.md index 9ac2620f..fe5c0dc1 100644 --- a/services/resourcemanager/CHANGELOG.md +++ b/services/resourcemanager/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT resources such as your project, organization and folders diff --git a/services/resourcemanager/pyproject.toml b/services/resourcemanager/pyproject.toml index d8ed6d68..55f3f8a4 100644 --- a/services/resourcemanager/pyproject.toml +++ b/services/resourcemanager/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-resourcemanager" [tool.poetry] name = "stackit-resourcemanager" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/resourcemanager/src/stackit/resourcemanager/configuration.py b/services/resourcemanager/src/stackit/resourcemanager/configuration.py index e901f99a..d83f19da 100644 --- a/services/resourcemanager/src/stackit/resourcemanager/configuration.py +++ b/services/resourcemanager/src/stackit/resourcemanager/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://resource-manager.api.stackit.cloud" """Default Base url """ @@ -63,6 +72,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -81,8 +91,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/runcommand/CHANGELOG.md b/services/runcommand/CHANGELOG.md index 85d47822..64d356d8 100644 --- a/services/runcommand/CHANGELOG.md +++ b/services/runcommand/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - STACKIT Run Command module can be used to run remote commands and custom scripts on VMs diff --git a/services/runcommand/pyproject.toml b/services/runcommand/pyproject.toml index b36ae788..3d8f2d9b 100644 --- a/services/runcommand/pyproject.toml +++ b/services/runcommand/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-runcommand" [tool.poetry] name = "stackit-runcommand" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/runcommand/src/stackit/runcommand/configuration.py b/services/runcommand/src/stackit/runcommand/configuration.py index 97976c38..08c625e5 100644 --- a/services/runcommand/src/stackit/runcommand/configuration.py +++ b/services/runcommand/src/stackit/runcommand/configuration.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -23,7 +25,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://run-command.api.eu01.stackit.cloud" """Default Base url """ @@ -65,6 +74,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -83,8 +93,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/secretsmanager/CHANGELOG.md b/services/secretsmanager/CHANGELOG.md index 5c3a9d44..698273aa 100644 --- a/services/secretsmanager/CHANGELOG.md +++ b/services/secretsmanager/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Secrets manager resources diff --git a/services/secretsmanager/pyproject.toml b/services/secretsmanager/pyproject.toml index 2333f478..325ada94 100644 --- a/services/secretsmanager/pyproject.toml +++ b/services/secretsmanager/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-secretsmanager" [tool.poetry] name = "stackit-secretsmanager" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/secretsmanager/src/stackit/secretsmanager/configuration.py b/services/secretsmanager/src/stackit/secretsmanager/configuration.py index bb2b5102..20aba911 100644 --- a/services/secretsmanager/src/stackit/secretsmanager/configuration.py +++ b/services/secretsmanager/src/stackit/secretsmanager/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://secrets-manager.api.eu01.stackit.cloud" """Default Base url """ @@ -64,6 +73,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -82,8 +92,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/serverbackup/CHANGELOG.md b/services/serverbackup/CHANGELOG.md index 7564cd3b..cf1bd2a9 100644 --- a/services/serverbackup/CHANGELOG.md +++ b/services/serverbackup/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Server Backups diff --git a/services/serverbackup/pyproject.toml b/services/serverbackup/pyproject.toml index d3e95ab6..90acb6f1 100644 --- a/services/serverbackup/pyproject.toml +++ b/services/serverbackup/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-serverbackup" [tool.poetry] name = "stackit-serverbackup" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/serverbackup/src/stackit/serverbackup/configuration.py b/services/serverbackup/src/stackit/serverbackup/configuration.py index 35843f59..b312a06f 100644 --- a/services/serverbackup/src/stackit/serverbackup/configuration.py +++ b/services/serverbackup/src/stackit/serverbackup/configuration.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -23,7 +25,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://server-backup.api.eu01.stackit.cloud" """Default Base url """ @@ -65,6 +74,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -83,8 +93,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/serverupdate/CHANGELOG.md b/services/serverupdate/CHANGELOG.md index 047d83dd..ef500818 100644 --- a/services/serverupdate/CHANGELOG.md +++ b/services/serverupdate/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.1 (2024-12-23) - **Bugfix:** `Id` field of `Update` model is now of type `int64` (was `string`) diff --git a/services/serverupdate/pyproject.toml b/services/serverupdate/pyproject.toml index e2738573..bf5d61bd 100644 --- a/services/serverupdate/pyproject.toml +++ b/services/serverupdate/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-serverupdate" [tool.poetry] name = "stackit-serverupdate" -version = "v0.1.1" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/serverupdate/src/stackit/serverupdate/configuration.py b/services/serverupdate/src/stackit/serverupdate/configuration.py index bd99a5ff..cb286fc3 100644 --- a/services/serverupdate/src/stackit/serverupdate/configuration.py +++ b/services/serverupdate/src/stackit/serverupdate/configuration.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -23,7 +25,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://server-update.api.eu01.stackit.cloud" """Default Base url """ @@ -65,6 +74,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -83,8 +93,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/serviceaccount/CHANGELOG.md b/services/serviceaccount/CHANGELOG.md index b1367390..8782763f 100644 --- a/services/serviceaccount/CHANGELOG.md +++ b/services/serviceaccount/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Service Accounts diff --git a/services/serviceaccount/pyproject.toml b/services/serviceaccount/pyproject.toml index 0943d298..84146d49 100644 --- a/services/serviceaccount/pyproject.toml +++ b/services/serviceaccount/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-serviceaccount" [tool.poetry] name = "stackit-serviceaccount" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/serviceaccount/src/stackit/serviceaccount/configuration.py b/services/serviceaccount/src/stackit/serviceaccount/configuration.py index 1ce0d220..b4c5bad0 100644 --- a/services/serviceaccount/src/stackit/serviceaccount/configuration.py +++ b/services/serviceaccount/src/stackit/serviceaccount/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://service-account.api.stackit.cloud" """Default Base url """ @@ -63,6 +72,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -81,8 +91,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/serviceenablement/CHANGELOG.md b/services/serviceenablement/CHANGELOG.md index f69857e0..b36dbaa3 100644 --- a/services/serviceenablement/CHANGELOG.md +++ b/services/serviceenablement/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - STACKIT Service Enablement module can be used to enable services diff --git a/services/serviceenablement/pyproject.toml b/services/serviceenablement/pyproject.toml index bbc3c6c0..bd71fe81 100644 --- a/services/serviceenablement/pyproject.toml +++ b/services/serviceenablement/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-serviceenablement" [tool.poetry] name = "stackit-serviceenablement" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/serviceenablement/src/stackit/serviceenablement/configuration.py b/services/serviceenablement/src/stackit/serviceenablement/configuration.py index 25d01cfe..b2648d5c 100644 --- a/services/serviceenablement/src/stackit/serviceenablement/configuration.py +++ b/services/serviceenablement/src/stackit/serviceenablement/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://service-enablement.api.eu01.stackit.cloud" """Default Base url """ @@ -64,6 +73,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -82,8 +92,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/ske/CHANGELOG.md b/services/ske/CHANGELOG.md index 2d564c26..064df343 100644 --- a/services/ske/CHANGELOG.md +++ b/services/ske/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT Kubernetes Engine resources diff --git a/services/ske/pyproject.toml b/services/ske/pyproject.toml index 574d57e9..64d413bb 100644 --- a/services/ske/pyproject.toml +++ b/services/ske/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-ske" [tool.poetry] name = "stackit-ske" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/ske/src/stackit/ske/configuration.py b/services/ske/src/stackit/ske/configuration.py index a94c21dd..cf453c36 100644 --- a/services/ske/src/stackit/ske/configuration.py +++ b/services/ske/src/stackit/ske/configuration.py @@ -11,6 +11,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -22,7 +24,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://ske.api.eu01.stackit.cloud" """Default Base url """ @@ -64,6 +73,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -82,8 +92,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: diff --git a/services/sqlserverflex/CHANGELOG.md b/services/sqlserverflex/CHANGELOG.md index 3c930e6c..cd08ecc2 100644 --- a/services/sqlserverflex/CHANGELOG.md +++ b/services/sqlserverflex/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.2.0 (2025-01-13) + +- **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. + +STACKIT will move to a new way of specifying regions, where the region is provided as a function argument instead of being set in the client configuration. Once all services have migrated, the methods to specify the region in the client configuration will be removed. + ## v0.1.0 (2024-12-04) - Manage your STACKIT SQLServer Flex resources diff --git a/services/sqlserverflex/pyproject.toml b/services/sqlserverflex/pyproject.toml index 94ccbd97..c499566e 100644 --- a/services/sqlserverflex/pyproject.toml +++ b/services/sqlserverflex/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-sqlserverflex" [tool.poetry] name = "stackit-sqlserverflex" -version = "v0.1.0" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/sqlserverflex/src/stackit/sqlserverflex/configuration.py b/services/sqlserverflex/src/stackit/sqlserverflex/configuration.py index 025c1e04..8cbe0928 100644 --- a/services/sqlserverflex/src/stackit/sqlserverflex/configuration.py +++ b/services/sqlserverflex/src/stackit/sqlserverflex/configuration.py @@ -12,6 +12,8 @@ Do not edit the class manually. """ # noqa: E501 docstring might be too long +import os + class HostConfiguration: def __init__( @@ -23,7 +25,14 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" + print( + "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n", + "as a function argument instead of being set in the client configuration.\n" + "Once all services have migrated, the methods to specify the region in the client configuration " + "will be removed.", + ) + """Constructor + """ self._base_path = "https://mssql-flex-service.api.eu01.stackit.cloud" """Default Base url """ @@ -65,6 +74,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): :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 + :error: if a region is given for a global url :return: URL based on host settings """ if index is None: @@ -83,8 +93,25 @@ def get_host_from_settings(self, index, variables=None, servers=None): url = server["url"] + # check if environment variable was provided for region + # if nothing was set this is None + region_env = os.environ.get("STACKIT_REGION") + # go through variables and replace placeholders for variable_name, variable in server.get("variables", {}).items(): + # If a region is provided by the user for a global url + # return an error (except for providing via environment variable). + # The region is provided as a function argument instead of being set in the client configuration. + if ( + variable_name == "region" + and (variable["default_value"] == "global" or variable["default_value"] == "") + and region_env is None + and variables.get(variable_name) is not None + ): + raise ValueError( + "this API does not support setting a region in the the client configuration, " + "please check if the region can be specified as a function parameter" + ) used_value = variables.get(variable_name, variable["default_value"]) if "enum_values" in variable and used_value not in variable["enum_values"]: