Skip to content

Ft/region adjustment #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions services/authorization/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion services/authorization/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-authorization"

[tool.poetry]
name = "stackit-authorization"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/certificates/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion services/certificates/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-certificates"

[tool.poetry]
name = "stackit-certificates"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/dns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/dns/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-dns"

[tool.poetry]
name = "stackit-dns"
version = "v0.1.0"
version = "v0.2.0"
authors = ["STACKIT Developer Tools <developer-tools@stackit.cloud>"]
description = "STACKIT DNS API"
readme = "README.md"
Expand Down
6 changes: 6 additions & 0 deletions services/iaas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion services/iaas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-iaas"

[tool.poetry]
name = "stackit-iaas"
version = "v0.2.0"
version = "v0.3.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/lbapplication/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion services/lbapplication/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-lbapplication"

[tool.poetry]
name = "stackit-lbapplication"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/loadbalancer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/loadbalancer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-loadbalancer"

[tool.poetry]
name = "stackit-loadbalancer"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/logme/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/logme/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-logme"

[tool.poetry]
name = "stackit-logme"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/mariadb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/mariadb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-mariadb"

[tool.poetry]
name = "stackit-mariadb"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/mongodbflex/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/mongodbflex/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-mongodbflex"

[tool.poetry]
name = "stackit-mongodbflex"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/objectstorage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/objectstorage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-objectstorage"

[tool.poetry]
name = "stackit-objectstorage"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
6 changes: 6 additions & 0 deletions services/observability/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/observability/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-observability"

[tool.poetry]
name = "stackit-observability"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
Do not edit the class manually.
""" # noqa: E501 docstring might be too long

import os


class HostConfiguration:
def __init__(
Expand All @@ -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
"""
Expand Down Expand Up @@ -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:
Expand All @@ -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"]:
Expand Down
6 changes: 6 additions & 0 deletions services/opensearch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/opensearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-opensearch"

[tool.poetry]
name = "stackit-opensearch"
version = "v0.1.0"
version = "v0.2.0"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
29 changes: 28 additions & 1 deletion services/opensearch/src/stackit/opensearch/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
Do not edit the class manually.
""" # noqa: E501 docstring might be too long

import os


class HostConfiguration:
def __init__(
Expand All @@ -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
"""
Expand Down Expand Up @@ -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:
Expand All @@ -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"]:
Expand Down
Loading
Loading