From c5dea4acc835e0f7d1fc8c9d22b38a1ae770e59e Mon Sep 17 00:00:00 2001 From: Stuart Cam Date: Wed, 6 Mar 2019 14:17:14 +1100 Subject: [PATCH] Ml calendar apis (#3569) --- .../ApiGenerator/ApiGenerator.cs | 9 - .../ApiGenerator/Domain/ApiUrlPart.cs | 2 + .../Endpoints/GetCalendarEventsOverrides.cs | 13 ++ .../Endpoints/GetCalendarsOverrides.cs | 13 ++ .../xpack.ml.get_calendars.patch.json | 7 + .../RequestParameters.Generated.cs | 46 +++++ .../ElasticLowLevelClient.Generated.cs | 120 ++++++++++++ .../IElasticLowLevelClient.Generated.cs | 98 ++++++++++ .../CommonAbstractions/Request/RouteValues.cs | 2 + .../PutMapping/PutMappingRequest.cs | 4 +- .../DeleteCalendar/DeleteCalendarRequest.cs | 9 + .../DeleteCalendar/DeleteCalendarResponse.cs | 6 + .../ElasticClient-DeleteCalendar.cs | 55 ++++++ .../DeleteCalendarEventRequest.cs | 9 + .../DeleteCalendarEventResponse.cs | 6 + .../ElasticClient-DeleteCalendarEvent.cs | 54 ++++++ .../DeleteCalendarJobRequest.cs | 9 + .../DeleteCalendarJobResponse.cs | 30 +++ .../ElasticClient-DeleteCalendarJob.cs | 55 ++++++ .../ElasticClient-GetCalendarEvents.cs | 53 +++++ .../GetCalendarEventsRequest.cs | 48 +++++ .../GetCalendarEventsResponse.cs | 34 ++++ .../ElasticClient-GetCalendars.cs | 55 ++++++ .../GetCalendars/GetCalendarsRequest.cs | 33 ++++ .../GetCalendars/GetCalendarsResponse.cs | 44 +++++ .../GetCategories/GetCategoriesRequest.cs | 8 +- .../GetJobs/ElasticClient-GetJobs.cs | 2 +- .../ElasticClient-PostCalendarEvents.cs | 56 ++++++ .../PostCalendarEventsRequest.cs | 82 ++++++++ .../PostCalendarEventsResponse.cs | 25 +++ .../PutCalendar/ElasticClient-PutCalendar.cs | 56 ++++++ .../PutCalendar/PutCalendarRequest.cs | 33 ++++ .../PutCalendar/PutCalendarResponse.cs | 30 +++ .../ElasticClient-PutCalendarJob.cs | 56 ++++++ .../PutCalendarJob/PutCalendarJobRequest.cs | 15 ++ .../PutCalendarJob/PutCalendarJobResponse.cs | 30 +++ src/Nest/_Generated/_Descriptors.generated.cs | 110 +++++++++++ .../_Generated/_LowLevelDispatch.generated.cs | 182 ++++++++++++++++++ src/Nest/_Generated/_Requests.generated.cs | 153 +++++++++++++++ .../Tests.Configuration/tests.default.yaml | 22 --- .../RequestResponseApiTestBase.cs | 2 + .../TestState/CallUniqueValues.cs | 7 + .../DeleteCalendar/DeleteCalendarApiTests.cs | 55 ++++++ .../DeleteCalendar/DeleteCalendarUrlTests.cs | 17 ++ .../DeleteCalendarEventApiTests.cs | 68 +++++++ .../DeleteCalendarEventUrlTests.cs | 17 ++ .../DeleteCalendarJobApiTests.cs | 67 +++++++ .../DeleteCalendarJobUrlTests.cs | 17 ++ .../GetCalendarEventsApiTests.cs | 69 +++++++ .../GetCalendarEventsUrlTests.cs | 20 ++ .../GetCalendars/GetCalendarsApiTests.cs | 131 +++++++++++++ .../GetCalendars/GetCalendarsUrlTests.cs | 26 +++ .../MachineLearningIntegrationTestBase.cs | 68 +++++++ .../PostCalendarEventsApiTests.cs | 103 ++++++++++ .../PostCalendarEventsUrlTests.cs | 17 ++ .../PutCalendar/PutCalendarApiTests.cs | 63 ++++++ .../PutCalendar/PutCalendarUrlTests.cs | 17 ++ .../PutCalendarJob/PutCalendarJobApiTests.cs | 66 +++++++ .../PutCalendarJob/PutCalendarJobUrlTests.cs | 17 ++ 59 files changed, 2483 insertions(+), 38 deletions(-) create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarEventsOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarsOverrides.cs create mode 100644 src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_calendars.patch.json create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendar/ElasticClient-DeleteCalendar.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendarEvent/ElasticClient-DeleteCalendarEvent.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/DeleteCalendarJob/ElasticClient-DeleteCalendarJob.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCalendarEvents/ElasticClient-GetCalendarEvents.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCalendars/ElasticClient-GetCalendars.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PostCalendarEvents/ElasticClient-PostCalendarEvents.cs create mode 100644 src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PutCalendar/ElasticClient-PutCalendar.cs create mode 100644 src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarResponse.cs create mode 100644 src/Nest/XPack/MachineLearning/PutCalendarJob/ElasticClient-PutCalendarJob.cs create mode 100644 src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobRequest.cs create mode 100644 src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobResponse.cs delete mode 100644 src/Tests/Tests.Configuration/tests.default.yaml create mode 100644 src/Tests/Tests/XPack/MachineLearning/DeleteCalendar/DeleteCalendarApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/DeleteCalendar/DeleteCalendarUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/GetCalendars/GetCalendarsApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/GetCalendars/GetCalendarsUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/PutCalendar/PutCalendarApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/PutCalendar/PutCalendarUrlTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/PutCalendarJob/PutCalendarJobApiTests.cs create mode 100644 src/Tests/Tests/XPack/MachineLearning/PutCalendarJob/PutCalendarJobUrlTests.cs diff --git a/src/CodeGeneration/ApiGenerator/ApiGenerator.cs b/src/CodeGeneration/ApiGenerator/ApiGenerator.cs index 405b0c1ee08..4cdda24d8b9 100644 --- a/src/CodeGeneration/ApiGenerator/ApiGenerator.cs +++ b/src/CodeGeneration/ApiGenerator/ApiGenerator.cs @@ -27,16 +27,7 @@ public class ApiGenerator "rank_eval.json", // these API's are new and need to be mapped - "xpack.ml.delete_calendar.json", - "xpack.ml.delete_calendar_event.json", - "xpack.ml.delete_calendar_job.json", - "xpack.ml.get_calendar_events.json", - "xpack.ml.get_calendars.json", "xpack.ml.info.json", - "xpack.ml.post_calendar_events.json", - "xpack.ml.put_calendar.json", - "xpack.ml.put_calendar_job.json", - "xpack.ml.get_calendar_job.json", "xpack.ml.delete_forecast.json", "xpack.ml.find_file_structure.json", "delete_by_query_rethrottle.json", diff --git a/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs b/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs index dcdfd1bfbce..6eb846f2a09 100644 --- a/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs +++ b/src/CodeGeneration/ApiGenerator/Domain/ApiUrlPart.cs @@ -43,6 +43,8 @@ public string ClrTypeName case "type": return Type == "string" ? "TypeName" : "Types"; case "watch_id": case "job_id": + case "calendar_id": + case "event_id": case "datafeed_id": case "snapshot_id": case "filter_id": diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarEventsOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarEventsOverrides.cs new file mode 100644 index 00000000000..16b6643114e --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarEventsOverrides.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace ApiGenerator.Overrides.Endpoints +{ + public class GetCalendarEventsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarsOverrides.cs b/src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarsOverrides.cs new file mode 100644 index 00000000000..374ad590cb9 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/Overrides/Endpoints/GetCalendarsOverrides.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace ApiGenerator.Overrides.Endpoints +{ + public class GetCalendarsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size" + }; + } +} diff --git a/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_calendars.patch.json b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_calendars.patch.json new file mode 100644 index 00000000000..19987f2ed74 --- /dev/null +++ b/src/CodeGeneration/ApiGenerator/RestSpecification/XPack/MachineLearning/xpack.ml.get_calendars.patch.json @@ -0,0 +1,7 @@ +{ + "xpack.ml.get_calendars": { + "body": { + "description" : "Calendar selection details if not provided in URI" + } + } +} diff --git a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs index 99012a2611c..8476550fb12 100644 --- a/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs +++ b/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs @@ -2354,6 +2354,21 @@ public partial class CloseJobRequestParameters : RequestParametersControls the time to wait until a job has closed. Default to 30 minutes public TimeSpan Timeout { get => Q("timeout"); set => Q("timeout", value); } } + ///Request options for XpackMlDeleteCalendar
+ public partial class DeleteCalendarRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + } + ///Request options for XpackMlDeleteCalendarEvent
+ public partial class DeleteCalendarEventRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + } + ///Request options for XpackMlDeleteCalendarJob
+ public partial class DeleteCalendarJobRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + } ///Request options for XpackMlDeleteDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html
public partial class DeleteDatafeedRequestParameters : RequestParameters { @@ -2397,6 +2412,22 @@ public partial class GetBucketsRequestParameters : RequestParameters HttpMethod.POST; } + ///Request options for XpackMlGetCalendars
+ public partial class GetCalendarsRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + } + ///Request options for XpackMlGetCalendarEvents
+ public partial class GetCalendarEventsRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + ///Get events for the job. When this option is used calendar_id must be '_all' + public string JobId { get => Q("job_id"); set => Q("job_id", value); } + ///Get events after this time + public string Start { get => Q("start"); set => Q("start", value); } + ///Get events before this time + public DateTimeOffset? End { get => Q("end"); set => Q("end", value); } + } ///Request options for XpackMlGetCategories
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html
public partial class GetCategoriesRequestParameters : RequestParameters { @@ -2455,6 +2486,11 @@ public partial class OpenJobRequestParameters : RequestParameters HttpMethod.POST; } + ///Request options for XpackMlPostCalendarEvents
+ public partial class PostCalendarEventsRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + } ///Request options for XpackMlPostData
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html
public partial class PostJobDataRequestParameters : RequestParameters { @@ -2469,6 +2505,16 @@ public partial class PreviewDatafeedRequestParameters : RequestParameters HttpMethod.GET; } + ///Request options for XpackMlPutCalendar
+ public partial class PutCalendarRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + } + ///Request options for XpackMlPutCalendarJob
+ public partial class PutCalendarJobRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + } ///Request options for XpackMlPutDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html
public partial class PutDatafeedRequestParameters : RequestParameters { diff --git a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs index a7c8e0f3d50..9d99eb10187 100644 --- a/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs +++ b/src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs @@ -3164,6 +3164,40 @@ public TResponse XpackMlCloseJob(string job_id, CloseJobRequestParame ///A func that allows you to describe the querystring parameters & request specific connection settings. public Task XpackMlCloseJobAsync(string job_id, CloseJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_close"), ctx, null, _params(requestParameters)); + ///DELETE on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to delete + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlDeleteCalendar(string calendar_id, DeleteCalendarRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(DELETE, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), null, _params(requestParameters)); + ///DELETE on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to delete + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlDeleteCalendarAsync(string calendar_id, DeleteCalendarRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(DELETE, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), ctx, null, _params(requestParameters)); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/events/{event_id} + ///The ID of the calendar to modify + ///The ID of the event to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlDeleteCalendarEvent(string calendar_id, string event_id, DeleteCalendarEventRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(DELETE, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/events/{event_id.NotNull("event_id")}"), null, _params(requestParameters)); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/events/{event_id} + ///The ID of the calendar to modify + ///The ID of the event to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlDeleteCalendarEventAsync(string calendar_id, string event_id, DeleteCalendarEventRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(DELETE, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/events/{event_id.NotNull("event_id")}"), ctx, null, _params(requestParameters)); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlDeleteCalendarJob(string calendar_id, string job_id, DeleteCalendarJobRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(DELETE, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/jobs/{job_id.NotNull("job_id")}"), null, _params(requestParameters)); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlDeleteCalendarJobAsync(string calendar_id, string job_id, DeleteCalendarJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(DELETE, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/jobs/{job_id.NotNull("job_id")}"), ctx, null, _params(requestParameters)); ///DELETE on /_xpack/ml/datafeeds/{datafeed_id} http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html ///The ID of the datafeed to delete ///A func that allows you to describe the querystring parameters & request specific connection settings. @@ -3248,6 +3282,56 @@ public TResponse XpackMlGetBuckets(string job_id, PostData body, GetB ///A func that allows you to describe the querystring parameters & request specific connection settings. public Task XpackMlGetBucketsAsync(string job_id, PostData body, GetBucketsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/results/buckets"), ctx, body, _params(requestParameters)); + ///GET on /_xpack/ml/calendars + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlGetCalendars(GetCalendarsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(GET, Url($"_xpack/ml/calendars"), null, _params(requestParameters)); + ///GET on /_xpack/ml/calendars + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlGetCalendarsAsync(GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(GET, Url($"_xpack/ml/calendars"), ctx, null, _params(requestParameters)); + ///GET on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlGetCalendars(string calendar_id, GetCalendarsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(GET, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), null, _params(requestParameters)); + ///GET on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlGetCalendarsAsync(string calendar_id, GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(GET, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), ctx, null, _params(requestParameters)); + ///POST on /_xpack/ml/calendars + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlGetCalendars(PostData body, GetCalendarsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(POST, Url($"_xpack/ml/calendars"), body, _params(requestParameters)); + ///POST on /_xpack/ml/calendars + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlGetCalendarsAsync(PostData body, GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(POST, Url($"_xpack/ml/calendars"), ctx, body, _params(requestParameters)); + ///POST on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlGetCalendars(string calendar_id, PostData body, GetCalendarsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(POST, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), body, _params(requestParameters)); + ///POST on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlGetCalendarsAsync(string calendar_id, PostData body, GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(POST, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), ctx, body, _params(requestParameters)); + ///GET on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar containing the events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlGetCalendarEvents(string calendar_id, GetCalendarEventsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(GET, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/events"), null, _params(requestParameters)); + ///GET on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar containing the events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlGetCalendarEventsAsync(string calendar_id, GetCalendarEventsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(GET, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/events"), ctx, null, _params(requestParameters)); ///GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id} http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html ///The name of the job ///The identifier of the category definition of interest @@ -3492,6 +3576,18 @@ public TResponse XpackMlOpenJob(string job_id, OpenJobRequestParamete ///A func that allows you to describe the querystring parameters & request specific connection settings. public Task XpackMlOpenJobAsync(string job_id, OpenJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(POST, Url($"_xpack/ml/anomaly_detectors/{job_id.NotNull("job_id")}/_open"), ctx, null, _params(requestParameters)); + ///POST on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar to modify + ///A list of events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlPostCalendarEvents(string calendar_id, PostData body, PostCalendarEventsRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(POST, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/events"), body, _params(requestParameters)); + ///POST on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar to modify + ///A list of events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlPostCalendarEventsAsync(string calendar_id, PostData body, PostCalendarEventsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(POST, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/events"), ctx, body, _params(requestParameters)); ///POST on /_xpack/ml/anomaly_detectors/{job_id}/_data http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html ///The name of the job receiving the data ///The data to process @@ -3514,6 +3610,30 @@ public TResponse XpackMlPreviewDatafeed(string datafeed_id, PreviewDa ///A func that allows you to describe the querystring parameters & request specific connection settings. public Task XpackMlPreviewDatafeedAsync(string datafeed_id, PreviewDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(GET, Url($"_xpack/ml/datafeeds/{datafeed_id.NotNull("datafeed_id")}/_preview"), ctx, null, _params(requestParameters)); + ///PUT on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to create + ///The calendar details + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlPutCalendar(string calendar_id, PostData body, PutCalendarRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(PUT, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), body, _params(requestParameters)); + ///PUT on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to create + ///The calendar details + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlPutCalendarAsync(string calendar_id, PostData body, PutCalendarRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(PUT, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}"), ctx, body, _params(requestParameters)); + ///PUT on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to add to the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public TResponse XpackMlPutCalendarJob(string calendar_id, string job_id, PutCalendarJobRequestParameters requestParameters = null) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequest(PUT, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/jobs/{job_id.NotNull("job_id")}"), null, _params(requestParameters)); + ///PUT on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to add to the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + public Task XpackMlPutCalendarJobAsync(string calendar_id, string job_id, PutCalendarJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) + where TResponse : class, IElasticsearchResponse, new() => this.DoRequestAsync(PUT, Url($"_xpack/ml/calendars/{calendar_id.NotNull("calendar_id")}/jobs/{job_id.NotNull("job_id")}"), ctx, null, _params(requestParameters)); ///PUT on /_xpack/ml/datafeeds/{datafeed_id} http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html ///The ID of the datafeed to create ///The datafeed config diff --git a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs index 05c13f322fe..228c7210cfd 100644 --- a/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs +++ b/src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs @@ -2562,6 +2562,34 @@ public partial interface IElasticLowLevelClient ///The name of the job to close ///A func that allows you to describe the querystring parameters & request specific connection settings. Task XpackMlCloseJobAsync(string job_id, CloseJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///DELETE on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to delete + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlDeleteCalendar(string calendar_id, DeleteCalendarRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///DELETE on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to delete + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlDeleteCalendarAsync(string calendar_id, DeleteCalendarRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/events/{event_id} + ///The ID of the calendar to modify + ///The ID of the event to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlDeleteCalendarEvent(string calendar_id, string event_id, DeleteCalendarEventRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/events/{event_id} + ///The ID of the calendar to modify + ///The ID of the event to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlDeleteCalendarEventAsync(string calendar_id, string event_id, DeleteCalendarEventRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlDeleteCalendarJob(string calendar_id, string job_id, DeleteCalendarJobRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///DELETE on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to remove from the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlDeleteCalendarJobAsync(string calendar_id, string job_id, DeleteCalendarJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); ///DELETE on /_xpack/ml/datafeeds/{datafeed_id} http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html ///The ID of the datafeed to delete ///A func that allows you to describe the querystring parameters & request specific connection settings. @@ -2630,6 +2658,46 @@ public partial interface IElasticLowLevelClient ///Bucket selection details if not provided in URI ///A func that allows you to describe the querystring parameters & request specific connection settings. Task XpackMlGetBucketsAsync(string job_id, PostData body, GetBucketsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///GET on /_xpack/ml/calendars + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlGetCalendars(GetCalendarsRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///GET on /_xpack/ml/calendars + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlGetCalendarsAsync(GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///GET on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlGetCalendars(string calendar_id, GetCalendarsRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///GET on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlGetCalendarsAsync(string calendar_id, GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///POST on /_xpack/ml/calendars + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlGetCalendars(PostData body, GetCalendarsRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///POST on /_xpack/ml/calendars + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlGetCalendarsAsync(PostData body, GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///POST on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlGetCalendars(string calendar_id, PostData body, GetCalendarsRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///POST on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to fetch + ///Calendar selection details if not provided in URI + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlGetCalendarsAsync(string calendar_id, PostData body, GetCalendarsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///GET on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar containing the events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlGetCalendarEvents(string calendar_id, GetCalendarEventsRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///GET on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar containing the events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlGetCalendarEventsAsync(string calendar_id, GetCalendarEventsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); ///GET on /_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id} http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html ///The name of the job ///The identifier of the category definition of interest @@ -2828,6 +2896,16 @@ public partial interface IElasticLowLevelClient ///The ID of the job to open ///A func that allows you to describe the querystring parameters & request specific connection settings. Task XpackMlOpenJobAsync(string job_id, OpenJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///POST on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar to modify + ///A list of events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlPostCalendarEvents(string calendar_id, PostData body, PostCalendarEventsRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///POST on /_xpack/ml/calendars/{calendar_id}/events + ///The ID of the calendar to modify + ///A list of events + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlPostCalendarEventsAsync(string calendar_id, PostData body, PostCalendarEventsRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); ///POST on /_xpack/ml/anomaly_detectors/{job_id}/_data http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html ///The name of the job receiving the data ///The data to process @@ -2846,6 +2924,26 @@ public partial interface IElasticLowLevelClient ///The ID of the datafeed to preview ///A func that allows you to describe the querystring parameters & request specific connection settings. Task XpackMlPreviewDatafeedAsync(string datafeed_id, PreviewDatafeedRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///PUT on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to create + ///The calendar details + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlPutCalendar(string calendar_id, PostData body, PutCalendarRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///PUT on /_xpack/ml/calendars/{calendar_id} + ///The ID of the calendar to create + ///The calendar details + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlPutCalendarAsync(string calendar_id, PostData body, PutCalendarRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); + ///PUT on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to add to the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + TResponse XpackMlPutCalendarJob(string calendar_id, string job_id, PutCalendarJobRequestParameters requestParameters = null) where TResponse : class, IElasticsearchResponse, new(); + ///PUT on /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///The ID of the calendar to modify + ///The ID of the job to add to the calendar + ///A func that allows you to describe the querystring parameters & request specific connection settings. + Task XpackMlPutCalendarJobAsync(string calendar_id, string job_id, PutCalendarJobRequestParameters requestParameters = null, CancellationToken ctx = default(CancellationToken)) where TResponse : class, IElasticsearchResponse, new(); ///PUT on /_xpack/ml/datafeeds/{datafeed_id} http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html ///The ID of the datafeed to create ///The datafeed config diff --git a/src/Nest/CommonAbstractions/Request/RouteValues.cs b/src/Nest/CommonAbstractions/Request/RouteValues.cs index 93821e94cbd..a8156ce2988 100644 --- a/src/Nest/CommonAbstractions/Request/RouteValues.cs +++ b/src/Nest/CommonAbstractions/Request/RouteValues.cs @@ -17,6 +17,8 @@ public class RouteValues public string Fields => GetResolved("fields"); public string FilterId => GetResolved("filter_id"); public string Id => GetResolved("id"); + public string CalendarId => GetResolved("calendar_id"); + public string EventId => GetResolved("event_id"); public string Index => GetResolved("index"); public string IndexMetric => GetResolved("index_metric"); diff --git a/src/Nest/Indices/MappingManagement/PutMapping/PutMappingRequest.cs b/src/Nest/Indices/MappingManagement/PutMapping/PutMappingRequest.cs index 83f599449ee..644abaaeaa2 100644 --- a/src/Nest/Indices/MappingManagement/PutMapping/PutMappingRequest.cs +++ b/src/Nest/Indices/MappingManagement/PutMapping/PutMappingRequest.cs @@ -123,9 +123,9 @@ public PutMappingDescriptor(IndexName index, TypeName type) : base(r => r.Requir /// /// Convenience method to map as much as it can based on ElasticType attributes set on the type. - ///
This method also automatically sets up mappings for known values types (int, long, double, datetime, etcetera)
+ ///
This method also automatically sets up mappings for primitive values types (e.g. int, long, double, DateTime...)
///
Class types default to object and Enums to int
- ///
Later calls can override whatever is set is by this call.
+ ///
Later calls can override whatever is set by this call.
///
public PutMappingDescriptor AutoMap(IPropertyVisitor visitor = null, int maxRecursion = 0) => Assign(a => a.Properties = a.Properties.AutoMap(visitor, maxRecursion)); diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarRequest.cs b/src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarRequest.cs new file mode 100644 index 00000000000..0b8609a5455 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarRequest.cs @@ -0,0 +1,9 @@ +namespace Nest +{ + public partial interface IDeleteCalendarRequest { } + + public partial class DeleteCalendarRequest { } + + [DescriptorFor("XpackMlDeleteCalendar")] + public partial class DeleteCalendarDescriptor { } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarResponse.cs b/src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarResponse.cs new file mode 100644 index 00000000000..4533a084b8b --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendar/DeleteCalendarResponse.cs @@ -0,0 +1,6 @@ +namespace Nest +{ + public interface IDeleteCalendarResponse : IAcknowledgedResponse { } + + public class DeleteCalendarResponse : AcknowledgedResponseBase, IDeleteCalendarResponse { } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendar/ElasticClient-DeleteCalendar.cs b/src/Nest/XPack/MachineLearning/DeleteCalendar/ElasticClient-DeleteCalendar.cs new file mode 100644 index 00000000000..19564c22321 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendar/ElasticClient-DeleteCalendar.cs @@ -0,0 +1,55 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Deletes a machine learning calendar. + /// Removes all scheduled events from the calendar then deletes the calendar. + /// + IDeleteCalendarResponse DeleteCalendar(Id calendarId, Func selector = null); + + /// + IDeleteCalendarResponse DeleteCalendar(IDeleteCalendarRequest request); + + /// + Task DeleteCalendarAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task DeleteCalendarAsync(IDeleteCalendarRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IDeleteCalendarResponse DeleteCalendar(Id calendarId, Func selector = null) => + DeleteCalendar(selector.InvokeOrDefault(new DeleteCalendarDescriptor(calendarId))); + + /// + public IDeleteCalendarResponse DeleteCalendar(IDeleteCalendarRequest request) => + Dispatcher.Dispatch( + request, + (p, d) => LowLevelDispatch.XpackMlDeleteCalendarDispatch(p) + ); + + /// + public Task DeleteCalendarAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + DeleteCalendarAsync(selector.InvokeOrDefault(new DeleteCalendarDescriptor(calendarId)), cancellationToken); + + /// + public Task DeleteCalendarAsync(IDeleteCalendarRequest request, CancellationToken cancellationToken = default(CancellationToken)) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + (p, d, c) => LowLevelDispatch.XpackMlDeleteCalendarDispatchAsync(p, c) + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventRequest.cs b/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventRequest.cs new file mode 100644 index 00000000000..e2f62c46d88 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventRequest.cs @@ -0,0 +1,9 @@ +namespace Nest +{ + public partial interface IDeleteCalendarEventRequest { } + + public partial class DeleteCalendarEventRequest { } + + [DescriptorFor("XpackMlDeleteCalendarEvent")] + public partial class DeleteCalendarEventDescriptor { } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventResponse.cs b/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventResponse.cs new file mode 100644 index 00000000000..6a338b4eb66 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/DeleteCalendarEventResponse.cs @@ -0,0 +1,6 @@ +namespace Nest +{ + public interface IDeleteCalendarEventResponse : IAcknowledgedResponse { } + + public class DeleteCalendarEventResponse : AcknowledgedResponseBase, IDeleteCalendarEventResponse { } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/ElasticClient-DeleteCalendarEvent.cs b/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/ElasticClient-DeleteCalendarEvent.cs new file mode 100644 index 00000000000..a24bb18ca61 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendarEvent/ElasticClient-DeleteCalendarEvent.cs @@ -0,0 +1,54 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Deletes scheduled events from a machine learning calendar. + /// + IDeleteCalendarEventResponse DeleteCalendarEvent(Id calendarId, Id eventId, Func selector = null); + + /// + IDeleteCalendarEventResponse DeleteCalendarEvent(IDeleteCalendarEventRequest request); + + /// + Task DeleteCalendarEventAsync(Id calendarId, Id eventId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task DeleteCalendarEventAsync(IDeleteCalendarEventRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IDeleteCalendarEventResponse DeleteCalendarEvent(Id calendarId, Id eventId, Func selector = null) => + DeleteCalendarEvent(selector.InvokeOrDefault(new DeleteCalendarEventDescriptor(calendarId, eventId))); + + /// + public IDeleteCalendarEventResponse DeleteCalendarEvent(IDeleteCalendarEventRequest request) => + Dispatcher.Dispatch( + request, + (p, d) => LowLevelDispatch.XpackMlDeleteCalendarEventDispatch(p) + ); + + /// + public Task DeleteCalendarEventAsync(Id calendarId, Id eventId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + DeleteCalendarEventAsync(selector.InvokeOrDefault(new DeleteCalendarEventDescriptor(calendarId, eventId)), cancellationToken); + + /// + public Task DeleteCalendarEventAsync(IDeleteCalendarEventRequest request, CancellationToken cancellationToken = default(CancellationToken)) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + (p, d, c) => LowLevelDispatch.XpackMlDeleteCalendarEventDispatchAsync(p, c) + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobRequest.cs b/src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobRequest.cs new file mode 100644 index 00000000000..b906a0a14e6 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobRequest.cs @@ -0,0 +1,9 @@ +namespace Nest +{ + public partial interface IDeleteCalendarJobRequest { } + + public partial class DeleteCalendarJobRequest { } + + [DescriptorFor("XpackMlDeleteCalendarJob")] + public partial class DeleteCalendarJobDescriptor { } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobResponse.cs b/src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobResponse.cs new file mode 100644 index 00000000000..01049491bb8 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendarJob/DeleteCalendarJobResponse.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// The response from deleting a calendar job. + /// + public partial interface IDeleteCalendarJobResponse : IResponse + { + [JsonProperty("calendar_id")] + string CalendarId { get; } + + [JsonProperty("job_ids")] + IReadOnlyCollection JobIds { get; } + + [JsonProperty("description")] + string Description { get; } + } + + /// + public class DeleteCalendarJobResponse : ResponseBase, IDeleteCalendarJobResponse + { + public string CalendarId { get; internal set; } + + public string Description { get; internal set; } + + public IReadOnlyCollection JobIds { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/XPack/MachineLearning/DeleteCalendarJob/ElasticClient-DeleteCalendarJob.cs b/src/Nest/XPack/MachineLearning/DeleteCalendarJob/ElasticClient-DeleteCalendarJob.cs new file mode 100644 index 00000000000..8b63a1ffa61 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/DeleteCalendarJob/ElasticClient-DeleteCalendarJob.cs @@ -0,0 +1,55 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Deletes a machine learning calendar. + /// Removes all scheduled events from the calendar then deletes the calendar. + /// + IDeleteCalendarJobResponse DeleteCalendarJob(Id calendarId, Id jobId, Func selector = null); + + /// + IDeleteCalendarJobResponse DeleteCalendarJob(IDeleteCalendarJobRequest request); + + /// + Task DeleteCalendarJobAsync(Id calendarId, Id jobId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task DeleteCalendarJobAsync(IDeleteCalendarJobRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IDeleteCalendarJobResponse DeleteCalendarJob(Id calendarId, Id jobId, Func selector = null) => + DeleteCalendarJob(selector.InvokeOrDefault(new DeleteCalendarJobDescriptor(calendarId, jobId))); + + /// + public IDeleteCalendarJobResponse DeleteCalendarJob(IDeleteCalendarJobRequest request) => + Dispatcher.Dispatch( + request, + (p, d) => LowLevelDispatch.XpackMlDeleteCalendarJobDispatch(p) + ); + + /// + public Task DeleteCalendarJobAsync(Id calendarId, Id jobId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + DeleteCalendarJobAsync(selector.InvokeOrDefault(new DeleteCalendarJobDescriptor(calendarId, jobId)), cancellationToken); + + /// + public Task DeleteCalendarJobAsync(IDeleteCalendarJobRequest request, CancellationToken cancellationToken = default(CancellationToken)) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + (p, d, c) => LowLevelDispatch.XpackMlDeleteCalendarJobDispatchAsync(p, c) + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCalendarEvents/ElasticClient-GetCalendarEvents.cs b/src/Nest/XPack/MachineLearning/GetCalendarEvents/ElasticClient-GetCalendarEvents.cs new file mode 100644 index 00000000000..ecc0f15c07c --- /dev/null +++ b/src/Nest/XPack/MachineLearning/GetCalendarEvents/ElasticClient-GetCalendarEvents.cs @@ -0,0 +1,53 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Retrieve information about the scheduled events in calendars. + /// + IGetCalendarEventsResponse GetCalendarEvents(Id calendarId, Func selector = null); + + /// + IGetCalendarEventsResponse GetCalendarEvents(IGetCalendarEventsRequest request); + + /// + Task GetCalendarEventsAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task GetCalendarEventsAsync(IGetCalendarEventsRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IGetCalendarEventsResponse GetCalendarEvents(Id calendarId, Func selector = null) => + GetCalendarEvents(selector.InvokeOrDefault(new GetCalendarEventsDescriptor(calendarId))); + + /// + public IGetCalendarEventsResponse GetCalendarEvents(IGetCalendarEventsRequest request) => + Dispatcher.Dispatch( + request, + (p, d) => LowLevelDispatch.XpackMlGetCalendarEventsDispatch(p) + ); + + /// + public Task GetCalendarEventsAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => GetCalendarEventsAsync(selector.InvokeOrDefault(new GetCalendarEventsDescriptor(calendarId)), cancellationToken); + + /// + public Task GetCalendarEventsAsync(IGetCalendarEventsRequest request, CancellationToken cancellationToken = default(CancellationToken)) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + (p, d, c) => LowLevelDispatch.XpackMlGetCalendarEventsDispatchAsync(p, c) + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsRequest.cs b/src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsRequest.cs new file mode 100644 index 00000000000..a999dd0746c --- /dev/null +++ b/src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsRequest.cs @@ -0,0 +1,48 @@ +using System; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// Retrieves configuration information for calendars. + /// + public partial interface IGetCalendarEventsRequest + { + /// + /// Skips a number of events + /// + [JsonProperty("from")] + int? From { get; set; } + + /// + /// Specifies a max number of events to get + /// + [JsonProperty("size")] + int? Size { get; set; } + } + + public partial class GetCalendarEventsRequest + { + /// + public int? From { get; set; } + + /// + public int? Size { get; set; } + } + + [DescriptorFor("XpackMlGetCalendarEvents")] + public partial class GetCalendarEventsDescriptor + { + /// + int? IGetCalendarEventsRequest.From { get; set; } + + /// + int? IGetCalendarEventsRequest.Size { get; set; } + + /// + public GetCalendarEventsDescriptor From(int? from) => Assign(a => a.From = from); + + /// + public GetCalendarEventsDescriptor Size(int? size) => Assign(a => a.Size = size); + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsResponse.cs b/src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsResponse.cs new file mode 100644 index 00000000000..ba6a7cc4f5a --- /dev/null +++ b/src/Nest/XPack/MachineLearning/GetCalendarEvents/GetCalendarEventsResponse.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// Retrieves configuration information for calendars. + /// + public interface IGetCalendarEventsResponse : IResponse + { + /// + /// Count of scheduled event resources. + /// + [JsonProperty("count")] + int Count { get; } + + /// + /// An array of scheduled event resources. + /// + [JsonProperty("events")] + IReadOnlyCollection Events { get; } + } + + public class GetCalendarEventsResponse : ResponseBase, IGetCalendarEventsResponse + { + /// + [JsonProperty("count")] + public int Count { get; internal set; } + + /// + [JsonProperty("events")] + public IReadOnlyCollection Events { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCalendars/ElasticClient-GetCalendars.cs b/src/Nest/XPack/MachineLearning/GetCalendars/ElasticClient-GetCalendars.cs new file mode 100644 index 00000000000..b998214e2f6 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/GetCalendars/ElasticClient-GetCalendars.cs @@ -0,0 +1,55 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Retrieves calendar configuration information for machine learning jobs. + /// + IGetCalendarsResponse GetCalendars(Func selector = null); + + + /// + IGetCalendarsResponse GetCalendars(IGetCalendarsRequest request); + + /// + Task GetCalendarsAsync(Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task GetCalendarsAsync(IGetCalendarsRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IGetCalendarsResponse GetCalendars(Func selector = null) => + GetCalendars(selector.InvokeOrDefault(new GetCalendarsDescriptor())); + + /// + public IGetCalendarsResponse GetCalendars(IGetCalendarsRequest request) => + Dispatcher.Dispatch( + request, + LowLevelDispatch.XpackMlGetCalendarsDispatch + ); + + /// + public Task GetCalendarsAsync(Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + GetCalendarsAsync(selector.InvokeOrDefault(new GetCalendarsDescriptor()), cancellationToken); + + /// + public Task GetCalendarsAsync(IGetCalendarsRequest request, CancellationToken cancellationToken = default(CancellationToken)) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + LowLevelDispatch.XpackMlGetCalendarsDispatchAsync + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsRequest.cs b/src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsRequest.cs new file mode 100644 index 00000000000..eddecf916b7 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsRequest.cs @@ -0,0 +1,33 @@ +using System; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// Retrieves configuration information for calendars. + /// + public partial interface IGetCalendarsRequest + { + /// + /// Specifies pagination for the calendars + /// + [JsonProperty("page")] + IPage Page { get; set; } + } + + public partial class GetCalendarsRequest + { + /// + public IPage Page { get; set; } + } + + [DescriptorFor("XpackMlGetCalendars")] + public partial class GetCalendarsDescriptor + { + /// + IPage IGetCalendarsRequest.Page { get; set; } + + /// + public GetCalendarsDescriptor Page(Func selector) => Assign(a => a.Page = selector?.Invoke(new PageDescriptor())); + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsResponse.cs b/src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsResponse.cs new file mode 100644 index 00000000000..9c227cbf471 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/GetCalendars/GetCalendarsResponse.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// Retrieves configuration information for calendars. + /// + public interface IGetCalendarsResponse : IResponse + { + /// + /// The count of calendars. + /// + [JsonProperty("count")] + long Count { get; } + + /// + /// An array of calendar resources. + /// + [JsonProperty("calendars")] + IReadOnlyCollection Calendars { get; } + } + + public class Calendar + { + [JsonProperty("calendar_id")] + public Id CalendarId { get; set; } + + [JsonProperty("job_ids")] + public IReadOnlyCollection JobIds { get; set; } = EmptyReadOnly.Collection; + + [JsonProperty("description")] + public string Description { get; set; } + } + + public class GetCalendarsResponse : ResponseBase, IGetCalendarsResponse + { + /// + public long Count { get; internal set; } + + /// + public IReadOnlyCollection Calendars { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs b/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs index b53ebfde23c..30dcebac00f 100644 --- a/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs +++ b/src/Nest/XPack/MachineLearning/GetCategories/GetCategoriesRequest.cs @@ -18,18 +18,18 @@ public partial interface IGetCategoriesRequest /// public partial class GetCategoriesRequest { - /// + /// public IPage Page { get; set; } } - /// [DescriptorFor("XpackMlGetCategories")] public partial class GetCategoriesDescriptor { - /// + /// IPage IGetCategoriesRequest.Page { get; set; } - /// + + /// public GetCategoriesDescriptor Page(Func selector) => Assign(a => a.Page = selector?.Invoke(new PageDescriptor())); } } diff --git a/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs b/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs index 0a7f50e56ee..16615927f62 100644 --- a/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs +++ b/src/Nest/XPack/MachineLearning/GetJobs/ElasticClient-GetJobs.cs @@ -8,7 +8,7 @@ namespace Nest public partial interface IElasticClient { /// - /// Retrieves configuration for machine learning jobs. + /// Retrieves machine learning job configuration information /// IGetJobsResponse GetJobs(Func selector = null); diff --git a/src/Nest/XPack/MachineLearning/PostCalendarEvents/ElasticClient-PostCalendarEvents.cs b/src/Nest/XPack/MachineLearning/PostCalendarEvents/ElasticClient-PostCalendarEvents.cs new file mode 100644 index 00000000000..4f627589b3a --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PostCalendarEvents/ElasticClient-PostCalendarEvents.cs @@ -0,0 +1,56 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Creates a machine learning calendar event. + /// + IPostCalendarEventsResponse PostCalendarEvents(Id calendarId, Func selector = null); + + /// + IPostCalendarEventsResponse PostCalendarEvents(IPostCalendarEventsRequest request); + + /// + Task PostCalendarEventsAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task PostCalendarEventsAsync(IPostCalendarEventsRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IPostCalendarEventsResponse PostCalendarEvents(Id calendarId, Func selector = null) + => PostCalendarEvents(selector.InvokeOrDefault(new PostCalendarEventsDescriptor(calendarId))); + + /// + public IPostCalendarEventsResponse PostCalendarEvents(IPostCalendarEventsRequest request) => + Dispatcher.Dispatch( + request, + LowLevelDispatch.XpackMlPostCalendarEventsDispatch + ); + + /// + public Task PostCalendarEventsAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + PostCalendarEventsAsync(selector.InvokeOrDefault(new PostCalendarEventsDescriptor(calendarId)), cancellationToken); + + /// + public Task PostCalendarEventsAsync(IPostCalendarEventsRequest request, + CancellationToken cancellationToken = default(CancellationToken) + ) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + LowLevelDispatch.XpackMlPostCalendarEventsDispatchAsync + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsRequest.cs b/src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsRequest.cs new file mode 100644 index 00000000000..0d9dc8ab943 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsRequest.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Nest +{ + /// + /// Post scheduled events in a calendar. + /// + public partial interface IPostCalendarEventsRequest + { + /// + /// A list of one of more scheduled events. + /// + [JsonProperty("events")] + IEnumerable Events { get; set; } + } + + public class ScheduledEvent + { + /// + /// An identifier for the calendar that contains the scheduled event. + /// + [JsonProperty("calendar_id")] + public Id CalendarId { get; set; } + + /// + /// A description of the scheduled event. + /// + [JsonProperty("description")] + public string Description { get; set; } + + /// + /// The timestamp for the beginning of the scheduled event. + /// + [JsonProperty("start_time")] + [JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))] + public DateTimeOffset? StartTime { get; set; } + + /// + /// The timestamp for the end of the scheduled event. + /// + [JsonProperty("end_time")] + [JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))] + public DateTimeOffset? EndTime { get; set; } + + /// + /// An automatically-generated identifier for the scheduled event. + /// + [JsonProperty("event_id")] + public Id EventId { get; set; } + } + + /// + public partial class PostCalendarEventsRequest + { + /// + [JsonProperty("events")] + public IEnumerable Events { get; set; } + } + + [DescriptorFor("XpackMlPostCalendarEvents")] + public partial class PostCalendarEventsDescriptor + { + /// + IEnumerable IPostCalendarEventsRequest.Events { get; set; } + + /// + public PostCalendarEventsDescriptor Events(IEnumerable events) => Assign(a => a.Events = events); + + /// + public PostCalendarEventsDescriptor Events(params ScheduledEvent[] events) => Assign(a => + { + if (events != null && events.Length == 1 && events[0] is IEnumerable) + a.Events = ((IEnumerable)events[0]).Cast(); + else a.Events = events; + }); + } +} diff --git a/src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsResponse.cs b/src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsResponse.cs new file mode 100644 index 00000000000..f9798b92b3a --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PostCalendarEvents/PostCalendarEventsResponse.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// The response from creating a calendar. + /// + public partial interface IPostCalendarEventsResponse : IResponse + { + /// + /// A list of one of more scheduled events. + /// + [JsonProperty("events")] + IReadOnlyCollection Events { get; } + } + + /// + public class PostCalendarEventsResponse : ResponseBase, IPostCalendarEventsResponse + { + /// + [JsonProperty("events")] + public IReadOnlyCollection Events { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/XPack/MachineLearning/PutCalendar/ElasticClient-PutCalendar.cs b/src/Nest/XPack/MachineLearning/PutCalendar/ElasticClient-PutCalendar.cs new file mode 100644 index 00000000000..b81b5f3aca5 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PutCalendar/ElasticClient-PutCalendar.cs @@ -0,0 +1,56 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Creates a machine learning calendar. + /// + IPutCalendarResponse PutCalendar(Id calendarId, Func selector = null); + + /// + IPutCalendarResponse PutCalendar(IPutCalendarRequest request); + + /// + Task PutCalendarAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task PutCalendarAsync(IPutCalendarRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IPutCalendarResponse PutCalendar(Id calendarId, Func selector = null) + => PutCalendar(selector.InvokeOrDefault(new PutCalendarDescriptor(calendarId))); + + /// + public IPutCalendarResponse PutCalendar(IPutCalendarRequest request) => + Dispatcher.Dispatch( + request, + LowLevelDispatch.XpackMlPutCalendarDispatch + ); + + /// + public Task PutCalendarAsync(Id calendarId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + PutCalendarAsync(selector.InvokeOrDefault(new PutCalendarDescriptor(calendarId)), cancellationToken); + + /// + public Task PutCalendarAsync(IPutCalendarRequest request, + CancellationToken cancellationToken = default(CancellationToken) + ) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + LowLevelDispatch.XpackMlPutCalendarDispatchAsync + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarRequest.cs b/src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarRequest.cs new file mode 100644 index 00000000000..10697e279da --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarRequest.cs @@ -0,0 +1,33 @@ +using System; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// Creates a machine learning calendar. + /// + public partial interface IPutCalendarRequest + { + /// + /// A description of the calendar. + /// + [JsonProperty("description")] + string Description { get; set; } + } + + /// + public partial class PutCalendarRequest + { + /// + public string Description { get; set; } + } + + [DescriptorFor("XpackMlPutCalendar")] + public partial class PutCalendarDescriptor + { + string IPutCalendarRequest.Description { get; set; } + + /// + public PutCalendarDescriptor Description(string description) => Assign(a => a.Description = description); + } +} diff --git a/src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarResponse.cs b/src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarResponse.cs new file mode 100644 index 00000000000..cb3383d4402 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PutCalendar/PutCalendarResponse.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// The response from creating a calendar. + /// + public partial interface IPutCalendarResponse : IResponse + { + [JsonProperty("calendar_id")] + Id CalendarId { get; } + + [JsonProperty("description")] + string Description { get; } + + [JsonProperty("job_ids")] + IReadOnlyCollection JobIds { get; } + } + + /// + public class PutCalendarResponse : ResponseBase, IPutCalendarResponse + { + public Id CalendarId { get; internal set; } + + public string Description { get; internal set; } + + public IReadOnlyCollection JobIds { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/XPack/MachineLearning/PutCalendarJob/ElasticClient-PutCalendarJob.cs b/src/Nest/XPack/MachineLearning/PutCalendarJob/ElasticClient-PutCalendarJob.cs new file mode 100644 index 00000000000..d9c0180fbe3 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PutCalendarJob/ElasticClient-PutCalendarJob.cs @@ -0,0 +1,56 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Elasticsearch.Net; + +namespace Nest +{ + public partial interface IElasticClient + { + /// + /// Adds a job to a machine learning calendar. + /// + IPutCalendarJobResponse PutCalendarJob(Id calendarId, Id jobId, Func selector = null); + + /// + IPutCalendarJobResponse PutCalendarJob(IPutCalendarJobRequest request); + + /// + Task PutCalendarJobAsync(Id calendarId, Id jobId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ); + + /// + Task PutCalendarJobAsync(IPutCalendarJobRequest request, CancellationToken cancellationToken = default(CancellationToken)); + } + + public partial class ElasticClient + { + /// + public IPutCalendarJobResponse PutCalendarJob(Id calendarId, Id jobId, Func selector = null) + => PutCalendarJob(selector.InvokeOrDefault(new PutCalendarJobDescriptor(calendarId, jobId))); + + /// + public IPutCalendarJobResponse PutCalendarJob(IPutCalendarJobRequest request) => + Dispatcher.Dispatch( + request, + (p, d) => LowLevelDispatch.XpackMlPutCalendarJobDispatch(p) + ); + + /// + public Task PutCalendarJobAsync(Id calendarId, Id jobId, Func selector = null, + CancellationToken cancellationToken = default(CancellationToken) + ) => + PutCalendarJobAsync(selector.InvokeOrDefault(new PutCalendarJobDescriptor(calendarId, jobId)), cancellationToken); + + /// + public Task PutCalendarJobAsync(IPutCalendarJobRequest request, + CancellationToken cancellationToken = default(CancellationToken) + ) => + Dispatcher.DispatchAsync( + request, + cancellationToken, + (p, d, c) => LowLevelDispatch.XpackMlPutCalendarJobDispatchAsync(p, c) + ); + } +} diff --git a/src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobRequest.cs b/src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobRequest.cs new file mode 100644 index 00000000000..6d8e2890eb1 --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobRequest.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// Adds a job to a calendar. + /// + public partial interface IPutCalendarJobRequest { } + + /// + public partial class PutCalendarJobRequest { } + + [DescriptorFor("XpackMlPutCalendarJob")] + public partial class PutCalendarJobDescriptor { } +} diff --git a/src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobResponse.cs b/src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobResponse.cs new file mode 100644 index 00000000000..7108d56659f --- /dev/null +++ b/src/Nest/XPack/MachineLearning/PutCalendarJob/PutCalendarJobResponse.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Nest +{ + /// + /// The response from creating a calendar job. + /// + public partial interface IPutCalendarJobResponse : IResponse + { + [JsonProperty("calendar_id")] + Id CalendarId { get; } + + [JsonProperty("job_ids")] + IReadOnlyCollection JobIds { get; } + + [JsonProperty("description")] + string Description { get; } + } + + /// + public class PutCalendarJobResponse : ResponseBase, IPutCalendarJobResponse + { + public Id CalendarId { get; internal set; } + + public string Description { get; internal set; } + + public IReadOnlyCollection JobIds { get; internal set; } = EmptyReadOnly.Collection; + } +} diff --git a/src/Nest/_Generated/_Descriptors.generated.cs b/src/Nest/_Generated/_Descriptors.generated.cs index 24e4fd5032e..dc855874046 100644 --- a/src/Nest/_Generated/_Descriptors.generated.cs +++ b/src/Nest/_Generated/_Descriptors.generated.cs @@ -4142,6 +4142,46 @@ public CloseJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} ///Controls the time to wait until a job has closed. Default to 30 minutes public CloseJobDescriptor Timeout(Time timeout) => Qs("timeout", timeout); } + ///descriptor for XpackMlDeleteCalendar
+ public partial class DeleteCalendarDescriptor : RequestDescriptorBase, IDeleteCalendarRequest + { + /// /_xpack/ml/calendars/{calendar_id} + /// this parameter is required + public DeleteCalendarDescriptor(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IDeleteCalendarRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + + } + ///descriptor for XpackMlDeleteCalendarEvent
+ public partial class DeleteCalendarEventDescriptor : RequestDescriptorBase, IDeleteCalendarEventRequest + { + /// /_xpack/ml/calendars/{calendar_id}/events/{event_id} + /// this parameter is required + /// this parameter is required + public DeleteCalendarEventDescriptor(Id calendar_id, Id event_id) : base(r=>r.Required("calendar_id", calendar_id).Required("event_id", event_id)){} + // values part of the url path + Id IDeleteCalendarEventRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + Id IDeleteCalendarEventRequest.EventId => Self.RouteValues.Get("event_id"); + + // Request parameters + + } + ///descriptor for XpackMlDeleteCalendarJob
+ public partial class DeleteCalendarJobDescriptor : RequestDescriptorBase, IDeleteCalendarJobRequest + { + /// /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + /// this parameter is required + /// this parameter is required + public DeleteCalendarJobDescriptor(Id calendar_id, Id job_id) : base(r=>r.Required("calendar_id", calendar_id).Required("job_id", job_id)){} + // values part of the url path + Id IDeleteCalendarJobRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + Id IDeleteCalendarJobRequest.JobId => Self.RouteValues.Get("job_id"); + + // Request parameters + + } ///descriptor for XpackMlDeleteDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html
public partial class DeleteDatafeedDescriptor : RequestDescriptorBase, IDeleteDatafeedRequest { @@ -4232,6 +4272,38 @@ public GetBucketsDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} // Request parameters } + ///descriptor for XpackMlGetCalendars
+ public partial class GetCalendarsDescriptor : RequestDescriptorBase, IGetCalendarsRequest + { + /// /_xpack/ml/calendars + public GetCalendarsDescriptor() : base(){} + // values part of the url path + Id IGetCalendarsRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + ///The ID of the calendar to fetch + public GetCalendarsDescriptor CalendarId(Id calendarId) => Assign(a=>a.RouteValues.Optional("calendar_id", calendarId)); + + // Request parameters + + } + ///descriptor for XpackMlGetCalendarEvents
+ public partial class GetCalendarEventsDescriptor : RequestDescriptorBase, IGetCalendarEventsRequest + { + /// /_xpack/ml/calendars/{calendar_id}/events + /// this parameter is required + public GetCalendarEventsDescriptor(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IGetCalendarEventsRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + + ///Get events for the job. When this option is used calendar_id must be '_all' + public GetCalendarEventsDescriptor JobId(string jobId) => Qs("job_id", jobId); + ///Get events after this time + public GetCalendarEventsDescriptor Start(string start) => Qs("start", start); + ///Get events before this time + public GetCalendarEventsDescriptor End(DateTimeOffset? end) => Qs("end", end); + } ///descriptor for XpackMlGetCategories
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html
public partial class GetCategoriesDescriptor : RequestDescriptorBase, IGetCategoriesRequest { @@ -4375,6 +4447,18 @@ public OpenJobDescriptor(Id job_id) : base(r=>r.Required("job_id", job_id)){} // Request parameters + } + ///descriptor for XpackMlPostCalendarEvents
+ public partial class PostCalendarEventsDescriptor : RequestDescriptorBase, IPostCalendarEventsRequest + { + /// /_xpack/ml/calendars/{calendar_id}/events + /// this parameter is required + public PostCalendarEventsDescriptor(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IPostCalendarEventsRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + } ///descriptor for XpackMlPostData
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html
public partial class PostJobDataDescriptor : RequestDescriptorBase, IPostJobDataRequest @@ -4403,6 +4487,32 @@ public PreviewDatafeedDescriptor(Id datafeed_id) : base(r=>r.Required("datafeed_ // Request parameters + } + ///descriptor for XpackMlPutCalendar
+ public partial class PutCalendarDescriptor : RequestDescriptorBase, IPutCalendarRequest + { + /// /_xpack/ml/calendars/{calendar_id} + /// this parameter is required + public PutCalendarDescriptor(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IPutCalendarRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + + } + ///descriptor for XpackMlPutCalendarJob
+ public partial class PutCalendarJobDescriptor : RequestDescriptorBase, IPutCalendarJobRequest + { + /// /_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + /// this parameter is required + /// this parameter is required + public PutCalendarJobDescriptor(Id calendar_id, Id job_id) : base(r=>r.Required("calendar_id", calendar_id).Required("job_id", job_id)){} + // values part of the url path + Id IPutCalendarJobRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + Id IPutCalendarJobRequest.JobId => Self.RouteValues.Get("job_id"); + + // Request parameters + } ///descriptor for XpackMlPutDatafeed
http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html
public partial class PutDatafeedDescriptor : RequestDescriptorBase,PutDatafeedRequestParameters, IPutDatafeedRequest>, IPutDatafeedRequest diff --git a/src/Nest/_Generated/_LowLevelDispatch.generated.cs b/src/Nest/_Generated/_LowLevelDispatch.generated.cs index f85c3f6fab6..2abb247a7d9 100644 --- a/src/Nest/_Generated/_LowLevelDispatch.generated.cs +++ b/src/Nest/_Generated/_LowLevelDispatch.generated.cs @@ -3354,6 +3354,72 @@ internal partial class LowLevelDispatch throw InvalidDispatch("XpackMlCloseJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_close"); } + internal TResponse XpackMlDeleteCalendarDispatch(IRequest p) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlDeleteCalendar(p.RouteValues.CalendarId,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlDeleteCalendar", p, new [] { DELETE }, "/_xpack/ml/calendars/{calendar_id}"); + } + + internal Task XpackMlDeleteCalendarDispatchAsync(IRequest p, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlDeleteCalendarAsync(p.RouteValues.CalendarId,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlDeleteCalendar", p, new [] { DELETE }, "/_xpack/ml/calendars/{calendar_id}"); + } + + internal TResponse XpackMlDeleteCalendarEventDispatch(IRequest p) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.CalendarId, p.RouteValues.EventId)) return _lowLevel.XpackMlDeleteCalendarEvent(p.RouteValues.CalendarId,p.RouteValues.EventId,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlDeleteCalendarEvent", p, new [] { DELETE }, "/_xpack/ml/calendars/{calendar_id}/events/{event_id}"); + } + + internal Task XpackMlDeleteCalendarEventDispatchAsync(IRequest p, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.CalendarId, p.RouteValues.EventId)) return _lowLevel.XpackMlDeleteCalendarEventAsync(p.RouteValues.CalendarId,p.RouteValues.EventId,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlDeleteCalendarEvent", p, new [] { DELETE }, "/_xpack/ml/calendars/{calendar_id}/events/{event_id}"); + } + + internal TResponse XpackMlDeleteCalendarJobDispatch(IRequest p) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.CalendarId, p.RouteValues.JobId)) return _lowLevel.XpackMlDeleteCalendarJob(p.RouteValues.CalendarId,p.RouteValues.JobId,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlDeleteCalendarJob", p, new [] { DELETE }, "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}"); + } + + internal Task XpackMlDeleteCalendarJobDispatchAsync(IRequest p, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case DELETE: + if (AllSetNoFallback(p.RouteValues.CalendarId, p.RouteValues.JobId)) return _lowLevel.XpackMlDeleteCalendarJobAsync(p.RouteValues.CalendarId,p.RouteValues.JobId,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlDeleteCalendarJob", p, new [] { DELETE }, "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}"); + } + internal TResponse XpackMlDeleteDatafeedDispatch(IRequest p) where TResponse : class, IElasticsearchResponse, new() { switch(p.HttpMethod) @@ -3512,6 +3578,56 @@ internal partial class LowLevelDispatch throw InvalidDispatch("XpackMlGetBuckets", p, new [] { GET, POST }, "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets"); } + internal TResponse XpackMlGetCalendarsDispatch(IRequest p,SerializableData body) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.CalendarId)) return _lowLevel.XpackMlGetCalendars(p.RouteValues.CalendarId,p.RequestParameters); + return _lowLevel.XpackMlGetCalendars(p.RequestParameters); + case POST: + if (AllSet(p.RouteValues.CalendarId)) return _lowLevel.XpackMlGetCalendars(p.RouteValues.CalendarId,body,p.RequestParameters); + return _lowLevel.XpackMlGetCalendars(body,p.RequestParameters); + } + throw InvalidDispatch("XpackMlGetCalendars", p, new [] { GET, POST }, "/_xpack/ml/calendars", "/_xpack/ml/calendars/{calendar_id}"); + } + + internal Task XpackMlGetCalendarsDispatchAsync(IRequest p,SerializableData body, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case GET: + if (AllSet(p.RouteValues.CalendarId)) return _lowLevel.XpackMlGetCalendarsAsync(p.RouteValues.CalendarId,p.RequestParameters,ct); + return _lowLevel.XpackMlGetCalendarsAsync(p.RequestParameters,ct); + case POST: + if (AllSet(p.RouteValues.CalendarId)) return _lowLevel.XpackMlGetCalendarsAsync(p.RouteValues.CalendarId,body,p.RequestParameters,ct); + return _lowLevel.XpackMlGetCalendarsAsync(body,p.RequestParameters,ct); + } + throw InvalidDispatch("XpackMlGetCalendars", p, new [] { GET, POST }, "/_xpack/ml/calendars", "/_xpack/ml/calendars/{calendar_id}"); + } + + internal TResponse XpackMlGetCalendarEventsDispatch(IRequest p) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlGetCalendarEvents(p.RouteValues.CalendarId,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlGetCalendarEvents", p, new [] { GET }, "/_xpack/ml/calendars/{calendar_id}/events"); + } + + internal Task XpackMlGetCalendarEventsDispatchAsync(IRequest p, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case GET: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlGetCalendarEventsAsync(p.RouteValues.CalendarId,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlGetCalendarEvents", p, new [] { GET }, "/_xpack/ml/calendars/{calendar_id}/events"); + } + internal TResponse XpackMlGetCategoriesDispatch(IRequest p,SerializableData body) where TResponse : class, IElasticsearchResponse, new() { switch(p.HttpMethod) @@ -3770,6 +3886,28 @@ internal partial class LowLevelDispatch throw InvalidDispatch("XpackMlOpenJob", p, new [] { POST }, "/_xpack/ml/anomaly_detectors/{job_id}/_open"); } + internal TResponse XpackMlPostCalendarEventsDispatch(IRequest p,SerializableData body) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlPostCalendarEvents(p.RouteValues.CalendarId,body,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlPostCalendarEvents", p, new [] { POST }, "/_xpack/ml/calendars/{calendar_id}/events"); + } + + internal Task XpackMlPostCalendarEventsDispatchAsync(IRequest p,SerializableData body, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case POST: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlPostCalendarEventsAsync(p.RouteValues.CalendarId,body,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlPostCalendarEvents", p, new [] { POST }, "/_xpack/ml/calendars/{calendar_id}/events"); + } + internal TResponse XpackMlPostDataDispatch(IRequest p,SerializableData body) where TResponse : class, IElasticsearchResponse, new() { switch(p.HttpMethod) @@ -3814,6 +3952,50 @@ internal partial class LowLevelDispatch throw InvalidDispatch("XpackMlPreviewDatafeed", p, new [] { GET }, "/_xpack/ml/datafeeds/{datafeed_id}/_preview"); } + internal TResponse XpackMlPutCalendarDispatch(IRequest p,SerializableData body) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlPutCalendar(p.RouteValues.CalendarId,body,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlPutCalendar", p, new [] { PUT }, "/_xpack/ml/calendars/{calendar_id}"); + } + + internal Task XpackMlPutCalendarDispatchAsync(IRequest p,SerializableData body, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.CalendarId)) return _lowLevel.XpackMlPutCalendarAsync(p.RouteValues.CalendarId,body,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlPutCalendar", p, new [] { PUT }, "/_xpack/ml/calendars/{calendar_id}"); + } + + internal TResponse XpackMlPutCalendarJobDispatch(IRequest p) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.CalendarId, p.RouteValues.JobId)) return _lowLevel.XpackMlPutCalendarJob(p.RouteValues.CalendarId,p.RouteValues.JobId,p.RequestParameters); + break; + } + throw InvalidDispatch("XpackMlPutCalendarJob", p, new [] { PUT }, "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}"); + } + + internal Task XpackMlPutCalendarJobDispatchAsync(IRequest p, CancellationToken ct) where TResponse : class, IElasticsearchResponse, new() + { + switch(p.HttpMethod) + { + case PUT: + if (AllSetNoFallback(p.RouteValues.CalendarId, p.RouteValues.JobId)) return _lowLevel.XpackMlPutCalendarJobAsync(p.RouteValues.CalendarId,p.RouteValues.JobId,p.RequestParameters,ct); + break; + } + throw InvalidDispatch("XpackMlPutCalendarJob", p, new [] { PUT }, "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}"); + } + internal TResponse XpackMlPutDatafeedDispatch(IRequest p,SerializableData body) where TResponse : class, IElasticsearchResponse, new() { switch(p.HttpMethod) diff --git a/src/Nest/_Generated/_Requests.generated.cs b/src/Nest/_Generated/_Requests.generated.cs index 4fe3701333e..7d1096c666c 100644 --- a/src/Nest/_Generated/_Requests.generated.cs +++ b/src/Nest/_Generated/_Requests.generated.cs @@ -1786,6 +1786,63 @@ public DeleteByQueryRequest(Indices index, Types type) : base(r=>r.Required("ind public long? Slices { get => Q("slices"); set => Q("slices", value); } } [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface IDeleteCalendarEventRequest : IRequest + { + Id CalendarId { get; } + Id EventId { get; } + } + ///Request parameters for XpackMlDeleteCalendarEvent
+ public partial class DeleteCalendarEventRequest : PlainRequestBase, IDeleteCalendarEventRequest + { + protected IDeleteCalendarEventRequest Self => this; + ////_xpack/ml/calendars/{calendar_id}/events/{event_id} + ///this parameter is required + ///this parameter is required + public DeleteCalendarEventRequest(Id calendar_id, Id event_id) : base(r=>r.Required("calendar_id", calendar_id).Required("event_id", event_id)){} + // values part of the url path + Id IDeleteCalendarEventRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + Id IDeleteCalendarEventRequest.EventId => Self.RouteValues.Get("event_id"); + + // Request parameters + } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface IDeleteCalendarJobRequest : IRequest + { + Id CalendarId { get; } + Id JobId { get; } + } + ///Request parameters for XpackMlDeleteCalendarJob
+ public partial class DeleteCalendarJobRequest : PlainRequestBase, IDeleteCalendarJobRequest + { + protected IDeleteCalendarJobRequest Self => this; + ////_xpack/ml/calendars/{calendar_id}/jobs/{job_id} + ///this parameter is required + ///this parameter is required + public DeleteCalendarJobRequest(Id calendar_id, Id job_id) : base(r=>r.Required("calendar_id", calendar_id).Required("job_id", job_id)){} + // values part of the url path + Id IDeleteCalendarJobRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + Id IDeleteCalendarJobRequest.JobId => Self.RouteValues.Get("job_id"); + + // Request parameters + } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface IDeleteCalendarRequest : IRequest + { + Id CalendarId { get; } + } + ///Request parameters for XpackMlDeleteCalendar
+ public partial class DeleteCalendarRequest : PlainRequestBase, IDeleteCalendarRequest + { + protected IDeleteCalendarRequest Self => this; + ////_xpack/ml/calendars/{calendar_id} + ///this parameter is required + public DeleteCalendarRequest(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IDeleteCalendarRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] public partial interface IDeleteDatafeedRequest : IRequest { Id DatafeedId { get; } @@ -2737,6 +2794,48 @@ public GetBucketsRequest(Id job_id) : base(r=>r.Required("job_id", job_id)){} // Request parameters } [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface IGetCalendarEventsRequest : IRequest + { + Id CalendarId { get; } + } + ///Request parameters for XpackMlGetCalendarEvents
+ public partial class GetCalendarEventsRequest : PlainRequestBase, IGetCalendarEventsRequest + { + protected IGetCalendarEventsRequest Self => this; + ////_xpack/ml/calendars/{calendar_id}/events + ///this parameter is required + public GetCalendarEventsRequest(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IGetCalendarEventsRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + ///Get events for the job. When this option is used calendar_id must be '_all' + public string JobId { get => Q("job_id"); set => Q("job_id", value); } + ///Get events after this time + public string Start { get => Q("start"); set => Q("start", value); } + ///Get events before this time + public DateTimeOffset? End { get => Q("end"); set => Q("end", value); } + } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface IGetCalendarsRequest : IRequest + { + Id CalendarId { get; } + } + ///Request parameters for XpackMlGetCalendars
+ public partial class GetCalendarsRequest : PlainRequestBase, IGetCalendarsRequest + { + protected IGetCalendarsRequest Self => this; + ////_xpack/ml/calendars + public GetCalendarsRequest() : base(){} + ////_xpack/ml/calendars/{calendar_id} + ///Optional, accepts null + public GetCalendarsRequest(Id calendar_id) : base(r=>r.Optional("calendar_id", calendar_id)){} + // values part of the url path + Id IGetCalendarsRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] public partial interface IGetCategoriesRequest : IRequest { Id JobId { get; } @@ -4263,6 +4362,23 @@ public partial class PingRequest : PlainRequestBase, IPin // Request parameters } [JsonObject(MemberSerialization = MemberSerialization.OptIn)] + public partial interface IPostCalendarEventsRequest : IRequest + { + Id CalendarId { get; } + } + ///Request parameters for XpackMlPostCalendarEvents
+ public partial class PostCalendarEventsRequest : PlainRequestBase, IPostCalendarEventsRequest + { + protected IPostCalendarEventsRequest Self => this; + ////_xpack/ml/calendars/{calendar_id}/events + ///this parameter is required + public PostCalendarEventsRequest(Id calendar_id) : base(r=>r.Required("calendar_id", calendar_id)){} + // values part of the url path + Id IPostCalendarEventsRequest.CalendarId => Self.RouteValues.Get("calendar_id"); + + // Request parameters + } + [JsonObject(MemberSerialization = MemberSerialization.OptIn)] public partial interface IPostJobDataRequest : IRequest { Id JobId { get; } @@ -4339,6 +4455,43 @@ public PutAliasRequest(Indices index, Name name) : base(r=>r.Required("index", i public Time MasterTimeout { get => Q