class CloudStorageValidator {

    public void validate(CloudStorageRequest cloudStorageRequest, DetailedEnvironmentResponse environment,
            ValidationResult.ValidationResultBuilder validationResultBuilder) {
        if (CloudStorageValidation.DISABLED.equals(environment.getCloudStorageValidation())) {
            LOGGER.info("Due to cloud storage validation not being enabled, not validating cloudStorageRequest: {}",
                    JsonUtil.writeValueAsStringSilent(cloudStorageRequest));
            return;
        }

        String accountId = ThreadBasedUserCrnProvider.getAccountId();
        if (!entitlementService.cloudStorageValidationEnabled(INTERNAL_ACTOR_CRN, accountId)) {
            LOGGER.info("Cloud storage validation entitlement is missing, not validating cloudStorageRequest: {}",
                    JsonUtil.writeValueAsStringSilent(cloudStorageRequest));
            return;
        }

        LOGGER.info("Validating cloudStorageRequest: {}", JsonUtil.writeValueAsStringSilent(cloudStorageRequest));
        if (cloudStorageRequest != null) {
            Credential credential = getCredential(environment);
            CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential);

            ObjectStorageValidateRequest request = createObjectStorageValidateRequest(
                    environment.getCloudPlatform(), cloudCredential, cloudStorageRequest);
            ObjectStorageValidateResponse response = ThreadBasedUserCrnProvider.doAsInternalActor(() ->
                    cloudProviderServicesV4Endpoint.validateObjectStorage(request));

            LOGGER.info("ValidateObjectStorage: request: {}, response: {}", JsonUtil.writeValueAsStringSilent(request),
                    JsonUtil.writeValueAsStringSilent(response));

            if (ResponseStatus.ERROR.equals(response.getStatus())) {
                validationResultBuilder.error(response.getError());
                throw new BadRequestException(response.getError());
            }
        }
    }

    public  CloudStorageValidator(CredentialToCloudCredentialConverter credentialToCloudCredentialConverter,
            EntitlementService entitlementService, SecretService secretService,
            CloudProviderServicesV4Endopint cloudProviderServicesV4Endpoint);

}