Skip to content

Commit 4353c0d

Browse files
stackit-pipelineFyusel
authored andcommitted
Generate dns
1 parent 2f5dc63 commit 4353c0d

7 files changed

Lines changed: 135 additions & 7 deletions

File tree

services/dns/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
864bdad12a54f612df8fcdb6e41dd2933e94c3af
1+
da4701b7dbe20e984aef89711bb9ba716e19fcba

services/dns/src/stackit/dns/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"CloneZonePayload",
3232
"CreateLabelPayload",
3333
"CreateLabelResponse",
34+
"CreateMoveCodePayload",
3435
"CreateRecordSetPayload",
3536
"CreateZonePayload",
3637
"DeleteLabelResponse",
@@ -88,6 +89,9 @@
8889
from stackit.dns.models.create_label_response import (
8990
CreateLabelResponse as CreateLabelResponse,
9091
)
92+
from stackit.dns.models.create_move_code_payload import (
93+
CreateMoveCodePayload as CreateMoveCodePayload,
94+
)
9195
from stackit.dns.models.create_record_set_payload import (
9296
CreateRecordSetPayload as CreateRecordSetPayload,
9397
)

services/dns/src/stackit/dns/api/default_api.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from stackit.dns.models.clone_zone_payload import CloneZonePayload
3131
from stackit.dns.models.create_label_payload import CreateLabelPayload
3232
from stackit.dns.models.create_label_response import CreateLabelResponse
33+
from stackit.dns.models.create_move_code_payload import CreateMoveCodePayload
3334
from stackit.dns.models.create_record_set_payload import CreateRecordSetPayload
3435
from stackit.dns.models.create_zone_payload import CreateZonePayload
3536
from stackit.dns.models.delete_label_response import DeleteLabelResponse
@@ -627,6 +628,9 @@ def create_move_code(
627628
self,
628629
project_id: Annotated[StrictStr, Field(description="project id")],
629630
zone_id: Annotated[StrictStr, Field(description="zone id")],
631+
create_move_code_payload: Annotated[
632+
Optional[CreateMoveCodePayload], Field(description="information about the movecode")
633+
] = None,
630634
_request_timeout: Union[
631635
None,
632636
Annotated[StrictFloat, Field(gt=0)],
@@ -645,6 +649,8 @@ def create_move_code(
645649
:type project_id: str
646650
:param zone_id: zone id (required)
647651
:type zone_id: str
652+
:param create_move_code_payload: information about the movecode
653+
:type create_move_code_payload: CreateMoveCodePayload
648654
:param _request_timeout: timeout setting for this request. If one
649655
number provided, it will be total request
650656
timeout. It can also be a pair (tuple) of
@@ -670,6 +676,7 @@ def create_move_code(
670676
_param = self._create_move_code_serialize(
671677
project_id=project_id,
672678
zone_id=zone_id,
679+
create_move_code_payload=create_move_code_payload,
673680
_request_auth=_request_auth,
674681
_content_type=_content_type,
675682
_headers=_headers,
@@ -695,6 +702,9 @@ def create_move_code_with_http_info(
695702
self,
696703
project_id: Annotated[StrictStr, Field(description="project id")],
697704
zone_id: Annotated[StrictStr, Field(description="zone id")],
705+
create_move_code_payload: Annotated[
706+
Optional[CreateMoveCodePayload], Field(description="information about the movecode")
707+
] = None,
698708
_request_timeout: Union[
699709
None,
700710
Annotated[StrictFloat, Field(gt=0)],
@@ -713,6 +723,8 @@ def create_move_code_with_http_info(
713723
:type project_id: str
714724
:param zone_id: zone id (required)
715725
:type zone_id: str
726+
:param create_move_code_payload: information about the movecode
727+
:type create_move_code_payload: CreateMoveCodePayload
716728
:param _request_timeout: timeout setting for this request. If one
717729
number provided, it will be total request
718730
timeout. It can also be a pair (tuple) of
@@ -738,6 +750,7 @@ def create_move_code_with_http_info(
738750
_param = self._create_move_code_serialize(
739751
project_id=project_id,
740752
zone_id=zone_id,
753+
create_move_code_payload=create_move_code_payload,
741754
_request_auth=_request_auth,
742755
_content_type=_content_type,
743756
_headers=_headers,
@@ -763,6 +776,9 @@ def create_move_code_without_preload_content(
763776
self,
764777
project_id: Annotated[StrictStr, Field(description="project id")],
765778
zone_id: Annotated[StrictStr, Field(description="zone id")],
779+
create_move_code_payload: Annotated[
780+
Optional[CreateMoveCodePayload], Field(description="information about the movecode")
781+
] = None,
766782
_request_timeout: Union[
767783
None,
768784
Annotated[StrictFloat, Field(gt=0)],
@@ -781,6 +797,8 @@ def create_move_code_without_preload_content(
781797
:type project_id: str
782798
:param zone_id: zone id (required)
783799
:type zone_id: str
800+
:param create_move_code_payload: information about the movecode
801+
:type create_move_code_payload: CreateMoveCodePayload
784802
:param _request_timeout: timeout setting for this request. If one
785803
number provided, it will be total request
786804
timeout. It can also be a pair (tuple) of
@@ -806,6 +824,7 @@ def create_move_code_without_preload_content(
806824
_param = self._create_move_code_serialize(
807825
project_id=project_id,
808826
zone_id=zone_id,
827+
create_move_code_payload=create_move_code_payload,
809828
_request_auth=_request_auth,
810829
_content_type=_content_type,
811830
_headers=_headers,
@@ -826,6 +845,7 @@ def _create_move_code_serialize(
826845
self,
827846
project_id,
828847
zone_id,
848+
create_move_code_payload,
829849
_request_auth,
830850
_content_type,
831851
_headers,
@@ -852,11 +872,21 @@ def _create_move_code_serialize(
852872
# process the header parameters
853873
# process the form parameters
854874
# process the body parameter
875+
if create_move_code_payload is not None:
876+
_body_params = create_move_code_payload
855877

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

882+
# set the HTTP header `Content-Type`
883+
if _content_type:
884+
_header_params["Content-Type"] = _content_type
885+
else:
886+
_default_content_type = self.api_client.select_header_content_type(["application/json"])
887+
if _default_content_type is not None:
888+
_header_params["Content-Type"] = _default_content_type
889+
860890
# authentication setting
861891
_auth_settings: List[str] = []
862892

services/dns/src/stackit/dns/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from stackit.dns.models.clone_zone_payload import CloneZonePayload
1818
from stackit.dns.models.create_label_payload import CreateLabelPayload
1919
from stackit.dns.models.create_label_response import CreateLabelResponse
20+
from stackit.dns.models.create_move_code_payload import CreateMoveCodePayload
2021
from stackit.dns.models.create_record_set_payload import CreateRecordSetPayload
2122
from stackit.dns.models.create_zone_payload import CreateZonePayload
2223
from stackit.dns.models.delete_label_response import DeleteLabelResponse
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT DNS API
5+
6+
This api provides dns
7+
8+
The version of the OpenAPI document: 1.0
9+
Contact: dns@stackit.cloud
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501
14+
15+
from __future__ import annotations
16+
17+
import json
18+
import pprint
19+
from typing import Any, ClassVar, Dict, List, Optional, Set
20+
21+
from pydantic import BaseModel, ConfigDict, Field
22+
from pydantic_core import to_jsonable_python
23+
from typing_extensions import Annotated, Self
24+
25+
26+
class CreateMoveCodePayload(BaseModel):
27+
"""
28+
options for generating a move code.
29+
""" # noqa: E501
30+
31+
ttl: Optional[Annotated[int, Field(le=2592000, strict=True, ge=1)]] = Field(
32+
default=None,
33+
description="TTL is the duration for which the move code is valid, represented as seconds. Min: 1, Max: 2592000 (30 days).",
34+
)
35+
__properties: ClassVar[List[str]] = ["ttl"]
36+
37+
model_config = ConfigDict(
38+
validate_by_name=True,
39+
validate_by_alias=True,
40+
validate_assignment=True,
41+
protected_namespaces=(),
42+
)
43+
44+
def to_str(self) -> str:
45+
"""Returns the string representation of the model using alias"""
46+
return pprint.pformat(self.model_dump(by_alias=True))
47+
48+
def to_json(self) -> str:
49+
"""Returns the JSON representation of the model using alias"""
50+
return json.dumps(to_jsonable_python(self.to_dict()))
51+
52+
@classmethod
53+
def from_json(cls, json_str: str) -> Optional[Self]:
54+
"""Create an instance of CreateMoveCodePayload from a JSON string"""
55+
return cls.from_dict(json.loads(json_str))
56+
57+
def to_dict(self) -> Dict[str, Any]:
58+
"""Return the dictionary representation of the model using alias.
59+
60+
This has the following differences from calling pydantic's
61+
`self.model_dump(by_alias=True)`:
62+
63+
* `None` is only added to the output dict for nullable fields that
64+
were set at model initialization. Other fields with value `None`
65+
are ignored.
66+
"""
67+
excluded_fields: Set[str] = set([])
68+
69+
_dict = self.model_dump(
70+
by_alias=True,
71+
exclude=excluded_fields,
72+
exclude_none=True,
73+
)
74+
return _dict
75+
76+
@classmethod
77+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78+
"""Create an instance of CreateMoveCodePayload from a dict"""
79+
if obj is None:
80+
return None
81+
82+
if not isinstance(obj, dict):
83+
return cls.model_validate(obj)
84+
85+
_obj = cls.model_validate({"ttl": obj.get("ttl")})
86+
return _obj

services/dns/src/stackit/dns/models/domain_observability_extension.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import pprint
1919
from typing import Any, ClassVar, Dict, List, Optional, Set
2020

21-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
21+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
2222
from pydantic_core import to_jsonable_python
2323
from typing_extensions import Self
2424

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

35+
@field_validator("state")
36+
def state_validate_enum(cls, value):
37+
"""Validates the enum"""
38+
if value is None:
39+
return value
40+
41+
if value not in set(["CREATING", "CREATE_SUCCEEDED", "ERROR"]):
42+
raise ValueError("must be one of enum values ('CREATING', 'CREATE_SUCCEEDED', 'ERROR')")
43+
return value
44+
3545
model_config = ConfigDict(
3646
validate_by_name=True,
3747
validate_by_alias=True,

services/dns/src/stackit/dns/models/zone_observability_extension.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ class ZoneObservabilityExtension(BaseModel):
2929
""" # noqa: E501
3030

3131
observability_instance_id: StrictStr = Field(alias="observabilityInstanceId")
32-
state: Optional[StrictStr] = None
33-
__properties: ClassVar[List[str]] = ["observabilityInstanceId", "state"]
32+
__properties: ClassVar[List[str]] = ["observabilityInstanceId"]
3433

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

83-
_obj = cls.model_validate(
84-
{"observabilityInstanceId": obj.get("observabilityInstanceId"), "state": obj.get("state")}
85-
)
82+
_obj = cls.model_validate({"observabilityInstanceId": obj.get("observabilityInstanceId")})
8683
return _obj

0 commit comments

Comments
 (0)