diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.cluster_manager.json similarity index 67% rename from rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json rename to rest-api-spec/src/main/resources/rest-api-spec/api/cat.cluster_manager.json index 63fe159ee56b8..c1084825546bf 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.master.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.cluster_manager.json @@ -1,17 +1,27 @@ { - "cat.master":{ + "cat.cluster_manager":{ "documentation":{ - "url":"https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html", - "description":"Returns information about the master node." + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-master/", + "description":"Returns information about the cluster-manager node." }, "stability":"stable", "url":{ "paths":[ { - "path":"/_cat/master", + "path":"/_cat/cluster_manager", "methods":[ "GET" ] + }, + { + "path":"/_cat/master", + "methods":[ + "GET" + ], + "deprecated":{ + "version":"2.0.0", + "description":"To promote inclusive language, please use '/_cat/cluster_manager' instead." + } } ] }, @@ -22,7 +32,7 @@ }, "local":{ "type":"boolean", - "description":"Return local information, do not retrieve the state from master node (default: false)" + "description":"Return local information, do not retrieve the state from cluster-manager node (default: false)" }, "master_timeout":{ "type":"time", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml new file mode 100644 index 0000000000000..b0f1c81b56a0e --- /dev/null +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.cluster_manager/10_basic.yml @@ -0,0 +1,46 @@ +setup: + - skip: + features: allowed_warnings + +--- +"Help": + - skip: + version: " - 1.4.99" + reason: "path _cat/cluster_manager is introduced in 2.0.0" + + - do: + cat.cluster_manager: + help: true + allowed_warnings: + - '[GET /_cat/master] is deprecated! Use [GET /_cat/cluster_manager] instead.' + + - match: + $body: | + /^ id .+ \n + host .+ \n + ip .+ \n + node .+ \n + + $/ + +--- +"Test cat cluster_manager output": + - skip: + version: " - 1.4.99" + reason: "path _cat/cluster_manager is introduced in 2.0.0" + + - do: + cat.cluster_manager: {} + allowed_warnings: + - '[GET /_cat/master] is deprecated! Use [GET /_cat/cluster_manager] instead.' + + - match: + $body: | + /^ + ( \S+ \s+ # node id + [-\w.]+ \s+ # host name + (\d{1,3}\.){3}\d{1,3} \s+ # ip address + [-\w.]+ # node name + \n + ) + $/ diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java index 56172e41effe1..1219b419122c6 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java @@ -50,18 +50,19 @@ public class RestMasterAction extends AbstractCatAction { @Override - public List routes() { - return singletonList(new Route(GET, "/_cat/master")); + public List replacedRoutes() { + // The deprecated path will be removed in a future major version. + return singletonList(new ReplacedRoute(GET, "/_cat/cluster_manager", "/_cat/master")); } @Override public String getName() { - return "cat_master_action"; + return "cat_cluster_manager_action"; } @Override protected void documentation(StringBuilder sb) { - sb.append("/_cat/master\n"); + sb.append("/_cat/cluster_manager\n"); } @Override