Skip to content

Commit c65a5fe

Browse files
committed
PR Fixes - Fix support for timeout and master_timeout parameters
1 parent 323caca commit c65a5fe

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

modules/streams/src/main/java/org/elasticsearch/rest/streams/logs/RestSetLogStreamsEnabledAction.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import org.elasticsearch.rest.ServerlessScope;
1818
import org.elasticsearch.rest.action.RestToXContentListener;
1919

20-
import java.io.IOException;
2120
import java.util.List;
21+
import java.util.Set;
2222

2323
import static org.elasticsearch.rest.RestRequest.Method.POST;
2424

@@ -35,7 +35,7 @@ public List<Route> routes() {
3535
}
3636

3737
@Override
38-
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
38+
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
3939
final boolean enabled = request.path().endsWith("_enable");
4040
assert enabled || request.path().endsWith("_disable");
4141
return restChannel -> client.execute(
@@ -49,4 +49,9 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
4949
);
5050
}
5151

52+
@Override
53+
public Set<String> supportedQueryParameters() {
54+
return Set.of(RestUtils.REST_MASTER_TIMEOUT_PARAM, RestUtils.REST_TIMEOUT_PARAM);
55+
}
56+
5257
}

modules/streams/src/main/java/org/elasticsearch/rest/streams/logs/RestStreamsStatusAction.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
import org.elasticsearch.rest.ServerlessScope;
1919
import org.elasticsearch.rest.action.RestToXContentListener;
2020

21-
import java.io.IOException;
21+
import java.util.Collections;
2222
import java.util.List;
23+
import java.util.Set;
2324

2425
import static org.elasticsearch.rest.RestRequest.Method.GET;
2526

@@ -37,12 +38,16 @@ public List<RestHandler.Route> routes() {
3738
}
3839

3940
@Override
40-
protected BaseRestHandler.RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
41+
protected BaseRestHandler.RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) {
4142
return restChannel -> client.execute(
4243
StreamsStatusAction.INSTANCE,
4344
new StreamsStatusAction.Request(RestUtils.getMasterNodeTimeout(request)),
4445
new RestToXContentListener<>(restChannel)
4546
);
4647
}
4748

49+
@Override
50+
public Set<String> supportedQueryParameters() {
51+
return Collections.singleton(RestUtils.REST_MASTER_TIMEOUT_PARAM);
52+
}
4853
}

rest-api-spec/src/main/resources/rest-api-spec/api/streams.logs_disable.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
}
2424
]
2525
},
26-
"params": {}
26+
"params": {
27+
"timeout": {
28+
"type": "time",
29+
"description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error."
30+
},
31+
"master_timeout": {
32+
"type": "time",
33+
"description": "Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error."
34+
}
35+
}
2736
}
2837
}

rest-api-spec/src/main/resources/rest-api-spec/api/streams.logs_enable.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
}
2424
]
2525
},
26-
"params": {}
26+
"params": {
27+
"timeout": {
28+
"type": "time",
29+
"description": "Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error."
30+
},
31+
"master_timeout": {
32+
"type": "time",
33+
"description": "Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error."
34+
}
35+
}
2736
}
2837
}

rest-api-spec/src/main/resources/rest-api-spec/api/streams.status.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,9 @@
2323
]
2424
},
2525
"params": {
26-
"local": {
27-
"type": "boolean",
28-
"description": "Return local information, do not retrieve the state from master node (default: false)"
29-
},
3026
"master_timeout": {
3127
"type": "time",
32-
"description": "Specify timeout for connection to master"
28+
"description": "Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error."
3329
}
3430
}
3531
}

0 commit comments

Comments
 (0)