Search in sources :

Example 1 with PARAMETER_TASK_ID

use of org.opensearch.ml.utils.RestActionUtils.PARAMETER_TASK_ID in project ml-commons by opensearch-project.

the class RestMLDeleteTaskAction method prepareRequest.

@Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient nodeClient) throws IOException {
    String taskId = restRequest.param(PARAMETER_TASK_ID);
    MLTaskDeleteRequest mlModelDeleteRequest = new MLTaskDeleteRequest(taskId);
    return channel -> nodeClient.execute(MLTaskDeleteAction.INSTANCE, mlModelDeleteRequest, new RestToXContentListener<>(channel));
}
Also used : MLTaskDeleteRequest(org.opensearch.ml.common.transport.task.MLTaskDeleteRequest) List(java.util.List) PARAMETER_TASK_ID(org.opensearch.ml.utils.RestActionUtils.PARAMETER_TASK_ID) NodeClient(org.opensearch.client.node.NodeClient) RestToXContentListener(org.opensearch.rest.action.RestToXContentListener) ImmutableList(com.google.common.collect.ImmutableList) MLTaskDeleteAction(org.opensearch.ml.common.transport.task.MLTaskDeleteAction) Locale(java.util.Locale) RestRequest(org.opensearch.rest.RestRequest) IOException(java.io.IOException) BaseRestHandler(org.opensearch.rest.BaseRestHandler) ML_BASE_URI(org.opensearch.ml.plugin.MachineLearningPlugin.ML_BASE_URI) MLTaskDeleteRequest(org.opensearch.ml.common.transport.task.MLTaskDeleteRequest)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 IOException (java.io.IOException)1 List (java.util.List)1 Locale (java.util.Locale)1 NodeClient (org.opensearch.client.node.NodeClient)1 MLTaskDeleteAction (org.opensearch.ml.common.transport.task.MLTaskDeleteAction)1 MLTaskDeleteRequest (org.opensearch.ml.common.transport.task.MLTaskDeleteRequest)1 ML_BASE_URI (org.opensearch.ml.plugin.MachineLearningPlugin.ML_BASE_URI)1 PARAMETER_TASK_ID (org.opensearch.ml.utils.RestActionUtils.PARAMETER_TASK_ID)1 BaseRestHandler (org.opensearch.rest.BaseRestHandler)1 RestRequest (org.opensearch.rest.RestRequest)1 RestToXContentListener (org.opensearch.rest.action.RestToXContentListener)1