Search in sources :

Example 26 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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 27 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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 28 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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 29 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse 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 30 with TelemetryResponse

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

the class StackToStackV4ResponseConverterTest method testConvertWithoutCluster.

@Test
public void testConvertWithoutCluster() throws CloudbreakImageNotFoundException {
    Stack source = getSource();
    // GIVEN
    getSource().setCluster(null);
    given(imageService.getImage(source.getId())).willReturn(mock(Image.class));
    given(imageToStackImageV4ResponseConverter.convert(any())).willReturn(new StackImageV4Response());
    given(stackToCustomDomainsSettingsV4Response.convert(any())).willReturn(new CustomDomainSettingsV4Response());
    given(stackAuthenticationToStackAuthenticationV4ResponseConverter.convert(any())).willReturn(new StackAuthenticationV4Response());
    given(networkToNetworkV4ResponseConverter.convert(any())).willReturn(new NetworkV4Response());
    given(workspaceToWorkspaceResourceV4ResponseConverter.convert(any())).willReturn(new WorkspaceResourceV4Response());
    given(cloudbreakDetailsToCloudbreakDetailsV4ResponseConverter.convert(any())).willReturn(new CloudbreakDetailsV4Response());
    given(stackToPlacementSettingsV4ResponseConverter.convert(any())).willReturn(new PlacementSettingsV4Response());
    given(telemetryConverter.convert(any())).willReturn(new TelemetryResponse());
    given(instanceGroupToInstanceGroupV4ResponseConverter.convert(any())).willReturn(new InstanceGroupV4Response());
    given(databaseAvailabilityTypeToDatabaseResponseConverter.convert(any(), any())).willReturn(new DatabaseResponse());
    // WHEN
    StackV4Response result = underTest.convert(source);
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("cluster", "gcp", "mock", "openstack", "aws", "yarn", "azure", "telemetry", "environmentName", "credentialName", "credentialCrn", "telemetry", "flowIdentifier", "loadBalancers"));
    assertNull(result.getCluster());
    verify(restRequestThreadLocalService).setWorkspace(source.getWorkspace());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) DatabaseResponse(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.database.DatabaseResponse) CustomDomainSettingsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.customdomain.CustomDomainSettingsV4Response) StackImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response) Image(com.sequenceiq.cloudbreak.cloud.model.Image) WorkspaceResourceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.workspace.responses.WorkspaceResourceV4Response) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) StackAuthenticationV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.authentication.StackAuthenticationV4Response) NetworkV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.network.NetworkV4Response) CloudbreakDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.CloudbreakDetailsV4Response) InstanceGroupV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response) PlacementSettingsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.PlacementSettingsV4Response) AbstractEntityConverterTest(com.sequenceiq.cloudbreak.converter.AbstractEntityConverterTest) Test(org.junit.Test)

Aggregations

TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)45 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)17 Test (org.junit.jupiter.api.Test)17 Test (org.junit.Test)16 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)14 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)10 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)10 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)9 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)8 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)8 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)8 ArrayList (java.util.ArrayList)8 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)7 CloudIdentityType (com.sequenceiq.common.model.CloudIdentityType)7 CloudStorageCdpService (com.sequenceiq.common.model.CloudStorageCdpService)7 FileSystemType (com.sequenceiq.common.model.FileSystemType)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