Skip to content

Commit

Permalink
[Backport 2.x] Fix: remove unnecessary trailing slashes in APIs. (#3978)
Browse files Browse the repository at this point in the history
Backport dadd03f from #3976.

Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent ad40325 commit b8ab43b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ public class ActionGroupsApiAction extends AbstractApiAction {
// legacy mapping for backwards compatibility
// TODO: remove in next version
new Route(Method.GET, "/actiongroup/{name}"),
new Route(Method.GET, "/actiongroup/"),
new Route(Method.GET, "/actiongroup"),
new Route(Method.DELETE, "/actiongroup/{name}"),
new Route(Method.PUT, "/actiongroup/{name}"),

// corrected mapping, introduced in OpenSearch Security
new Route(Method.GET, "/actiongroups/{name}"),
new Route(Method.GET, "/actiongroups/"),
new Route(Method.GET, "/actiongroups"),
new Route(Method.DELETE, "/actiongroups/{name}"),
new Route(Method.PUT, "/actiongroups/{name}"),
new Route(Method.PATCH, "/actiongroups/"),
new Route(Method.PATCH, "/actiongroups"),
new Route(Method.PATCH, "/actiongroups/{name}")

)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@
public class AuditApiAction extends AbstractApiAction {
private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(RestRequest.Method.GET, "/audit/"),
new Route(RestRequest.Method.GET, "/audit"),
new Route(RestRequest.Method.PUT, "/audit/config"),
new Route(RestRequest.Method.PATCH, "/audit/")
new Route(RestRequest.Method.PATCH, "/audit")
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ protected void consumeParameters(final RestRequest request) {
private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(Method.GET, "/user/{name}"),
new Route(Method.GET, "/user/"),
new Route(Method.GET, "/user"),
new Route(Method.POST, "/user/{name}/authtoken"),
new Route(Method.DELETE, "/user/{name}"),
new Route(Method.PUT, "/user/{name}"),

// corrected mapping, introduced in OpenSearch Security
new Route(Method.GET, "/internalusers/{name}"),
new Route(Method.GET, "/internalusers/"),
new Route(Method.GET, "/internalusers"),
new Route(Method.POST, "/internalusers/{name}/authtoken"),
new Route(Method.DELETE, "/internalusers/{name}"),
new Route(Method.PUT, "/internalusers/{name}"),
new Route(Method.PATCH, "/internalusers/"),
new Route(Method.PATCH, "/internalusers"),
new Route(Method.PATCH, "/internalusers/{name}")
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public class NodesDnApiAction extends AbstractApiAction {
private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(Method.GET, "/nodesdn/{name}"),
new Route(Method.GET, "/nodesdn/"),
new Route(Method.GET, "/nodesdn"),
new Route(Method.DELETE, "/nodesdn/{name}"),
new Route(Method.PUT, "/nodesdn/{name}"),
new Route(Method.PATCH, "/nodesdn/"),
new Route(Method.PATCH, "/nodesdn"),
new Route(Method.PATCH, "/nodesdn/{name}")
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public class RolesApiAction extends AbstractApiAction {

private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(Method.GET, "/roles/"),
new Route(Method.GET, "/roles"),
new Route(Method.GET, "/roles/{name}"),
new Route(Method.DELETE, "/roles/{name}"),
new Route(Method.PUT, "/roles/{name}"),
new Route(Method.PATCH, "/roles/"),
new Route(Method.PATCH, "/roles"),
new Route(Method.PATCH, "/roles/{name}")
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public class RolesMappingApiAction extends AbstractApiAction {

private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(Method.GET, "/rolesmapping/"),
new Route(Method.GET, "/rolesmapping"),
new Route(Method.GET, "/rolesmapping/{name}"),
new Route(Method.DELETE, "/rolesmapping/{name}"),
new Route(Method.PUT, "/rolesmapping/{name}"),
new Route(Method.PATCH, "/rolesmapping/"),
new Route(Method.PATCH, "/rolesmapping"),
new Route(Method.PATCH, "/rolesmapping/{name}")
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
*/
public class SecuritySSLCertsApiAction extends AbstractApiAction {
private static final List<Route> ROUTES = addRoutesPrefix(
ImmutableList.of(new Route(Method.GET, "/ssl/certs"), new Route(Method.PUT, "/ssl/{certType}/reloadcerts/"))
ImmutableList.of(new Route(Method.GET, "/ssl/certs"), new Route(Method.PUT, "/ssl/{certType}/reloadcerts"))
);

private final SecurityKeyStore securityKeyStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public class TenantsApiAction extends AbstractApiAction {
private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(Method.GET, "/tenants/{name}"),
new Route(Method.GET, "/tenants/"),
new Route(Method.GET, "/tenants"),
new Route(Method.DELETE, "/tenants/{name}"),
new Route(Method.PUT, "/tenants/{name}"),
new Route(Method.PATCH, "/tenants/"),
new Route(Method.PATCH, "/tenants"),
new Route(Method.PATCH, "/tenants/{name}")
)
);
Expand Down

0 comments on commit b8ab43b

Please sign in to comment.