Skip to content

Commit e4edee0

Browse files
Add generated task endpoints (#7567) (#7568)
Co-authored-by: Steve Gordon <[email protected]>
1 parent 55f67b3 commit e4edee0

10 files changed

+953
-1
lines changed

src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlLookup.g.cs

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ internal static class ApiUrlLookup
109109
internal static ApiUrls SqlGetAsync = new ApiUrls(new[] { "/_sql/async/{id}" });
110110
internal static ApiUrls SqlGetAsyncStatus = new ApiUrls(new[] { "/_sql/async/status/{id}" });
111111
internal static ApiUrls SqlQuery = new ApiUrls(new[] { "/_sql" });
112+
internal static ApiUrls TasksCancel = new ApiUrls(new[] { "/_tasks/_cancel", "/_tasks/{task_id}/_cancel" });
113+
internal static ApiUrls TasksGet = new ApiUrls(new[] { "/_tasks/{task_id}" });
114+
internal static ApiUrls TasksList = new ApiUrls(new[] { "/_tasks" });
112115
internal static ApiUrls NoNamespaceTermsEnum = new ApiUrls(new[] { "/{index}/_terms_enum" });
113116
internal static ApiUrls NoNamespaceUpdateByQuery = new ApiUrls(new[] { "/{index}/_update_by_query" });
114117
internal static ApiUrls NoNamespaceUpdateByQueryRethrottle = new ApiUrls(new[] { "/_update_by_query/{task_id}/_rethrottle" });
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Requests;
22+
using Elastic.Clients.Elasticsearch.Serialization;
23+
using Elastic.Transport;
24+
using System;
25+
using System.Collections.Generic;
26+
using System.Linq.Expressions;
27+
using System.Text.Json;
28+
using System.Text.Json.Serialization;
29+
30+
namespace Elastic.Clients.Elasticsearch.Tasks;
31+
32+
public sealed class CancelRequestParameters : RequestParameters
33+
{
34+
/// <summary>
35+
/// <para>A comma-separated list of actions that should be cancelled. Leave empty to cancel all.</para>
36+
/// </summary>
37+
public ICollection<string>? Actions { get => Q<ICollection<string>?>("actions"); set => Q("actions", value); }
38+
39+
/// <summary>
40+
/// <para>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</para>
41+
/// </summary>
42+
public ICollection<string>? Nodes { get => Q<ICollection<string>?>("nodes"); set => Q("nodes", value); }
43+
44+
/// <summary>
45+
/// <para>Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.</para>
46+
/// </summary>
47+
public string? ParentTaskId { get => Q<string?>("parent_task_id"); set => Q("parent_task_id", value); }
48+
49+
/// <summary>
50+
/// <para>Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false</para>
51+
/// </summary>
52+
public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
53+
}
54+
55+
/// <summary>
56+
/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely.
57+
/// <para>Cancels a task, if it can be cancelled through an API.</para>
58+
/// </summary>
59+
public sealed partial class CancelRequest : PlainRequest<CancelRequestParameters>
60+
{
61+
public CancelRequest()
62+
{
63+
}
64+
65+
public CancelRequest(Elastic.Clients.Elasticsearch.TaskId? task_id) : base(r => r.Optional("task_id", task_id))
66+
{
67+
}
68+
69+
internal override ApiUrls ApiUrls => ApiUrlLookup.TasksCancel;
70+
71+
protected override HttpMethod StaticHttpMethod => HttpMethod.POST;
72+
73+
internal override bool SupportsBody => false;
74+
75+
/// <summary>
76+
/// <para>A comma-separated list of actions that should be cancelled. Leave empty to cancel all.</para>
77+
/// </summary>
78+
[JsonIgnore]
79+
public ICollection<string>? Actions { get => Q<ICollection<string>?>("actions"); set => Q("actions", value); }
80+
81+
/// <summary>
82+
/// <para>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</para>
83+
/// </summary>
84+
[JsonIgnore]
85+
public ICollection<string>? Nodes { get => Q<ICollection<string>?>("nodes"); set => Q("nodes", value); }
86+
87+
/// <summary>
88+
/// <para>Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.</para>
89+
/// </summary>
90+
[JsonIgnore]
91+
public string? ParentTaskId { get => Q<string?>("parent_task_id"); set => Q("parent_task_id", value); }
92+
93+
/// <summary>
94+
/// <para>Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false</para>
95+
/// </summary>
96+
[JsonIgnore]
97+
public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
98+
}
99+
100+
/// <summary>
101+
/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely.
102+
/// <para>Cancels a task, if it can be cancelled through an API.</para>
103+
/// </summary>
104+
public sealed partial class CancelRequestDescriptor : RequestDescriptor<CancelRequestDescriptor, CancelRequestParameters>
105+
{
106+
internal CancelRequestDescriptor(Action<CancelRequestDescriptor> configure) => configure.Invoke(this);
107+
108+
public CancelRequestDescriptor()
109+
{
110+
}
111+
112+
internal override ApiUrls ApiUrls => ApiUrlLookup.TasksCancel;
113+
114+
protected override HttpMethod StaticHttpMethod => HttpMethod.POST;
115+
116+
internal override bool SupportsBody => false;
117+
118+
public CancelRequestDescriptor Actions(ICollection<string>? actions) => Qs("actions", actions);
119+
public CancelRequestDescriptor Nodes(ICollection<string>? nodes) => Qs("nodes", nodes);
120+
public CancelRequestDescriptor ParentTaskId(string? parentTaskId) => Qs("parent_task_id", parentTaskId);
121+
public CancelRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion);
122+
123+
public CancelRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.TaskId? task_id)
124+
{
125+
RouteValues.Optional("task_id", task_id);
126+
return Self;
127+
}
128+
129+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
130+
{
131+
}
132+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Serialization;
22+
using Elastic.Transport.Products.Elasticsearch;
23+
using System.Collections.Generic;
24+
using System.Text.Json.Serialization;
25+
26+
namespace Elastic.Clients.Elasticsearch.Tasks;
27+
28+
/// <summary>
29+
/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely.
30+
/// </summary>
31+
public sealed partial class CancelResponse : ElasticsearchResponse
32+
{
33+
[JsonInclude, JsonPropertyName("node_failures")]
34+
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.ErrorCause>? NodeFailures { get; init; }
35+
36+
/// <summary>
37+
/// <para>Task information grouped by node, if `group_by` was set to `node` (the default).</para>
38+
/// </summary>
39+
[JsonInclude, JsonPropertyName("nodes")]
40+
public IReadOnlyDictionary<string, Elastic.Clients.Elasticsearch.Tasks.NodeTasks>? Nodes { get; init; }
41+
[JsonInclude, JsonPropertyName("task_failures")]
42+
public IReadOnlyCollection<Elastic.Clients.Elasticsearch.TaskFailure>? TaskFailures { get; init; }
43+
44+
/// <summary>
45+
/// <para>Either a flat list of tasks if `group_by` was set to `none`, or grouped by parents if<br/>`group_by` was set to `parents`.</para>
46+
/// </summary>
47+
[JsonInclude, JsonPropertyName("tasks")]
48+
public Elastic.Clients.Elasticsearch.Tasks.TaskInfos? Tasks { get; init; }
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Requests;
22+
using Elastic.Clients.Elasticsearch.Serialization;
23+
using Elastic.Transport;
24+
using System;
25+
using System.Collections.Generic;
26+
using System.Linq.Expressions;
27+
using System.Text.Json;
28+
using System.Text.Json.Serialization;
29+
30+
namespace Elastic.Clients.Elasticsearch.Tasks;
31+
32+
public sealed class GetTasksRequestParameters : RequestParameters
33+
{
34+
/// <summary>
35+
/// <para>Explicit operation timeout</para>
36+
/// </summary>
37+
public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("timeout"); set => Q("timeout", value); }
38+
39+
/// <summary>
40+
/// <para>Wait for the matching tasks to complete (default: false)</para>
41+
/// </summary>
42+
public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
43+
}
44+
45+
/// <summary>
46+
/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely.
47+
/// <para>Returns information about a task.</para>
48+
/// </summary>
49+
public sealed partial class GetTasksRequest : PlainRequest<GetTasksRequestParameters>
50+
{
51+
public GetTasksRequest(Elastic.Clients.Elasticsearch.Id task_id) : base(r => r.Required("task_id", task_id))
52+
{
53+
}
54+
55+
internal override ApiUrls ApiUrls => ApiUrlLookup.TasksGet;
56+
57+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
58+
59+
internal override bool SupportsBody => false;
60+
61+
/// <summary>
62+
/// <para>Explicit operation timeout</para>
63+
/// </summary>
64+
[JsonIgnore]
65+
public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("timeout"); set => Q("timeout", value); }
66+
67+
/// <summary>
68+
/// <para>Wait for the matching tasks to complete (default: false)</para>
69+
/// </summary>
70+
[JsonIgnore]
71+
public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
72+
}
73+
74+
/// <summary>
75+
/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely.
76+
/// <para>Returns information about a task.</para>
77+
/// </summary>
78+
public sealed partial class GetTasksRequestDescriptor : RequestDescriptor<GetTasksRequestDescriptor, GetTasksRequestParameters>
79+
{
80+
internal GetTasksRequestDescriptor(Action<GetTasksRequestDescriptor> configure) => configure.Invoke(this);
81+
82+
public GetTasksRequestDescriptor(Elastic.Clients.Elasticsearch.Id task_id) : base(r => r.Required("task_id", task_id))
83+
{
84+
}
85+
86+
internal GetTasksRequestDescriptor()
87+
{
88+
}
89+
90+
internal override ApiUrls ApiUrls => ApiUrlLookup.TasksGet;
91+
92+
protected override HttpMethod StaticHttpMethod => HttpMethod.GET;
93+
94+
internal override bool SupportsBody => false;
95+
96+
public GetTasksRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout);
97+
public GetTasksRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion);
98+
99+
public GetTasksRequestDescriptor TaskId(Elastic.Clients.Elasticsearch.Id task_id)
100+
{
101+
RouteValues.Required("task_id", task_id);
102+
return Self;
103+
}
104+
105+
protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
106+
{
107+
}
108+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information.
4+
//
5+
// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6+
// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7+
// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8+
// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9+
// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10+
// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11+
// ------------------------------------------------
12+
//
13+
// This file is automatically generated.
14+
// Please do not edit these files manually.
15+
//
16+
// ------------------------------------------------
17+
18+
#nullable restore
19+
20+
using Elastic.Clients.Elasticsearch.Fluent;
21+
using Elastic.Clients.Elasticsearch.Serialization;
22+
using Elastic.Transport.Products.Elasticsearch;
23+
using System.Collections.Generic;
24+
using System.Text.Json.Serialization;
25+
26+
namespace Elastic.Clients.Elasticsearch.Tasks;
27+
28+
/// <summary>
29+
/// EXPERIMENTAL! May change in ways that are not backwards compatible or be removed entirely.
30+
/// </summary>
31+
public sealed partial class GetTasksResponse : ElasticsearchResponse
32+
{
33+
[JsonInclude, JsonPropertyName("completed")]
34+
public bool Completed { get; init; }
35+
[JsonInclude, JsonPropertyName("response")]
36+
public Elastic.Clients.Elasticsearch.Tasks.TaskStatus? Response { get; init; }
37+
[JsonInclude, JsonPropertyName("task")]
38+
public Elastic.Clients.Elasticsearch.Tasks.TaskInfo Task { get; init; }
39+
}

0 commit comments

Comments
 (0)