use of com.sequenceiq.environment.environment.domain.LocationAwareCredential in project cloudbreak by hortonworks.
the class NoSqlTableCreationModeDeterminerService method getNoSqlTableMetaData.
private NoSqlTableMetadataResponse getNoSqlTableMetaData(LocationAwareCredential locationAwareCredential, String dynamoDbTablename) {
Credential credential = locationAwareCredential.getCredential();
String cloudPlatform = credential.getCloudPlatform();
String location = locationAwareCredential.getLocation();
NoSqlConnector noSqlConnector = getNoSqlConnector(cloudPlatform);
CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential);
NoSqlTableMetadataRequest request = NoSqlTableMetadataRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
return noSqlConnector.getNoSqlTableMetaData(request);
}
use of com.sequenceiq.environment.environment.domain.LocationAwareCredential in project cloudbreak by hortonworks.
the class S3GuardTableDeleteHandler method deleteS3GuardTable.
private void deleteS3GuardTable(Environment environment, AwsParameters awsParameters) {
if (S3GuardTableCreation.CREATE_NEW == awsParameters.getS3guardTableCreation()) {
LocationAwareCredential locationAwareCredential = getLocationAwareCredential(environment);
ResponseStatus responseStatus = deleteNoSqlTable(locationAwareCredential, awsParameters.getS3guardTableName());
if (responseStatus == ResponseStatus.OK) {
LOGGER.info("'{}' DynamoDB table deletion initiated at cloud provider.", awsParameters.getS3guardTableName());
} else if (responseStatus == ResponseStatus.RESOURCE_NOT_FOUND) {
LOGGER.warn("'{}' DynamoDB table deletion initiated but table was not found.", awsParameters.getS3guardTableName());
}
} else {
LOGGER.info("'{}' DynamoDB table had already been existing before environment creation. Will not delete it.", awsParameters.getS3guardTableName());
}
}
use of com.sequenceiq.environment.environment.domain.LocationAwareCredential in project cloudbreak by hortonworks.
the class S3GuardTableDeleteHandler method deleteNoSqlTable.
private ResponseStatus deleteNoSqlTable(LocationAwareCredential locationAwareCredential, String dynamoDbTablename) {
Credential credential = locationAwareCredential.getCredential();
String cloudPlatform = credential.getCloudPlatform();
String location = locationAwareCredential.getLocation();
NoSqlConnector noSqlConnector = getNoSqlConnector(cloudPlatform);
CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential);
NoSqlTableMetadataRequest noSqlTableMetadataRequest = NoSqlTableMetadataRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
NoSqlTableMetadataResponse noSqlTableMetaData = noSqlConnector.getNoSqlTableMetaData(noSqlTableMetadataRequest);
if (ResponseStatus.OK.equals(noSqlTableMetaData.getStatus())) {
NoSqlTableDeleteRequest request = NoSqlTableDeleteRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
NoSqlTableDeleteResponse response = noSqlConnector.deleteNoSqlTable(request);
return response.getStatus();
} else {
return ResponseStatus.OK;
}
}
use of com.sequenceiq.environment.environment.domain.LocationAwareCredential in project cloudbreak by hortonworks.
the class AwsParameterValidator method determineAwsParameters.
private void determineAwsParameters(EnvironmentDto environment, ParametersDto parametersDto) {
LocationAwareCredential locationAwareCredential = getLocationAwareCredential(environment);
S3GuardTableCreation dynamoDbTableCreation = noSqlTableCreationModeDeterminerService.determineCreationMode(locationAwareCredential, parametersDto.getAwsParametersDto().getS3GuardTableName());
LOGGER.debug("S3Guard table name: {}, creation: {}", parametersDto.getAwsParametersDto().getS3GuardTableName(), dynamoDbTableCreation);
parametersDto.getAwsParametersDto().setDynamoDbTableCreation(dynamoDbTableCreation);
parametersService.saveParameters(environment.getId(), parametersDto);
}
Aggregations