Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change SLM endpoint from /_ilm/* to /_slm/* #41320

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

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

protected DeleteSnapshotLifecycleAction() {
super(NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public class ExecuteSnapshotLifecycleAction extends Action<ExecuteSnapshotLifecycleAction.Response> {
public static final ExecuteSnapshotLifecycleAction INSTANCE = new ExecuteSnapshotLifecycleAction();
public static final String NAME = "cluster:admin/ilm/snapshot/execute";
public static final String NAME = "cluster:admin/slm/execute";

protected ExecuteSnapshotLifecycleAction() {
super(NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

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

protected GetSnapshotLifecycleAction() {
super(NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

protected PutSnapshotLifecycleAction() {
super(NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void testMissingRepo() throws Exception {
SnapshotLifecyclePolicy policy = new SnapshotLifecyclePolicy("test-policy", "snap",
"*/1 * * * * ?", "missing-repo", Collections.emptyMap());

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

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

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

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

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

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

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

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

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

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

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

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

Request putLifecycle = new Request("PUT", "/_ilm/snapshot/" + policyName);
Request putLifecycle = new Request("PUT", "/_slm/policy/" + policyName);
XContentBuilder lifecycleBuilder = JsonXContent.contentBuilder();
policy.toXContent(lifecycleBuilder, ToXContent.EMPTY_PARAMS);
putLifecycle.setJsonEntity(Strings.toString(lifecycleBuilder));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class RestDeleteSnapshotLifecycleAction extends BaseRestHandler {

public RestDeleteSnapshotLifecycleAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.DELETE, "/_ilm/snapshot/{name}", this);
controller.registerHandler(RestRequest.Method.DELETE, "/_slm/policy/{name}", this);
}

@Override
public String getName() {
return "ilm_delete_snapshot_lifecycle";
return "slm_delete_lifecycle";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public class RestExecuteSnapshotLifecycleAction extends BaseRestHandler {

public RestExecuteSnapshotLifecycleAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/_ilm/snapshot/{name}/_execute", this);
controller.registerHandler(RestRequest.Method.PUT, "/_slm/policy/{name}/_execute", this);
}

@Override
public String getName() {
return "ilm_execute_snapshot_lifecycle";
return "slm_execute_lifecycle";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public class RestGetSnapshotLifecycleAction extends BaseRestHandler {

public RestGetSnapshotLifecycleAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.GET, "/_ilm/snapshot", this);
controller.registerHandler(RestRequest.Method.GET, "/_ilm/snapshot/{name}", this);
controller.registerHandler(RestRequest.Method.GET, "/_slm/policy", this);
controller.registerHandler(RestRequest.Method.GET, "/_slm/policy/{name}", this);
}

@Override
public String getName() {
return "ilm_get_snapshot_lifecycle";
return "slm_get_lifecycle";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public class RestPutSnapshotLifecycleAction extends BaseRestHandler {

public RestPutSnapshotLifecycleAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(RestRequest.Method.PUT, "/_ilm/snapshot/{name}", this);
controller.registerHandler(RestRequest.Method.PUT, "/_slm/policy/{name}", this);
}

@Override
public String getName() {
return "ilm_put_snapshot_lifecycle";
return "slm_put_lifecycle";
}

@Override
Expand Down