Update new APIs in 7.x
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
# flake8: noqa
|
||||
from __future__ import absolute_import
|
||||
|
||||
VERSION = (7, 7, 0)
|
||||
VERSION = (7, 8, 0)
|
||||
__version__ = VERSION
|
||||
__versionstr__ = "7.7.0a2"
|
||||
__versionstr__ = "7.8.0"
|
||||
|
||||
import logging
|
||||
import warnings
|
||||
|
||||
@@ -20,6 +20,7 @@ class AutoscalingClient(NamespacedClient):
|
||||
@query_params()
|
||||
def delete_autoscaling_policy(self, name, params=None, headers=None):
|
||||
"""
|
||||
Deletes an autoscaling policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-delete-autoscaling-policy.html>`_
|
||||
|
||||
:arg name: the name of the autoscaling policy
|
||||
@@ -37,6 +38,7 @@ class AutoscalingClient(NamespacedClient):
|
||||
@query_params()
|
||||
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
|
||||
@@ -54,6 +56,7 @@ class AutoscalingClient(NamespacedClient):
|
||||
@query_params()
|
||||
def put_autoscaling_policy(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates a new autoscaling policy.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/autoscaling-put-autoscaling-policy.html>`_
|
||||
|
||||
:arg name: the name of the autoscaling policy
|
||||
|
||||
@@ -324,3 +324,38 @@ class ClusterClient(NamespacedClient):
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params("wait_for_removal")
|
||||
def delete_voting_config_exclusions(self, params=None, headers=None):
|
||||
"""
|
||||
Clears cluster voting config exclusions.
|
||||
`<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(
|
||||
"DELETE",
|
||||
"/_cluster/voting_config_exclusions",
|
||||
params=params,
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
@query_params("node_ids", "node_names", "timeout")
|
||||
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/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
|
||||
may not also specify ?node_names.
|
||||
:arg node_names: A comma-separated list of the names of the
|
||||
nodes to exclude from the voting configuration. If specified, you may
|
||||
not also specify ?node_ids.
|
||||
:arg timeout: Explicit operation timeout Default: 30s
|
||||
"""
|
||||
return self.transport.perform_request(
|
||||
"POST", "/_cluster/voting_config_exclusions", params=params, headers=headers
|
||||
)
|
||||
|
||||
@@ -1388,7 +1388,7 @@ class IndicesClient(NamespacedClient):
|
||||
"GET", _make_path("_index_template", name), params=params, headers=headers
|
||||
)
|
||||
|
||||
@query_params("create", "master_timeout", "order")
|
||||
@query_params("cause", "create", "master_timeout")
|
||||
def put_index_template(self, name, body, params=None, headers=None):
|
||||
"""
|
||||
Creates or updates an index template.
|
||||
@@ -1396,12 +1396,11 @@ class IndicesClient(NamespacedClient):
|
||||
|
||||
:arg name: The name of the template
|
||||
:arg body: The template definition
|
||||
:arg cause: User defined reason for creating/updating the index
|
||||
template
|
||||
:arg create: Whether the index template should only be added if
|
||||
new or can also replace an existing one
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
:arg order: The order for this template when merging multiple
|
||||
matching ones (higher numbers are merged later, overriding the lower
|
||||
numbers)
|
||||
"""
|
||||
for param in (name, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
@@ -1414,3 +1413,32 @@ class IndicesClient(NamespacedClient):
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@query_params("cause", "create", "master_timeout")
|
||||
def simulate_index_template(self, name, body=None, params=None, headers=None):
|
||||
"""
|
||||
Simulate matching the given index name against the index templates in the
|
||||
system
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-templates.html>`_
|
||||
|
||||
:arg name: The name of the index (it must be a concrete index
|
||||
name)
|
||||
:arg body: New index template definition, which will be included
|
||||
in the simulation, as if it already exists in the system
|
||||
:arg cause: User defined reason for dry-run creating the new
|
||||
template for simulation purposes
|
||||
:arg create: Whether the index template we optionally defined in
|
||||
the body should only be dry-run added if new or can also replace an
|
||||
existing one
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
|
||||
return self.transport.perform_request(
|
||||
"POST",
|
||||
_make_path("_index_template", "_simulate_index", name),
|
||||
params=params,
|
||||
headers=headers,
|
||||
body=body,
|
||||
)
|
||||
|
||||
@@ -9,6 +9,7 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
|
||||
def clear_cache(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Clear the cache of searchable snapshots.
|
||||
`<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
|
||||
@@ -32,7 +33,8 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
@query_params("master_timeout", "wait_for_completion")
|
||||
def mount(self, repository, snapshot, body, params=None, headers=None):
|
||||
"""
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/searchable-snapshots-api-mount-snapshot>`_
|
||||
Mount a snapshot as a searchable index.
|
||||
`<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
|
||||
@@ -59,6 +61,7 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
@query_params()
|
||||
def repository_stats(self, repository, params=None, headers=None):
|
||||
"""
|
||||
Retrieve usage statistics about a snapshot repository.
|
||||
`<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
|
||||
@@ -76,6 +79,7 @@ class SearchableSnapshotsClient(NamespacedClient):
|
||||
@query_params()
|
||||
def stats(self, index=None, params=None, headers=None):
|
||||
"""
|
||||
Retrieve various statistics about searchable snapshots.
|
||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/searchable-snapshots-api-stats.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names
|
||||
|
||||
Reference in New Issue
Block a user