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 . Cluster ;
31
+
32
+ public sealed class AllocationExplainRequestParameters : RequestParameters
33
+ {
34
+ /// <summary>
35
+ /// <para>If true, returns information about disk usage and shard sizes.</para>
36
+ /// </summary>
37
+ public bool ? IncludeDiskInfo { get => Q < bool ? > ( "include_disk_info" ) ; set => Q ( "include_disk_info" , value ) ; }
38
+
39
+ /// <summary>
40
+ /// <para>If true, returns YES decisions in explanation.</para>
41
+ /// </summary>
42
+ public bool ? IncludeYesDecisions { get => Q < bool ? > ( "include_yes_decisions" ) ; set => Q ( "include_yes_decisions" , value ) ; }
43
+ }
44
+
45
+ /// <summary>
46
+ /// <para>Provides explanations for shard allocations in the cluster.</para>
47
+ /// </summary>
48
+ public sealed partial class AllocationExplainRequest : PlainRequest < AllocationExplainRequestParameters >
49
+ {
50
+ internal override ApiUrls ApiUrls => ApiUrlLookup . ClusterAllocationExplain ;
51
+
52
+ protected override HttpMethod StaticHttpMethod => HttpMethod . POST ;
53
+
54
+ internal override bool SupportsBody => true ;
55
+
56
+ /// <summary>
57
+ /// <para>If true, returns information about disk usage and shard sizes.</para>
58
+ /// </summary>
59
+ [ JsonIgnore ]
60
+ public bool ? IncludeDiskInfo { get => Q < bool ? > ( "include_disk_info" ) ; set => Q ( "include_disk_info" , value ) ; }
61
+
62
+ /// <summary>
63
+ /// <para>If true, returns YES decisions in explanation.</para>
64
+ /// </summary>
65
+ [ JsonIgnore ]
66
+ public bool ? IncludeYesDecisions { get => Q < bool ? > ( "include_yes_decisions" ) ; set => Q ( "include_yes_decisions" , value ) ; }
67
+
68
+ /// <summary>
69
+ /// <para>Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.</para>
70
+ /// </summary>
71
+ [ JsonInclude , JsonPropertyName ( "current_node" ) ]
72
+ public string ? CurrentNode { get ; set ; }
73
+
74
+ /// <summary>
75
+ /// <para>Specifies the name of the index that you would like an explanation for.</para>
76
+ /// </summary>
77
+ [ JsonInclude , JsonPropertyName ( "index" ) ]
78
+ public Elastic . Clients . Elasticsearch . IndexName ? Index { get ; set ; }
79
+
80
+ /// <summary>
81
+ /// <para>If true, returns explanation for the primary shard for the given shard ID.</para>
82
+ /// </summary>
83
+ [ JsonInclude , JsonPropertyName ( "primary" ) ]
84
+ public bool ? Primary { get ; set ; }
85
+
86
+ /// <summary>
87
+ /// <para>Specifies the ID of the shard that you would like an explanation for.</para>
88
+ /// </summary>
89
+ [ JsonInclude , JsonPropertyName ( "shard" ) ]
90
+ public int ? Shard { get ; set ; }
91
+ }
92
+
93
+ /// <summary>
94
+ /// <para>Provides explanations for shard allocations in the cluster.</para>
95
+ /// </summary>
96
+ public sealed partial class AllocationExplainRequestDescriptor : RequestDescriptor < AllocationExplainRequestDescriptor , AllocationExplainRequestParameters >
97
+ {
98
+ internal AllocationExplainRequestDescriptor ( Action < AllocationExplainRequestDescriptor > configure ) => configure . Invoke ( this ) ;
99
+
100
+ public AllocationExplainRequestDescriptor ( )
101
+ {
102
+ }
103
+
104
+ internal override ApiUrls ApiUrls => ApiUrlLookup . ClusterAllocationExplain ;
105
+
106
+ protected override HttpMethod StaticHttpMethod => HttpMethod . POST ;
107
+
108
+ internal override bool SupportsBody => true ;
109
+
110
+ public AllocationExplainRequestDescriptor IncludeDiskInfo ( bool ? includeDiskInfo = true ) => Qs ( "include_disk_info" , includeDiskInfo ) ;
111
+ public AllocationExplainRequestDescriptor IncludeYesDecisions ( bool ? includeYesDecisions = true ) => Qs ( "include_yes_decisions" , includeYesDecisions ) ;
112
+
113
+ private string ? CurrentNodeValue { get ; set ; }
114
+ private Elastic . Clients . Elasticsearch . IndexName ? IndexValue { get ; set ; }
115
+ private bool ? PrimaryValue { get ; set ; }
116
+ private int ? ShardValue { get ; set ; }
117
+
118
+ /// <summary>
119
+ /// <para>Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.</para>
120
+ /// </summary>
121
+ public AllocationExplainRequestDescriptor CurrentNode ( string ? currentNode )
122
+ {
123
+ CurrentNodeValue = currentNode ;
124
+ return Self ;
125
+ }
126
+
127
+ /// <summary>
128
+ /// <para>Specifies the name of the index that you would like an explanation for.</para>
129
+ /// </summary>
130
+ public AllocationExplainRequestDescriptor Index ( Elastic . Clients . Elasticsearch . IndexName ? index )
131
+ {
132
+ IndexValue = index ;
133
+ return Self ;
134
+ }
135
+
136
+ /// <summary>
137
+ /// <para>If true, returns explanation for the primary shard for the given shard ID.</para>
138
+ /// </summary>
139
+ public AllocationExplainRequestDescriptor Primary ( bool ? primary = true )
140
+ {
141
+ PrimaryValue = primary ;
142
+ return Self ;
143
+ }
144
+
145
+ /// <summary>
146
+ /// <para>Specifies the ID of the shard that you would like an explanation for.</para>
147
+ /// </summary>
148
+ public AllocationExplainRequestDescriptor Shard ( int ? shard )
149
+ {
150
+ ShardValue = shard ;
151
+ return Self ;
152
+ }
153
+
154
+ protected override void Serialize ( Utf8JsonWriter writer , JsonSerializerOptions options , IElasticsearchClientSettings settings )
155
+ {
156
+ writer . WriteStartObject ( ) ;
157
+ if ( ! string . IsNullOrEmpty ( CurrentNodeValue ) )
158
+ {
159
+ writer . WritePropertyName ( "current_node" ) ;
160
+ writer . WriteStringValue ( CurrentNodeValue ) ;
161
+ }
162
+
163
+ if ( IndexValue is not null )
164
+ {
165
+ writer . WritePropertyName ( "index" ) ;
166
+ JsonSerializer . Serialize ( writer , IndexValue , options ) ;
167
+ }
168
+
169
+ if ( PrimaryValue . HasValue )
170
+ {
171
+ writer . WritePropertyName ( "primary" ) ;
172
+ writer . WriteBooleanValue ( PrimaryValue . Value ) ;
173
+ }
174
+
175
+ if ( ShardValue . HasValue )
176
+ {
177
+ writer . WritePropertyName ( "shard" ) ;
178
+ writer . WriteNumberValue ( ShardValue . Value ) ;
179
+ }
180
+
181
+ writer . WriteEndObject ( ) ;
182
+ }
183
+ }
0 commit comments