Skip to content
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
2 changes: 1 addition & 1 deletion services/dns/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
864bdad12a54f612df8fcdb6e41dd2933e94c3af
da4701b7dbe20e984aef89711bb9ba716e19fcba
4 changes: 4 additions & 0 deletions services/dns/src/stackit/dns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"CloneZonePayload",
"CreateLabelPayload",
"CreateLabelResponse",
"CreateMoveCodePayload",
"CreateRecordSetPayload",
"CreateZonePayload",
"DeleteLabelResponse",
Expand Down Expand Up @@ -88,6 +89,9 @@
from stackit.dns.models.create_label_response import (
CreateLabelResponse as CreateLabelResponse,
)
from stackit.dns.models.create_move_code_payload import (
CreateMoveCodePayload as CreateMoveCodePayload,
)
from stackit.dns.models.create_record_set_payload import (
CreateRecordSetPayload as CreateRecordSetPayload,
)
Expand Down
30 changes: 30 additions & 0 deletions services/dns/src/stackit/dns/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from stackit.dns.models.clone_zone_payload import CloneZonePayload
from stackit.dns.models.create_label_payload import CreateLabelPayload
from stackit.dns.models.create_label_response import CreateLabelResponse
from stackit.dns.models.create_move_code_payload import CreateMoveCodePayload
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
Expand Down Expand Up @@ -627,6 +628,9 @@ def create_move_code(
self,
project_id: Annotated[StrictStr, Field(description="project id")],
zone_id: Annotated[StrictStr, Field(description="zone id")],
create_move_code_payload: Annotated[
Optional[CreateMoveCodePayload], Field(description="information about the movecode")
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Expand All @@ -645,6 +649,8 @@ def create_move_code(
:type project_id: str
:param zone_id: zone id (required)
:type zone_id: str
:param create_move_code_payload: information about the movecode
:type create_move_code_payload: CreateMoveCodePayload
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
Expand All @@ -670,6 +676,7 @@ def create_move_code(
_param = self._create_move_code_serialize(
project_id=project_id,
zone_id=zone_id,
create_move_code_payload=create_move_code_payload,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
Expand All @@ -695,6 +702,9 @@ def create_move_code_with_http_info(
self,
project_id: Annotated[StrictStr, Field(description="project id")],
zone_id: Annotated[StrictStr, Field(description="zone id")],
create_move_code_payload: Annotated[
Optional[CreateMoveCodePayload], Field(description="information about the movecode")
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Expand All @@ -713,6 +723,8 @@ def create_move_code_with_http_info(
:type project_id: str
:param zone_id: zone id (required)
:type zone_id: str
:param create_move_code_payload: information about the movecode
:type create_move_code_payload: CreateMoveCodePayload
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
Expand All @@ -738,6 +750,7 @@ def create_move_code_with_http_info(
_param = self._create_move_code_serialize(
project_id=project_id,
zone_id=zone_id,
create_move_code_payload=create_move_code_payload,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
Expand All @@ -763,6 +776,9 @@ def create_move_code_without_preload_content(
self,
project_id: Annotated[StrictStr, Field(description="project id")],
zone_id: Annotated[StrictStr, Field(description="zone id")],
create_move_code_payload: Annotated[
Optional[CreateMoveCodePayload], Field(description="information about the movecode")
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Expand All @@ -781,6 +797,8 @@ def create_move_code_without_preload_content(
:type project_id: str
:param zone_id: zone id (required)
:type zone_id: str
:param create_move_code_payload: information about the movecode
:type create_move_code_payload: CreateMoveCodePayload
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
Expand All @@ -806,6 +824,7 @@ def create_move_code_without_preload_content(
_param = self._create_move_code_serialize(
project_id=project_id,
zone_id=zone_id,
create_move_code_payload=create_move_code_payload,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
Expand All @@ -826,6 +845,7 @@ def _create_move_code_serialize(
self,
project_id,
zone_id,
create_move_code_payload,
_request_auth,
_content_type,
_headers,
Expand All @@ -852,11 +872,21 @@ def _create_move_code_serialize(
# process the header parameters
# process the form parameters
# process the body parameter
if create_move_code_payload is not None:
_body_params = create_move_code_payload

# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(["application/json"])

# set the HTTP header `Content-Type`
if _content_type:
_header_params["Content-Type"] = _content_type
else:
_default_content_type = self.api_client.select_header_content_type(["application/json"])
if _default_content_type is not None:
_header_params["Content-Type"] = _default_content_type

# authentication setting
_auth_settings: List[str] = []

Expand Down
1 change: 1 addition & 0 deletions services/dns/src/stackit/dns/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from stackit.dns.models.clone_zone_payload import CloneZonePayload
from stackit.dns.models.create_label_payload import CreateLabelPayload
from stackit.dns.models.create_label_response import CreateLabelResponse
from stackit.dns.models.create_move_code_payload import CreateMoveCodePayload
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
Expand Down
86 changes: 86 additions & 0 deletions services/dns/src/stackit/dns/models/create_move_code_payload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# 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

from __future__ import annotations

import json
import pprint
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field
from pydantic_core import to_jsonable_python
from typing_extensions import Annotated, Self


class CreateMoveCodePayload(BaseModel):
"""
options for generating a move code.
""" # noqa: E501

ttl: Optional[Annotated[int, Field(le=2592000, strict=True, ge=1)]] = Field(
default=None,
description="TTL is the duration for which the move code is valid, represented as seconds. Min: 1, Max: 2592000 (30 days).",
)
__properties: ClassVar[List[str]] = ["ttl"]

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=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"""
return json.dumps(to_jsonable_python(self.to_dict()))

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of CreateMoveCodePayload 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 CreateMoveCodePayload from a dict"""
if obj is None:
return None

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

_obj = cls.model_validate({"ttl": obj.get("ttl")})
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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, StrictStr, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Self

Expand All @@ -32,6 +32,16 @@ class DomainObservabilityExtension(BaseModel):
state: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["observabilityInstanceId", "state"]

@field_validator("state")
def state_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value

if value not in set(["CREATING", "CREATE_SUCCEEDED", "ERROR"]):
raise ValueError("must be one of enum values ('CREATING', 'CREATE_SUCCEEDED', 'ERROR')")
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class ZoneObservabilityExtension(BaseModel):
""" # noqa: E501

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

model_config = ConfigDict(
validate_by_name=True,
Expand Down Expand Up @@ -80,7 +79,5 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate(
{"observabilityInstanceId": obj.get("observabilityInstanceId"), "state": obj.get("state")}
)
_obj = cls.model_validate({"observabilityInstanceId": obj.get("observabilityInstanceId")})
return _obj
Loading