/// <summary> /// Create the appropriate parser depending whether the template is JSON or YAML. /// </summary> /// <param name="templateBody"></param> /// <returns></returns> /// <exception cref="LambdaToolsException"></exception> public static ITemplateParser CreateTemplateParser(string templateBody) { switch (LambdaUtilities.DetermineTemplateFormat(templateBody)) { case TemplateFormat.Json: return(new JsonTemplateParser(templateBody)); case TemplateFormat.Yaml: return(new YamlTemplateParser(templateBody)); default: throw new LambdaToolsException("Unable to determine template file format", LambdaToolsException.LambdaErrorCode.ServerlessTemplateParseError); } }