Skip to content

Commit 75ef83c

Browse files
committed
Add CatTasks
Save the last downloaded branch version for the generated parts of the client, so that this is used if regenerating the client without downloading specs again
1 parent d4211ae commit 75ef83c

File tree

14 files changed

+174
-23
lines changed

14 files changed

+174
-23
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/CodeConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private static string Root
3333
public static string EsNetFolder { get; } = $@"{Root}..\..\..\src\Elasticsearch.Net\";
3434
public static string ViewFolder { get; } = $@"{Root}Views\";
3535
public static string RestSpecificationFolder { get; } = $@"{Root}RestSpecification\";
36+
public static string LastDownloadedVersionFile { get; } = Path.Combine(Root, "last_downloaded_version.txt");
3637

3738
public static readonly Dictionary<string, string> MethodNameOverrides =
3839
(from f in new DirectoryInfo(NestFolder).GetFiles("*.cs", SearchOption.AllDirectories)

src/CodeGeneration/CodeGeneration.LowLevelClient/Program.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,20 @@ static void Main(string[] args)
1919
answer = Console.ReadLine()?.Trim().ToLowerInvariant();
2020
redownloadCoreSpecification = answer == "y";
2121
}
22+
2223
if (redownloadCoreSpecification)
2324
{
2425
Console.Write("Branch to download specification from (default master): ");
2526
downloadBranch = Console.ReadLine()?.Trim();
2627
}
28+
else
29+
{
30+
// read last downloaded branch from file.
31+
if (File.Exists(CodeConfiguration.LastDownloadedVersionFile))
32+
{
33+
downloadBranch = File.ReadAllText(CodeConfiguration.LastDownloadedVersionFile);
34+
}
35+
}
2736

2837
if (redownloadCoreSpecification)
2938
RestSpecDownloader.Download(downloadBranch);

src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecDownloader.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ private RestSpecDownloader(string branch)
5151
pbar.Tick($"Downloaded rest-api-spec to {spec.FolderOnDisk} for branch {branch}");
5252
}
5353
}
54+
55+
File.WriteAllText(CodeConfiguration.LastDownloadedVersionFile, branch);
5456
}
5557

5658
private void DownloadJsonDefinitions(Specification spec, IProgressBar pbar)

src/CodeGeneration/CodeGeneration.LowLevelClient/RestSpecification/Core/root.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
88
<meta charset='utf-8'>
99

10-
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-a9fe177388cff62b13a50c0c406598bf4fcafb67f53ec567fc4c12f7c3862b7d.css" media="all" rel="stylesheet" />
11-
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-9021a4cfc4018fe5a2a77e85faff461096052fae2bbc2568adc831a63edbd461.css" media="all" rel="stylesheet" />
10+
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-d05617edbd0684501ca011b9998eb456541d8156ca96d8ffcfb175827827f62c.css" media="all" rel="stylesheet" />
11+
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-8a7b3d8f4db7e0cf07fa7b41a66e4292720ac2a2c3ce057b0e328d0a14dcb1ee.css" media="all" rel="stylesheet" />
1212

1313

1414
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/site-0996ced1a40a04be84d932b2c830830a2c87259cfb5c41c90ca7fee0c5979e9d.css" media="all" rel="stylesheet" />
1515

1616

17-
<link as="script" href="https://assets-cdn.github.com/assets/frameworks-72d60952acd3f2189ed13fcf70acbc5c16b27bf17851613d47cd59c3881c3c0a.js" rel="preload" />
17+
<link as="script" href="https://assets-cdn.github.com/assets/frameworks-7162beea272a856d06e084945fd8026a47bbb9e7eb295d95b60ea82b26c27296.js" rel="preload" />
1818

19-
<link as="script" href="https://assets-cdn.github.com/assets/github-7a41b69ff9c19929b5b4db958b40d85fe3eb2a6b2cd5275111ab32aa90912487.js" rel="preload" />
19+
<link as="script" href="https://assets-cdn.github.com/assets/github-b488c351cda2e01f720a508ce18a9571ef6e977c006bcb0a5d2324f2a4dcefb1.js" rel="preload" />
2020

2121
<meta http-equiv="X-UA-Compatible" content="IE=edge">
2222
<meta http-equiv="Content-Language" content="en">
@@ -55,7 +55,7 @@
5555
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
5656
<meta name="google-analytics" content="UA-3769691-2">
5757

58-
<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="3CF105D8:234C:322296F:575A221D" name="octolytics-dimension-request_id" />
58+
<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="3CF105D8:73E3:A9C94B7:575F7BB5" name="octolytics-dimension-request_id" />
5959
<meta content="/&lt;user-name&gt;/&lt;repo-name&gt;/files/disambiguate" data-pjax-transient="true" name="analytics-location" />
6060

6161

@@ -68,16 +68,16 @@
6868
<meta name="user-login" content="">
6969

