Skip to content

Commit c5ab8aa

Browse files
Fix cleanup repository patch and regen LL code (#6055)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 0c3210a commit c5ab8aa

File tree

10 files changed

+68
-31
lines changed

10 files changed

+68
-31
lines changed

src/ApiGenerator/RestSpecification/Core/fleet.msearch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
"url":{
1414
"paths":[
1515
{
16-
"path":"/_fleet/_msearch",
16+
"path":"/_fleet/_fleet_msearch",
1717
"methods":[
1818
"GET",
1919
"POST"
2020
]
2121
},
2222
{
23-
"path":"/{index}/_fleet/_msearch",
23+
"path":"/{index}/_fleet/_fleet_msearch",
2424
"methods":[
2525
"GET",
2626
"POST"

src/ApiGenerator/RestSpecification/Core/fleet.search.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"url":{
1414
"paths":[
1515
{
16-
"path":"/{index}/_fleet/_search",
16+
"path":"/{index}/_fleet/_fleet_search",
1717
"methods":[
1818
"GET",
1919
"POST"

src/ApiGenerator/RestSpecification/Core/nodes.hot_threads.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,19 @@
134134
"options":[
135135
"cpu",
136136
"wait",
137-
"block"
137+
"block",
138+
"mem"
138139
],
139140
"description":"The type to sample (default: cpu)"
140141
},
142+
"sort":{
143+
"type":"enum",
144+
"options":[
145+
"cpu",
146+
"total"
147+
],
148+
"description":"The sort order for 'cpu' type (default: total)"
149+
},
141150
"timeout":{
142151
"type":"time",
143152
"description":"Explicit operation timeout"

src/ApiGenerator/RestSpecification/Core/open_point_in_time.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
},
5353
"keep_alive": {
5454
"type": "string",
55-
"description": "Specific the time to live for the point in time"
55+
"description": "Specific the time to live for the point in time",
56+
"required": true
5657
}
5758
}
5859
}

src/ApiGenerator/RestSpecification/_Patches/snapshot.cleanup_repository.patch.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Elasticsearch.Net/Api/Enums.Generated.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,15 @@ public enum IndicesShardStoresStatus
422422
All
423423
}
424424

425+
[StringEnum]
426+
public enum Sort
427+
{
428+
[EnumMember(Value = "cpu")]
429+
Cpu,
430+
[EnumMember(Value = "total")]
431+
Total
432+
}
433+
425434
[StringEnum]
426435
public enum ThreadType
427436
{
@@ -430,7 +439,9 @@ public enum ThreadType
430439
[EnumMember(Value = "wait")]
431440
Wait,
432441
[EnumMember(Value = "block")]
433-
Block
442+
Block,
443+
[EnumMember(Value = "mem")]
444+
Mem
434445
}
435446

436447
[StringEnum]
@@ -496,6 +507,7 @@ static KnownEnums()
496507
EnumStringResolvers.TryAdd(typeof(Conflicts), (e) => GetStringValue((Conflicts)e));
497508
EnumStringResolvers.TryAdd(typeof(OpType), (e) => GetStringValue((OpType)e));
498509
EnumStringResolvers.TryAdd(typeof(IndicesShardStoresStatus), (e) => GetStringValue((IndicesShardStoresStatus)e));
510+
EnumStringResolvers.TryAdd(typeof(Sort), (e) => GetStringValue((Sort)e));
499511
EnumStringResolvers.TryAdd(typeof(ThreadType), (e) => GetStringValue((ThreadType)e));
500512
EnumStringResolvers.TryAdd(typeof(GridType), (e) => GetStringValue((GridType)e));
501513
EnumStringResolvers.TryAdd(typeof(GroupBy), (e) => GetStringValue((GroupBy)e));
@@ -978,6 +990,19 @@ public static string GetStringValue(this IndicesShardStoresStatus enumValue)
978990
throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'IndicesShardStoresStatus'");
979991
}
980992

993+
public static string GetStringValue(this Sort enumValue)
994+
{
995+
switch (enumValue)
996+
{
997+
case Sort.Cpu:
998+
return "cpu";
999+
case Sort.Total:
1000+
return "total";
1001+
}
1002+
1003+
throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'Sort'");
1004+
}
1005+
9811006
public static string GetStringValue(this ThreadType enumValue)
9821007
{
9831008
switch (enumValue)
@@ -988,6 +1013,8 @@ public static string GetStringValue(this ThreadType enumValue)
9881013
return "wait";
9891014
case ThreadType.Block:
9901015
return "block";
1016+
case ThreadType.Mem:
1017+
return "mem";
9911018
}
9921019

9931020
throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum 'ThreadType'");

src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Nodes.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ public long? Snapshots
6767
set => Q("snapshots", value);
6868
}
6969

70+
///<summary>The sort order for 'cpu' type (default: total)</summary>
71+
public Sort? Sort
72+
{
73+
get => Q<Sort? >("sort");
74+
set => Q("sort", value);
75+
}
76+
7077
///<summary>The type to sample (default: cpu)</summary>
7178
public ThreadType? ThreadType
7279
{

src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Elasticsearch.Net.Specification.SnapshotApi
3131
public class CleanupRepositoryRequestParameters : RequestParameters<CleanupRepositoryRequestParameters>
3232
{
3333
public override HttpMethod DefaultHttpMethod => HttpMethod.POST;
34-
public override bool SupportsBody => true;
34+
public override bool SupportsBody => false;
3535
///<summary>Explicit operation timeout for connection to master node</summary>
3636
public TimeSpan MasterTimeout
3737
{

src/Elasticsearch.Net/ElasticLowLevelClient.Fleet.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,48 +57,48 @@ public TResponse GlobalCheckpoints<TResponse>(string index, GlobalCheckpointsReq
5757
[MapsApi("fleet.global_checkpoints", "index")]
5858
public Task<TResponse> GlobalCheckpointsAsync<TResponse>(string index, GlobalCheckpointsRequestParameters requestParameters = null, CancellationToken ctx = default)
5959
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(GET, Url($"{index:index}/_fleet/global_checkpoints"), ctx, null, RequestParams(requestParameters));
60-
///<summary>POST on /_fleet/_msearch</summary>
60+
///<summary>POST on /_fleet/_fleet_msearch</summary>
6161
///<param name = "body">The request definitions (metadata-fleet search request definition pairs), separated by newlines</param>
6262
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
6363
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
6464
public TResponse Msearch<TResponse>(PostData body, MsearchRequestParameters requestParameters = null)
65-
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_fleet/_msearch", body, RequestParams(requestParameters));
66-
///<summary>POST on /_fleet/_msearch</summary>
65+
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, "_fleet/_fleet_msearch", body, RequestParams(requestParameters));
66+
///<summary>POST on /_fleet/_fleet_msearch</summary>
6767
///<param name = "body">The request definitions (metadata-fleet search request definition pairs), separated by newlines</param>
6868
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
6969
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
7070
[MapsApi("fleet.msearch", "body")]
7171
public Task<TResponse> MsearchAsync<TResponse>(PostData body, MsearchRequestParameters requestParameters = null, CancellationToken ctx = default)
72-
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_fleet/_msearch", ctx, body, RequestParams(requestParameters));
73-
///<summary>POST on /{index}/_fleet/_msearch</summary>
72+
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, "_fleet/_fleet_msearch", ctx, body, RequestParams(requestParameters));
73+
///<summary>POST on /{index}/_fleet/_fleet_msearch</summary>
7474
///<param name = "index">The index name to use as the default</param>
7575
///<param name = "body">The request definitions (metadata-fleet search request definition pairs), separated by newlines</param>
7676
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
7777
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
7878
public TResponse Msearch<TResponse>(string index, PostData body, MsearchRequestParameters requestParameters = null)
79-
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"{index:index}/_fleet/_msearch"), body, RequestParams(requestParameters));
80-
///<summary>POST on /{index}/_fleet/_msearch</summary>
79+
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"{index:index}/_fleet/_fleet_msearch"), body, RequestParams(requestParameters));
80+
///<summary>POST on /{index}/_fleet/_fleet_msearch</summary>
8181
///<param name = "index">The index name to use as the default</param>
8282
///<param name = "body">The request definitions (metadata-fleet search request definition pairs), separated by newlines</param>
8383
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
8484
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
8585
[MapsApi("fleet.msearch", "index, body")]
8686
public Task<TResponse> MsearchAsync<TResponse>(string index, PostData body, MsearchRequestParameters requestParameters = null, CancellationToken ctx = default)
87-
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"{index:index}/_fleet/_msearch"), ctx, body, RequestParams(requestParameters));
88-
///<summary>POST on /{index}/_fleet/_search</summary>
87+
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"{index:index}/_fleet/_fleet_msearch"), ctx, body, RequestParams(requestParameters));
88+
///<summary>POST on /{index}/_fleet/_fleet_search</summary>
8989
///<param name = "index">The index name to search.</param>
9090
///<param name = "body">The search definition using the Query DSL</param>
9191
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
9292
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
9393
public TResponse Search<TResponse>(string index, PostData body, SearchRequestParameters requestParameters = null)
94-
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"{index:index}/_fleet/_search"), body, RequestParams(requestParameters));
95-
///<summary>POST on /{index}/_fleet/_search</summary>
94+
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"{index:index}/_fleet/_fleet_search"), body, RequestParams(requestParameters));
95+
///<summary>POST on /{index}/_fleet/_fleet_search</summary>
9696
///<param name = "index">The index name to search.</param>
9797
///<param name = "body">The search definition using the Query DSL</param>
9898
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
9999
///<remarks>Note: Experimental within the Elasticsearch server, this functionality is Experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features. This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded.</remarks>
100100
[MapsApi("fleet.search", "index, body")]
101101
public Task<TResponse> SearchAsync<TResponse>(string index, PostData body, SearchRequestParameters requestParameters = null, CancellationToken ctx = default)
102-
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"{index:index}/_fleet/_search"), ctx, body, RequestParams(requestParameters));
102+
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"{index:index}/_fleet/_fleet_search"), ctx, body, RequestParams(requestParameters));
103103
}
104104
}

