|
10 | 10 | ) |
11 | 11 | from dateutil import parser |
12 | 12 | from .types import ( |
| 13 | + AclActionRedirectRedirectType, |
13 | 14 | AclActionType, |
14 | 15 | AclHttpFilter, |
15 | 16 | ForwardPortAlgorithm, |
|
20 | 21 | StickySessionsType, |
21 | 22 | Acl, |
22 | 23 | AclAction, |
| 24 | + AclActionRedirect, |
23 | 25 | AclMatch, |
24 | 26 | AclSpec, |
25 | 27 | Backend, |
@@ -475,6 +477,26 @@ def unmarshal_Lb(data: Any) -> Lb: |
475 | 477 | return Lb(**args) |
476 | 478 |
|
477 | 479 |
|
| 480 | +def unmarshal_AclActionRedirect(data: Any) -> AclActionRedirect: |
| 481 | + if type(data) is not dict: |
| 482 | + raise TypeError( |
| 483 | + f"Unmarshalling the type 'AclActionRedirect' failed as data isn't a dictionary." |
| 484 | + ) |
| 485 | + |
| 486 | + args: Dict[str, Any] = {} |
| 487 | + |
| 488 | + field = data.get("code") |
| 489 | + args["code"] = field |
| 490 | + |
| 491 | + field = data.get("target") |
| 492 | + args["target"] = field |
| 493 | + |
| 494 | + field = data.get("type_") |
| 495 | + args["type_"] = field |
| 496 | + |
| 497 | + return AclActionRedirect(**args) |
| 498 | + |
| 499 | + |
478 | 500 | def unmarshal_Backend(data: Any) -> Backend: |
479 | 501 | if type(data) is not dict: |
480 | 502 | raise TypeError( |
@@ -607,6 +629,9 @@ def unmarshal_AclAction(data: Any) -> AclAction: |
607 | 629 |
|
608 | 630 | args: Dict[str, Any] = {} |
609 | 631 |
|
| 632 | + field = data.get("redirect") |
| 633 | + args["redirect"] = unmarshal_AclActionRedirect(field) if field is not None else None |
| 634 | + |
610 | 635 | field = data.get("type_") |
611 | 636 | args["type_"] = field |
612 | 637 |
|
@@ -1109,11 +1134,25 @@ def unmarshal_SetAclsResponse(data: Any) -> SetAclsResponse: |
1109 | 1134 | return SetAclsResponse(**args) |
1110 | 1135 |
|
1111 | 1136 |
|
| 1137 | +def marshal_AclActionRedirect( |
| 1138 | + request: AclActionRedirect, |
| 1139 | + defaults: ProfileDefaults, |
| 1140 | +) -> Dict[str, Any]: |
| 1141 | + return { |
| 1142 | + "code": request.code, |
| 1143 | + "target": request.target, |
| 1144 | + "type": AclActionRedirectRedirectType(request.type_), |
| 1145 | + } |
| 1146 | + |
| 1147 | + |
1112 | 1148 | def marshal_AclAction( |
1113 | 1149 | request: AclAction, |
1114 | 1150 | defaults: ProfileDefaults, |
1115 | 1151 | ) -> Dict[str, Any]: |
1116 | 1152 | return { |
| 1153 | + "redirect": marshal_AclActionRedirect(request.redirect, defaults) |
| 1154 | + if request.redirect is not None |
| 1155 | + else None, |
1117 | 1156 | "type": AclActionType(request.type_), |
1118 | 1157 | } |
1119 | 1158 |
|
|
0 commit comments