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);
}
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);
}
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);
}
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);
}
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;
}
Aggregations