diff --git a/apps/emqx_cluster_link/src/emqx_cluster_link_api.erl b/apps/emqx_cluster_link/src/emqx_cluster_link_api.erl index 77a77610b..7e70a9ccc 100644 --- a/apps/emqx_cluster_link/src/emqx_cluster_link_api.erl +++ b/apps/emqx_cluster_link/src/emqx_cluster_link_api.erl @@ -22,8 +22,8 @@ -export([ '/cluster/links'/2, - '/cluster/links/:name'/2, - '/cluster/links/:name/metrics'/2 + '/cluster/links/link/:name'/2, + '/cluster/links/link/:name/metrics'/2 ]). -define(CONF_PATH, [cluster, links]). @@ -39,8 +39,8 @@ api_spec() -> paths() -> [ "/cluster/links", - "/cluster/links/:name", - "/cluster/links/:name/metrics" + "/cluster/links/link/:name", + "/cluster/links/link/:name/metrics" ]. schema("/cluster/links") -> @@ -69,9 +69,9 @@ schema("/cluster/links") -> } } }; -schema("/cluster/links/:name") -> +schema("/cluster/links/link/:name") -> #{ - 'operationId' => '/cluster/links/:name', + 'operationId' => '/cluster/links/link/:name', get => #{ description => "Get a cluster link configuration", @@ -117,9 +117,9 @@ schema("/cluster/links/:name") -> } } }; -schema("/cluster/links/:name/metrics") -> +schema("/cluster/links/link/:name/metrics") -> #{ - 'operationId' => '/cluster/links/:name/metrics', + 'operationId' => '/cluster/links/link/:name/metrics', get => #{ description => "Get a cluster link metrics", @@ -173,11 +173,11 @@ fields(node_metrics) -> fun() -> handle_create(Name, Body) end ). -'/cluster/links/:name'(get, #{bindings := #{name := Name}}) -> +'/cluster/links/link/:name'(get, #{bindings := #{name := Name}}) -> with_link(Name, fun(Link) -> handle_lookup(Name, Link) end, not_found()); -'/cluster/links/:name'(put, #{bindings := #{name := Name}, body := Params0}) -> +'/cluster/links/link/:name'(put, #{bindings := #{name := Name}, body := Params0}) -> with_link(Name, fun() -> handle_update(Name, Params0) end, not_found()); -'/cluster/links/:name'(delete, #{bindings := #{name := Name}}) -> +'/cluster/links/link/:name'(delete, #{bindings := #{name := Name}}) -> with_link( Name, fun() -> @@ -192,7 +192,7 @@ fields(node_metrics) -> not_found() ). -'/cluster/links/:name/metrics'(get, #{bindings := #{name := Name}}) -> +'/cluster/links/link/:name/metrics'(get, #{bindings := #{name := Name}}) -> with_link(Name, fun() -> handle_metrics(Name) end, not_found()). %%-------------------------------------------------------------------- diff --git a/apps/emqx_cluster_link/test/emqx_cluster_link_api_SUITE.erl b/apps/emqx_cluster_link/test/emqx_cluster_link_api_SUITE.erl index f4a15a62a..27cbe7532 100644 --- a/apps/emqx_cluster_link/test/emqx_cluster_link_api_SUITE.erl +++ b/apps/emqx_cluster_link/test/emqx_cluster_link_api_SUITE.erl @@ -152,11 +152,11 @@ get_link(Name) -> get_link(SourceOrTargetCluster, Name) -> Host = host(SourceOrTargetCluster), - Path = emqx_mgmt_api_test_util:api_path(Host, [api_root(), Name]), + Path = emqx_mgmt_api_test_util:api_path(Host, [api_root(), "link", Name]), emqx_mgmt_api_test_util:simple_request(get, Path, _Params = ""). delete_link(Name) -> - Path = emqx_mgmt_api_test_util:api_path([api_root(), Name]), + Path = emqx_mgmt_api_test_util:api_path([api_root(), "link", Name]), emqx_mgmt_api_test_util:simple_request(delete, Path, _Params = ""). update_link(Name, Params) -> @@ -164,7 +164,7 @@ update_link(Name, Params) -> update_link(SourceOrTargetCluster, Name, Params) -> Host = host(SourceOrTargetCluster), - Path = emqx_mgmt_api_test_util:api_path(Host, [api_root(), Name]), + Path = emqx_mgmt_api_test_util:api_path(Host, [api_root(), "link", Name]), emqx_mgmt_api_test_util:simple_request(put, Path, Params). create_link(Name, Params0) -> @@ -177,7 +177,7 @@ get_metrics(Name) -> get_metrics(SourceOrTargetCluster, Name) -> Host = host(SourceOrTargetCluster), - Path = emqx_mgmt_api_test_util:api_path(Host, [api_root(), Name, "metrics"]), + Path = emqx_mgmt_api_test_util:api_path(Host, [api_root(), "link", Name, "metrics"]), emqx_mgmt_api_test_util:simple_request(get, Path, _Params = []). host(source) -> "http://127.0.0.1:18083";