Skip to content

Generator: Update SDK /services/loadbalancer #1255

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
from stackit.loadbalancer.models.options_tcp import OptionsTCP
from stackit.loadbalancer.models.options_udp import OptionsUDP
from stackit.loadbalancer.models.plan_details import PlanDetails
from stackit.loadbalancer.models.security_group import SecurityGroup
from stackit.loadbalancer.models.server_name_indicator import ServerNameIndicator
from stackit.loadbalancer.models.session_persistence import SessionPersistence
from stackit.loadbalancer.models.status import Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from stackit.loadbalancer.models.options_tcp import OptionsTCP
from stackit.loadbalancer.models.options_udp import OptionsUDP
from stackit.loadbalancer.models.plan_details import PlanDetails
from stackit.loadbalancer.models.security_group import SecurityGroup
from stackit.loadbalancer.models.server_name_indicator import ServerNameIndicator
from stackit.loadbalancer.models.session_persistence import SessionPersistence
from stackit.loadbalancer.models.status import Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from stackit.loadbalancer.models.load_balancer_error import LoadBalancerError
from stackit.loadbalancer.models.load_balancer_options import LoadBalancerOptions
from stackit.loadbalancer.models.network import Network
from stackit.loadbalancer.models.security_group import SecurityGroup
from stackit.loadbalancer.models.target_pool import TargetPool


Expand Down Expand Up @@ -70,6 +71,11 @@ class CreateLoadBalancerPayload(BaseModel):
description="List of all target pools which will be used in the load balancer. Limited to 20.",
alias="targetPools",
)
target_security_group: Optional[SecurityGroup] = Field(
default=None,
description="Security Group permitting network traffic from the LoadBalancer to the targets.",
alias="targetSecurityGroup",
)
version: Optional[StrictStr] = Field(
default=None,
description="Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case.",
Expand All @@ -86,6 +92,7 @@ class CreateLoadBalancerPayload(BaseModel):
"region",
"status",
"targetPools",
"targetSecurityGroup",
"version",
]

Expand Down Expand Up @@ -146,13 +153,15 @@ def to_dict(self) -> Dict[str, Any]:
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
"""
excluded_fields: Set[str] = set(
[
"errors",
"private_address",
"region",
"status",
"target_security_group",
]
)

Expand Down Expand Up @@ -192,6 +201,9 @@ def to_dict(self) -> Dict[str, Any]:
if _item:
_items.append(_item.to_dict())
_dict["targetPools"] = _items
# override the default output from pydantic by calling `to_dict()` of target_security_group
if self.target_security_group:
_dict["targetSecurityGroup"] = self.target_security_group.to_dict()
return _dict

@classmethod
Expand Down Expand Up @@ -230,6 +242,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if obj.get("targetPools") is not None
else None
),
"targetSecurityGroup": (
SecurityGroup.from_dict(obj["targetSecurityGroup"])
if obj.get("targetSecurityGroup") is not None
else None
),
"version": obj.get("version"),
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from stackit.loadbalancer.models.load_balancer_error import LoadBalancerError
from stackit.loadbalancer.models.load_balancer_options import LoadBalancerOptions
from stackit.loadbalancer.models.network import Network
from stackit.loadbalancer.models.security_group import SecurityGroup
from stackit.loadbalancer.models.target_pool import TargetPool


Expand Down Expand Up @@ -70,6 +71,11 @@ class LoadBalancer(BaseModel):
description="List of all target pools which will be used in the load balancer. Limited to 20.",
alias="targetPools",
)
target_security_group: Optional[SecurityGroup] = Field(
default=None,
description="Security Group permitting network traffic from the LoadBalancer to the targets.",
alias="targetSecurityGroup",
)
version: Optional[StrictStr] = Field(
default=None,
description="Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case.",
Expand All @@ -86,6 +92,7 @@ class LoadBalancer(BaseModel):
"region",
"status",
"targetPools",
"targetSecurityGroup",
"version",
]

Expand Down Expand Up @@ -146,13 +153,15 @@ def to_dict(self) -> Dict[str, Any]:
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
"""
excluded_fields: Set[str] = set(
[
"errors",
"private_address",
"region",
"status",
"target_security_group",
]
)

Expand Down Expand Up @@ -192,6 +201,9 @@ def to_dict(self) -> Dict[str, Any]:
if _item:
_items.append(_item.to_dict())
_dict["targetPools"] = _items
# override the default output from pydantic by calling `to_dict()` of target_security_group
if self.target_security_group:
_dict["targetSecurityGroup"] = self.target_security_group.to_dict()
return _dict

@classmethod
Expand Down Expand Up @@ -230,6 +242,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if obj.get("targetPools") is not None
else None
),
"targetSecurityGroup": (
SecurityGroup.from_dict(obj["targetSecurityGroup"])
if obj.get("targetSecurityGroup") is not None
else None
),
"version": obj.get("version"),
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# coding: utf-8

"""
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 load balancer provided, two VMs are deployed in your OpenStack project subject to a fee.

The version of the OpenAPI document: 2.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 SecurityGroup(BaseModel):
"""
SecurityGroup
"""

id: Optional[StrictStr] = Field(default=None, description="ID of the security Group")
name: Optional[StrictStr] = Field(default=None, description="Name of the security Group")
__properties: ClassVar[List[str]] = ["id", "name"]

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 SecurityGroup 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 SecurityGroup from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"id": obj.get("id"), "name": obj.get("name")})
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from stackit.loadbalancer.models.load_balancer_error import LoadBalancerError
from stackit.loadbalancer.models.load_balancer_options import LoadBalancerOptions
from stackit.loadbalancer.models.network import Network
from stackit.loadbalancer.models.security_group import SecurityGroup
from stackit.loadbalancer.models.target_pool import TargetPool


Expand Down Expand Up @@ -70,6 +71,11 @@ class UpdateLoadBalancerPayload(BaseModel):
description="List of all target pools which will be used in the load balancer. Limited to 20.",
alias="targetPools",
)
target_security_group: Optional[SecurityGroup] = Field(
default=None,
description="Security Group permitting network traffic from the LoadBalancer to the targets.",
alias="targetSecurityGroup",
)
version: Optional[StrictStr] = Field(
default=None,
description="Load balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this load balancer resource that changes during updates of the load balancers. On updates this field specified the load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case.",
Expand All @@ -86,6 +92,7 @@ class UpdateLoadBalancerPayload(BaseModel):
"region",
"status",
"targetPools",
"targetSecurityGroup",
"version",
]

Expand Down Expand Up @@ -146,13 +153,15 @@ def to_dict(self) -> Dict[str, Any]:
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
* OpenAPI `readOnly` fields are excluded.
"""
excluded_fields: Set[str] = set(
[
"errors",
"private_address",
"region",
"status",
"target_security_group",
]
)

Expand Down Expand Up @@ -192,6 +201,9 @@ def to_dict(self) -> Dict[str, Any]:
if _item:
_items.append(_item.to_dict())
_dict["targetPools"] = _items
# override the default output from pydantic by calling `to_dict()` of target_security_group
if self.target_security_group:
_dict["targetSecurityGroup"] = self.target_security_group.to_dict()
return _dict

@classmethod
Expand Down Expand Up @@ -230,6 +242,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if obj.get("targetPools") is not None
else None
),
"targetSecurityGroup": (
SecurityGroup.from_dict(obj["targetSecurityGroup"])
if obj.get("targetSecurityGroup") is not None
else None
),
"version": obj.get("version"),
}
)
Expand Down
Loading