use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class AwsObjectStorageConnector method validateObjectStorage.
@Override
public ObjectStorageValidateResponse validateObjectStorage(ObjectStorageValidateRequest request) {
String accountId = Crn.safeFromString(request.getCredential().getId()).getAccountId();
if (!entitlementService.awsCloudStorageValidationEnabled(accountId)) {
LOGGER.info("Aws Cloud storage validation entitlement is missing, not validating cloudStorageRequest: {}", JsonUtil.writeValueAsStringSilent(request));
return ObjectStorageValidateResponse.builder().withStatus(ResponseStatus.OK).build();
}
AwsCredentialView awsCredentialView = new AwsCredentialView(request.getCredential());
AmazonIdentityManagementClient iam = awsClient.createAmazonIdentityManagement(awsCredentialView);
SpiFileSystem spiFileSystem = request.getSpiFileSystem();
ValidationResultBuilder resultBuilder = new ValidationResultBuilder();
resultBuilder.prefix("Cloud Storage validation failed");
ValidationResult validationResult = awsIDBrokerObjectStorageValidator.validateObjectStorage(iam, spiFileSystem, request.getLogsLocationBase(), request.getBackupLocationBase(), resultBuilder);
ObjectStorageValidateResponse response;
if (validationResult.hasError()) {
response = ObjectStorageValidateResponse.builder().withStatus(ResponseStatus.ERROR).withError(validationResult.getFormattedErrors()).build();
} else {
response = ObjectStorageValidateResponse.builder().withStatus(ResponseStatus.OK).withError(validationResult.getFormattedWarnings()).build();
}
return response;
}
use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class ComponentTestUtil method getStackForLaunch.
public CloudStack getStackForLaunch(InstanceStatus createRequested, InstanceStatus createRequested1) throws IOException {
InstanceAuthentication instanceAuthentication = new InstanceAuthentication(PUBLIC_KEY, "pubkeyid", LOGIN_USER_NAME);
CloudInstance instance = getCloudInstance(instanceAuthentication, "group1", InstanceStatus.CREATE_REQUESTED, 0L, null);
Security security = getSecurity();
List<Group> groups = List.of(new Group("group1", InstanceGroupType.CORE, List.of(instance), security, null, instanceAuthentication, instanceAuthentication.getLoginUserName(), instanceAuthentication.getPublicKey(), ROOT_VOLUME_SIZE, Optional.empty(), createGroupNetwork(), emptyMap()));
Network network = new Network(new Subnet(CIDR));
Map<InstanceGroupType, String> userData = ImmutableMap.of(InstanceGroupType.CORE, CORE_CUSTOM_DATA, InstanceGroupType.GATEWAY, GATEWAY_CUSTOM_DATA);
Image image = new Image("cb-centos66-amb200-2015-05-25", userData, "redhat6", "redhat6", "", "default", "default-id", new HashMap<>());
String template = configuration.getTemplate(LATEST_AWS_CLOUD_FORMATION_TEMPLATE_PATH, "UTF-8").toString();
SpiFileSystem efsFileSystem = getEfsFileSystem();
return new CloudStack(groups, network, image, Map.of(), Map.of(), template, instanceAuthentication, LOGIN_USER_NAME, PUBLIC_KEY, efsFileSystem);
}
use of com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem in project cloudbreak by hortonworks.
the class ComponentTestUtil method getEfsFileSystem.
private SpiFileSystem getEfsFileSystem() {
String fileSystemName = "efs-test";
Map<String, String> tags = new HashMap<>();
tags.put(CloudEfsConfiguration.KEY_FILESYSTEM_TAGS_NAME, fileSystemName);
SpiFileSystem newEfsFileSystem = new SpiFileSystem(fileSystemName, FileSystemType.EFS, null, new HashMap<>());
newEfsFileSystem.putParameter(CloudEfsConfiguration.KEY_ENCRYPTED, true);
newEfsFileSystem.putParameter(CloudEfsConfiguration.KEY_FILESYSTEM_TAGS, tags);
newEfsFileSystem.putParameter(CloudEfsConfiguration.KEY_PERFORMANCE_MODE, "generalPurpose");
newEfsFileSystem.putParameter(CloudEfsConfiguration.KEY_THROUGHPUT_MODE, "provisioned");
return newEfsFileSystem;
}
Aggregations