Search in sources :

Example 1 with FreeIpaImageRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest in project cloudbreak by hortonworks.

the class FreeIpaConverterTest method aFreeIpaImage.

private FreeIpaImageRequest aFreeIpaImage(String catalog, String id) {
    FreeIpaImageRequest request = new FreeIpaImageRequest();
    request.setId(id);
    request.setCatalog(catalog);
    return request;
}
Also used : FreeIpaImageRequest(com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest)

Example 2 with FreeIpaImageRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest in project cloudbreak by hortonworks.

the class EnvironmentTestDto method withFreeIpaImage.

public EnvironmentTestDto withFreeIpaImage(String imageCatalog, String imageUuid) {
    if (!Strings.isNullOrEmpty(imageCatalog) && !Strings.isNullOrEmpty(imageUuid)) {
        FreeIpaImageRequest imageRequest = new FreeIpaImageRequest();
        imageRequest.setCatalog(imageCatalog);
        imageRequest.setId(imageUuid);
        withCreateFreeIpa(true);
        getRequest().getFreeIpa().setImage(imageRequest);
    }
    return this;
}
Also used : FreeIpaImageRequest(com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest)

Example 3 with FreeIpaImageRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest 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 FreeIpaImageRequest

use of com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest in project cloudbreak by hortonworks.

the class EnvironmentTestDto method withMarketplaceFreeIpaImage.

public EnvironmentTestDto withMarketplaceFreeIpaImage() {
    FreeIpaImageRequest imageRequest = new FreeIpaImageRequest();
    imageRequest.setCatalog(getMarketplaceFreeIpaCatalogUrl());
    imageRequest.setId(getMarketplaceFreeIpaImageUuid());
    getRequest().getFreeIpa().setImage(imageRequest);
    return this;
}
Also used : FreeIpaImageRequest(com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest)

Aggregations

FreeIpaImageRequest (com.sequenceiq.environment.api.v1.environment.model.request.FreeIpaImageRequest)4 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)1