Skip to content

Commit a411236

Browse files
feat(interlink): add support for range (#1366)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
1 parent b5d2b4d commit a411236

File tree

6 files changed

+86
-0
lines changed

6 files changed

+86
-0
lines changed

scaleway-async/scaleway_async/interlink/v1beta1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .types import ListPopsRequestOrderBy
1313
from .types import ListRoutingPoliciesRequestOrderBy
1414
from .types import BgpConfig
15+
from .types import Range
1516
from .types import PartnerHost
1617
from .types import SelfHost
1718
from .types import DedicatedConnection
@@ -62,6 +63,7 @@
6263
"ListPopsRequestOrderBy",
6364
"ListRoutingPoliciesRequestOrderBy",
6465
"BgpConfig",
66+
"Range",
6567
"PartnerHost",
6668
"SelfHost",
6769
"DedicatedConnection",

scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
BgpStatus,
1414
DedicatedConnectionStatus,
1515
LinkStatus,
16+
Range,
1617
DedicatedConnection,
1718
BgpConfig,
1819
PartnerHost,
@@ -37,6 +38,29 @@
3738
)
3839

3940

41+
def unmarshal_Range(data: Any) -> Range:
42+
if not isinstance(data, dict):
43+
raise TypeError(
44+
"Unmarshalling the type 'Range' failed as data isn't a dictionary."
45+
)
46+
47+
args: dict[str, Any] = {}
48+
49+
field = data.get("start", None)
50+
if field is not None:
51+
args["start"] = field
52+
else:
53+
args["start"] = None
54+
55+
field = data.get("end", None)
56+
if field is not None:
57+
args["end"] = field
58+
else:
59+
args["end"] = None
60+
61+
return Range(**args)
62+
63+
4064
def unmarshal_DedicatedConnection(data: Any) -> DedicatedConnection:
4165
if not isinstance(data, dict):
4266
raise TypeError(
@@ -123,6 +147,12 @@ def unmarshal_DedicatedConnection(data: Any) -> DedicatedConnection:
123147
else:
124148
args["demarcation_info"] = None
125149

150+
field = data.get("vlan_range", None)
151+
if field is not None:
152+
args["vlan_range"] = unmarshal_Range(field)
153+
else:
154+
args["vlan_range"] = None
155+
126156
return DedicatedConnection(**args)
127157

128158

scaleway-async/scaleway_async/interlink/v1beta1/types.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ class BgpConfig:
137137
"""
138138

139139

140+
@dataclass
141+
class Range:
142+
start: int
143+
end: int
144+
145+
140146
@dataclass
141147
class PartnerHost:
142148
partner_id: str
@@ -230,6 +236,11 @@ class DedicatedConnection:
230236
Demarcation details required by the data center to set up the supporting Cross Connect. This generally includes the physical space in the facility, the cabinet or rack the connection should land in, the patch panel to go in, the port designation, and the media type.
231237
"""
232238

239+
vlan_range: Optional[Range] = None
240+
"""
241+
Range in which to pick vlan for self-hosted links on this dedicated connection. Both start & end are included. Any range defined here must be itself included in the greater allowed range of vlans from 1500 to 3899 (this range is hardware dependent and can change over time, but actual range will be enforced).
242+
"""
243+
233244

234245
@dataclass
235246
class Link:

scaleway/scaleway/interlink/v1beta1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from .types import ListPopsRequestOrderBy
1313
from .types import ListRoutingPoliciesRequestOrderBy
1414
from .types import BgpConfig
15+
from .types import Range
1516
from .types import PartnerHost
1617
from .types import SelfHost
1718
from .types import DedicatedConnection
@@ -62,6 +63,7 @@
6263
"ListPopsRequestOrderBy",
6364
"ListRoutingPoliciesRequestOrderBy",
6465
"BgpConfig",
66+
"Range",
6567
"PartnerHost",
6668
"SelfHost",
6769
"DedicatedConnection",

scaleway/scaleway/interlink/v1beta1/marshalling.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
BgpStatus,
1414
DedicatedConnectionStatus,
1515
LinkStatus,
16+
Range,
1617
DedicatedConnection,
1718
BgpConfig,
1819
PartnerHost,
@@ -37,6 +38,29 @@
3738
)
3839

3940

41+
def unmarshal_Range(data: Any) -> Range:
42+
if not isinstance(data, dict):
43+
raise TypeError(
44+
"Unmarshalling the type 'Range' failed as data isn't a dictionary."
45+
)
46+
47+
args: dict[str, Any] = {}
48+
49+
field = data.get("start", None)
50+
if field is not None:
51+
args["start"] = field
52+
else:
53+
args["start"] = None
54+
55+
field = data.get("end", None)
56+
if field is not None:
57+
args["end"] = field
58+
else:
59+
args["end"] = None
60+
61+
return Range(**args)
62+
63+
4064
def unmarshal_DedicatedConnection(data: Any) -> DedicatedConnection:
4165
if not isinstance(data, dict):
4266
raise TypeError(
@@ -123,6 +147,12 @@ def unmarshal_DedicatedConnection(data: Any) -> DedicatedConnection:
123147
else:
124148
args["demarcation_info"] = None
125149

150+
field = data.get("vlan_range", None)
151+
if field is not None:
152+
args["vlan_range"] = unmarshal_Range(field)
153+
else:
154+
args["vlan_range"] = None
155+
126156
return DedicatedConnection(**args)
127157

128158

scaleway/scaleway/interlink/v1beta1/types.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ class BgpConfig:
137137
"""
138138

139139

140+
@dataclass
141+
class Range:
142+
start: int
143+
end: int
144+
145+
140146
@dataclass
141147
class PartnerHost:
142148
partner_id: str
@@ -230,6 +236,11 @@ class DedicatedConnection:
230236
Demarcation details required by the data center to set up the supporting Cross Connect. This generally includes the physical space in the facility, the cabinet or rack the connection should land in, the patch panel to go in, the port designation, and the media type.
231237
"""
232238

239+
vlan_range: Optional[Range] = None
240+
"""
241+
Range in which to pick vlan for self-hosted links on this dedicated connection. Both start & end are included. Any range defined here must be itself included in the greater allowed range of vlans from 1500 to 3899 (this range is hardware dependent and can change over time, but actual range will be enforced).
242+
"""
243+
233244

234245
@dataclass
235246
class Link:

0 commit comments

Comments
 (0)