Search in sources :

Example 1 with AwsFreeIpaParameters

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;
}
Also used : AttachedFreeIpaRequest(com.sequenceiq.environment.api.v1.environment.model.request.AttachedFreeIpaRequest) AwsFreeIpaParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters) AwsFreeIpaSpotParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaSpotParameters)

Example 2 with AwsFreeIpaParameters

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;
}
Also used : AwsFreeIpaParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters)

Example 3 with AwsFreeIpaParameters

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();
}
Also used : FreeIpaImageRequest(com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest) FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException)

Example 4 with AwsFreeIpaParameters

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;
}
Also used : AttachedFreeIpaRequest(com.sequenceiq.environment.api.v1.environment.model.request.AttachedFreeIpaRequest) AwsFreeIpaParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters) AwsFreeIpaSpotParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaSpotParameters)

Aggregations

AwsFreeIpaParameters (com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaParameters)3 AttachedFreeIpaRequest (com.sequenceiq.environment.api.v1.environment.model.request.AttachedFreeIpaRequest)2 AwsFreeIpaSpotParameters (com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsFreeIpaSpotParameters)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 FreeIpaImageRequest (com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest)1 FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)1