@@ -34,7 +34,13 @@ async def delete_node(
3434 t .Union [str , t .Union [t .List [str ], t .Tuple [str , ...]]]
3535 ] = None ,
3636 human : t .Optional [bool ] = None ,
37+ master_timeout : t .Optional [
38+ t .Union ["t.Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's']" , str ]
39+ ] = None ,
3740 pretty : t .Optional [bool ] = None ,
41+ timeout : t .Optional [
42+ t .Union ["t.Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's']" , str ]
43+ ] = None ,
3844 ) -> ObjectApiResponse [t .Any ]:
3945 """
4046 Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and
@@ -43,6 +49,11 @@ async def delete_node(
4349 `<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
4450
4551 :param node_id: The node id of node to be removed from the shutdown state
52+ :param master_timeout: Period to wait for a connection to the master node. If
53+ no response is received before the timeout expires, the request fails and
54+ returns an error.
55+ :param timeout: Period to wait for a response. If no response is received before
56+ the timeout expires, the request fails and returns an error.
4657 """
4758 if node_id in SKIP_IN_PATH :
4859 raise ValueError ("Empty value passed for parameter 'node_id'" )
@@ -54,8 +65,12 @@ async def delete_node(
5465 __query ["filter_path" ] = filter_path
5566 if human is not None :
5667 __query ["human" ] = human
68+ if master_timeout is not None :
69+ __query ["master_timeout" ] = master_timeout
5770 if pretty is not None :
5871 __query ["pretty" ] = pretty
72+ if timeout is not None :
73+ __query ["timeout" ] = timeout
5974 __headers = {"accept" : "application/json" }
6075 return await self .perform_request ( # type: ignore[return-value]
6176 "DELETE" , __path , params = __query , headers = __headers
@@ -73,7 +88,13 @@ async def get_node(
7388 t .Union [str , t .Union [t .List [str ], t .Tuple [str , ...]]]
7489 ] = None ,
7590 human : t .Optional [bool ] = None ,
91+ master_timeout : t .Optional [
92+ t .Union ["t.Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's']" , str ]
93+ ] = None ,
7694 pretty : t .Optional [bool ] = None ,
95+ timeout : t .Optional [
96+ t .Union ["t.Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's']" , str ]
97+ ] = None ,
7798 ) -> ObjectApiResponse [t .Any ]:
7899 """
79100 Retrieve status of a node or nodes that are currently marked as shutting down.
@@ -82,6 +103,11 @@ async def get_node(
82103 `<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
83104
84105 :param node_id: Which node for which to retrieve the shutdown status
106+ :param master_timeout: Period to wait for a connection to the master node. If
107+ no response is received before the timeout expires, the request fails and
108+ returns an error.
109+ :param timeout: Period to wait for a response. If no response is received before
110+ the timeout expires, the request fails and returns an error.
85111 """
86112 if node_id not in SKIP_IN_PATH :
87113 __path = f"/_nodes/{ _quote (node_id )} /shutdown"
@@ -94,24 +120,40 @@ async def get_node(
94120 __query ["filter_path" ] = filter_path
95121 if human is not None :
96122 __query ["human" ] = human
123+ if master_timeout is not None :
124+ __query ["master_timeout" ] = master_timeout
97125 if pretty is not None :
98126 __query ["pretty" ] = pretty
127+ if timeout is not None :
128+ __query ["timeout" ] = timeout
99129 __headers = {"accept" : "application/json" }
100130 return await self .perform_request ( # type: ignore[return-value]
101131 "GET" , __path , params = __query , headers = __headers
102132 )
103133
104- @_rewrite_parameters ()
134+ @_rewrite_parameters (
135+ body_fields = True ,
136+ )
105137 async def put_node (
106138 self ,
107139 * ,
108140 node_id : str ,
141+ reason : str ,
142+ type : t .Union ["t.Literal['remove', 'replace', 'restart']" , str ],
143+ allocation_delay : t .Optional [str ] = None ,
109144 error_trace : t .Optional [bool ] = None ,
110145 filter_path : t .Optional [
111146 t .Union [str , t .Union [t .List [str ], t .Tuple [str , ...]]]
112147 ] = None ,
113148 human : t .Optional [bool ] = None ,
149+ master_timeout : t .Optional [
150+ t .Union ["t.Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's']" , str ]
151+ ] = None ,
114152 pretty : t .Optional [bool ] = None ,
153+ target_node_name : t .Optional [str ] = None ,
154+ timeout : t .Optional [
155+ t .Union ["t.Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's']" , str ]
156+ ] = None ,
115157 ) -> ObjectApiResponse [t .Any ]:
116158 """
117159 Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct
@@ -120,20 +162,68 @@ async def put_node(
120162 `<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
121163
122164 :param node_id: The node id of node to be shut down
165+ :param reason: A human-readable reason that the node is being shut down. This
166+ field provides information for other cluster operators; it does not affect
167+ the shut down process.
168+ :param type: Valid values are restart, remove, or replace. Use restart when you
169+ need to temporarily shut down a node to perform an upgrade, make configuration
170+ changes, or perform other maintenance. Because the node is expected to rejoin
171+ the cluster, data is not migrated off of the node. Use remove when you need
172+ to permanently remove a node from the cluster. The node is not marked ready
173+ for shutdown until data is migrated off of the node Use replace to do a 1:1
174+ replacement of a node with another node. Certain allocation decisions will
175+ be ignored (such as disk watermarks) in the interest of true replacement
176+ of the source node with the target node. During a replace-type shutdown,
177+ rollover and index creation may result in unassigned shards, and shrink may
178+ fail until the replacement is complete.
179+ :param allocation_delay: Only valid if type is restart. Controls how long Elasticsearch
180+ will wait for the node to restart and join the cluster before reassigning
181+ its shards to other nodes. This works the same as delaying allocation with
182+ the index.unassigned.node_left.delayed_timeout setting. If you specify both
183+ a restart allocation delay and an index-level allocation delay, the longer
184+ of the two is used.
185+ :param master_timeout: Period to wait for a connection to the master node. If
186+ no response is received before the timeout expires, the request fails and
187+ returns an error.
188+ :param target_node_name: Only valid if type is replace. Specifies the name of
189+ the node that is replacing the node being shut down. Shards from the shut
190+ down node are only allowed to be allocated to the target node, and no other
191+ data will be allocated to the target node. During relocation of data certain
192+ allocation rules are ignored, such as disk watermarks or user attribute filtering
193+ rules.
194+ :param timeout: Period to wait for a response. If no response is received before
195+ the timeout expires, the request fails and returns an error.
123196 """
124197 if node_id in SKIP_IN_PATH :
125198 raise ValueError ("Empty value passed for parameter 'node_id'" )
199+ if reason is None :
200+ raise ValueError ("Empty value passed for parameter 'reason'" )
201+ if type is None :
202+ raise ValueError ("Empty value passed for parameter 'type'" )
126203 __path = f"/_nodes/{ _quote (node_id )} /shutdown"
204+ __body : t .Dict [str , t .Any ] = {}
127205 __query : t .Dict [str , t .Any ] = {}
206+ if reason is not None :
207+ __body ["reason" ] = reason
208+ if type is not None :
209+ __body ["type" ] = type
210+ if allocation_delay is not None :
211+ __body ["allocation_delay" ] = allocation_delay
128212 if error_trace is not None :
129213 __query ["error_trace" ] = error_trace
130214 if filter_path is not None :
131215 __query ["filter_path" ] = filter_path
132216 if human is not None :
133217 __query ["human" ] = human
218+ if master_timeout is not None :
219+ __query ["master_timeout" ] = master_timeout
134220 if pretty is not None :
135221 __query ["pretty" ] = pretty
136- __headers = {"accept" : "application/json" }
222+ if target_node_name is not None :
223+ __body ["target_node_name" ] = target_node_name
224+ if timeout is not None :
225+ __query ["timeout" ] = timeout
226+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
137227 return await self .perform_request ( # type: ignore[return-value]
138- "PUT" , __path , params = __query , headers = __headers
228+ "PUT" , __path , params = __query , headers = __headers , body = __body
139229 )
0 commit comments