Skip to content

Run TransportGetComponentTemplateAction on local node #116868

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

Merged
merged 22 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
09c73a2
Run TransportGetComponentTemplateAction on local node
nielsbauman Nov 15, 2024
b67cb8f
Precommit
nielsbauman Nov 15, 2024
96d8665
Update docs/changelog/116868.yaml
nielsbauman Nov 15, 2024
91faa7f
Merge branch 'main' into component-template
nielsbauman Dec 4, 2024
df808dd
Make use of new `TransportLocalClusterStateAction` changes and fix tests
nielsbauman Dec 4, 2024
be1a243
Merge branch 'main' into component-template
nielsbauman Dec 5, 2024
df06c2f
Use correct owner for update annotation
nielsbauman Dec 5, 2024
d52afb8
Merge branch 'main' into component-template
nielsbauman Dec 17, 2024
1cff203
Update docs
nielsbauman Dec 17, 2024
d3df410
Re-add import to fix compilation
nielsbauman Dec 17, 2024
c1e0a93
Merge branch 'main' into component-template
nielsbauman Dec 17, 2024
1369f06
Fix docs
nielsbauman Dec 17, 2024
57ea30e
Move utility method to `RestUtils`
nielsbauman Dec 17, 2024
d0ed335
Merge branch 'main' into component-template
nielsbauman Dec 18, 2024
ecfad45
Try to make docs changes work
nielsbauman Dec 18, 2024
55337b2
Use include, fix syntax
leemthompo Dec 19, 2024
c418d33
Delete docs/changelog/116868.yaml
nielsbauman Dec 19, 2024
132d930
Update docs/changelog/116868.yaml
nielsbauman Dec 19, 2024
939349f
Merge branch 'main' into component-template
nielsbauman Dec 19, 2024
5c49936
Merge branch 'main' into component-template
nielsbauman Dec 23, 2024
51f210b
Consume param in compat mode and add tests
nielsbauman Dec 23, 2024
35eb683
Remove unnecessary test features
nielsbauman Dec 23, 2024
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
Prev Previous commit
Next Next commit
Consume param in compat mode and add tests
  • Loading branch information
nielsbauman committed Dec 23, 2024
commit 51f210b302273e56a34e996d21a5ccac74e84351
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,33 @@
- match: {component_templates.0.component_template.template.lifecycle.enabled: true}
- match: {component_templates.0.component_template.template.lifecycle.data_retention: "10d"}
- is_true: component_templates.0.component_template.template.lifecycle.rollover

---
"Deprecated local parameter":
- requires:
capabilities:
- method: GET
path: /_component_template
capabilities: ["local_param_deprecated"]
test_runner_features: ["capabilities", "warnings"]
reason: Deprecation was implemented with capability

- do:
cluster.get_component_template:
local: true
warnings:
- "the [?local] query parameter to this API has no effect, is now deprecated, and will be removed in a future version"

---
"Deprecated local parameter works in v8 compat mode":
- requires:
test_runner_features: ["capabilities", "warnings", "headers"]

- do:
headers:
Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
Accept: "application/vnd.elasticsearch+json;compatible-with=8"
cluster.get_component_template:
local: true

- exists: component_templates
6 changes: 4 additions & 2 deletions server/src/main/java/org/elasticsearch/rest/RestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,12 @@ public static TimeValue getTimeout(RestRequest restRequest) {
// NOTE: ensure each usage of this method has been deprecated for long enough to remove it.
@UpdateForV10(owner = UpdateForV10.Owner.DISTRIBUTED_COORDINATION)
public static void consumeDeprecatedLocalParameter(RestRequest request) {
if (request.getRestApiVersion() == RestApiVersion.V_8) {
if (request.hasParam("local") == false) {
return;
}
if (request.paramAsBoolean("local", false)) {
// Consume this param just for validation when in BWC mode.
final var local = request.paramAsBoolean("local", false);
if (request.getRestApiVersion() != RestApiVersion.V_8) {
DeprecationLogger.getLogger(TransportLocalClusterStateAction.class)
.critical(
DeprecationCategory.API,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
@ServerlessScope(Scope.PUBLIC)
public class RestGetComponentTemplateAction extends BaseRestHandler {

private static final Set<String> SUPPORTED_CAPABILITIES = Set.of("local_param_deprecated");

@Override
public List<Route> routes() {
return List.of(
Expand Down Expand Up @@ -72,4 +74,8 @@ protected Set<String> responseParams() {
return Settings.FORMAT_PARAMS;
}

@Override
public Set<String> supportedCapabilities() {
return SUPPORTED_CAPABILITIES;
}
}