protected async Task PutComponentTemplateAsync()

in src/Elastic.Ingest.Elasticsearch/ElasticsearchChannelBase.Bootstrap.cs [152:165]


	protected async Task<bool> PutComponentTemplateAsync(BootstrapMethod bootstrapMethod, string name, string body, CancellationToken ctx = default)
	{
		var putComponentTemplate = await Options.Transport.RequestAsync<PutComponentTemplateResponse>
				(HttpMethod.PUT, $"_component_template/{name}", PostData.String(body), cancellationToken: ctx)
			.ConfigureAwait(false);
		if (putComponentTemplate.ApiCallDetails.HasSuccessfulStatusCode) return true;

		return bootstrapMethod == BootstrapMethod.Silent
			? false
			: throw new Exception(
				$"Failure to create component template `{name}` for {TemplateWildcard}: {putComponentTemplate}",
				putComponentTemplate.ApiCallDetails.OriginalException
			);
	}