use of com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters in project cloudbreak by hortonworks.
the class EnvironmentApiConverterTest method createFreeIpaRequest.
private AttachedFreeIpaRequest createFreeIpaRequest() {
AwsFreeIpaSpotParameters awsFreeIpaSpotParameters = new AwsFreeIpaSpotParameters();
awsFreeIpaSpotParameters.setPercentage(50);
awsFreeIpaSpotParameters.setMaxPrice(0.9);
AwsFreeIpaParameters awsFreeIpaParameters = new AwsFreeIpaParameters();
awsFreeIpaParameters.setSpot(awsFreeIpaSpotParameters);
AttachedFreeIpaRequest attachedFreeIpaRequest = new AttachedFreeIpaRequest();
attachedFreeIpaRequest.setAws(awsFreeIpaParameters);
return attachedFreeIpaRequest;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters in project cloudbreak by hortonworks.
the class FreeIpaConverter method convertAws.
private AwsFreeIpaParameters convertAws(FreeIpaCreationAwsParametersDto aws) {
AwsFreeIpaParameters result = new AwsFreeIpaParameters();
result.setSpot(convertAwsSpot(aws.getSpot()));
return result;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters in project cloudbreak by hortonworks.
the class FreeIpaConverter method convert.
public FreeIpaCreationDto convert(AttachedFreeIpaRequest request, String accountId, String cloudPlatform) {
FreeIpaCreationDto.Builder builder = FreeIpaCreationDto.builder();
if (request != null) {
builder.withCreate(request.getCreate());
builder.withEnableMultiAz(request.isEnableMultiAz());
if (request.isEnableMultiAz()) {
if (!cloudPlatform.equalsIgnoreCase(CloudConstants.AWS)) {
throw new BadRequestException("You need to provision AWS environment to use Multi Availability Zone.");
}
if (!entitlementService.awsNativeFreeIpaEnabled(accountId)) {
throw new BadRequestException("You need to be entitled for CDP_CB_AWS_NATIVE_FREEIPA to provision FreeIPA in Multi Availability Zone.");
}
}
Optional.ofNullable(request.getInstanceCountByGroup()).ifPresent(builder::withInstanceCountByGroup);
Optional.ofNullable(request.getInstanceType()).ifPresent(builder::withInstanceType);
Optional.ofNullable(request.getAws()).map(AwsFreeIpaParameters::getSpot).ifPresent(spotParameters -> builder.withAws(FreeIpaCreationAwsParametersDto.builder().withSpot(FreeIpaCreationAwsSpotParametersDto.builder().withPercentage(spotParameters.getPercentage()).withMaxPrice(spotParameters.getMaxPrice()).build()).build()));
FreeIpaImageRequest image = request.getImage();
if (image != null) {
builder.withImageCatalog(image.getCatalog());
builder.withImageId(image.getId());
}
}
return builder.build();
}
use of com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters in project cloudbreak by hortonworks.
the class AwsCloudProvider method getAttachedFreeIpaRequest.
private AttachedFreeIpaRequest getAttachedFreeIpaRequest() {
AttachedFreeIpaRequest attachedFreeIpaRequest = new AttachedFreeIpaRequest();
AwsFreeIpaParameters awsFreeIpaParameters = new AwsFreeIpaParameters();
AwsFreeIpaSpotParameters awsFreeIpaSpotParameters = new AwsFreeIpaSpotParameters();
awsFreeIpaSpotParameters.setPercentage(getSpotPercentage());
awsFreeIpaParameters.setSpot(awsFreeIpaSpotParameters);
attachedFreeIpaRequest.setAws(awsFreeIpaParameters);
return attachedFreeIpaRequest;
}
Aggregations