class DatabusConfigService {

    public DatabusConfigView createDatabusConfigs(String accessKeyId,
            char[] accessKeySecret, String secretAlgorithm, String endpoint) {
        final DatabusConfigView.Builder builder = new DatabusConfigView.Builder();
        boolean validAccessKeySecret = accessKeySecret != null && StringUtils.isNotEmpty(new String(accessKeySecret));
        boolean enableDbus = validAccessKeySecret && StringUtils.isNoneEmpty(endpoint, new String(accessKeySecret));
        if (enableDbus) {
            builder.withEndpoint(endpoint)
                    .withAccessKeyId(accessKeyId)
                    .withAccessKeySecret(accessKeySecret)
                    .withAccessKeySecretAlgorithm(secretAlgorithm);
        } else {
            LOGGER.debug("Although metering or cluster deployment log reporting is enabled, databus "
                            + "credentials/endpoint is not provided properly. endpoint: {}, accessKey: {}, privateKey: {}",
                    endpoint, accessKeyId, validAccessKeySecret ? "*****" : "<empty>");
        }
        return builder
                .withEnabled(enableDbus)
                .build();
    }

}