7070
<meta name="expected-hostname" content="github.com">
71-
<meta name="js-proxy-site-detection-payload" content="YmEzZmIwNTEzNDIyYzViN2ZjOWUxN2RlNTdkMTM1MGYxMDI0ZDllNzcxYTkxYWMxODFkMGM3NmVkZjc3NmIwMnx7InJlbW90ZV9hZGRyZXNzIjoiNjAuMjQxLjUuMjE2IiwicmVxdWVzdF9pZCI6IjNDRjEwNUQ4OjIzNEM6MzIyMjk2Rjo1NzVBMjIxRCIsInRpbWVzdGFtcCI6MTQ2NTUyNDc2NX0=">
71+
<meta name="js-proxy-site-detection-payload" content="YTM5NzgzNDA3NDQ3YWQ3YmU0ZGQ0N2E4MzA5MGY4ZjkwNzZlNGIzMmZkMThlZmRkMjRlMTRjZjYxNDMyZWE3Nnx7InJlbW90ZV9hZGRyZXNzIjoiNjAuMjQxLjUuMjE2IiwicmVxdWVzdF9pZCI6IjNDRjEwNUQ4OjczRTM6QTlDOTRCNzo1NzVGN0JCNSIsInRpbWVzdGFtcCI6MTQ2NTg3NTM4Mn0=">
7272

7373

7474
<link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#4078c0">
7575
<link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
7676

77-
<meta name="html-safe-nonce" content="bab19beddd4817c8dbf976b6f6262241da47d082">
78-
<meta content="293a494a18f2f0c51d99adb63e9425d5f04ee578" name="form-nonce" />
77+
<meta name="html-safe-nonce" content="9fe34ff4883b60ecf665716eb1a603dd571aa13e">
78+
<meta content="d95973f9b06efd716a6076985b2423784f323a8d" name="form-nonce" />
7979

80-
<meta http-equiv="x-pjax-version" content="62efa5befe58d176087013e390bce7af">
80+
<meta http-equiv="x-pjax-version" content="0d991aedd39fd69967e97d3f953d7cc7">
8181

8282

8383

@@ -183,7 +183,7 @@
183183
Watch
184184
</a>
185185
<a class="social-count" href="/elastic/elasticsearch/watchers">
186-
1,660
186+
1,663
187187
</a>
188188

189189
</li>
@@ -197,7 +197,7 @@
197197
</a>
198198

199199
<a class="social-count js-social-count" href="/elastic/elasticsearch/stargazers">
200-
16,884
200+
16,920
201201
</a>
202202

203203
</li>
@@ -211,7 +211,7 @@
211211
</a>
212212

213213
<a href="/elastic/elasticsearch/network" class="social-count">
214-
5,708
214+
5,725
215215
</a>
216216
</li>
217217
</ul>
@@ -244,15 +244,15 @@ <h1 class="public ">
244244
<a href="/elastic/elasticsearch/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /elastic/elasticsearch/issues" itemprop="url">
245245
<svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
246246
<span itemprop="name">Issues</span>
247-
<span class="counter">975</span>
247+
<span class="counter">972</span>
248248
<meta itemprop="position" content="2">
249249
</a> </span>
250250

251251
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
252252
<a href="/elastic/elasticsearch/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /elastic/elasticsearch/pulls" itemprop="url">
253253
<svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
254254
<span itemprop="name">Pull requests</span>
255-
<span class="counter">100</span>
255+
<span class="counter">96</span>
256256
<meta itemprop="position" content="3">
257257
</a> </span>
258258

@@ -3818,7 +3818,7 @@ <h1 class="public ">
38183818
<svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
38193819
</a>
38203820
<ul class="site-footer-links">
3821-
<li>&copy; 2016 <span title="0.09588s from github-fe119-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
3821+
<li>&copy; 2016 <span title="0.08668s from github-fe151-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
38223822
<li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
38233823
<li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
38243824
<li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
@@ -3842,8 +3842,8 @@ <h1 class="public ">
38423842

38433843

38443844
<script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/compat-7db58f8b7b91111107fac755dd8b178fe7db0f209ced51fc339c446ad3f8da2b.js"></script>
3845-
<script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-72d60952acd3f2189ed13fcf70acbc5c16b27bf17851613d47cd59c3881c3c0a.js"></script>
3846-
<script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-7a41b69ff9c19929b5b4db958b40d85fe3eb2a6b2cd5275111ab32aa90912487.js"></script>
3845+
<script crossorigin="anonymous" src="https://assets-cdn.github.com/assets/frameworks-7162beea272a856d06e084945fd8026a47bbb9e7eb295d95b60ea82b26c27296.js"></script>
3846+
<script async="async" crossorigin="anonymous" src="https://assets-cdn.github.com/assets/github-b488c351cda2e01f720a508ce18a9571ef6e977c006bcb0a5d2324f2a4dcefb1.js"></script>
38473847

