[7.x] Generate async API
This commit is contained in:
committed by
Seth Michael Larson
parent
bed5ffc740
commit
05e5dc9402
File diff suppressed because it is too large
Load Diff
@@ -7,27 +7,27 @@ from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
|
||||
|
||||
class AsyncSearchClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete(self, id, params=None, headers=None):
|
||||
async def delete(self, id, params=None, headers=None):
|
||||
"""
|
||||
Deletes an async 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/master/async-search.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/async-search.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(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE", _make_path("_async_search", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("keep_alive", "typed_keys", "wait_for_completion_timeout")
|
||||
def get(self, id, params=None, headers=None):
|
||||
async def get(self, id, params=None, headers=None):
|
||||
"""
|
||||
Retrieves the results of a previously submitted async search request given its
|
||||
ID.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/async-search.html>`_
|
||||
|
||||
:arg id: The async search ID
|
||||
:arg keep_alive: Specify the time interval in which the results
|
||||
@@ -40,7 +40,7 @@ class AsyncSearchClient(NamespacedClient):
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_async_search", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -87,10 +87,10 @@ class AsyncSearchClient(NamespacedClient):
|
||||
"version",
|
||||
"wait_for_completion_timeout",
|
||||
)
|
||||
def submit(self, body=None, index=None, params=None, headers=None):
|
||||
async def submit(self, body=None, index=None, params=None, headers=None):
|
||||
"""
|
||||
Executes a search request asynchronously.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/async-search.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/async-search.html>`_
|
||||
|
||||
:arg body: The search definition using the Query DSL
|
||||
:arg index: A comma-separated list of index names to search; use
|
||||
@@ -125,7 +125,7 @@ class AsyncSearchClient(NamespacedClient):
|
||||
closed, hidden, none, all Default: open
|
||||
:arg explain: Specify whether to return detailed information
|
||||
about score computation as part of a hit
|
||||
:arg from\\_: Starting offset (default: 0)
|
||||
:arg from_: Starting offset (default: 0)
|
||||
:arg ignore_throttled: Whether specified concrete, expanded or
|
||||
aliased indices should be ignored when throttled
|
||||
:arg ignore_unavailable: Whether specified concrete indices
|
||||
@@ -182,7 +182,7 @@ class AsyncSearchClient(NamespacedClient):
|
||||
if "from_" in params:
|
||||
params["from"] = params.pop("from_")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_async_search"),
|
||||
params=params,
|
||||
|
||||
@@ -7,28 +7,28 @@ from .utils import NamespacedClient, query_params, SKIP_IN_PATH, _make_path
|
||||
|
||||
class AutoscalingClient(NamespacedClient):
|
||||
@query_params()
|
||||
def get_autoscaling_decision(self, params=None, headers=None):
|
||||
async def get_autoscaling_decision(self, params=None, headers=None):
|
||||
"""
|
||||
Gets the current autoscaling decision based on the configured autoscaling
|
||||
policy, indicating whether or not autoscaling is needed.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-get-autoscaling-decision.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-get-autoscaling-decision.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_autoscaling/decision", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def delete_autoscaling_policy(self, name, params=None, headers=None):
|
||||
async def delete_autoscaling_policy(self, name, params=None, headers=None):
|
||||
"""
|
||||
Deletes an autoscaling policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-delete-autoscaling-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-delete-autoscaling-policy.html>`_
|
||||
|
||||
:arg name: the name of the autoscaling policy
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_autoscaling", "policy", name),
|
||||
params=params,
|
||||
@@ -36,10 +36,28 @@ class AutoscalingClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def put_autoscaling_policy(self, name, body, params=None, headers=None):
|
||||
async def get_autoscaling_policy(self, name, params=None, headers=None):
|
||||
"""
|
||||
Retrieves an autoscaling policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-get-autoscaling-policy.html>`_
|
||||
|
||||
:arg name: the name of the autoscaling policy
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_autoscaling", "policy", name),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def put_autoscaling_policy(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a new autoscaling policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-put-autoscaling-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-put-autoscaling-policy.html>`_
|
||||
|
||||
:arg name: the name of the autoscaling policy
|
||||
:arg body: the specification of the autoscaling policy
|
||||
@@ -48,28 +66,10 @@ class AutoscalingClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_autoscaling", "policy", name),
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_autoscaling_policy(self, name, params=None, headers=None):
|
||||
"""
|
||||
Retrieves an autoscaling policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/autoscaling-get-autoscaling-policy.html>`_
|
||||
|
||||
:arg name: the name of the autoscaling policy
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_autoscaling", "policy", name),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@@ -7,11 +7,11 @@ from .utils import NamespacedClient, query_params, _make_path
|
||||
|
||||
class CatClient(NamespacedClient):
|
||||
@query_params("expand_wildcards", "format", "h", "help", "local", "s", "v")
|
||||
def aliases(self, name=None, params=None, headers=None):
|
||||
async def aliases(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Shows information about currently configured aliases to indices including
|
||||
filter and routing infos.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-alias.html>`_
|
||||
|
||||
:arg name: A comma-separated list of alias names to return
|
||||
:arg expand_wildcards: Whether to expand wildcard expression to
|
||||
@@ -27,16 +27,16 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "aliases", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("bytes", "format", "h", "help", "local", "master_timeout", "s", "v")
|
||||
def allocation(self, node_id=None, params=None, headers=None):
|
||||
async def allocation(self, node_id=None, params=None, headers=None):
|
||||
"""
|
||||
Provides a snapshot of how many shards are allocated to each data node and how
|
||||
much disk space they are using.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-allocation.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information
|
||||
@@ -54,7 +54,7 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "allocation", node_id),
|
||||
params=params,
|
||||
@@ -62,11 +62,11 @@ class CatClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "s", "v")
|
||||
def count(self, index=None, params=None, headers=None):
|
||||
async def count(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Provides quick access to the document count of the entire cluster, or
|
||||
individual indices.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-count.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names to limit the
|
||||
returned information
|
||||
@@ -78,15 +78,15 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "count", index), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "s", "time", "ts", "v")
|
||||
def health(self, params=None, headers=None):
|
||||
async def health(self, params=None, headers=None):
|
||||
"""
|
||||
Returns a concise representation of the cluster health.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-health.html>`_
|
||||
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
@@ -99,21 +99,21 @@ class CatClient(NamespacedClient):
|
||||
:arg ts: Set to false to disable timestamping Default: True
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/health", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("help", "s")
|
||||
def help(self, params=None, headers=None):
|
||||
async def help(self, params=None, headers=None):
|
||||
"""
|
||||
Returns help for the Cat APIs.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat.html>`_
|
||||
|
||||
:arg help: Return help information
|
||||
:arg s: Comma-separated list of column names or column aliases
|
||||
to sort by
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -132,11 +132,11 @@ class CatClient(NamespacedClient):
|
||||
"time",
|
||||
"v",
|
||||
)
|
||||
def indices(self, index=None, params=None, headers=None):
|
||||
async def indices(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about indices: number of primaries and replicas, document
|
||||
counts, disk size, ...
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-indices.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names to limit the
|
||||
returned information
|
||||
@@ -166,15 +166,15 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "indices", index), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "v")
|
||||
def master(self, params=None, headers=None):
|
||||
async def master(self, params=None, headers=None):
|
||||
"""
|
||||
Returns information about the master node.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-master.html>`_
|
||||
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
@@ -188,17 +188,26 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/master", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"bytes", "format", "full_id", "h", "help", "master_timeout", "s", "time", "v"
|
||||
"bytes",
|
||||
"format",
|
||||
"full_id",
|
||||
"h",
|
||||
"help",
|
||||
"local",
|
||||
"master_timeout",
|
||||
"s",
|
||||
"time",
|
||||
"v",
|
||||
)
|
||||
def nodes(self, params=None, headers=None):
|
||||
async def nodes(self, params=None, headers=None):
|
||||
"""
|
||||
Returns basic statistics about performance of cluster nodes.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-nodes.html>`_
|
||||
|
||||
:arg bytes: The unit in which to display byte values Valid
|
||||
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
|
||||
@@ -208,6 +217,8 @@ class CatClient(NamespacedClient):
|
||||
version (default: false)
|
||||
:arg h: Comma-separated list of column names to display
|
||||
:arg help: Return help information
|
||||
:arg local: Calculate the selected nodes using the local cluster
|
||||
state rather than the state from master node (default: false)
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
to master node
|
||||
:arg s: Comma-separated list of column names or column aliases
|
||||
@@ -216,17 +227,17 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/nodes", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"active_only", "bytes", "detailed", "format", "h", "help", "s", "time", "v"
|
||||
)
|
||||
def recovery(self, index=None, params=None, headers=None):
|
||||
async def recovery(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about index shard recoveries, both on-going completed.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-recovery.html>`_
|
||||
|
||||
:arg index: Comma-separated list or wildcard expression of index
|
||||
names to limit the returned information
|
||||
@@ -246,17 +257,17 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "recovery", index), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"bytes", "format", "h", "help", "local", "master_timeout", "s", "time", "v"
|
||||
)
|
||||
def shards(self, index=None, params=None, headers=None):
|
||||
async def shards(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Provides a detailed view of shard allocation on nodes.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-shards.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names to limit the
|
||||
returned information
|
||||
@@ -276,15 +287,15 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "shards", index), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("bytes", "format", "h", "help", "s", "v")
|
||||
def segments(self, index=None, params=None, headers=None):
|
||||
async def segments(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Provides low-level information about the segments in the shards of an index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-segments.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names to limit the
|
||||
returned information
|
||||
@@ -298,15 +309,15 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "segments", index), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "time", "v")
|
||||
def pending_tasks(self, params=None, headers=None):
|
||||
async def pending_tasks(self, params=None, headers=None):
|
||||
"""
|
||||
Returns a concise representation of the cluster pending tasks.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-pending-tasks.html>`_
|
||||
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
@@ -322,16 +333,16 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/pending_tasks", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "time", "v")
|
||||
def thread_pool(self, thread_pool_patterns=None, params=None, headers=None):
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "size", "v")
|
||||
async def thread_pool(self, thread_pool_patterns=None, params=None, headers=None):
|
||||
"""
|
||||
Returns cluster-wide thread pool statistics per node. By default the active,
|
||||
queue and rejected statistics are returned for all thread pools.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-thread-pool.html>`_
|
||||
|
||||
:arg thread_pool_patterns: A comma-separated list of regular-
|
||||
expressions to filter the thread pools in the output
|
||||
@@ -345,11 +356,11 @@ class CatClient(NamespacedClient):
|
||||
to master node
|
||||
:arg s: Comma-separated list of column names or column aliases
|
||||
to sort by
|
||||
:arg time: The unit in which to display time values Valid
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg size: The multiplier in which to display values Valid
|
||||
choices: , k, m, g, t, p
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "thread_pool", thread_pool_patterns),
|
||||
params=params,
|
||||
@@ -357,11 +368,11 @@ class CatClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("bytes", "format", "h", "help", "s", "v")
|
||||
def fielddata(self, fields=None, params=None, headers=None):
|
||||
async def fielddata(self, fields=None, params=None, headers=None):
|
||||
"""
|
||||
Shows how much heap memory is currently being used by fielddata on every data
|
||||
node in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-fielddata.html>`_
|
||||
|
||||
:arg fields: A comma-separated list of fields to return in the
|
||||
output
|
||||
@@ -375,7 +386,7 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "fielddata", fields),
|
||||
params=params,
|
||||
@@ -383,10 +394,10 @@ class CatClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "v")
|
||||
def plugins(self, params=None, headers=None):
|
||||
async def plugins(self, params=None, headers=None):
|
||||
"""
|
||||
Returns information about installed plugins across nodes node.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-plugins.html>`_
|
||||
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
@@ -400,15 +411,15 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/plugins", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "v")
|
||||
def nodeattrs(self, params=None, headers=None):
|
||||
async def nodeattrs(self, params=None, headers=None):
|
||||
"""
|
||||
Returns information about custom node attributes.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-nodeattrs.html>`_
|
||||
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
@@ -422,15 +433,15 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/nodeattrs", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "v")
|
||||
def repositories(self, params=None, headers=None):
|
||||
async def repositories(self, params=None, headers=None):
|
||||
"""
|
||||
Returns information about snapshot repositories registered in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-repositories.html>`_
|
||||
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
@@ -444,17 +455,17 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/repositories", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"format", "h", "help", "ignore_unavailable", "master_timeout", "s", "time", "v"
|
||||
)
|
||||
def snapshots(self, repository=None, params=None, headers=None):
|
||||
async def snapshots(self, repository=None, params=None, headers=None):
|
||||
"""
|
||||
Returns all snapshots in a specific repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-snapshots.html>`_
|
||||
|
||||
:arg repository: Name of repository from which to fetch the
|
||||
snapshot information
|
||||
@@ -472,7 +483,7 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "snapshots", repository),
|
||||
params=params,
|
||||
@@ -491,11 +502,11 @@ class CatClient(NamespacedClient):
|
||||
"time",
|
||||
"v",
|
||||
)
|
||||
def tasks(self, params=None, headers=None):
|
||||
async def tasks(self, params=None, headers=None):
|
||||
"""
|
||||
Returns information about the tasks currently executing on one or more nodes in
|
||||
the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/tasks.html>`_
|
||||
|
||||
:arg actions: A comma-separated list of actions that should be
|
||||
returned. Leave empty to return all.
|
||||
@@ -516,15 +527,15 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cat/tasks", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("format", "h", "help", "local", "master_timeout", "s", "v")
|
||||
def templates(self, name=None, params=None, headers=None):
|
||||
async def templates(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about existing templates.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-templates.html>`_
|
||||
|
||||
:arg name: A pattern that returned template names must match
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
@@ -539,15 +550,15 @@ class CatClient(NamespacedClient):
|
||||
to sort by
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_cat", "templates", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("allow_no_match", "bytes", "format", "h", "help", "s", "time", "v")
|
||||
def ml_data_frame_analytics(self, id=None, params=None, headers=None):
|
||||
async def ml_data_frame_analytics(self, id=None, params=None, headers=None):
|
||||
"""
|
||||
Gets configuration and usage information about data frame analytics jobs.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-dfanalytics.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-dfanalytics.html>`_
|
||||
|
||||
:arg id: The ID of the data frame analytics to fetch
|
||||
:arg allow_no_match: Whether to ignore if a wildcard expression
|
||||
@@ -565,7 +576,7 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "ml", "data_frame", "analytics", id),
|
||||
params=params,
|
||||
@@ -573,10 +584,10 @@ class CatClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("allow_no_datafeeds", "format", "h", "help", "s", "time", "v")
|
||||
def ml_datafeeds(self, datafeed_id=None, params=None, headers=None):
|
||||
async def ml_datafeeds(self, datafeed_id=None, params=None, headers=None):
|
||||
"""
|
||||
Gets configuration and usage information about datafeeds.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-datafeeds.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-datafeeds.html>`_
|
||||
|
||||
:arg datafeed_id: The ID of the datafeeds stats to fetch
|
||||
:arg allow_no_datafeeds: Whether to ignore if a wildcard
|
||||
@@ -592,7 +603,7 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "ml", "datafeeds", datafeed_id),
|
||||
params=params,
|
||||
@@ -600,10 +611,10 @@ class CatClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("allow_no_jobs", "bytes", "format", "h", "help", "s", "time", "v")
|
||||
def ml_jobs(self, job_id=None, params=None, headers=None):
|
||||
async def ml_jobs(self, job_id=None, params=None, headers=None):
|
||||
"""
|
||||
Gets configuration and usage information about anomaly detection jobs.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-anomaly-detectors.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-anomaly-detectors.html>`_
|
||||
|
||||
:arg job_id: The ID of the jobs stats to fetch
|
||||
:arg allow_no_jobs: Whether to ignore if a wildcard expression
|
||||
@@ -621,7 +632,7 @@ class CatClient(NamespacedClient):
|
||||
choices: d, h, m, s, ms, micros, nanos
|
||||
:arg v: Verbose mode. Display column headers
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "ml", "anomaly_detectors", job_id),
|
||||
params=params,
|
||||
@@ -640,10 +651,10 @@ class CatClient(NamespacedClient):
|
||||
"time",
|
||||
"v",
|
||||
)
|
||||
def ml_trained_models(self, model_id=None, params=None, headers=None):
|
||||
async def ml_trained_models(self, model_id=None, params=None, headers=None):
|
||||
"""
|
||||
Gets configuration and usage information about inference trained models.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-trained-model.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-trained-model.html>`_
|
||||
|
||||
:arg model_id: The ID of the trained models stats to fetch
|
||||
:arg allow_no_match: Whether to ignore if a wildcard expression
|
||||
@@ -653,7 +664,7 @@ class CatClient(NamespacedClient):
|
||||
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
:arg from\\_: skips a number of trained models
|
||||
:arg from_: skips a number of trained models
|
||||
:arg h: Comma-separated list of column names to display
|
||||
:arg help: Return help information
|
||||
:arg s: Comma-separated list of column names or column aliases
|
||||
@@ -668,7 +679,7 @@ class CatClient(NamespacedClient):
|
||||
if "from_" in params:
|
||||
params["from"] = params.pop("from_")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "ml", "trained_models", model_id),
|
||||
params=params,
|
||||
@@ -678,10 +689,10 @@ class CatClient(NamespacedClient):
|
||||
@query_params(
|
||||
"allow_no_match", "format", "from_", "h", "help", "s", "size", "time", "v"
|
||||
)
|
||||
def transforms(self, transform_id=None, params=None, headers=None):
|
||||
async def transforms(self, transform_id=None, params=None, headers=None):
|
||||
"""
|
||||
Gets configuration and usage information about transforms.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cat-transforms.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cat-transforms.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform for which to get
|
||||
stats. '_all' or '*' implies all transforms
|
||||
@@ -690,7 +701,7 @@ class CatClient(NamespacedClient):
|
||||
transforms have been specified)
|
||||
:arg format: a short version of the Accept header, e.g. json,
|
||||
yaml
|
||||
:arg from\\_: skips a number of transform configs, defaults to 0
|
||||
:arg from_: skips a number of transform configs, defaults to 0
|
||||
:arg h: Comma-separated list of column names to display
|
||||
:arg help: Return help information
|
||||
:arg s: Comma-separated list of column names or column aliases
|
||||
@@ -705,7 +716,7 @@ class CatClient(NamespacedClient):
|
||||
if "from_" in params:
|
||||
params["from"] = params.pop("from_")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cat", "transforms", transform_id),
|
||||
params=params,
|
||||
|
||||
@@ -7,17 +7,17 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class CcrClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete_auto_follow_pattern(self, name, params=None, headers=None):
|
||||
async def delete_auto_follow_pattern(self, name, params=None, headers=None):
|
||||
"""
|
||||
Deletes auto-follow patterns.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-delete-auto-follow-pattern.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-delete-auto-follow-pattern.html>`_
|
||||
|
||||
:arg name: The name of the auto follow pattern.
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_ccr", "auto_follow", name),
|
||||
params=params,
|
||||
@@ -25,10 +25,10 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("wait_for_active_shards")
|
||||
def follow(self, index, body, params=None, headers=None):
|
||||
async def follow(self, index, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a new follower index configured to follow the referenced leader index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-follow.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-put-follow.html>`_
|
||||
|
||||
:arg index: The name of the follower index
|
||||
:arg body: The name of the leader index and other optional ccr
|
||||
@@ -43,7 +43,7 @@ class CcrClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path(index, "_ccr", "follow"),
|
||||
params=params,
|
||||
@@ -52,11 +52,11 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def follow_info(self, index, params=None, headers=None):
|
||||
async def follow_info(self, index, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about all follower indices, including parameters and
|
||||
status for each follower index
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-follow-info.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-get-follow-info.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index patterns; use `_all`
|
||||
to perform the operation on all indices
|
||||
@@ -64,16 +64,16 @@ class CcrClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path(index, "_ccr", "info"), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def follow_stats(self, index, params=None, headers=None):
|
||||
async def follow_stats(self, index, params=None, headers=None):
|
||||
"""
|
||||
Retrieves follower stats. return shard-level stats about the following tasks
|
||||
associated with each shard for the specified indices.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-follow-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-get-follow-stats.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index patterns; use `_all`
|
||||
to perform the operation on all indices
|
||||
@@ -81,15 +81,15 @@ class CcrClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path(index, "_ccr", "stats"), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def forget_follower(self, index, body, params=None, headers=None):
|
||||
async def forget_follower(self, index, body, params=None, headers=None):
|
||||
"""
|
||||
Removes the follower retention leases from the leader.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-forget-follower.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-post-forget-follower.html>`_
|
||||
|
||||
:arg index: the name of the leader index for which specified
|
||||
follower retention leases should be removed
|
||||
@@ -102,7 +102,7 @@ class CcrClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_ccr", "forget_follower"),
|
||||
params=params,
|
||||
@@ -111,15 +111,15 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_auto_follow_pattern(self, name=None, params=None, headers=None):
|
||||
async def get_auto_follow_pattern(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Gets configured auto-follow patterns. Returns the specified auto-follow pattern
|
||||
collection.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-auto-follow-pattern.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-get-auto-follow-pattern.html>`_
|
||||
|
||||
:arg name: The name of the auto follow pattern.
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_ccr", "auto_follow", name),
|
||||
params=params,
|
||||
@@ -127,11 +127,11 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def pause_follow(self, index, params=None, headers=None):
|
||||
async def pause_follow(self, index, params=None, headers=None):
|
||||
"""
|
||||
Pauses a follower index. The follower index will not fetch any additional
|
||||
operations from the leader index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-pause-follow.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-post-pause-follow.html>`_
|
||||
|
||||
:arg index: The name of the follower index that should pause
|
||||
following its leader index.
|
||||
@@ -139,7 +139,7 @@ class CcrClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_ccr", "pause_follow"),
|
||||
params=params,
|
||||
@@ -147,12 +147,12 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def put_auto_follow_pattern(self, name, body, params=None, headers=None):
|
||||
async def put_auto_follow_pattern(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a new named collection of auto-follow patterns against a specified
|
||||
remote cluster. Newly created indices on the remote cluster matching any of the
|
||||
specified patterns will be automatically configured as follower indices.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-put-auto-follow-pattern.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-put-auto-follow-pattern.html>`_
|
||||
|
||||
:arg name: The name of the auto follow pattern.
|
||||
:arg body: The specification of the auto follow pattern
|
||||
@@ -161,7 +161,7 @@ class CcrClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_ccr", "auto_follow", name),
|
||||
params=params,
|
||||
@@ -170,10 +170,10 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def resume_follow(self, index, body=None, params=None, headers=None):
|
||||
async def resume_follow(self, index, body=None, params=None, headers=None):
|
||||
"""
|
||||
Resumes a follower index that has been paused
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-resume-follow.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-post-resume-follow.html>`_
|
||||
|
||||
:arg index: The name of the follow index to resume following.
|
||||
:arg body: The name of the leader index and other optional ccr
|
||||
@@ -182,7 +182,7 @@ class CcrClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_ccr", "resume_follow"),
|
||||
params=params,
|
||||
@@ -191,21 +191,21 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def stats(self, params=None, headers=None):
|
||||
async def stats(self, params=None, headers=None):
|
||||
"""
|
||||
Gets all stats related to cross-cluster replication.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-get-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-get-stats.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_ccr/stats", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def unfollow(self, index, params=None, headers=None):
|
||||
async def unfollow(self, index, params=None, headers=None):
|
||||
"""
|
||||
Stops the following task associated with a follower index and removes index
|
||||
metadata and settings associated with cross-cluster replication.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-post-unfollow.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-post-unfollow.html>`_
|
||||
|
||||
:arg index: The name of the follower index that should be turned
|
||||
into a regular index.
|
||||
@@ -213,7 +213,7 @@ class CcrClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_ccr", "unfollow"),
|
||||
params=params,
|
||||
@@ -221,10 +221,10 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def pause_auto_follow_pattern(self, name, params=None, headers=None):
|
||||
async def pause_auto_follow_pattern(self, name, params=None, headers=None):
|
||||
"""
|
||||
Pauses an auto-follow pattern
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-pause-auto-follow-pattern.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-pause-auto-follow-pattern.html>`_
|
||||
|
||||
:arg name: The name of the auto follow pattern that should pause
|
||||
discovering new indices to follow.
|
||||
@@ -232,7 +232,7 @@ class CcrClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_ccr", "auto_follow", name, "pause"),
|
||||
params=params,
|
||||
@@ -240,10 +240,10 @@ class CcrClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def resume_auto_follow_pattern(self, name, params=None, headers=None):
|
||||
async def resume_auto_follow_pattern(self, name, params=None, headers=None):
|
||||
"""
|
||||
Resumes an auto-follow pattern that has been paused
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ccr-resume-auto-follow-pattern.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ccr-resume-auto-follow-pattern.html>`_
|
||||
|
||||
:arg name: The name of the auto follow pattern to resume
|
||||
discovering new indices to follow.
|
||||
@@ -251,7 +251,7 @@ class CcrClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_ccr", "auto_follow", name, "resume"),
|
||||
params=params,
|
||||
|
||||
@@ -19,10 +19,10 @@ class ClusterClient(NamespacedClient):
|
||||
"wait_for_nodes",
|
||||
"wait_for_status",
|
||||
)
|
||||
def health(self, index=None, params=None, headers=None):
|
||||
async def health(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Returns basic information about the health of the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-health.html>`_
|
||||
|
||||
:arg index: Limit the information returned to a specific index
|
||||
:arg expand_wildcards: Whether to expand wildcard expression to
|
||||
@@ -49,7 +49,7 @@ class ClusterClient(NamespacedClient):
|
||||
:arg wait_for_status: Wait until cluster is in a specific state
|
||||
Valid choices: green, yellow, red
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cluster", "health", index),
|
||||
params=params,
|
||||
@@ -57,17 +57,17 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("local", "master_timeout")
|
||||
def pending_tasks(self, params=None, headers=None):
|
||||
async def pending_tasks(self, params=None, headers=None):
|
||||
"""
|
||||
Returns a list of any cluster-level changes (e.g. create index, update mapping,
|
||||
allocate or fail shard) which have not yet been executed.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-pending.html>`_
|
||||
|
||||
:arg local: Return local information, do not retrieve the state
|
||||
from master node (default: false)
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cluster/pending_tasks", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -81,10 +81,10 @@ class ClusterClient(NamespacedClient):
|
||||
"wait_for_metadata_version",
|
||||
"wait_for_timeout",
|
||||
)
|
||||
def state(self, metric=None, index=None, params=None, headers=None):
|
||||
async def state(self, metric=None, index=None, params=None, headers=None):
|
||||
"""
|
||||
Returns a comprehensive information about the state of the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-state.html>`_
|
||||
|
||||
:arg metric: Limit the information returned to the specified
|
||||
metrics Valid choices: _all, blocks, metadata, nodes, routing_table,
|
||||
@@ -112,7 +112,7 @@ class ClusterClient(NamespacedClient):
|
||||
if index and metric in SKIP_IN_PATH:
|
||||
metric = "_all"
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_cluster", "state", metric, index),
|
||||
params=params,
|
||||
@@ -120,10 +120,10 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("flat_settings", "timeout")
|
||||
def stats(self, node_id=None, params=None, headers=None):
|
||||
async def stats(self, node_id=None, params=None, headers=None):
|
||||
"""
|
||||
Returns high-level overview of cluster statistics.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-stats.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information; use `_local` to return information from
|
||||
@@ -133,7 +133,7 @@ class ClusterClient(NamespacedClient):
|
||||
false)
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
"/_cluster/stats"
|
||||
if node_id in SKIP_IN_PATH
|
||||
@@ -145,10 +145,10 @@ class ClusterClient(NamespacedClient):
|
||||
@query_params(
|
||||
"dry_run", "explain", "master_timeout", "metric", "retry_failed", "timeout"
|
||||
)
|
||||
def reroute(self, body=None, params=None, headers=None):
|
||||
async def reroute(self, body=None, params=None, headers=None):
|
||||
"""
|
||||
Allows to manually change the allocation of individual shards in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-reroute.html>`_
|
||||
|
||||
:arg body: The definition of `commands` to perform (`move`,
|
||||
`cancel`, `allocate`)
|
||||
@@ -165,15 +165,15 @@ class ClusterClient(NamespacedClient):
|
||||
due to too many subsequent allocation failures
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_cluster/reroute", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params("flat_settings", "include_defaults", "master_timeout", "timeout")
|
||||
def get_settings(self, params=None, headers=None):
|
||||
async def get_settings(self, params=None, headers=None):
|
||||
"""
|
||||
Returns cluster settings.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-update-settings.html>`_
|
||||
|
||||
:arg flat_settings: Return settings in flat format (default:
|
||||
false)
|
||||
@@ -183,15 +183,15 @@ class ClusterClient(NamespacedClient):
|
||||
to master node
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_cluster/settings", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("flat_settings", "master_timeout", "timeout")
|
||||
def put_settings(self, body, params=None, headers=None):
|
||||
async def put_settings(self, body, params=None, headers=None):
|
||||
"""
|
||||
Updates the cluster settings.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-update-settings.html>`_
|
||||
|
||||
:arg body: The settings to be updated. Can be either `transient`
|
||||
or `persistent` (survives cluster restart).
|
||||
@@ -204,25 +204,25 @@ class ClusterClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT", "/_cluster/settings", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def remote_info(self, params=None, headers=None):
|
||||
async def remote_info(self, params=None, headers=None):
|
||||
"""
|
||||
Returns the information about configured remote clusters.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-remote-info.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_remote/info", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("include_disk_info", "include_yes_decisions")
|
||||
def allocation_explain(self, body=None, params=None, headers=None):
|
||||
async def allocation_explain(self, body=None, params=None, headers=None):
|
||||
"""
|
||||
Provides explanations for shard allocations in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-allocation-explain.html>`_
|
||||
|
||||
:arg body: The index, shard, and primary flag to explain. Empty
|
||||
means 'explain the first unassigned shard'
|
||||
@@ -231,7 +231,7 @@ class ClusterClient(NamespacedClient):
|
||||
:arg include_yes_decisions: Return 'YES' decisions in
|
||||
explanation (default: false)
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
"/_cluster/allocation/explain",
|
||||
params=params,
|
||||
@@ -240,10 +240,10 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout")
|
||||
def delete_component_template(self, name, params=None, headers=None):
|
||||
async def delete_component_template(self, name, params=None, headers=None):
|
||||
"""
|
||||
Deletes a component template
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
|
||||
|
||||
:arg name: The name of the template
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
@@ -252,7 +252,7 @@ class ClusterClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_component_template", name),
|
||||
params=params,
|
||||
@@ -260,10 +260,10 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("local", "master_timeout")
|
||||
def get_component_template(self, name=None, params=None, headers=None):
|
||||
async def get_component_template(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Returns one or more component templates
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
|
||||
|
||||
:arg name: The comma separated names of the component templates
|
||||
:arg local: Return local information, do not retrieve the state
|
||||
@@ -271,7 +271,7 @@ class ClusterClient(NamespacedClient):
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
to master node
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_component_template", name),
|
||||
params=params,
|
||||
@@ -279,10 +279,10 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("create", "master_timeout", "timeout")
|
||||
def put_component_template(self, name, body, params=None, headers=None):
|
||||
async def put_component_template(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates or updates a component template
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
|
||||
|
||||
:arg name: The name of the template
|
||||
:arg body: The template definition
|
||||
@@ -295,7 +295,7 @@ class ClusterClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_component_template", name),
|
||||
params=params,
|
||||
@@ -304,10 +304,10 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("local", "master_timeout")
|
||||
def exists_component_template(self, name, params=None, headers=None):
|
||||
async def exists_component_template(self, name, params=None, headers=None):
|
||||
"""
|
||||
Returns information about whether a particular component template exist
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-component-templates.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-component-template.html>`_
|
||||
|
||||
:arg name: The name of the template
|
||||
:arg local: Return local information, do not retrieve the state
|
||||
@@ -318,7 +318,7 @@ class ClusterClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"HEAD",
|
||||
_make_path("_component_template", name),
|
||||
params=params,
|
||||
@@ -326,16 +326,16 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("wait_for_removal")
|
||||
def delete_voting_config_exclusions(self, params=None, headers=None):
|
||||
async def delete_voting_config_exclusions(self, params=None, headers=None):
|
||||
"""
|
||||
Clears cluster voting config exclusions.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/voting-config-exclusions.html>`_
|
||||
|
||||
:arg wait_for_removal: Specifies whether to wait for all
|
||||
excluded nodes to be removed from the cluster before clearing the voting
|
||||
configuration exclusions list. Default: True
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
"/_cluster/voting_config_exclusions",
|
||||
params=params,
|
||||
@@ -343,10 +343,10 @@ class ClusterClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("node_ids", "node_names", "timeout")
|
||||
def post_voting_config_exclusions(self, params=None, headers=None):
|
||||
async def post_voting_config_exclusions(self, params=None, headers=None):
|
||||
"""
|
||||
Updates the cluster voting config exclusions by node ids or node names.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/voting-config-exclusions.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/voting-config-exclusions.html>`_
|
||||
|
||||
:arg node_ids: A comma-separated list of the persistent ids of
|
||||
the nodes to exclude from the voting configuration. If specified, you
|
||||
@@ -356,6 +356,6 @@ class ClusterClient(NamespacedClient):
|
||||
not also specify ?node_ids.
|
||||
:arg timeout: Explicit operation timeout Default: 30s
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_cluster/voting_config_exclusions", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
# Licensed to Elasticsearch B.V under one or more agreements.
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
|
||||
class Data_FrameClient(NamespacedClient):
|
||||
@query_params()
|
||||
async def delete_data_frame_transform(
|
||||
self, transform_id, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-data-frame-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform to delete
|
||||
"""
|
||||
if transform_id in SKIP_IN_PATH:
|
||||
raise ValueError(
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_data_frame", "transforms", transform_id),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params("from_", "size")
|
||||
async def get_data_frame_transform(
|
||||
self, transform_id=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-data-frame-transform.html>`_
|
||||
|
||||
:arg transform_id: The id or comma delimited list of id expressions of
|
||||
the transforms to get, '_all' or '*' implies get all transforms
|
||||
:arg from_: skips a number of transform configs, defaults to 0
|
||||
:arg size: specifies a max number of transforms to get, defaults to 100
|
||||
"""
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_data_frame", "transforms", transform_id),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def get_data_frame_transform_stats(
|
||||
self, transform_id=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-data-frame-transform-stats.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform for which to get stats.
|
||||
'_all' or '*' implies all transforms
|
||||
"""
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_data_frame", "transforms", transform_id, "_stats"),
|
||||
params=params,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def preview_data_frame_transform(self, body, params=None, headers=None):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/preview-data-frame-transform.html>`_
|
||||
|
||||
:arg body: The definition for the data_frame transform to preview
|
||||
"""
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
"/_data_frame/transforms/_preview",
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params()
|
||||
async def put_data_frame_transform(
|
||||
self, transform_id, body, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-data-frame-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the new transform.
|
||||
:arg body: The data frame transform definition
|
||||
"""
|
||||
for param in (transform_id, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_data_frame", "transforms", transform_id),
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params("timeout")
|
||||
async def start_data_frame_transform(self, transform_id, params=None, headers=None):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/start-data-frame-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform to start
|
||||
:arg timeout: Controls the time to wait for the transform to start
|
||||
"""
|
||||
if transform_id in SKIP_IN_PATH:
|
||||
raise ValueError(
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_data_frame", "transforms", transform_id, "_start"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params("timeout", "wait_for_completion")
|
||||
async def stop_data_frame_transform(self, transform_id, params=None, headers=None):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/stop-data-frame-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform to stop
|
||||
:arg timeout: Controls the time to wait until the transform has stopped.
|
||||
Default to 30 seconds
|
||||
:arg wait_for_completion: Whether to wait for the transform to fully
|
||||
stop before returning or not. Default to false
|
||||
"""
|
||||
if transform_id in SKIP_IN_PATH:
|
||||
raise ValueError(
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_data_frame", "transforms", transform_id, "_stop"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
# Licensed to Elasticsearch B.V under one or more agreements.
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
from .utils import NamespacedClient, query_params, _make_path
|
||||
|
||||
|
||||
class DeprecationClient(NamespacedClient):
|
||||
@query_params()
|
||||
async def info(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
`<http://www.elastic.co/guide/en/migration/7.x/migration-api-deprecation.html>`_
|
||||
|
||||
:arg index: Index pattern
|
||||
"""
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path(index, "_xpack", "migration", "deprecations"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
@@ -7,17 +7,17 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class EnrichClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete_policy(self, name, params=None, headers=None):
|
||||
async def delete_policy(self, name, params=None, headers=None):
|
||||
"""
|
||||
Deletes an existing enrich policy and its enrich index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-enrich-policy-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-enrich-policy-api.html>`_
|
||||
|
||||
:arg name: The name of the enrich policy
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_enrich", "policy", name),
|
||||
params=params,
|
||||
@@ -25,10 +25,10 @@ class EnrichClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("wait_for_completion")
|
||||
def execute_policy(self, name, params=None, headers=None):
|
||||
async def execute_policy(self, name, params=None, headers=None):
|
||||
"""
|
||||
Creates the enrich index for an existing enrich policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/execute-enrich-policy-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/execute-enrich-policy-api.html>`_
|
||||
|
||||
:arg name: The name of the enrich policy
|
||||
:arg wait_for_completion: Should the request should block until
|
||||
@@ -37,7 +37,7 @@ class EnrichClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_enrich", "policy", name, "_execute"),
|
||||
params=params,
|
||||
@@ -45,22 +45,22 @@ class EnrichClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_policy(self, name=None, params=None, headers=None):
|
||||
async def get_policy(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Gets information about an enrich policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-enrich-policy-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-enrich-policy-api.html>`_
|
||||
|
||||
:arg name: A comma-separated list of enrich policy names
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_enrich", "policy", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def put_policy(self, name, body, params=None, headers=None):
|
||||
async def put_policy(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a new enrich policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-enrich-policy-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-enrich-policy-api.html>`_
|
||||
|
||||
:arg name: The name of the enrich policy
|
||||
:arg body: The enrich policy to register
|
||||
@@ -69,7 +69,7 @@ class EnrichClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_enrich", "policy", name),
|
||||
params=params,
|
||||
@@ -78,12 +78,12 @@ class EnrichClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def stats(self, params=None, headers=None):
|
||||
async def stats(self, params=None, headers=None):
|
||||
"""
|
||||
Gets enrich coordinator statistics and information about enrich policies that
|
||||
are currently executing.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/enrich-stats-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/enrich-stats-api.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_enrich/_stats", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
|
||||
|
||||
class EqlClient(NamespacedClient):
|
||||
@query_params()
|
||||
def search(self, index, body, params=None, headers=None):
|
||||
async def search(self, index, body, params=None, headers=None):
|
||||
"""
|
||||
Returns results matching a query expressed in Event Query Language (EQL)
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/eql-search-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/eql-search-api.html>`_
|
||||
|
||||
:arg index: The name of the index to scope the operation
|
||||
:arg body: Eql request body. Use the `query` to limit the query
|
||||
@@ -20,7 +20,7 @@ class EqlClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_eql", "search"),
|
||||
params=params,
|
||||
|
||||
@@ -7,24 +7,26 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class GraphClient(NamespacedClient):
|
||||
@query_params("routing", "timeout")
|
||||
def explore(self, index, body=None, params=None, headers=None):
|
||||
async def explore(self, index, body=None, doc_type=None, params=None, headers=None):
|
||||
"""
|
||||
Explore extracted and summarized information about the documents and terms in
|
||||
an index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/graph-explore-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/graph-explore-api.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names to search; use
|
||||
`_all` or empty string to perform the operation on all indices
|
||||
:arg body: Graph Query DSL
|
||||
:arg doc_type: A comma-separated list of document types to
|
||||
search; leave empty to perform the operation on all types
|
||||
:arg routing: Specific routing value
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_graph", "explore"),
|
||||
_make_path(index, doc_type, "_graph", "explore"),
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
|
||||
@@ -7,18 +7,18 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class IlmClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete_lifecycle(self, policy, params=None, headers=None):
|
||||
async def delete_lifecycle(self, policy, params=None, headers=None):
|
||||
"""
|
||||
Deletes the specified lifecycle policy definition. A currently used policy
|
||||
cannot be deleted.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-delete-lifecycle.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-delete-lifecycle.html>`_
|
||||
|
||||
:arg policy: The name of the index lifecycle policy
|
||||
"""
|
||||
if policy in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'policy'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_ilm", "policy", policy),
|
||||
params=params,
|
||||
@@ -26,11 +26,11 @@ class IlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("only_errors", "only_managed")
|
||||
def explain_lifecycle(self, index, params=None, headers=None):
|
||||
async def explain_lifecycle(self, index, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the index's current lifecycle state, such as the
|
||||
currently executing phase, action, and step.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-explain-lifecycle.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-explain-lifecycle.html>`_
|
||||
|
||||
:arg index: The name of the index to explain
|
||||
:arg only_errors: filters the indices included in the response
|
||||
@@ -41,38 +41,38 @@ class IlmClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path(index, "_ilm", "explain"), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_lifecycle(self, policy=None, params=None, headers=None):
|
||||
async def get_lifecycle(self, policy=None, params=None, headers=None):
|
||||
"""
|
||||
Returns the specified policy definition. Includes the policy version and last
|
||||
modified date.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-get-lifecycle.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-get-lifecycle.html>`_
|
||||
|
||||
:arg policy: The name of the index lifecycle policy
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_ilm", "policy", policy), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_status(self, params=None, headers=None):
|
||||
async def get_status(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves the current index lifecycle management (ILM) status.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-get-status.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-get-status.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_ilm/status", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def move_to_step(self, index, body=None, params=None, headers=None):
|
||||
async def move_to_step(self, index, body=None, params=None, headers=None):
|
||||
"""
|
||||
Manually moves an index into the specified step and executes that step.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-move-to-step.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-move-to-step.html>`_
|
||||
|
||||
:arg index: The name of the index whose lifecycle step is to
|
||||
change
|
||||
@@ -81,7 +81,7 @@ class IlmClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_ilm", "move", index),
|
||||
params=params,
|
||||
@@ -90,10 +90,10 @@ class IlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def put_lifecycle(self, policy, body=None, params=None, headers=None):
|
||||
async def put_lifecycle(self, policy, body=None, params=None, headers=None):
|
||||
"""
|
||||
Creates a lifecycle policy
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-put-lifecycle.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-put-lifecycle.html>`_
|
||||
|
||||
:arg policy: The name of the index lifecycle policy
|
||||
:arg body: The lifecycle policy definition to register
|
||||
@@ -101,7 +101,7 @@ class IlmClient(NamespacedClient):
|
||||
if policy in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'policy'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_ilm", "policy", policy),
|
||||
params=params,
|
||||
@@ -110,25 +110,25 @@ class IlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def remove_policy(self, index, params=None, headers=None):
|
||||
async def remove_policy(self, index, params=None, headers=None):
|
||||
"""
|
||||
Removes the assigned lifecycle policy and stops managing the specified index
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-remove-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-remove-policy.html>`_
|
||||
|
||||
:arg index: The name of the index to remove policy on
|
||||
"""
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", _make_path(index, "_ilm", "remove"), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def retry(self, index, params=None, headers=None):
|
||||
async def retry(self, index, params=None, headers=None):
|
||||
"""
|
||||
Retries executing the policy for an index that is in the ERROR step.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-retry-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-retry-policy.html>`_
|
||||
|
||||
:arg index: The name of the indices (comma-separated) whose
|
||||
failed lifecycle step is to be retry
|
||||
@@ -136,27 +136,27 @@ class IlmClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", _make_path(index, "_ilm", "retry"), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def start(self, params=None, headers=None):
|
||||
async def start(self, params=None, headers=None):
|
||||
"""
|
||||
Start the index lifecycle management (ILM) plugin.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-start.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-start.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_ilm/start", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def stop(self, params=None, headers=None):
|
||||
async def stop(self, params=None, headers=None):
|
||||
"""
|
||||
Halts all lifecycle management operations and stops the index lifecycle
|
||||
management (ILM) plugin
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ilm-stop.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ilm-stop.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_ilm/stop", params=params, headers=headers
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,25 +7,25 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class IngestClient(NamespacedClient):
|
||||
@query_params("master_timeout")
|
||||
def get_pipeline(self, id=None, params=None, headers=None):
|
||||
async def get_pipeline(self, id=None, params=None, headers=None):
|
||||
"""
|
||||
Returns a pipeline.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-pipeline-api.html>`_
|
||||
|
||||
:arg id: Comma separated list of pipeline ids. Wildcards
|
||||
supported
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
to master node
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_ingest", "pipeline", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout")
|
||||
def put_pipeline(self, id, body, params=None, headers=None):
|
||||
async def put_pipeline(self, id, body, params=None, headers=None):
|
||||
"""
|
||||
Creates or updates a pipeline.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-pipeline-api.html>`_
|
||||
|
||||
:arg id: Pipeline ID
|
||||
:arg body: The ingest definition
|
||||
@@ -37,7 +37,7 @@ class IngestClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_ingest", "pipeline", id),
|
||||
params=params,
|
||||
@@ -46,10 +46,10 @@ class IngestClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout")
|
||||
def delete_pipeline(self, id, params=None, headers=None):
|
||||
async def delete_pipeline(self, id, params=None, headers=None):
|
||||
"""
|
||||
Deletes a pipeline.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-pipeline-api.html>`_
|
||||
|
||||
:arg id: Pipeline ID
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
@@ -59,7 +59,7 @@ class IngestClient(NamespacedClient):
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_ingest", "pipeline", id),
|
||||
params=params,
|
||||
@@ -67,10 +67,10 @@ class IngestClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("verbose")
|
||||
def simulate(self, body, id=None, params=None, headers=None):
|
||||
async def simulate(self, body, id=None, params=None, headers=None):
|
||||
"""
|
||||
Allows to simulate a pipeline with example documents.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/simulate-pipeline-api.html>`_
|
||||
|
||||
:arg body: The simulate definition
|
||||
:arg id: Pipeline ID
|
||||
@@ -80,7 +80,7 @@ class IngestClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_ingest", "pipeline", id, "_simulate"),
|
||||
params=params,
|
||||
@@ -89,11 +89,11 @@ class IngestClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def processor_grok(self, params=None, headers=None):
|
||||
async def processor_grok(self, params=None, headers=None):
|
||||
"""
|
||||
Returns a list of the built-in patterns.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/grok-processor.html#grok-processor-rest-get>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_ingest/processor/grok", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,82 +7,82 @@ from .utils import NamespacedClient, query_params
|
||||
|
||||
class LicenseClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete(self, params=None, headers=None):
|
||||
async def delete(self, params=None, headers=None):
|
||||
"""
|
||||
Deletes licensing information for the cluster
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-license.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-license.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE", "/_license", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("accept_enterprise", "local")
|
||||
def get(self, params=None, headers=None):
|
||||
async def get(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves licensing information for the cluster
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-license.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-license.html>`_
|
||||
|
||||
:arg accept_enterprise: Supported for backwards compatibility
|
||||
with 7.x. If this param is used it must be set to true
|
||||
:arg accept_enterprise: If the active license is an enterprise
|
||||
license, return type as 'enterprise' (default: false)
|
||||
:arg local: Return local information, do not retrieve the state
|
||||
from master node (default: false)
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_license", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_basic_status(self, params=None, headers=None):
|
||||
async def get_basic_status(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the status of the basic license.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-basic-status.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-basic-status.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_license/basic_status", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_trial_status(self, params=None, headers=None):
|
||||
async def get_trial_status(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the status of the trial license.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-trial-status.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-trial-status.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_license/trial_status", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("acknowledge")
|
||||
def post(self, body=None, params=None, headers=None):
|
||||
async def post(self, body=None, params=None, headers=None):
|
||||
"""
|
||||
Updates the license for the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-license.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/update-license.html>`_
|
||||
|
||||
:arg body: licenses to be installed
|
||||
:arg acknowledge: whether the user has acknowledged acknowledge
|
||||
messages (default: false)
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT", "/_license", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params("acknowledge")
|
||||
def post_start_basic(self, params=None, headers=None):
|
||||
async def post_start_basic(self, params=None, headers=None):
|
||||
"""
|
||||
Starts an indefinite basic license.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/start-basic.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/start-basic.html>`_
|
||||
|
||||
:arg acknowledge: whether the user has acknowledged acknowledge
|
||||
messages (default: false)
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_license/start_basic", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("acknowledge", "doc_type")
|
||||
def post_start_trial(self, params=None, headers=None):
|
||||
async def post_start_trial(self, params=None, headers=None):
|
||||
"""
|
||||
starts a limited time trial license.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/start-trial.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/start-trial.html>`_
|
||||
|
||||
:arg acknowledge: whether the user has acknowledged acknowledge
|
||||
messages (default: false)
|
||||
@@ -93,6 +93,6 @@ class LicenseClient(NamespacedClient):
|
||||
if "doc_type" in params:
|
||||
params["type"] = params.pop("doc_type")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_license/start_trial", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,16 +7,16 @@ from .utils import NamespacedClient, query_params, _make_path
|
||||
|
||||
class MigrationClient(NamespacedClient):
|
||||
@query_params()
|
||||
def deprecations(self, index=None, params=None, headers=None):
|
||||
async def deprecations(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about different cluster, node, and index level settings
|
||||
that use deprecated features that will be removed or changed in the next major
|
||||
version.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/migration-api-deprecation.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/migration-api-deprecation.html>`_
|
||||
|
||||
:arg index: Index pattern
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path(index, "_migration", "deprecations"),
|
||||
params=params,
|
||||
|
||||
+343
-323
File diff suppressed because it is too large
Load Diff
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH, _bu
|
||||
|
||||
class MonitoringClient(NamespacedClient):
|
||||
@query_params("interval", "system_api_version", "system_id")
|
||||
def bulk(self, body, doc_type=None, params=None, headers=None):
|
||||
async def bulk(self, body, doc_type=None, params=None, headers=None):
|
||||
"""
|
||||
Used by the monitoring features to send monitoring data.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/monitor-elasticsearch-cluster.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/monitor-elasticsearch-cluster.html>`_
|
||||
|
||||
:arg body: The operation definition and data (action-data
|
||||
pairs), separated by newlines
|
||||
@@ -25,7 +25,7 @@ class MonitoringClient(NamespacedClient):
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
body = _bulk_body(self.transport.serializer, body)
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_monitoring", doc_type, "bulk"),
|
||||
params=params,
|
||||
|
||||
@@ -7,12 +7,12 @@ from .utils import NamespacedClient, query_params, _make_path
|
||||
|
||||
class NodesClient(NamespacedClient):
|
||||
@query_params("timeout")
|
||||
def reload_secure_settings(
|
||||
async def reload_secure_settings(
|
||||
self, body=None, node_id=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
Reloads secure settings.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/secure-settings.html#reloadable-secure-settings>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/secure-settings.html#reloadable-secure-settings>`_
|
||||
|
||||
:arg body: An object containing the password for the
|
||||
elasticsearch keystore
|
||||
@@ -21,7 +21,7 @@ class NodesClient(NamespacedClient):
|
||||
all cluster nodes.
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_nodes", node_id, "reload_secure_settings"),
|
||||
params=params,
|
||||
@@ -30,10 +30,10 @@ class NodesClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("flat_settings", "timeout")
|
||||
def info(self, node_id=None, metric=None, params=None, headers=None):
|
||||
async def info(self, node_id=None, metric=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about nodes in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-nodes-info.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information; use `_local` to return information from
|
||||
@@ -46,17 +46,70 @@ class NodesClient(NamespacedClient):
|
||||
false)
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_nodes", node_id, metric), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"completion_fields",
|
||||
"fielddata_fields",
|
||||
"fields",
|
||||
"groups",
|
||||
"include_segment_file_sizes",
|
||||
"level",
|
||||
"timeout",
|
||||
"types",
|
||||
)
|
||||
async def stats(
|
||||
self, node_id=None, metric=None, index_metric=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
Returns statistical information about nodes in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-nodes-stats.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information; use `_local` to return information from
|
||||
the node you're connecting to, leave empty to get information from all
|
||||
nodes
|
||||
:arg metric: Limit the information returned to the specified
|
||||
metrics Valid choices: _all, breaker, fs, http, indices, jvm, os,
|
||||
process, thread_pool, transport, discovery
|
||||
:arg index_metric: Limit the information returned for `indices`
|
||||
metric to the specific index metrics. Isn't used if `indices` (or `all`)
|
||||
metric isn't specified. Valid choices: _all, completion, docs,
|
||||
fielddata, query_cache, flush, get, indexing, merge, request_cache,
|
||||
refresh, search, segments, store, warmer, suggest
|
||||
:arg completion_fields: A comma-separated list of fields for
|
||||
`fielddata` and `suggest` index metric (supports wildcards)
|
||||
:arg fielddata_fields: A comma-separated list of fields for
|
||||
`fielddata` index metric (supports wildcards)
|
||||
:arg fields: A comma-separated list of fields for `fielddata`
|
||||
and `completion` index metric (supports wildcards)
|
||||
:arg groups: A comma-separated list of search groups for
|
||||
`search` index metric
|
||||
:arg include_segment_file_sizes: Whether to report the
|
||||
aggregated disk usage of each one of the Lucene index files (only
|
||||
applies if segment stats are requested)
|
||||
:arg level: Return indices stats aggregated at index, node or
|
||||
shard level Valid choices: indices, node, shards Default: node
|
||||
:arg timeout: Explicit operation timeout
|
||||
:arg types: A comma-separated list of document types for the
|
||||
`indexing` index metric
|
||||
"""
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_nodes", node_id, "stats", metric, index_metric),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout"
|
||||
)
|
||||
def hot_threads(self, node_id=None, params=None, headers=None):
|
||||
async def hot_threads(self, node_id=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about hot threads on each node in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-nodes-hot-threads.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information; use `_local` to return information from
|
||||
@@ -78,7 +131,7 @@ class NodesClient(NamespacedClient):
|
||||
if "doc_type" in params:
|
||||
params["type"] = params.pop("doc_type")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_nodes", node_id, "hot_threads"),
|
||||
params=params,
|
||||
@@ -86,10 +139,10 @@ class NodesClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("timeout")
|
||||
def usage(self, node_id=None, metric=None, params=None, headers=None):
|
||||
async def usage(self, node_id=None, metric=None, params=None, headers=None):
|
||||
"""
|
||||
Returns low-level information about REST actions usage on nodes.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-nodes-usage.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information; use `_local` to return information from
|
||||
@@ -99,62 +152,9 @@ class NodesClient(NamespacedClient):
|
||||
metrics Valid choices: _all, rest_actions
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_nodes", node_id, "usage", metric),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params(
|
||||
"completion_fields",
|
||||
"fielddata_fields",
|
||||
"fields",
|
||||
"groups",
|
||||
"include_segment_file_sizes",
|
||||
"level",
|
||||
"timeout",
|
||||
"types",
|
||||
)
|
||||
def stats(
|
||||
self, node_id=None, metric=None, index_metric=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
Returns statistical information about nodes in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html>`_
|
||||
|
||||
:arg node_id: A comma-separated list of node IDs or names to
|
||||
limit the returned information; use `_local` to return information from
|
||||
the node you're connecting to, leave empty to get information from all
|
||||
nodes
|
||||
:arg metric: Limit the information returned to the specified
|
||||
metrics Valid choices: _all, breaker, fs, http, indices, jvm, os,
|
||||
process, thread_pool, transport, discovery
|
||||
:arg index_metric: Limit the information returned for `indices`
|
||||
metric to the specific index metrics. Isn't used if `indices` (or `all`)
|
||||
metric isn't specified. Valid choices: _all, completion, docs,
|
||||
fielddata, query_cache, flush, get, indexing, merge, request_cache,
|
||||
refresh, search, segments, store, warmer, suggest, bulk
|
||||
:arg completion_fields: A comma-separated list of fields for
|
||||
`fielddata` and `suggest` index metric (supports wildcards)
|
||||
:arg fielddata_fields: A comma-separated list of fields for
|
||||
`fielddata` index metric (supports wildcards)
|
||||
:arg fields: A comma-separated list of fields for `fielddata`
|
||||
and `completion` index metric (supports wildcards)
|
||||
:arg groups: A comma-separated list of search groups for
|
||||
`search` index metric
|
||||
:arg include_segment_file_sizes: Whether to report the
|
||||
aggregated disk usage of each one of the Lucene index files (only
|
||||
applies if segment stats are requested)
|
||||
:arg level: Return indices stats aggregated at index, node or
|
||||
shard level Valid choices: indices, node, shards Default: node
|
||||
:arg timeout: Explicit operation timeout
|
||||
:arg types: A comma-separated list of document types for the
|
||||
`indexing` index metric
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_nodes", node_id, "stats", metric, index_metric),
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params
|
||||
|
||||
class RemoteClient(NamespacedClient):
|
||||
@query_params()
|
||||
def info(self, params=None, headers=None):
|
||||
async def info(self, params=None, headers=None):
|
||||
"""
|
||||
`<http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html>`_
|
||||
`<http://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-remote-info.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_remote/info", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,53 +7,53 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class RollupClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete_job(self, id, params=None, headers=None):
|
||||
async def delete_job(self, id, params=None, headers=None):
|
||||
"""
|
||||
Deletes an existing rollup job.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-delete-job.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-delete-job.html>`_
|
||||
|
||||
:arg id: The ID of the job to delete
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE", _make_path("_rollup", "job", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_jobs(self, id=None, params=None, headers=None):
|
||||
async def get_jobs(self, id=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves the configuration, stats, and status of rollup jobs.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-job.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-job.html>`_
|
||||
|
||||
:arg id: The ID of the job(s) to fetch. Accepts glob patterns,
|
||||
or left blank for all jobs
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_rollup", "job", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_rollup_caps(self, id=None, params=None, headers=None):
|
||||
async def get_rollup_caps(self, id=None, params=None, headers=None):
|
||||
"""
|
||||
Returns the capabilities of any rollup jobs that have been configured for a
|
||||
specific index or index pattern.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-caps.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-rollup-caps.html>`_
|
||||
|
||||
:arg id: The ID of the index to check rollup capabilities on, or
|
||||
left blank for all jobs
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_rollup", "data", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_rollup_index_caps(self, index, params=None, headers=None):
|
||||
async def get_rollup_index_caps(self, index, params=None, headers=None):
|
||||
"""
|
||||
Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the
|
||||
index where rollup data is stored).
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-get-rollup-index-caps.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-get-rollup-index-caps.html>`_
|
||||
|
||||
:arg index: The rollup index or index pattern to obtain rollup
|
||||
capabilities from.
|
||||
@@ -61,15 +61,15 @@ class RollupClient(NamespacedClient):
|
||||
if index in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path(index, "_rollup", "data"), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def put_job(self, id, body, params=None, headers=None):
|
||||
async def put_job(self, id, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a rollup job.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-put-job.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-put-job.html>`_
|
||||
|
||||
:arg id: The ID of the job to create
|
||||
:arg body: The job configuration
|
||||
@@ -78,7 +78,7 @@ class RollupClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_rollup", "job", id),
|
||||
params=params,
|
||||
@@ -87,10 +87,12 @@ class RollupClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("rest_total_hits_as_int", "typed_keys")
|
||||
def rollup_search(self, index, body, doc_type=None, params=None, headers=None):
|
||||
async def rollup_search(
|
||||
self, index, body, doc_type=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
Enables searching rolled-up data using the standard query DSL.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-search.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-search.html>`_
|
||||
|
||||
:arg index: The indices or index-pattern(s) (containing rollup
|
||||
or regular data) that should be searched
|
||||
@@ -105,7 +107,7 @@ class RollupClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, doc_type, "_rollup_search"),
|
||||
params=params,
|
||||
@@ -114,17 +116,17 @@ class RollupClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def start_job(self, id, params=None, headers=None):
|
||||
async def start_job(self, id, params=None, headers=None):
|
||||
"""
|
||||
Starts an existing, stopped rollup job.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-start-job.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-start-job.html>`_
|
||||
|
||||
:arg id: The ID of the job to start
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_rollup", "job", id, "_start"),
|
||||
params=params,
|
||||
@@ -132,10 +134,10 @@ class RollupClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("timeout", "wait_for_completion")
|
||||
def stop_job(self, id, params=None, headers=None):
|
||||
async def stop_job(self, id, params=None, headers=None):
|
||||
"""
|
||||
Stops an existing, started rollup job.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/rollup-stop-job.html>`_
|
||||
|
||||
:arg id: The ID of the job to stop
|
||||
:arg timeout: Block for (at maximum) the specified duration
|
||||
@@ -147,7 +149,7 @@ class RollupClient(NamespacedClient):
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_rollup", "job", id, "_stop"),
|
||||
params=params,
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class SearchableSnapshotsClient(NamespacedClient):
|
||||
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
|
||||
def clear_cache(self, index=None, params=None, headers=None):
|
||||
async def clear_cache(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Clear the cache of searchable snapshots.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-clear-cache.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/searchable-snapshots-api-clear-cache.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index name to limit the
|
||||
operation
|
||||
@@ -23,7 +23,7 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
:arg ignore_unavailable: Whether specified concrete indices
|
||||
should be ignored when unavailable (missing or closed)
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path(index, "_searchable_snapshots", "cache", "clear"),
|
||||
params=params,
|
||||
@@ -31,10 +31,10 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "wait_for_completion")
|
||||
def mount(self, repository, snapshot, body, params=None, headers=None):
|
||||
async def mount(self, repository, snapshot, body, params=None, headers=None):
|
||||
"""
|
||||
Mount a snapshot as a searchable index.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-mount-snapshot.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/searchable-snapshots-api-mount-snapshot.html>`_
|
||||
|
||||
:arg repository: The name of the repository containing the
|
||||
snapshot of the index to mount
|
||||
@@ -50,7 +50,7 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_snapshot", repository, snapshot, "_mount"),
|
||||
params=params,
|
||||
@@ -59,17 +59,17 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def repository_stats(self, repository, params=None, headers=None):
|
||||
async def repository_stats(self, repository, params=None, headers=None):
|
||||
"""
|
||||
Retrieve usage statistics about a snapshot repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-repository-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/searchable-snapshots-repository-stats.html>`_
|
||||
|
||||
:arg repository: The repository for which to get the stats for
|
||||
"""
|
||||
if repository in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'repository'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_snapshot", repository, "_stats"),
|
||||
params=params,
|
||||
@@ -77,14 +77,14 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def stats(self, index=None, params=None, headers=None):
|
||||
async def stats(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieve various statistics about searchable snapshots.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/searchable-snapshots-api-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/searchable-snapshots-api-stats.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path(index, "_searchable_snapshots", "stats"),
|
||||
params=params,
|
||||
|
||||
@@ -7,21 +7,21 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class SecurityClient(NamespacedClient):
|
||||
@query_params()
|
||||
def authenticate(self, params=None, headers=None):
|
||||
async def authenticate(self, params=None, headers=None):
|
||||
"""
|
||||
Enables authentication as a user and retrieve information about the
|
||||
authenticated user.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-authenticate.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-authenticate.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_security/_authenticate", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def change_password(self, body, username=None, params=None, headers=None):
|
||||
async def change_password(self, body, username=None, params=None, headers=None):
|
||||
"""
|
||||
Changes the passwords of users in the native realm and built-in users.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-change-password.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-change-password.html>`_
|
||||
|
||||
:arg body: the new password for the user
|
||||
:arg username: The username of the user to change the password
|
||||
@@ -34,7 +34,7 @@ class SecurityClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_security", "user", username, "_password"),
|
||||
params=params,
|
||||
@@ -43,11 +43,11 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("usernames")
|
||||
def clear_cached_realms(self, realms, params=None, headers=None):
|
||||
async def clear_cached_realms(self, realms, params=None, headers=None):
|
||||
"""
|
||||
Evicts users from the user cache. Can completely clear the cache or evict
|
||||
specific users.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-cache.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-cache.html>`_
|
||||
|
||||
:arg realms: Comma-separated list of realms to clear
|
||||
:arg usernames: Comma-separated list of usernames to clear from
|
||||
@@ -56,7 +56,7 @@ class SecurityClient(NamespacedClient):
|
||||
if realms in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'realms'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_security", "realm", realms, "_clear_cache"),
|
||||
params=params,
|
||||
@@ -64,17 +64,17 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def clear_cached_roles(self, name, params=None, headers=None):
|
||||
async def clear_cached_roles(self, name, params=None, headers=None):
|
||||
"""
|
||||
Evicts roles from the native role cache.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-role-cache.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-clear-role-cache.html>`_
|
||||
|
||||
:arg name: Role name
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_security", "role", name, "_clear_cache"),
|
||||
params=params,
|
||||
@@ -82,10 +82,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def create_api_key(self, body, params=None, headers=None):
|
||||
async def create_api_key(self, body, params=None, headers=None):
|
||||
"""
|
||||
Creates an API key for access without requiring basic authentication.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-create-api-key.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html>`_
|
||||
|
||||
:arg body: The api key request to create an API key
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -96,15 +96,15 @@ class SecurityClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT", "/_security/api_key", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def delete_privileges(self, application, name, params=None, headers=None):
|
||||
async def delete_privileges(self, application, name, params=None, headers=None):
|
||||
"""
|
||||
Removes application privileges.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-privilege.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-delete-privilege.html>`_
|
||||
|
||||
:arg application: Application name
|
||||
:arg name: Privilege name
|
||||
@@ -117,7 +117,7 @@ class SecurityClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_security", "privilege", application, name),
|
||||
params=params,
|
||||
@@ -125,10 +125,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def delete_role(self, name, params=None, headers=None):
|
||||
async def delete_role(self, name, params=None, headers=None):
|
||||
"""
|
||||
Removes roles in the native realm.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-role.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-delete-role.html>`_
|
||||
|
||||
:arg name: Role name
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -139,7 +139,7 @@ class SecurityClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_security", "role", name),
|
||||
params=params,
|
||||
@@ -147,10 +147,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def delete_role_mapping(self, name, params=None, headers=None):
|
||||
async def delete_role_mapping(self, name, params=None, headers=None):
|
||||
"""
|
||||
Removes role mappings.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-role-mapping.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-delete-role-mapping.html>`_
|
||||
|
||||
:arg name: Role-mapping name
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -161,7 +161,7 @@ class SecurityClient(NamespacedClient):
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_security", "role_mapping", name),
|
||||
params=params,
|
||||
@@ -169,10 +169,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def delete_user(self, username, params=None, headers=None):
|
||||
async def delete_user(self, username, params=None, headers=None):
|
||||
"""
|
||||
Deletes users from the native realm.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-delete-user.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-delete-user.html>`_
|
||||
|
||||
:arg username: username
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -183,7 +183,7 @@ class SecurityClient(NamespacedClient):
|
||||
if username in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'username'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_security", "user", username),
|
||||
params=params,
|
||||
@@ -191,10 +191,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def disable_user(self, username, params=None, headers=None):
|
||||
async def disable_user(self, username, params=None, headers=None):
|
||||
"""
|
||||
Disables users in the native realm.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-disable-user.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-disable-user.html>`_
|
||||
|
||||
:arg username: The username of the user to disable
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -205,7 +205,7 @@ class SecurityClient(NamespacedClient):
|
||||
if username in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'username'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_security", "user", username, "_disable"),
|
||||
params=params,
|
||||
@@ -213,10 +213,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def enable_user(self, username, params=None, headers=None):
|
||||
async def enable_user(self, username, params=None, headers=None):
|
||||
"""
|
||||
Enables users in the native realm.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-enable-user.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-enable-user.html>`_
|
||||
|
||||
:arg username: The username of the user to enable
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -227,7 +227,7 @@ class SecurityClient(NamespacedClient):
|
||||
if username in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'username'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_security", "user", username, "_enable"),
|
||||
params=params,
|
||||
@@ -235,10 +235,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("id", "name", "owner", "realm_name", "username")
|
||||
def get_api_key(self, params=None, headers=None):
|
||||
async def get_api_key(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information for one or more API keys.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-api-key.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-api-key.html>`_
|
||||
|
||||
:arg id: API key id of the API key to be retrieved
|
||||
:arg name: API key name of the API key to be retrieved
|
||||
@@ -249,20 +249,22 @@ class SecurityClient(NamespacedClient):
|
||||
:arg username: user name of the user who created this API key to
|
||||
be retrieved
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_security/api_key", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_privileges(self, application=None, name=None, params=None, headers=None):
|
||||
async def get_privileges(
|
||||
self, application=None, name=None, params=None, headers=None
|
||||
):
|
||||
"""
|
||||
Retrieves application privileges.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-privileges.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-privileges.html>`_
|
||||
|
||||
:arg application: Application name
|
||||
:arg name: Privilege name
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_security", "privilege", application, name),
|
||||
params=params,
|
||||
@@ -270,26 +272,26 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_role(self, name=None, params=None, headers=None):
|
||||
async def get_role(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves roles in the native realm.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-role.html>`_
|
||||
|
||||
:arg name: Role name
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_security", "role", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_role_mapping(self, name=None, params=None, headers=None):
|
||||
async def get_role_mapping(self, name=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves role mappings.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-role-mapping.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-role-mapping.html>`_
|
||||
|
||||
:arg name: Role-Mapping name
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_security", "role_mapping", name),
|
||||
params=params,
|
||||
@@ -297,29 +299,29 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_token(self, body, params=None, headers=None):
|
||||
async def get_token(self, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a bearer token for access without requiring basic authentication.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-token.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-token.html>`_
|
||||
|
||||
:arg body: The token request to get
|
||||
"""
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_security/oauth2/token", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_user(self, username=None, params=None, headers=None):
|
||||
async def get_user(self, username=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about users in the native realm and built-in users.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-user.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-user.html>`_
|
||||
|
||||
:arg username: A comma-separated list of usernames
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_security", "user", username),
|
||||
params=params,
|
||||
@@ -327,20 +329,20 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_user_privileges(self, params=None, headers=None):
|
||||
async def get_user_privileges(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves application privileges.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-privileges.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-privileges.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_security/user/_privileges", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def has_privileges(self, body, user=None, params=None, headers=None):
|
||||
async def has_privileges(self, body, user=None, params=None, headers=None):
|
||||
"""
|
||||
Determines whether the specified user has a specified list of privileges.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-has-privileges.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-has-privileges.html>`_
|
||||
|
||||
:arg body: The privileges to test
|
||||
:arg user: Username
|
||||
@@ -348,7 +350,7 @@ class SecurityClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_security", "user", user, "_has_privileges"),
|
||||
params=params,
|
||||
@@ -357,32 +359,32 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def invalidate_api_key(self, body, params=None, headers=None):
|
||||
async def invalidate_api_key(self, body, params=None, headers=None):
|
||||
"""
|
||||
Invalidates one or more API keys.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-invalidate-api-key.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-invalidate-api-key.html>`_
|
||||
|
||||
:arg body: The api key request to invalidate API key(s)
|
||||
"""
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE", "/_security/api_key", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def invalidate_token(self, body, params=None, headers=None):
|
||||
async def invalidate_token(self, body, params=None, headers=None):
|
||||
"""
|
||||
Invalidates one or more access tokens or refresh tokens.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-invalidate-token.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-invalidate-token.html>`_
|
||||
|
||||
:arg body: The token to invalidate
|
||||
"""
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
"/_security/oauth2/token",
|
||||
params=params,
|
||||
@@ -391,10 +393,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def put_privileges(self, body, params=None, headers=None):
|
||||
async def put_privileges(self, body, params=None, headers=None):
|
||||
"""
|
||||
Adds or updates application privileges.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-privileges.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-put-privileges.html>`_
|
||||
|
||||
:arg body: The privilege(s) to add
|
||||
:arg refresh: If `true` (the default) then refresh the affected
|
||||
@@ -405,15 +407,15 @@ class SecurityClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT", "/_security/privilege/", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def put_role(self, name, body, params=None, headers=None):
|
||||
async def put_role(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Adds and updates roles in the native realm.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-role.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-put-role.html>`_
|
||||
|
||||
:arg name: Role name
|
||||
:arg body: The role to add
|
||||
@@ -426,7 +428,7 @@ class SecurityClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_security", "role", name),
|
||||
params=params,
|
||||
@@ -435,10 +437,10 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def put_role_mapping(self, name, body, params=None, headers=None):
|
||||
async def put_role_mapping(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates and updates role mappings.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-role-mapping.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-put-role-mapping.html>`_
|
||||
|
||||
:arg name: Role-mapping name
|
||||
:arg body: The role mapping to add
|
||||
@@ -451,7 +453,7 @@ class SecurityClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_security", "role_mapping", name),
|
||||
params=params,
|
||||
@@ -460,11 +462,11 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("refresh")
|
||||
def put_user(self, username, body, params=None, headers=None):
|
||||
async def put_user(self, username, body, params=None, headers=None):
|
||||
"""
|
||||
Adds and updates users in the native realm. These users are commonly referred
|
||||
to as native users.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-put-user.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-put-user.html>`_
|
||||
|
||||
:arg username: The username of the User
|
||||
:arg body: The user to add
|
||||
@@ -477,7 +479,7 @@ class SecurityClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_security", "user", username),
|
||||
params=params,
|
||||
@@ -486,12 +488,12 @@ class SecurityClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_builtin_privileges(self, params=None, headers=None):
|
||||
async def get_builtin_privileges(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves the list of cluster privileges and index privileges that are
|
||||
available in this version of Elasticsearch.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-builtin-privileges.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-get-builtin-privileges.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_security/privilege/_builtin", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class SlmClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete_lifecycle(self, policy_id, params=None, headers=None):
|
||||
async def delete_lifecycle(self, policy_id, params=None, headers=None):
|
||||
"""
|
||||
Deletes an existing snapshot lifecycle policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-delete-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-delete-policy.html>`_
|
||||
|
||||
:arg policy_id: The id of the snapshot lifecycle policy to
|
||||
remove
|
||||
@@ -18,7 +18,7 @@ class SlmClient(NamespacedClient):
|
||||
if policy_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'policy_id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_slm", "policy", policy_id),
|
||||
params=params,
|
||||
@@ -26,11 +26,11 @@ class SlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def execute_lifecycle(self, policy_id, params=None, headers=None):
|
||||
async def execute_lifecycle(self, policy_id, params=None, headers=None):
|
||||
"""
|
||||
Immediately creates a snapshot according to the lifecycle policy, without
|
||||
waiting for the scheduled time.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-execute-lifecycle.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-execute-lifecycle.html>`_
|
||||
|
||||
:arg policy_id: The id of the snapshot lifecycle policy to be
|
||||
executed
|
||||
@@ -38,7 +38,7 @@ class SlmClient(NamespacedClient):
|
||||
if policy_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'policy_id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_slm", "policy", policy_id, "_execute"),
|
||||
params=params,
|
||||
@@ -46,27 +46,27 @@ class SlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def execute_retention(self, params=None, headers=None):
|
||||
async def execute_retention(self, params=None, headers=None):
|
||||
"""
|
||||
Deletes any snapshots that are expired according to the policy's retention
|
||||
rules.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-execute-retention.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-execute-retention.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_slm/_execute_retention", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_lifecycle(self, policy_id=None, params=None, headers=None):
|
||||
async def get_lifecycle(self, policy_id=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves one or more snapshot lifecycle policy definitions and information
|
||||
about the latest snapshot attempts.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-get-policy.html>`_
|
||||
|
||||
:arg policy_id: Comma-separated list of snapshot lifecycle
|
||||
policies to retrieve
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_slm", "policy", policy_id),
|
||||
params=params,
|
||||
@@ -74,21 +74,21 @@ class SlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_stats(self, params=None, headers=None):
|
||||
async def get_stats(self, params=None, headers=None):
|
||||
"""
|
||||
Returns global and policy-level statistics about actions taken by snapshot
|
||||
lifecycle management.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-get-stats.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_slm/stats", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def put_lifecycle(self, policy_id, body=None, params=None, headers=None):
|
||||
async def put_lifecycle(self, policy_id, body=None, params=None, headers=None):
|
||||
"""
|
||||
Creates or updates a snapshot lifecycle policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-put-policy.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-put-policy.html>`_
|
||||
|
||||
:arg policy_id: The id of the snapshot lifecycle policy
|
||||
:arg body: The snapshot lifecycle policy definition to register
|
||||
@@ -96,7 +96,7 @@ class SlmClient(NamespacedClient):
|
||||
if policy_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'policy_id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_slm", "policy", policy_id),
|
||||
params=params,
|
||||
@@ -105,31 +105,31 @@ class SlmClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_status(self, params=None, headers=None):
|
||||
async def get_status(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves the status of snapshot lifecycle management (SLM).
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-get-status.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-get-status.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_slm/status", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def start(self, params=None, headers=None):
|
||||
async def start(self, params=None, headers=None):
|
||||
"""
|
||||
Turns on snapshot lifecycle management (SLM).
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-start.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-start.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_slm/start", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def stop(self, params=None, headers=None):
|
||||
async def stop(self, params=None, headers=None):
|
||||
"""
|
||||
Turns off snapshot lifecycle management (SLM).
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/slm-api-stop.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/slm-api-stop.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_slm/stop", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class SnapshotClient(NamespacedClient):
|
||||
@query_params("master_timeout", "wait_for_completion")
|
||||
def create(self, repository, snapshot, body=None, params=None, headers=None):
|
||||
async def create(self, repository, snapshot, body=None, params=None, headers=None):
|
||||
"""
|
||||
Creates a snapshot in a repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg snapshot: A snapshot name
|
||||
@@ -24,7 +24,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_snapshot", repository, snapshot),
|
||||
params=params,
|
||||
@@ -33,10 +33,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout")
|
||||
def delete(self, repository, snapshot, params=None, headers=None):
|
||||
async def delete(self, repository, snapshot, params=None, headers=None):
|
||||
"""
|
||||
Deletes a snapshot.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg snapshot: A snapshot name
|
||||
@@ -47,7 +47,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_snapshot", repository, snapshot),
|
||||
params=params,
|
||||
@@ -55,10 +55,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("ignore_unavailable", "master_timeout", "verbose")
|
||||
def get(self, repository, snapshot, params=None, headers=None):
|
||||
async def get(self, repository, snapshot, params=None, headers=None):
|
||||
"""
|
||||
Returns information about a snapshot.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg snapshot: A comma-separated list of snapshot names
|
||||
@@ -74,7 +74,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_snapshot", repository, snapshot),
|
||||
params=params,
|
||||
@@ -82,10 +82,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout")
|
||||
def delete_repository(self, repository, params=None, headers=None):
|
||||
async def delete_repository(self, repository, params=None, headers=None):
|
||||
"""
|
||||
Deletes a repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A comma-separated list of repository names
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
@@ -95,7 +95,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if repository in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'repository'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_snapshot", repository),
|
||||
params=params,
|
||||
@@ -103,10 +103,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("local", "master_timeout")
|
||||
def get_repository(self, repository=None, params=None, headers=None):
|
||||
async def get_repository(self, repository=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about a repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A comma-separated list of repository names
|
||||
:arg local: Return local information, do not retrieve the state
|
||||
@@ -114,15 +114,15 @@ class SnapshotClient(NamespacedClient):
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
to master node
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_snapshot", repository), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout", "verify")
|
||||
def create_repository(self, repository, body, params=None, headers=None):
|
||||
async def create_repository(self, repository, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg body: The repository definition
|
||||
@@ -135,7 +135,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_snapshot", repository),
|
||||
params=params,
|
||||
@@ -144,10 +144,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "wait_for_completion")
|
||||
def restore(self, repository, snapshot, body=None, params=None, headers=None):
|
||||
async def restore(self, repository, snapshot, body=None, params=None, headers=None):
|
||||
"""
|
||||
Restores a snapshot.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg snapshot: A snapshot name
|
||||
@@ -161,7 +161,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_snapshot", repository, snapshot, "_restore"),
|
||||
params=params,
|
||||
@@ -170,10 +170,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("ignore_unavailable", "master_timeout")
|
||||
def status(self, repository=None, snapshot=None, params=None, headers=None):
|
||||
async def status(self, repository=None, snapshot=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about the status of a snapshot.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg snapshot: A comma-separated list of snapshot names
|
||||
@@ -183,7 +183,7 @@ class SnapshotClient(NamespacedClient):
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
to master node
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_snapshot", repository, snapshot, "_status"),
|
||||
params=params,
|
||||
@@ -191,10 +191,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout")
|
||||
def verify_repository(self, repository, params=None, headers=None):
|
||||
async def verify_repository(self, repository, params=None, headers=None):
|
||||
"""
|
||||
Verifies a repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
@@ -204,7 +204,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if repository in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'repository'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_snapshot", repository, "_verify"),
|
||||
params=params,
|
||||
@@ -212,10 +212,10 @@ class SnapshotClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("master_timeout", "timeout")
|
||||
def cleanup_repository(self, repository, params=None, headers=None):
|
||||
async def cleanup_repository(self, repository, params=None, headers=None):
|
||||
"""
|
||||
Removes stale data from repository.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/clean-up-snapshot-repo-api.html>`_
|
||||
|
||||
:arg repository: A repository name
|
||||
:arg master_timeout: Explicit operation timeout for connection
|
||||
@@ -225,7 +225,7 @@ class SnapshotClient(NamespacedClient):
|
||||
if repository in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'repository'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_snapshot", repository, "_cleanup"),
|
||||
params=params,
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, SKIP_IN_PATH
|
||||
|
||||
class SqlClient(NamespacedClient):
|
||||
@query_params()
|
||||
def clear_cursor(self, body, params=None, headers=None):
|
||||
async def clear_cursor(self, body, params=None, headers=None):
|
||||
"""
|
||||
Clears the SQL cursor
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-pagination.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/sql-pagination.html>`_
|
||||
|
||||
:arg body: Specify the cursor value in the `cursor` element to
|
||||
clean the cursor.
|
||||
@@ -18,15 +18,15 @@ class SqlClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_sql/close", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params("format")
|
||||
def query(self, body, params=None, headers=None):
|
||||
async def query(self, body, params=None, headers=None):
|
||||
"""
|
||||
Executes a SQL request
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-rest-overview.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/sql-rest-overview.html>`_
|
||||
|
||||
:arg body: Use the `query` element to start a query. Use the
|
||||
`cursor` element to continue a query.
|
||||
@@ -36,21 +36,21 @@ class SqlClient(NamespacedClient):
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_sql", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def translate(self, body, params=None, headers=None):
|
||||
async def translate(self, body, params=None, headers=None):
|
||||
"""
|
||||
Translates SQL into Elasticsearch queries
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/sql-translate.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/sql-translate.html>`_
|
||||
|
||||
:arg body: Specify the query in the `query` element.
|
||||
"""
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_sql/translate", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@@ -7,12 +7,12 @@ from .utils import NamespacedClient, query_params
|
||||
|
||||
class SslClient(NamespacedClient):
|
||||
@query_params()
|
||||
def certificates(self, params=None, headers=None):
|
||||
async def certificates(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the X.509 certificates used to encrypt
|
||||
communications in the cluster.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-ssl.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-ssl.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_ssl/certificates", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
import warnings
|
||||
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
|
||||
@@ -15,10 +16,10 @@ class TasksClient(NamespacedClient):
|
||||
"timeout",
|
||||
"wait_for_completion",
|
||||
)
|
||||
def list(self, params=None, headers=None):
|
||||
async def list(self, params=None, headers=None):
|
||||
"""
|
||||
Returns a list of tasks.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/tasks.html>`_
|
||||
|
||||
:arg actions: A comma-separated list of actions that should be
|
||||
returned. Leave empty to return all.
|
||||
@@ -34,15 +35,15 @@ class TasksClient(NamespacedClient):
|
||||
:arg wait_for_completion: Wait for the matching tasks to
|
||||
complete (default: false)
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_tasks", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("actions", "nodes", "parent_task_id", "wait_for_completion")
|
||||
def cancel(self, task_id=None, params=None, headers=None):
|
||||
async def cancel(self, task_id=None, params=None, headers=None):
|
||||
"""
|
||||
Cancels a task, if it can be cancelled through an API.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/tasks.html>`_
|
||||
|
||||
:arg task_id: Cancel the task with specified task id
|
||||
(node_id:task_number)
|
||||
@@ -57,7 +58,7 @@ class TasksClient(NamespacedClient):
|
||||
cancellation of the task and its descendant tasks is completed. Defaults
|
||||
to false
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_tasks", task_id, "_cancel"),
|
||||
params=params,
|
||||
@@ -65,10 +66,10 @@ class TasksClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("timeout", "wait_for_completion")
|
||||
def get(self, task_id, params=None, headers=None):
|
||||
async def get(self, task_id=None, params=None, headers=None):
|
||||
"""
|
||||
Returns information about a task.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/tasks.html>`_
|
||||
|
||||
:arg task_id: Return the task with specified id
|
||||
(node_id:task_number)
|
||||
@@ -77,8 +78,13 @@ class TasksClient(NamespacedClient):
|
||||
complete (default: false)
|
||||
"""
|
||||
if task_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'task_id'.")
|
||||
warnings.warn(
|
||||
"Calling client.tasks.get() without a task_id is deprecated "
|
||||
"and will be removed in v8.0. Use client.tasks.list() instead.",
|
||||
category=DeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_tasks", task_id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class TransformClient(NamespacedClient):
|
||||
@query_params("force")
|
||||
def delete_transform(self, transform_id, params=None, headers=None):
|
||||
async def delete_transform(self, transform_id, params=None, headers=None):
|
||||
"""
|
||||
Deletes an existing transform.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform to delete
|
||||
:arg force: When `true`, the transform is deleted regardless of
|
||||
@@ -22,7 +22,7 @@ class TransformClient(NamespacedClient):
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_transform", transform_id),
|
||||
params=params,
|
||||
@@ -30,10 +30,10 @@ class TransformClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("allow_no_match", "from_", "size")
|
||||
def get_transform(self, transform_id=None, params=None, headers=None):
|
||||
async def get_transform(self, transform_id=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves configuration information for transforms.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-transform.html>`_
|
||||
|
||||
:arg transform_id: The id or comma delimited list of id
|
||||
expressions of the transforms to get, '_all' or '*' implies get all
|
||||
@@ -41,7 +41,7 @@ class TransformClient(NamespacedClient):
|
||||
:arg allow_no_match: Whether to ignore if a wildcard expression
|
||||
matches no transforms. (This includes `_all` string or when no
|
||||
transforms have been specified)
|
||||
:arg from\\_: skips a number of transform configs, defaults to 0
|
||||
:arg from_: skips a number of transform configs, defaults to 0
|
||||
:arg size: specifies a max number of transforms to get, defaults
|
||||
to 100
|
||||
"""
|
||||
@@ -49,7 +49,7 @@ class TransformClient(NamespacedClient):
|
||||
if "from_" in params:
|
||||
params["from"] = params.pop("from_")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_transform", transform_id),
|
||||
params=params,
|
||||
@@ -57,17 +57,17 @@ class TransformClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("allow_no_match", "from_", "size")
|
||||
def get_transform_stats(self, transform_id, params=None, headers=None):
|
||||
async def get_transform_stats(self, transform_id, params=None, headers=None):
|
||||
"""
|
||||
Retrieves usage information for transforms.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/get-transform-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-transform-stats.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform for which to get
|
||||
stats. '_all' or '*' implies all transforms
|
||||
:arg allow_no_match: Whether to ignore if a wildcard expression
|
||||
matches no transforms. (This includes `_all` string or when no
|
||||
transforms have been specified)
|
||||
:arg from\\_: skips a number of transform stats, defaults to 0
|
||||
:arg from_: skips a number of transform stats, defaults to 0
|
||||
:arg size: specifies a max number of transform stats to get,
|
||||
defaults to 100
|
||||
"""
|
||||
@@ -80,7 +80,7 @@ class TransformClient(NamespacedClient):
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_transform", transform_id, "_stats"),
|
||||
params=params,
|
||||
@@ -88,25 +88,25 @@ class TransformClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def preview_transform(self, body, params=None, headers=None):
|
||||
async def preview_transform(self, body, params=None, headers=None):
|
||||
"""
|
||||
Previews a transform.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/preview-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/preview-transform.html>`_
|
||||
|
||||
:arg body: The definition for the transform to preview
|
||||
"""
|
||||
if body in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_transform/_preview", params=params, headers=headers, body=body
|
||||
)
|
||||
|
||||
@query_params("defer_validation")
|
||||
def put_transform(self, transform_id, body, params=None, headers=None):
|
||||
async def put_transform(self, transform_id, body, params=None, headers=None):
|
||||
"""
|
||||
Instantiates a transform.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/put-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the new transform.
|
||||
:arg body: The transform definition
|
||||
@@ -117,7 +117,7 @@ class TransformClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_transform", transform_id),
|
||||
params=params,
|
||||
@@ -126,10 +126,10 @@ class TransformClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("timeout")
|
||||
def start_transform(self, transform_id, params=None, headers=None):
|
||||
async def start_transform(self, transform_id, params=None, headers=None):
|
||||
"""
|
||||
Starts one or more transforms.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/start-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/start-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform to start
|
||||
:arg timeout: Controls the time to wait for the transform to
|
||||
@@ -140,7 +140,7 @@ class TransformClient(NamespacedClient):
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_transform", transform_id, "_start"),
|
||||
params=params,
|
||||
@@ -154,10 +154,10 @@ class TransformClient(NamespacedClient):
|
||||
"wait_for_checkpoint",
|
||||
"wait_for_completion",
|
||||
)
|
||||
def stop_transform(self, transform_id, params=None, headers=None):
|
||||
async def stop_transform(self, transform_id, params=None, headers=None):
|
||||
"""
|
||||
Stops one or more transforms.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/stop-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/stop-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform to stop
|
||||
:arg allow_no_match: Whether to ignore if a wildcard expression
|
||||
@@ -177,7 +177,7 @@ class TransformClient(NamespacedClient):
|
||||
"Empty value passed for a required argument 'transform_id'."
|
||||
)
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_transform", transform_id, "_stop"),
|
||||
params=params,
|
||||
@@ -185,10 +185,10 @@ class TransformClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("defer_validation")
|
||||
def update_transform(self, transform_id, body, params=None, headers=None):
|
||||
async def update_transform(self, transform_id, body, params=None, headers=None):
|
||||
"""
|
||||
Updates certain properties of a transform.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-transform.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/update-transform.html>`_
|
||||
|
||||
:arg transform_id: The id of the transform.
|
||||
:arg body: The update transform definition
|
||||
@@ -199,7 +199,7 @@ class TransformClient(NamespacedClient):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_transform", transform_id, "_update"),
|
||||
params=params,
|
||||
|
||||
@@ -2,129 +2,12 @@
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import weakref
|
||||
from datetime import date, datetime
|
||||
from functools import wraps
|
||||
from ..compat import string_types, quote, PY2
|
||||
|
||||
# parts of URL to be omitted
|
||||
SKIP_IN_PATH = (None, "", b"", [], ())
|
||||
|
||||
|
||||
def _escape(value):
|
||||
"""
|
||||
Escape a single value of a URL string or a query parameter. If it is a list
|
||||
or tuple, turn it into a comma-separated string first.
|
||||
"""
|
||||
|
||||
# make sequences into comma-separated stings
|
||||
if isinstance(value, (list, tuple)):
|
||||
value = ",".join(value)
|
||||
|
||||
# dates and datetimes into isoformat
|
||||
elif isinstance(value, (date, datetime)):
|
||||
value = value.isoformat()
|
||||
|
||||
# make bools into true/false strings
|
||||
elif isinstance(value, bool):
|
||||
value = str(value).lower()
|
||||
|
||||
# don't decode bytestrings
|
||||
elif isinstance(value, bytes):
|
||||
return value
|
||||
|
||||
# encode strings to utf-8
|
||||
if isinstance(value, string_types):
|
||||
if PY2 and isinstance(value, unicode): # noqa: F821
|
||||
return value.encode("utf-8")
|
||||
if not PY2 and isinstance(value, str):
|
||||
return value.encode("utf-8")
|
||||
|
||||
return str(value)
|
||||
|
||||
|
||||
def _make_path(*parts):
|
||||
"""
|
||||
Create a URL string from parts, omit all `None` values and empty strings.
|
||||
Convert lists and tuples to comma separated values.
|
||||
"""
|
||||
# TODO: maybe only allow some parts to be lists/tuples ?
|
||||
return "/" + "/".join(
|
||||
# preserve ',' and '*' in url for nicer URLs in logs
|
||||
quote(_escape(p), b",*")
|
||||
for p in parts
|
||||
if p not in SKIP_IN_PATH
|
||||
)
|
||||
|
||||
|
||||
# parameters that apply to all methods
|
||||
GLOBAL_PARAMS = ("pretty", "human", "error_trace", "format", "filter_path")
|
||||
|
||||
|
||||
def query_params(*es_query_params):
|
||||
"""
|
||||
Decorator that pops all accepted parameters from method's kwargs and puts
|
||||
them in the params argument.
|
||||
"""
|
||||
|
||||
def _wrapper(func):
|
||||
@wraps(func)
|
||||
def _wrapped(*args, **kwargs):
|
||||
params = (kwargs.pop("params", None) or {}).copy()
|
||||
headers = {
|
||||
k.lower(): v
|
||||
for k, v in (kwargs.pop("headers", None) or {}).copy().items()
|
||||
}
|
||||
|
||||
if "opaque_id" in kwargs:
|
||||
headers["x-opaque-id"] = kwargs.pop("opaque_id")
|
||||
|
||||
for p in es_query_params + GLOBAL_PARAMS:
|
||||
if p in kwargs:
|
||||
v = kwargs.pop(p)
|
||||
if v is not None:
|
||||
params[p] = _escape(v)
|
||||
|
||||
# don't treat ignore, request_timeout, and opaque_id as other params to avoid escaping
|
||||
for p in ("ignore", "request_timeout"):
|
||||
if p in kwargs:
|
||||
params[p] = kwargs.pop(p)
|
||||
return func(*args, params=params, headers=headers, **kwargs)
|
||||
|
||||
return _wrapped
|
||||
|
||||
return _wrapper
|
||||
|
||||
|
||||
def _bulk_body(serializer, body):
|
||||
# if not passed in a string, serialize items and join by newline
|
||||
if not isinstance(body, string_types):
|
||||
body = "\n".join(map(serializer.dumps, body))
|
||||
|
||||
# bulk body must end with a newline
|
||||
if isinstance(body, bytes):
|
||||
if not body.endswith(b"\n"):
|
||||
body += b"\n"
|
||||
elif isinstance(body, string_types) and not body.endswith("\n"):
|
||||
body += "\n"
|
||||
|
||||
return body
|
||||
|
||||
|
||||
class NamespacedClient(object):
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@property
|
||||
def transport(self):
|
||||
return self.client.transport
|
||||
|
||||
|
||||
class AddonClient(NamespacedClient):
|
||||
@classmethod
|
||||
def infect_client(cls, client):
|
||||
addon = cls(weakref.proxy(client))
|
||||
setattr(client, cls.namespace, addon)
|
||||
return client
|
||||
from ...client.utils import ( # noqa
|
||||
_make_path,
|
||||
_normalize_hosts,
|
||||
_escape,
|
||||
_bulk_body,
|
||||
query_params,
|
||||
SKIP_IN_PATH,
|
||||
NamespacedClient,
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@ from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
|
||||
|
||||
class WatcherClient(NamespacedClient):
|
||||
@query_params()
|
||||
def ack_watch(self, watch_id, action_id=None, params=None, headers=None):
|
||||
async def ack_watch(self, watch_id, action_id=None, params=None, headers=None):
|
||||
"""
|
||||
Acknowledges a watch, manually throttling the execution of the watch's actions.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-ack-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-ack-watch.html>`_
|
||||
|
||||
:arg watch_id: Watch ID
|
||||
:arg action_id: A comma-separated list of the action ids to be
|
||||
@@ -19,7 +19,7 @@ class WatcherClient(NamespacedClient):
|
||||
if watch_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'watch_id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_watcher", "watch", watch_id, "_ack", action_id),
|
||||
params=params,
|
||||
@@ -27,17 +27,17 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def activate_watch(self, watch_id, params=None, headers=None):
|
||||
async def activate_watch(self, watch_id, params=None, headers=None):
|
||||
"""
|
||||
Activates a currently inactive watch.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-activate-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-activate-watch.html>`_
|
||||
|
||||
:arg watch_id: Watch ID
|
||||
"""
|
||||
if watch_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'watch_id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_watcher", "watch", watch_id, "_activate"),
|
||||
params=params,
|
||||
@@ -45,17 +45,17 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def deactivate_watch(self, watch_id, params=None, headers=None):
|
||||
async def deactivate_watch(self, watch_id, params=None, headers=None):
|
||||
"""
|
||||
Deactivates a currently active watch.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-deactivate-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-deactivate-watch.html>`_
|
||||
|
||||
:arg watch_id: Watch ID
|
||||
"""
|
||||
if watch_id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'watch_id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_watcher", "watch", watch_id, "_deactivate"),
|
||||
params=params,
|
||||
@@ -63,17 +63,17 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def delete_watch(self, id, params=None, headers=None):
|
||||
async def delete_watch(self, id, params=None, headers=None):
|
||||
"""
|
||||
Removes a watch from Watcher.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-delete-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-delete-watch.html>`_
|
||||
|
||||
:arg id: Watch ID
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"DELETE",
|
||||
_make_path("_watcher", "watch", id),
|
||||
params=params,
|
||||
@@ -81,17 +81,17 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params("debug")
|
||||
def execute_watch(self, body=None, id=None, params=None, headers=None):
|
||||
async def execute_watch(self, body=None, id=None, params=None, headers=None):
|
||||
"""
|
||||
Forces the execution of a stored watch.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-execute-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-execute-watch.html>`_
|
||||
|
||||
:arg body: Execution control
|
||||
:arg id: Watch ID
|
||||
:arg debug: indicates whether the watch should execute in debug
|
||||
mode
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_watcher", "watch", id, "_execute"),
|
||||
params=params,
|
||||
@@ -100,25 +100,25 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def get_watch(self, id, params=None, headers=None):
|
||||
async def get_watch(self, id, params=None, headers=None):
|
||||
"""
|
||||
Retrieves a watch by its ID.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-get-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-get-watch.html>`_
|
||||
|
||||
:arg id: Watch ID
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", _make_path("_watcher", "watch", id), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("active", "if_primary_term", "if_seq_no", "version")
|
||||
def put_watch(self, id, body=None, params=None, headers=None):
|
||||
async def put_watch(self, id, body=None, params=None, headers=None):
|
||||
"""
|
||||
Creates a new watch, or updates an existing one.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-put-watch.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-put-watch.html>`_
|
||||
|
||||
:arg id: Watch ID
|
||||
:arg body: The watch
|
||||
@@ -132,7 +132,7 @@ class WatcherClient(NamespacedClient):
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"PUT",
|
||||
_make_path("_watcher", "watch", id),
|
||||
params=params,
|
||||
@@ -141,20 +141,20 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def start(self, params=None, headers=None):
|
||||
async def start(self, params=None, headers=None):
|
||||
"""
|
||||
Starts Watcher if it is not already running.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-start.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-start.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_watcher/_start", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("emit_stacktraces")
|
||||
def stats(self, metric=None, params=None, headers=None):
|
||||
async def stats(self, metric=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieves the current Watcher metrics.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-stats.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-stats.html>`_
|
||||
|
||||
:arg metric: Controls what additional stat metrics should be
|
||||
include in the response Valid choices: _all, queued_watches,
|
||||
@@ -162,7 +162,7 @@ class WatcherClient(NamespacedClient):
|
||||
:arg emit_stacktraces: Emits stack traces of currently running
|
||||
watches
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET",
|
||||
_make_path("_watcher", "stats", metric),
|
||||
params=params,
|
||||
@@ -170,11 +170,11 @@ class WatcherClient(NamespacedClient):
|
||||
)
|
||||
|
||||
@query_params()
|
||||
def stop(self, params=None, headers=None):
|
||||
async def stop(self, params=None, headers=None):
|
||||
"""
|
||||
Stops Watcher if it is running.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/watcher-api-stop.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/watcher-api-stop.html>`_
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"POST", "/_watcher/_stop", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -11,26 +11,26 @@ class XPackClient(NamespacedClient):
|
||||
|
||||
# AUTO-GENERATED-API-DEFINITIONS #
|
||||
@query_params("categories")
|
||||
def info(self, params=None, headers=None):
|
||||
async def info(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves information about the installed X-Pack features.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/info-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/info-api.html>`_
|
||||
|
||||
:arg categories: Comma-separated list of info categories. Can be
|
||||
any of: build, license, features
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_xpack", params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("master_timeout")
|
||||
def usage(self, params=None, headers=None):
|
||||
async def usage(self, params=None, headers=None):
|
||||
"""
|
||||
Retrieves usage information about the installed X-Pack features.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/usage-api.html>`_
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/usage-api.html>`_
|
||||
|
||||
:arg master_timeout: Specify timeout for watch write operation
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
return await self.transport.perform_request(
|
||||
"GET", "/_xpack/usage", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import logging
|
||||
|
||||
from ..transport import Transport
|
||||
from ..exceptions import TransportError
|
||||
from ..compat import string_types, urlparse, unquote
|
||||
from ..transport import Transport, TransportError
|
||||
from .indices import IndicesClient
|
||||
from .ingest import IngestClient
|
||||
from .cluster import ClusterClient
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Licensed to Elasticsearch B.V under one or more agreements.
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Licensed to Elasticsearch B.V under one or more agreements.
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Licensed to Elasticsearch B.V under one or more agreements.
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Licensed to Elasticsearch B.V under one or more agreements.
|
||||
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
# See the LICENSE file in the project root for more information
|
||||
|
||||
|
||||
Reference in New Issue
Block a user