Skip to content

Commit d6de587

Browse files
authored
Change SLM endpoint from /_ilm/* to /_slm/* (#41320)
This commit changes the endpoint for snapshot lifecycle management from: ``` GET /_ilm/snapshot/<policy> ``` to: ``` GET /_slm/policy/<policy> ``` It mimics the ILM path only using `slm` instead of `ilm`. Relates to #38461
1 parent 7ea37fe commit d6de587

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/DeleteSnapshotLifecycleAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
public class DeleteSnapshotLifecycleAction extends Action<DeleteSnapshotLifecycleAction.Response> {
2121
public static final DeleteSnapshotLifecycleAction INSTANCE = new DeleteSnapshotLifecycleAction();
22-
public static final String NAME = "cluster:admin/ilm/snapshot/delete";
22+
public static final String NAME = "cluster:admin/slm/delete";
2323

2424
protected DeleteSnapshotLifecycleAction() {
2525
super(NAME);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/ExecuteSnapshotLifecycleAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
public class ExecuteSnapshotLifecycleAction extends Action<ExecuteSnapshotLifecycleAction.Response> {
2828
public static final ExecuteSnapshotLifecycleAction INSTANCE = new ExecuteSnapshotLifecycleAction();
29-
public static final String NAME = "cluster:admin/ilm/snapshot/execute";
29+
public static final String NAME = "cluster:admin/slm/execute";
3030

3131
protected ExecuteSnapshotLifecycleAction() {
3232
super(NAME);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/GetSnapshotLifecycleAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
public class GetSnapshotLifecycleAction extends Action<GetSnapshotLifecycleAction.Response> {
2727
public static final GetSnapshotLifecycleAction INSTANCE = new GetSnapshotLifecycleAction();
28-
public static final String NAME = "cluster:admin/ilm/snapshot/get";
28+
public static final String NAME = "cluster:admin/slm/get";
2929

3030
protected GetSnapshotLifecycleAction() {
3131
super(NAME);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/PutSnapshotLifecycleAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
public class PutSnapshotLifecycleAction extends Action<PutSnapshotLifecycleAction.Response> {
2626
public static final PutSnapshotLifecycleAction INSTANCE = new PutSnapshotLifecycleAction();
27-
public static final String NAME = "cluster:admin/ilm/snapshot/put";
27+
public static final String NAME = "cluster:admin/slm/put";
2828

2929
protected PutSnapshotLifecycleAction() {
3030
super(NAME);

x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/snapshotlifecycle/SnapshotLifecycleIT.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testMissingRepo() throws Exception {
4444
SnapshotLifecyclePolicy policy = new SnapshotLifecyclePolicy("test-policy", "snap",
4545
"*/1 * * * * ?", "missing-repo", Collections.emptyMap());
4646

47-
Request putLifecycle = new Request("PUT", "/_ilm/snapshot/test-policy");
47+
Request putLifecycle = new Request("PUT", "/_slm/policy/test-policy");
4848
XContentBuilder lifecycleBuilder = JsonXContent.contentBuilder();
4949
policy.toXContent(lifecycleBuilder, ToXContent.EMPTY_PARAMS);
5050
putLifecycle.setJsonEntity(Strings.toString(lifecycleBuilder));
@@ -86,7 +86,7 @@ public void testFullPolicySnapshot() throws Exception {
8686
assertThat((List<String>)snapResponse.get("indices"), equalTo(Collections.singletonList(indexName)));
8787

8888
// Check that the last success date was written to the cluster state
89-
Request getReq = new Request("GET", "/_ilm/snapshot/" + policyName);
89+
Request getReq = new Request("GET", "/_slm/policy/" + policyName);
9090
Response policyMetadata = client().performRequest(getReq);
9191
Map<String, Object> policyResponseMap;
9292
try (InputStream is = policyMetadata.getEntity().getContent()) {
@@ -105,7 +105,7 @@ public void testFullPolicySnapshot() throws Exception {
105105
assertThat(lastSnapshotName, startsWith("snap-"));
106106
});
107107

108-
Request delReq = new Request("DELETE", "/_ilm/snapshot/" + policyName);
108+
Request delReq = new Request("DELETE", "/_slm/policy/" + policyName);
109109
assertOK(client().performRequest(delReq));
110110

111111
// It's possible there could have been a snapshot in progress when the
@@ -127,7 +127,7 @@ public void testPolicyFailure() throws Exception {
127127

128128
assertBusy(() -> {
129129
// Check that the failure is written to the cluster state
130-
Request getReq = new Request("GET", "/_ilm/snapshot/" + policyName);
130+
Request getReq = new Request("GET", "/_slm/policy/" + policyName);
131131
Response policyMetadata = client().performRequest(getReq);
132132
try (InputStream is = policyMetadata.getEntity().getContent()) {
133133
Map<String, Object> responseMap = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true);
@@ -151,7 +151,7 @@ public void testPolicyFailure() throws Exception {
151151
}
152152
});
153153

154-
Request delReq = new Request("DELETE", "/_ilm/snapshot/" + policyName);
154+
Request delReq = new Request("DELETE", "/_slm/policy/" + policyName);
155155
assertOK(client().performRequest(delReq));
156156
}
157157

@@ -171,11 +171,11 @@ public void testPolicyManualExecution() throws Exception {
171171
createSnapshotPolicy(policyName, "snap", "1 2 3 4 5 ?", repoId, indexName, true);
172172

173173
ResponseException badResp = expectThrows(ResponseException.class,
174-
() -> client().performRequest(new Request("PUT", "/_ilm/snapshot/" + policyName + "-bad/_execute")));
174+
() -> client().performRequest(new Request("PUT", "/_slm/policy/" + policyName + "-bad/_execute")));
175175
assertThat(EntityUtils.toString(badResp.getResponse().getEntity()),
176176
containsString("no such snapshot lifecycle policy [" + policyName + "-bad]"));
177177

178-
Response goodResp = client().performRequest(new Request("PUT", "/_ilm/snapshot/" + policyName + "/_execute"));
178+
Response goodResp = client().performRequest(new Request("PUT", "/_slm/policy/" + policyName + "/_execute"));
179179

180180
try (XContentParser parser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY,
181181
DeprecationHandler.THROW_UNSUPPORTED_OPERATION, EntityUtils.toByteArray(goodResp.getEntity()))) {
@@ -196,7 +196,7 @@ public void testPolicyManualExecution() throws Exception {
196196
});
197197
}
198198

