131131import java .util .Map ;
132132import java .util .function .Predicate ;
133133import java .util .function .Supplier ;
134- import java .util .stream .Stream ;
135134
136135import static java .util .Collections .singletonList ;
137136import static org .elasticsearch .xpack .inference .services .elastic .ElasticInferenceService .ELASTIC_INFERENCE_SERVICE_IDENTIFIER ;
@@ -193,24 +192,17 @@ public InferencePlugin(Settings settings) {
193192
194193 @ Override
195194 public List <ActionHandler <? extends ActionRequest , ? extends ActionResponse >> getActions () {
196- var availableActions = List .of (
195+ return List .of (
197196 new ActionHandler <>(InferenceAction .INSTANCE , TransportInferenceAction .class ),
198-
199197 new ActionHandler <>(GetInferenceModelAction .INSTANCE , TransportGetInferenceModelAction .class ),
200198 new ActionHandler <>(PutInferenceModelAction .INSTANCE , TransportPutInferenceModelAction .class ),
201199 new ActionHandler <>(UpdateInferenceModelAction .INSTANCE , TransportUpdateInferenceModelAction .class ),
202200 new ActionHandler <>(DeleteInferenceEndpointAction .INSTANCE , TransportDeleteInferenceEndpointAction .class ),
203201 new ActionHandler <>(XPackUsageFeatureAction .INFERENCE , TransportInferenceUsageAction .class ),
204202 new ActionHandler <>(GetInferenceDiagnosticsAction .INSTANCE , TransportGetInferenceDiagnosticsAction .class ),
205- new ActionHandler <>(GetInferenceServicesAction .INSTANCE , TransportGetInferenceServicesAction .class )
203+ new ActionHandler <>(GetInferenceServicesAction .INSTANCE , TransportGetInferenceServicesAction .class ),
204+ new ActionHandler <>(UnifiedCompletionAction .INSTANCE , TransportUnifiedCompletionInferenceAction .class )
206205 );
207-
208- List <ActionHandler <? extends ActionRequest , ? extends ActionResponse >> conditionalActions =
209- UnifiedCompletionFeature .UNIFIED_COMPLETION_FEATURE_FLAG .isEnabled ()
210- ? List .of (new ActionHandler <>(UnifiedCompletionAction .INSTANCE , TransportUnifiedCompletionInferenceAction .class ))
211- : List .of ();
212-
213- return Stream .concat (availableActions .stream (), conditionalActions .stream ()).toList ();
214206 }
215207
216208 @ Override
@@ -225,21 +217,17 @@ public List<RestHandler> getRestHandlers(
225217 Supplier <DiscoveryNodes > nodesInCluster ,
226218 Predicate <NodeFeature > clusterSupportsFeature
227219 ) {
228- var availableRestActions = List .of (
220+ return List .of (
229221 new RestInferenceAction (),
230222 new RestStreamInferenceAction (threadPoolSetOnce ),
231223 new RestGetInferenceModelAction (),
232224 new RestPutInferenceModelAction (),
233225 new RestUpdateInferenceModelAction (),
234226 new RestDeleteInferenceEndpointAction (),
235227 new RestGetInferenceDiagnosticsAction (),
236- new RestGetInferenceServicesAction ()
228+ new RestGetInferenceServicesAction (),
229+ new RestUnifiedCompletionInferenceAction (threadPoolSetOnce )
237230 );
238- List <RestHandler > conditionalRestActions = UnifiedCompletionFeature .UNIFIED_COMPLETION_FEATURE_FLAG .isEnabled ()
239- ? List .of (new RestUnifiedCompletionInferenceAction (threadPoolSetOnce ))
240- : List .of ();
241-
242- return Stream .concat (availableRestActions .stream (), conditionalRestActions .stream ()).toList ();
243231 }
244232
245233 @ Override
0 commit comments