use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithDisabledMonitoringFeatureWithCdpSaas.
@Test
public void testConvertWithDisabledMonitoringFeatureWithCdpSaas() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
FeaturesRequest featuresRequest = new FeaturesRequest();
featuresRequest.addMonitoring(false);
telemetryRequest.setFeatures(featuresRequest);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertFalse(result.getFeatures().getMonitoring().isEnabled());
assertNotNull(result.getMonitoring().getRemoteWriteUrl());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertWithWADisabled.
@Test
public void testConvertWithWADisabled() {
// GIVEN
TelemetryRequest telemetryRequest = new TelemetryRequest();
FeaturesRequest fr = new FeaturesRequest();
fr.addWorkloadAnalytics(false);
telemetryRequest.setFeatures(fr);
// WHEN
EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
// THEN
assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class TelemetryApiConverterTest method testConvertToRequestWithFeatures.
@Test
public void testConvertToRequestWithFeatures() {
// GIVEN
EnvironmentLogging logging = new EnvironmentLogging();
S3CloudStorageParameters s3Params = new S3CloudStorageParameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
EnvironmentFeatures features = new EnvironmentFeatures();
features.addClusterLogsCollection(false);
features.addMonitoring(true);
EnvironmentTelemetry telemetry = new EnvironmentTelemetry();
telemetry.setLogging(logging);
telemetry.setFeatures(features);
// WHEN
TelemetryRequest result = underTest.convertToRequest(telemetry);
// THEN
assertNotNull(result.getFeatures());
assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
assertTrue(result.getFeatures().getMonitoring().isEnabled());
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class CloudStorageValidator method validateCloudStorage.
public ObjectStorageValidateResponse validateCloudStorage(String accountId, EnvironmentCloudStorageValidationRequest environmentCloudStorageValidationRequest) {
Credential credential = credentialService.getByCrnForAccountId(environmentCloudStorageValidationRequest.getCredentialCrn(), accountId, ENVIRONMENT, false);
String attributes = credential.getAttributes();
CloudCredential cloudCredential = new CloudCredential(credential.getResourceCrn(), credential.getName(), new Json(attributes).getMap(), credential.getAccountId(), credential.isVerifyPermissions());
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
TelemetryRequest telemetryRequest = environmentCloudStorageValidationRequest.getTelemetry();
boolean loggingConfigured = isLoggingConfigured(telemetryRequest);
if (loggingConfigured) {
LOGGER.debug("Cloud storage logging is enabled.");
addLogIdentity(cloudStorageRequest, telemetryRequest);
}
ObjectStorageValidateRequest.Builder objectStorageValidateBuilder = ObjectStorageValidateRequest.builder().withCloudPlatform(credential.getCloudPlatform()).withCredential(cloudCredential).withCloudStorageRequest(cloudStorageRequest);
if (loggingConfigured) {
objectStorageValidateBuilder.withLogsLocationBase(telemetryRequest.getLogging().getStorageLocation());
}
if (environmentCloudStorageValidationRequest.getBackup() != null) {
objectStorageValidateBuilder.withBackupLocationBase(environmentCloudStorageValidationRequest.getBackup().getStorageLocation());
}
ObjectStorageValidateRequest objectStorageValidateRequest = objectStorageValidateBuilder.build();
return ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> cloudProviderServicesV4Endpoint.validateObjectStorage(objectStorageValidateRequest));
}
use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest in project cloudbreak by hortonworks.
the class FreeIpaCreationHandler method setTelemetry.
private void setTelemetry(EnvironmentDto environmentDto, CreateFreeIpaRequest createFreeIpaRequest) {
TelemetryRequest telemetryRequest = telemetryApiConverter.convertToRequest(environmentDto.getTelemetry());
createFreeIpaRequest.setTelemetry(telemetryRequest);
}
Aggregations