Skip to content

Commit 0822f67

Browse files
Generate dns
1 parent c7340e3 commit 0822f67

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CreateRecordSetPayload(BaseModel):
3333
default=None, description="user comment"
3434
)
3535
name: Annotated[str, Field(min_length=1, strict=True, max_length=253)] = Field(
36-
description="name of the record which should be a valid domain according to rfc1035 Section 2.3.4"
36+
description="name of the record which should be a valid domain according to rfc1035 Section 2.3.4. For APEX records (same as zone name), the zone name itself has to be put in here."
3737
)
3838
records: List[RecordPayload] = Field(description="records")
3939
ttl: Optional[Annotated[int, Field(le=99999999, strict=True, ge=60)]] = Field(
@@ -68,10 +68,14 @@ def type_validate_enum(cls, value):
6868
"URI",
6969
"CERT",
7070
"SVCB",
71+
"TYPE",
72+
"CSYNC",
73+
"HINFO",
74+
"HTTPS",
7175
]
7276
):
7377
raise ValueError(
74-
"must be one of enum values ('A', 'AAAA', 'SOA', 'CNAME', 'NS', 'MX', 'TXT', 'SRV', 'PTR', 'ALIAS', 'DNAME', 'CAA', 'DNSKEY', 'DS', 'LOC', 'NAPTR', 'SSHFP', 'TLSA', 'URI', 'CERT', 'SVCB')"
78+
"must be one of enum values ('A', 'AAAA', 'SOA', 'CNAME', 'NS', 'MX', 'TXT', 'SRV', 'PTR', 'ALIAS', 'DNAME', 'CAA', 'DNSKEY', 'DS', 'LOC', 'NAPTR', 'SSHFP', 'TLSA', 'URI', 'CERT', 'SVCB', 'TYPE', 'CSYNC', 'HINFO', 'HTTPS')"
7579
)
7680
return value
7781

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

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class RecordSet(BaseModel):
4545
)
4646
id: StrictStr = Field(description="rr set id")
4747
name: Annotated[str, Field(min_length=1, strict=True, max_length=253)] = Field(
48-
description="name of the record which should be a valid domain according to rfc1035 Section 2.3.4"
48+
description="name of the record which should be a valid domain according to rfc1035 Section 2.3.4. For APEX records (same as zone name), the zone name itself has to be put in here."
4949
)
5050
records: Annotated[List[Record], Field(min_length=1)] = Field(description="records")
5151
state: StrictStr = Field(description="record set state")
@@ -93,9 +93,37 @@ def state_validate_enum(cls, value):
9393
@field_validator("type")
9494
def type_validate_enum(cls, value):
9595
"""Validates the enum"""
96-
if value not in set(["A", "AAAA", "SOA", "CNAME", "NS", "MX", "TXT", "SRV", "PTR", "ALIAS", "DNAME", "CAA"]):
96+
if value not in set(
97+
[
98+
"A",
99+
"AAAA",
100+
"SOA",
101+
"CNAME",
102+
"NS",
103+
"MX",
104+
"TXT",
105+
"SRV",
106+
"PTR",
107+
"ALIAS",
108+
"DNAME",
109+
"CAA",
110+
"DNSKEY",
111+
"DS",
112+
"LOC",
113+
"NAPTR",
114+
"SSHFP",
115+
"TLSA",
116+
"URI",
117+
"CERT",
118+
"SVCB",
119+
"TYPE",
120+
"CSYNC",
121+
"HINFO",
122+
"HTTPS",
123+
]
124+
):
97125
raise ValueError(
98-
"must be one of enum values ('A', 'AAAA', 'SOA', 'CNAME', 'NS', 'MX', 'TXT', 'SRV', 'PTR', 'ALIAS', 'DNAME', 'CAA')"
126+
"must be one of enum values ('A', 'AAAA', 'SOA', 'CNAME', 'NS', 'MX', 'TXT', 'SRV', 'PTR', 'ALIAS', 'DNAME', 'CAA', 'DNSKEY', 'DS', 'LOC', 'NAPTR', 'SSHFP', 'TLSA', 'URI', 'CERT', 'SVCB', 'TYPE', 'CSYNC', 'HINFO', 'HTTPS')"
99127
)
100128
return value
101129

0 commit comments

Comments
 (0)