38483848

38493849

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v5.0.0-alpha3
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Nest
4+
{
5+
public class CatTasksRecord : ICatRecord
6+
{
7+
[JsonProperty("action")]
8+
public string Action { get; internal set; }
9+
10+
[JsonProperty("ip")]
11+
public string Ip { get; internal set; }
12+
13+
[JsonProperty("node")]
14+
public string Node { get; internal set; }
15+
16+
[JsonProperty("parent_task_id")]
17+
public string ParentTaskId { get; internal set; }
18+
19+
[JsonProperty("running_time")]
20+
public string RunningTime { get; internal set; }
21+
22+
[JsonProperty("start_time")]
23+
public string StartTime { get; internal set; }
24+
25+
[JsonProperty("task_id")]
26+
public string TaskId { get; internal set; }
27+
28+
[JsonProperty("timestamp")]
29+
public string Timestamp { get; internal set; }
30+
31+
[JsonProperty("type")]
32+
public string Type { get; internal set; }
33+
}
34+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Nest
8+
{
9+
public partial interface ICatTasksRequest { }
10+
11+
public partial class CatTasksRequest { }
12+
13+
public partial class CatTasksDescriptor { }
14+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using Elasticsearch.Net;
5+
6+
namespace Nest
7+
{
8+
public partial interface IElasticClient
9+
{
10+
/// <inheritdoc/>
11+
ICatResponse<CatTasksRecord> CatTasks(Func<CatTasksDescriptor, ICatTasksRequest> selector = null);
12+
13+
/// <inheritdoc/>
14+
ICatResponse<CatTasksRecord> CatTasks(ICatTasksRequest request);
15+
16+
/// <inheritdoc/>
17+
Task<ICatResponse<CatTasksRecord>> CatTasksAsync(Func<CatTasksDescriptor, ICatTasksRequest> selector = null);
18+
19+
/// <inheritdoc/>
20+
Task<ICatResponse<CatTasksRecord>> CatTasksAsync(ICatTasksRequest request);
21+
}
22+
23+
public partial class ElasticClient
24+
{
25+
/// <inheritdoc/>
26+
public ICatResponse<CatTasksRecord> CatTasks(Func<CatTasksDescriptor, ICatTasksRequest> selector = null) =>
27+
this.CatTasks(selector.InvokeOrDefault(new CatTasksDescriptor()));
28+
29+
/// <inheritdoc/>
30+
public ICatResponse<CatTasksRecord> CatTasks(ICatTasksRequest request) =>
31+
this.DoCat<ICatTasksRequest, CatTasksRequestParameters, CatTasksRecord>(
32+
request,
33+
this.LowLevelDispatch.CatTasksDispatch<CatResponse<CatTasksRecord>>);
34+
35+
/// <inheritdoc/>
36+
public Task<ICatResponse<CatTasksRecord>> CatTasksAsync(Func<CatTasksDescriptor, ICatTasksRequest> selector = null) =>
37+
this.CatTasksAsync(selector.InvokeOrDefault(new CatTasksDescriptor()));
38+
39+
/// <inheritdoc/>
40+
public Task<ICatResponse<CatTasksRecord>> CatTasksAsync(ICatTasksRequest request) =>
41+
this.DoCatAsync<ICatTasksRequest, CatTasksRequestParameters, CatTasksRecord>(
42+
request,
43+
this.LowLevelDispatch.CatTasksDispatchAsync<CatResponse<CatTasksRecord>>);
44+
}
45+
}

src/Nest/Nest.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@
297297
<Compile Include="Cat\CatShards\CatShardsRecord.cs" />
298298
<Compile Include="Cat\CatShards\CatShardsRequest.cs" />
299299
<Compile Include="Cat\CatShards\ElasticClient-CatShards.cs" />
300+
<Compile Include="Cat\CatTasks\CatTasksRecord.cs" />
301+
<Compile Include="Cat\CatTasks\CatTasksRequest.cs" />
302+
<Compile Include="Cat\CatTasks\ElasticClient-CatTasks.cs" />
300303
<Compile Include="Cat\CatThreadPool\CatThreadPoolRecord.cs" />
301304
<Compile Include="Cat\CatThreadPool\CatThreadPoolRecordJsonConverter.cs" />
302305
<Compile Include="Cat\CatThreadPool\CatThreadPoolRequest.cs" />

src/Nest/_Generated/_Descriptors.generated.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,6 @@ public partial class CatTasksDescriptor : RequestDescriptorBase<CatTasksDescrip
707707

708708
///<summary>Comma separated list of filters used to reduce the response returned by Elasticsearch</summary>
709709
public CatTasksDescriptor FilterPath(string filter_path) => AssignParam(p=>p.FilterPath(filter_path));
710-
711-
//TODO THIS METHOD IS UNMAPPED!
712-
713710

714711
}
715712

0 commit comments

Comments
 (0)