class X509CertRequest {

    boolean validateInstanceCnames(final String provider, final DataCache athenzSysDomainCache,
            final String serviceFqn, final String instanceHostname, List<String> instanceHostCnames, HostnameResolver hostnameResolver) {

        // if we have no cname list provided then nothing to check

        if (instanceHostCnames == null || instanceHostCnames.isEmpty()) {
            return true;
        }

        // with a valid cname, we must have an instance hostname provided

        if (instanceHostname == null || instanceHostname.isEmpty()) {
             LOGGER.error("Instance Host CNAME list provided without Hostname");
             return false;
        }

        // verify that all the cnames are valid hostnames and the provider
        // is authorized to request them

        for (String cname : instanceHostCnames) {
            if (!isHostnameAllowed(provider, athenzSysDomainCache, cname)) {
                return false;
            }
        }

        // we must also have a resolver present and configured

        if (hostnameResolver != null) {
            if (!hostnameResolver.isValidHostCnameList(serviceFqn, instanceHostname, instanceHostCnames, CertType.X509)) {
                LOGGER.error("{} does not have all hosts in {} as configured CNAMEs", instanceHostname,
                        String.join(",", instanceHostCnames));
                return false;
            }

            return true;
        }

        LOGGER.error("Instance host name CNAME list provided without a valid hostname resolver");
        return false;
    }

    public  X509CertRequest(String csr);

}