From aaa5b51aa00511e354b76d8bb050c60f21a092bd Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 4 Feb 2025 11:48:50 +0000 Subject: [PATCH 1/2] Generate lbapplication --- .../lbapplication/models/active_health_check.py | 16 +++------------- .../lbapplication/models/get_quota_response.py | 7 +------ .../src/stackit/lbapplication/models/listener.py | 11 ++++------- .../stackit/lbapplication/models/plan_details.py | 9 ++------- .../src/stackit/lbapplication/models/status.py | 9 ++------- .../stackit/lbapplication/models/target_pool.py | 7 +------ .../models/update_target_pool_payload.py | 7 +------ 7 files changed, 14 insertions(+), 52 deletions(-) diff --git a/services/lbapplication/src/stackit/lbapplication/models/active_health_check.py b/services/lbapplication/src/stackit/lbapplication/models/active_health_check.py index 1175db42..6b0931b4 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/active_health_check.py +++ b/services/lbapplication/src/stackit/lbapplication/models/active_health_check.py @@ -18,7 +18,7 @@ import re from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, field_validator from typing_extensions import Annotated, Self from stackit.lbapplication.models.http_health_checks import HttpHealthChecks @@ -29,7 +29,7 @@ class ActiveHealthCheck(BaseModel): ActiveHealthCheck """ - healthy_threshold: Optional[Any] = Field( + healthy_threshold: Optional[StrictInt] = Field( default=None, description="Healthy threshold of the health checking", alias="healthyThreshold" ) http_health_checks: Optional[HttpHealthChecks] = Field(default=None, alias="httpHealthChecks") @@ -44,7 +44,7 @@ class ActiveHealthCheck(BaseModel): timeout: Optional[Annotated[str, Field(strict=True)]] = Field( default=None, description="Active health checking timeout duration in seconds" ) - unhealthy_threshold: Optional[Any] = Field( + unhealthy_threshold: Optional[StrictInt] = Field( default=None, description="Unhealthy threshold of the health checking", alias="unhealthyThreshold" ) __properties: ClassVar[List[str]] = [ @@ -126,16 +126,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of http_health_checks if self.http_health_checks: _dict["httpHealthChecks"] = self.http_health_checks.to_dict() - # set to None if healthy_threshold (nullable) is None - # and model_fields_set contains the field - if self.healthy_threshold is None and "healthy_threshold" in self.model_fields_set: - _dict["healthyThreshold"] = None - - # set to None if unhealthy_threshold (nullable) is None - # and model_fields_set contains the field - if self.unhealthy_threshold is None and "unhealthy_threshold" in self.model_fields_set: - _dict["unhealthyThreshold"] = None - return _dict @classmethod diff --git a/services/lbapplication/src/stackit/lbapplication/models/get_quota_response.py b/services/lbapplication/src/stackit/lbapplication/models/get_quota_response.py index 34df7e1f..091e3f9c 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/get_quota_response.py +++ b/services/lbapplication/src/stackit/lbapplication/models/get_quota_response.py @@ -27,7 +27,7 @@ class GetQuotaResponse(BaseModel): GetQuotaResponse """ - max_load_balancers: Optional[Any] = Field( + max_load_balancers: Optional[Annotated[int, Field(le=999, strict=True, ge=-1)]] = Field( default=None, description="The maximum number of load balancing servers in this project. Unlimited if set to -1.", alias="maxLoadBalancers", @@ -91,11 +91,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if max_load_balancers (nullable) is None - # and model_fields_set contains the field - if self.max_load_balancers is None and "max_load_balancers" in self.model_fields_set: - _dict["maxLoadBalancers"] = None - return _dict @classmethod diff --git a/services/lbapplication/src/stackit/lbapplication/models/listener.py b/services/lbapplication/src/stackit/lbapplication/models/listener.py index cd69ac6b..71595b9d 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/listener.py +++ b/services/lbapplication/src/stackit/lbapplication/models/listener.py @@ -18,7 +18,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing_extensions import Self +from typing_extensions import Annotated, Self from stackit.lbapplication.models.protocol_options_https import ProtocolOptionsHTTPS from stackit.lbapplication.models.rule import Rule @@ -36,7 +36,9 @@ class Listener(BaseModel): default=None, description="Will be used to reference a listener and will replace display name in the future. Currently uses - as the name if no display name is given.", ) - port: Optional[Any] = Field(default=None, description="Port number where we listen for traffic") + port: Optional[Annotated[int, Field(le=65535, strict=True, ge=1)]] = Field( + default=None, description="Port number where we listen for traffic" + ) protocol: Optional[StrictStr] = Field( default=None, description="Protocol is the highest network protocol we understand to load balance. Currently PROTOCOL_HTTP and PROTOCOL_HTTPS are supported.", @@ -108,11 +110,6 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict["rules"] = _items - # set to None if port (nullable) is None - # and model_fields_set contains the field - if self.port is None and "port" in self.model_fields_set: - _dict["port"] = None - return _dict @classmethod diff --git a/services/lbapplication/src/stackit/lbapplication/models/plan_details.py b/services/lbapplication/src/stackit/lbapplication/models/plan_details.py index 66afa6c1..ab77d7e1 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/plan_details.py +++ b/services/lbapplication/src/stackit/lbapplication/models/plan_details.py @@ -17,7 +17,7 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing_extensions import Self @@ -28,7 +28,7 @@ class PlanDetails(BaseModel): description: Optional[StrictStr] = Field(default=None, description="Description") flavor_name: Optional[StrictStr] = Field(default=None, description="Flavor Name", alias="flavorName") - max_connections: Optional[Any] = Field( + max_connections: Optional[StrictInt] = Field( default=None, description="Maximum number of concurrent connections per application load balancer VM instance.", alias="maxConnections", @@ -74,11 +74,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if max_connections (nullable) is None - # and model_fields_set contains the field - if self.max_connections is None and "max_connections" in self.model_fields_set: - _dict["maxConnections"] = None - return _dict @classmethod diff --git a/services/lbapplication/src/stackit/lbapplication/models/status.py b/services/lbapplication/src/stackit/lbapplication/models/status.py index 74c33d24..467c7811 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/status.py +++ b/services/lbapplication/src/stackit/lbapplication/models/status.py @@ -17,7 +17,7 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing_extensions import Self from stackit.lbapplication.models.google_protobuf_any import GoogleProtobufAny @@ -28,7 +28,7 @@ class Status(BaseModel): The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). """ - code: Optional[Any] = Field( + code: Optional[StrictInt] = Field( default=None, description="The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].", ) @@ -86,11 +86,6 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict["details"] = _items - # set to None if code (nullable) is None - # and model_fields_set contains the field - if self.code is None and "code" in self.model_fields_set: - _dict["code"] = None - return _dict @classmethod diff --git a/services/lbapplication/src/stackit/lbapplication/models/target_pool.py b/services/lbapplication/src/stackit/lbapplication/models/target_pool.py index e0b7a3c7..f616706f 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/target_pool.py +++ b/services/lbapplication/src/stackit/lbapplication/models/target_pool.py @@ -32,7 +32,7 @@ class TargetPool(BaseModel): active_health_check: Optional[ActiveHealthCheck] = Field(default=None, alias="activeHealthCheck") name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Target pool name") - target_port: Optional[Any] = Field( + target_port: Optional[Annotated[int, Field(le=65535, strict=True, ge=1)]] = Field( default=None, description="The number identifying the port where each target listens for traffic.", alias="targetPort", @@ -99,11 +99,6 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict["targets"] = _items - # set to None if target_port (nullable) is None - # and model_fields_set contains the field - if self.target_port is None and "target_port" in self.model_fields_set: - _dict["targetPort"] = None - return _dict @classmethod diff --git a/services/lbapplication/src/stackit/lbapplication/models/update_target_pool_payload.py b/services/lbapplication/src/stackit/lbapplication/models/update_target_pool_payload.py index 7af93e7b..a742b917 100644 --- a/services/lbapplication/src/stackit/lbapplication/models/update_target_pool_payload.py +++ b/services/lbapplication/src/stackit/lbapplication/models/update_target_pool_payload.py @@ -32,7 +32,7 @@ class UpdateTargetPoolPayload(BaseModel): active_health_check: Optional[ActiveHealthCheck] = Field(default=None, alias="activeHealthCheck") name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Target pool name") - target_port: Optional[Any] = Field( + target_port: Optional[Annotated[int, Field(le=65535, strict=True, ge=1)]] = Field( default=None, description="The number identifying the port where each target listens for traffic.", alias="targetPort", @@ -99,11 +99,6 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict["targets"] = _items - # set to None if target_port (nullable) is None - # and model_fields_set contains the field - if self.target_port is None and "target_port" in self.model_fields_set: - _dict["targetPort"] = None - return _dict @classmethod From 82dd5ebe8a49a9230ca63922510dd2eb8d2e89cc Mon Sep 17 00:00:00 2001 From: Alexander Dahmen Date: Fri, 7 Feb 2025 13:40:07 +0100 Subject: [PATCH 2/2] Add changelog Signed-off-by: Alexander Dahmen --- CHANGELOG.md | 2 ++ services/lbapplication/CHANGELOG.md | 4 ++++ services/lbapplication/pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a8efc95..75176a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Release (2025-XX-XX) +- `lbapplication`: [v0.3.0](services/lbapplication/CHANGELOG.md#v030-2025-02-07) + - **Bugfix**: Set type from interface to int64 of `HealthyThreshold`, `UnhealthyThreshold`, `MaxLoadBalancers`, `Port`, `MaxConnections`, `Code` and `TargetPort` - `ske`: [v0.3.0](services/ske/CHANGELOG.md#v030-2025-02-06) - **Removal:** The following methods were removed after deprecation (2024-04-16) and [`serviceenablement` SDK](https://github.com/stackitcloud/stackit-sdk-python/tree/main/services/serviceenablement) must be used instead. - `DisableService` diff --git a/services/lbapplication/CHANGELOG.md b/services/lbapplication/CHANGELOG.md index 9cd61493..05e13b95 100644 --- a/services/lbapplication/CHANGELOG.md +++ b/services/lbapplication/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.3.0 (2025-02-07) + +- **Bugfix**: Set type from interface to int64 of `HealthyThreshold`, `UnhealthyThreshold`, `MaxLoadBalancers`, `Port`, `MaxConnections`, `Code` and `TargetPort` + ## v0.2.1 (2025-01-14) - **Bugfix**: `configuration.py` region adjustment was missing diff --git a/services/lbapplication/pyproject.toml b/services/lbapplication/pyproject.toml index 8768147d..3912c8f3 100644 --- a/services/lbapplication/pyproject.toml +++ b/services/lbapplication/pyproject.toml @@ -3,7 +3,7 @@ name = "stackit-lbapplication" [tool.poetry] name = "stackit-lbapplication" -version = "v0.2.1" +version = "v0.3.0" authors = [ "STACKIT Developer Tools ", ]