Search in sources :

Example 1 with GcsCloudStorageV1Parameters

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

the class StorageIdentityValidatorTest method testCloudStorageValidationWithMoreThanOneStorageParameter.

@Test
void testCloudStorageValidationWithMoreThanOneStorageParameter() {
    StorageIdentityBase storage = new StorageIdentityBase();
    storage.setType(CloudIdentityType.LOG);
    S3CloudStorageV1Parameters s3 = new S3CloudStorageV1Parameters();
    s3.setInstanceProfile("instace::profile");
    storage.setS3(s3);
    GcsCloudStorageV1Parameters gcs = new GcsCloudStorageV1Parameters();
    gcs.setServiceAccountEmail("service.account@googlecloud.com");
    storage.setGcs(gcs);
    Set<ConstraintViolation<StorageIdentityBase>> constraintViolations = validator.validate(storage);
    assertEquals(1, constraintViolations.size());
    ConstraintViolation<StorageIdentityBase> violation = constraintViolations.iterator().next();
    assertEquals(ValidCloudStorage.MESSAGE, violation.getMessage());
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) ConstraintViolation(javax.validation.ConstraintViolation) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) Test(org.junit.jupiter.api.Test)

Example 2 with GcsCloudStorageV1Parameters

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

the class EnvironmentBackupStorageConfigurationValidatorTest method validateBackupStorageConfigGcpWhenConfigValidationFailed.

@Test
public void validateBackupStorageConfigGcpWhenConfigValidationFailed() {
    when(environment.getCloudPlatform()).thenReturn(CloudConstants.GCP);
    when(environment.getBackup()).thenReturn(backup);
    GcsCloudStorageV1Parameters gcp = new GcsCloudStorageV1Parameters();
    gcp.setServiceAccountEmail("admin1@dev-cdp.iam.gservice-account.com");
    when(backup.getGcs()).thenReturn(gcp);
    ValidationResult result = underTest.validateBackupStorageConfiguration(environment);
    assertTrue(result.hasError());
}
Also used : ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) Test(org.junit.jupiter.api.Test)

Example 3 with GcsCloudStorageV1Parameters

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

the class BackupConverter 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 4 with GcsCloudStorageV1Parameters

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

the class GcpCloudProvider method loggingRequest.

@Override
public LoggingRequest loggingRequest(TelemetryTestDto dto) {
    GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
    gcsCloudStorageV1Parameters.setServiceAccountEmail(getServiceAccountEmail());
    LoggingRequest loggingRequest = new LoggingRequest();
    loggingRequest.setGcs(gcsCloudStorageV1Parameters);
    loggingRequest.setStorageLocation(getBaseLocation());
    return loggingRequest;
}
Also used : LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)

Example 5 with GcsCloudStorageV1Parameters

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

the class StorageValidationServiceTest method whenGcsConfiguredWithServiceAccountShouldNotThrowException.

@Test
public void whenGcsConfiguredWithServiceAccountShouldNotThrowException() {
    SdxCloudStorageRequest cloudStorageRequest = new SdxCloudStorageRequest();
    cloudStorageRequest.setBaseLocation("gs://example-path");
    cloudStorageRequest.setFileSystemType(FileSystemType.GCS);
    GcsCloudStorageV1Parameters gcs = new GcsCloudStorageV1Parameters();
    gcs.setServiceAccountEmail("mail");
    cloudStorageRequest.setGcs(gcs);
    underTest.validateCloudStorage("GCP", cloudStorageRequest);
}
Also used : SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) 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