예제 #1
0
        public HttpResponseMessage GetARMTemplate(string templateName)
        {
            var list          = TemplatesManager.GetTemplates().ToList();
            var emptyTemplate = WebsiteTemplate.EmptySiteTemplate;

            emptyTemplate.MSDeployPackageUrl = $"{SimpleSettings.ZippedRepoUrl}/Default/{Uri.EscapeDataString((emptyTemplate.Name))}.zip";

            list.Add(emptyTemplate);

            var template = list.FirstOrDefault((temp) => string.Equals(temp.Name, templateName, StringComparison.OrdinalIgnoreCase));

            if (template != null)
            {
                var armTemplateJson = TemplatesManager.GetARMTemplate(template);
                return(Request.CreateResponse(HttpStatusCode.OK, armTemplateJson, new MediaTypeHeaderValue("application/json")));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
        }