Skip to content

Commit a42ca09

Browse files
Add support for ingest endpoints. (#7401) (#7403)
* Generate ingest endpoints and types * Codegen fixes * Manual code enhancements * Add initial tests Co-authored-by: Steve Gordon <[email protected]>
1 parent cac448c commit a42ca09

File tree

70 files changed

+20530
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+20530
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections.Generic;
6+
using System.Text.Json.Serialization;
7+
8+
namespace Elastic.Clients.Elasticsearch.Ingest;
9+
10+
public partial class GetPipelineResponse
11+
{
12+
[JsonIgnore]
13+
public IReadOnlyDictionary<string, Pipeline> Pipelines => BackingDictionary;
14+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Diagnostics.CodeAnalysis;
6+
7+
namespace Elastic.Clients.Elasticsearch.Ingest;
8+
9+
public partial class Processor
10+
{
11+
// TODO - We should generate this.
12+
// TODO - We should include a marker interface on the variants to support constraining the generic T here to IProcessor
13+
14+
public bool TryGet<T>([NotNullWhen(true)] out T? processor) where T : class
15+
{
16+
processor = null;
17+
18+
if (Variant is T variant)
19+
{
20+
processor = variant;
21+
return true;
22+
}
23+
24+
return false;
25+
}
26+
}

src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ internal static class ApiUrlsLookups
8383
internal static ApiUrls IndexManagementUpdateAliases = new ApiUrls(new[] { "/_aliases" });
8484
internal static ApiUrls NoNamespaceIndex = new ApiUrls(new[] { "/{index}/_doc/{id}", "/{index}/_doc" });
8585
internal static ApiUrls NoNamespaceInfo = new ApiUrls(new[] { "/" });
86+
internal static ApiUrls IngestDeletePipeline = new ApiUrls(new[] { "/_ingest/pipeline/{id}" });
87+
internal static ApiUrls IngestGeoIpStats = new ApiUrls(new[] { "/_ingest/geoip/stats" });
88+
internal static ApiUrls IngestGetPipeline = new ApiUrls(new[] { "/_ingest/pipeline", "/_ingest/pipeline/{id}" });
89+
internal static ApiUrls IngestProcessorGrok = new ApiUrls(new[] { "/_ingest/processor/grok" });
90+
internal static ApiUrls IngestPutPipeline = new ApiUrls(new[] { "/_ingest/pipeline/{id}" });
91+
internal static ApiUrls IngestSimulate = new ApiUrls(new[] { "/_ingest/pipeline/_simulate", "/_ingest/pipeline/{id}/_simulate" });
8692
internal static ApiUrls NoNamespaceMget = new ApiUrls(new[] { "/_mget", "/{index}/_mget" });
8793
internal static ApiUrls NoNamespaceMsearch = new ApiUrls(new[] { "/_msearch", "/{index}/_msearch" });
8894
internal static ApiUrls NoNamespaceMsearchTemplate = new ApiUrls(new[] { "/_msearch/template", "/{index}/_msearch/template" });
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Clients.Elasticsearch.Fluent;
19+
using Elastic.Clients.Elasticsearch.Requests;
20+
using Elastic.Clients.Elasticsearch.Serialization;
21+
using Elastic.Transport;
22+
using System;
23+
using System.Collections.Generic;
24+
using System.Linq.Expressions;
25+
using System.Text.Json;
26+
using System.Text.Json.Serialization;
27+
28+
#nullable restore
29+
namespace Elastic.Clients.Elasticsearch.Ingest;
30+
public sealed class DeletePipelineRequestParameters : RequestParameters
31+
{
32+
[JsonIgnore]
33+
public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("master_timeout"); set => Q("master_timeout", value); }
34+
35+
[JsonIgnore]
36+
public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("timeout"); set => Q("timeout", value); }
37+
}
38+
39+
public sealed partial class DeletePipelineRequest : PlainRequest<DeletePipelineRequestParameters>
40+
{
41+
public DeletePipelineRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
42+
{
43+
}
44+
45+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestDeletePipeline;
46+
protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE;
47+
internal override bool SupportsBody => false;
48+
[JsonIgnore]
49+
public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("master_timeout"); set => Q("master_timeout", value); }
50+
51+
[JsonIgnore]
52+
public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("timeout"); set => Q("timeout", value); }
53+
}
54+
55+
public sealed partial class DeletePipelineRequestDescriptor<TDocument> : RequestDescriptor<DeletePipelineRequestDescriptor<TDocument>, DeletePipelineRequestParameters>
56+
{
57+
internal DeletePipelineRequestDescriptor(Action<DeletePipelineRequestDescriptor<TDocument>> configure) => configure.Invoke(this);
58+
public DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
59+
{
60+
}
61+
62+
internal DeletePipelineRequestDescriptor()
63+
{
64+
}
65+
66+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestDeletePipeline;
67+
protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE;
68+
internal override bool SupportsBody => false;
69+
public DeletePipelineRequestDescriptor<TDocument> MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);
70+
public DeletePipelineRequestDescriptor<TDocument> Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout);
71+
public DeletePipelineRequestDescriptor<TDocument> Id(Elastic.Clients.Elasticsearch.Id id)
72+
{
73+
RouteValues.Required("id", id);
74+
return Self;
75+
}
76+
77+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
78+
{
79+
}
80+
}
81+
82+
public sealed partial class DeletePipelineRequestDescriptor : RequestDescriptor<DeletePipelineRequestDescriptor, DeletePipelineRequestParameters>
83+
{
84+
internal DeletePipelineRequestDescriptor(Action<DeletePipelineRequestDescriptor> configure) => configure.Invoke(this);
85+
public DeletePipelineRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id))
86+
{
87+
}
88+
89+
internal DeletePipelineRequestDescriptor()
90+
{
91+
}
92+
93+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestDeletePipeline;
94+
protected override HttpMethod StaticHttpMethod => HttpMethod.DELETE;
95+
internal override bool SupportsBody => false;
96+
public DeletePipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);
97+
public DeletePipelineRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout);
98+
public DeletePipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id)
99+
{
100+
RouteValues.Required("id", id);
101+
return Self;
102+
}
103+
104+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
105+
{
106+
}
107+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Clients.Elasticsearch.Fluent;
19+
using Elastic.Clients.Elasticsearch.Serialization;
20+
using Elastic.Transport.Products.Elasticsearch;
21+
using System.Collections.Generic;
22+
using System.Text.Json.Serialization;
23+
24+
#nullable restore
25+
namespace Elastic.Clients.Elasticsearch.Ingest;
26+
public sealed partial class DeletePipelineResponse : ElasticsearchResponse
27+
{
28+
[JsonInclude, JsonPropertyName("acknowledged")]
29+
public bool Acknowledged { get; init; }
30+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Clients.Elasticsearch.Fluent;
19+
using Elastic.Clients.Elasticsearch.Requests;
20+
using Elastic.Clients.Elasticsearch.Serialization;
21+
using Elastic.Transport;
22+
using System;
23+
using System.Collections.Generic;
24+
using System.Linq.Expressions;
25+
using System.Text.Json;
26+
using System.Text.Json.Serialization;
27+
28+
#nullable restore
29+
namespace Elastic.Clients.Elasticsearch.Ingest;
30+
public sealed class GeoIpStatsRequestParameters : RequestParameters
31+
{
32+
}
33+
34+
public sealed partial class GeoIpStatsRequest : PlainRequest<GeoIpStatsRequestParameters>
35+
{
36+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestGeoIpStats;
37+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
38+
internal override bool SupportsBody => false;
39+
}
40+
41+
public sealed partial class GeoIpStatsRequestDescriptor : RequestDescriptor<GeoIpStatsRequestDescriptor, GeoIpStatsRequestParameters>
42+
{
43+
internal GeoIpStatsRequestDescriptor(Action<GeoIpStatsRequestDescriptor> configure) => configure.Invoke(this);
44+
public GeoIpStatsRequestDescriptor()
45+
{
46+
}
47+
48+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestGeoIpStats;
49+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
50+
internal override bool SupportsBody => false;
51+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
52+
{
53+
}
54+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Clients.Elasticsearch.Fluent;
19+
using Elastic.Clients.Elasticsearch.Serialization;
20+
using Elastic.Transport.Products.Elasticsearch;
21+
using System.Collections.Generic;
22+
using System.Text.Json.Serialization;
23+
24+
#nullable restore
25+
namespace Elastic.Clients.Elasticsearch.Ingest;
26+
public sealed partial class GeoIpStatsResponse : ElasticsearchResponse
27+
{
28+
[JsonInclude, JsonPropertyName("nodes")]
29+
public IReadOnlyDictionary<Elastic.Clients.Elasticsearch.Id, Elastic.Clients.Elasticsearch.Ingest.GeoIpNodeDatabases> Nodes { get; init; }
30+
31+
[JsonInclude, JsonPropertyName("stats")]
32+
public Elastic.Clients.Elasticsearch.Ingest.GeoIpDownloadStatistics Stats { get; init; }
33+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
using Elastic.Clients.Elasticsearch.Fluent;
19+
using Elastic.Clients.Elasticsearch.Requests;
20+
using Elastic.Clients.Elasticsearch.Serialization;
21+
using Elastic.Transport;
22+
using System;
23+
using System.Collections.Generic;
24+
using System.Linq.Expressions;
25+
using System.Text.Json;
26+
using System.Text.Json.Serialization;
27+
28+
#nullable restore
29+
namespace Elastic.Clients.Elasticsearch.Ingest;
30+
public sealed class GetPipelineRequestParameters : RequestParameters
31+
{
32+
[JsonIgnore]
33+
public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("master_timeout"); set => Q("master_timeout", value); }
34+
35+
[JsonIgnore]
36+
public bool? Summary { get => Q<bool?>("summary"); set => Q("summary", value); }
37+
}
38+
39+
public sealed partial class GetPipelineRequest : PlainRequest<GetPipelineRequestParameters>
40+
{
41+
public GetPipelineRequest()
42+
{
43+
}
44+
45+
public GetPipelineRequest(Elastic.Clients.Elasticsearch.Id? id) : base(r => r.Optional("id", id))
46+
{
47+
}
48+
49+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestGetPipeline;
50+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
51+
internal override bool SupportsBody => false;
52+
[JsonIgnore]
53+
public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("master_timeout"); set => Q("master_timeout", value); }
54+
55+
[JsonIgnore]
56+
public bool? Summary { get => Q<bool?>("summary"); set => Q("summary", value); }
57+
}
58+
59+
public sealed partial class GetPipelineRequestDescriptor<TDocument> : RequestDescriptor<GetPipelineRequestDescriptor<TDocument>, GetPipelineRequestParameters>
60+
{
61+
internal GetPipelineRequestDescriptor(Action<GetPipelineRequestDescriptor<TDocument>> configure) => configure.Invoke(this);
62+
public GetPipelineRequestDescriptor()
63+
{
64+
}
65+
66+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestGetPipeline;
67+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
68+
internal override bool SupportsBody => false;
69+
public GetPipelineRequestDescriptor<TDocument> MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);
70+
public GetPipelineRequestDescriptor<TDocument> Summary(bool? summary = true) => Qs("summary", summary);
71+
public GetPipelineRequestDescriptor<TDocument> Id(Elastic.Clients.Elasticsearch.Id? id)
72+
{
73+
RouteValues.Optional("id", id);
74+
return Self;
75+
}
76+
77+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
78+
{
79+
}
80+
}
81+
82+
public sealed partial class GetPipelineRequestDescriptor : RequestDescriptor<GetPipelineRequestDescriptor, GetPipelineRequestParameters>
83+
{
84+
internal GetPipelineRequestDescriptor(Action<GetPipelineRequestDescriptor> configure) => configure.Invoke(this);
85+
public GetPipelineRequestDescriptor()
86+
{
87+
}
88+
89+
internal override ApiUrls ApiUrls => ApiUrlsLookups.IngestGetPipeline;
90+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
91+
internal override bool SupportsBody => false;
92+
public GetPipelineRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout);
93+
public GetPipelineRequestDescriptor Summary(bool? summary = true) => Qs("summary", summary);
94+
public GetPipelineRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id? id)
95+
{
96+
RouteValues.Optional("id", id);
97+
return Self;
98+
}
99+
100+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
101+
{
102+
}
103+
}

0 commit comments

Comments
 (0)