Generate cluster client from API specs (#530)

Signed-off-by: saimedhi <[email protected]>
This commit is contained in:
Sai Medhini Reddy Maryada
2023-10-09 17:57:09 -04:00
committed by GitHub
parent 388fb9d983
commit ce835fb59d
6 changed files with 765 additions and 236 deletions
+1
View File
@@ -9,6 +9,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Generate `tasks` client from API specs ([#508](https://github.com/opensearch-project/opensearch-py/pull/508)) - Generate `tasks` client from API specs ([#508](https://github.com/opensearch-project/opensearch-py/pull/508))
- Generate `ingest` client from API specs ([#513](https://github.com/opensearch-project/opensearch-py/pull/513)) - Generate `ingest` client from API specs ([#513](https://github.com/opensearch-project/opensearch-py/pull/513))
- Generate `dangling_indices` client from API specs ([#511](https://github.com/opensearch-project/opensearch-py/pull/511)) - Generate `dangling_indices` client from API specs ([#511](https://github.com/opensearch-project/opensearch-py/pull/511))
- Generate `cluster` client from API specs ([#530](https://github.com/opensearch-project/opensearch-py/pull/530))
- Generate `nodes` client from API specs ([#514](https://github.com/opensearch-project/opensearch-py/pull/514)) - Generate `nodes` client from API specs ([#514](https://github.com/opensearch-project/opensearch-py/pull/514))
- Generate `cat` client from API specs ([#529](https://github.com/opensearch-project/opensearch-py/pull/529)) - Generate `cat` client from API specs ([#529](https://github.com/opensearch-project/opensearch-py/pull/529))
### Deprecated ### Deprecated
+259 -108
View File
@@ -25,16 +25,27 @@
# under the License. # under the License.
# ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
#
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or the "OpenSearch API specification" available at:
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class ClusterClient(NamespacedClient): class ClusterClient(NamespacedClient):
@query_params( @query_params(
"awareness_attribute",
"cluster_manager_timeout",
"expand_wildcards", "expand_wildcards",
"level", "level",
"local", "local",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_events", "wait_for_events",
@@ -48,31 +59,35 @@ class ClusterClient(NamespacedClient):
Returns basic information about the health of the cluster. Returns basic information about the health of the cluster.
:arg index: Limit the information returned to a specific index :arg index: Limit the information returned to specific indicies.
:arg awareness_attribute: The awareness attribute for which the
health is required.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: all,
closed, hidden, none, all Default: all open, closed, hidden, none
:arg level: Specify the level of detail for returned information :arg level: Specify the level of detail for returned
Valid choices: cluster, indices, shards Default: cluster information. Valid choices: cluster, indices, shards,
awareness_attributes
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node :arg timeout: Operation timeout.
:arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Wait until the specified number of :arg wait_for_active_shards: Wait until the specified number of
shards is active shards is active.
:arg wait_for_events: Wait until all currently queued events :arg wait_for_events: Wait until all currently queued events
with the given priority are processed Valid choices: immediate, urgent, with the given priority are processed. Valid choices: immediate,
high, normal, low, languid urgent, high, normal, low, languid
:arg wait_for_no_initializing_shards: Whether to wait until :arg wait_for_no_initializing_shards: Whether to wait until
there are no initializing shards in the cluster there are no initializing shards in the cluster.
:arg wait_for_no_relocating_shards: Whether to wait until there :arg wait_for_no_relocating_shards: Whether to wait until there
are no relocating shards in the cluster are no relocating shards in the cluster.
:arg wait_for_nodes: Wait until the specified number of nodes is :arg wait_for_nodes: Wait until the specified number of nodes is
available available.
:arg wait_for_status: Wait until cluster is in a specific state :arg wait_for_status: Wait until cluster is in a specific state.
Valid choices: green, yellow, red Valid choices: green, yellow, red
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
@@ -82,17 +97,20 @@ class ClusterClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("local", "master_timeout", "cluster_manager_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
async 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, Returns a list of any cluster-level changes (e.g. create index, update mapping,
allocate or fail shard) which have not yet been executed. allocate or fail shard) which have not yet been executed.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg master_timeout (Deprecated: To promote inclusive language,
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager use 'cluster_manager_timeout' instead): Operation timeout for connection
to master node.
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "/_cluster/pending_tasks", params=params, headers=headers "GET", "/_cluster/pending_tasks", params=params, headers=headers
@@ -100,12 +118,12 @@ class ClusterClient(NamespacedClient):
@query_params( @query_params(
"allow_no_indices", "allow_no_indices",
"cluster_manager_timeout",
"expand_wildcards", "expand_wildcards",
"flat_settings", "flat_settings",
"ignore_unavailable", "ignore_unavailable",
"local", "local",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"wait_for_metadata_version", "wait_for_metadata_version",
"wait_for_timeout", "wait_for_timeout",
) )
@@ -115,28 +133,31 @@ class ClusterClient(NamespacedClient):
:arg metric: Limit the information returned to the specified :arg metric: Limit the information returned to the specified
metrics Valid choices: _all, blocks, metadata, nodes, routing_table, metrics. Valid choices: _all, blocks, metadata, nodes, routing_table,
routing_nodes, master_node, version routing_nodes, master_node, cluster_manager_node, version
:arg index: A comma-separated list of index names; use `_all` or :arg index: Comma-separated list of indices; use `_all` or empty
empty string to perform the operation on all indices string to perform the operation on all indices.
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified).
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: all,
closed, hidden, none, all Default: open open, closed, hidden, none
:arg flat_settings: Return settings in flat format (default: :arg flat_settings: Return settings in flat format. (default:
false) false)
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed).
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg master_timeout (Deprecated: To promote inclusive language,
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager use 'cluster_manager_timeout' instead): Operation timeout for connection
to master node.
:arg wait_for_metadata_version: Wait for the metadata version to :arg wait_for_metadata_version: Wait for the metadata version to
be equal or greater than the specified metadata version be equal or greater than the specified metadata version.
:arg wait_for_timeout: The maximum time to wait for :arg wait_for_timeout: The maximum time to wait for
wait_for_metadata_version before timing out wait_for_metadata_version before timing out.
""" """
if index and metric in SKIP_IN_PATH: if index and metric in SKIP_IN_PATH:
metric = "_all" metric = "_all"
@@ -154,13 +175,13 @@ class ClusterClient(NamespacedClient):
Returns high-level overview of cluster statistics. Returns high-level overview of cluster statistics.
:arg node_id: A comma-separated list of node IDs or names to :arg node_id: Comma-separated list of node IDs or names to limit
limit the returned information; use `_local` to return information from the returned information; use `_local` to return information from the
the node you're connecting to, leave empty to get information from all node you're connecting to, leave empty to get information from all
nodes nodes.
:arg flat_settings: Return settings in flat format (default: :arg flat_settings: Return settings in flat format. (default:
false) false)
:arg timeout: Explicit operation timeout :arg timeout: Operation timeout.
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "GET",
@@ -172,10 +193,10 @@ class ClusterClient(NamespacedClient):
) )
@query_params( @query_params(
"cluster_manager_timeout",
"dry_run", "dry_run",
"explain", "explain",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"metric", "metric",
"retry_failed", "retry_failed",
"timeout", "timeout",
@@ -187,30 +208,30 @@ class ClusterClient(NamespacedClient):
:arg body: The definition of `commands` to perform (`move`, :arg body: The definition of `commands` to perform (`move`,
`cancel`, `allocate`) `cancel`, `allocate`)
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg dry_run: Simulate the operation only and return the :arg dry_run: Simulate the operation only and return the
resulting state resulting state.
:arg explain: Return an explanation of why the commands can or :arg explain: Return an explanation of why the commands can or
cannot be executed cannot be executed.
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node
:arg metric: Limit the information returned to the specified :arg metric: Limit the information returned to the specified
metrics. Defaults to all but metadata Valid choices: _all, blocks, metrics. Defaults to all but metadata.
metadata, nodes, routing_table, master_node, version
:arg retry_failed: Retries allocation of shards that are blocked :arg retry_failed: Retries allocation of shards that are blocked
due to too many subsequent allocation failures due to too many subsequent allocation failures.
:arg timeout: Explicit operation timeout :arg timeout: Operation timeout.
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "/_cluster/reroute", params=params, headers=headers, body=body "POST", "/_cluster/reroute", params=params, headers=headers, body=body
) )
@query_params( @query_params(
"cluster_manager_timeout",
"flat_settings", "flat_settings",
"include_defaults", "include_defaults",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"timeout", "timeout",
) )
async def get_settings(self, params=None, headers=None): async def get_settings(self, params=None, headers=None):
@@ -218,22 +239,23 @@ class ClusterClient(NamespacedClient):
Returns cluster settings. Returns cluster settings.
:arg flat_settings: Return settings in flat format (default: :arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg flat_settings: Return settings in flat format. (default:
false) false)
:arg include_defaults: Whether to return all default clusters :arg include_defaults: Whether to return all default clusters
setting. setting. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node :arg timeout: Operation timeout.
:arg timeout: Explicit operation timeout
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "/_cluster/settings", params=params, headers=headers "GET", "/_cluster/settings", params=params, headers=headers
) )
@query_params( @query_params(
"flat_settings", "master_timeout", "cluster_manager_timeout", "timeout" "cluster_manager_timeout", "flat_settings", "master_timeout", "timeout"
) )
async def put_settings(self, body, params=None, headers=None): async def put_settings(self, body, params=None, headers=None):
""" """
@@ -242,13 +264,14 @@ class ClusterClient(NamespacedClient):
:arg body: The settings to be updated. Can be either `transient` :arg body: The settings to be updated. Can be either `transient`
or `persistent` (survives cluster restart). or `persistent` (survives cluster restart).
:arg flat_settings: Return settings in flat format (default: :arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg flat_settings: Return settings in flat format. (default:
false) false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node :arg timeout: Operation timeout.
:arg timeout: Explicit operation timeout
""" """
if body in SKIP_IN_PATH: if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.") raise ValueError("Empty value passed for a required argument 'body'.")
@@ -276,9 +299,9 @@ class ClusterClient(NamespacedClient):
:arg body: The index, shard, and primary flag to explain. Empty :arg body: The index, shard, and primary flag to explain. Empty
means 'explain the first unassigned shard' means 'explain the first unassigned shard'
:arg include_disk_info: Return information about disk usage and :arg include_disk_info: Return information about disk usage and
shard sizes (default: false) shard sizes. (default: false)
:arg include_yes_decisions: Return 'YES' decisions in :arg include_yes_decisions: Return 'YES' decisions in
explanation (default: false) explanation. (default: false)
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
@@ -288,16 +311,19 @@ class ClusterClient(NamespacedClient):
body=body, body=body,
) )
@query_params("master_timeout", "cluster_manager_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async 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 Deletes a component template.
:arg name: The name of the template :arg name: The name of the template.
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg cluster_manager_timeout: Operation timeout for connection
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager to cluster-manager node.
:arg timeout: Explicit operation timeout :arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead): Operation timeout for connection
to master node.
:arg timeout: Operation timeout.
""" """
if name in SKIP_IN_PATH: if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.") raise ValueError("Empty value passed for a required argument 'name'.")
@@ -309,19 +335,20 @@ class ClusterClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("local", "master_timeout", "cluster_manager_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
async 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 Returns one or more component templates.
:arg name: The comma separated names of the component templates :arg name: The Comma-separated names of the component templates.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "GET",
@@ -330,19 +357,22 @@ class ClusterClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("create", "master_timeout", "cluster_manager_timeout", "timeout") @query_params("cluster_manager_timeout", "create", "master_timeout", "timeout")
async 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 Creates or updates a component template.
:arg name: The name of the template :arg name: The name of the template.
:arg body: The template definition :arg body: The template definition
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg create: Whether the index template should only be added if :arg create: Whether the index template should only be added if
new or can also replace an existing one new or can also replace an existing one. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg master_timeout (Deprecated: To promote inclusive language,
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg timeout: Explicit operation timeout to master node.
:arg timeout: Operation timeout.
""" """
for param in (name, body): for param in (name, body):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
@@ -356,19 +386,18 @@ class ClusterClient(NamespacedClient):
body=body, body=body,
) )
@query_params("local", "master_timeout", "cluster_manager_timeout") @query_params("local", "master_timeout")
async 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 Returns information about whether a particular component template exist.
:arg name: The name of the template :arg name: The name of the template.
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node
""" """
if name in SKIP_IN_PATH: if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.") raise ValueError("Empty value passed for a required argument 'name'.")
@@ -388,7 +417,7 @@ class ClusterClient(NamespacedClient):
:arg wait_for_removal: Specifies whether to wait for all :arg wait_for_removal: Specifies whether to wait for all
excluded nodes to be removed from the cluster before clearing the voting excluded nodes to be removed from the cluster before clearing the voting
configuration exclusions list. Default: True configuration exclusions list. (default: True)
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"DELETE", "DELETE",
@@ -403,14 +432,136 @@ class ClusterClient(NamespacedClient):
Updates the cluster voting config exclusions by node ids or node names. Updates the cluster voting config exclusions by node ids or node names.
:arg node_ids: A comma-separated list of the persistent ids of :arg node_ids: Comma-separated list of the persistent ids of the
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 nodes to exclude from the voting configuration. If specified, you may
not also specify ?node_ids. not also specify ?node_names.
:arg timeout: Explicit operation timeout Default: 30s :arg node_names: 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: Operation timeout.
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "/_cluster/voting_config_exclusions", params=params, headers=headers "POST", "/_cluster/voting_config_exclusions", params=params, headers=headers
) )
@query_params()
async def delete_decommission_awareness(self, params=None, headers=None):
"""
Delete any existing decommission.
"""
return await self.transport.perform_request(
"DELETE",
"/_cluster/decommission/awareness/",
params=params,
headers=headers,
)
@query_params()
async def delete_weighted_routing(self, params=None, headers=None):
"""
Delete weighted shard routing weights.
"""
return await self.transport.perform_request(
"DELETE",
"/_cluster/routing/awareness/weights",
params=params,
headers=headers,
)
@query_params()
async def get_decommission_awareness(
self, awareness_attribute_name, params=None, headers=None
):
"""
Get details and status of decommissioned attribute.
:arg awareness_attribute_name: Awareness attribute name.
"""
if awareness_attribute_name in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'awareness_attribute_name'."
)
return await self.transport.perform_request(
"GET",
_make_path(
"_cluster",
"decommission",
"awareness",
awareness_attribute_name,
"_status",
),
params=params,
headers=headers,
)
@query_params()
async def get_weighted_routing(self, attribute, params=None, headers=None):
"""
Fetches weighted shard routing weights.
:arg attribute: Awareness attribute name.
"""
if attribute in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'attribute'.")
return await self.transport.perform_request(
"GET",
_make_path("_cluster", "routing", "awareness", attribute, "weights"),
params=params,
headers=headers,
)
@query_params()
async def put_decommission_awareness(
self,
awareness_attribute_name,
awareness_attribute_value,
params=None,
headers=None,
):
"""
Decommissions an awareness attribute.
:arg awareness_attribute_name: Awareness attribute name.
:arg awareness_attribute_value: Awareness attribute value.
"""
for param in (awareness_attribute_name, awareness_attribute_value):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path(
"_cluster",
"decommission",
"awareness",
awareness_attribute_name,
awareness_attribute_value,
),
params=params,
headers=headers,
)
@query_params()
async def put_weighted_routing(self, attribute, params=None, headers=None):
"""
Updates weighted shard routing weights.
:arg attribute: Awareness attribute name.
"""
if attribute in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'attribute'.")
return await self.transport.perform_request(
"PUT",
_make_path("_cluster", "routing", "awareness", attribute, "weights"),
params=params,
headers=headers,
)
+120 -10
View File
@@ -24,6 +24,15 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
#
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or the "OpenSearch API specification" available at:
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------
from typing import Any, Collection, MutableMapping, Optional, Tuple, Union from typing import Any, Collection, MutableMapping, Optional, Tuple, Union
from .utils import NamespacedClient from .utils import NamespacedClient
@@ -33,11 +42,12 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
index: Optional[Any] = ..., index: Optional[Any] = ...,
awareness_attribute: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
level: Optional[Any] = ..., level: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ..., wait_for_active_shards: Optional[Any] = ...,
wait_for_events: Optional[Any] = ..., wait_for_events: Optional[Any] = ...,
@@ -61,9 +71,9 @@ class ClusterClient(NamespacedClient):
async def pending_tasks( async def pending_tasks(
self, self,
*, *,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
error_trace: Optional[bool] = ..., error_trace: Optional[bool] = ...,
@@ -83,12 +93,12 @@ class ClusterClient(NamespacedClient):
metric: Optional[Any] = ..., metric: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
flat_settings: Optional[Any] = ..., flat_settings: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
wait_for_metadata_version: Optional[Any] = ..., wait_for_metadata_version: Optional[Any] = ...,
wait_for_timeout: Optional[Any] = ..., wait_for_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
@@ -127,10 +137,10 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
dry_run: Optional[Any] = ..., dry_run: Optional[Any] = ...,
explain: Optional[Any] = ..., explain: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
metric: Optional[Any] = ..., metric: Optional[Any] = ...,
retry_failed: Optional[Any] = ..., retry_failed: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
@@ -150,10 +160,10 @@ class ClusterClient(NamespacedClient):
async def get_settings( async def get_settings(
self, self,
*, *,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ..., flat_settings: Optional[Any] = ...,
include_defaults: Optional[Any] = ..., include_defaults: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -172,9 +182,9 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
body: Any, body: Any,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ..., flat_settings: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -228,8 +238,8 @@ class ClusterClient(NamespacedClient):
self, self,
name: Any, name: Any,
*, *,
master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -248,9 +258,9 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
name: Optional[Any] = ..., name: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
error_trace: Optional[bool] = ..., error_trace: Optional[bool] = ...,
@@ -269,9 +279,9 @@ class ClusterClient(NamespacedClient):
name: Any, name: Any,
*, *,
body: Any, body: Any,
cluster_manager_timeout: Optional[Any] = ...,
create: Optional[Any] = ..., create: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -292,7 +302,6 @@ class ClusterClient(NamespacedClient):
*, *,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
error_trace: Optional[bool] = ..., error_trace: Optional[bool] = ...,
@@ -342,3 +351,104 @@ class ClusterClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ..., params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ..., headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ... ) -> Any: ...
async def delete_decommission_awareness(
self,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def delete_weighted_routing(
self,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def get_decommission_awareness(
self,
awareness_attribute_name: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def get_weighted_routing(
self,
attribute: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def put_decommission_awareness(
self,
awareness_attribute_name: Any,
awareness_attribute_value: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
async def put_weighted_routing(
self,
attribute: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
+259 -108
View File
@@ -25,16 +25,27 @@
# under the License. # under the License.
# ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
#
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or the "OpenSearch API specification" available at:
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class ClusterClient(NamespacedClient): class ClusterClient(NamespacedClient):
@query_params( @query_params(
"awareness_attribute",
"cluster_manager_timeout",
"expand_wildcards", "expand_wildcards",
"level", "level",
"local", "local",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_events", "wait_for_events",
@@ -48,31 +59,35 @@ class ClusterClient(NamespacedClient):
Returns basic information about the health of the cluster. Returns basic information about the health of the cluster.
:arg index: Limit the information returned to a specific index :arg index: Limit the information returned to specific indicies.
:arg awareness_attribute: The awareness attribute for which the
health is required.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: all,
closed, hidden, none, all Default: all open, closed, hidden, none
:arg level: Specify the level of detail for returned information :arg level: Specify the level of detail for returned
Valid choices: cluster, indices, shards Default: cluster information. Valid choices: cluster, indices, shards,
awareness_attributes
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node :arg timeout: Operation timeout.
:arg timeout: Explicit operation timeout
:arg wait_for_active_shards: Wait until the specified number of :arg wait_for_active_shards: Wait until the specified number of
shards is active shards is active.
:arg wait_for_events: Wait until all currently queued events :arg wait_for_events: Wait until all currently queued events
with the given priority are processed Valid choices: immediate, urgent, with the given priority are processed. Valid choices: immediate,
high, normal, low, languid urgent, high, normal, low, languid
:arg wait_for_no_initializing_shards: Whether to wait until :arg wait_for_no_initializing_shards: Whether to wait until
there are no initializing shards in the cluster there are no initializing shards in the cluster.
:arg wait_for_no_relocating_shards: Whether to wait until there :arg wait_for_no_relocating_shards: Whether to wait until there
are no relocating shards in the cluster are no relocating shards in the cluster.
:arg wait_for_nodes: Wait until the specified number of nodes is :arg wait_for_nodes: Wait until the specified number of nodes is
available available.
:arg wait_for_status: Wait until cluster is in a specific state :arg wait_for_status: Wait until cluster is in a specific state.
Valid choices: green, yellow, red Valid choices: green, yellow, red
""" """
return self.transport.perform_request( return self.transport.perform_request(
@@ -82,17 +97,20 @@ class ClusterClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("local", "master_timeout", "cluster_manager_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
def pending_tasks(self, params=None, headers=None): def pending_tasks(self, params=None, headers=None):
""" """
Returns a list of any cluster-level changes (e.g. create index, update mapping, Returns a list of any cluster-level changes (e.g. create index, update mapping,
allocate or fail shard) which have not yet been executed. allocate or fail shard) which have not yet been executed.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg master_timeout (Deprecated: To promote inclusive language,
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager use 'cluster_manager_timeout' instead): Operation timeout for connection
to master node.
""" """
return self.transport.perform_request( return self.transport.perform_request(
"GET", "/_cluster/pending_tasks", params=params, headers=headers "GET", "/_cluster/pending_tasks", params=params, headers=headers
@@ -100,12 +118,12 @@ class ClusterClient(NamespacedClient):
@query_params( @query_params(
"allow_no_indices", "allow_no_indices",
"cluster_manager_timeout",
"expand_wildcards", "expand_wildcards",
"flat_settings", "flat_settings",
"ignore_unavailable", "ignore_unavailable",
"local", "local",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"wait_for_metadata_version", "wait_for_metadata_version",
"wait_for_timeout", "wait_for_timeout",
) )
@@ -115,28 +133,31 @@ class ClusterClient(NamespacedClient):
:arg metric: Limit the information returned to the specified :arg metric: Limit the information returned to the specified
metrics Valid choices: _all, blocks, metadata, nodes, routing_table, metrics. Valid choices: _all, blocks, metadata, nodes, routing_table,
routing_nodes, master_node, version routing_nodes, master_node, cluster_manager_node, version
:arg index: A comma-separated list of index names; use `_all` or :arg index: Comma-separated list of indices; use `_all` or empty
empty string to perform the operation on all indices string to perform the operation on all indices.
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified).
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg expand_wildcards: Whether to expand wildcard expression to :arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open, concrete indices that are open, closed or both. Valid choices: all,
closed, hidden, none, all Default: open open, closed, hidden, none
:arg flat_settings: Return settings in flat format (default: :arg flat_settings: Return settings in flat format. (default:
false) false)
:arg ignore_unavailable: Whether specified concrete indices :arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed) should be ignored when unavailable (missing or closed).
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg master_timeout (Deprecated: To promote inclusive language,
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager use 'cluster_manager_timeout' instead): Operation timeout for connection
to master node.
:arg wait_for_metadata_version: Wait for the metadata version to :arg wait_for_metadata_version: Wait for the metadata version to
be equal or greater than the specified metadata version be equal or greater than the specified metadata version.
:arg wait_for_timeout: The maximum time to wait for :arg wait_for_timeout: The maximum time to wait for
wait_for_metadata_version before timing out wait_for_metadata_version before timing out.
""" """
if index and metric in SKIP_IN_PATH: if index and metric in SKIP_IN_PATH:
metric = "_all" metric = "_all"
@@ -154,13 +175,13 @@ class ClusterClient(NamespacedClient):
Returns high-level overview of cluster statistics. Returns high-level overview of cluster statistics.
:arg node_id: A comma-separated list of node IDs or names to :arg node_id: Comma-separated list of node IDs or names to limit
limit the returned information; use `_local` to return information from the returned information; use `_local` to return information from the
the node you're connecting to, leave empty to get information from all node you're connecting to, leave empty to get information from all
nodes nodes.
:arg flat_settings: Return settings in flat format (default: :arg flat_settings: Return settings in flat format. (default:
false) false)
:arg timeout: Explicit operation timeout :arg timeout: Operation timeout.
""" """
return self.transport.perform_request( return self.transport.perform_request(
"GET", "GET",
@@ -172,10 +193,10 @@ class ClusterClient(NamespacedClient):
) )
@query_params( @query_params(
"cluster_manager_timeout",
"dry_run", "dry_run",
"explain", "explain",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"metric", "metric",
"retry_failed", "retry_failed",
"timeout", "timeout",
@@ -187,30 +208,30 @@ class ClusterClient(NamespacedClient):
:arg body: The definition of `commands` to perform (`move`, :arg body: The definition of `commands` to perform (`move`,
`cancel`, `allocate`) `cancel`, `allocate`)
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg dry_run: Simulate the operation only and return the :arg dry_run: Simulate the operation only and return the
resulting state resulting state.
:arg explain: Return an explanation of why the commands can or :arg explain: Return an explanation of why the commands can or
cannot be executed cannot be executed.
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node
:arg metric: Limit the information returned to the specified :arg metric: Limit the information returned to the specified
metrics. Defaults to all but metadata Valid choices: _all, blocks, metrics. Defaults to all but metadata.
metadata, nodes, routing_table, master_node, version
:arg retry_failed: Retries allocation of shards that are blocked :arg retry_failed: Retries allocation of shards that are blocked
due to too many subsequent allocation failures due to too many subsequent allocation failures.
:arg timeout: Explicit operation timeout :arg timeout: Operation timeout.
""" """
return self.transport.perform_request( return self.transport.perform_request(
"POST", "/_cluster/reroute", params=params, headers=headers, body=body "POST", "/_cluster/reroute", params=params, headers=headers, body=body
) )
@query_params( @query_params(
"cluster_manager_timeout",
"flat_settings", "flat_settings",
"include_defaults", "include_defaults",
"master_timeout", "master_timeout",
"cluster_manager_timeout",
"timeout", "timeout",
) )
def get_settings(self, params=None, headers=None): def get_settings(self, params=None, headers=None):
@@ -218,22 +239,23 @@ class ClusterClient(NamespacedClient):
Returns cluster settings. Returns cluster settings.
:arg flat_settings: Return settings in flat format (default: :arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg flat_settings: Return settings in flat format. (default:
false) false)
:arg include_defaults: Whether to return all default clusters :arg include_defaults: Whether to return all default clusters
setting. setting. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node :arg timeout: Operation timeout.
:arg timeout: Explicit operation timeout
""" """
return self.transport.perform_request( return self.transport.perform_request(
"GET", "/_cluster/settings", params=params, headers=headers "GET", "/_cluster/settings", params=params, headers=headers
) )
@query_params( @query_params(
"flat_settings", "master_timeout", "cluster_manager_timeout", "timeout" "cluster_manager_timeout", "flat_settings", "master_timeout", "timeout"
) )
def put_settings(self, body, params=None, headers=None): def put_settings(self, body, params=None, headers=None):
""" """
@@ -242,13 +264,14 @@ class ClusterClient(NamespacedClient):
:arg body: The settings to be updated. Can be either `transient` :arg body: The settings to be updated. Can be either `transient`
or `persistent` (survives cluster restart). or `persistent` (survives cluster restart).
:arg flat_settings: Return settings in flat format (default: :arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg flat_settings: Return settings in flat format. (default:
false) false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node :arg timeout: Operation timeout.
:arg timeout: Explicit operation timeout
""" """
if body in SKIP_IN_PATH: if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.") raise ValueError("Empty value passed for a required argument 'body'.")
@@ -276,9 +299,9 @@ class ClusterClient(NamespacedClient):
:arg body: The index, shard, and primary flag to explain. Empty :arg body: The index, shard, and primary flag to explain. Empty
means 'explain the first unassigned shard' means 'explain the first unassigned shard'
:arg include_disk_info: Return information about disk usage and :arg include_disk_info: Return information about disk usage and
shard sizes (default: false) shard sizes. (default: false)
:arg include_yes_decisions: Return 'YES' decisions in :arg include_yes_decisions: Return 'YES' decisions in
explanation (default: false) explanation. (default: false)
""" """
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
@@ -288,16 +311,19 @@ class ClusterClient(NamespacedClient):
body=body, body=body,
) )
@query_params("master_timeout", "cluster_manager_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_component_template(self, name, params=None, headers=None): def delete_component_template(self, name, params=None, headers=None):
""" """
Deletes a component template Deletes a component template.
:arg name: The name of the template :arg name: The name of the template.
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg cluster_manager_timeout: Operation timeout for connection
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager to cluster-manager node.
:arg timeout: Explicit operation timeout :arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead): Operation timeout for connection
to master node.
:arg timeout: Operation timeout.
""" """
if name in SKIP_IN_PATH: if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.") raise ValueError("Empty value passed for a required argument 'name'.")
@@ -309,19 +335,20 @@ class ClusterClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("local", "master_timeout", "cluster_manager_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
def get_component_template(self, name=None, params=None, headers=None): def get_component_template(self, name=None, params=None, headers=None):
""" """
Returns one or more component templates Returns one or more component templates.
:arg name: The comma separated names of the component templates :arg name: The Comma-separated names of the component templates.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node
""" """
return self.transport.perform_request( return self.transport.perform_request(
"GET", "GET",
@@ -330,19 +357,22 @@ class ClusterClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("create", "master_timeout", "cluster_manager_timeout", "timeout") @query_params("cluster_manager_timeout", "create", "master_timeout", "timeout")
def put_component_template(self, name, body, params=None, headers=None): def put_component_template(self, name, body, params=None, headers=None):
""" """
Creates or updates a component template Creates or updates a component template.
:arg name: The name of the template :arg name: The name of the template.
:arg body: The template definition :arg body: The template definition
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg create: Whether the index template should only be added if :arg create: Whether the index template should only be added if
new or can also replace an existing one new or can also replace an existing one. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master :arg master_timeout (Deprecated: To promote inclusive language,
:arg cluster_manager_timeout: Specify timeout for connection to cluster_manager use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg timeout: Explicit operation timeout to master node.
:arg timeout: Operation timeout.
""" """
for param in (name, body): for param in (name, body):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
@@ -356,19 +386,18 @@ class ClusterClient(NamespacedClient):
body=body, body=body,
) )
@query_params("local", "master_timeout", "cluster_manager_timeout") @query_params("local", "master_timeout")
def exists_component_template(self, name, params=None, headers=None): def exists_component_template(self, name, params=None, headers=None):
""" """
Returns information about whether a particular component template exist Returns information about whether a particular component template exist.
:arg name: The name of the template :arg name: The name of the template.
:arg local: Return local information, do not retrieve the state :arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false) from cluster-manager node. (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection :arg master_timeout (Deprecated: To promote inclusive language,
to master node use 'cluster_manager_timeout' instead): Operation timeout for connection
:arg cluster_manager_timeout: Explicit operation timeout for connection to master node.
to cluster_manager node
""" """
if name in SKIP_IN_PATH: if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.") raise ValueError("Empty value passed for a required argument 'name'.")
@@ -388,7 +417,7 @@ class ClusterClient(NamespacedClient):
:arg wait_for_removal: Specifies whether to wait for all :arg wait_for_removal: Specifies whether to wait for all
excluded nodes to be removed from the cluster before clearing the voting excluded nodes to be removed from the cluster before clearing the voting
configuration exclusions list. Default: True configuration exclusions list. (default: True)
""" """
return self.transport.perform_request( return self.transport.perform_request(
"DELETE", "DELETE",
@@ -403,14 +432,136 @@ class ClusterClient(NamespacedClient):
Updates the cluster voting config exclusions by node ids or node names. Updates the cluster voting config exclusions by node ids or node names.
:arg node_ids: A comma-separated list of the persistent ids of :arg node_ids: Comma-separated list of the persistent ids of the
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 nodes to exclude from the voting configuration. If specified, you may
not also specify ?node_ids. not also specify ?node_names.
:arg timeout: Explicit operation timeout Default: 30s :arg node_names: 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: Operation timeout.
""" """
return self.transport.perform_request( return self.transport.perform_request(
"POST", "/_cluster/voting_config_exclusions", params=params, headers=headers "POST", "/_cluster/voting_config_exclusions", params=params, headers=headers
) )
@query_params()
def delete_decommission_awareness(self, params=None, headers=None):
"""
Delete any existing decommission.
"""
return self.transport.perform_request(
"DELETE",
"/_cluster/decommission/awareness/",
params=params,
headers=headers,
)
@query_params()
def delete_weighted_routing(self, params=None, headers=None):
"""
Delete weighted shard routing weights.
"""
return self.transport.perform_request(
"DELETE",
"/_cluster/routing/awareness/weights",
params=params,
headers=headers,
)
@query_params()
def get_decommission_awareness(
self, awareness_attribute_name, params=None, headers=None
):
"""
Get details and status of decommissioned attribute.
:arg awareness_attribute_name: Awareness attribute name.
"""
if awareness_attribute_name in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'awareness_attribute_name'."
)
return self.transport.perform_request(
"GET",
_make_path(
"_cluster",
"decommission",
"awareness",
awareness_attribute_name,
"_status",
),
params=params,
headers=headers,
)
@query_params()
def get_weighted_routing(self, attribute, params=None, headers=None):
"""
Fetches weighted shard routing weights.
:arg attribute: Awareness attribute name.
"""
if attribute in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'attribute'.")
return self.transport.perform_request(
"GET",
_make_path("_cluster", "routing", "awareness", attribute, "weights"),
params=params,
headers=headers,
)
@query_params()
def put_decommission_awareness(
self,
awareness_attribute_name,
awareness_attribute_value,
params=None,
headers=None,
):
"""
Decommissions an awareness attribute.
:arg awareness_attribute_name: Awareness attribute name.
:arg awareness_attribute_value: Awareness attribute value.
"""
for param in (awareness_attribute_name, awareness_attribute_value):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"PUT",
_make_path(
"_cluster",
"decommission",
"awareness",
awareness_attribute_name,
awareness_attribute_value,
),
params=params,
headers=headers,
)
@query_params()
def put_weighted_routing(self, attribute, params=None, headers=None):
"""
Updates weighted shard routing weights.
:arg attribute: Awareness attribute name.
"""
if attribute in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'attribute'.")
return self.transport.perform_request(
"PUT",
_make_path("_cluster", "routing", "awareness", attribute, "weights"),
params=params,
headers=headers,
)
+120 -10
View File
@@ -24,6 +24,15 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
#
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or the "OpenSearch API specification" available at:
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------
from typing import Any, Collection, MutableMapping, Optional, Tuple, Union from typing import Any, Collection, MutableMapping, Optional, Tuple, Union
from .utils import NamespacedClient from .utils import NamespacedClient
@@ -33,11 +42,12 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
index: Optional[Any] = ..., index: Optional[Any] = ...,
awareness_attribute: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
level: Optional[Any] = ..., level: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ..., wait_for_active_shards: Optional[Any] = ...,
wait_for_events: Optional[Any] = ..., wait_for_events: Optional[Any] = ...,
@@ -61,9 +71,9 @@ class ClusterClient(NamespacedClient):
def pending_tasks( def pending_tasks(
self, self,
*, *,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
error_trace: Optional[bool] = ..., error_trace: Optional[bool] = ...,
@@ -83,12 +93,12 @@ class ClusterClient(NamespacedClient):
metric: Optional[Any] = ..., metric: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
flat_settings: Optional[Any] = ..., flat_settings: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
wait_for_metadata_version: Optional[Any] = ..., wait_for_metadata_version: Optional[Any] = ...,
wait_for_timeout: Optional[Any] = ..., wait_for_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
@@ -127,10 +137,10 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
dry_run: Optional[Any] = ..., dry_run: Optional[Any] = ...,
explain: Optional[Any] = ..., explain: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
metric: Optional[Any] = ..., metric: Optional[Any] = ...,
retry_failed: Optional[Any] = ..., retry_failed: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
@@ -150,10 +160,10 @@ class ClusterClient(NamespacedClient):
def get_settings( def get_settings(
self, self,
*, *,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ..., flat_settings: Optional[Any] = ...,
include_defaults: Optional[Any] = ..., include_defaults: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -172,9 +182,9 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
body: Any, body: Any,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ..., flat_settings: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -228,8 +238,8 @@ class ClusterClient(NamespacedClient):
self, self,
name: Any, name: Any,
*, *,
master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -248,9 +258,9 @@ class ClusterClient(NamespacedClient):
self, self,
*, *,
name: Optional[Any] = ..., name: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
error_trace: Optional[bool] = ..., error_trace: Optional[bool] = ...,
@@ -269,9 +279,9 @@ class ClusterClient(NamespacedClient):
name: Any, name: Any,
*, *,
body: Any, body: Any,
cluster_manager_timeout: Optional[Any] = ...,
create: Optional[Any] = ..., create: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ..., timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
@@ -292,7 +302,6 @@ class ClusterClient(NamespacedClient):
*, *,
local: Optional[Any] = ..., local: Optional[Any] = ...,
master_timeout: Optional[Any] = ..., master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
pretty: Optional[bool] = ..., pretty: Optional[bool] = ...,
human: Optional[bool] = ..., human: Optional[bool] = ...,
error_trace: Optional[bool] = ..., error_trace: Optional[bool] = ...,
@@ -342,3 +351,104 @@ class ClusterClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ..., params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ..., headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ... ) -> Any: ...
def delete_decommission_awareness(
self,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def delete_weighted_routing(
self,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def get_decommission_awareness(
self,
awareness_attribute_name: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def get_weighted_routing(
self,
attribute: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def put_decommission_awareness(
self,
awareness_attribute_name: Any,
awareness_attribute_value: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
def put_weighted_routing(
self,
attribute: Any,
*,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> Any: ...
+6
View File
@@ -502,6 +502,12 @@ def read_modules():
if p["x-operation-group"] != "nodes.hot_threads" and "type" in params_new: if p["x-operation-group"] != "nodes.hot_threads" and "type" in params_new:
params_new.pop("type") params_new.pop("type")
if (
p["x-operation-group"] == "cluster.health"
and "ensure_node_commissioned" in params_new
):
params_new.pop("ensure_node_commissioned")
if bool(params_new): if bool(params_new):
p.update({"params": params_new}) p.update({"params": params_new})