class AwsS3ConfigurationReader {

    public static AwsS3AuthConfiguration from(Configuration configuration) {
        String endpoint = configuration.getString(OBJECTSTORAGE_ENDPOINT);
        if (StringUtils.isEmpty(endpoint)) {
            throw new NullPointerException("'endpoint' is mandatory");
        }

        return AwsS3AuthConfiguration.builder()
                .endpoint(URI.create(endpoint))
                .accessKeyId(configuration.getString(OBJECTSTORAGE_ACCESKEYID))
                .secretKey(configuration.getString(OBJECTSTORAGE_SECRETKEY))
                .build();
    }

}