use of com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage in project cloudbreak by hortonworks.
the class CloudStorageConverter method requestToFileSystem.
public FileSystem requestToFileSystem(CloudStorageBase cloudStorageRequest) {
FileSystem fileSystem = new FileSystem();
fileSystem.setName(nameGenerator.generateName(FILESYSTEM));
FileSystemType fileSystemType = fileSystemResolver.determineFileSystemType(cloudStorageRequest);
fileSystem.setType(fileSystemType);
CloudStorage cloudStorage = new CloudStorage();
String s3GuardDynamoTableName = getS3GuardDynamoTableName(cloudStorageRequest);
cloudStorage.setS3GuardDynamoTableName(s3GuardDynamoTableName);
List<StorageLocation> storageLocations = cloudStorageRequest.getLocations().stream().map(this::storageLocationRequestToStorageLocation).collect(Collectors.toList());
cloudStorage.setLocations(storageLocations);
if (cloudStorageRequest.getIdentities() != null) {
List<CloudIdentity> cloudIdentities = cloudStorageRequest.getIdentities().stream().map(this::identityRequestToCloudIdentity).collect(Collectors.toList());
cloudStorage.setCloudIdentities(cloudIdentities);
}
cloudStorage.setAccountMapping(accountMappingRequestToAccountMapping(cloudStorageRequest.getAccountMapping()));
fileSystem.setCloudStorage(cloudStorage);
return fileSystem;
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundService method prepareFilesystemIfNotPresentedButSdxHasIt.
private void prepareFilesystemIfNotPresentedButSdxHasIt(Cluster requestedCluster, Stack stack) {
if (requestedCluster.getFileSystem() == null) {
if (hasFilesystem(stack.getCluster().getFileSystem())) {
FileSystem fileSystem = new FileSystem();
fileSystem.setCloudStorage(new CloudStorage());
fileSystem.setName(nameGenerator.generateName(FILESYSTEM));
fileSystem.setType(stack.getCluster().getFileSystem().getType());
requestedCluster.setFileSystem(fileSystem);
}
}
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundService method prepareFilesytem.
public FileSystem prepareFilesytem(Cluster requestedCluster, Stack datalakeStack) {
prepareFilesystemIfNotPresentedButSdxHasIt(requestedCluster, datalakeStack);
if (hasFilesystem(requestedCluster.getFileSystem())) {
FileSystem fileSystem = requestedCluster.getFileSystem();
if (hasLocations(fileSystem)) {
CloudStorage cloudStorage = fileSystem.getCloudStorage();
FileSystem dlFileSystem = datalakeStack.getCluster().getFileSystem();
if (hasFilesystem(dlFileSystem)) {
if (hasLocations(dlFileSystem)) {
List<StorageLocation> dlStorageLocations = dlFileSystem.getCloudStorage().getLocations();
List<StorageLocation> hiveRelatedStorageConfigs = getHiveRelatedStorageConfigs(dlStorageLocations);
if (sdxHasHiveStorageConfiguration(hiveRelatedStorageConfigs)) {
List<StorageLocation> storageLocations = getStorageLocationsWithoutHiveRelatedLocations(cloudStorage.getLocations());
storageLocations.addAll(hiveRelatedStorageConfigs);
cloudStorage.setLocations(storageLocations);
fileSystem.setCloudStorage(cloudStorage);
}
}
}
}
}
return requestedCluster.getFileSystem();
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage in project cloudbreak by hortonworks.
the class ClouderaManagerStorageErrorMapperTest method setUp.
@BeforeEach
void setUp() {
underTest = new ClouderaManagerStorageErrorMapper();
exception = new CloudStorageConfigurationFailedException(EXCEPTION_MESSAGE);
cluster = new Cluster();
fileSystem = new FileSystem();
cloudStorage = new CloudStorage();
cloudIdentity = new CloudIdentity();
cloudIdentity.setIdentityType(CloudIdentityType.ID_BROKER);
cloudStorage.setCloudIdentities(List.of(cloudIdentity));
accountMapping = new AccountMapping();
accountMapping.setUserMappings(Map.ofEntries(entry("hive", "myDataAccessRole"), entry("solr", "myRangerAuditRole")));
cloudStorage.setAccountMapping(accountMapping);
StorageLocation locationRangerAudit = new StorageLocation();
locationRangerAudit.setType(CloudStorageCdpService.RANGER_AUDIT);
locationRangerAudit.setValue("myRangerAuditLocation");
cloudStorage.setLocations(List.of(locationRangerAudit));
fileSystem.setCloudStorage(cloudStorage);
cluster.setFileSystem(fileSystem);
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.CloudStorage in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testStackInputAccountMappings.
@Test
public void testStackInputAccountMappings() {
FileSystem sourceFileSystem = mock(FileSystem.class);
CloudStorage sourceCloudStorage = mock(CloudStorage.class);
when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem);
when(sourceFileSystem.getCloudStorage()).thenReturn(sourceCloudStorage);
AccountMapping accountMapping = new AccountMapping();
accountMapping.setGroupMappings(GROUP_MAPPINGS);
accountMapping.setUserMappings(USER_MAPPINGS);
when(sourceCloudStorage.getAccountMapping()).thenReturn(accountMapping);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
AccountMappingView accountMappingView = result.getAccountMappingView();
assertThat(accountMappingView).isNotNull();
assertThat(accountMappingView.getGroupMappings()).isEqualTo(GROUP_MAPPINGS);
assertThat(accountMappingView.getUserMappings()).isEqualTo(USER_MAPPINGS);
}
Aggregations