Skip to content

Commit

Permalink
Add deprecation warning
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Oct 3, 2024
1 parent 777fb59 commit 5825089
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.logging.DeprecationLogger;
import org.opensearch.core.action.ActionListener;
import org.opensearch.rest.RestRequest;
import org.opensearch.rest.RestRequest.Method;
Expand All @@ -29,13 +30,16 @@
import org.opensearch.threadpool.ThreadPool;

import static org.opensearch.security.dlic.rest.api.Responses.internalServerError;
import static org.opensearch.security.dlic.rest.api.Responses.methodNotImplemented;
import static org.opensearch.security.dlic.rest.api.Responses.ok;
import static org.opensearch.security.dlic.rest.support.Utils.addRoutesPrefix;

public class FlushCacheApiAction extends AbstractApiAction {

private final static Logger LOGGER = LogManager.getLogger(FlushCacheApiAction.class);

private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(FlushCacheApiAction.class);

private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new Route(Method.DELETE, "/cache"),
Expand Down Expand Up @@ -91,7 +95,23 @@ public void onFailure(final Exception e) {

}
)
);
)
.override(Method.GET, (channel, request, client) -> {
deprecationLogger.deprecate("GET", "GET is not supported on this endpoint and will be removed in the next major release.");
methodNotImplemented(channel, Method.GET);
})
.override(Method.POST, (channel, request, client) -> {
deprecationLogger.deprecate(
"POST",
"POST is not supported on this endpoint and will be removed in the next major release."
);
methodNotImplemented(channel, Method.GET);
})
.override(Method.PUT, (channel, request, client) -> {
deprecationLogger.deprecate("PUT", "PUT is not supported on this endpoint and will be removed in the next major release.");
methodNotImplemented(channel, Method.PUT);
});

}

@Override
Expand Down

0 comments on commit 5825089

Please sign in to comment.