Search in sources :

Example 21 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class TelemetryApiConverter method convertGcs.

private GcsCloudStorageV1Parameters convertGcs(GcsCloudStorageV1Parameters gcs) {
    GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = null;
    if (gcs != null) {
        gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
        gcsCloudStorageV1Parameters.setServiceAccountEmail(gcs.getServiceAccountEmail());
    }
    return gcsCloudStorageV1Parameters;
}
Also used : GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)

Example 22 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class CloudBackupFolderResolverServiceTest method testUpdateStorageLocationGcs.

@Test
public void testUpdateStorageLocationGcs() {
    // GIVEN
    Backup backup = createBackup();
    backup.setS3(null);
    backup.setGcs(new GcsCloudStorageV1Parameters());
    backup.setStorageLocation("gs://mybucket");
    // WHEN
    underTest.updateStorageLocation(backup, FluentClusterType.FREEIPA.value(), "mycluster", "crn:cdp:cloudbreak:us-west-1:someone:stack:12345");
    // THEN
    assertEquals("gs://mybucket/cluster-backups/freeipa/mycluster_12345", backup.getStorageLocation());
}
Also used : Backup(com.sequenceiq.freeipa.api.model.Backup) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.Test)

Example 23 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class StackToCloudStackConverterTest method testBuildFileSystemViewDifferentGCPEmail.

@Test
public void testBuildFileSystemViewDifferentGCPEmail() throws Exception {
    Telemetry telemetry = mock(Telemetry.class);
    Backup backup = mock(Backup.class);
    Logging logging = mock(Logging.class);
    GcsCloudStorageV1Parameters gcsLogging = new GcsCloudStorageV1Parameters();
    gcsLogging.setServiceAccountEmail("myaccount1@myprojectid.iam.gserviceaccount.com");
    GcsCloudStorageV1Parameters gcsBackup = new GcsCloudStorageV1Parameters();
    gcsBackup.setServiceAccountEmail("myaccount2@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);
    expectedException.expect(BadRequestException.class);
    underTest.buildFileSystemView(stack);
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) Backup(com.sequenceiq.freeipa.api.model.Backup) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.Test)

Example 24 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters 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 25 with GcsCloudStorageV1Parameters

use of com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters in project cloudbreak by hortonworks.

the class TelemetryConverterTest method testConvertFromRequestForGCS.

@Test
public void testConvertFromRequestForGCS() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    LoggingRequest logging = new LoggingRequest();
    GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
    gcsCloudStorageV1Parameters.setServiceAccountEmail(EMAIL);
    logging.setGcs(gcsCloudStorageV1Parameters);
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addClusterLogsCollection(false);
    telemetryRequest.setLogging(logging);
    telemetryRequest.setFeatures(featuresRequest);
    // WHEN
    Telemetry result = underTest.convert(telemetryRequest);
    // THEN
    assertThat(result.getFeatures().getWorkloadAnalytics(), nullValue());
    assertThat(result.getFeatures().getClusterLogsCollection().isEnabled(), is(false));
    assertThat(result.getDatabusEndpoint(), is(DATABUS_ENDPOINT));
    assertThat(result.getLogging().getGcs(), notNullValue());
    assertThat(result.getLogging().getGcs().getServiceAccountEmail(), is(EMAIL));
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Aggregations

GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)31 Test (org.junit.jupiter.api.Test)12 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)10 Logging (com.sequenceiq.common.api.telemetry.model.Logging)7 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)7 Test (org.junit.Test)7 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)6 SdxCloudStorageRequest (com.sequenceiq.sdx.api.model.SdxCloudStorageRequest)4 ValidationResult (com.sequenceiq.cloudbreak.validation.ValidationResult)3 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)3 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)3 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)3 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)3 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)3 Backup (com.sequenceiq.freeipa.api.model.Backup)3 FileSystemV4Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.FileSystemV4Endpoint)2 FileSystemParameterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Response)2 FileSystemParameterV4Responses (com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Responses)2 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)2 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)2