|
25 | 25 |
|
26 | 26 | class IngestClient(NamespacedClient):
|
27 | 27 |
|
| 28 | + @_rewrite_parameters() |
| 29 | + async def delete_geoip_database( |
| 30 | + self, |
| 31 | + *, |
| 32 | + id: t.Union[str, t.Sequence[str]], |
| 33 | + error_trace: t.Optional[bool] = None, |
| 34 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 35 | + human: t.Optional[bool] = None, |
| 36 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 37 | + pretty: t.Optional[bool] = None, |
| 38 | + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 39 | + ) -> ObjectApiResponse[t.Any]: |
| 40 | + """ |
| 41 | + Deletes a geoip database configuration. |
| 42 | +
|
| 43 | + `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html>`_ |
| 44 | +
|
| 45 | + :param id: A comma-separated list of geoip database configurations to delete |
| 46 | + :param master_timeout: Period to wait for a connection to the master node. If |
| 47 | + no response is received before the timeout expires, the request fails and |
| 48 | + returns an error. |
| 49 | + :param timeout: Period to wait for a response. If no response is received before |
| 50 | + the timeout expires, the request fails and returns an error. |
| 51 | + """ |
| 52 | + if id in SKIP_IN_PATH: |
| 53 | + raise ValueError("Empty value passed for parameter 'id'") |
| 54 | + __path_parts: t.Dict[str, str] = {"id": _quote(id)} |
| 55 | + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' |
| 56 | + __query: t.Dict[str, t.Any] = {} |
| 57 | + if error_trace is not None: |
| 58 | + __query["error_trace"] = error_trace |
| 59 | + if filter_path is not None: |
| 60 | + __query["filter_path"] = filter_path |
| 61 | + if human is not None: |
| 62 | + __query["human"] = human |
| 63 | + if master_timeout is not None: |
| 64 | + __query["master_timeout"] = master_timeout |
| 65 | + if pretty is not None: |
| 66 | + __query["pretty"] = pretty |
| 67 | + if timeout is not None: |
| 68 | + __query["timeout"] = timeout |
| 69 | + __headers = {"accept": "application/json"} |
| 70 | + return await self.perform_request( # type: ignore[return-value] |
| 71 | + "DELETE", |
| 72 | + __path, |
| 73 | + params=__query, |
| 74 | + headers=__headers, |
| 75 | + endpoint_id="ingest.delete_geoip_database", |
| 76 | + path_parts=__path_parts, |
| 77 | + ) |
| 78 | + |
28 | 79 | @_rewrite_parameters()
|
29 | 80 | async def delete_pipeline(
|
30 | 81 | self,
|
@@ -112,6 +163,57 @@ async def geo_ip_stats(
|
112 | 163 | path_parts=__path_parts,
|
113 | 164 | )
|
114 | 165 |
|
| 166 | + @_rewrite_parameters() |
| 167 | + async def get_geoip_database( |
| 168 | + self, |
| 169 | + *, |
| 170 | + id: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 171 | + error_trace: t.Optional[bool] = None, |
| 172 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 173 | + human: t.Optional[bool] = None, |
| 174 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 175 | + pretty: t.Optional[bool] = None, |
| 176 | + ) -> ObjectApiResponse[t.Any]: |
| 177 | + """ |
| 178 | + Returns information about one or more geoip database configurations. |
| 179 | +
|
| 180 | + `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html>`_ |
| 181 | +
|
| 182 | + :param id: Comma-separated list of database configuration IDs to retrieve. Wildcard |
| 183 | + (`*`) expressions are supported. To get all database configurations, omit |
| 184 | + this parameter or use `*`. |
| 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 | + """ |
| 189 | + __path_parts: t.Dict[str, str] |
| 190 | + if id not in SKIP_IN_PATH: |
| 191 | + __path_parts = {"id": _quote(id)} |
| 192 | + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' |
| 193 | + else: |
| 194 | + __path_parts = {} |
| 195 | + __path = "/_ingest/geoip/database" |
| 196 | + __query: t.Dict[str, t.Any] = {} |
| 197 | + if error_trace is not None: |
| 198 | + __query["error_trace"] = error_trace |
| 199 | + if filter_path is not None: |
| 200 | + __query["filter_path"] = filter_path |
| 201 | + if human is not None: |
| 202 | + __query["human"] = human |
| 203 | + if master_timeout is not None: |
| 204 | + __query["master_timeout"] = master_timeout |
| 205 | + if pretty is not None: |
| 206 | + __query["pretty"] = pretty |
| 207 | + __headers = {"accept": "application/json"} |
| 208 | + return await self.perform_request( # type: ignore[return-value] |
| 209 | + "GET", |
| 210 | + __path, |
| 211 | + params=__query, |
| 212 | + headers=__headers, |
| 213 | + endpoint_id="ingest.get_geoip_database", |
| 214 | + path_parts=__path_parts, |
| 215 | + ) |
| 216 | + |
115 | 217 | @_rewrite_parameters()
|
116 | 218 | async def get_pipeline(
|
117 | 219 | self,
|
@@ -205,6 +307,79 @@ async def processor_grok(
|
205 | 307 | path_parts=__path_parts,
|
206 | 308 | )
|
207 | 309 |
|
| 310 | + @_rewrite_parameters( |
| 311 | + body_fields=("maxmind", "name"), |
| 312 | + ) |
| 313 | + async def put_geoip_database( |
| 314 | + self, |
| 315 | + *, |
| 316 | + id: str, |
| 317 | + maxmind: t.Optional[t.Mapping[str, t.Any]] = None, |
| 318 | + name: t.Optional[str] = None, |
| 319 | + error_trace: t.Optional[bool] = None, |
| 320 | + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, |
| 321 | + human: t.Optional[bool] = None, |
| 322 | + master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 323 | + pretty: t.Optional[bool] = None, |
| 324 | + timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None, |
| 325 | + body: t.Optional[t.Dict[str, t.Any]] = None, |
| 326 | + ) -> ObjectApiResponse[t.Any]: |
| 327 | + """ |
| 328 | + Returns information about one or more geoip database configurations. |
| 329 | +
|
| 330 | + `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/TODO.html>`_ |
| 331 | +
|
| 332 | + :param id: ID of the database configuration to create or update. |
| 333 | + :param maxmind: The configuration necessary to identify which IP geolocation |
| 334 | + provider to use to download the database, as well as any provider-specific |
| 335 | + configuration necessary for such downloading. At present, the only supported |
| 336 | + provider is maxmind, and the maxmind provider requires that an account_id |
| 337 | + (string) is configured. |
| 338 | + :param name: The provider-assigned name of the IP geolocation database to download. |
| 339 | + :param master_timeout: Period to wait for a connection to the master node. If |
| 340 | + no response is received before the timeout expires, the request fails and |
| 341 | + returns an error. |
| 342 | + :param timeout: Period to wait for a response. If no response is received before |
| 343 | + the timeout expires, the request fails and returns an error. |
| 344 | + """ |
| 345 | + if id in SKIP_IN_PATH: |
| 346 | + raise ValueError("Empty value passed for parameter 'id'") |
| 347 | + if maxmind is None and body is None: |
| 348 | + raise ValueError("Empty value passed for parameter 'maxmind'") |
| 349 | + if name is None and body is None: |
| 350 | + raise ValueError("Empty value passed for parameter 'name'") |
| 351 | + __path_parts: t.Dict[str, str] = {"id": _quote(id)} |
| 352 | + __path = f'/_ingest/geoip/database/{__path_parts["id"]}' |
| 353 | + __query: t.Dict[str, t.Any] = {} |
| 354 | + __body: t.Dict[str, t.Any] = body if body is not None else {} |
| 355 | + if error_trace is not None: |
| 356 | + __query["error_trace"] = error_trace |
| 357 | + if filter_path is not None: |
| 358 | + __query["filter_path"] = filter_path |
| 359 | + if human is not None: |
| 360 | + __query["human"] = human |
| 361 | + if master_timeout is not None: |
| 362 | + __query["master_timeout"] = master_timeout |
| 363 | + if pretty is not None: |
| 364 | + __query["pretty"] = pretty |
| 365 | + if timeout is not None: |
| 366 | + __query["timeout"] = timeout |
| 367 | + if not __body: |
| 368 | + if maxmind is not None: |
| 369 | + __body["maxmind"] = maxmind |
| 370 | + if name is not None: |
| 371 | + __body["name"] = name |
| 372 | + __headers = {"accept": "application/json", "content-type": "application/json"} |
| 373 | + return await self.perform_request( # type: ignore[return-value] |
| 374 | + "PUT", |
| 375 | + __path, |
| 376 | + params=__query, |
| 377 | + headers=__headers, |
| 378 | + body=__body, |
| 379 | + endpoint_id="ingest.put_geoip_database", |
| 380 | + path_parts=__path_parts, |
| 381 | + ) |
| 382 | + |
208 | 383 | @_rewrite_parameters(
|
209 | 384 | body_fields=("description", "meta", "on_failure", "processors", "version"),
|
210 | 385 | parameter_aliases={"_meta": "meta"},
|
|
0 commit comments