Search in sources :

Example 1 with ModifyLaunchTemplateRequest

use of com.amazonaws.services.ec2.model.ModifyLaunchTemplateRequest in project cloudbreak by hortonworks.

the class AwsLaunchTemplateUpdateService method modifyLaunchTemplate.

private ModifyLaunchTemplateResult modifyLaunchTemplate(AmazonEc2Client ec2Client, LaunchTemplateSpecification launchTemplateSpecification, CreateLaunchTemplateVersionResult createLaunchTemplateVersionResult, boolean setLaunchtemplateVersionToDefault) {
    ModifyLaunchTemplateRequest modifyLaunchTemplateRequest = new ModifyLaunchTemplateRequest().withLaunchTemplateId(launchTemplateSpecification.getLaunchTemplateId());
    if (setLaunchtemplateVersionToDefault) {
        modifyLaunchTemplateRequest.withDefaultVersion(createLaunchTemplateVersionResult.getLaunchTemplateVersion().getVersionNumber().toString());
    } else {
        LOGGER.debug("In case of dryrun the default version of the used launch template remain the same: {}", launchTemplateSpecification.getVersion());
        modifyLaunchTemplateRequest.withDefaultVersion(launchTemplateSpecification.getVersion());
    }
    ModifyLaunchTemplateResult modifyLaunchTemplateResult = ec2Client.modifyLaunchTemplate(modifyLaunchTemplateRequest);
    LOGGER.debug("Modified launch template: {}", modifyLaunchTemplateResult);
    return modifyLaunchTemplateResult;
}
Also used : ModifyLaunchTemplateRequest(com.amazonaws.services.ec2.model.ModifyLaunchTemplateRequest) ModifyLaunchTemplateResult(com.amazonaws.services.ec2.model.ModifyLaunchTemplateResult)

Aggregations

ModifyLaunchTemplateRequest (com.amazonaws.services.ec2.model.ModifyLaunchTemplateRequest)1 ModifyLaunchTemplateResult (com.amazonaws.services.ec2.model.ModifyLaunchTemplateResult)1