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

[Backport 2.x] Fix: remove unnecessary trailing slashes in APIs. #3978

Merged
merged 1 commit into from
Jan 23, 2024
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 @@ -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
Loading