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

Add deprecation warning for GET/POST/PUT cache #4776

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from
Open
Changes from 2 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 @@ -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 @@

}
)
);
)
.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);
})

Check warning on line 102 in src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java#L100-L102

Added lines #L100 - L102 were not covered by tests
.override(Method.POST, (channel, request, client) -> {
deprecationLogger.deprecate(

Check warning on line 104 in src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java#L104

Added line #L104 was not covered by tests
"POST",
"POST is not supported on this endpoint and will be removed in the next major release."
);
methodNotImplemented(channel, Method.POST);
})

Check warning on line 109 in src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java#L108-L109

Added lines #L108 - L109 were not covered by tests
.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);
});

Check warning on line 113 in src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/security/dlic/rest/api/FlushCacheApiAction.java#L111-L113

Added lines #L111 - L113 were not covered by tests

}

@Override
Expand Down
Loading