use of com.sequenceiq.common.api.cloudstorage.StorageIdentityBase in project cloudbreak by hortonworks.
the class CloudStorageConverter method requestToSpiFileSystem.
public SpiFileSystem requestToSpiFileSystem(CloudStorageBase cloudStorageRequest) {
List<CloudFileSystemView> cloudFileSystemViews = new ArrayList<>();
FileSystemType type = null;
if (cloudStorageRequest.getIdentities() != null && !cloudStorageRequest.getIdentities().isEmpty()) {
for (StorageIdentityBase storageIdentity : cloudStorageRequest.getIdentities()) {
type = getCloudFileSystemView(cloudStorageRequest, cloudFileSystemViews, storageIdentity);
}
}
validateCloudFileSystemViews(cloudFileSystemViews, type);
return new SpiFileSystem("", type, cloudFileSystemViews);
}
use of com.sequenceiq.common.api.cloudstorage.StorageIdentityBase 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());
}
use of com.sequenceiq.common.api.cloudstorage.StorageIdentityBase in project cloudbreak by hortonworks.
the class CloudStorageValidationUtilTest method testIsCloudStorageConfiguredWhenS3NotNull.
@Test
public void testIsCloudStorageConfiguredWhenS3NotNull() {
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
StorageIdentityBase storageIdentityBase = new StorageIdentityBase();
storageIdentityBase.setS3(new S3CloudStorageV1Parameters());
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 CloudStorageDecorator method decorate.
public CloudStorageRequest decorate(String blueprintName, String clusterName, CloudStorageRequest request, DetailedEnvironmentResponse environment) {
if (environment != null) {
if (request == null) {
request = new CloudStorageRequest();
}
TelemetryResponse telemetry = environment.getTelemetry();
if (telemetry != null && telemetry.getLogging() != null) {
LoggingResponse logging = telemetry.getLogging();
StorageIdentityBase identity = new StorageIdentityBase();
identity.setType(CloudIdentityType.LOG);
identity.setS3(logging.getS3());
identity.setAdlsGen2(logging.getAdlsGen2());
identity.setGcs(logging.getGcs());
List<StorageIdentityBase> identities = request.getIdentities();
if (identities == null) {
identities = new ArrayList<>();
}
boolean logConfiguredInRequest = false;
for (StorageIdentityBase identityBase : identities) {
if (CloudIdentityType.LOG.equals(identityBase.getType())) {
logConfiguredInRequest = true;
}
}
if (!logConfiguredInRequest) {
identities.add(identity);
}
request.setIdentities(identities);
}
List<SdxClusterResponse> datalakes = sdxClientService.getByEnvironmentCrn(environment.getCrn());
updateCloudStorageLocations(blueprintName, clusterName, request, datalakes);
updateDynamoDBTable(request, environment);
}
return request;
}
use of com.sequenceiq.common.api.cloudstorage.StorageIdentityBase in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method testAddAzureIdbrokerMsiToTelemetry.
@Test
public void testAddAzureIdbrokerMsiToTelemetry() {
Map<String, Object> attributes = new HashMap<>();
CloudStorageRequest cloudStorageRequest = new CloudStorageRequest();
List<StorageIdentityBase> identities = new ArrayList<>();
StorageIdentityBase identity = new StorageIdentityBase();
identity.setType(CloudIdentityType.ID_BROKER);
AdlsGen2CloudStorageV1Parameters adlsGen2 = new AdlsGen2CloudStorageV1Parameters();
adlsGen2.setManagedIdentity("msi");
identity.setAdlsGen2(adlsGen2);
identities.add(identity);
cloudStorageRequest.setIdentities(identities);
when(stackV4Request.getCluster()).thenReturn(clusterV4Request);
clusterV4Request.setCloudStorage(cloudStorageRequest);
underTest.addAzureIdbrokerMsiToTelemetry(attributes, stackV4Request);
assertThat(clusterV4Request.getCloudStorage()).isNotNull();
assertThat(attributes.get(FluentConfigView.AZURE_IDBROKER_INSTANCE_MSI)).isEqualTo("msi");
}
Aggregations