src/Elasticsearch.Net/ElasticLowLevelClient.Snapshot.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,15 @@ internal LowLevelSnapshotNamespace(ElasticLowLevelClient client): base(client)
4848

4949
///<summary>POST on /_snapshot/{repository}/_cleanup <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html</para></summary>
5050
///<param name = "repository">A repository name</param>
51-
///<param name = "body"></param>
5251
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
53-
public TResponse CleanupRepository<TResponse>(string repository, PostData body, CleanupRepositoryRequestParameters requestParameters = null)
54-
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_snapshot/{repository:repository}/_cleanup"), body, RequestParams(requestParameters));
52+
public TResponse CleanupRepository<TResponse>(string repository, CleanupRepositoryRequestParameters requestParameters = null)
53+
where TResponse : class, IElasticsearchResponse, new() => DoRequest<TResponse>(POST, Url($"_snapshot/{repository:repository}/_cleanup"), null, RequestParams(requestParameters));
5554
///<summary>POST on /_snapshot/{repository}/_cleanup <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/clean-up-snapshot-repo-api.html</para></summary>
5655
///<param name = "repository">A repository name</param>
57-
///<param name = "body"></param>
5856
///<param name = "requestParameters">Request specific configuration such as querystring parameters &amp; request specific connection settings.</param>
59-
[MapsApi("snapshot.cleanup_repository", "repository, body")]
60-
public Task<TResponse> CleanupRepositoryAsync<TResponse>(string repository, PostData body, CleanupRepositoryRequestParameters requestParameters = null, CancellationToken ctx = default)
61-
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_snapshot/{repository:repository}/_cleanup"), ctx, body, RequestParams(requestParameters));
57+
[MapsApi("snapshot.cleanup_repository", "repository")]
58+
public Task<TResponse> CleanupRepositoryAsync<TResponse>(string repository, CleanupRepositoryRequestParameters requestParameters = null, CancellationToken ctx = default)
59+
where TResponse : class, IElasticsearchResponse, new() => DoRequestAsync<TResponse>(POST, Url($"_snapshot/{repository:repository}/_cleanup"), ctx, null, RequestParams(requestParameters));
6260
///<summary>PUT on /_snapshot/{repository}/{snapshot}/_clone/{target_snapshot} <para>https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html</para></summary>
6361
///<param name = "repository">A repository name</param>
6462
///<param name = "snapshot">The name of the snapshot to clone from</param>

0 commit comments

Comments
 (0)