Skip to content

Commit 1ad1794

Browse files
committed
Region adjustment
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. Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
1 parent 59a929d commit 1ad1794

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

templates/python/configuration.mustache

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class HostConfiguration:
88
server_operation_index=None, server_operation_variables=None,
99
ignore_operation_servers=False,
1010
) -> None:
11+
print('''WARNING: 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.
12+
Once all services have migrated, the methods to specify the region in the client configuration will be removed.''')
1113
"""Constructor
1214
"""
1315
self._base_path = "{{{basePath}}}"
@@ -67,6 +69,7 @@ class HostConfiguration:
6769
:param index: array index of the host settings
6870
:param variables: hash of variable and the corresponding value
6971
:param servers: an array of host settings or None
72+
:error: if a region is given for a global url
7073
:return: URL based on host settings
7174
"""
7275
if index is None:
@@ -86,6 +89,12 @@ class HostConfiguration:
8689

8790
# go through variables and replace placeholders
8891
for variable_name, variable in server.get('variables', {}).items():
92+
# If a region is provided by the user return an error.
93+
# The region is provided as a function argument instead of being set in the client configuration.
94+
if variable_name == 'region' and variables.get(variable_name) is not None:
95+
raise ValueError(
96+
"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"
97+
)
8998
used_value = variables.get(
9099
variable_name, variable['default_value'])
91100

0 commit comments

Comments
 (0)