Skip to content

Generator: Update SDK /services/authorization #1160

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 6 commits into from
May 14, 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions services/authorization/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions services/ske/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.4.2 (2025-05-13)
- **Feature:** Added `ClusterError`

## v0.4.1 (2025-05-09)
- **Feature:** Update user-agent header

Expand Down
2 changes: 1 addition & 1 deletion services/ske/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-ske"

[tool.poetry]
name = "stackit-ske"
version = "v0.4.1"
version = "v0.4.2"
authors = [
"STACKIT Developer Tools <[email protected]>",
]
Expand Down
1 change: 1 addition & 0 deletions services/ske/src/stackit/ske/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions services/ske/src/stackit/ske/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
101 changes: 101 additions & 0 deletions services/ske/src/stackit/ske/models/cluster_error.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions services/ske/src/stackit/ske/models/cluster_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,13 +43,15 @@ class ClusterStatus(BaseModel):
alias="egressAddressRanges",
)
error: Optional[RuntimeError] = None
errors: Optional[List[ClusterError]] = None
hibernated: Optional[StrictBool] = None
__properties: ClassVar[List[str]] = [
"aggregated",
"creationTime",
"credentialsRotation",
"egressAddressRanges",
"error",
"errors",
"hibernated",
]

Expand Down Expand Up @@ -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
Expand All @@ -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"),
}
)
Expand Down
3 changes: 3 additions & 0 deletions services/stackitmarketplace/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion services/stackitmarketplace/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "stackit-stackitmarketplace"

[tool.poetry]
name = "stackit-stackitmarketplace"
version = "v1.0.1"
version = "v1.1.0"
authors = [
"STACKIT Developer Tools <[email protected]>",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
Expand Down
Loading