Search in sources :

Example 11 with LoggingResponse

use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.

the class CloudStorageManifesterTest method whenCloudStorageEnabledFromInternalRequestWithLogging.

@Test
public void whenCloudStorageEnabledFromInternalRequestWithLogging() {
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    clusterV4Request.setBlueprintName(exampleBlueprintName);
    CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
    StorageLocationBase storageLocationBase = new StorageLocationBase();
    storageLocationBase.setType(CloudStorageCdpService.RANGER_AUDIT);
    storageLocationBase.setValue("s3a://ranger-audit");
    cloudStorageRequest.setLocations(List.of(storageLocationBase));
    clusterV4Request.setCloudStorage(cloudStorageRequest);
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setCloudPlatform("AWS");
    TelemetryResponse telemetryResponse = new TelemetryResponse();
    LoggingResponse loggingResponse = new LoggingResponse();
    S3CloudStorageV1Parameters s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
    s3CloudStorageV1Parameters.setInstanceProfile("logprofile");
    loggingResponse.setS3(s3CloudStorageV1Parameters);
    telemetryResponse.setLogging(loggingResponse);
    environment.setTelemetry(telemetryResponse);
    CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest());
    assertEquals(CloudStorageCdpService.RANGER_AUDIT, cloudStorageConfigReq.getLocations().get(0).getType());
    assertEquals(CloudIdentityType.LOG, cloudStorageConfigReq.getIdentities().get(0).getType());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.jupiter.api.Test)

Example 12 with LoggingResponse

use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.

the class CloudStorageValidationServiceTest method getEnvironment.

private DetailedEnvironmentResponse getEnvironment() {
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    TelemetryResponse telemetry = new TelemetryResponse();
    FeaturesResponse features = new FeaturesResponse();
    FeatureSetting featureSetting = new FeatureSetting();
    featureSetting.setEnabled(true);
    features.setCloudStorageLogging(featureSetting);
    telemetry.setFeatures(features);
    LoggingResponse logging = new LoggingResponse();
    logging.setS3(new S3CloudStorageV1Parameters());
    telemetry.setLogging(logging);
    environment.setTelemetry(telemetry);
    return environment;
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)

Example 13 with LoggingResponse

use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.

the class StackRequestManifester method prepareTelemetryForStack.

private void prepareTelemetryForStack(StackV4Request stackV4Request, DetailedEnvironmentResponse environment, SdxCluster sdxCluster) {
    TelemetryResponse envTelemetry = environment.getTelemetry();
    if (envTelemetry != null && envTelemetry.getLogging() != null) {
        TelemetryRequest telemetryRequest = new TelemetryRequest();
        LoggingRequest loggingRequest = new LoggingRequest();
        LoggingResponse envLogging = envTelemetry.getLogging();
        loggingRequest.setS3(envLogging.getS3());
        loggingRequest.setAdlsGen2(envLogging.getAdlsGen2());
        loggingRequest.setGcs(envLogging.getGcs());
        loggingRequest.setCloudwatch(envLogging.getCloudwatch());
        loggingRequest.setStorageLocation(envLogging.getStorageLocation());
        telemetryRequest.setLogging(loggingRequest);
        MonitoringRequest monitoringRequest = new MonitoringRequest();
        MonitoringResponse envMonitoring = envTelemetry.getMonitoring();
        if (envMonitoring != null) {
            monitoringRequest.setRemoteWriteUrl(envMonitoring.getRemoteWriteUrl());
        }
        telemetryRequest.setMonitoring(monitoringRequest);
        if (envTelemetry.getFeatures() != null) {
            FeaturesRequest featuresRequest = new FeaturesRequest();
            featuresRequest.setClusterLogsCollection(envTelemetry.getFeatures().getClusterLogsCollection());
            featuresRequest.setMonitoring(envTelemetry.getFeatures().getMonitoring());
            if (envTelemetry.getFeatures().getCloudStorageLogging() != null) {
                featuresRequest.setCloudStorageLogging(envTelemetry.getFeatures().getCloudStorageLogging());
            } else {
                featuresRequest.addCloudStorageLogging(true);
            }
            telemetryRequest.setFeatures(featuresRequest);
        }
        if (envTelemetry.getFluentAttributes() != null) {
            Map<String, Object> fluentAttributes = envTelemetry.getFluentAttributes();
            if (!fluentAttributes.containsKey(TelemetryClusterDetails.CLUSTER_CRN_KEY)) {
                fluentAttributes.put(TelemetryClusterDetails.CLUSTER_CRN_KEY, sdxCluster.getCrn());
            }
            addAzureIdbrokerMsiToTelemetry(fluentAttributes, stackV4Request);
            telemetryRequest.setFluentAttributes(fluentAttributes);
        }
        stackV4Request.setTelemetry(telemetryRequest);
    }
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 14 with LoggingResponse

use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.

the class EnvironmentClientServiceTest method testSdxLogLocationOnUpgradeRequestEnabled.

@Test
public void testSdxLogLocationOnUpgradeRequestEnabled() {
    LoggingResponse loggingResponse = new LoggingResponse();
    loggingResponse.setStorageLocation(LOG_LOCATION);
    TelemetryResponse telemetryResponse = new TelemetryResponse();
    telemetryResponse.setLogging(loggingResponse);
    DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
    environmentResponse.setCloudPlatform(CLOUD_PLATFORM);
    environmentResponse.setTelemetry(telemetryResponse);
    environmentResponse.setAzure(AzureEnvironmentParameters.builder().withAzureResourceGroup(AzureResourceGroup.builder().withResourceGroupUsage(ResourceGroupUsage.MULTIPLE).build()).build());
    when(environmentEndpoint.getByCrn(anyString())).thenReturn(environmentResponse);
    Assert.assertEquals(LOG_LOCATION, underTest.getBackupLocation(ENV_CRN));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Test(org.junit.Test)

Example 15 with LoggingResponse

use of com.sequenceiq.common.api.telemetry.response.LoggingResponse in project cloudbreak by hortonworks.

the class CloudStorageDecoratorTest method testConvertWhenIdentityIsSetToNull.

@Test
void testConvertWhenIdentityIsSetToNull() {
    CloudStorageRequest request = new CloudStorageRequest();
    request.setIdentities(null);
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    TelemetryResponse telemetry = new TelemetryResponse();
    telemetry.setLogging(new LoggingResponse());
    environment.setTelemetry(telemetry);
    CloudStorageRequest result = underTest.decorate(BLUEPRINT_NAME, CLUSTER_NAME, request, environment);
    assertNotNull(result);
    assertEquals(1, result.getIdentities().size());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Test(org.junit.jupiter.api.Test)

Aggregations

LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)22 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)17 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)12 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)10 Test (org.junit.jupiter.api.Test)10 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)9 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)8 CloudIdentityType (com.sequenceiq.common.model.CloudIdentityType)7 CloudStorageCdpService (com.sequenceiq.common.model.CloudStorageCdpService)7 FileSystemType (com.sequenceiq.common.model.FileSystemType)7 ArrayList (java.util.ArrayList)7 List (java.util.List)7 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)7 Assertions.assertNull (org.junit.jupiter.api.Assertions.assertNull)7 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)7 InjectMocks (org.mockito.InjectMocks)7 Mock (org.mockito.Mock)7 Mockito.when (org.mockito.Mockito.when)7 MockitoExtension (org.mockito.junit.jupiter.MockitoExtension)7 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)5