diff --git a/scaleway-async/scaleway_async/interlink/v1beta1/api.py b/scaleway-async/scaleway_async/interlink/v1beta1/api.py index 56c00bb49..fd41addc8 100644 --- a/scaleway-async/scaleway_async/interlink/v1beta1/api.py +++ b/scaleway-async/scaleway_async/interlink/v1beta1/api.py @@ -28,6 +28,7 @@ CreateLinkRequest, CreateRoutingPolicyRequest, DedicatedConnection, + DetachRoutingPolicyRequest, Link, ListDedicatedConnectionsResponse, ListLinksResponse, @@ -59,6 +60,7 @@ marshal_AttachVpcRequest, marshal_CreateLinkRequest, marshal_CreateRoutingPolicyRequest, + marshal_DetachRoutingPolicyRequest, marshal_UpdateLinkRequest, marshal_UpdateRoutingPolicyRequest, ) @@ -1031,12 +1033,14 @@ async def detach_routing_policy( self, *, link_id: str, + routing_policy_id: str, region: Optional[ScwRegion] = None, ) -> Link: """ Detach a routing policy. Detach a routing policy from an existing link. Without a routing policy, all routes across the link are blocked by default. :param link_id: ID of the link to detach a routing policy from. + :param routing_policy_id: ID of the routing policy to be detached. :param region: Region to target. If none is passed will use default region from the config. :return: :class:`Link ` @@ -1045,6 +1049,7 @@ async def detach_routing_policy( result = await api.detach_routing_policy( link_id="example", + routing_policy_id="example", ) """ @@ -1056,7 +1061,14 @@ async def detach_routing_policy( res = self._request( "POST", f"/interlink/v1beta1/regions/{param_region}/links/{param_link_id}/detach-routing-policy", - body={}, + body=marshal_DetachRoutingPolicyRequest( + DetachRoutingPolicyRequest( + link_id=link_id, + routing_policy_id=routing_policy_id, + region=region, + ), + self.client, + ), ) self._throw_on_error(res) @@ -1143,6 +1155,7 @@ async def list_routing_policies( organization_id: Optional[str] = None, name: Optional[str] = None, tags: Optional[List[str]] = None, + ipv6: Optional[bool] = None, ) -> ListRoutingPoliciesResponse: """ List routing policies. @@ -1155,6 +1168,7 @@ async def list_routing_policies( :param organization_id: Organization ID to filter for. :param name: Routing policy name to filter for. :param tags: Tags to filter for. + :param ipv6: Filter for the routing policies based on IP prefixes version. :return: :class:`ListRoutingPoliciesResponse ` Usage: @@ -1171,6 +1185,7 @@ async def list_routing_policies( "GET", f"/interlink/v1beta1/regions/{param_region}/routing-policies", params={ + "ipv6": ipv6, "name": name, "order_by": order_by, "organization_id": organization_id @@ -1196,6 +1211,7 @@ async def list_routing_policies_all( organization_id: Optional[str] = None, name: Optional[str] = None, tags: Optional[List[str]] = None, + ipv6: Optional[bool] = None, ) -> List[RoutingPolicy]: """ List routing policies. @@ -1208,6 +1224,7 @@ async def list_routing_policies_all( :param organization_id: Organization ID to filter for. :param name: Routing policy name to filter for. :param tags: Tags to filter for. + :param ipv6: Filter for the routing policies based on IP prefixes version. :return: :class:`List[RoutingPolicy] ` Usage: @@ -1229,6 +1246,7 @@ async def list_routing_policies_all( "organization_id": organization_id, "name": name, "tags": tags, + "ipv6": ipv6, }, ) @@ -1272,6 +1290,7 @@ async def create_routing_policy( self, *, name: str, + is_ipv6: bool, region: Optional[ScwRegion] = None, project_id: Optional[str] = None, tags: Optional[List[str]] = None, @@ -1282,6 +1301,7 @@ async def create_routing_policy( Create a routing policy. Create a routing policy. Routing policies allow you to set IP prefix filters to define the incoming route announcements to accept from the peer, and the outgoing routes to announce to the peer. :param name: Name of the routing policy. + :param is_ipv6: IP prefixes version of the routing policy. :param region: Region to target. If none is passed will use default region from the config. :param project_id: ID of the Project to create the routing policy in. :param tags: List of tags to apply to the routing policy. @@ -1294,6 +1314,7 @@ async def create_routing_policy( result = await api.create_routing_policy( name="example", + is_ipv6=False, ) """ @@ -1307,6 +1328,7 @@ async def create_routing_policy( body=marshal_CreateRoutingPolicyRequest( CreateRoutingPolicyRequest( name=name, + is_ipv6=is_ipv6, region=region, project_id=project_id, tags=tags, diff --git a/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py b/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py index 0768e3db6..0c567d65c 100644 --- a/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/interlink/v1beta1/marshalling.py @@ -27,6 +27,7 @@ AttachVpcRequest, CreateLinkRequest, CreateRoutingPolicyRequest, + DetachRoutingPolicyRequest, UpdateLinkRequest, UpdateRoutingPolicyRequest, ) @@ -272,6 +273,18 @@ def unmarshal_Link(data: Any) -> Link: else: args["peer_bgp_config"] = None + field = data.get("routing_policy_v4_id", None) + if field is not None: + args["routing_policy_v4_id"] = field + else: + args["routing_policy_v4_id"] = None + + field = data.get("routing_policy_v6_id", None) + if field is not None: + args["routing_policy_v6_id"] = field + else: + args["routing_policy_v6_id"] = None + return Link(**args) @@ -397,6 +410,10 @@ def unmarshal_RoutingPolicy(data: Any) -> RoutingPolicy: if field is not None: args["prefix_filter_out"] = field + field = data.get("is_ipv6", None) + if field is not None: + args["is_ipv6"] = field + field = data.get("region", None) if field is not None: args["region"] = field @@ -591,6 +608,9 @@ def marshal_CreateRoutingPolicyRequest( if request.name is not None: output["name"] = request.name + if request.is_ipv6 is not None: + output["is_ipv6"] = request.is_ipv6 + if request.project_id is not None: output["project_id"] = request.project_id or defaults.default_project_id @@ -606,6 +626,18 @@ def marshal_CreateRoutingPolicyRequest( return output +def marshal_DetachRoutingPolicyRequest( + request: DetachRoutingPolicyRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.routing_policy_id is not None: + output["routing_policy_id"] = request.routing_policy_id + + return output + + def marshal_UpdateLinkRequest( request: UpdateLinkRequest, defaults: ProfileDefaults, diff --git a/scaleway-async/scaleway_async/interlink/v1beta1/types.py b/scaleway-async/scaleway_async/interlink/v1beta1/types.py index b41c803ae..bbc7e0092 100644 --- a/scaleway-async/scaleway_async/interlink/v1beta1/types.py +++ b/scaleway-async/scaleway_async/interlink/v1beta1/types.py @@ -286,16 +286,6 @@ class Link: Defines whether route propagation is enabled or not. To enable or disable route propagation, use the dedicated endpoint. """ - vlan: int - """ - VLAN of the link. - """ - - region: ScwRegion - """ - Region of the link. - """ - vpc_id: Optional[str] """ ID of the Scaleway VPC attached to the link. @@ -303,7 +293,7 @@ class Link: routing_policy_id: Optional[str] """ - ID of the routing policy attached to the link. + Deprecated. Use routing_policy_v4_id or routing_policy_v6_id instead. """ created_at: Optional[datetime] @@ -316,6 +306,16 @@ class Link: Last modification date of the link. """ + vlan: int + """ + VLAN of the link. + """ + + region: ScwRegion + """ + Region of the link. + """ + scw_bgp_config: Optional[BgpConfig] """ BGP configuration on Scaleway's side. @@ -326,6 +326,16 @@ class Link: BGP configuration on peer's side (on-premises or other hosting provider). """ + routing_policy_v4_id: Optional[str] + """ + ID of the routing policy IPv4 attached to the link. + """ + + routing_policy_v6_id: Optional[str] + """ + ID of the routing policy IPv6 attached to the link. + """ + partner: Optional[PartnerHost] self_: Optional[SelfHost] @@ -449,6 +459,11 @@ class RoutingPolicy: IP prefix filters to advertise to the peer (ranges of routes to advertise). """ + is_ipv6: bool + """ + IP prefixes version of the routing policy. + """ + region: ScwRegion """ Region of the routing policy. @@ -550,6 +565,11 @@ class CreateRoutingPolicyRequest: Name of the routing policy. """ + is_ipv6: bool + """ + IP prefixes version of the routing policy. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -609,6 +629,11 @@ class DetachRoutingPolicyRequest: ID of the link to detach a routing policy from. """ + routing_policy_id: str + """ + ID of the routing policy to be detached. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -1045,6 +1070,11 @@ class ListRoutingPoliciesRequest: Tags to filter for. """ + ipv6: Optional[bool] + """ + Filter for the routing policies based on IP prefixes version. + """ + @dataclass class ListRoutingPoliciesResponse: diff --git a/scaleway/scaleway/interlink/v1beta1/api.py b/scaleway/scaleway/interlink/v1beta1/api.py index ed7fd366a..355178ec3 100644 --- a/scaleway/scaleway/interlink/v1beta1/api.py +++ b/scaleway/scaleway/interlink/v1beta1/api.py @@ -28,6 +28,7 @@ CreateLinkRequest, CreateRoutingPolicyRequest, DedicatedConnection, + DetachRoutingPolicyRequest, Link, ListDedicatedConnectionsResponse, ListLinksResponse, @@ -59,6 +60,7 @@ marshal_AttachVpcRequest, marshal_CreateLinkRequest, marshal_CreateRoutingPolicyRequest, + marshal_DetachRoutingPolicyRequest, marshal_UpdateLinkRequest, marshal_UpdateRoutingPolicyRequest, ) @@ -1029,12 +1031,14 @@ def detach_routing_policy( self, *, link_id: str, + routing_policy_id: str, region: Optional[ScwRegion] = None, ) -> Link: """ Detach a routing policy. Detach a routing policy from an existing link. Without a routing policy, all routes across the link are blocked by default. :param link_id: ID of the link to detach a routing policy from. + :param routing_policy_id: ID of the routing policy to be detached. :param region: Region to target. If none is passed will use default region from the config. :return: :class:`Link ` @@ -1043,6 +1047,7 @@ def detach_routing_policy( result = api.detach_routing_policy( link_id="example", + routing_policy_id="example", ) """ @@ -1054,7 +1059,14 @@ def detach_routing_policy( res = self._request( "POST", f"/interlink/v1beta1/regions/{param_region}/links/{param_link_id}/detach-routing-policy", - body={}, + body=marshal_DetachRoutingPolicyRequest( + DetachRoutingPolicyRequest( + link_id=link_id, + routing_policy_id=routing_policy_id, + region=region, + ), + self.client, + ), ) self._throw_on_error(res) @@ -1141,6 +1153,7 @@ def list_routing_policies( organization_id: Optional[str] = None, name: Optional[str] = None, tags: Optional[List[str]] = None, + ipv6: Optional[bool] = None, ) -> ListRoutingPoliciesResponse: """ List routing policies. @@ -1153,6 +1166,7 @@ def list_routing_policies( :param organization_id: Organization ID to filter for. :param name: Routing policy name to filter for. :param tags: Tags to filter for. + :param ipv6: Filter for the routing policies based on IP prefixes version. :return: :class:`ListRoutingPoliciesResponse ` Usage: @@ -1169,6 +1183,7 @@ def list_routing_policies( "GET", f"/interlink/v1beta1/regions/{param_region}/routing-policies", params={ + "ipv6": ipv6, "name": name, "order_by": order_by, "organization_id": organization_id @@ -1194,6 +1209,7 @@ def list_routing_policies_all( organization_id: Optional[str] = None, name: Optional[str] = None, tags: Optional[List[str]] = None, + ipv6: Optional[bool] = None, ) -> List[RoutingPolicy]: """ List routing policies. @@ -1206,6 +1222,7 @@ def list_routing_policies_all( :param organization_id: Organization ID to filter for. :param name: Routing policy name to filter for. :param tags: Tags to filter for. + :param ipv6: Filter for the routing policies based on IP prefixes version. :return: :class:`List[RoutingPolicy] ` Usage: @@ -1227,6 +1244,7 @@ def list_routing_policies_all( "organization_id": organization_id, "name": name, "tags": tags, + "ipv6": ipv6, }, ) @@ -1270,6 +1288,7 @@ def create_routing_policy( self, *, name: str, + is_ipv6: bool, region: Optional[ScwRegion] = None, project_id: Optional[str] = None, tags: Optional[List[str]] = None, @@ -1280,6 +1299,7 @@ def create_routing_policy( Create a routing policy. Create a routing policy. Routing policies allow you to set IP prefix filters to define the incoming route announcements to accept from the peer, and the outgoing routes to announce to the peer. :param name: Name of the routing policy. + :param is_ipv6: IP prefixes version of the routing policy. :param region: Region to target. If none is passed will use default region from the config. :param project_id: ID of the Project to create the routing policy in. :param tags: List of tags to apply to the routing policy. @@ -1292,6 +1312,7 @@ def create_routing_policy( result = api.create_routing_policy( name="example", + is_ipv6=False, ) """ @@ -1305,6 +1326,7 @@ def create_routing_policy( body=marshal_CreateRoutingPolicyRequest( CreateRoutingPolicyRequest( name=name, + is_ipv6=is_ipv6, region=region, project_id=project_id, tags=tags, diff --git a/scaleway/scaleway/interlink/v1beta1/marshalling.py b/scaleway/scaleway/interlink/v1beta1/marshalling.py index 0768e3db6..0c567d65c 100644 --- a/scaleway/scaleway/interlink/v1beta1/marshalling.py +++ b/scaleway/scaleway/interlink/v1beta1/marshalling.py @@ -27,6 +27,7 @@ AttachVpcRequest, CreateLinkRequest, CreateRoutingPolicyRequest, + DetachRoutingPolicyRequest, UpdateLinkRequest, UpdateRoutingPolicyRequest, ) @@ -272,6 +273,18 @@ def unmarshal_Link(data: Any) -> Link: else: args["peer_bgp_config"] = None + field = data.get("routing_policy_v4_id", None) + if field is not None: + args["routing_policy_v4_id"] = field + else: + args["routing_policy_v4_id"] = None + + field = data.get("routing_policy_v6_id", None) + if field is not None: + args["routing_policy_v6_id"] = field + else: + args["routing_policy_v6_id"] = None + return Link(**args) @@ -397,6 +410,10 @@ def unmarshal_RoutingPolicy(data: Any) -> RoutingPolicy: if field is not None: args["prefix_filter_out"] = field + field = data.get("is_ipv6", None) + if field is not None: + args["is_ipv6"] = field + field = data.get("region", None) if field is not None: args["region"] = field @@ -591,6 +608,9 @@ def marshal_CreateRoutingPolicyRequest( if request.name is not None: output["name"] = request.name + if request.is_ipv6 is not None: + output["is_ipv6"] = request.is_ipv6 + if request.project_id is not None: output["project_id"] = request.project_id or defaults.default_project_id @@ -606,6 +626,18 @@ def marshal_CreateRoutingPolicyRequest( return output +def marshal_DetachRoutingPolicyRequest( + request: DetachRoutingPolicyRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.routing_policy_id is not None: + output["routing_policy_id"] = request.routing_policy_id + + return output + + def marshal_UpdateLinkRequest( request: UpdateLinkRequest, defaults: ProfileDefaults, diff --git a/scaleway/scaleway/interlink/v1beta1/types.py b/scaleway/scaleway/interlink/v1beta1/types.py index b41c803ae..bbc7e0092 100644 --- a/scaleway/scaleway/interlink/v1beta1/types.py +++ b/scaleway/scaleway/interlink/v1beta1/types.py @@ -286,16 +286,6 @@ class Link: Defines whether route propagation is enabled or not. To enable or disable route propagation, use the dedicated endpoint. """ - vlan: int - """ - VLAN of the link. - """ - - region: ScwRegion - """ - Region of the link. - """ - vpc_id: Optional[str] """ ID of the Scaleway VPC attached to the link. @@ -303,7 +293,7 @@ class Link: routing_policy_id: Optional[str] """ - ID of the routing policy attached to the link. + Deprecated. Use routing_policy_v4_id or routing_policy_v6_id instead. """ created_at: Optional[datetime] @@ -316,6 +306,16 @@ class Link: Last modification date of the link. """ + vlan: int + """ + VLAN of the link. + """ + + region: ScwRegion + """ + Region of the link. + """ + scw_bgp_config: Optional[BgpConfig] """ BGP configuration on Scaleway's side. @@ -326,6 +326,16 @@ class Link: BGP configuration on peer's side (on-premises or other hosting provider). """ + routing_policy_v4_id: Optional[str] + """ + ID of the routing policy IPv4 attached to the link. + """ + + routing_policy_v6_id: Optional[str] + """ + ID of the routing policy IPv6 attached to the link. + """ + partner: Optional[PartnerHost] self_: Optional[SelfHost] @@ -449,6 +459,11 @@ class RoutingPolicy: IP prefix filters to advertise to the peer (ranges of routes to advertise). """ + is_ipv6: bool + """ + IP prefixes version of the routing policy. + """ + region: ScwRegion """ Region of the routing policy. @@ -550,6 +565,11 @@ class CreateRoutingPolicyRequest: Name of the routing policy. """ + is_ipv6: bool + """ + IP prefixes version of the routing policy. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -609,6 +629,11 @@ class DetachRoutingPolicyRequest: ID of the link to detach a routing policy from. """ + routing_policy_id: str + """ + ID of the routing policy to be detached. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -1045,6 +1070,11 @@ class ListRoutingPoliciesRequest: Tags to filter for. """ + ipv6: Optional[bool] + """ + Filter for the routing policies based on IP prefixes version. + """ + @dataclass class ListRoutingPoliciesResponse: