-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Delete forecast API #3591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Delete forecast API #3591
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6309891
Avoid doing string concat when not needed
Henr1k80 4aa8ad1
Implement Delete Forecast API + integration tests
codebrain 06474b1
Implement custom type for forecast_id to capture comma delimited list.
codebrain 7ad853c
Address PR comments.
codebrain b9dccba
ForecastIds type, null is used instead of new List<string>() on const…
codebrain 0304296
ForecastIds type, reverse prior commi, prefer empty lists over null v…
codebrain 596968e
Merge branch '6.6' into feature/ml-api-delete-forecast
b9ef0ad
Fix ambiguous method invocation.
codebrain 140d45c
Merge branch 'feature/ml-api-delete-forecast' of github.com:elastic/e…
codebrain ae6480b
Fix ForecastIds GetHashCode implementation
russcam 7b43e9c
Fix ForecastIds Equality and Hashcode implementations
russcam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.delete_forecast.patch.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"xpack.ml.delete_forecast": { | ||
"url": { | ||
"path": "/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}", | ||
"paths": [ | ||
"/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}" | ||
], | ||
"parts": { | ||
"forecast_id": { | ||
"required": true, | ||
"description": "The ID of the forecast to delete, can be comma delimited list or `_all`" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/Nest/XPack/MachineLearning/DeleteForecast/DeleteForecastRequest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Nest | ||
{ | ||
public partial interface IDeleteForecastRequest { } | ||
|
||
public partial class DeleteForecastRequest { } | ||
|
||
[DescriptorFor("XpackMlDeleteForecast")] | ||
public partial class DeleteForecastDescriptor { } | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Nest/XPack/MachineLearning/DeleteForecast/DeleteForecastResponse.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Nest | ||
{ | ||
public interface IDeleteForecastResponse : IAcknowledgedResponse { } | ||
|
||
public class DeleteForecastResponse : AcknowledgedResponseBase, IDeleteForecastResponse { } | ||
} |
56 changes: 56 additions & 0 deletions
56
src/Nest/XPack/MachineLearning/DeleteForecast/ElasticClient-DeleteForecast.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Elasticsearch.Net; | ||
|
||
namespace Nest | ||
{ | ||
public partial interface IElasticClient | ||
{ | ||
/// <summary> | ||
/// Deletes forecasts from a machine learning job. | ||
/// </summary> | ||
IDeleteForecastResponse DeleteForecast(Id jobId, Id forecastId, Func<DeleteForecastDescriptor, IDeleteForecastRequest> selector = null); | ||
|
||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
IDeleteForecastResponse DeleteForecast(IDeleteForecastRequest request); | ||
|
||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
Task<IDeleteForecastResponse> DeleteForecastAsync(Id jobId, Id forecastId, Func<DeleteForecastDescriptor, IDeleteForecastRequest> selector = null, | ||
CancellationToken cancellationToken = default(CancellationToken) | ||
); | ||
|
||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
Task<IDeleteForecastResponse> DeleteForecastAsync(IDeleteForecastRequest request, | ||
CancellationToken cancellationToken = default(CancellationToken) | ||
); | ||
} | ||
|
||
public partial class ElasticClient | ||
{ | ||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
public IDeleteForecastResponse DeleteForecast(Id jobId, Id forecastId, Func<DeleteForecastDescriptor, IDeleteForecastRequest> selector = null) => | ||
DeleteForecast(selector.InvokeOrDefault(new DeleteForecastDescriptor(jobId, forecastId))); | ||
|
||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
public IDeleteForecastResponse DeleteForecast(IDeleteForecastRequest request) => | ||
Dispatcher.Dispatch<IDeleteForecastRequest, DeleteForecastRequestParameters, DeleteForecastResponse>( | ||
request, | ||
(p, d) => LowLevelDispatch.XpackMlDeleteForecastDispatch<DeleteForecastResponse>(p) | ||
); | ||
|
||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
public Task<IDeleteForecastResponse> DeleteForecastAsync(Id jobId, Id forecastId, | ||
Func<DeleteForecastDescriptor, IDeleteForecastRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) => | ||
DeleteForecastAsync(selector.InvokeOrDefault(new DeleteForecastDescriptor(jobId, forecastId)), cancellationToken); | ||
|
||
/// <inheritdoc cref="DeleteForecast(Nest.IdNest.Id,System.Func{Nest.DeleteForecastDescriptor,Nest.IDeleteForecastRequest})" /> | ||
public Task<IDeleteForecastResponse> DeleteForecastAsync(IDeleteForecastRequest request, | ||
CancellationToken cancellationToken = default(CancellationToken)) => | ||
Dispatcher.DispatchAsync<IDeleteForecastRequest, DeleteForecastRequestParameters, DeleteForecastResponse, IDeleteForecastResponse>( | ||
request, | ||
cancellationToken, | ||
(p, d, c) => LowLevelDispatch.XpackMlDeleteForecastDispatchAsync<DeleteForecastResponse>(p, c) | ||
); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.