From 29b4256169f5b0e71e7a181576269c60344e3b2c Mon Sep 17 00:00:00 2001 From: Mpdreamz Date: Mon, 14 Jun 2021 16:17:13 +0000 Subject: [PATCH] [codegen] master synchronization --- .../RestSpecification/Core/ml.reset_job.json | 36 +++++++++++++++++++ .../RequestParameters.MachineLearning.cs | 11 ++++++ .../ElasticLowLevelClient.MachineLearning.cs | 11 ++++++ 3 files changed, 58 insertions(+) create mode 100644 src/ApiGenerator/RestSpecification/Core/ml.reset_job.json diff --git a/src/ApiGenerator/RestSpecification/Core/ml.reset_job.json b/src/ApiGenerator/RestSpecification/Core/ml.reset_job.json new file mode 100644 index 00000000000..75d2ae410e8 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ml.reset_job.json @@ -0,0 +1,36 @@ +{ + "ml.reset_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html", + "description":"Resets an existing anomaly detection job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ml/anomaly_detectors/{job_id}/_reset", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to reset" + } + } + } + ] + }, + "params":{ + "wait_for_completion":{ + "type":"boolean", + "description":"Should this request wait until the operation has completed before returning", + "default":true + } + } + } +} diff --git a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs index 9a75716b49b..5e1e5c5b01e 100644 --- a/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs +++ b/src/Elasticsearch.Net/Api/RequestParameters/RequestParameters.MachineLearning.cs @@ -685,6 +685,17 @@ public bool? Reassign } } + ///Request options for ResetJob https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html + public class ResetJobRequestParameters : RequestParameters + { + ///Should this request wait until the operation has completed before returning + public bool? WaitForCompletion + { + get => Q("wait_for_completion"); + set => Q("wait_for_completion", value); + } + } + ///Request options for RevertModelSnapshot https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html public class RevertModelSnapshotRequestParameters : RequestParameters { diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs index da63c2e0d32..762a0d0b736 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.MachineLearning.cs @@ -834,6 +834,17 @@ public TResponse PutTrainedModelAlias(string modelId, string modelAli [MapsApi("ml.put_trained_model_alias", "model_id, model_alias")] public Task PutTrainedModelAliasAsync(string modelId, string modelAlias, PutTrainedModelAliasRequestParameters requestParameters = null, CancellationToken ctx = default) where TResponse : class, ITransportResponse, new() => DoRequestAsync(PUT, Url($"_ml/trained_models/{modelId:modelId}/model_aliases/{modelAlias:modelAlias}"), ctx, null, RequestParams(requestParameters)); + ///POST on /_ml/anomaly_detectors/{job_id}/_reset https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html + ///The ID of the job to reset + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse ResetJob(string jobId, ResetJobRequestParameters requestParameters = null) + where TResponse : class, ITransportResponse, new() => DoRequest(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_reset"), null, RequestParams(requestParameters)); + ///POST on /_ml/anomaly_detectors/{job_id}/_reset https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html + ///The ID of the job to reset + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("ml.reset_job", "job_id")] + public Task ResetJobAsync(string jobId, ResetJobRequestParameters requestParameters = null, CancellationToken ctx = default) + where TResponse : class, ITransportResponse, new() => DoRequestAsync(POST, Url($"_ml/anomaly_detectors/{jobId:jobId}/_reset"), ctx, null, RequestParams(requestParameters)); ///POST on /_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html ///The ID of the job to fetch ///The ID of the snapshot to revert to