Search in sources :

Example 36 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.

the class StackToCloudStackConverterTest method testBuildFileSystemViewSameGCPEmail.

@Test
public void testBuildFileSystemViewSameGCPEmail() throws Exception {
    Telemetry telemetry = mock(Telemetry.class);
    Backup backup = mock(Backup.class);
    Logging logging = mock(Logging.class);
    GcsCloudStorageV1Parameters gcsLogging = new GcsCloudStorageV1Parameters();
    gcsLogging.setServiceAccountEmail("myaccount@myprojectid.iam.gserviceaccount.com");
    GcsCloudStorageV1Parameters gcsBackup = new GcsCloudStorageV1Parameters();
    gcsBackup.setServiceAccountEmail("myaccount@myprojectid.iam.gserviceaccount.com");
    when(stack.getTelemetry()).thenReturn(telemetry);
    when(telemetry.getLogging()).thenReturn(logging);
    when(stack.getBackup()).thenReturn(backup);
    when(backup.getGcs()).thenReturn(gcsBackup);
    when(logging.getGcs()).thenReturn(gcsLogging);
    Optional<CloudFileSystemView> fileSystemView = underTest.buildFileSystemView(stack);
    assertEquals(Optional.empty(), fileSystemView);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) Backup(com.sequenceiq.freeipa.api.model.Backup) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.Test)

Example 37 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging 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));
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.jupiter.api.Test)

Example 38 with Logging

use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.

the class TelemetryConverter method createLoggingFromRequest.

private Logging createLoggingFromRequest(LoggingRequest loggingRequest) {
    Logging logging = null;
    if (loggingRequest != null) {
        logging = new Logging();
        logging.setStorageLocation(loggingRequest.getStorageLocation());
        if (loggingRequest.getS3() != null) {
            S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
            s3Params.setInstanceProfile(loggingRequest.getS3().getInstanceProfile());
            logging.setS3(s3Params);
        } else if (loggingRequest.getAdlsGen2() != null) {
            AdlsGen2CloudStorageV1Parameters adlsGen2Params = new AdlsGen2CloudStorageV1Parameters();
            AdlsGen2CloudStorageV1Parameters adlsGen2FromRequest = loggingRequest.getAdlsGen2();
            adlsGen2Params.setAccountKey(adlsGen2FromRequest.getAccountKey());
            adlsGen2Params.setAccountName(adlsGen2FromRequest.getAccountName());
            adlsGen2Params.setSecure(adlsGen2FromRequest.isSecure());
            adlsGen2Params.setManagedIdentity(adlsGen2FromRequest.getManagedIdentity());
            logging.setAdlsGen2(adlsGen2Params);
        } else if (loggingRequest.getGcs() != null) {
            GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
            gcsCloudStorageV1Parameters.setServiceAccountEmail(loggingRequest.getGcs().getServiceAccountEmail());
            logging.setGcs(gcsCloudStorageV1Parameters);
        } else if (loggingRequest.getCloudwatch() != null) {
            logging.setCloudwatch(CloudwatchParams.copy(loggingRequest.getCloudwatch()));
        }
    }
    return logging;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)

Aggregations

Logging (com.sequenceiq.common.api.telemetry.model.Logging)38 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)30 Test (org.junit.Test)21 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)15 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)10 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)7 Backup (com.sequenceiq.freeipa.api.model.Backup)7 Test (org.junit.jupiter.api.Test)7 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)4 Features (com.sequenceiq.common.api.telemetry.model.Features)4 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)4 CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)3 Monitoring (com.sequenceiq.common.api.telemetry.model.Monitoring)3 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)3 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)2 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)2 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1