Skip to content

Commit 30bf8b0

Browse files
authored
feat(lb): allow multi ip attach (#205)
1 parent 47b4433 commit 30bf8b0

File tree

6 files changed

+64
-12
lines changed

6 files changed

+64
-12
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ async def create_lb(
311311
name: Optional[str] = None,
312312
ip_id: Optional[str] = None,
313313
assign_flexible_ip: Optional[bool] = None,
314+
ip_ids: Optional[List[str]] = None,
314315
tags: Optional[List[str]] = None,
315316
) -> Lb:
316317
"""
@@ -326,6 +327,7 @@ async def create_lb(
326327
:param description: Description for the Load Balancer.
327328
:param ip_id: ID of an existing flexible IP address to attach to the Load Balancer.
328329
:param assign_flexible_ip: Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
330+
:param ip_ids: List of IP IDs to attach to the Load Balancer.
329331
:param tags: List of tags for the Load Balancer.
330332
:param type_: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types.
331333
:param ssl_compatibility_level: Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort.
@@ -359,6 +361,7 @@ async def create_lb(
359361
name=name or random_name(prefix="lb"),
360362
ip_id=ip_id,
361363
assign_flexible_ip=assign_flexible_ip,
364+
ip_ids=ip_ids,
362365
tags=tags,
363366
),
364367
self.client,
@@ -660,6 +663,7 @@ async def list_i_ps_all(
660663
async def create_ip(
661664
self,
662665
*,
666+
is_ipv6: bool,
663667
region: Optional[Region] = None,
664668
organization_id: Optional[str] = None,
665669
project_id: Optional[str] = None,
@@ -675,12 +679,13 @@ async def create_ip(
675679
676680
One-of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set.
677681
:param reverse: Reverse DNS (domain name) for the IP address.
682+
:param is_ipv6: If true, creates a Flexible IP with an ipv6 address.
678683
:return: :class:`Ip <Ip>`
679684
680685
Usage:
681686
::
682687
683-
result = await api.create_ip()
688+
result = await api.create_ip(is_ipv6=True)
684689
"""
685690

686691
param_region = validate_path_param(
@@ -692,6 +697,7 @@ async def create_ip(
692697
f"/lb/v1/regions/{param_region}/ips",
693698
body=marshal_CreateIpRequest(
694699
CreateIpRequest(
700+
is_ipv6=is_ipv6,
695701
region=region,
696702
organization_id=organization_id,
697703
project_id=project_id,
@@ -3243,6 +3249,7 @@ async def create_lb(
32433249
name: Optional[str] = None,
32443250
ip_id: Optional[str] = None,
32453251
assign_flexible_ip: Optional[bool] = None,
3252+
ip_ids: Optional[List[str]] = None,
32463253
tags: Optional[List[str]] = None,
32473254
) -> Lb:
32483255
"""
@@ -3259,6 +3266,7 @@ async def create_lb(
32593266
:param description: Description for the Load Balancer.
32603267
:param ip_id: ID of an existing flexible IP address to attach to the Load Balancer.
32613268
:param assign_flexible_ip: Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
3269+
:param ip_ids: List of IP IDs to attach to the Load Balancer.
32623270
:param tags: List of tags for the Load Balancer.
32633271
:param type_: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types.
32643272
:param ssl_compatibility_level: Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort.
@@ -3290,6 +3298,7 @@ async def create_lb(
32903298
name=name or random_name(prefix="lb"),
32913299
ip_id=ip_id,
32923300
assign_flexible_ip=assign_flexible_ip,
3301+
ip_ids=ip_ids,
32933302
tags=tags,
32943303
),
32953304
self.client,
@@ -3587,6 +3596,7 @@ async def list_i_ps_all(
35873596
async def create_ip(
35883597
self,
35893598
*,
3599+
is_ipv6: bool,
35903600
zone: Optional[Zone] = None,
35913601
organization_id: Optional[str] = None,
35923602
project_id: Optional[str] = None,
@@ -3603,12 +3613,13 @@ async def create_ip(
36033613
36043614
One-of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set.
36053615
:param reverse: Reverse DNS (domain name) for the IP address.
3616+
:param is_ipv6: If true, creates a Flexible IP with an ipv6 address.
36063617
:return: :class:`Ip <Ip>`
36073618
36083619
Usage:
36093620
::
36103621
3611-
result = await api.create_ip()
3622+
result = await api.create_ip(is_ipv6=True)
36123623
"""
36133624

36143625
param_zone = validate_path_param("zone", zone or self.client.default_zone)
@@ -3618,6 +3629,7 @@ async def create_ip(
36183629
f"/lb/v1/zones/{param_zone}/ips",
36193630
body=marshal_ZonedApiCreateIpRequest(
36203631
ZonedApiCreateIpRequest(
3632+
is_ipv6=is_ipv6,
36213633
zone=zone,
36223634
organization_id=organization_id,
36233635
project_id=project_id,

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,7 @@ def marshal_CreateIpRequest(
15761576
),
15771577
]
15781578
),
1579+
"is_ipv6": request.is_ipv6,
15791580
"reverse": request.reverse,
15801581
}
15811582

@@ -1606,6 +1607,7 @@ def marshal_CreateLbRequest(
16061607
"assign_flexible_ip": request.assign_flexible_ip,
16071608
"description": request.description,
16081609
"ip_id": request.ip_id,
1610+
"ip_ids": request.ip_ids,
16091611
"name": request.name,
16101612
"ssl_compatibility_level": SSLCompatibilityLevel(
16111613
request.ssl_compatibility_level
@@ -2055,6 +2057,7 @@ def marshal_ZonedApiCreateIpRequest(
20552057
),
20562058
]
20572059
),
2060+
"is_ipv6": request.is_ipv6,
20582061
"reverse": request.reverse,
20592062
}
20602063

@@ -2085,6 +2088,7 @@ def marshal_ZonedApiCreateLbRequest(
20852088
"assign_flexible_ip": request.assign_flexible_ip,
20862089
"description": request.description,
20872090
"ip_id": request.ip_id,
2091+
"ip_ids": request.ip_ids,
20882092
"name": request.name,
20892093
"ssl_compatibility_level": SSLCompatibilityLevel(
20902094
request.ssl_compatibility_level

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,9 +1668,9 @@ class CreateLbRequest:
16681668
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
16691669
"""
16701670

1671-
assign_flexible_ip: Optional[bool]
1671+
ip_ids: Optional[List[str]]
16721672
"""
1673-
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
1673+
List of IP IDs to attach to the Load Balancer.
16741674
"""
16751675

16761676
tags: Optional[List[str]]
@@ -1831,6 +1831,11 @@ class CreateIpRequest:
18311831
Reverse DNS (domain name) for the IP address.
18321832
"""
18331833

1834+
is_ipv6: bool
1835+
"""
1836+
If true, creates a Flexible IP with an ipv6 address.
1837+
"""
1838+
18341839

18351840
@dataclass
18361841
class GetIpRequest:
@@ -3209,9 +3214,9 @@ class ZonedApiCreateLbRequest:
32093214
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
32103215
"""
32113216

3212-
assign_flexible_ip: Optional[bool]
3217+
ip_ids: Optional[List[str]]
32133218
"""
3214-
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
3219+
List of IP IDs to attach to the Load Balancer.
32153220
"""
32163221

32173222
tags: Optional[List[str]]
@@ -3372,6 +3377,11 @@ class ZonedApiCreateIpRequest:
33723377
Reverse DNS (domain name) for the IP address.
33733378
"""
33743379

3380+
is_ipv6: bool
3381+
"""
3382+
If true, creates a Flexible IP with an ipv6 address.
3383+
"""
3384+
33753385

33763386
@dataclass
33773387
class ZonedApiGetIpRequest:

scaleway/scaleway/lb/v1/api.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ def create_lb(
311311
name: Optional[str] = None,
312312
ip_id: Optional[str] = None,
313313
assign_flexible_ip: Optional[bool] = None,
314+
ip_ids: Optional[List[str]] = None,
314315
tags: Optional[List[str]] = None,
315316
) -> Lb:
316317
"""
@@ -326,6 +327,7 @@ def create_lb(
326327
:param description: Description for the Load Balancer.
327328
:param ip_id: ID of an existing flexible IP address to attach to the Load Balancer.
328329
:param assign_flexible_ip: Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
330+
:param ip_ids: List of IP IDs to attach to the Load Balancer.
329331
:param tags: List of tags for the Load Balancer.
330332
:param type_: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types.
331333
:param ssl_compatibility_level: Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort.
@@ -359,6 +361,7 @@ def create_lb(
359361
name=name or random_name(prefix="lb"),
360362
ip_id=ip_id,
361363
assign_flexible_ip=assign_flexible_ip,
364+
ip_ids=ip_ids,
362365
tags=tags,
363366
),
364367
self.client,
@@ -660,6 +663,7 @@ def list_i_ps_all(
660663
def create_ip(
661664
self,
662665
*,
666+
is_ipv6: bool,
663667
region: Optional[Region] = None,
664668
organization_id: Optional[str] = None,
665669
project_id: Optional[str] = None,
@@ -675,12 +679,13 @@ def create_ip(
675679
676680
One-of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set.
677681
:param reverse: Reverse DNS (domain name) for the IP address.
682+
:param is_ipv6: If true, creates a Flexible IP with an ipv6 address.
678683
:return: :class:`Ip <Ip>`
679684
680685
Usage:
681686
::
682687
683-
result = api.create_ip()
688+
result = api.create_ip(is_ipv6=True)
684689
"""
685690

686691
param_region = validate_path_param(
@@ -692,6 +697,7 @@ def create_ip(
692697
f"/lb/v1/regions/{param_region}/ips",
693698
body=marshal_CreateIpRequest(
694699
CreateIpRequest(
700+
is_ipv6=is_ipv6,
695701
region=region,
696702
organization_id=organization_id,
697703
project_id=project_id,
@@ -3241,6 +3247,7 @@ def create_lb(
32413247
name: Optional[str] = None,
32423248
ip_id: Optional[str] = None,
32433249
assign_flexible_ip: Optional[bool] = None,
3250+
ip_ids: Optional[List[str]] = None,
32443251
tags: Optional[List[str]] = None,
32453252
) -> Lb:
32463253
"""
@@ -3257,6 +3264,7 @@ def create_lb(
32573264
:param description: Description for the Load Balancer.
32583265
:param ip_id: ID of an existing flexible IP address to attach to the Load Balancer.
32593266
:param assign_flexible_ip: Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
3267+
:param ip_ids: List of IP IDs to attach to the Load Balancer.
32603268
:param tags: List of tags for the Load Balancer.
32613269
:param type_: Load Balancer commercial offer type. Use the Load Balancer types endpoint to retrieve a list of available offer types.
32623270
:param ssl_compatibility_level: Determines the minimal SSL version which needs to be supported on the client side, in an SSL/TLS offloading context. Intermediate is suitable for general-purpose servers with a variety of clients, recommended for almost all systems. Modern is suitable for services with clients that support TLS 1.3 and do not need backward compatibility. Old is compatible with a small number of very old clients and should be used only as a last resort.
@@ -3288,6 +3296,7 @@ def create_lb(
32883296
name=name or random_name(prefix="lb"),
32893297
ip_id=ip_id,
32903298
assign_flexible_ip=assign_flexible_ip,
3299+
ip_ids=ip_ids,
32913300
tags=tags,
32923301
),
32933302
self.client,
@@ -3585,6 +3594,7 @@ def list_i_ps_all(
35853594
def create_ip(
35863595
self,
35873596
*,
3597+
is_ipv6: bool,
35883598
zone: Optional[Zone] = None,
35893599
organization_id: Optional[str] = None,
35903600
project_id: Optional[str] = None,
@@ -3601,12 +3611,13 @@ def create_ip(
36013611
36023612
One-of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set.
36033613
:param reverse: Reverse DNS (domain name) for the IP address.
3614+
:param is_ipv6: If true, creates a Flexible IP with an ipv6 address.
36043615
:return: :class:`Ip <Ip>`
36053616
36063617
Usage:
36073618
::
36083619
3609-
result = api.create_ip()
3620+
result = api.create_ip(is_ipv6=True)
36103621
"""
36113622

36123623
param_zone = validate_path_param("zone", zone or self.client.default_zone)
@@ -3616,6 +3627,7 @@ def create_ip(
36163627
f"/lb/v1/zones/{param_zone}/ips",
36173628
body=marshal_ZonedApiCreateIpRequest(
36183629
ZonedApiCreateIpRequest(
3630+
is_ipv6=is_ipv6,
36193631
zone=zone,
36203632
organization_id=organization_id,
36213633
project_id=project_id,

scaleway/scaleway/lb/v1/marshalling.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,7 @@ def marshal_CreateIpRequest(
15761576
),
15771577
]
15781578
),
1579+
"is_ipv6": request.is_ipv6,
15791580
"reverse": request.reverse,
15801581
}
15811582

@@ -1606,6 +1607,7 @@ def marshal_CreateLbRequest(
16061607
"assign_flexible_ip": request.assign_flexible_ip,
16071608
"description": request.description,
16081609
"ip_id": request.ip_id,
1610+
"ip_ids": request.ip_ids,
16091611
"name": request.name,
16101612
"ssl_compatibility_level": SSLCompatibilityLevel(
16111613
request.ssl_compatibility_level
@@ -2055,6 +2057,7 @@ def marshal_ZonedApiCreateIpRequest(
20552057
),
20562058
]
20572059
),
2060+
"is_ipv6": request.is_ipv6,
20582061
"reverse": request.reverse,
20592062
}
20602063

@@ -2085,6 +2088,7 @@ def marshal_ZonedApiCreateLbRequest(
20852088
"assign_flexible_ip": request.assign_flexible_ip,
20862089
"description": request.description,
20872090
"ip_id": request.ip_id,
2091+
"ip_ids": request.ip_ids,
20882092
"name": request.name,
20892093
"ssl_compatibility_level": SSLCompatibilityLevel(
20902094
request.ssl_compatibility_level

scaleway/scaleway/lb/v1/types.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,9 +1668,9 @@ class CreateLbRequest:
16681668
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
16691669
"""
16701670

1671-
assign_flexible_ip: Optional[bool]
1671+
ip_ids: Optional[List[str]]
16721672
"""
1673-
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
1673+
List of IP IDs to attach to the Load Balancer.
16741674
"""
16751675

16761676
tags: Optional[List[str]]
@@ -1831,6 +1831,11 @@ class CreateIpRequest:
18311831
Reverse DNS (domain name) for the IP address.
18321832
"""
18331833

1834+
is_ipv6: bool
1835+
"""
1836+
If true, creates a Flexible IP with an ipv6 address.
1837+
"""
1838+
18341839

18351840
@dataclass
18361841
class GetIpRequest:
@@ -3209,9 +3214,9 @@ class ZonedApiCreateLbRequest:
32093214
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
32103215
"""
32113216

3212-
assign_flexible_ip: Optional[bool]
3217+
ip_ids: Optional[List[str]]
32133218
"""
3214-
Defines whether to automatically assign a flexible public IP to lb. Default value is `false` (do not assign).
3219+
List of IP IDs to attach to the Load Balancer.
32153220
"""
32163221

32173222
tags: Optional[List[str]]
@@ -3372,6 +3377,11 @@ class ZonedApiCreateIpRequest:
33723377
Reverse DNS (domain name) for the IP address.
33733378
"""
33743379

3380+
is_ipv6: bool
3381+
"""
3382+
If true, creates a Flexible IP with an ipv6 address.
3383+
"""
3384+
33753385

33763386
@dataclass
33773387
class ZonedApiGetIpRequest:

0 commit comments

Comments
 (0)