22
33from linode_api4 .errors import UnexpectedResponseError
44from linode_api4 .groups import Group
5- from linode_api4 .objects import VPC , Region , VPCIPAddress , VPCIPv6RangeOptions
5+ from linode_api4 .objects import VPC , Region , VPCIPAddress , VPCIPv4DefaultRange , VPCIPv4RangeOptions , VPCIPv6RangeOptions
66from linode_api4 .objects .base import _flatten_request_body_recursive
77from linode_api4 .paginated_list import PaginatedList
88from linode_api4 .util import drop_null_keys
@@ -36,6 +36,7 @@ def create(
3636 description : Optional [str ] = None ,
3737 subnets : Optional [List [Dict [str , Any ]]] = None ,
3838 ipv6 : Optional [List [Union [VPCIPv6RangeOptions , Dict [str , Any ]]]] = None ,
39+ ipv4 : Optional [List [Union [VPCIPv4RangeOptions , Dict [str , Any ]]]] = None ,
3940 ** kwargs ,
4041 ) -> VPC :
4142 """
@@ -53,6 +54,8 @@ def create(
5354 :type subnets: List[Dict[str, Any]]
5455 :param ipv6: The IPv6 address ranges for this VPC.
5556 :type ipv6: List[Union[VPCIPv6RangeOptions, Dict[str, Any]]]
57+ :param ipv4: The IPv4 address ranges for this VPC.
58+ :type ipv4: List[Union[VPCIPv4RangeOptions, Dict[str, Any]]]
5659
5760 :returns: The new VPC object.
5861 :rtype: VPC
@@ -61,6 +64,7 @@ def create(
6164 "label" : label ,
6265 "region" : region .id if isinstance (region , Region ) else region ,
6366 "description" : description ,
67+ "ipv4" : ipv4 ,
6468 "ipv6" : ipv6 ,
6569 "subnets" : subnets ,
6670 }
@@ -108,3 +112,15 @@ def ips(self, *filters) -> PaginatedList:
108112 return self .client ._get_and_filter (
109113 VPCIPAddress , * filters , endpoint = "/vpcs/ips"
110114 )
115+
116+ def default_ranges (self ) -> VPCIPv4DefaultRange :
117+ """
118+ Retrieve the default settings for the internal and forbidden IPv4 address ranges in VPCs.
119+
120+ API Documentation: TODO
121+
122+ :returns: The default IPv4 ranges for VPCs.
123+ :rtype: VPCIPv4DefaultRange
124+ """
125+ result = self .client .get ("/vpcs/default-ranges" )
126+ return VPCIPv4DefaultRange .from_json (result )
0 commit comments