API: Update APIs for Elasticsearch 7.10

This commit is contained in:
Seth Michael Larson
2020-10-07 10:22:43 -05:00
parent b8e2443ae9
commit 449bba6781
6 changed files with 82 additions and 16 deletions
+8 -8
View File
@@ -1413,7 +1413,7 @@ class MlClient(NamespacedClient):
"""
Deletes an existing trained inference model that is currently not referenced by
an ingest pipeline.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-inference.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-trained-models.html>`_
:arg model_id: The ID of the trained model to delete
"""
@@ -1422,7 +1422,7 @@ class MlClient(NamespacedClient):
return await self.transport.perform_request(
"DELETE",
_make_path("_ml", "inference", model_id),
_make_path("_ml", "trained_models", model_id),
params=params,
headers=headers,
)
@@ -1459,7 +1459,7 @@ class MlClient(NamespacedClient):
async def get_trained_models(self, model_id=None, params=None, headers=None):
"""
Retrieves configuration information for a trained inference model.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models.html>`_
:arg model_id: The ID of the trained models to fetch
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1488,7 +1488,7 @@ class MlClient(NamespacedClient):
return await self.transport.perform_request(
"GET",
_make_path("_ml", "inference", model_id),
_make_path("_ml", "trained_models", model_id),
params=params,
headers=headers,
)
@@ -1497,7 +1497,7 @@ class MlClient(NamespacedClient):
async def get_trained_models_stats(self, model_id=None, params=None, headers=None):
"""
Retrieves usage information for trained inference models.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference-stats.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models-stats.html>`_
:arg model_id: The ID of the trained models stats to fetch
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1513,7 +1513,7 @@ class MlClient(NamespacedClient):
return await self.transport.perform_request(
"GET",
_make_path("_ml", "inference", model_id, "_stats"),
_make_path("_ml", "trained_models", model_id, "_stats"),
params=params,
headers=headers,
)
@@ -1522,7 +1522,7 @@ class MlClient(NamespacedClient):
async def put_trained_model(self, model_id, body, params=None, headers=None):
"""
Creates an inference trained model.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-inference.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-trained-models.html>`_
:arg model_id: The ID of the trained models to store
:arg body: The trained model configuration
@@ -1533,7 +1533,7 @@ class MlClient(NamespacedClient):
return await self.transport.perform_request(
"PUT",
_make_path("_ml", "inference", model_id),
_make_path("_ml", "trained_models", model_id),
params=params,
headers=headers,
body=body,
+19
View File
@@ -530,3 +530,22 @@ class SecurityClient(NamespacedClient):
params=params,
headers=headers,
)
@query_params()
async def clear_api_key_cache(self, ids, params=None, headers=None):
"""
Clear a subset or all entries from the API key cache.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-api-key-cache.html>`_
:arg ids: A comma-separated list of IDs of API keys to clear
from the cache
"""
if ids in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'ids'.")
return await self.transport.perform_request(
"POST",
_make_path("_security", "api_key", ids, "_clear_cache"),
params=params,
headers=headers,
)
+14
View File
@@ -418,3 +418,17 @@ class SecurityClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def clear_api_key_cache(
self,
ids: Any,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
+8 -8
View File
@@ -1399,7 +1399,7 @@ class MlClient(NamespacedClient):
"""
Deletes an existing trained inference model that is currently not referenced by
an ingest pipeline.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-inference.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-trained-models.html>`_
:arg model_id: The ID of the trained model to delete
"""
@@ -1408,7 +1408,7 @@ class MlClient(NamespacedClient):
return self.transport.perform_request(
"DELETE",
_make_path("_ml", "inference", model_id),
_make_path("_ml", "trained_models", model_id),
params=params,
headers=headers,
)
@@ -1445,7 +1445,7 @@ class MlClient(NamespacedClient):
def get_trained_models(self, model_id=None, params=None, headers=None):
"""
Retrieves configuration information for a trained inference model.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models.html>`_
:arg model_id: The ID of the trained models to fetch
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1474,7 +1474,7 @@ class MlClient(NamespacedClient):
return self.transport.perform_request(
"GET",
_make_path("_ml", "inference", model_id),
_make_path("_ml", "trained_models", model_id),
params=params,
headers=headers,
)
@@ -1483,7 +1483,7 @@ class MlClient(NamespacedClient):
def get_trained_models_stats(self, model_id=None, params=None, headers=None):
"""
Retrieves usage information for trained inference models.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-inference-stats.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trained-models-stats.html>`_
:arg model_id: The ID of the trained models stats to fetch
:arg allow_no_match: Whether to ignore if a wildcard expression
@@ -1499,7 +1499,7 @@ class MlClient(NamespacedClient):
return self.transport.perform_request(
"GET",
_make_path("_ml", "inference", model_id, "_stats"),
_make_path("_ml", "trained_models", model_id, "_stats"),
params=params,
headers=headers,
)
@@ -1508,7 +1508,7 @@ class MlClient(NamespacedClient):
def put_trained_model(self, model_id, body, params=None, headers=None):
"""
Creates an inference trained model.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-inference.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-trained-models.html>`_
:arg model_id: The ID of the trained models to store
:arg body: The trained model configuration
@@ -1519,7 +1519,7 @@ class MlClient(NamespacedClient):
return self.transport.perform_request(
"PUT",
_make_path("_ml", "inference", model_id),
_make_path("_ml", "trained_models", model_id),
params=params,
headers=headers,
body=body,
+19
View File
@@ -528,3 +528,22 @@ class SecurityClient(NamespacedClient):
params=params,
headers=headers,
)
@query_params()
def clear_api_key_cache(self, ids, params=None, headers=None):
"""
Clear a subset or all entries from the API key cache.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-api-key-cache.html>`_
:arg ids: A comma-separated list of IDs of API keys to clear
from the cache
"""
if ids in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'ids'.")
return self.transport.perform_request(
"POST",
_make_path("_security", "api_key", ids, "_clear_cache"),
params=params,
headers=headers,
)
+14
View File
@@ -418,3 +418,17 @@ class SecurityClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def clear_api_key_cache(
self,
ids: Any,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...