class CerberusMetadataLookup {

    public ArrayList<Map<String, String>> getCerberusMetadata(String environment) {

        String cerberusUrl = String.format("https://%s.cerberus.nikecloud.com", environment);
        OkHttpClient httpClient = createHttpClient();
        String region = EnvUtils.getRequiredEnv("REGION");
        DefaultCerberusCredentialsProviderChain chain = new DefaultCerberusCredentialsProviderChain(cerberusUrl, region);

        ArrayList<Map<String, String>> sdbMetadata = new ArrayList<>();
        String offset = "0";
        Boolean hasNext;

        do {
            HashMap result = executeRequest(httpClient, chain, cerberusUrl, offset);
            sdbMetadata.addAll((ArrayList<Map<String, String>>) result.get("safe_deposit_box_metadata"));

            offset = result.get("next_offset").toString();
            hasNext = Boolean.valueOf(result.get("has_next").toString());

        } while (hasNext);

        if (sdbMetadata.isEmpty()) {
            throw new NullPointerException("SDB Metadata is empty");
        }
        return sdbMetadata;
    }

}