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;
}
Aggregations