private static Optional<String> resolveOptional(String hostname, NameResolver resolver, RecordType recordType) {
            Set<String> values = resolver.resolve(hostname, recordType);
            return switch (values.size()) {
                case 0 -> Optional.empty();
                case 1 -> Optional.of(values.iterator().next());
                default -> throw new IllegalArgumentException("Hostname " + hostname + " resolved to more than one " + recordType.description() + ": " + values);
            };
        }
Allocate an IPv4 address. A successful allocation is guaranteed to have an IPv4 address.

@param ipAddress Unassigned IPv4 address
@param resolver DNS name resolver to use
@return An allocation containing 1 IPv4 address.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/IP.java