Skip to main content

isIPv4

isIPv4(address: IpAddress) : Bool

Tests whether the specified IpAddress is an IPv4 address. For example, isIPv4(ipAddress("1.2.3.4")) returns true and isIPv4(ipAddress("2001:0db8:85a3:0000:0000:8a2e:0370:7334") returns false.

This function will raise an error if address is absent.

isIPv4(subnet: IpSubnet) : Bool

Tests whether the specified IpSubnet is an IPv4 subnet. For example, isIPv4(ipSubnet("192.168.1.0/24")) returns true and isIPv4(ipSubnet("2001:0db8:abcd:0000::/56")) returns false.

This function will raise an error if subnet is absent.

An example usage would be the following query that gets all used IPv4 VPC subnets:

getVpcIPv4Subnets =
foreach cloudAccount in network.cloudAccounts
foreach vpc in cloudAccount
foreach subnet in vpc.subnets
foreach address in subnet.addresses
where isIPv4(address)
select address;

See also

Types

Functions