Update APIs on 7.x
This commit is contained in:
@@ -19,7 +19,7 @@ from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
|
||||
|
||||
|
||||
class EqlClient(NamespacedClient):
|
||||
@query_params()
|
||||
@query_params("keep_alive", "keep_on_completion", "wait_for_completion_timeout")
|
||||
async def search(self, index, body, params=None, headers=None):
|
||||
"""
|
||||
Returns results matching a query expressed in Event Query Language (EQL)
|
||||
@@ -28,6 +28,13 @@ class EqlClient(NamespacedClient):
|
||||
:arg index: The name of the index to scope the operation
|
||||
:arg body: Eql request body. Use the `query` to limit the query
|
||||
scope.
|
||||
:arg keep_alive: Update the time interval in which the results
|
||||
(partial or final) for this search will be available Default: 5d
|
||||
:arg keep_on_completion: Control whether the response should be
|
||||
stored in the cluster if it completed within the provided
|
||||
[wait_for_completion] time (default: false)
|
||||
:arg wait_for_completion_timeout: Specify the time that the
|
||||
request should block waiting for the final response
|
||||
"""
|
||||
for param in (index, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
@@ -40,3 +47,39 @@ class EqlClient(NamespacedClient):
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def delete(self, id, params=None, headers=None):
|
||||
"""
|
||||
Deletes an async EQL search by ID. If the search is still running, the search
|
||||
request will be cancelled. Otherwise, the saved search results are deleted.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
|
||||
|
||||
:arg id: The async search ID
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return await self.transport.perform_request(
|
||||
"DELETE", _make_path("_eql", "search", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("keep_alive", "wait_for_completion_timeout")
|
||||
async def get(self, id, params=None, headers=None):
|
||||
"""
|
||||
Returns async results from previously executed Event Query Language (EQL)
|
||||
search
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
|
||||
|
||||
:arg id: The async search ID
|
||||
:arg keep_alive: Update the time interval in which the results
|
||||
(partial or final) for this search will be available Default: 5d
|
||||
:arg wait_for_completion_timeout: Specify the time that the
|
||||
request should block waiting for the final response
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_eql", "search", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -1314,7 +1314,8 @@ class IndicesClient(NamespacedClient):
|
||||
Deletes a data stream.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
||||
|
||||
:arg name: The name of the data stream
|
||||
:arg name: A comma-separated list of data streams to delete; use
|
||||
`*` to delete all data streams
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
@@ -1443,8 +1444,8 @@ class IndicesClient(NamespacedClient):
|
||||
Returns data streams.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
||||
|
||||
:arg name: The name or wildcard expression of the requested data
|
||||
streams
|
||||
:arg name: A comma-separated list of data streams to get; use
|
||||
`*` to get all data streams
|
||||
"""
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_data_stream", name), params=params, headers=headers
|
||||
@@ -1492,3 +1493,37 @@ class IndicesClient(NamespacedClient):
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_resolve", "index", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"allow_no_indices",
|
||||
"expand_wildcards",
|
||||
"ignore_unavailable",
|
||||
"master_timeout",
|
||||
"timeout",
|
||||
)
|
||||
async def add_block(self, index, block, params=None, headers=None):
|
||||
"""
|
||||
Adds a block to an index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-blocks.html>`_
|
||||
|
||||
:arg index: A comma separated list of indices to add a block to
|
||||
:arg block: The block to add (one of read, write, read_only or
|
||||
metadata)
|
||||
:arg allow_no_indices: Whether to ignore if a wildcard indices
|
||||
expression resolves into no concrete indices. (This includes `_all`
|
||||
string or when no indices have been specified)
|
||||
:arg expand_wildcards: Whether to expand wildcard expression to
|
||||
concrete indices that are open, closed or both. Valid choices: open,
|
||||
closed, hidden, none, all Default: open
|
||||
:arg ignore_unavailable: Whether specified concrete indices
|
||||
should be ignored when unavailable (missing or closed)
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
for param in (index, block):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return await self.transport.perform_request(
|
||||
"PUT", _make_path(index, "_block", block), params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -1529,3 +1529,24 @@ class MlClient(NamespacedClient):
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def update_data_frame_analytics(self, id, body, params=None, headers=None):
|
||||
"""
|
||||
Updates certain properties of a data frame analytics job.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/update-dfanalytics.html>`_
|
||||
|
||||
:arg id: The ID of the data frame analytics to update
|
||||
:arg body: The data frame analytics settings to update
|
||||
"""
|
||||
for param in (id, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_ml", "data_frame", "analytics", id, "_update"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@@ -510,3 +510,23 @@ class SecurityClient(NamespacedClient):
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_security/privilege/_builtin", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def clear_cached_privileges(self, application, params=None, headers=None):
|
||||
"""
|
||||
Evicts application privileges from the native application privileges cache.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-privilege-cache.html>`_
|
||||
|
||||
:arg application: A comma-separated list of application names
|
||||
"""
|
||||
if application in SKIP_IN_PATH:
|
||||
raise ValueError(
|
||||
"Empty value passed for a required argument 'application'."
|
||||
)
|
||||
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_security", "privilege", application, "_clear_cache"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@@ -23,12 +23,14 @@ class XPackClient(NamespacedClient):
|
||||
return getattr(self.client, attr_name)
|
||||
|
||||
# AUTO-GENERATED-API-DEFINITIONS #
|
||||
@query_params("categories")
|
||||
@query_params("accept_enterprise", "categories")
|
||||
async def info(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the installed X-Pack features.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/info-api.html>`_
|
||||
|
||||
:arg accept_enterprise: If an enterprise license is installed,
|
||||
return the type and mode as 'enterprise' (default: false)
|
||||
:arg categories: Comma-separated list of info categories. Can be
|
||||
any of: build, license, features
|
||||
"""
|
||||
|
||||
@@ -19,7 +19,7 @@ from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
|
||||
|
||||
|
||||
class EqlClient(NamespacedClient):
|
||||
@query_params()
|
||||
@query_params("keep_alive", "keep_on_completion", "wait_for_completion_timeout")
|
||||
def search(self, index, body, params=None, headers=None):
|
||||
"""
|
||||
Returns results matching a query expressed in Event Query Language (EQL)
|
||||
@@ -28,6 +28,13 @@ class EqlClient(NamespacedClient):
|
||||
:arg index: The name of the index to scope the operation
|
||||
:arg body: Eql request body. Use the `query` to limit the query
|
||||
scope.
|
||||
:arg keep_alive: Update the time interval in which the results
|
||||
(partial or final) for this search will be available Default: 5d
|
||||
:arg keep_on_completion: Control whether the response should be
|
||||
stored in the cluster if it completed within the provided
|
||||
[wait_for_completion] time (default: false)
|
||||
:arg wait_for_completion_timeout: Specify the time that the
|
||||
request should block waiting for the final response
|
||||
"""
|
||||
for param in (index, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
@@ -40,3 +47,39 @@ class EqlClient(NamespacedClient):
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def delete(self, id, params=None, headers=None):
|
||||
"""
|
||||
Deletes an async EQL search by ID. If the search is still running, the search
|
||||
request will be cancelled. Otherwise, the saved search results are deleted.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
|
||||
|
||||
:arg id: The async search ID
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
"DELETE", _make_path("_eql", "search", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("keep_alive", "wait_for_completion_timeout")
|
||||
def get(self, id, params=None, headers=None):
|
||||
"""
|
||||
Returns async results from previously executed Event Query Language (EQL)
|
||||
search
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
|
||||
|
||||
:arg id: The async search ID
|
||||
:arg keep_alive: Update the time interval in which the results
|
||||
(partial or final) for this search will be available Default: 5d
|
||||
:arg wait_for_completion_timeout: Specify the time that the
|
||||
request should block waiting for the final response
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
"GET", _make_path("_eql", "search", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -1310,7 +1310,8 @@ class IndicesClient(NamespacedClient):
|
||||
Deletes a data stream.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
||||
|
||||
:arg name: The name of the data stream
|
||||
:arg name: A comma-separated list of data streams to delete; use
|
||||
`*` to delete all data streams
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
@@ -1439,8 +1440,8 @@ class IndicesClient(NamespacedClient):
|
||||
Returns data streams.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/data-streams.html>`_
|
||||
|
||||
:arg name: The name or wildcard expression of the requested data
|
||||
streams
|
||||
:arg name: A comma-separated list of data streams to get; use
|
||||
`*` to get all data streams
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
"GET", _make_path("_data_stream", name), params=params, headers=headers
|
||||
@@ -1488,3 +1489,37 @@ class IndicesClient(NamespacedClient):
|
||||
return self.transport.perform_request(
|
||||
"GET", _make_path("_resolve", "index", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"allow_no_indices",
|
||||
"expand_wildcards",
|
||||
"ignore_unavailable",
|
||||
"master_timeout",
|
||||
"timeout",
|
||||
)
|
||||
def add_block(self, index, block, params=None, headers=None):
|
||||
"""
|
||||
Adds a block to an index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-blocks.html>`_
|
||||
|
||||
:arg index: A comma separated list of indices to add a block to
|
||||
:arg block: The block to add (one of read, write, read_only or
|
||||
metadata)
|
||||
:arg allow_no_indices: Whether to ignore if a wildcard indices
|
||||
expression resolves into no concrete indices. (This includes `_all`
|
||||
string or when no indices have been specified)
|
||||
:arg expand_wildcards: Whether to expand wildcard expression to
|
||||
concrete indices that are open, closed or both. Valid choices: open,
|
||||
closed, hidden, none, all Default: open
|
||||
:arg ignore_unavailable: Whether specified concrete indices
|
||||
should be ignored when unavailable (missing or closed)
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
for param in (index, block):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
"PUT", _make_path(index, "_block", block), params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -1515,3 +1515,24 @@ class MlClient(NamespacedClient):
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def update_data_frame_analytics(self, id, body, params=None, headers=None):
|
||||
"""
|
||||
Updates certain properties of a data frame analytics job.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/update-dfanalytics.html>`_
|
||||
|
||||
:arg id: The ID of the data frame analytics to update
|
||||
:arg body: The data frame analytics settings to update
|
||||
"""
|
||||
for param in (id, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_ml", "data_frame", "analytics", id, "_update"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@@ -508,3 +508,23 @@ class SecurityClient(NamespacedClient):
|
||||
return self.transport.perform_request(
|
||||
"GET", "/_security/privilege/_builtin", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def clear_cached_privileges(self, application, params=None, headers=None):
|
||||
"""
|
||||
Evicts application privileges from the native application privileges cache.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-privilege-cache.html>`_
|
||||
|
||||
:arg application: A comma-separated list of application names
|
||||
"""
|
||||
if application in SKIP_IN_PATH:
|
||||
raise ValueError(
|
||||
"Empty value passed for a required argument 'application'."
|
||||
)
|
||||
|
||||
return self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_security", "privilege", application, "_clear_cache"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@@ -23,12 +23,14 @@ class XPackClient(NamespacedClient):
|
||||
return getattr(self.client, attr_name)
|
||||
|
||||
# AUTO-GENERATED-API-DEFINITIONS #
|
||||
@query_params("categories")
|
||||
@query_params("accept_enterprise", "categories")
|
||||
def info(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the installed X-Pack features.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/info-api.html>`_
|
||||
|
||||
:arg accept_enterprise: If an enterprise license is installed,
|
||||
return the type and mode as 'enterprise' (default: false)
|
||||
:arg categories: Comma-separated list of info categories. Can be
|
||||
any of: build, license, features
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user