Search in sources :

Example 16 with TelemetryRequest

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());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) Features(com.sequenceiq.common.api.telemetry.model.Features) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 17 with TelemetryRequest

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());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) Features(com.sequenceiq.common.api.telemetry.model.Features) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 18 with TelemetryRequest

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());
}
Also used : EnvironmentLogging(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentLogging) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageParameters(com.sequenceiq.environment.environment.dto.telemetry.S3CloudStorageParameters) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) Test(org.junit.jupiter.api.Test)

Example 19 with TelemetryRequest

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));
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) Json(com.sequenceiq.cloudbreak.common.json.Json) ObjectStorageValidateRequest(com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateRequest)

Example 20 with TelemetryRequest

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);
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest)

Aggregations

TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)47 Test (org.junit.Test)19 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)15 Test (org.junit.jupiter.api.Test)15 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)13 Features (com.sequenceiq.common.api.telemetry.model.Features)10 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)10 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)9 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)9 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)9 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)7 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)6 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)6 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)4 WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)3 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)3 AltusDatabusConfiguration (com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration)2 ObjectStorageValidateRequest (com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateRequest)2 ObjectStorageValidateResponse (com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateResponse)2 Json (com.sequenceiq.cloudbreak.common.json.Json)2