use of com.sequenceiq.common.api.cloudstorage.S3Guard in project cloudbreak by hortonworks.
the class CloudStorageDecorator method updateDynamoDBTable.
public void updateDynamoDBTable(CloudStorageRequest request, DetailedEnvironmentResponse environment) {
if (dynamoDBTableNameSpecified(environment)) {
String dynamoDbTableName = environment.getAws().getS3guard().getDynamoDbTableName();
S3Guard s3Guard = new S3Guard();
s3Guard.setDynamoTableName(dynamoDbTableName);
AwsStorageParameters aws = new AwsStorageParameters();
aws.setS3Guard(s3Guard);
request.setAws(aws);
}
}
use of com.sequenceiq.common.api.cloudstorage.S3Guard in project cloudbreak by hortonworks.
the class CloudStorageManifester method addS3Guard.
private void addS3Guard(CloudStorageRequest cloudStorageRequest, DetailedEnvironmentResponse environment) {
if (isS3GuardConfigured(environment, cloudStorageRequest)) {
String dynamoDbTableName = environment.getAws().getS3guard().getDynamoDbTableName();
if (!Strings.isNullOrEmpty(dynamoDbTableName)) {
LOGGER.debug("Setting dynamo db table name s3 guard configuration: {}", dynamoDbTableName);
AwsStorageParameters awsStorageParameters = new AwsStorageParameters();
S3Guard s3Guard = new S3Guard();
s3Guard.setDynamoTableName(environment.getAws().getS3guard().getDynamoDbTableName());
awsStorageParameters.setS3Guard(s3Guard);
cloudStorageRequest.setAws(awsStorageParameters);
}
}
}
use of com.sequenceiq.common.api.cloudstorage.S3Guard in project cloudbreak by hortonworks.
the class CloudStorageConverter method fileSystemToRequest.
public CloudStorageRequest fileSystemToRequest(FileSystem fileSystem) {
CloudStorageRequest result = new CloudStorageRequest();
CloudStorage cloudStorage = fileSystem.getCloudStorage();
if (cloudStorage != null) {
List<StorageIdentityBase> storageIdentityRequests = cloudStorage.getCloudIdentities().stream().map(this::cloudIdentityToRequest).collect(Collectors.toList());
result.setIdentities(storageIdentityRequests);
List<StorageLocationBase> storageLocationRequests = cloudStorage.getLocations().stream().map(this::storageLocationToRequest).collect(Collectors.toList());
result.setLocations(storageLocationRequests);
NullUtil.doIfNotNull(cloudStorage.getS3GuardDynamoTableName(), tableName -> {
AwsStorageParameters awsStorageParameters = new AwsStorageParameters();
S3Guard s3Guard = new S3Guard();
s3Guard.setDynamoTableName(tableName);
awsStorageParameters.setS3Guard(s3Guard);
result.setAws(awsStorageParameters);
});
result.setAccountMapping(accountMappingToAccountMappingRequest(cloudStorage.getAccountMapping()));
}
return result;
}
use of com.sequenceiq.common.api.cloudstorage.S3Guard 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;
}
Aggregations