use of com.amazonaws.services.ec2.model.RequestLaunchTemplateData in project cloudbreak by hortonworks.
the class AwsLaunchTemplateUpdateService method getCreateLaunchTemplateVersionRequest.
private CreateLaunchTemplateVersionResult getCreateLaunchTemplateVersionRequest(AmazonEc2Client ec2Client, Map<LaunchTemplateField, String> updatableFields, LaunchTemplateSpecification launchTemplateSpecification) {
CreateLaunchTemplateVersionRequest createLaunchTemplateVersionRequest = new CreateLaunchTemplateVersionRequest().withLaunchTemplateId(launchTemplateSpecification.getLaunchTemplateId()).withSourceVersion(launchTemplateSpecification.getVersion()).withVersionDescription(updatableFields.getOrDefault(LaunchTemplateField.DESCRIPTION, null)).withLaunchTemplateData(new RequestLaunchTemplateData().withImageId(updatableFields.getOrDefault(LaunchTemplateField.IMAGE_ID, null)).withUserData(updatableFields.getOrDefault(LaunchTemplateField.USER_DATA, null)));
CreateLaunchTemplateVersionResult createLaunchTemplateVersionResult = ec2Client.createLaunchTemplateVersion(createLaunchTemplateVersionRequest);
validateCreatedLaunchTemplateVersionResult(createLaunchTemplateVersionResult);
LOGGER.debug("Updated field in new launch template version: {}", updatableFields);
return createLaunchTemplateVersionResult;
}
Aggregations