Skip to content

Commit 6671e34

Browse files
authored
feat(vpc): add ingress rule documentation and cli (#1908)
1 parent 3364547 commit 6671e34

6 files changed

Lines changed: 400 additions & 92 deletions

File tree

scaleway-async/scaleway_async/vpc/v2/api.py

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,8 +1438,8 @@ async def list_subnet_overlaps(
14381438
) -> ListSubnetOverlapsResponse:
14391439
"""
14401440
List subnet overlaps.
1441-
List subnet overlaps between the VPCConnector VPC and the target VPC or for a specific subnet if specified.
1442-
:param vpc_connector_id: VPCConnector ID.
1441+
List subnet overlaps between the VPCs on both sides of a connector, or for a specific subnet if specified.
1442+
:param vpc_connector_id: VPC Peering connector ID.
14431443
:param region: Region to target. If none is passed will use default region from the config.
14441444
:param order_by: Sort order of the returned Subnet overlaps.
14451445
:param page: Page number to return, from the paginated results.
@@ -1485,8 +1485,8 @@ async def list_subnet_overlaps_all(
14851485
) -> list[ListSubnetOverlapsResponseSubnetOverlap]:
14861486
"""
14871487
List subnet overlaps.
1488-
List subnet overlaps between the VPCConnector VPC and the target VPC or for a specific subnet if specified.
1489-
:param vpc_connector_id: VPCConnector ID.
1488+
List subnet overlaps between the VPCs on both sides of a connector, or for a specific subnet if specified.
1489+
:param vpc_connector_id: VPC Peering connector ID.
14901490
:param region: Region to target. If none is passed will use default region from the config.
14911491
:param order_by: Sort order of the returned Subnet overlaps.
14921492
:param page: Page number to return, from the paginated results.
@@ -1530,17 +1530,19 @@ async def list_ingress_rules(
15301530
project_id: Optional[str] = None,
15311531
) -> ListIngressRulesResponse:
15321532
"""
1533+
List ingress rules.
1534+
List existing ingress rules in the specified region.
15331535
:param region: Region to target. If none is passed will use default region from the config.
1534-
:param order_by:
1535-
:param page:
1536-
:param page_size:
1537-
:param vpc_id:
1538-
:param nexthop_resource_ip:
1539-
:param nexthop_private_network_id:
1540-
:param is_ipv6:
1541-
:param tags:
1542-
:param organization_id:
1543-
:param project_id:
1536+
:param order_by: Sort order of the returned ingress rules.
1537+
:param page: Page number to return, from the paginated results.
1538+
:param page_size: Maximum number of ingress rules to return per page.
1539+
:param vpc_id: ID of the VPC to filter for.
1540+
:param nexthop_resource_ip: Next hop IP to filter for.
1541+
:param nexthop_private_network_id: Next hop Private Network ID to filter for. Only ingress rules with this Private Network as next hop will be returned.
1542+
:param is_ipv6: Whether to return only IPv4 or IPv6 ingress rules.
1543+
:param tags: Tags to filter for. Only ingress rules with one or more matching tags will be returned.
1544+
:param organization_id: Organization ID to filter for. Only ingress rules belonging to this Organization will be returned.
1545+
:param project_id: Project ID to filter for. Only ingress rules belonging to this Project will be returned.
15441546
:return: :class:`ListIngressRulesResponse <ListIngressRulesResponse>`
15451547
15461548
Usage:
@@ -1590,17 +1592,19 @@ async def list_ingress_rules_all(
15901592
project_id: Optional[str] = None,
15911593
) -> list[IngressRule]:
15921594
"""
1595+
List ingress rules.
1596+
List existing ingress rules in the specified region.
15931597
:param region: Region to target. If none is passed will use default region from the config.
1594-
:param order_by:
1595-
:param page:
1596-
:param page_size:
1597-
:param vpc_id:
1598-
:param nexthop_resource_ip:
1599-
:param nexthop_private_network_id:
1600-
:param is_ipv6:
1601-
:param tags:
1602-
:param organization_id:
1603-
:param project_id:
1598+
:param order_by: Sort order of the returned ingress rules.
1599+
:param page: Page number to return, from the paginated results.
1600+
:param page_size: Maximum number of ingress rules to return per page.
1601+
:param vpc_id: ID of the VPC to filter for.
1602+
:param nexthop_resource_ip: Next hop IP to filter for.
1603+
:param nexthop_private_network_id: Next hop Private Network ID to filter for. Only ingress rules with this Private Network as next hop will be returned.
1604+
:param is_ipv6: Whether to return only IPv4 or IPv6 ingress rules.
1605+
:param tags: Tags to filter for. Only ingress rules with one or more matching tags will be returned.
1606+
:param organization_id: Organization ID to filter for. Only ingress rules belonging to this Organization will be returned.
1607+
:param project_id: Project ID to filter for. Only ingress rules belonging to this Project will be returned.
16041608
:return: :class:`list[IngressRule] <list[IngressRule]>`
16051609
16061610
Usage:
@@ -1640,13 +1644,15 @@ async def create_ingress_rule(
16401644
tags: Optional[list[str]] = None,
16411645
) -> IngressRule:
16421646
"""
1643-
:param vpc_id:
1644-
:param source:
1645-
:param nexthop_resource_ip:
1646-
:param nexthop_private_network_id:
1647+
Create an ingress rule.
1648+
Create an ingress rule in the specified region.
1649+
:param vpc_id: ID of the VPC this rule will belong to.
1650+
:param source: Source network to match ingress traffic on. Can be IPv6 or IPv4.
1651+
:param nexthop_resource_ip: IP of the local resource to redirect ingress traffic to. IP version must be consistent with the source network.
1652+
:param nexthop_private_network_id: ID of the Private Network the destination resource is in.
16471653
:param region: Region to target. If none is passed will use default region from the config.
1648-
:param description:
1649-
:param tags:
1654+
:param description: Description for this ingress rule.
1655+
:param tags: Tags for this ingress rule.
16501656
:return: :class:`IngressRule <IngressRule>`
16511657
16521658
Usage:
@@ -1691,7 +1697,9 @@ async def get_ingress_rule(
16911697
region: Optional[ScwRegion] = None,
16921698
) -> IngressRule:
16931699
"""
1694-
:param rule_id:
1700+
Get an ingress rule.
1701+
Retrieve details of an existing ingress rule, specified by its ingress rule ID.
1702+
:param rule_id: ID of the ingress rule to return.
16951703
:param region: Region to target. If none is passed will use default region from the config.
16961704
:return: :class:`IngressRule <IngressRule>`
16971705
@@ -1728,13 +1736,15 @@ async def update_ingress_rule(
17281736
tags: Optional[list[str]] = None,
17291737
) -> IngressRule:
17301738
"""
1731-
:param rule_id:
1739+
Update an ingress rule.
1740+
Update an ingress rule specified by its ingress rule ID.
1741+
:param rule_id: ID of the ingress rule to update.
17321742
:param region: Region to target. If none is passed will use default region from the config.
1733-
:param source:
1734-
:param nexthop_resource_ip:
1735-
:param nexthop_private_network_id:
1736-
:param description:
1737-
:param tags:
1743+
:param source: Source network to match ingress traffic on. Can be IPv4 or IPv6.
1744+
:param nexthop_resource_ip: IP of the local resource to redirect ingress traffic to. IP version must be consistent with the source network.
1745+
:param nexthop_private_network_id: ID of the Private Network the destination resource is in.
1746+
:param description: Description to set for this ingress rule.
1747+
:param tags: Tags to set for this ingress rule.
17381748
:return: :class:`IngressRule <IngressRule>`
17391749
17401750
Usage:
@@ -1777,7 +1787,9 @@ async def delete_ingress_rule(
17771787
region: Optional[ScwRegion] = None,
17781788
) -> None:
17791789
"""
1780-
:param rule_id:
1790+
Delete an ingress rule.
1791+
Delete an ingress rule specified by its ingress rule ID.
1792+
:param rule_id: ID of the ingress rule to delete.
17811793
:param region: Region to target. If none is passed will use default region from the config.
17821794
17831795
Usage:

scaleway-async/scaleway_async/vpc/v2/marshalling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def unmarshal_IngressRule(data: Any) -> IngressRule:
296296
if field is not None:
297297
args["is_ipv6"] = field
298298
else:
299-
args["is_ipv6"] = None
299+
args["is_ipv6"] = False
300300

301301
field = data.get("source", None)
302302
if field is not None:
@@ -338,7 +338,7 @@ def unmarshal_IngressRule(data: Any) -> IngressRule:
338338
if field is not None:
339339
args["tags"] = field
340340
else:
341-
args["tags"] = None
341+
args["tags"] = []
342342

343343
field = data.get("organization_id", None)
344344
if field is not None:

0 commit comments

Comments
 (0)