Skip to content

Commit 449bba6

Browse files
committed
API: Update APIs for Elasticsearch 7.10
1 parent b8e2443 commit 449bba6

File tree

6 files changed

+82
-16
lines changed

6 files changed

+82
-16
lines changed

elasticsearch/_async/client/ml.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ async def delete_trained_model(self, model_id, params=None, headers=None):
14131413
"""
14141414
Deletes an existing trained inference model that is currently not referenced by
14151415
an ingest pipeline.
1416-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-inference.html>`_
1416+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-trained-models.html>`_
14171417
14181418
:arg model_id: The ID of the trained model to delete
14191419
"""
@@ -1422,7 +1422,7 @@ async def delete_trained_model(self, model_id, params=None, headers=None):
14221422

14231423
return await self.transport.perform_request(
14241424
"DELETE",
1425-
_make_path("_ml", "inference", model_id),
1425+
_make_path("_ml", "trained_models", model_id),
14261426
params=params,
14271427
headers=headers,
14281428
)
@@ -1459,7 +1459,7 @@ async def explain_data_frame_analytics(
14591459
async def get_trained_models(self, model_id=None, params=None, headers=None):
14601460
"""
14611461
Retrieves configuration information for a trained inference model.
1462-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference.html>`_
1462+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models.html>`_
14631463
14641464
:arg model_id: The ID of the trained models to fetch
14651465
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1488,7 +1488,7 @@ async def get_trained_models(self, model_id=None, params=None, headers=None):
14881488

14891489
return await self.transport.perform_request(
14901490
"GET",
1491-
_make_path("_ml", "inference", model_id),
1491+
_make_path("_ml", "trained_models", model_id),
14921492
params=params,
14931493
headers=headers,
14941494
)
@@ -1497,7 +1497,7 @@ async def get_trained_models(self, model_id=None, params=None, headers=None):
14971497
async def get_trained_models_stats(self, model_id=None, params=None, headers=None):
14981498
"""
14991499
Retrieves usage information for trained inference models.
1500-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference-stats.html>`_
1500+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models-stats.html>`_
15011501
15021502
:arg model_id: The ID of the trained models stats to fetch
15031503
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1513,7 +1513,7 @@ async def get_trained_models_stats(self, model_id=None, params=None, headers=Non
15131513

15141514
return await self.transport.perform_request(
15151515
"GET",
1516-
_make_path("_ml", "inference", model_id, "_stats"),
1516+
_make_path("_ml", "trained_models", model_id, "_stats"),
15171517
params=params,
15181518
headers=headers,
15191519
)
@@ -1522,7 +1522,7 @@ async def get_trained_models_stats(self, model_id=None, params=None, headers=Non
15221522
async def put_trained_model(self, model_id, body, params=None, headers=None):
15231523
"""
15241524
Creates an inference trained model.
1525-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-inference.html>`_
1525+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-trained-models.html>`_
15261526
15271527
:arg model_id: The ID of the trained models to store
15281528
:arg body: The trained model configuration
@@ -1533,7 +1533,7 @@ async def put_trained_model(self, model_id, body, params=None, headers=None):
15331533

15341534
return await self.transport.perform_request(
15351535
"PUT",
1536-
_make_path("_ml", "inference", model_id),
1536+
_make_path("_ml", "trained_models", model_id),
15371537
params=params,
15381538
headers=headers,
15391539
body=body,

elasticsearch/_async/client/security.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,3 +530,22 @@ async def clear_cached_privileges(self, application, params=None, headers=None):
530530
params=params,
531531
headers=headers,
532532
)
533+
534+
@query_params()
535+
async def clear_api_key_cache(self, ids, params=None, headers=None):
536+
"""
537+
Clear a subset or all entries from the API key cache.
538+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-api-key-cache.html>`_
539+
540+
:arg ids: A comma-separated list of IDs of API keys to clear
541+
from the cache
542+
"""
543+
if ids in SKIP_IN_PATH:
544+
raise ValueError("Empty value passed for a required argument 'ids'.")
545+
546+
return await self.transport.perform_request(
547+
"POST",
548+
_make_path("_security", "api_key", ids, "_clear_cache"),
549+
params=params,
550+
headers=headers,
551+
)

elasticsearch/_async/client/security.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,3 +418,17 @@ class SecurityClient(NamespacedClient):
418418
params: Optional[MutableMapping[str, Any]] = ...,
419419
headers: Optional[MutableMapping[str, str]] = ...,
420420
) -> Any: ...
421+
async def clear_api_key_cache(
422+
self,
423+
ids: Any,
424+
pretty: Optional[bool] = ...,
425+
human: Optional[bool] = ...,
426+
error_trace: Optional[bool] = ...,
427+
format: Optional[str] = ...,
428+
filter_path: Optional[Union[str, Collection[str]]] = ...,
429+
request_timeout: Optional[Union[int, float]] = ...,
430+
ignore: Optional[Union[int, Collection[int]]] = ...,
431+
opaque_id: Optional[str] = ...,
432+
params: Optional[MutableMapping[str, Any]] = ...,
433+
headers: Optional[MutableMapping[str, str]] = ...,
434+
) -> Any: ...

elasticsearch/client/ml.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ def delete_trained_model(self, model_id, params=None, headers=None):
13991399
"""
14001400
Deletes an existing trained inference model that is currently not referenced by
14011401
an ingest pipeline.
1402-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-inference.html>`_
1402+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-trained-models.html>`_
14031403
14041404
:arg model_id: The ID of the trained model to delete
14051405
"""
@@ -1408,7 +1408,7 @@ def delete_trained_model(self, model_id, params=None, headers=None):
14081408

14091409
return self.transport.perform_request(
14101410
"DELETE",
1411-
_make_path("_ml", "inference", model_id),
1411+
_make_path("_ml", "trained_models", model_id),
14121412
params=params,
14131413
headers=headers,
14141414
)
@@ -1445,7 +1445,7 @@ def explain_data_frame_analytics(
14451445
def get_trained_models(self, model_id=None, params=None, headers=None):
14461446
"""
14471447
Retrieves configuration information for a trained inference model.
1448-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference.html>`_
1448+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models.html>`_
14491449
14501450
:arg model_id: The ID of the trained models to fetch
14511451
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1474,7 +1474,7 @@ def get_trained_models(self, model_id=None, params=None, headers=None):
14741474

14751475
return self.transport.perform_request(
14761476
"GET",
1477-
_make_path("_ml", "inference", model_id),
1477+
_make_path("_ml", "trained_models", model_id),
14781478
params=params,
14791479
headers=headers,
14801480
)
@@ -1483,7 +1483,7 @@ def get_trained_models(self, model_id=None, params=None, headers=None):
14831483
def get_trained_models_stats(self, model_id=None, params=None, headers=None):
14841484
"""
14851485
Retrieves usage information for trained inference models.
1486-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference-stats.html>`_
1486+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models-stats.html>`_
14871487
14881488
:arg model_id: The ID of the trained models stats to fetch
14891489
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1499,7 +1499,7 @@ def get_trained_models_stats(self, model_id=None, params=None, headers=None):
14991499

15001500
return self.transport.perform_request(
15011501
"GET",
1502-
_make_path("_ml", "inference", model_id, "_stats"),
1502+
_make_path("_ml", "trained_models", model_id, "_stats"),
15031503
params=params,
15041504
headers=headers,
15051505
)
@@ -1508,7 +1508,7 @@ def get_trained_models_stats(self, model_id=None, params=None, headers=None):
15081508
def put_trained_model(self, model_id, body, params=None, headers=None):
15091509
"""
15101510
Creates an inference trained model.
1511-
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-inference.html>`_
1511+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-trained-models.html>`_
15121512
15131513
:arg model_id: The ID of the trained models to store
15141514
:arg body: The trained model configuration
@@ -1519,7 +1519,7 @@ def put_trained_model(self, model_id, body, params=None, headers=None):
15191519

15201520
return self.transport.perform_request(
15211521
"PUT",
1522-
_make_path("_ml", "inference", model_id),
1522+
_make_path("_ml", "trained_models", model_id),
15231523
params=params,
15241524
headers=headers,
15251525
body=body,

elasticsearch/client/security.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,22 @@ def clear_cached_privileges(self, application, params=None, headers=None):
528528
params=params,
529529
headers=headers,
530530
)
531+
532+
@query_params()
533+
def clear_api_key_cache(self, ids, params=None, headers=None):
534+
"""
535+
Clear a subset or all entries from the API key cache.
536+
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-api-key-cache.html>`_
537+
538+
:arg ids: A comma-separated list of IDs of API keys to clear
539+
from the cache
540+
"""
541+
if ids in SKIP_IN_PATH:
542+
raise ValueError("Empty value passed for a required argument 'ids'.")
543+
544+
return self.transport.perform_request(
545+
"POST",
546+
_make_path("_security", "api_key", ids, "_clear_cache"),
547+
params=params,
548+
headers=headers,
549+
)

elasticsearch/client/security.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,3 +418,17 @@ class SecurityClient(NamespacedClient):
418418
params: Optional[MutableMapping[str, Any]] = ...,
419419
headers: Optional[MutableMapping[str, str]] = ...,
420420
) -> Any: ...
421+
def clear_api_key_cache(
422+
self,
423+
ids: Any,
424+
pretty: Optional[bool] = ...,
425+
human: Optional[bool] = ...,
426+
error_trace: Optional[bool] = ...,
427+
format: Optional[str] = ...,
428+
filter_path: Optional[Union[str, Collection[str]]] = ...,
429+
request_timeout: Optional[Union[int, float]] = ...,
430+
ignore: Optional[Union[int, Collection[int]]] = ...,
431+
opaque_id: Optional[str] = ...,
432+
params: Optional[MutableMapping[str, Any]] = ...,
433+
headers: Optional[MutableMapping[str, str]] = ...,
434+
) -> Any: ...

0 commit comments

Comments
 (0)