From 9d1fb79e4043d3c584d3f7a4926689f5a9e5a411 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 14 May 2025 09:33:33 +0000 Subject: [PATCH 1/3] Generate alb --- services/alb/src/stackit/alb/__init__.py | 1 + .../alb/src/stackit/alb/models/__init__.py | 1 + services/alb/src/stackit/alb/models/path.py | 88 +++++++++++++++++++ services/alb/src/stackit/alb/models/rule.py | 9 +- 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 services/alb/src/stackit/alb/models/path.py diff --git a/services/alb/src/stackit/alb/__init__.py b/services/alb/src/stackit/alb/__init__.py index 38e7ff75..71e37e80 100644 --- a/services/alb/src/stackit/alb/__init__.py +++ b/services/alb/src/stackit/alb/__init__.py @@ -62,6 +62,7 @@ LoadbalancerOptionObservability, ) from stackit.alb.models.network import Network +from stackit.alb.models.path import Path from stackit.alb.models.plan_details import PlanDetails from stackit.alb.models.protocol_options_http import ProtocolOptionsHTTP from stackit.alb.models.protocol_options_https import ProtocolOptionsHTTPS diff --git a/services/alb/src/stackit/alb/models/__init__.py b/services/alb/src/stackit/alb/models/__init__.py index e4dba07e..55bedd8d 100644 --- a/services/alb/src/stackit/alb/models/__init__.py +++ b/services/alb/src/stackit/alb/models/__init__.py @@ -43,6 +43,7 @@ LoadbalancerOptionObservability, ) from stackit.alb.models.network import Network +from stackit.alb.models.path import Path from stackit.alb.models.plan_details import PlanDetails from stackit.alb.models.protocol_options_http import ProtocolOptionsHTTP from stackit.alb.models.protocol_options_https import ProtocolOptionsHTTPS diff --git a/services/alb/src/stackit/alb/models/path.py b/services/alb/src/stackit/alb/models/path.py new file mode 100644 index 00000000..c3f28f86 --- /dev/null +++ b/services/alb/src/stackit/alb/models/path.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Application Load Balancer API + + This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + + The version of the OpenAPI document: 2beta2.0.0 + 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, Field, StrictStr +from typing_extensions import Self + + +class Path(BaseModel): + """ + Path + """ + + exact: Optional[StrictStr] = Field( + default=None, + description="Exact path match. Only a request path exactly equal to the value will match, e.g. '/foo' matches only '/foo', not '/foo/bar' or '/foobar'.", + ) + prefix: Optional[StrictStr] = Field( + default=None, + description="Prefix path match. Only matches on full segment boundaries, e.g. '/foo' matches '/foo' and '/foo/bar' but NOT '/foobar'.", + ) + __properties: ClassVar[List[str]] = ["exact", "prefix"] + + 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 Path 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 Path from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"exact": obj.get("exact"), "prefix": obj.get("prefix")}) + return _obj diff --git a/services/alb/src/stackit/alb/models/rule.py b/services/alb/src/stackit/alb/models/rule.py index ca7dd2de..9b4cc2e4 100644 --- a/services/alb/src/stackit/alb/models/rule.py +++ b/services/alb/src/stackit/alb/models/rule.py @@ -22,6 +22,7 @@ from stackit.alb.models.cookie_persistence import CookiePersistence from stackit.alb.models.http_header import HttpHeader +from stackit.alb.models.path import Path from stackit.alb.models.query_parameter import QueryParameter @@ -32,9 +33,10 @@ class Rule(BaseModel): cookie_persistence: Optional[CookiePersistence] = Field(default=None, alias="cookiePersistence") headers: Optional[List[HttpHeader]] = Field(default=None, description="Headers for the rule.") + path: Optional[Path] = None path_prefix: Optional[StrictStr] = Field( default=None, - description="Path prefix for the rule. If empty or '/', it matches the root path.", + description="Legacy path prefix match. Optional. If not set, defaults to root path '/'. Cannot be set if 'path' is used. Prefer using 'path.prefix' instead. Only matches on full segment boundaries, e.g. '/foo' matches '/foo' and '/foo/bar' but NOT '/foobar'.", alias="pathPrefix", ) query_parameters: Optional[List[QueryParameter]] = Field( @@ -51,6 +53,7 @@ class Rule(BaseModel): __properties: ClassVar[List[str]] = [ "cookiePersistence", "headers", + "path", "pathPrefix", "queryParameters", "targetPool", @@ -104,6 +107,9 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict["headers"] = _items + # override the default output from pydantic by calling `to_dict()` of path + if self.path: + _dict["path"] = self.path.to_dict() # override the default output from pydantic by calling `to_dict()` of each item in query_parameters (list) _items = [] if self.query_parameters: @@ -134,6 +140,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("headers") is not None else None ), + "path": Path.from_dict(obj["path"]) if obj.get("path") is not None else None, "pathPrefix": obj.get("pathPrefix"), "queryParameters": ( [QueryParameter.from_dict(_item) for _item in obj["queryParameters"]] From cee8fb9404a488c4c65812f8ae782f1eb8c5ac2d Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 14 May 2025 14:31:38 +0200 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ services/alb/CHANGELOG.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b306be..2d1ee535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## Release (2025-XX-XX) +- `alb`: [v0.2.0](services/alb/CHANGELOG.md#v020-2025-05-14) + - **Feature:** New field `Path` for `Rule` + - `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) diff --git a/services/alb/CHANGELOG.md b/services/alb/CHANGELOG.md index 91e077b1..a03d0f53 100644 --- a/services/alb/CHANGELOG.md +++ b/services/alb/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.2.0 (2025-05-14) +- **Feature:** New field `Path` for `Rule` + ## v0.1.2 (2025-05-09) - **Feature:** Update user-agent header From 71eb1cae611c6420ed3d7f5463eee800589e2441 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 14 May 2025 14:33:51 +0200 Subject: [PATCH 3/3] update pyproject.toml --- services/alb/pyproject.toml | 2 +- services/authorization/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/alb/pyproject.toml b/services/alb/pyproject.toml index 7f139dee..859831ca 100644 --- a/services/alb/pyproject.toml +++ b/services/alb/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-alb" [tool.poetry] name = "stackit-alb" -version = "v0.1.2" +version = "v0.2.0" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/authorization/pyproject.toml b/services/authorization/pyproject.toml index b72ee8e7..d879e30c 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.3" +version = "v0.2.4" authors = [ "STACKIT Developer Tools ", ]