Skip to content

Commit 3f1b7f2

Browse files
codebrainrusscam
authored andcommitted
Fix/ml close job (#3737)
* Remove optional body declaraion from xpack.ml.close_job specification * Regenerate from adjusted specification * Change LLC dispatch to remove PostBody
1 parent c38e3ac commit 3f1b7f2

File tree

5 files changed

+45
-16
lines changed

5 files changed

+45
-16
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"xpack.ml.close_job": {
3+
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html",
4+
"methods": [ "POST" ],
5+
"url": {
6+
"path": "/_xpack/ml/anomaly_detectors/{job_id}/_close",
7+
"paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/_close" ],
8+
"parts": {
9+
"job_id": {
10+
"type": "string",
11+
"required": true,
12+
"description": "The name of the job to close"
13+
}
14+
},
15+
"params": {
16+
"allow_no_jobs": {
17+
"type": "boolean",
18+
"required": false,
19+
"description": "Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)"
20+
},
21+
"force": {
22+
"type": "boolean",
23+
"required": false,
24+
"description": "True if the job should be forcefully closed"
25+
},
26+
"timeout": {
27+
"type": "time",
28+
"description": "Controls the time to wait until a job has closed. Default to 30 minutes"
29+
}
30+
}
31+
}
32+
}
33+
}

src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,16 +3306,14 @@ public TResponse XpackLicensePostStartTrial<TResponse>(StartTrialLicenseRequestP
33063306
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_xpack/license/start_trial"), ctx, null, _params(requestParameters));
33073307
///<summary>POST on /_xpack/ml/anomaly_detectors/{job_id}/_close <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html</para></summary>
33083308
///<param name="job_id">The name of the job to close</param>
3309-
///<param name="body">The URL params optionally sent in the body</param>
33103309
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
3311-
public TResponse XpackMlCloseJob<TResponse>(string job_id, PostData body, CloseJobRequestParameters requestParameters = null)
3312-
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), body, _params(requestParameters));
3310+
public TResponse XpackMlCloseJob<TResponse>(string job_id, CloseJobRequestParameters requestParameters = null)
3311+
where TResponse : class, IElasticsearchResponse, new() => this.DoRequest<TResponse>(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), null, _params(requestParameters));
33133312
///<summary>POST on /_xpack/ml/anomaly_detectors/{job_id}/_close <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html</para></summary>
33143313
///<param name="job_id">The name of the job to close</param>
3315-
///<param name="body">The URL params optionally sent in the body</param>
33163314
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
3317-
public Task<TResponse> XpackMlCloseJobAsync<TResponse>(string job_id, PostData body, CloseJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
3318-
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), ctx, body, _params(requestParameters));
3315+
public Task<TResponse> XpackMlCloseJobAsync<TResponse>(string job_id, CloseJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken))
3316+
where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync<TResponse>(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), ctx, null, _params(requestParameters));
33193317
///<summary>DELETE on /_xpack/ml/calendars/{calendar_id} <para></para></summary>
33203318
///<param name="calendar_id">The ID of the calendar to delete</param>
33213319
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>

