Skip to content

Commit 6825914

Browse files
scaleway-botyfodil
andauthored
feat(tem): add dkim, spf and mx records in domain message (#1248)
Co-authored-by: Yacine Fodil <105779815+yfodil@users.noreply.github.com>
1 parent 79ecae5 commit 6825914

File tree

6 files changed

+300
-0
lines changed

6 files changed

+300
-0
lines changed

scaleway-async/scaleway_async/tem/v1alpha1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
from .types import ProjectSettingsPeriodicReportFrequency
2020
from .types import WebhookEventStatus
2121
from .types import WebhookEventType
22+
from .types import DomainRecordsDKIM
2223
from .types import DomainRecordsDMARC
24+
from .types import DomainRecordsMX
25+
from .types import DomainRecordsSPF
2326
from .types import EmailTry
2427
from .types import DomainRecords
2528
from .types import DomainReputation
@@ -106,7 +109,10 @@
106109
"ProjectSettingsPeriodicReportFrequency",
107110
"WebhookEventStatus",
108111
"WebhookEventType",
112+
"DomainRecordsDKIM",
109113
"DomainRecordsDMARC",
114+
"DomainRecordsMX",
115+
"DomainRecordsSPF",
110116
"EmailTry",
111117
"DomainRecords",
112118
"DomainReputation",

scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
WebhookEventType,
2222
EmailTry,
2323
Email,
24+
DomainRecordsDKIM,
2425
DomainRecordsDMARC,
26+
DomainRecordsMX,
27+
DomainRecordsSPF,
2528
DomainRecords,
2629
DomainReputation,
2730
DomainStatistics,
@@ -205,6 +208,29 @@ def unmarshal_Email(data: Any) -> Email:
205208
return Email(**args)
206209

207210

211+
def unmarshal_DomainRecordsDKIM(data: Any) -> DomainRecordsDKIM:
212+
if not isinstance(data, dict):
213+
raise TypeError(
214+
"Unmarshalling the type 'DomainRecordsDKIM' failed as data isn't a dictionary."
215+
)
216+
217+
args: dict[str, Any] = {}
218+
219+
field = data.get("name", None)
220+
if field is not None:
221+
args["name"] = field
222+
else:
223+
args["name"] = None
224+
225+
field = data.get("value", None)
226+
if field is not None:
227+
args["value"] = field
228+
else:
229+
args["value"] = None
230+
231+
return DomainRecordsDKIM(**args)
232+
233+
208234
def unmarshal_DomainRecordsDMARC(data: Any) -> DomainRecordsDMARC:
209235
if not isinstance(data, dict):
210236
raise TypeError(
@@ -228,6 +254,52 @@ def unmarshal_DomainRecordsDMARC(data: Any) -> DomainRecordsDMARC:
228254
return DomainRecordsDMARC(**args)
229255

230256

257+
def unmarshal_DomainRecordsMX(data: Any) -> DomainRecordsMX:
258+
if not isinstance(data, dict):
259+
raise TypeError(
260+
"Unmarshalling the type 'DomainRecordsMX' failed as data isn't a dictionary."
261+
)
262+
263+
args: dict[str, Any] = {}
264+
265+
field = data.get("name", None)
266+
if field is not None:
267+
args["name"] = field
268+
else:
269+
args["name"] = None
270+
271+
field = data.get("value", None)
272+
if field is not None:
273+
args["value"] = field
274+
else:
275+
args["value"] = None
276+
277+
return DomainRecordsMX(**args)
278+
279+
280+
def unmarshal_DomainRecordsSPF(data: Any) -> DomainRecordsSPF:
281+
if not isinstance(data, dict):
282+
raise TypeError(
283+
"Unmarshalling the type 'DomainRecordsSPF' failed as data isn't a dictionary."
284+
)
285+
286+
args: dict[str, Any] = {}
287+
288+
field = data.get("name", None)
289+
if field is not None:
290+
args["name"] = field
291+
else:
292+
args["name"] = None
293+
294+
field = data.get("value", None)
295+
if field is not None:
296+
args["value"] = field
297+
else:
298+
args["value"] = None
299+
300+
return DomainRecordsSPF(**args)
301+
302+
231303
def unmarshal_DomainRecords(data: Any) -> DomainRecords:
232304
if not isinstance(data, dict):
233305
raise TypeError(
@@ -242,6 +314,24 @@ def unmarshal_DomainRecords(data: Any) -> DomainRecords:
242314
else:
243315
args["dmarc"] = None
244316

317+
field = data.get("dkim", None)
318+
if field is not None:
319+
args["dkim"] = unmarshal_DomainRecordsDKIM(field)
320+
else:
321+
args["dkim"] = None
322+
323+
field = data.get("spf", None)
324+
if field is not None:
325+
args["spf"] = unmarshal_DomainRecordsSPF(field)
326+
else:
327+
args["spf"] = None
328+
329+
field = data.get("mx", None)
330+
if field is not None:
331+
args["mx"] = unmarshal_DomainRecordsMX(field)
332+
else:
333+
args["mx"] = None
334+
245335
return DomainRecords(**args)
246336

247337

scaleway-async/scaleway_async/tem/v1alpha1/types.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ def __str__(self) -> str:
205205
return str(self.value)
206206

207207

208+
@dataclass
209+
class DomainRecordsDKIM:
210+
name: str
211+
"""
212+
Name of the DKIM TXT record.
213+
"""
214+
215+
value: str
216+
"""
217+
Value of the DKIM TXT record.
218+
"""
219+
220+
208221
@dataclass
209222
class DomainRecordsDMARC:
210223
name: str
@@ -218,6 +231,32 @@ class DomainRecordsDMARC:
218231
"""
219232

220233

234+
@dataclass
235+
class DomainRecordsMX:
236+
name: str
237+
"""
238+
Name of the MX record.
239+
"""
240+
241+
value: str
242+
"""
243+
Value of the MX record.
244+
"""
245+
246+
247+
@dataclass
248+
class DomainRecordsSPF:
249+
name: str
250+
"""
251+
Name of the SPF TXT record.
252+
"""
253+
254+
value: str
255+
"""
256+
Value of the SPF TXT record.
257+
"""
258+
259+
221260
@dataclass
222261
class EmailTry:
223262
rank: int
@@ -248,6 +287,21 @@ class DomainRecords:
248287
DMARC TXT record specification.
249288
"""
250289

290+
dkim: Optional[DomainRecordsDKIM] = None
291+
"""
292+
DKIM TXT record specification.
293+
"""
294+
295+
spf: Optional[DomainRecordsSPF] = None
296+
"""
297+
SPF TXT record specification.
298+
"""
299+
300+
mx: Optional[DomainRecordsMX] = None
301+
"""
302+
MX record specification.
303+
"""
304+
251305

252306
@dataclass
253307
class DomainReputation:

scaleway/scaleway/tem/v1alpha1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
from .types import ProjectSettingsPeriodicReportFrequency
2020
from .types import WebhookEventStatus
2121
from .types import WebhookEventType
22+
from .types import DomainRecordsDKIM
2223
from .types import DomainRecordsDMARC
24+
from .types import DomainRecordsMX
25+
from .types import DomainRecordsSPF
2326
from .types import EmailTry
2427
from .types import DomainRecords
2528
from .types import DomainReputation
@@ -106,7 +109,10 @@
106109
"ProjectSettingsPeriodicReportFrequency",
107110
"WebhookEventStatus",
108111
"WebhookEventType",
112+
"DomainRecordsDKIM",
109113
"DomainRecordsDMARC",
114+
"DomainRecordsMX",
115+
"DomainRecordsSPF",
110116
"EmailTry",
111117
"DomainRecords",
112118
"DomainReputation",

scaleway/scaleway/tem/v1alpha1/marshalling.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
WebhookEventType,
2222
EmailTry,
2323
Email,
24+
DomainRecordsDKIM,
2425
DomainRecordsDMARC,
26+
DomainRecordsMX,
27+
DomainRecordsSPF,
2528
DomainRecords,
2629
DomainReputation,
2730
DomainStatistics,
@@ -205,6 +208,29 @@ def unmarshal_Email(data: Any) -> Email:
205208
return Email(**args)
206209

207210

211+
def unmarshal_DomainRecordsDKIM(data: Any) -> DomainRecordsDKIM:
212+
if not isinstance(data, dict):
213+
raise TypeError(
214+
"Unmarshalling the type 'DomainRecordsDKIM' failed as data isn't a dictionary."
215+
)
216+
217+
args: dict[str, Any] = {}
218+
219+
field = data.get("name", None)
220+
if field is not None:
221+
args["name"] = field
222+
else:
223+
args["name"] = None
224+
225+
field = data.get("value", None)
226+
if field is not None:
227+
args["value"] = field
228+
else:
229+
args["value"] = None
230+
231+
return DomainRecordsDKIM(**args)
232+
233+
208234
def unmarshal_DomainRecordsDMARC(data: Any) -> DomainRecordsDMARC:
209235
if not isinstance(data, dict):
210236
raise TypeError(
@@ -228,6 +254,52 @@ def unmarshal_DomainRecordsDMARC(data: Any) -> DomainRecordsDMARC:
228254
return DomainRecordsDMARC(**args)
229255

230256

257+
def unmarshal_DomainRecordsMX(data: Any) -> DomainRecordsMX:
258+
if not isinstance(data, dict):
259+
raise TypeError(
260+
"Unmarshalling the type 'DomainRecordsMX' failed as data isn't a dictionary."
261+
)
262+
263+
args: dict[str, Any] = {}
264+
265+
field = data.get("name", None)
266+
if field is not None:
267+
args["name"] = field
268+
else:
269+
args["name"] = None
270+
271+
field = data.get("value", None)
272+
if field is not None:
273+
args["value"] = field
274+
else:
275+
args["value"] = None
276+
277+
return DomainRecordsMX(**args)
278+
279+
280+
def unmarshal_DomainRecordsSPF(data: Any) -> DomainRecordsSPF:
281+
if not isinstance(data, dict):
282+
raise TypeError(
283+
"Unmarshalling the type 'DomainRecordsSPF' failed as data isn't a dictionary."
284+
)
285+
286+
args: dict[str, Any] = {}
287+
288+
field = data.get("name", None)
289+
if field is not None:
290+
args["name"] = field
291+
else:
292+
args["name"] = None
293+
294+
field = data.get("value", None)
295+
if field is not None:
296+
args["value"] = field
297+
else:
298+
args["value"] = None
299+
300+
return DomainRecordsSPF(**args)
301+
302+
231303
def unmarshal_DomainRecords(data: Any) -> DomainRecords:
232304
if not isinstance(data, dict):
233305
raise TypeError(
@@ -242,6 +314,24 @@ def unmarshal_DomainRecords(data: Any) -> DomainRecords:
242314
else:
243315
args["dmarc"] = None
244316

317+
field = data.get("dkim", None)
318+
if field is not None:
319+
args["dkim"] = unmarshal_DomainRecordsDKIM(field)
320+
else:
321+
args["dkim"] = None
322+
323+
field = data.get("spf", None)
324+
if field is not None:
325+
args["spf"] = unmarshal_DomainRecordsSPF(field)
326+
else:
327+
args["spf"] = None
328+
329+
field = data.get("mx", None)
330+
if field is not None:
331+
args["mx"] = unmarshal_DomainRecordsMX(field)
332+
else:
333+
args["mx"] = None
334+
245335
return DomainRecords(**args)
246336

247337

0 commit comments

Comments
 (0)