|
| 1 | +# Licensed to Elasticsearch B.V. under one or more contributor |
| 2 | +# license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright |
| 4 | +# ownership. Elasticsearch B.V. licenses this file to you under |
| 5 | +# the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +class C: |
| 19 | + |
| 20 | + @_rewrite_parameters() |
| 21 | + @_stability_warning(Stability.EXPERIMENTAL) |
| 22 | + async def delete_desired_balance( |
| 23 | + self, |
| 24 | + *, |
| 25 | + error_trace: t.Optional[bool] = None, |
| 26 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 27 | + human: t.Optional[bool] = None, |
| 28 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 29 | + pretty: t.Optional[bool] = None, |
| 30 | + ) -> ObjectApiResponse[t.Any]: |
| 31 | + """ |
| 32 | + .. raw:: html |
| 33 | +
|
| 34 | + <p>This API is a diagnostics API and the output should not be relied upon for building applications.</p> |
| 35 | +
|
| 36 | +
|
| 37 | + :param master_timeout: Period to wait for a connection to the master node. |
| 38 | + """ |
| 39 | + __path_parts: t.Dict[str, str] = {} |
| 40 | + __path = "/_internal/desired_balance" |
| 41 | + __query: t.Dict[str, t.Any] = {} |
| 42 | + if error_trace is not None: |
| 43 | + __query["error_trace"] = error_trace |
| 44 | + if filter_path is not None: |
| 45 | + __query["filter_path"] = filter_path |
| 46 | + if human is not None: |
| 47 | + __query["human"] = human |
| 48 | + if master_timeout is not None: |
| 49 | + __query["master_timeout"] = master_timeout |
| 50 | + if pretty is not None: |
| 51 | + __query["pretty"] = pretty |
| 52 | + __headers = {"accept": "application/json"} |
| 53 | + return await self.perform_request( # type: ignore[return-value] |
| 54 | + "DELETE", |
| 55 | + __path, |
| 56 | + params=__query, |
| 57 | + headers=__headers, |
| 58 | + endpoint_id="_internal.delete_desired_balance", |
| 59 | + path_parts=__path_parts, |
| 60 | + ) |
| 61 | + |
| 62 | + @_rewrite_parameters() |
| 63 | + @_stability_warning(Stability.EXPERIMENTAL) |
| 64 | + async def delete_desired_nodes( |
| 65 | + self, |
| 66 | + *, |
| 67 | + error_trace: t.Optional[bool] = None, |
| 68 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 69 | + human: t.Optional[bool] = None, |
| 70 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 71 | + pretty: t.Optional[bool] = None, |
| 72 | + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 73 | + ) -> ObjectApiResponse[t.Any]: |
| 74 | + """ |
| 75 | + .. raw:: html |
| 76 | +
|
| 77 | + <p>Designed for indirect use by ECE/ESS and ECK, direct use is not supported.</p> |
| 78 | +
|
| 79 | +
|
| 80 | + :param master_timeout: Period to wait for a connection to the master node. |
| 81 | + :param timeout: Period to wait for a response. If no response is received before |
| 82 | + the timeout expires, the request fails and returns an error. |
| 83 | + """ |
| 84 | + __path_parts: t.Dict[str, str] = {} |
| 85 | + __path = "/_internal/desired_nodes" |
| 86 | + __query: t.Dict[str, t.Any] = {} |
| 87 | + if error_trace is not None: |
| 88 | + __query["error_trace"] = error_trace |
| 89 | + if filter_path is not None: |
| 90 | + __query["filter_path"] = filter_path |
| 91 | + if human is not None: |
| 92 | + __query["human"] = human |
| 93 | + if master_timeout is not None: |
| 94 | + __query["master_timeout"] = master_timeout |
| 95 | + if pretty is not None: |
| 96 | + __query["pretty"] = pretty |
| 97 | + if timeout is not None: |
| 98 | + __query["timeout"] = timeout |
| 99 | + __headers = {"accept": "application/json"} |
| 100 | + return await self.perform_request( # type: ignore[return-value] |
| 101 | + "DELETE", |
| 102 | + __path, |
| 103 | + params=__query, |
| 104 | + headers=__headers, |
| 105 | + endpoint_id="_internal.delete_desired_nodes", |
| 106 | + path_parts=__path_parts, |
| 107 | + ) |
| 108 | + |
| 109 | + @_rewrite_parameters() |
| 110 | + @_stability_warning(Stability.EXPERIMENTAL) |
| 111 | + async def get_desired_balance( |
| 112 | + self, |
| 113 | + *, |
| 114 | + error_trace: t.Optional[bool] = None, |
| 115 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 116 | + human: t.Optional[bool] = None, |
| 117 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 118 | + pretty: t.Optional[bool] = None, |
| 119 | + ) -> ObjectApiResponse[t.Any]: |
| 120 | + """ |
| 121 | + .. raw:: html |
| 122 | +
|
| 123 | + <p>This API is a diagnostics API and the output should not be relied upon for building applications.</p> |
| 124 | +
|
| 125 | +
|
| 126 | + :param master_timeout: Period to wait for a connection to the master node. |
| 127 | + """ |
| 128 | + __path_parts: t.Dict[str, str] = {} |
| 129 | + __path = "/_internal/desired_balance" |
| 130 | + __query: t.Dict[str, t.Any] = {} |
| 131 | + if error_trace is not None: |
| 132 | + __query["error_trace"] = error_trace |
| 133 | + if filter_path is not None: |
| 134 | + __query["filter_path"] = filter_path |
| 135 | + if human is not None: |
| 136 | + __query["human"] = human |
| 137 | + if master_timeout is not None: |
| 138 | + __query["master_timeout"] = master_timeout |
| 139 | + if pretty is not None: |
| 140 | + __query["pretty"] = pretty |
| 141 | + __headers = {"accept": "application/json"} |
| 142 | + return await self.perform_request( # type: ignore[return-value] |
| 143 | + "GET", |
| 144 | + __path, |
| 145 | + params=__query, |
| 146 | + headers=__headers, |
| 147 | + endpoint_id="_internal.get_desired_balance", |
| 148 | + path_parts=__path_parts, |
| 149 | + ) |
| 150 | + |
| 151 | + @_rewrite_parameters() |
| 152 | + @_stability_warning(Stability.EXPERIMENTAL) |
| 153 | + async def get_desired_nodes( |
| 154 | + self, |
| 155 | + *, |
| 156 | + error_trace: t.Optional[bool] = None, |
| 157 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 158 | + human: t.Optional[bool] = None, |
| 159 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 160 | + pretty: t.Optional[bool] = None, |
| 161 | + ) -> ObjectApiResponse[t.Any]: |
| 162 | + """ |
| 163 | + .. raw:: html |
| 164 | +
|
| 165 | + <p>Gets the latest desired nodes.</p> |
| 166 | +
|
| 167 | +
|
| 168 | + :param master_timeout: Period to wait for a connection to the master node. |
| 169 | + """ |
| 170 | + __path_parts: t.Dict[str, str] = {} |
| 171 | + __path = "/_internal/desired_nodes/_latest" |
| 172 | + __query: t.Dict[str, t.Any] = {} |
| 173 | + if error_trace is not None: |
| 174 | + __query["error_trace"] = error_trace |
| 175 | + if filter_path is not None: |
| 176 | + __query["filter_path"] = filter_path |
| 177 | + if human is not None: |
| 178 | + __query["human"] = human |
| 179 | + if master_timeout is not None: |
| 180 | + __query["master_timeout"] = master_timeout |
| 181 | + if pretty is not None: |
| 182 | + __query["pretty"] = pretty |
| 183 | + __headers = {"accept": "application/json"} |
| 184 | + return await self.perform_request( # type: ignore[return-value] |
| 185 | + "GET", |
| 186 | + __path, |
| 187 | + params=__query, |
| 188 | + headers=__headers, |
| 189 | + endpoint_id="_internal.get_desired_nodes", |
| 190 | + path_parts=__path_parts, |
| 191 | + ) |
| 192 | + |
| 193 | + @_rewrite_parameters() |
| 194 | + @_stability_warning(Stability.EXPERIMENTAL) |
| 195 | + async def prevalidate_node_removal( |
| 196 | + self, |
| 197 | + *, |
| 198 | + error_trace: t.Optional[bool] = None, |
| 199 | + external_ids: t.Optional[t.Sequence[str]] = None, |
| 200 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 201 | + human: t.Optional[bool] = None, |
| 202 | + ids: t.Optional[t.Sequence[str]] = None, |
| 203 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 204 | + names: t.Optional[t.Sequence[str]] = None, |
| 205 | + pretty: t.Optional[bool] = None, |
| 206 | + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 207 | + ) -> ObjectApiResponse[t.Any]: |
| 208 | + """ |
| 209 | + .. raw:: html |
| 210 | +
|
| 211 | + <p>Prevalidates node removal from the cluster.</p> |
| 212 | +
|
| 213 | +
|
| 214 | + :param external_ids: A comma-separated list of node external IDs to prevalidate |
| 215 | + :param ids: A comma-separated list of node IDs to prevalidate |
| 216 | + :param master_timeout: Period to wait for a connection to the master node. |
| 217 | + :param names: A comma-separated list of node names to prevalidate |
| 218 | + :param timeout: Period to wait for a response. If no response is received before |
| 219 | + the timeout expires, the request fails and returns an error. |
| 220 | + """ |
| 221 | + __path_parts: t.Dict[str, str] = {} |
| 222 | + __path = "/_internal/prevalidate_node_removal" |
| 223 | + __query: t.Dict[str, t.Any] = {} |
| 224 | + if error_trace is not None: |
| 225 | + __query["error_trace"] = error_trace |
| 226 | + if external_ids is not None: |
| 227 | + __query["external_ids"] = external_ids |
| 228 | + if filter_path is not None: |
| 229 | + __query["filter_path"] = filter_path |
| 230 | + if human is not None: |
| 231 | + __query["human"] = human |
| 232 | + if ids is not None: |
| 233 | + __query["ids"] = ids |
| 234 | + if master_timeout is not None: |
| 235 | + __query["master_timeout"] = master_timeout |
| 236 | + if names is not None: |
| 237 | + __query["names"] = names |
| 238 | + if pretty is not None: |
| 239 | + __query["pretty"] = pretty |
| 240 | + if timeout is not None: |
| 241 | + __query["timeout"] = timeout |
| 242 | + __headers = {"accept": "application/json"} |
| 243 | + return await self.perform_request( # type: ignore[return-value] |
| 244 | + "POST", |
| 245 | + __path, |
| 246 | + params=__query, |
| 247 | + headers=__headers, |
| 248 | + endpoint_id="_internal.prevalidate_node_removal", |
| 249 | + path_parts=__path_parts, |
| 250 | + ) |
| 251 | + |
| 252 | + @_rewrite_parameters( |
| 253 | + body_name="body", |
| 254 | + ignore_deprecated_options={"body"}, |
| 255 | + ) |
| 256 | + @_stability_warning(Stability.EXPERIMENTAL) |
| 257 | + async def update_desired_nodes( |
| 258 | + self, |
| 259 | + *, |
| 260 | + history_id: str, |
| 261 | + version: int, |
| 262 | + body: t.Optional[t.Any] = None, |
| 263 | + body: t.Optional[t.Any] = None, |
| 264 | + dry_run: t.Optional[bool] = None, |
| 265 | + error_trace: t.Optional[bool] = None, |
| 266 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 267 | + human: t.Optional[bool] = None, |
| 268 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 269 | + pretty: t.Optional[bool] = None, |
| 270 | + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 271 | + ) -> ObjectApiResponse[t.Any]: |
| 272 | + """ |
| 273 | + .. raw:: html |
| 274 | +
|
| 275 | + <p>Designed for indirect use by ECE/ESS and ECK, direct use is not supported.</p> |
| 276 | +
|
| 277 | +
|
| 278 | + :param history_id: The history ID |
| 279 | + :param version: The version number |
| 280 | + :param body: |
| 281 | + :param dry_run: Simulate the update |
| 282 | + :param master_timeout: Period to wait for a connection to the master node. |
| 283 | + :param timeout: Period to wait for a response. If no response is received before |
| 284 | + the timeout expires, the request fails and returns an error. |
| 285 | + """ |
| 286 | + if history_id in SKIP_IN_PATH: |
| 287 | + raise ValueError("Empty value passed for parameter 'history_id'") |
| 288 | + if version in SKIP_IN_PATH: |
| 289 | + raise ValueError("Empty value passed for parameter 'version'") |
| 290 | + if body is None and body is None: |
| 291 | + raise ValueError( |
| 292 | + "Empty value passed for parameters 'body' and 'body', one of them should be set." |
| 293 | + ) |
| 294 | + elif body is not None and body is not None: |
| 295 | + raise ValueError("Cannot set both 'body' and 'body'") |
| 296 | + __path_parts: t.Dict[str, str] = { |
| 297 | + "history_id": _quote(history_id), |
| 298 | + "version": _quote(version), |
| 299 | + } |
| 300 | + __path = f'/_internal/desired_nodes/{__path_parts["history_id"]}/{__path_parts["version"]}' |
| 301 | + __query: t.Dict[str, t.Any] = {} |
| 302 | + if dry_run is not None: |
| 303 | + __query["dry_run"] = dry_run |
| 304 | + if error_trace is not None: |
| 305 | + __query["error_trace"] = error_trace |
| 306 | + if filter_path is not None: |
| 307 | + __query["filter_path"] = filter_path |
| 308 | + if human is not None: |
| 309 | + __query["human"] = human |
| 310 | + if master_timeout is not None: |
| 311 | + __query["master_timeout"] = master_timeout |
| 312 | + if pretty is not None: |
| 313 | + __query["pretty"] = pretty |
| 314 | + if timeout is not None: |
| 315 | + __query["timeout"] = timeout |
| 316 | + __body = body if body is not None else body |
| 317 | + __headers = {"accept": "application/json", "content-type": "application/json"} |
| 318 | + return await self.perform_request( # type: ignore[return-value] |
| 319 | + "PUT", |
| 320 | + __path, |
| 321 | + params=__query, |
| 322 | + headers=__headers, |
| 323 | + body=__body, |
| 324 | + endpoint_id="_internal.update_desired_nodes", |
| 325 | + path_parts=__path_parts, |
| 326 | + ) |
0 commit comments