Skip to content

Generator: Update SDK /services/dns #670

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 2 commits into from
Feb 27, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request.
- `ske`: [v0.4.0](services/ske/CHANGELOG.md#v040-2025-02-27)
- `Nodepool`: `maximum` and `minimum` must be <= 1000
- `dns`: [v0.3.0](services/dns/CHANGELOG.md#v030-2025-02-27)
- Add support for extensions

## Release (2025-02-11)

Expand Down
4 changes: 4 additions & 0 deletions services/dns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.3.0 (2025-02-27)

- Add support for extensions

## v0.2.1 (2025-01-14)

- **Bugfix**: `configuration.py` region adjustment was missing
Expand Down
6 changes: 6 additions & 0 deletions services/dns/src/stackit/dns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
from stackit.dns.models.create_record_set_payload import CreateRecordSetPayload
from stackit.dns.models.create_zone_payload import CreateZonePayload
from stackit.dns.models.delete_label_response import DeleteLabelResponse
from stackit.dns.models.domain_extensions import DomainExtensions
from stackit.dns.models.domain_observability_extension import (
DomainObservabilityExtension,
)
from stackit.dns.models.error_message import ErrorMessage
from stackit.dns.models.export_record_sets_payload import ExportRecordSetsPayload
from stackit.dns.models.import_record_sets_payload import ImportRecordSetsPayload
Expand All @@ -65,8 +69,10 @@
from stackit.dns.models.validate_move_code_payload import ValidateMoveCodePayload
from stackit.dns.models.zone import Zone
from stackit.dns.models.zone_data_exchange import ZoneDataExchange
from stackit.dns.models.zone_extensions import ZoneExtensions
from stackit.dns.models.zone_models_import_record_model import (
ZoneModelsImportRecordModel,
)
from stackit.dns.models.zone_models_import_zone_json import ZoneModelsImportZoneJson
from stackit.dns.models.zone_observability_extension import ZoneObservabilityExtension
from stackit.dns.models.zone_response import ZoneResponse
3 changes: 3 additions & 0 deletions services/dns/src/stackit/dns/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ def create_move_code(
_response_types_map: Dict[str, Optional[str]] = {
"200": "MoveCodeResponse",
"400": "Message",
"409": "Message",
"502": "Message",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
Expand Down Expand Up @@ -739,6 +740,7 @@ def create_move_code_with_http_info(
_response_types_map: Dict[str, Optional[str]] = {
"200": "MoveCodeResponse",
"400": "Message",
"409": "Message",
"502": "Message",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
Expand Down Expand Up @@ -805,6 +807,7 @@ def create_move_code_without_preload_content(
_response_types_map: Dict[str, Optional[str]] = {
"200": "MoveCodeResponse",
"400": "Message",
"409": "Message",
"502": "Message",
}
response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
Expand Down
6 changes: 6 additions & 0 deletions services/dns/src/stackit/dns/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
from stackit.dns.models.create_record_set_payload import CreateRecordSetPayload
from stackit.dns.models.create_zone_payload import CreateZonePayload
from stackit.dns.models.delete_label_response import DeleteLabelResponse
from stackit.dns.models.domain_extensions import DomainExtensions
from stackit.dns.models.domain_observability_extension import (
DomainObservabilityExtension,
)
from stackit.dns.models.error_message import ErrorMessage
from stackit.dns.models.export_record_sets_payload import ExportRecordSetsPayload
from stackit.dns.models.import_record_sets_payload import ImportRecordSetsPayload
Expand All @@ -46,8 +50,10 @@
from stackit.dns.models.validate_move_code_payload import ValidateMoveCodePayload
from stackit.dns.models.zone import Zone
from stackit.dns.models.zone_data_exchange import ZoneDataExchange
from stackit.dns.models.zone_extensions import ZoneExtensions
from stackit.dns.models.zone_models_import_record_model import (
ZoneModelsImportRecordModel,
)
from stackit.dns.models.zone_models_import_zone_json import ZoneModelsImportZoneJson
from stackit.dns.models.zone_observability_extension import ZoneObservabilityExtension
from stackit.dns.models.zone_response import ZoneResponse
10 changes: 10 additions & 0 deletions services/dns/src/stackit/dns/models/create_zone_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
)
from typing_extensions import Annotated, Self

from stackit.dns.models.zone_extensions import ZoneExtensions


class CreateZonePayload(BaseModel):
"""
Expand All @@ -52,6 +54,7 @@ class CreateZonePayload(BaseModel):
expire_time: Optional[Annotated[int, Field(strict=True, ge=60)]] = Field(
default=None, description="expire time", alias="expireTime"
)
extensions: Optional[ZoneExtensions] = Field(default=None, description="optional extensions")
is_reverse_zone: Optional[StrictBool] = Field(
default=False, description="if the zone is a reverse zone or not", alias="isReverseZone"
)
Expand All @@ -74,6 +77,7 @@ class CreateZonePayload(BaseModel):
"description",
"dnsName",
"expireTime",
"extensions",
"isReverseZone",
"name",
"negativeCache",
Expand Down Expand Up @@ -130,6 +134,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of extensions
if self.extensions:
_dict["extensions"] = self.extensions.to_dict()
return _dict

@classmethod
Expand All @@ -151,6 +158,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"description": obj.get("description"),
"dnsName": obj.get("dnsName"),
"expireTime": obj.get("expireTime"),
"extensions": (
ZoneExtensions.from_dict(obj["extensions"]) if obj.get("extensions") is not None else None
),
"isReverseZone": obj.get("isReverseZone") if obj.get("isReverseZone") is not None else False,
"name": obj.get("name"),
"negativeCache": obj.get("negativeCache"),
Expand Down
99 changes: 99 additions & 0 deletions services/dns/src/stackit/dns/models/domain_extensions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# coding: utf-8

"""
STACKIT DNS API

This api provides dns

The version of the OpenAPI document: 1.0
Contact: dns@stackit.cloud
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
from typing_extensions import Self

from stackit.dns.models.domain_observability_extension import (
DomainObservabilityExtension,
)


class DomainExtensions(BaseModel):
"""
DomainExtensions
"""

observability_extension: Optional[DomainObservabilityExtension] = Field(
default=None, alias="observabilityExtension"
)
__properties: ClassVar[List[str]] = ["observabilityExtension"]

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 DomainExtensions 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,
)
# override the default output from pydantic by calling `to_dict()` of observability_extension
if self.observability_extension:
_dict["observabilityExtension"] = self.observability_extension.to_dict()
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of DomainExtensions from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate(
{
"observabilityExtension": (
DomainObservabilityExtension.from_dict(obj["observabilityExtension"])
if obj.get("observabilityExtension") is not None
else None
)
}
)
return _obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# coding: utf-8

"""
STACKIT DNS API

This api provides dns

The version of the OpenAPI document: 1.0
Contact: dns@stackit.cloud
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 DomainObservabilityExtension(BaseModel):
"""
DomainObservabilityExtension
"""

observability_instance_id: StrictStr = Field(alias="observabilityInstanceId")
state: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["observabilityInstanceId", "state"]

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

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

_obj = cls.model_validate(
{"observabilityInstanceId": obj.get("observabilityInstanceId"), "state": obj.get("state")}
)
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing_extensions import Annotated, Self

from stackit.dns.models.zone_extensions import ZoneExtensions


class PartialUpdateZonePayload(BaseModel):
"""
Expand All @@ -42,6 +44,7 @@ class PartialUpdateZonePayload(BaseModel):
expire_time: Optional[Annotated[int, Field(strict=True, ge=60)]] = Field(
default=None, description="expire time", alias="expireTime"
)
extensions: Optional[ZoneExtensions] = Field(default=None, description="optional extensions")
name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=63)]] = Field(
default=None, description="user given name"
)
Expand All @@ -61,6 +64,7 @@ class PartialUpdateZonePayload(BaseModel):
"defaultTTL",
"description",
"expireTime",
"extensions",
"name",
"negativeCache",
"primaries",
Expand Down Expand Up @@ -105,6 +109,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of extensions
if self.extensions:
_dict["extensions"] = self.extensions.to_dict()
return _dict

@classmethod
Expand All @@ -125,6 +132,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"defaultTTL": obj.get("defaultTTL"),
"description": obj.get("description"),
"expireTime": obj.get("expireTime"),
"extensions": (
ZoneExtensions.from_dict(obj["extensions"]) if obj.get("extensions") is not None else None
),
"name": obj.get("name"),
"negativeCache": obj.get("negativeCache"),
"primaries": obj.get("primaries"),
Expand Down
Loading
Loading