class AwsImageUpdateService {

    public void updateImage(AuthenticatedContext authenticatedContext, CloudStack stack, CloudResource cfResource) {
        String cfTemplate = stack.getTemplate();
        if (cfTemplate.contains("AWS::AutoScaling::LaunchConfiguration")) {
            awsLaunchConfigurationImageUpdateService.updateImage(authenticatedContext, stack, cfResource);
        } else if (cfTemplate.contains("AWS::EC2::LaunchTemplate")) {
            awsLaunchTemplateImageUpdateService.updateImage(authenticatedContext, stack, cfResource);
        } else {
            throw new NotImplementedException("Image update for stack template is not implemented yet.");
        }
    }

}