Skip to content

Commit b87e7eb

Browse files
authored
feat(lb): add header host in match route (#18)
1 parent d1bd033 commit b87e7eb

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed

scaleway-async/scaleway_async/lb/v1/marshalling.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ def unmarshal_RouteMatch(data: Any) -> RouteMatch:
716716

717717
args: Dict[str, Any] = {}
718718

719+
field = data.get("host_header")
720+
args["host_header"] = field
721+
719722
field = data.get("sni")
720723
args["sni"] = field
721724

@@ -1335,7 +1338,18 @@ def marshal_RouteMatch(
13351338
defaults: ProfileDefaults,
13361339
) -> Dict[str, Any]:
13371340
return {
1338-
"sni": request.sni,
1341+
**resolve_one_of(
1342+
[
1343+
OneOfPossibility("sni", request.sni),
1344+
OneOfPossibility("host_header", request.host_header),
1345+
]
1346+
),
1347+
**resolve_one_of(
1348+
[
1349+
OneOfPossibility("sni", request.sni),
1350+
OneOfPossibility("host_header", request.host_header),
1351+
]
1352+
),
13391353
}
13401354

13411355

scaleway-async/scaleway_async/lb/v1/types.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,16 @@ class RouteMatch:
13871387

13881388
sni: Optional[str]
13891389
"""
1390-
Server Name Indication TLS extension (SNI) field from an incoming connection made via an SSL/TLS transport layer
1390+
Server Name Indication TLS extension (SNI) field from an incoming connection made via an SSL/TLS transport layer.
1391+
1392+
One-of ('match_type'): at most one of 'sni', 'host_header' could be set.
1393+
"""
1394+
1395+
host_header: Optional[str]
1396+
"""
1397+
The Host request header specifies the host of the server to which the request is being sent.
1398+
1399+
One-of ('match_type'): at most one of 'sni', 'host_header' could be set.
13911400
"""
13921401

13931402

scaleway/scaleway/lb/v1/marshalling.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ def unmarshal_RouteMatch(data: Any) -> RouteMatch:
716716

717717
args: Dict[str, Any] = {}
718718

719+
field = data.get("host_header")
720+
args["host_header"] = field
721+
719722
field = data.get("sni")
720723
args["sni"] = field
721724

@@ -1335,7 +1338,18 @@ def marshal_RouteMatch(
13351338
defaults: ProfileDefaults,
13361339
) -> Dict[str, Any]:
13371340
return {
1338-
"sni": request.sni,
1341+
**resolve_one_of(
1342+
[
1343+
OneOfPossibility("sni", request.sni),
1344+
OneOfPossibility("host_header", request.host_header),
1345+
]
1346+
),
1347+
**resolve_one_of(
1348+
[
1349+
OneOfPossibility("sni", request.sni),
1350+
OneOfPossibility("host_header", request.host_header),
1351+
]
1352+
),
13391353
}
13401354

13411355

scaleway/scaleway/lb/v1/types.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,16 @@ class RouteMatch:
13871387

13881388
sni: Optional[str]
13891389
"""
1390-
Server Name Indication TLS extension (SNI) field from an incoming connection made via an SSL/TLS transport layer
1390+
Server Name Indication TLS extension (SNI) field from an incoming connection made via an SSL/TLS transport layer.
1391+
1392+
One-of ('match_type'): at most one of 'sni', 'host_header' could be set.
1393+
"""
1394+
1395+
host_header: Optional[str]
1396+
"""
1397+
The Host request header specifies the host of the server to which the request is being sent.
1398+
1399+
One-of ('match_type'): at most one of 'sni', 'host_header' could be set.
13911400
"""
13921401

13931402

0 commit comments

Comments
 (0)