Skip to content

Commit 6d499fa

Browse files
feat(lb): add support for connection_rate_limit (scaleway#858)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 49b8bb1 commit 6d499fa

File tree

6 files changed

+110
-0
lines changed

6 files changed

+110
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,7 @@ async def create_frontend(
15151515
timeout_client: Optional[str] = None,
15161516
certificate_id: Optional[str] = None,
15171517
certificate_ids: Optional[List[str]] = None,
1518+
connection_rate_limit: Optional[int] = None,
15181519
) -> Frontend:
15191520
"""
15201521
Create a frontend in a given Load Balancer.
@@ -1528,6 +1529,7 @@ async def create_frontend(
15281529
:param timeout_client: Maximum allowed inactivity time on the client side.
15291530
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
15301531
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
1532+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
15311533
:return: :class:`Frontend <Frontend>`
15321534
15331535
Usage:
@@ -1558,6 +1560,7 @@ async def create_frontend(
15581560
timeout_client=timeout_client,
15591561
certificate_id=certificate_id,
15601562
certificate_ids=certificate_ids,
1563+
connection_rate_limit=connection_rate_limit,
15611564
),
15621565
self.client,
15631566
),
@@ -1610,6 +1613,7 @@ async def update_frontend(
16101613
timeout_client: Optional[str] = None,
16111614
certificate_id: Optional[str] = None,
16121615
certificate_ids: Optional[List[str]] = None,
1616+
connection_rate_limit: Optional[int] = None,
16131617
) -> Frontend:
16141618
"""
16151619
Update a frontend.
@@ -1623,6 +1627,7 @@ async def update_frontend(
16231627
:param timeout_client: Maximum allowed inactivity time on the client side.
16241628
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
16251629
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
1630+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
16261631
:return: :class:`Frontend <Frontend>`
16271632
16281633
Usage:
@@ -1654,6 +1659,7 @@ async def update_frontend(
16541659
timeout_client=timeout_client,
16551660
certificate_id=certificate_id,
16561661
certificate_ids=certificate_ids,
1662+
connection_rate_limit=connection_rate_limit,
16571663
),
16581664
self.client,
16591665
),
@@ -4549,6 +4555,7 @@ async def create_frontend(
45494555
timeout_client: Optional[str] = None,
45504556
certificate_id: Optional[str] = None,
45514557
certificate_ids: Optional[List[str]] = None,
4558+
connection_rate_limit: Optional[int] = None,
45524559
) -> Frontend:
45534560
"""
45544561
Create a frontend in a given load balancer.
@@ -4561,6 +4568,7 @@ async def create_frontend(
45614568
:param timeout_client: Maximum allowed inactivity time on the client side.
45624569
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
45634570
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
4571+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
45644572
:return: :class:`Frontend <Frontend>`
45654573
45664574
Usage:
@@ -4593,6 +4601,7 @@ async def create_frontend(
45934601
timeout_client=timeout_client,
45944602
certificate_id=certificate_id,
45954603
certificate_ids=certificate_ids,
4604+
connection_rate_limit=connection_rate_limit,
45964605
),
45974606
self.client,
45984607
),
@@ -4646,6 +4655,7 @@ async def update_frontend(
46464655
timeout_client: Optional[str] = None,
46474656
certificate_id: Optional[str] = None,
46484657
certificate_ids: Optional[List[str]] = None,
4658+
connection_rate_limit: Optional[int] = None,
46494659
) -> Frontend:
46504660
"""
46514661
Update a frontend.
@@ -4658,6 +4668,7 @@ async def update_frontend(
46584668
:param timeout_client: Maximum allowed inactivity time on the client side.
46594669
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
46604670
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
4671+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
46614672
:return: :class:`Frontend <Frontend>`
46624673
46634674
Usage:
@@ -4691,6 +4702,7 @@ async def update_frontend(
46914702
timeout_client=timeout_client,
46924703
certificate_id=certificate_id,
46934704
certificate_ids=certificate_ids,
4705+
connection_rate_limit=connection_rate_limit,
46944706
),
46954707
self.client,
46964708
),

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,12 @@ def unmarshal_Frontend(data: Any) -> Frontend:
855855
else:
856856
args["updated_at"] = None
857857

858+
field = data.get("connection_rate_limit", None)
859+
if field is not None:
860+
args["connection_rate_limit"] = field
861+
else:
862+
args["connection_rate_limit"] = None
863+
858864
return Frontend(**args)
859865

860866

@@ -1928,6 +1934,9 @@ def marshal_CreateFrontendRequest(
19281934
if request.certificate_ids is not None:
19291935
output["certificate_ids"] = request.certificate_ids
19301936

1937+
if request.connection_rate_limit is not None:
1938+
output["connection_rate_limit"] = request.connection_rate_limit
1939+
19311940
return output
19321941

19331942

@@ -2283,6 +2292,9 @@ def marshal_UpdateFrontendRequest(
22832292
if request.certificate_ids is not None:
22842293
output["certificate_ids"] = request.certificate_ids
22852294

2295+
if request.connection_rate_limit is not None:
2296+
output["connection_rate_limit"] = request.connection_rate_limit
2297+
22862298
return output
22872299

22882300

@@ -2576,6 +2588,9 @@ def marshal_ZonedApiCreateFrontendRequest(
25762588
if request.certificate_ids is not None:
25772589
output["certificate_ids"] = request.certificate_ids
25782590

2591+
if request.connection_rate_limit is not None:
2592+
output["connection_rate_limit"] = request.connection_rate_limit
2593+
25792594
return output
25802595

25812596

@@ -2926,6 +2941,9 @@ def marshal_ZonedApiUpdateFrontendRequest(
29262941
if request.certificate_ids is not None:
29272942
output["certificate_ids"] = request.certificate_ids
29282943

2944+
if request.connection_rate_limit is not None:
2945+
output["connection_rate_limit"] = request.connection_rate_limit
2946+
29292947
return output
29302948

29312949

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,11 @@ class Frontend:
944944
Date on which the frontend was last updated.
945945
"""
946946

947+
connection_rate_limit: Optional[int]
948+
"""
949+
Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
950+
"""
951+
947952

948953
@dataclass
949954
class PrivateNetworkDHCPConfig:
@@ -1476,6 +1481,11 @@ class CreateFrontendRequest:
14761481
List of SSL/TLS certificate IDs to bind to the frontend.
14771482
"""
14781483

1484+
connection_rate_limit: Optional[int]
1485+
"""
1486+
Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
1487+
"""
1488+
14791489

14801490
@dataclass
14811491
class CreateIpRequest:
@@ -2680,6 +2690,11 @@ class UpdateFrontendRequest:
26802690
List of SSL/TLS certificate IDs to bind to the frontend.
26812691
"""
26822692

2693+
connection_rate_limit: Optional[int]
2694+
"""
2695+
Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
2696+
"""
2697+
26832698

26842699
@dataclass
26852700
class UpdateHealthCheckRequest:
@@ -3120,6 +3135,11 @@ class ZonedApiCreateFrontendRequest:
31203135
List of SSL/TLS certificate IDs to bind to the frontend.
31213136
"""
31223137

3138+
connection_rate_limit: Optional[int]
3139+
"""
3140+
Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
3141+
"""
3142+
31233143

31243144
@dataclass
31253145
class ZonedApiCreateIpRequest:
@@ -4178,6 +4198,11 @@ class ZonedApiUpdateFrontendRequest:
41784198
List of SSL/TLS certificate IDs to bind to the frontend.
41794199
"""
41804200

4201+
connection_rate_limit: Optional[int]
4202+
"""
4203+
Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
4204+
"""
4205+
41814206

41824207
@dataclass
41834208
class ZonedApiUpdateHealthCheckRequest:

scaleway/scaleway/lb/v1/api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,7 @@ def create_frontend(
15151515
timeout_client: Optional[str] = None,
15161516
certificate_id: Optional[str] = None,
15171517
certificate_ids: Optional[List[str]] = None,
1518+
connection_rate_limit: Optional[int] = None,
15181519
) -> Frontend:
15191520
"""
15201521
Create a frontend in a given Load Balancer.
@@ -1528,6 +1529,7 @@ def create_frontend(
15281529
:param timeout_client: Maximum allowed inactivity time on the client side.
15291530
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
15301531
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
1532+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
15311533
:return: :class:`Frontend <Frontend>`
15321534
15331535
Usage:
@@ -1558,6 +1560,7 @@ def create_frontend(
15581560
timeout_client=timeout_client,
15591561
certificate_id=certificate_id,
15601562
certificate_ids=certificate_ids,
1563+
connection_rate_limit=connection_rate_limit,
15611564
),
15621565
self.client,
15631566
),
@@ -1610,6 +1613,7 @@ def update_frontend(
16101613
timeout_client: Optional[str] = None,
16111614
certificate_id: Optional[str] = None,
16121615
certificate_ids: Optional[List[str]] = None,
1616+
connection_rate_limit: Optional[int] = None,
16131617
) -> Frontend:
16141618
"""
16151619
Update a frontend.
@@ -1623,6 +1627,7 @@ def update_frontend(
16231627
:param timeout_client: Maximum allowed inactivity time on the client side.
16241628
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
16251629
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
1630+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
16261631
:return: :class:`Frontend <Frontend>`
16271632
16281633
Usage:
@@ -1654,6 +1659,7 @@ def update_frontend(
16541659
timeout_client=timeout_client,
16551660
certificate_id=certificate_id,
16561661
certificate_ids=certificate_ids,
1662+
connection_rate_limit=connection_rate_limit,
16571663
),
16581664
self.client,
16591665
),
@@ -4547,6 +4553,7 @@ def create_frontend(
45474553
timeout_client: Optional[str] = None,
45484554
certificate_id: Optional[str] = None,
45494555
certificate_ids: Optional[List[str]] = None,
4556+
connection_rate_limit: Optional[int] = None,
45504557
) -> Frontend:
45514558
"""
45524559
Create a frontend in a given load balancer.
@@ -4559,6 +4566,7 @@ def create_frontend(
45594566
:param timeout_client: Maximum allowed inactivity time on the client side.
45604567
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
45614568
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
4569+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
45624570
:return: :class:`Frontend <Frontend>`
45634571
45644572
Usage:
@@ -4591,6 +4599,7 @@ def create_frontend(
45914599
timeout_client=timeout_client,
45924600
certificate_id=certificate_id,
45934601
certificate_ids=certificate_ids,
4602+
connection_rate_limit=connection_rate_limit,
45944603
),
45954604
self.client,
45964605
),
@@ -4644,6 +4653,7 @@ def update_frontend(
46444653
timeout_client: Optional[str] = None,
46454654
certificate_id: Optional[str] = None,
46464655
certificate_ids: Optional[List[str]] = None,
4656+
connection_rate_limit: Optional[int] = None,
46474657
) -> Frontend:
46484658
"""
46494659
Update a frontend.
@@ -4656,6 +4666,7 @@ def update_frontend(
46564666
:param timeout_client: Maximum allowed inactivity time on the client side.
46574667
:param certificate_id: Certificate ID, deprecated in favor of certificate_ids array.
46584668
:param certificate_ids: List of SSL/TLS certificate IDs to bind to the frontend.
4669+
:param connection_rate_limit: Rate limit for new connections established on this frontend. Use 0 value to disable, else value is connections per second.
46594670
:return: :class:`Frontend <Frontend>`
46604671
46614672
Usage:
@@ -4689,6 +4700,7 @@ def update_frontend(
46894700
timeout_client=timeout_client,
46904701
certificate_id=certificate_id,
46914702
certificate_ids=certificate_ids,
4703+
connection_rate_limit=connection_rate_limit,
46924704
),
46934705
self.client,
46944706
),

scaleway/scaleway/lb/v1/marshalling.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,12 @@ def unmarshal_Frontend(data: Any) -> Frontend:
855855
else:
856856
args["updated_at"] = None
857857

858+
field = data.get("connection_rate_limit", None)
859+
if field is not None:
860+
args["connection_rate_limit"] = field
861+
else:
862+
args["connection_rate_limit"] = None
863+
858864
return Frontend(**args)
859865

860866

@@ -1928,6 +1934,9 @@ def marshal_CreateFrontendRequest(
19281934
if request.certificate_ids is not None:
19291935
output["certificate_ids"] = request.certificate_ids
19301936

1937+
if request.connection_rate_limit is not None:
1938+
output["connection_rate_limit"] = request.connection_rate_limit
1939+
19311940
return output
19321941

19331942

@@ -2283,6 +2292,9 @@ def marshal_UpdateFrontendRequest(
22832292
if request.certificate_ids is not None:
22842293
output["certificate_ids"] = request.certificate_ids
22852294

2295+
if request.connection_rate_limit is not None:
2296+
output["connection_rate_limit"] = request.connection_rate_limit
2297+
22862298
return output
22872299

22882300

@@ -2576,6 +2588,9 @@ def marshal_ZonedApiCreateFrontendRequest(
25762588
if request.certificate_ids is not None:
25772589
output["certificate_ids"] = request.certificate_ids
25782590

2591+
if request.connection_rate_limit is not None:
2592+
output["connection_rate_limit"] = request.connection_rate_limit
2593+
25792594
return output
25802595

25812596

@@ -2926,6 +2941,9 @@ def marshal_ZonedApiUpdateFrontendRequest(
29262941
if request.certificate_ids is not None:
29272942
output["certificate_ids"] = request.certificate_ids
29282943

2944+
if request.connection_rate_limit is not None:
2945+
output["connection_rate_limit"] = request.connection_rate_limit
2946+
29292947
return output
29302948

29312949

0 commit comments

Comments
 (0)