Skip to content

Commit 44502aa

Browse files
codebrainrusscam
authored andcommitted
Implement Index Lifecycle APIs (#3671)
Implement Index Lifecycle APIs (#3671)
1 parent 17950ad commit 44502aa

File tree

68 files changed

+3153
-14
lines changed

Some content is hidden

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

68 files changed

+3153
-14
lines changed

src/CodeGeneration/ApiGenerator/ApiGenerator.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ public class ApiGenerator
2222
{
2323
"ccr.follow_info.json",
2424
"ccr.forget_follower.json",
25-
"ilm.delete_lifecycle.json",
26-
"ilm.explain_lifecycle.json",
27-
"ilm.get_lifecycle.json",
28-
"ilm.get_status.json",
29-
"ilm.move_to_step.json",
30-
"ilm.put_lifecycle.json",
31-
"ilm.remove_policy.json",
32-
"ilm.retry.json",
33-
"ilm.start.json",
34-
"ilm.stop.json",
3525
"indices.freeze.json",
3626
"indices.unfreeze.json",
3727
"xpack.ml.set_upgrade_mode.json",
@@ -179,9 +169,10 @@ private static Dictionary<string, ApiQueryParameters> CreateCommonApiQueryParame
179169
private static string CreateMethodName(string apiEndpointKey)
180170
{
181171
var pascalCased = PascalCase(apiEndpointKey);
182-
if (pascalCased.StartsWith("Security"))
172+
if (pascalCased.StartsWith("Security")
173+
|| pascalCased.StartsWith("Ilm"))
183174
{
184-
pascalCased = "Xpack" + pascalCased;
175+
return "Xpack" + pascalCased;
185176
}
186177
return pascalCased;
187178
}

src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public string ClrTypeName
5050
case "filter_id":
5151
case "id": return Type == "string" ? "Id" : "Ids";
5252
case "category_id": return "CategoryId";
53+
case "policy_id": return "PolicyId";
5354
case "forecast_id": return "ForecastIds";
5455
case "nodes":
5556
case "node_id": return Type == "string" ? "NodeId" : "NodeIds";
@@ -109,7 +110,6 @@ public string InterfaceName
109110
public bool Required { get; set; }
110111
public string Type { get; set; }
111112

112-
113113
private string CleanUpDescription(string value)
114114
{
115115
if (string.IsNullOrWhiteSpace(value)) return value;

src/CodeGeneration/ApiGenerator/Overrides/EndpointOverridesBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public abstract class EndpointOverridesBase : IEndpointOverrides
1212
public virtual IDictionary<string, string> RenameQueryStringParams { get; } = new Dictionary<string, string>();
1313

1414
public virtual IEnumerable<string> RenderPartial { get; } = Enumerable.Empty<string>();
15-
public virtual IEnumerable<string> SkipQueryStringParams { get; } = Enumerable.Empty<string>();
1615

16+
public virtual IEnumerable<string> SkipQueryStringParams { get; } = Enumerable.Empty<string>();
1717

1818
public virtual CsharpMethod PatchMethod(CsharpMethod method) => method;
1919
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"ilm.delete_lifecycle": {
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html",
4+
"methods": [ "DELETE" ],
5+
"url": {
6+
"path": "/_ilm/policy/{policy_id}",
7+
"paths": ["/_ilm/policy/{policy_id}"],
8+
"parts": {
9+
"policy_id": {
10+
"type" : "string",
11+
"description" : "The name of the index lifecycle policy",
12+
"required": true
13+
}
14+
},
15+
"params": {
16+
"master_timeout": {
17+
"type" : "time",
18+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
19+
},
20+
"timeout": {
21+
"type" : "time",
22+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
23+
}
24+
}
25+
},
26+
"body": null
27+
}
28+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ilm.explain_lifecycle": {
3+
"url": {
4+
"parts": {
5+
"index": {
6+
"required": true
7+
}
8+
},
9+
"params": {
10+
"master_timeout": {
11+
"type" : "time",
12+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
13+
},
14+
"timeout": {
15+
"type" : "time",
16+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
17+
}
18+
}
19+
}
20+
}
21+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"ilm.get_lifecycle": {
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html",
4+
"methods": [ "GET" ],
5+
"url": {
6+
"path": "/_ilm/policy/{policy_id}",
7+
"paths": ["/_ilm/policy/{policy_id}", "/_ilm/policy"],
8+
"parts": {
9+
"policy_id": {
10+
"type" : "string",
11+
"description" : "The name of the index lifecycle policy"
12+
}
13+
},
14+
"params": {
15+
"master_timeout": {
16+
"type" : "time",
17+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
18+
},
19+
"timeout": {
20+
"type" : "time",
21+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
22+
}
23+
}
24+
},
25+
"body": null
26+
}
27+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"ilm.get_status": {
3+
"url": {
4+
"params": {
5+
"master_timeout": {
6+
"type" : "time",
7+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
8+
},
9+
"timeout": {
10+
"type" : "time",
11+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
12+
}
13+
}
14+
}
15+
}
16+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ilm.move_to_step": {
3+
"url": {
4+
"parts": {
5+
"index": {
6+
"required": true
7+
}
8+
},
9+
"params": {
10+
"master_timeout": {
11+
"type" : "time",
12+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
13+
},
14+
"timeout": {
15+
"type" : "time",
16+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
17+
}
18+
}
19+
}
20+
}
21+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"ilm.put_lifecycle": {
3+
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html",
4+
"methods": [ "PUT" ],
5+
"url": {
6+
"path": "/_ilm/policy/{policy_id}",
7+
"paths": ["/_ilm/policy/{policy_id}"],
8+
"parts": {
9+
"policy_id": {
10+
"type" : "string",
11+
"description" : "The name of the index lifecycle policy",
12+
"required": true
13+
}
14+
},
15+
"params": {
16+
"master_timeout": {
17+
"type" : "time",
18+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
19+
},
20+
"timeout": {
21+
"type" : "time",
22+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
23+
}
24+
}
25+
},
26+
"body": {
27+
"description": "The lifecycle policy definition to register"
28+
}
29+
}
30+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ilm.remove_policy": {
3+
"url": {
4+
"parts": {
5+
"index": {
6+
"required": true
7+
}
8+
},
9+
"params": {
10+
"master_timeout": {
11+
"type" : "time",
12+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
13+
},
14+
"timeout": {
15+
"type" : "time",
16+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
17+
}
18+
}
19+
}
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"ilm.retry": {
3+
"url": {
4+
"parts": {
5+
"index": {
6+
"required": true
7+
}
8+
},
9+
"params": {
10+
"master_timeout": {
11+
"type" : "time",
12+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
13+
},
14+
"timeout": {
15+
"type" : "time",
16+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
17+
}
18+
}
19+
}
20+
}
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"ilm.start": {
3+
"url": {
4+
"params": {
5+
"master_timeout": {
6+
"type" : "time",
7+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
8+
},
9+
"timeout": {
10+
"type" : "time",
11+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
12+
}
13+
}
14+
}
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"ilm.stop": {
3+
"url": {
4+
"params": {
5+
"master_timeout": {
6+
"type" : "time",
7+
"description" : "Specifies the period of time to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
8+
},
9+
"timeout": {
10+
"type" : "time",
11+
"description" : "Specifies the period of time to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Defaults to 30s."
12+
}
13+
}
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)