152
152
import org .opensearch .ml .rest .RestMLUpdateModelGroupAction ;
153
153
import org .opensearch .ml .rest .RestMLUploadModelChunkAction ;
154
154
import org .opensearch .ml .settings .MLCommonsSettings ;
155
+ import org .opensearch .ml .settings .MLFeatureEnabledSetting ;
155
156
import org .opensearch .ml .stats .MLClusterLevelStat ;
156
157
import org .opensearch .ml .stats .MLNodeLevelStat ;
157
158
import org .opensearch .ml .stats .MLStat ;
@@ -221,6 +222,8 @@ public class MachineLearningPlugin extends Plugin implements ActionPlugin {
221
222
222
223
private ConnectorAccessControlHelper connectorAccessControlHelper ;
223
224
225
+ private MLFeatureEnabledSetting mlFeatureEnabledSetting ;
226
+
224
227
@ Override
225
228
public List <ActionHandler <? extends ActionRequest , ? extends ActionResponse >> getActions () {
226
229
return ImmutableList
@@ -330,6 +333,8 @@ public Collection<Object> createComponents(
330
333
mlInputDatasetHandler = new MLInputDatasetHandler (client );
331
334
modelAccessControlHelper = new ModelAccessControlHelper (clusterService , settings );
332
335
connectorAccessControlHelper = new ConnectorAccessControlHelper (clusterService , settings );
336
+ mlFeatureEnabledSetting = new MLFeatureEnabledSetting (clusterService , settings );
337
+
333
338
mlModelChunkUploader = new MLModelChunkUploader (mlIndicesHandler , client , xContentRegistry , modelAccessControlHelper );
334
339
335
340
MLTaskDispatcher mlTaskDispatcher = new MLTaskDispatcher (clusterService , client , settings , nodeHelper );
@@ -436,6 +441,7 @@ public Collection<Object> createComponents(
436
441
mlExecuteTaskRunner ,
437
442
modelAccessControlHelper ,
438
443
connectorAccessControlHelper ,
444
+ mlFeatureEnabledSetting ,
439
445
mlSearchHandler ,
440
446
mlTaskDispatcher ,
441
447
mlModelChunkUploader ,
@@ -460,7 +466,7 @@ public List<RestHandler> getRestHandlers(
460
466
RestMLStatsAction restMLStatsAction = new RestMLStatsAction (mlStats , clusterService , indexUtils , xContentRegistry );
461
467
RestMLTrainingAction restMLTrainingAction = new RestMLTrainingAction ();
462
468
RestMLTrainAndPredictAction restMLTrainAndPredictAction = new RestMLTrainAndPredictAction ();
463
- RestMLPredictionAction restMLPredictionAction = new RestMLPredictionAction (mlModelManager );
469
+ RestMLPredictionAction restMLPredictionAction = new RestMLPredictionAction (mlModelManager , mlFeatureEnabledSetting );
464
470
RestMLExecuteAction restMLExecuteAction = new RestMLExecuteAction ();
465
471
RestMLGetModelAction restMLGetModelAction = new RestMLGetModelAction ();
466
472
RestMLDeleteModelAction restMLDeleteModelAction = new RestMLDeleteModelAction ();
@@ -469,7 +475,11 @@ public List<RestHandler> getRestHandlers(
469
475
RestMLDeleteTaskAction restMLDeleteTaskAction = new RestMLDeleteTaskAction ();
470
476
RestMLSearchTaskAction restMLSearchTaskAction = new RestMLSearchTaskAction ();
471
477
RestMLProfileAction restMLProfileAction = new RestMLProfileAction (clusterService );
472
- RestMLRegisterModelAction restMLRegisterModelAction = new RestMLRegisterModelAction (clusterService , settings );
478
+ RestMLRegisterModelAction restMLRegisterModelAction = new RestMLRegisterModelAction (
479
+ clusterService ,
480
+ settings ,
481
+ mlFeatureEnabledSetting
482
+ );
473
483
RestMLDeployModelAction restMLDeployModelAction = new RestMLDeployModelAction ();
474
484
RestMLUndeployModelAction restMLUndeployModelAction = new RestMLUndeployModelAction (clusterService , settings );
475
485
RestMLRegisterModelMetaAction restMLRegisterModelMetaAction = new RestMLRegisterModelMetaAction (clusterService , settings );
@@ -478,7 +488,7 @@ public List<RestHandler> getRestHandlers(
478
488
RestMLUpdateModelGroupAction restMLUpdateModelGroupAction = new RestMLUpdateModelGroupAction ();
479
489
RestMLSearchModelGroupAction restMLSearchModelGroupAction = new RestMLSearchModelGroupAction ();
480
490
RestMLDeleteModelGroupAction restMLDeleteModelGroupAction = new RestMLDeleteModelGroupAction ();
481
- RestMLCreateConnectorAction restMLCreateConnectorAction = new RestMLCreateConnectorAction ();
491
+ RestMLCreateConnectorAction restMLCreateConnectorAction = new RestMLCreateConnectorAction (mlFeatureEnabledSetting );
482
492
RestMLGetConnectorAction restMLGetConnectorAction = new RestMLGetConnectorAction ();
483
493
RestMLDeleteConnectorAction restMLDeleteConnectorAction = new RestMLDeleteConnectorAction ();
484
494
RestMLSearchConnectorAction restMLSearchConnectorAction = new RestMLSearchConnectorAction ();
@@ -613,7 +623,8 @@ public List<Setting<?>> getSettings() {
613
623
MLCommonsSettings .ML_COMMONS_CONNECTOR_ACCESS_CONTROL_ENABLED ,
614
624
MLCommonsSettings .ML_COMMONS_TRUSTED_CONNECTOR_ENDPOINTS_REGEX ,
615
625
MLCommonsSettings .ML_COMMONS_REMOTE_MODEL_ELIGIBLE_NODE_ROLES ,
616
- MLCommonsSettings .ML_COMMONS_LOCAL_MODEL_ELIGIBLE_NODE_ROLES
626
+ MLCommonsSettings .ML_COMMONS_LOCAL_MODEL_ELIGIBLE_NODE_ROLES ,
627
+ MLCommonsSettings .ML_COMMONS_REMOTE_INFERENCE_ENABLED
617
628
);
618
629
return settings ;
619
630
}
0 commit comments