Search in sources :

Example 11 with StorageIdentityBase

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

the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenAdlsGen2NotNull.

@Test
public void testIsCloudStorageConfiguredWhenAdlsGen2NotNull() {
    CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters());
    cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
    cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
    boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
    Assert.assertTrue(actual);
}
Also used : CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.Test)

Example 12 with StorageIdentityBase

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

the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenWasbNotNull.

@Test
public void testIsCloudStorageConfiguredWhenWasbNotNull() {
    CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setWasb(new WasbCloudStorageV1Parameters());
    cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
    cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
    boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
    Assert.assertTrue(actual);
}
Also used : CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) WasbCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.Test)

Example 13 with StorageIdentityBase

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

the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenAdlsNotNull.

@Test
public void testIsCloudStorageConfiguredWhenAdlsNotNull() {
    CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setAdls(new AdlsCloudStorageV1Parameters());
    cloudStorageRequest.setIdentities(List.of(storageIdentityBase));
    cloudStorageRequest.setLocations(List.of(new StorageLocationBase()));
    boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest);
    Assert.assertTrue(actual);
}
Also used : CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) AdlsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.Test)

Example 14 with StorageIdentityBase

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

the class CloudStorageValidator method addLogIdentity.

private void addLogIdentity(CloudStorageRequest cloudStorageRequest, TelemetryRequest telemetryRequest) {
    StorageIdentityBase log = new StorageIdentityBase();
    log.setType(CloudIdentityType.LOG);
    LoggingRequest logging = telemetryRequest.getLogging();
    if (logging.getS3() != null) {
        log.setS3(logging.getS3());
    } else if (logging.getAdlsGen2() != null) {
        log.setAdlsGen2(logging.getAdlsGen2());
    } else if (logging.getGcs() != null) {
        log.setGcs(logging.getGcs());
    } else if (logging.getCloudwatch() != null) {
        LOGGER.debug("Cloudwatch will act as s3 storage identity!");
        S3CloudStorageV1Parameters s3CloudwatchParams = new S3CloudStorageV1Parameters();
        s3CloudwatchParams.setInstanceProfile(logging.getCloudwatch().getInstanceProfile());
        log.setS3(s3CloudwatchParams);
    }
    cloudStorageRequest.getIdentities().add(log);
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Example 15 with StorageIdentityBase

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

the class CloudStorageConverter method cloudIdentityToStorageIdentityBase.

private StorageIdentityBase cloudIdentityToStorageIdentityBase(CloudIdentity cloudIdentity) {
    StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
    storageIdentityBase.setType(cloudIdentity.getIdentityType());
    if (cloudIdentity.getWasbIdentity() != null) {
        WasbCloudStorageV1Parameters parameters = wasbIdentityToParameters(cloudIdentity.getWasbIdentity());
        storageIdentityBase.setWasb(parameters);
    } else if (cloudIdentity.getS3Identity() != null) {
        S3CloudStorageV1Parameters parameters = s3IdentityToParameters(cloudIdentity.getS3Identity());
        storageIdentityBase.setS3(parameters);
    } else if (cloudIdentity.getAdlsGen2Identity() != null) {
        AdlsGen2CloudStorageV1Parameters adlsGen2CloudStorageV1Parameters = adlsGen2IdentityToParameters(cloudIdentity.getAdlsGen2Identity());
        storageIdentityBase.setAdlsGen2(adlsGen2CloudStorageV1Parameters);
    } else if (cloudIdentity.getGcsIdentity() != null) {
        GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = gcsIdentityToParameters(cloudIdentity.getGcsIdentity());
        storageIdentityBase.setGcs(gcsCloudStorageV1Parameters);
    }
    return storageIdentityBase;
}
Also used : S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) WasbCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)

Aggregations

StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)22 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)10 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)9 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)8 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)6 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)5 Test (org.junit.Test)5 Test (org.junit.jupiter.api.Test)5 WasbCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.WasbCloudStorageV1Parameters)4 ArrayList (java.util.ArrayList)4 FileSystemType (com.sequenceiq.common.model.FileSystemType)3 ConstraintViolation (javax.validation.ConstraintViolation)3 SpiFileSystem (com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem)2 CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)2 CloudStorage (com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage)2 AwsStorageParameters (com.sequenceiq.common.api.cloudstorage.AwsStorageParameters)2 CloudStorageResponse (com.sequenceiq.common.api.cloudstorage.CloudStorageResponse)2 S3Guard (com.sequenceiq.common.api.cloudstorage.S3Guard)2 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1