From d7c4e83fd3448dd4e5f62cb2d1520c748e687fe0 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:33:14 +0000 Subject: [PATCH 01/12] Generate objectstorage --- .../stackit/objectstorage/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/objectstorage/src/stackit/objectstorage/configuration.py b/services/objectstorage/src/stackit/objectstorage/configuration.py index 29a2dfb7c..b6e5322f9 100644 --- a/services/objectstorage/src/stackit/objectstorage/configuration.py +++ b/services/objectstorage/src/stackit/objectstorage/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://object-storage.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"]: From ac255e9be404e283cf81c0b0524440a1d0cedc57 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:30:38 +0000 Subject: [PATCH 02/12] Generate mongodbflex --- .../src/stackit/mongodbflex/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/mongodbflex/src/stackit/mongodbflex/configuration.py b/services/mongodbflex/src/stackit/mongodbflex/configuration.py index 3369a0be4..81166599f 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/configuration.py +++ b/services/mongodbflex/src/stackit/mongodbflex/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://mongodb-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"]: From e62b219002b12b9b927e7c05ba1b3b71aab97aa4 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:28:04 +0000 Subject: [PATCH 03/12] Generate mariadb --- .../src/stackit/mariadb/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/mariadb/src/stackit/mariadb/configuration.py b/services/mariadb/src/stackit/mariadb/configuration.py index 6150a3a66..3e6932327 100644 --- a/services/mariadb/src/stackit/mariadb/configuration.py +++ b/services/mariadb/src/stackit/mariadb/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://mariadb.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"]: From 8a58e48b29e4a800c99be2234b35a200241e418a Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:25:29 +0000 Subject: [PATCH 04/12] Generate logme --- .../logme/src/stackit/logme/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/logme/src/stackit/logme/configuration.py b/services/logme/src/stackit/logme/configuration.py index 5aa398c13..ae5c068a5 100644 --- a/services/logme/src/stackit/logme/configuration.py +++ b/services/logme/src/stackit/logme/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://logme.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"]: From 52e2cc31001cd1cabc389014f5bf3ff70268846f Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:22:53 +0000 Subject: [PATCH 05/12] Generate loadbalancer --- .../src/stackit/loadbalancer/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/loadbalancer/src/stackit/loadbalancer/configuration.py b/services/loadbalancer/src/stackit/loadbalancer/configuration.py index 8821e5d20..50b53a76b 100644 --- a/services/loadbalancer/src/stackit/loadbalancer/configuration.py +++ b/services/loadbalancer/src/stackit/loadbalancer/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://load-balancer.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"]: From ce1df8f82c5b880bc4acbcceacbe4cebeb02fd57 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:20:17 +0000 Subject: [PATCH 06/12] Generate lbapplication --- .../stackit/lbapplication/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/lbapplication/src/stackit/lbapplication/configuration.py b/services/lbapplication/src/stackit/lbapplication/configuration.py index 071903fe3..c9499db02 100644 --- a/services/lbapplication/src/stackit/lbapplication/configuration.py +++ b/services/lbapplication/src/stackit/lbapplication/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://lb-application.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"]: From 47c46b93d49508f499a7d9ffe89fb21b6a946d08 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:17:42 +0000 Subject: [PATCH 07/12] Generate iaasalpha --- .../src/stackit/iaasalpha/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/iaasalpha/src/stackit/iaasalpha/configuration.py b/services/iaasalpha/src/stackit/iaasalpha/configuration.py index 3cbeec2d5..d8e954551 100644 --- a/services/iaasalpha/src/stackit/iaasalpha/configuration.py +++ b/services/iaasalpha/src/stackit/iaasalpha/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://iaas.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"]: From f964dae832243e10e8bd61ec131e7b2b7481af03 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:15:46 +0000 Subject: [PATCH 08/12] Generate iaas --- .../iaas/src/stackit/iaas/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/iaas/src/stackit/iaas/configuration.py b/services/iaas/src/stackit/iaas/configuration.py index 732cb7a96..f8641da82 100644 --- a/services/iaas/src/stackit/iaas/configuration.py +++ b/services/iaas/src/stackit/iaas/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://iaas.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"]: From 871dacd587439bfeefca62da7bc03f53c32379df Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:13:54 +0000 Subject: [PATCH 09/12] Generate dns --- services/dns/src/stackit/dns/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/dns/src/stackit/dns/configuration.py b/services/dns/src/stackit/dns/configuration.py index 612bc2759..1698e6a5d 100644 --- a/services/dns/src/stackit/dns/configuration.py +++ b/services/dns/src/stackit/dns/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://dns.api.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"]: From 73a754ad6bec6bc4b1168b6449baa0c9a21acddb Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:11:19 +0000 Subject: [PATCH 10/12] Generate certificates --- .../src/stackit/certificates/configuration.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/services/certificates/src/stackit/certificates/configuration.py b/services/certificates/src/stackit/certificates/configuration.py index 6526275b1..d41b46371 100644 --- a/services/certificates/src/stackit/certificates/configuration.py +++ b/services/certificates/src/stackit/certificates/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://certificates.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"]: From 333dd6d6d8ce030d667d5e18d452f868d373d4c2 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 14 Jan 2025 08:08:44 +0000 Subject: [PATCH 11/12] Generate authorization --- .../stackit/authorization/configuration.py | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/services/authorization/src/stackit/authorization/configuration.py b/services/authorization/src/stackit/authorization/configuration.py index ba66f84de..b3d5d7992 100644 --- a/services/authorization/src/stackit/authorization/configuration.py +++ b/services/authorization/src/stackit/authorization/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,8 +24,15 @@ def __init__( server_operation_variables=None, ignore_operation_servers=False, ) -> None: - """Constructor""" - self._base_path = "https://authorization.api.stackit.cloud" + 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://authorization.api.eu01.stackit.cloud" """Default Base url """ self.server_index = 0 if server_index is None else server_index @@ -47,12 +56,13 @@ def get_host_settings(self): """ return [ { - "url": "https://authorization.api.stackit.cloud", + "url": "https://authorization.api.{region}stackit.cloud", "description": "No description provided", "variables": { "region": { "description": "No description provided", - "default_value": "global", + "default_value": "eu01.", + "enum_values": ["eu01.", "eu02."], } }, } @@ -63,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: @@ -81,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"]: From 492c68f9d952efa3a062a3f730f7c85daa0d572c Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Tue, 14 Jan 2025 12:13:31 +0100 Subject: [PATCH 12/12] Bugfix: Region adjustment Signed-off-by: Alexander Dahmen --- CHANGELOG.md | 21 +++++++++++++++++++++ services/authorization/CHANGELOG.md | 4 ++++ services/authorization/pyproject.toml | 2 +- services/certificates/CHANGELOG.md | 4 ++++ services/certificates/pyproject.toml | 2 +- services/dns/CHANGELOG.md | 4 ++++ services/dns/pyproject.toml | 2 +- services/iaas/CHANGELOG.md | 4 ++++ services/iaas/pyproject.toml | 2 +- services/lbapplication/CHANGELOG.md | 4 ++++ services/lbapplication/pyproject.toml | 2 +- services/loadbalancer/CHANGELOG.md | 4 ++++ services/loadbalancer/pyproject.toml | 2 +- services/logme/CHANGELOG.md | 4 ++++ services/logme/pyproject.toml | 2 +- services/mariadb/CHANGELOG.md | 4 ++++ services/mariadb/pyproject.toml | 2 +- services/mongodbflex/CHANGELOG.md | 4 ++++ services/mongodbflex/pyproject.toml | 2 +- services/objectstorage/CHANGELOG.md | 4 ++++ services/objectstorage/pyproject.toml | 2 +- 21 files changed, 71 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8891a892..1b52ca3ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ ### Highlights +- `authorization`: [v0.2.1](services/authorization/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `certificates`: [v0.2.1](services/certificates/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `dns`: [v0.2.1](services/dns/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `iaas`: [v0.3.1](services/iaas/CHANGELOG.md#v031-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `lbapplication`: [v0.2.1](services/lbapplication/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `loadbalancer`: [v0.2.1](services/loadbalancer/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `logme`: [v0.2.1](services/logme/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `mariadb`: [v0.2.1](services/mariadb/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `mongodbflex`: [v0.2.1](services/mongodbflex/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing +- `objectstorage`: [v0.2.1](services/objectstorage/CHANGELOG.md#v021-2025-01-14) + - **Bugfix**: `configuration.py` region adjustment was missing + - `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) diff --git a/services/authorization/CHANGELOG.md b/services/authorization/CHANGELOG.md index f346570fd..96aa243b5 100644 --- a/services/authorization/CHANGELOG.md +++ b/services/authorization/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/authorization/pyproject.toml b/services/authorization/pyproject.toml index 5a57f70f6..95138287c 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/certificates/CHANGELOG.md b/services/certificates/CHANGELOG.md index 15d315f21..89687b178 100644 --- a/services/certificates/CHANGELOG.md +++ b/services/certificates/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/certificates/pyproject.toml b/services/certificates/pyproject.toml index 0627063ed..d3d657846 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/dns/CHANGELOG.md b/services/dns/CHANGELOG.md index c623cb549..606744e40 100644 --- a/services/dns/CHANGELOG.md +++ b/services/dns/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index e6d97cfc1..b24424de9 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.2.0" +version = "v0.2.1" authors = ["STACKIT Developer Tools "] description = "STACKIT DNS API" readme = "README.md" diff --git a/services/iaas/CHANGELOG.md b/services/iaas/CHANGELOG.md index 43a4e719d..1716ad5ee 100644 --- a/services/iaas/CHANGELOG.md +++ b/services/iaas/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.3.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/iaas/pyproject.toml b/services/iaas/pyproject.toml index 694795f14..982ffcec9 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.3.0" +version = "v0.3.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/lbapplication/CHANGELOG.md b/services/lbapplication/CHANGELOG.md index addda376d..9cd61493b 100644 --- a/services/lbapplication/CHANGELOG.md +++ b/services/lbapplication/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/lbapplication/pyproject.toml b/services/lbapplication/pyproject.toml index 7756ef17a..8768147da 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/loadbalancer/CHANGELOG.md b/services/loadbalancer/CHANGELOG.md index a8a42be0b..6268763bc 100644 --- a/services/loadbalancer/CHANGELOG.md +++ b/services/loadbalancer/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/loadbalancer/pyproject.toml b/services/loadbalancer/pyproject.toml index 32c61b361..cbe5bd4bb 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/logme/CHANGELOG.md b/services/logme/CHANGELOG.md index d2a5e32c3..c5612bded 100644 --- a/services/logme/CHANGELOG.md +++ b/services/logme/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/logme/pyproject.toml b/services/logme/pyproject.toml index ded48f9e2..802fbb4a7 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/mariadb/CHANGELOG.md b/services/mariadb/CHANGELOG.md index f181a0df4..0e58935d3 100644 --- a/services/mariadb/CHANGELOG.md +++ b/services/mariadb/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/mariadb/pyproject.toml b/services/mariadb/pyproject.toml index 59a140489..d74eeac75 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/mongodbflex/CHANGELOG.md b/services/mongodbflex/CHANGELOG.md index 091e898a8..3b49395c0 100644 --- a/services/mongodbflex/CHANGELOG.md +++ b/services/mongodbflex/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/mongodbflex/pyproject.toml b/services/mongodbflex/pyproject.toml index 38a1230a0..09551b098 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/objectstorage/CHANGELOG.md b/services/objectstorage/CHANGELOG.md index 1ae7c335b..0ba35f3ab 100644 --- a/services/objectstorage/CHANGELOG.md +++ b/services/objectstorage/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.2.1 (2025-01-14) + +- **Bugfix**: `configuration.py` region adjustment was missing + ## v0.2.0 (2025-01-13) - **Breaking Change:**: `get_host_from_settings` returns an error if a region is specified for a global URL. diff --git a/services/objectstorage/pyproject.toml b/services/objectstorage/pyproject.toml index e14a77c7c..08ce08720 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.2.0" +version = "v0.2.1" authors = [ "STACKIT Developer Tools ", ]