src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,14 +2676,12 @@ public partial interface IElasticLowLevelClient
26762676
Task<TResponse> XpackLicensePostStartTrialAsync<TResponse>(StartTrialLicenseRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
26772677
///<summary>POST on /_xpack/ml/anomaly_detectors/{job_id}/_close <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html</para></summary>
26782678
///<param name="job_id">The name of the job to close</param>
2679-
///<param name="body">The URL params optionally sent in the body</param>
26802679
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
2681-
TResponse XpackMlCloseJob<TResponse>(string job_id, PostData body, CloseJobRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new();
2680+
TResponse XpackMlCloseJob<TResponse>(string job_id, CloseJobRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new();
26822681
///<summary>POST on /_xpack/ml/anomaly_detectors/{job_id}/_close <para>http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html</para></summary>
26832682
///<param name="job_id">The name of the job to close</param>
2684-
///<param name="body">The URL params optionally sent in the body</param>
26852683
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
2686-
Task<TResponse> XpackMlCloseJobAsync<TResponse>(string job_id, PostData body, CloseJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
2684+
Task<TResponse> XpackMlCloseJobAsync<TResponse>(string job_id, CloseJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new();
26872685
///<summary>DELETE on /_xpack/ml/calendars/{calendar_id} <para></para></summary>
26882686
///<param name="calendar_id">The ID of the calendar to delete</param>
26892687
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>

src/Nest/XPack/MachineLearning/CloseJob/ElasticClient-CloseJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ICloseJobResponse CloseJob(Id jobId, Func<CloseJobDescriptor, ICloseJobRe
3535
public ICloseJobResponse CloseJob(ICloseJobRequest request) =>
3636
Dispatcher.Dispatch<ICloseJobRequest, CloseJobRequestParameters, CloseJobResponse>(
3737
request,
38-
(p, d) => LowLevelDispatch.XpackMlCloseJobDispatch<CloseJobResponse>(p, d)
38+
(p, d) => LowLevelDispatch.XpackMlCloseJobDispatch<CloseJobResponse>(p)
3939
);
4040

4141
/// <inheritdoc />
@@ -49,7 +49,7 @@ public Task<ICloseJobResponse> CloseJobAsync(Id jobId, Func<CloseJobDescriptor,
4949
Dispatcher.DispatchAsync<ICloseJobRequest, CloseJobRequestParameters, CloseJobResponse, ICloseJobResponse>(
5050
request,
5151
cancellationToken,
52-
(p, d, c) => LowLevelDispatch.XpackMlCloseJobDispatchAsync<CloseJobResponse>(p, d, c)
52+
(p, d, c) => LowLevelDispatch.XpackMlCloseJobDispatchAsync<CloseJobResponse>(p, c)
5353
);
5454
}
5555
}

src/Nest/_Generated/_LowLevelDispatch.generated.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,23 +3594,23 @@ internal partial class LowLevelDispatch
35943594
throw InvalidDispatch("XpackLicensePostStartTrial", p, new [] { POST }, "/_xpack/license/start_trial");
35953595
}
35963596

3597-
internal TResponse XpackMlCloseJobDispatch<TResponse>(IRequest<CloseJobRequestParameters> p,SerializableData<ICloseJobRequest> body) where TResponse : class, IElasticsearchResponse, new()
3597+
internal TResponse XpackMlCloseJobDispatch<TResponse>(IRequest<CloseJobRequestParameters> p) where TResponse : class, IElasticsearchResponse, new()
35983598
{
35993599
switch(p.HttpMethod)
36003600
{
36013601
case POST:
3602-
if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlCloseJob<TResponse>(p.RouteValues.JobId,body,p.RequestParameters);
3602+
if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlCloseJob<TResponse>(p.RouteValues.JobId,p.RequestParameters);
36033603
break;
36043604
}
36053605
throw InvalidDispatch("XpackMlCloseJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_close");
36063606
}
36073607

3608-
internal Task<TResponse> XpackMlCloseJobDispatchAsync<TResponse>(IRequest<CloseJobRequestParameters> p,SerializableData<ICloseJobRequest> body, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new()
3608+
internal Task<TResponse> XpackMlCloseJobDispatchAsync<TResponse>(IRequest<CloseJobRequestParameters> p, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new()
36093609
{
36103610
switch(p.HttpMethod)
36113611
{
36123612
case POST:
3613-
if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlCloseJobAsync<TResponse>(p.RouteValues.JobId,body,p.RequestParameters,ct);
3613+
if (AllSetNoFallback(p.RouteValues.JobId)) return _lowLevel.XpackMlCloseJobAsync<TResponse>(p.RouteValues.JobId,p.RequestParameters,ct);
36143614
break;
36153615
}
36163616
throw InvalidDispatch("XpackMlCloseJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_close");

0 commit comments

Comments
 (0)