use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenCloudStorageLocationsIsEmptyAndEnvironmentHasTelemetryWithLogging.
@Test
void testConvertWhenCloudStorageLocationsIsEmptyAndEnvironmentHasTelemetryWithLogging() {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
environment.setTelemetry(telemetry);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, null, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
assertTrue(result.getLocations().isEmpty());
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class CloudStorageDecoratorTest method testConvertWhenEnvironmentHaveTelemetryAndStorageLocationsIsNotNullOrEmpty.
@Test
void testConvertWhenEnvironmentHaveTelemetryAndStorageLocationsIsNotNullOrEmpty() {
TelemetryResponse telemetry = new TelemetryResponse();
telemetry.setLogging(new LoggingResponse());
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
environment.setTelemetry(telemetry);
CloudStorageCdpService eStorageLocationType = CloudStorageCdpService.RANGER_AUDIT;
String eStorageLocationValue = "MYBUCKET/CONTAINER";
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(eStorageLocationType);
storageLocationBase.setValue(eStorageLocationValue);
List<StorageLocationBase> storageLocations = List.of(storageLocationBase);
CloudStorageRequest request = new CloudStorageRequest();
request.setLocations(storageLocations);
CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
assertNotNull(result);
assertTrue(result.getIdentities().stream().anyMatch(id -> CloudIdentityType.LOG.equals(id.getType())));
assertTrue(result.getLocations().stream().anyMatch(loc -> eStorageLocationType.equals(loc.getType()) && eStorageLocationValue.equals(loc.getValue())));
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class TelemetryConverter method createLoggingRequestFromResponse.
private LoggingRequest createLoggingRequestFromResponse(TelemetryResponse response) {
LoggingRequest loggingRequest = null;
if (response.getLogging() != null) {
LOGGER.debug("Setting logging response (telemetry) based on environment response");
LoggingResponse loggingResponse = response.getLogging();
loggingRequest = new LoggingRequest();
loggingRequest.setStorageLocation(loggingResponse.getStorageLocation());
loggingRequest.setS3(loggingResponse.getS3());
loggingRequest.setAdlsGen2(loggingResponse.getAdlsGen2());
loggingRequest.setGcs(loggingResponse.getGcs());
loggingRequest.setCloudwatch(loggingResponse.getCloudwatch());
}
return loggingRequest;
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class TelemetryConverter method createLoggingResponseFromSource.
private LoggingResponse createLoggingResponseFromSource(Telemetry telemetry) {
LoggingResponse loggingResponse = null;
if (telemetry.getLogging() != null) {
LOGGER.debug("Setting logging telemetry settings (response).");
Logging logging = telemetry.getLogging();
loggingResponse = new LoggingResponse();
loggingResponse.setStorageLocation(logging.getStorageLocation());
loggingResponse.setS3(logging.getS3());
loggingResponse.setAdlsGen2(logging.getAdlsGen2());
loggingResponse.setGcs(logging.getGcs());
loggingResponse.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
}
return loggingResponse;
}
use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.
the class TelemetryConverter method convert.
public TelemetryResponse convert(Telemetry telemetry) {
TelemetryResponse response = null;
if (telemetry != null) {
LoggingResponse loggingResponse = createLoggingResponseFromSource(telemetry);
MonitoringResponse monitoringResponse = createMonitoringResponseFromSource(telemetry);
WorkloadAnalyticsResponse waResponse = createWorkloadAnalyticsResponseFromSource(telemetry);
response = new TelemetryResponse();
response.setLogging(loggingResponse);
response.setMonitoring(monitoringResponse);
response.setWorkloadAnalytics(waResponse);
response.setFluentAttributes(telemetry.getFluentAttributes());
response.setRules(telemetry.getRules());
createFeaturesResponseFromSource(response, telemetry.getFeatures());
}
return response;
}
Aggregations