tools/Elastic.CommonSchema.Generator/Views/IndexTemplates.Generated.cshtml (53 lines of code) (raw):

@* ReSharper disable twice RedundantUsingDirective *@ @using System @using System.Linq @inherits Elastic.CommonSchema.Generator.Views.CodeTemplatePage<Elastic.CommonSchema.Generator.Projection.CommonSchemaTypesProjection> // Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information /* IMPORTANT NOTE ============== This file has been generated. If you wish to submit a PR please modify the original csharp file and submit the PR with that change. Thanks! */ // ReSharper disable RedundantUsingDirective using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Linq; using System.Net; using System.Runtime.Serialization; using System.Text.Json.Serialization; namespace Elastic.CommonSchema.Elasticsearch { /// <summary> /// Elastic Common Schema version @(Model.GitRef) index templates to be used with Elasticsearch. /// </summary> public static class IndexTemplates { @foreach (var template in Model.IndexTemplates) {<text> /// <summary> /// Elastic Common Schema version @(Model.GitRef) @(template.Name) index template /// See the Put Index Template API documentation: https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html /// </summary> /// <returns>Index template string that can be used with the Put Index Template API.</returns> @if (template.Name == "Composable") { <text> public static string GetIndexTemplateForElasticsearch@(template.Name)(string indexPattern = "ecs-*", string[] additionalComponents = null) { additionalComponents ??= new string[]{}; var userComponents = additionalComponents.Length == 0 ? "" : $", {string.Join(", ", additionalComponents.Select(a=>$"\"{a}\""))}"; </text> } else { <text> public static string GetIndexTemplateForElasticsearch@(template.Name)(string indexPattern = "ecs-*") { </text> } return @Raw("@")"@Raw(template.Template)"; } </text>} } }