class StackRequestManifester {

    void addAzureIdbrokerMsiToTelemetry(Map<String, Object> fluentAttributes, StackV4Request stackRequest) {
        if (stackRequest.getCluster() != null && stackRequest.getCluster().getCloudStorage() != null
                && stackRequest.getCluster().getCloudStorage().getIdentities() != null) {
            List<StorageIdentityBase> identities = stackRequest.getCluster().getCloudStorage().getIdentities();
            for (StorageIdentityBase identity : identities) {
                if (CloudIdentityType.ID_BROKER.equals(identity.getType()) && identity.getAdlsGen2() != null) {
                    if (!fluentAttributes.containsKey(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI)) {
                        String idBrokerInstanceMsi = identity.getAdlsGen2().getManagedIdentity();
                        LOGGER.info("Setting idbroker instance msi for telemetry: {}", idBrokerInstanceMsi);
                        fluentAttributes.put(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI, idBrokerInstanceMsi);
                    }
                }
            }
        }
    }

}