use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class CloudStorageConverter method storageLocationRequestToStorageLocation.
private StorageLocation storageLocationRequestToStorageLocation(StorageLocationBase storageLocationRequest) {
StorageLocation storageLocation = new StorageLocation();
try {
storageLocation.setType(storageLocationRequest.getType());
} catch (IllegalArgumentException e) {
throw new BadRequestException(String.format("StorageLocation type '%s' is not supported. Supported types: [%s].", storageLocationRequest.getType(), CloudStorageCdpService.typeListing()), e);
}
storageLocation.setValue(storageLocationRequest.getValue());
return storageLocation;
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class CloudStorageConverter method fileSystemToResponse.
public CloudStorageResponse fileSystemToResponse(FileSystem fileSystem) {
CloudStorageResponse response = new CloudStorageResponse();
CloudStorage cloudStorage = fileSystem.getCloudStorage();
if (cloudStorage != null) {
if (StringUtils.isNotEmpty(cloudStorage.getS3GuardDynamoTableName())) {
AwsStorageParameters awsStorageParameters = new AwsStorageParameters();
S3Guard s3Guard = new S3Guard();
s3Guard.setDynamoTableName(cloudStorage.getS3GuardDynamoTableName());
awsStorageParameters.setS3Guard(s3Guard);
response.setAws(awsStorageParameters);
}
List<StorageIdentityBase> storageIdentities = cloudStorage.getCloudIdentities().stream().map(this::cloudIdentityToStorageIdentityBase).collect(Collectors.toList());
response.setIdentities(storageIdentities);
List<StorageLocationBase> storageLocations = cloudStorage.getLocations().stream().map(storageLocation -> {
StorageLocationBase storageLocationBase = new StorageLocationBase();
storageLocationBase.setType(storageLocation.getType());
storageLocationBase.setValue(storageLocation.getValue());
return storageLocationBase;
}).collect(Collectors.toList());
response.setLocations(storageLocations);
response.setAccountMapping(accountMappingToAccountMappingRequest(cloudStorage.getAccountMapping()));
}
return response;
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class CloudFileSystemViewProviderTest method getCloudStorage.
private CloudStorage getCloudStorage(List<CloudIdentity> cloudIdentities) {
List<StorageLocation> storageLocations = new ArrayList<>();
StorageLocation storageLocation1 = new StorageLocation();
storageLocation1.setType(SERVICE_1);
storageLocation1.setValue(PATH_1);
storageLocations.add(storageLocation1);
StorageLocation storageLocation2 = new StorageLocation();
storageLocation2.setType(SERVICE_2);
storageLocation2.setValue(PATH_2);
storageLocations.add(storageLocation2);
StorageLocation storageLocation3 = new StorageLocation();
storageLocation3.setType(SERVICE_3);
storageLocation3.setValue(PATH_3);
storageLocations.add(storageLocation3);
StorageLocation storageLocation4 = new StorageLocation();
storageLocation4.setType(SERVICE_4);
storageLocation4.setValue(PATH_4);
storageLocations.add(storageLocation4);
CloudStorage cloudStorage = new CloudStorage();
cloudStorage.setCloudIdentities(cloudIdentities);
cloudStorage.setLocations(storageLocations);
return cloudStorage;
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundServiceTest method testFileSystemWhenHivePathPresentedInDistroXButSdxDoesNotContainsItShouldReturnWithDistroXConfigs.
@Test
public void testFileSystemWhenHivePathPresentedInDistroXButSdxDoesNotContainsItShouldReturnWithDistroXConfigs() throws IOException {
FileSystem fileSystem = underTest.prepareFilesytem(mockRequestedCluster(mockStorageLocation(3), mockStorageLocation(4)), mockStack());
List<StorageLocation> locations = fileSystem.getCloudStorage().getLocations();
Assert.assertEquals(2, locations.size());
Assert.assertTrue(hasPropretyWithIndex(locations, 3));
Assert.assertTrue(hasPropretyWithIndex(locations, 4));
}
use of com.sequenceiq.cloudbreak.domain.cloudstorage.StorageLocation in project cloudbreak by hortonworks.
the class RemoteDataContextWorkaroundServiceTest method mockStorageLocation.
private StorageLocation mockStorageLocation(int index) {
StorageLocation storageLocation = new StorageLocation();
storageLocation.setType(CloudStorageCdpService.HIVE_METASTORE_EXTERNAL_WAREHOUSE);
storageLocation.setValue("hive" + index);
return storageLocation;
}
Aggregations