From 513200a13974ab04fe368d8e9a14cd581a213ff0 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Wed, 5 Apr 2023 08:11:11 +0100 Subject: [PATCH] Add generated task endpoints (#7567) --- .../_Generated/Api/ApiUrlLookup.g.cs | 3 + .../_Generated/Api/Tasks/CancelRequest.g.cs | 132 ++++++++ .../_Generated/Api/Tasks/CancelResponse.g.cs | 49 +++ .../_Generated/Api/Tasks/GetTasksRequest.g.cs | 108 ++++++ .../Api/Tasks/GetTasksResponse.g.cs | 39 +++ .../_Generated/Api/Tasks/ListRequest.g.cs | 166 +++++++++ .../_Generated/Api/Tasks/ListResponse.g.cs | 49 +++ .../Client/ElasticsearchClient.Tasks.g.cs | 320 ++++++++++++++++++ .../Client/ElasticsearchClient.g.cs | 4 +- .../_Generated/Types/Enums/Enums.Tasks.g.cs | 84 +++++ 10 files changed, 953 insertions(+), 1 deletion(-) create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs index 2d68d7927b3..259cf062157 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs @@ -109,6 +109,9 @@ internal static class ApiUrlLookup internal static ApiUrls SqlGetAsync = new ApiUrls(new[] { "/_sql/async/{id}" }); internal static ApiUrls SqlGetAsyncStatus = new ApiUrls(new[] { "/_sql/async/status/{id}" }); internal static ApiUrls SqlQuery = new ApiUrls(new[] { "/_sql" }); + internal static ApiUrls TasksCancel = new ApiUrls(new[] { "/_tasks/_cancel", "/_tasks/{task_id}/_cancel" }); + internal static ApiUrls TasksGet = new ApiUrls(new[] { "/_tasks/{task_id}" }); + internal static ApiUrls TasksList = new ApiUrls(new[] { "/_tasks" }); internal static ApiUrls NoNamespaceTermsEnum = new ApiUrls(new[] { "/{index}/_terms_enum" }); internal static ApiUrls NoNamespaceUpdateByQuery = new ApiUrls(new[] { "/{index}/_update_by_query" }); internal static ApiUrls NoNamespaceUpdateByQueryRethrottle = new ApiUrls(new[] { "/_update_by_query/{task_id}/_rethrottle" }); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs new file mode 100644 index 00000000000..132e77ece8e --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelRequest.g.cs @@ -0,0 +1,132 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +public sealed class CancelRequestParameters : RequestParameters +{ + /// + /// A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + /// + public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + + /// + /// A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + /// + public ICollection? Nodes { get => Q?>("nodes"); set => Q("nodes", value); } + + /// + /// Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + /// + public string? ParentTaskId { get => Q("parent_task_id"); set => Q("parent_task_id", value); } + + /// + /// Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false + /// + public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } +} + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// Cancels a task, if it can be cancelled through an API. +/// +public sealed partial class CancelRequest : PlainRequest +{ + public CancelRequest() + { + } + + public CancelRequest(Elastic.Clients.Elasticsearch.TaskId? task_id) : base(r => r.Optional("task_id", task_id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.TasksCancel; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + /// + /// A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + /// + [JsonIgnore] + public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + + /// + /// A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + /// + [JsonIgnore] + public ICollection? Nodes { get => Q?>("nodes"); set => Q("nodes", value); } + + /// + /// Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + /// + [JsonIgnore] + public string? ParentTaskId { get => Q("parent_task_id"); set => Q("parent_task_id", value); } + + /// + /// Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false + /// + [JsonIgnore] + public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } +} + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// Cancels a task, if it can be cancelled through an API. +/// +public sealed partial class CancelRequestDescriptor : RequestDescriptor +{ + internal CancelRequestDescriptor(Action configure) => configure.Invoke(this); + + public CancelRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.TasksCancel; + + protected override HttpMethod StaticHttpMethod => HttpMethod.POST; + + internal override bool SupportsBody => false; + + public CancelRequestDescriptor Actions(ICollection? actions) => Qs("actions", actions); + public CancelRequestDescriptor Nodes(ICollection? nodes) => Qs("nodes", nodes); + public CancelRequestDescriptor ParentTaskId(string? parentTaskId) => Qs("parent_task_id", parentTaskId); + public CancelRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + + public CancelRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.TaskId? task_id) + { + RouteValues.Optional("task_id", task_id); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs new file mode 100644 index 00000000000..0d0066ac4de --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/CancelResponse.g.cs @@ -0,0 +1,49 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// +public sealed partial class CancelResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("node_failures")] + public IReadOnlyCollection? NodeFailures { get; init; } + + /// + /// Task information grouped by node, if `group_by` was set to `node` (the default). + /// + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary? Nodes { get; init; } + [JsonInclude, JsonPropertyName("task_failures")] + public IReadOnlyCollection? TaskFailures { get; init; } + + /// + /// Either a flat list of tasks if `group_by` was set to `none`, or grouped by parents if
`group_by` was set to `parents`.
+ ///
+ [JsonInclude, JsonPropertyName("tasks")] + public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs new file mode 100644 index 00000000000..40e84417fc9 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksRequest.g.cs @@ -0,0 +1,108 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +public sealed class GetTasksRequestParameters : RequestParameters +{ + /// + /// Explicit operation timeout + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// Wait for the matching tasks to complete (default: false) + /// + public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } +} + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// Returns information about a task. +/// +public sealed partial class GetTasksRequest : PlainRequest +{ + public GetTasksRequest(Elastic.Clients.Elasticsearch.Id task_id) : base(r => r.Required("task_id", task_id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.TasksGet; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + /// + /// Explicit operation timeout + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// Wait for the matching tasks to complete (default: false) + /// + [JsonIgnore] + public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } +} + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// Returns information about a task. +/// +public sealed partial class GetTasksRequestDescriptor : RequestDescriptor +{ + internal GetTasksRequestDescriptor(Action configure) => configure.Invoke(this); + + public GetTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Id task_id) : base(r => r.Required("task_id", task_id)) + { + } + + internal GetTasksRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.TasksGet; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + public GetTasksRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public GetTasksRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + + public GetTasksRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id task_id) + { + RouteValues.Required("task_id", task_id); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs new file mode 100644 index 00000000000..88d094b7a97 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/GetTasksResponse.g.cs @@ -0,0 +1,39 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// +public sealed partial class GetTasksResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("completed")] + public bool Completed { get; init; } + [JsonInclude, JsonPropertyName("response")] + public Elastic.Clients.Elasticsearch.Tasks.TaskStatus? Response { get; init; } + [JsonInclude, JsonPropertyName("task")] + public Elastic.Clients.Elasticsearch.Tasks.TaskInfo Task { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs new file mode 100644 index 00000000000..5b0fc15e173 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListRequest.g.cs @@ -0,0 +1,166 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Requests; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +public sealed class ListRequestParameters : RequestParameters +{ + /// + /// Comma-separated list or wildcard expression of actions used to limit the request. + /// + public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + + /// + /// If `true`, the response includes detailed information about shard recoveries. + /// + public bool? Detailed { get => Q("detailed"); set => Q("detailed", value); } + + /// + /// Key used to group tasks in the response. + /// + public Elastic.Clients.Elasticsearch.Tasks.GroupBy? GroupBy { get => Q("group_by"); set => Q("group_by", value); } + + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + public ICollection? NodeId { get => Q?>("node_id"); set => Q("node_id", value); } + + /// + /// Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. + /// + public Elastic.Clients.Elasticsearch.Id? ParentTaskId { get => Q("parent_task_id"); set => Q("parent_task_id", value); } + + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// If `true`, the request blocks until the operation is complete. + /// + public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } +} + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// The task management API returns information about tasks currently executing on one or more nodes in the cluster. +/// +public sealed partial class ListRequest : PlainRequest +{ + internal override ApiUrls ApiUrls => ApiUrlLookup.TasksList; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + /// + /// Comma-separated list or wildcard expression of actions used to limit the request. + /// + [JsonIgnore] + public ICollection? Actions { get => Q?>("actions"); set => Q("actions", value); } + + /// + /// If `true`, the response includes detailed information about shard recoveries. + /// + [JsonIgnore] + public bool? Detailed { get => Q("detailed"); set => Q("detailed", value); } + + /// + /// Key used to group tasks in the response. + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Tasks.GroupBy? GroupBy { get => Q("group_by"); set => Q("group_by", value); } + + /// + /// Comma-separated list of node IDs or names used to limit returned information. + /// + [JsonIgnore] + public ICollection? NodeId { get => Q?>("node_id"); set => Q("node_id", value); } + + /// + /// Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of `-1`. + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Id? ParentTaskId { get => Q("parent_task_id"); set => Q("parent_task_id", value); } + + /// + /// Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Duration? MasterTimeout { get => Q("master_timeout"); set => Q("master_timeout", value); } + + /// + /// Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. + /// + [JsonIgnore] + public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q("timeout"); set => Q("timeout", value); } + + /// + /// If `true`, the request blocks until the operation is complete. + /// + [JsonIgnore] + public bool? WaitForCompletion { get => Q("wait_for_completion"); set => Q("wait_for_completion", value); } +} + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// The task management API returns information about tasks currently executing on one or more nodes in the cluster. +/// +public sealed partial class ListRequestDescriptor : RequestDescriptor +{ + internal ListRequestDescriptor(Action configure) => configure.Invoke(this); + + public ListRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlLookup.TasksList; + + protected override HttpMethod StaticHttpMethod => HttpMethod.GET; + + internal override bool SupportsBody => false; + + public ListRequestDescriptor Actions(ICollection? actions) => Qs("actions", actions); + public ListRequestDescriptor Detailed(bool? detailed = true) => Qs("detailed", detailed); + public ListRequestDescriptor GroupBy(Elastic.Clients.Elasticsearch.Tasks.GroupBy? groupBy) => Qs("group_by", groupBy); + public ListRequestDescriptor MasterTimeout(Elastic.Clients.Elasticsearch.Duration? masterTimeout) => Qs("master_timeout", masterTimeout); + public ListRequestDescriptor NodeId(ICollection? nodeId) => Qs("node_id", nodeId); + public ListRequestDescriptor ParentTaskId(Elastic.Clients.Elasticsearch.Id? parentTaskId) => Qs("parent_task_id", parentTaskId); + public ListRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout); + public ListRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion); + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs new file mode 100644 index 00000000000..fbc0940ddbe --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Tasks/ListResponse.g.cs @@ -0,0 +1,49 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using Elastic.Clients.Elasticsearch.Fluent; +using Elastic.Clients.Elasticsearch.Serialization; +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +/// +/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. +/// +public sealed partial class ListResponse : ElasticsearchResponse +{ + [JsonInclude, JsonPropertyName("node_failures")] + public IReadOnlyCollection? NodeFailures { get; init; } + + /// + /// Task information grouped by node, if `group_by` was set to `node` (the default). + /// + [JsonInclude, JsonPropertyName("nodes")] + public IReadOnlyDictionary? Nodes { get; init; } + [JsonInclude, JsonPropertyName("task_failures")] + public IReadOnlyCollection? TaskFailures { get; init; } + + /// + /// Either a flat list of tasks if `group_by` was set to `none`, or grouped by parents if
`group_by` was set to `parents`.
+ ///
+ [JsonInclude, JsonPropertyName("tasks")] + public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; init; } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs new file mode 100644 index 00000000000..fae829c3857 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Tasks.g.cs @@ -0,0 +1,320 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +public partial class TasksNamespacedClient : NamespacedClientProxy +{ + /// + /// Initializes a new instance of the class for mocking. + /// + protected TasksNamespacedClient() : base() + { + } + + internal TasksNamespacedClient(ElasticsearchClient client) : base(client) + { + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual CancelResponse Cancel(CancelRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CancelAsync(CancelRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual CancelResponse Cancel() + { + var descriptor = new CancelRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual CancelResponse Cancel(CancelRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual CancelResponse Cancel(Action configureRequest) + { + var descriptor = new CancelRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CancelAsync(CancellationToken cancellationToken = default) + { + var descriptor = new CancelRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CancelAsync(CancelRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Cancels a task, if it can be cancelled through an API. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task CancelAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new CancelRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual GetTasksResponse Get(GetTasksRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetAsync(GetTasksRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id task_id) + { + var descriptor = new GetTasksRequestDescriptor(task_id); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual GetTasksResponse Get(GetTasksRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual GetTasksResponse Get(Elastic.Clients.Elasticsearch.Id task_id, Action configureRequest) + { + var descriptor = new GetTasksRequestDescriptor(task_id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Id task_id, CancellationToken cancellationToken = default) + { + var descriptor = new GetTasksRequestDescriptor(task_id); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetAsync(GetTasksRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns information about a task. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task GetAsync(Elastic.Clients.Elasticsearch.Id task_id, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new GetTasksRequestDescriptor(task_id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual ListResponse List(ListRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ListAsync(ListRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual ListResponse List() + { + var descriptor = new ListRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual ListResponse List(ListRequestDescriptor descriptor) + { + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual ListResponse List(Action configureRequest) + { + var descriptor = new ListRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ListAsync(CancellationToken cancellationToken = default) + { + var descriptor = new ListRequestDescriptor(); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ListAsync(ListRequestDescriptor descriptor, CancellationToken cancellationToken = default) + { + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + /// + /// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely. + /// Returns a list of tasks. + /// Learn more about this API in the Elasticsearch documentation. + /// + public virtual Task ListAsync(Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new ListRequestDescriptor(); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs index 30606837204..c32f24e8c0b 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs @@ -23,6 +23,7 @@ using Elastic.Clients.Elasticsearch.IndexManagement; using Elastic.Clients.Elasticsearch.Ingest; using Elastic.Clients.Elasticsearch.Sql; +using Elastic.Clients.Elasticsearch.Tasks; using System; using System.Threading; using System.Threading.Tasks; @@ -37,10 +38,11 @@ public partial class ElasticsearchClient public virtual IndicesNamespacedClient Indices { get; private set; } public virtual IngestNamespacedClient Ingest { get; private set; } public virtual SqlNamespacedClient Sql { get; private set; } + public virtual TasksNamespacedClient Tasks { get; private set; } private partial void SetupNamespaces() { - AsyncSearch = new AsyncSearchNamespacedClient(this); Cluster = new ClusterNamespacedClient(this); Eql = new EqlNamespacedClient(this); Indices = new IndicesNamespacedClient(this); Ingest = new IngestNamespacedClient(this); Sql = new SqlNamespacedClient(this); + AsyncSearch = new AsyncSearchNamespacedClient(this); Cluster = new ClusterNamespacedClient(this); Eql = new EqlNamespacedClient(this); Indices = new IndicesNamespacedClient(this); Ingest = new IngestNamespacedClient(this); Sql = new SqlNamespacedClient(this); Tasks = new TasksNamespacedClient(this); } /// diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs new file mode 100644 index 00000000000..0f497b1f0c2 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Enums/Enums.Tasks.g.cs @@ -0,0 +1,84 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +#nullable restore + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Runtime.Serialization; +using Elastic.Transport; +using Elastic.Clients.Elasticsearch.Serialization; + +namespace Elastic.Clients.Elasticsearch.Tasks; + +[JsonConverter(typeof(GroupByConverter))] +public enum GroupBy +{ + /// + /// Parent task ID + /// + [EnumMember(Value = "parents")] + Parents, + /// + /// Do not group tasks. + /// + [EnumMember(Value = "none")] + None, + /// + /// Node ID + /// + [EnumMember(Value = "nodes")] + Nodes +} + +internal sealed class GroupByConverter : JsonConverter +{ + public override GroupBy Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + var enumString = reader.GetString(); + switch (enumString) + { + case "parents": + return GroupBy.Parents; + case "none": + return GroupBy.None; + case "nodes": + return GroupBy.Nodes; + } + + ThrowHelper.ThrowJsonException(); return default; + } + + public override void Write(Utf8JsonWriter writer, GroupBy value, JsonSerializerOptions options) + { + switch (value) + { + case GroupBy.Parents: + writer.WriteStringValue("parents"); + return; + case GroupBy.None: + writer.WriteStringValue("none"); + return; + case GroupBy.Nodes: + writer.WriteStringValue("nodes"); + return; + } + + writer.WriteNullValue(); + } +} \ No newline at end of file