199-
Request delReq = new Request("DELETE", "/_ilm/snapshot/" + policyName);
199+
Request delReq = new Request("DELETE", "/_slm/policy/" + policyName);
200200
assertOK(client().performRequest(delReq));
201201

202202
// It's possible there could have been a snapshot in progress when the
@@ -213,7 +213,7 @@ private void createSnapshotPolicy(String policyName, String snapshotNamePattern,
213213
snapConfig.put("ignore_unavailable", ignoreUnavailable);
214214
SnapshotLifecyclePolicy policy = new SnapshotLifecyclePolicy(policyName, snapshotNamePattern, schedule, repoId, snapConfig);
215215

216-
Request putLifecycle = new Request("PUT", "/_ilm/snapshot/" + policyName);
216+
Request putLifecycle = new Request("PUT", "/_slm/policy/" + policyName);
217217
XContentBuilder lifecycleBuilder = JsonXContent.contentBuilder();
218218
policy.toXContent(lifecycleBuilder, ToXContent.EMPTY_PARAMS);
219219
putLifecycle.setJsonEntity(Strings.toString(lifecycleBuilder));

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/snapshotlifecycle/action/RestDeleteSnapshotLifecycleAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public class RestDeleteSnapshotLifecycleAction extends BaseRestHandler {
1818

1919
public RestDeleteSnapshotLifecycleAction(Settings settings, RestController controller) {
2020
super(settings);
21-
controller.registerHandler(RestRequest.Method.DELETE, "/_ilm/snapshot/{name}", this);
21+
controller.registerHandler(RestRequest.Method.DELETE, "/_slm/policy/{name}", this);
2222
}
2323

2424
@Override
2525
public String getName() {
26-
return "ilm_delete_snapshot_lifecycle";
26+
return "slm_delete_lifecycle";
2727
}
2828

2929
@Override

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/snapshotlifecycle/action/RestExecuteSnapshotLifecycleAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public class RestExecuteSnapshotLifecycleAction extends BaseRestHandler {
2020

2121
public RestExecuteSnapshotLifecycleAction(Settings settings, RestController controller) {
2222
super(settings);
23-
controller.registerHandler(RestRequest.Method.PUT, "/_ilm/snapshot/{name}/_execute", this);
23+
controller.registerHandler(RestRequest.Method.PUT, "/_slm/policy/{name}/_execute", this);
2424
}
2525

2626
@Override
2727
public String getName() {
28-
return "ilm_execute_snapshot_lifecycle";
28+
return "slm_execute_lifecycle";
2929
}
3030

3131
@Override

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/snapshotlifecycle/action/RestGetSnapshotLifecycleAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public class RestGetSnapshotLifecycleAction extends BaseRestHandler {
1919

2020
public RestGetSnapshotLifecycleAction(Settings settings, RestController controller) {
2121
super(settings);
22-
controller.registerHandler(RestRequest.Method.GET, "/_ilm/snapshot", this);
23-
controller.registerHandler(RestRequest.Method.GET, "/_ilm/snapshot/{name}", this);
22+
controller.registerHandler(RestRequest.Method.GET, "/_slm/policy", this);
23+
controller.registerHandler(RestRequest.Method.GET, "/_slm/policy/{name}", this);
2424
}
2525

2626
@Override
2727
public String getName() {
28-
return "ilm_get_snapshot_lifecycle";
28+
return "slm_get_lifecycle";
2929
}
3030

3131
@Override

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/snapshotlifecycle/action/RestPutSnapshotLifecycleAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public class RestPutSnapshotLifecycleAction extends BaseRestHandler {
2121

2222
public RestPutSnapshotLifecycleAction(Settings settings, RestController controller) {
2323
super(settings);
24-
controller.registerHandler(RestRequest.Method.PUT, "/_ilm/snapshot/{name}", this);
24+
controller.registerHandler(RestRequest.Method.PUT, "/_slm/policy/{name}", this);
2525
}
2626

2727
@Override
2828
public String getName() {
29-
return "ilm_put_snapshot_lifecycle";
29+
return "slm_put_lifecycle";
3030
}
3131

3232
@Override

0 commit comments

Comments
 (0)