class AzureIDBrokerObjectStorageValidator {

    public ValidationResult validateObjectStorage(AzureClient client,
            SpiFileSystem spiFileSystem,
            ValidationResultBuilder resultBuilder) {
        LOGGER.info("Validating Azure identities...");
        List<CloudFileSystemView> cloudFileSystems = spiFileSystem.getCloudFileSystems();
        if (Objects.nonNull(cloudFileSystems) && cloudFileSystems.size() > 0) {
            PagedList<RoleAssignmentInner> roleAssignments = client.listRoleAssignments();
            for (CloudFileSystemView cloudFileSystemView : cloudFileSystems) {
                CloudAdlsGen2View cloudFileSystem = (CloudAdlsGen2View) cloudFileSystemView;
                String managedIdentityId = cloudFileSystem.getManagedIdentity();
                Identity identity = client.getIdentityById(managedIdentityId);

                if (identity != null) {
                    CloudIdentityType cloudIdentityType = cloudFileSystem.getCloudIdentityType();
                    if (CloudIdentityType.ID_BROKER.equals(cloudIdentityType)) {
                        validateIDBroker(client, roleAssignments, identity, cloudFileSystem, resultBuilder);
                    } else if (CloudIdentityType.LOG.equals(cloudIdentityType)) {
                        validateLog(client, roleAssignments, identity, cloudFileSystem, resultBuilder);
                    }
                } else {
                    addError(resultBuilder, String.format("Identity with id %s does not exist in the given Azure subscription.", managedIdentityId));
                }
            }
        }
        return resultBuilder.build();
    }

}