diff --git a/CHANGELOG.md b/CHANGELOG.md index c470c1473..68b306be7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## Release (2025-XX-XX) +- `authorization`: [v0.2.4](services/authorization/CHANGELOG.md#v024-2025-05-13) + - **Bugfix:** Updated regex validator +- `stackitmarketplace`: [v1.1.0](services/stackitmarketplace/CHANGELOG.md#v110-2025-05-13) + - **Breaking Change:** Added organization id to `VendorSubscription` +- `ske`: [v0.4.2](services/ske/CHANGELOG.md#v042-2025-05-13) + - **Feature:** Added `ClusterError` + ## Release (2025-05-09) - `stackitmarketplace`: - [v1.0.1](services/stackitmarketplace/CHANGELOG.md#v101-2025-05-09) diff --git a/services/authorization/CHANGELOG.md b/services/authorization/CHANGELOG.md index 0498abc94..9490e02a6 100644 --- a/services/authorization/CHANGELOG.md +++ b/services/authorization/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.2.4 (2025-05-13) +- **Bugfix:** Updated regex validator + ## v0.2.3 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/authorization/src/stackit/authorization/models/existing_permission.py b/services/authorization/src/stackit/authorization/models/existing_permission.py index 165f8ac3d..5bcdfe05b 100644 --- a/services/authorization/src/stackit/authorization/models/existing_permission.py +++ b/services/authorization/src/stackit/authorization/models/existing_permission.py @@ -34,8 +34,8 @@ class ExistingPermission(BaseModel): @field_validator("name") def name_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^[a-z](?:-?\.?[a-z]){1,63}$", value): - raise ValueError(r"must validate the regular expression /^[a-z](?:-?\.?[a-z]){1,63}$/") + if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value): + raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/") return value model_config = ConfigDict( diff --git a/services/authorization/src/stackit/authorization/models/member.py b/services/authorization/src/stackit/authorization/models/member.py index 2737a9e4c..f1c58eceb 100644 --- a/services/authorization/src/stackit/authorization/models/member.py +++ b/services/authorization/src/stackit/authorization/models/member.py @@ -34,8 +34,8 @@ class Member(BaseModel): @field_validator("role") def role_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^[a-z](?:-?\.?[a-z]){1,63}$", value): - raise ValueError(r"must validate the regular expression /^[a-z](?:-?\.?[a-z]){1,63}$/") + if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value): + raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/") return value model_config = ConfigDict( diff --git a/services/authorization/src/stackit/authorization/models/permission.py b/services/authorization/src/stackit/authorization/models/permission.py index fb24fcb69..1ee48273e 100644 --- a/services/authorization/src/stackit/authorization/models/permission.py +++ b/services/authorization/src/stackit/authorization/models/permission.py @@ -34,8 +34,8 @@ class Permission(BaseModel): @field_validator("name") def name_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^[a-z](?:-?\.?[a-z]){1,63}$", value): - raise ValueError(r"must validate the regular expression /^[a-z](?:-?\.?[a-z]){1,63}$/") + if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value): + raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/") return value model_config = ConfigDict( diff --git a/services/authorization/src/stackit/authorization/models/role.py b/services/authorization/src/stackit/authorization/models/role.py index b13dfbc2a..b7baa8f3a 100644 --- a/services/authorization/src/stackit/authorization/models/role.py +++ b/services/authorization/src/stackit/authorization/models/role.py @@ -48,8 +48,8 @@ def id_validate_regular_expression(cls, value): @field_validator("name") def name_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^[a-z](?:-?\.?[a-z]){1,63}$", value): - raise ValueError(r"must validate the regular expression /^[a-z](?:-?\.?[a-z]){1,63}$/") + if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value): + raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/") return value model_config = ConfigDict( diff --git a/services/authorization/src/stackit/authorization/models/user_membership.py b/services/authorization/src/stackit/authorization/models/user_membership.py index 8df22d39f..7b55f7a0d 100644 --- a/services/authorization/src/stackit/authorization/models/user_membership.py +++ b/services/authorization/src/stackit/authorization/models/user_membership.py @@ -50,8 +50,8 @@ def resource_type_validate_regular_expression(cls, value): @field_validator("role") def role_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^[a-z](?:-?\.?[a-z]){1,63}$", value): - raise ValueError(r"must validate the regular expression /^[a-z](?:-?\.?[a-z]){1,63}$/") + if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value): + raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/") return value model_config = ConfigDict( diff --git a/services/ske/CHANGELOG.md b/services/ske/CHANGELOG.md index 9e0de15c1..e5000e490 100644 --- a/services/ske/CHANGELOG.md +++ b/services/ske/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.4.2 (2025-05-13) +- **Feature:** Added `ClusterError` + ## v0.4.1 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/ske/pyproject.toml b/services/ske/pyproject.toml index d42366d0e..b7c4ed69d 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.4.1" +version = "v0.4.2" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/ske/src/stackit/ske/__init__.py b/services/ske/src/stackit/ske/__init__.py index 5c6cea229..2a0cd7961 100644 --- a/services/ske/src/stackit/ske/__init__.py +++ b/services/ske/src/stackit/ske/__init__.py @@ -37,6 +37,7 @@ from stackit.ske.models.argus import Argus from stackit.ske.models.availability_zone import AvailabilityZone from stackit.ske.models.cluster import Cluster +from stackit.ske.models.cluster_error import ClusterError from stackit.ske.models.cluster_status import ClusterStatus from stackit.ske.models.cluster_status_state import ClusterStatusState from stackit.ske.models.create_kubeconfig_payload import CreateKubeconfigPayload diff --git a/services/ske/src/stackit/ske/models/__init__.py b/services/ske/src/stackit/ske/models/__init__.py index 2844c2d1f..f4fa80bdd 100644 --- a/services/ske/src/stackit/ske/models/__init__.py +++ b/services/ske/src/stackit/ske/models/__init__.py @@ -18,6 +18,7 @@ from stackit.ske.models.argus import Argus from stackit.ske.models.availability_zone import AvailabilityZone from stackit.ske.models.cluster import Cluster +from stackit.ske.models.cluster_error import ClusterError from stackit.ske.models.cluster_status import ClusterStatus from stackit.ske.models.cluster_status_state import ClusterStatusState from stackit.ske.models.create_kubeconfig_payload import CreateKubeconfigPayload diff --git a/services/ske/src/stackit/ske/models/cluster_error.py b/services/ske/src/stackit/ske/models/cluster_error.py new file mode 100644 index 000000000..3afa11a77 --- /dev/null +++ b/services/ske/src/stackit/ske/models/cluster_error.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + SKE-API + + The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. + + The version of the OpenAPI document: 1.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 docstring might be too long + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing_extensions import Self + + +class ClusterError(BaseModel): + """ + ClusterError + """ + + code: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["code", "message"] + + @field_validator("code") + def code_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set( + [ + "SKE_OBSERVABILITY_INSTANCE_NOT_FOUND", + "SKE_DNS_ZONE_NOT_FOUND", + "SKE_NODE_MISCONFIGURED_PDB", + "SKE_NODE_NO_VALID_HOST_FOUND", + ] + ): + raise ValueError( + "must be one of enum values ('SKE_OBSERVABILITY_INSTANCE_NOT_FOUND', 'SKE_DNS_ZONE_NOT_FOUND', 'SKE_NODE_MISCONFIGURED_PDB', 'SKE_NODE_NO_VALID_HOST_FOUND')" + ) + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ClusterError from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ClusterError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"code": obj.get("code"), "message": obj.get("message")}) + return _obj diff --git a/services/ske/src/stackit/ske/models/cluster_status.py b/services/ske/src/stackit/ske/models/cluster_status.py index b9eed0e81..02d1410bb 100644 --- a/services/ske/src/stackit/ske/models/cluster_status.py +++ b/services/ske/src/stackit/ske/models/cluster_status.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing_extensions import Self +from stackit.ske.models.cluster_error import ClusterError from stackit.ske.models.cluster_status_state import ClusterStatusState from stackit.ske.models.credentials_rotation_state import CredentialsRotationState from stackit.ske.models.runtime_error import RuntimeError @@ -42,6 +43,7 @@ class ClusterStatus(BaseModel): alias="egressAddressRanges", ) error: Optional[RuntimeError] = None + errors: Optional[List[ClusterError]] = None hibernated: Optional[StrictBool] = None __properties: ClassVar[List[str]] = [ "aggregated", @@ -49,6 +51,7 @@ class ClusterStatus(BaseModel): "credentialsRotation", "egressAddressRanges", "error", + "errors", "hibernated", ] @@ -95,6 +98,13 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of error if self.error: _dict["error"] = self.error.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) + _dict["errors"] = _items return _dict @classmethod @@ -119,6 +129,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: ), "egressAddressRanges": obj.get("egressAddressRanges"), "error": RuntimeError.from_dict(obj["error"]) if obj.get("error") is not None else None, + "errors": ( + [ClusterError.from_dict(_item) for _item in obj["errors"]] + if obj.get("errors") is not None + else None + ), "hibernated": obj.get("hibernated"), } ) diff --git a/services/stackitmarketplace/CHANGELOG.md b/services/stackitmarketplace/CHANGELOG.md index 5f195b4a2..10001b712 100644 --- a/services/stackitmarketplace/CHANGELOG.md +++ b/services/stackitmarketplace/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.0 (2025-05-13) +- **Breaking Change:** Added organization id to `VendorSubscription` + ## v1.0.1 (2025-05-09) - **Feature:** Update user-agent header diff --git a/services/stackitmarketplace/pyproject.toml b/services/stackitmarketplace/pyproject.toml index e3e5cb3f3..e705a1fcf 100644 --- a/services/stackitmarketplace/pyproject.toml +++ b/services/stackitmarketplace/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-stackitmarketplace" [tool.poetry] name = "stackit-stackitmarketplace" -version = "v1.0.1" +version = "v1.1.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py index 9491852a4..25b78e5cf 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/api/default_api.py @@ -1514,9 +1514,9 @@ def list_vendor_subscriptions( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ListVendorSubscriptionsResponse: - """List all subscriptions + """List all subscriptions of a project. - List all subscriptions. + List all subscriptions of a project. :param project_id: The project ID. (required) :type project_id: str @@ -1606,9 +1606,9 @@ def list_vendor_subscriptions_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[ListVendorSubscriptionsResponse]: - """List all subscriptions + """List all subscriptions of a project. - List all subscriptions. + List all subscriptions of a project. :param project_id: The project ID. (required) :type project_id: str @@ -1698,9 +1698,9 @@ def list_vendor_subscriptions_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List all subscriptions + """List all subscriptions of a project. - List all subscriptions. + List all subscriptions of a project. :param project_id: The project ID. (required) :type project_id: str diff --git a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py index 019618424..e01948049 100644 --- a/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py +++ b/services/stackitmarketplace/src/stackit/stackitmarketplace/models/vendor_subscription.py @@ -33,10 +33,11 @@ class VendorSubscription(BaseModel): """ lifecycle_state: SubscriptionLifecycleState = Field(alias="lifecycleState") + organization_id: object = Field(alias="organizationId") product: SubscriptionProduct project_id: object = Field(alias="projectId") subscription_id: object = Field(alias="subscriptionId") - __properties: ClassVar[List[str]] = ["lifecycleState", "product", "projectId", "subscriptionId"] + __properties: ClassVar[List[str]] = ["lifecycleState", "organizationId", "product", "projectId", "subscriptionId"] model_config = ConfigDict( populate_by_name=True, @@ -92,6 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { "lifecycleState": obj.get("lifecycleState"), + "organizationId": obj.get("organizationId"), "product": SubscriptionProduct.from_dict(obj["product"]) if obj.get("product") is not None else None, "projectId": obj.get("projectId"), "subscriptionId": obj.get("subscriptionId"),