use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class StackToStackV4ResponseConverter method convertTelemetryComponent.
private void convertTelemetryComponent(StackV4Response response, Stack source) {
TelemetryResponse telemetryResponse = null;
try {
Telemetry telemetry = componentConfigProviderService.getTelemetry(source.getId());
telemetryResponse = telemetryConverter.convert(telemetry);
} catch (CloudbreakServiceException exc) {
LOGGER.debug(exc.getMessage());
}
response.setTelemetry(telemetryResponse);
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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;
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class EnvironmentClientService method getBackupLocation.
/**
* Get the backup location.
* @param envCrn Environemnt CRN.
* @return backuplocation configured for the environment, If not, returns the log location.
*/
public String getBackupLocation(String environmentCrn) {
DetailedEnvironmentResponse detailedEnvironmentResponse = getByCrn(environmentCrn);
BackupResponse backupResponse = detailedEnvironmentResponse.getBackup();
TelemetryResponse telemetryResponse = detailedEnvironmentResponse.getTelemetry();
if (backupResponse != null && backupResponse.getStorageLocation() != null) {
LOGGER.info("Using the backup location to store the datalake backup");
return backupResponse.getStorageLocation();
} else if (telemetryResponse != null && telemetryResponse.getLogging() != null) {
LOGGER.info("Backup location not configured. Using the log location to store the datalake backup");
return telemetryResponse.getLogging().getStorageLocation();
} else {
LOGGER.error("Could not identify the location to store the backup");
throw new BadRequestException("Backup Location is empty. Datalake backup is not triggered.");
}
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponseForGcs.
@Test
public void testConvertToResponseForGcs() {
Logging logging = new Logging();
GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
gcsCloudStorageV1Parameters.setServiceAccountEmail(EMAIL);
logging.setGcs(gcsCloudStorageV1Parameters);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertThat(result.getLogging().getGcs(), notNullValue());
assertThat(result.getLogging().getGcs().getServiceAccountEmail(), is(EMAIL));
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class StackToDescribeFreeIpaResponseConverter method decorateWithCloudStorageAndTelemetry.
private void decorateWithCloudStorageAndTelemetry(Stack stack, DescribeFreeIpaResponse response) {
TelemetryResponse telemetryResponse = telemetryConverter.convert(stack.getTelemetry());
if (telemetryResponse != null) {
response.setTelemetry(telemetryResponse);
if (telemetryResponse.getLogging() != null) {
CloudStorageResponse cloudStorageResponse = new CloudStorageResponse();
List<StorageIdentityBase> identities = new ArrayList<>();
StorageIdentityBase logIdentity = new StorageIdentityBase();
logIdentity.setType(CloudIdentityType.LOG);
identities.add(logIdentity);
cloudStorageResponse.setIdentities(identities);
response.setCloudStorage(cloudStorageResponse);
}
}
}
Aggregations