diff --git a/CHANGELOG.md b/CHANGELOG.md index 61b6e968..3e8efd61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 `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 `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)) ### Deprecated - Deprecated point-in-time APIs (list_all_point_in_time, create_point_in_time, delete_point_in_time) and Security Client APIs (health_check and update_audit_config) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502)) diff --git a/opensearchpy/_async/client/cluster.py b/opensearchpy/_async/client/cluster.py index 174245cb..b64bdc5b 100644 --- a/opensearchpy/_async/client/cluster.py +++ b/opensearchpy/_async/client/cluster.py @@ -25,16 +25,27 @@ # 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 class ClusterClient(NamespacedClient): @query_params( + "awareness_attribute", + "cluster_manager_timeout", "expand_wildcards", "level", "local", "master_timeout", - "cluster_manager_timeout", "timeout", "wait_for_active_shards", "wait_for_events", @@ -48,31 +59,35 @@ async def health(self, index=None, params=None, headers=None): 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: all - :arg level: Specify the level of detail for returned information - Valid choices: cluster, indices, shards Default: cluster + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg level: Specify the level of detail for returned + information. Valid choices: cluster, indices, shards, + awareness_attributes :arg local: Return local information, do not retrieve the state - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node - :arg timeout: Explicit operation timeout + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. :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 - with the given priority are processed Valid choices: immediate, urgent, - high, normal, low, languid + with the given priority are processed. Valid choices: immediate, + urgent, high, normal, low, languid :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 - 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 - available - :arg wait_for_status: Wait until cluster is in a specific state + available. + :arg wait_for_status: Wait until cluster is in a specific state. Valid choices: green, yellow, red """ return await self.transport.perform_request( @@ -82,17 +97,20 @@ async def health(self, index=None, params=None, headers=None): 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): """ Returns a list of any cluster-level changes (e.g. create index, update mapping, 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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ return await self.transport.perform_request( "GET", "/_cluster/pending_tasks", params=params, headers=headers @@ -100,12 +118,12 @@ async def pending_tasks(self, params=None, headers=None): @query_params( "allow_no_indices", + "cluster_manager_timeout", "expand_wildcards", "flat_settings", "ignore_unavailable", "local", "master_timeout", - "cluster_manager_timeout", "wait_for_metadata_version", "wait_for_timeout", ) @@ -115,28 +133,31 @@ async def state(self, metric=None, index=None, params=None, headers=None): :arg metric: Limit the information returned to the specified - metrics Valid choices: _all, blocks, metadata, nodes, routing_table, - routing_nodes, master_node, version - :arg index: A comma-separated list of index names; use `_all` or - empty string to perform the operation on all indices + metrics. Valid choices: _all, blocks, metadata, nodes, routing_table, + routing_nodes, master_node, cluster_manager_node, version + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified) + 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg flat_settings: Return settings in flat format (default: + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg flat_settings: Return settings in flat format. (default: false) :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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. :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 - wait_for_metadata_version before timing out + wait_for_metadata_version before timing out. """ if index and metric in SKIP_IN_PATH: metric = "_all" @@ -154,13 +175,13 @@ async def stats(self, node_id=None, params=None, headers=None): Returns high-level overview of cluster statistics. - :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 flat_settings: Return settings in flat format (default: + :arg node_id: 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 flat_settings: Return settings in flat format. (default: false) - :arg timeout: Explicit operation timeout + :arg timeout: Operation timeout. """ return await self.transport.perform_request( "GET", @@ -172,10 +193,10 @@ async def stats(self, node_id=None, params=None, headers=None): ) @query_params( + "cluster_manager_timeout", "dry_run", "explain", "master_timeout", - "cluster_manager_timeout", "metric", "retry_failed", "timeout", @@ -187,30 +208,30 @@ async def reroute(self, body=None, params=None, headers=None): :arg body: The definition of `commands` to perform (`move`, `cancel`, `allocate`) + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :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 - cannot be executed - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node + cannot be executed. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. :arg metric: Limit the information returned to the specified - metrics. Defaults to all but metadata Valid choices: _all, blocks, - metadata, nodes, routing_table, master_node, version + metrics. Defaults to all but metadata. :arg retry_failed: Retries allocation of shards that are blocked - due to too many subsequent allocation failures - :arg timeout: Explicit operation timeout + due to too many subsequent allocation failures. + :arg timeout: Operation timeout. """ return await self.transport.perform_request( "POST", "/_cluster/reroute", params=params, headers=headers, body=body ) @query_params( + "cluster_manager_timeout", "flat_settings", "include_defaults", "master_timeout", - "cluster_manager_timeout", "timeout", ) async def get_settings(self, params=None, headers=None): @@ -218,22 +239,23 @@ async def get_settings(self, params=None, headers=None): 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) :arg include_defaults: Whether to return all default clusters - setting. - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node - :arg timeout: Explicit operation timeout + setting. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ return await self.transport.perform_request( "GET", "/_cluster/settings", params=params, headers=headers ) @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): """ @@ -242,13 +264,14 @@ async def put_settings(self, body, params=None, headers=None): :arg body: The settings to be updated. Can be either `transient` 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) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - 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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -276,9 +299,9 @@ async def allocation_explain(self, body=None, params=None, headers=None): :arg body: The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' :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 - explanation (default: false) + explanation. (default: false) """ return await self.transport.perform_request( "POST", @@ -288,16 +311,19 @@ async def allocation_explain(self, body=None, params=None, headers=None): 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): """ - Deletes a component template + Deletes a component 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: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + :arg name: The name of the template. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :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: raise ValueError("Empty value passed for a required argument 'name'.") @@ -309,19 +335,20 @@ async def delete_component_template(self, name, params=None, headers=None): 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): """ - 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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ return await self.transport.perform_request( "GET", @@ -330,19 +357,22 @@ async def get_component_template(self, name=None, params=None, headers=None): 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): """ - 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 cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :arg create: Whether the index template should only be added if - new or can also replace an existing one - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + new or can also replace an existing one. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ for param in (name, body): if param in SKIP_IN_PATH: @@ -356,19 +386,18 @@ async def put_component_template(self, name, body, params=None, headers=None): 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): """ - 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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'name'.") @@ -388,7 +417,7 @@ async def delete_voting_config_exclusions(self, params=None, headers=None): :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 + configuration exclusions list. (default: True) """ return await self.transport.perform_request( "DELETE", @@ -403,14 +432,136 @@ async def post_voting_config_exclusions(self, params=None, headers=None): Updates the cluster voting config exclusions by node ids or node names. - :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 + :arg node_ids: Comma-separated list of the persistent ids 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 + not also specify ?node_names. + :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( "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, + ) diff --git a/opensearchpy/_async/client/cluster.pyi b/opensearchpy/_async/client/cluster.pyi index f2cd948c..2685cbb5 100644 --- a/opensearchpy/_async/client/cluster.pyi +++ b/opensearchpy/_async/client/cluster.pyi @@ -24,6 +24,15 @@ # specific language governing permissions and limitations # 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 .utils import NamespacedClient @@ -33,11 +42,12 @@ class ClusterClient(NamespacedClient): self, *, index: Optional[Any] = ..., + awareness_attribute: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., level: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., wait_for_active_shards: Optional[Any] = ..., wait_for_events: Optional[Any] = ..., @@ -61,9 +71,9 @@ class ClusterClient(NamespacedClient): async def pending_tasks( self, *, + cluster_manager_timeout: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -83,12 +93,12 @@ class ClusterClient(NamespacedClient): metric: Optional[Any] = ..., index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., flat_settings: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., wait_for_metadata_version: Optional[Any] = ..., wait_for_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., @@ -127,10 +137,10 @@ class ClusterClient(NamespacedClient): self, *, body: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., dry_run: Optional[Any] = ..., explain: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., metric: Optional[Any] = ..., retry_failed: Optional[Any] = ..., timeout: Optional[Any] = ..., @@ -150,10 +160,10 @@ class ClusterClient(NamespacedClient): async def get_settings( self, *, + cluster_manager_timeout: Optional[Any] = ..., flat_settings: Optional[Any] = ..., include_defaults: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -172,9 +182,9 @@ class ClusterClient(NamespacedClient): self, *, body: Any, + cluster_manager_timeout: Optional[Any] = ..., flat_settings: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -228,8 +238,8 @@ class ClusterClient(NamespacedClient): self, name: Any, *, - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -248,9 +258,9 @@ class ClusterClient(NamespacedClient): self, *, name: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -269,9 +279,9 @@ class ClusterClient(NamespacedClient): name: Any, *, body: Any, + cluster_manager_timeout: Optional[Any] = ..., create: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -292,7 +302,6 @@ class ClusterClient(NamespacedClient): *, local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -342,3 +351,104 @@ class ClusterClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> 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: ... diff --git a/opensearchpy/client/cluster.py b/opensearchpy/client/cluster.py index fd749cbc..28f1f0e8 100644 --- a/opensearchpy/client/cluster.py +++ b/opensearchpy/client/cluster.py @@ -25,16 +25,27 @@ # 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 class ClusterClient(NamespacedClient): @query_params( + "awareness_attribute", + "cluster_manager_timeout", "expand_wildcards", "level", "local", "master_timeout", - "cluster_manager_timeout", "timeout", "wait_for_active_shards", "wait_for_events", @@ -48,31 +59,35 @@ def health(self, index=None, params=None, headers=None): 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: all - :arg level: Specify the level of detail for returned information - Valid choices: cluster, indices, shards Default: cluster + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg level: Specify the level of detail for returned + information. Valid choices: cluster, indices, shards, + awareness_attributes :arg local: Return local information, do not retrieve the state - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node - :arg timeout: Explicit operation timeout + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. :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 - with the given priority are processed Valid choices: immediate, urgent, - high, normal, low, languid + with the given priority are processed. Valid choices: immediate, + urgent, high, normal, low, languid :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 - 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 - available - :arg wait_for_status: Wait until cluster is in a specific state + available. + :arg wait_for_status: Wait until cluster is in a specific state. Valid choices: green, yellow, red """ return self.transport.perform_request( @@ -82,17 +97,20 @@ def health(self, index=None, params=None, headers=None): 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): """ Returns a list of any cluster-level changes (e.g. create index, update mapping, 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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ return self.transport.perform_request( "GET", "/_cluster/pending_tasks", params=params, headers=headers @@ -100,12 +118,12 @@ def pending_tasks(self, params=None, headers=None): @query_params( "allow_no_indices", + "cluster_manager_timeout", "expand_wildcards", "flat_settings", "ignore_unavailable", "local", "master_timeout", - "cluster_manager_timeout", "wait_for_metadata_version", "wait_for_timeout", ) @@ -115,28 +133,31 @@ def state(self, metric=None, index=None, params=None, headers=None): :arg metric: Limit the information returned to the specified - metrics Valid choices: _all, blocks, metadata, nodes, routing_table, - routing_nodes, master_node, version - :arg index: A comma-separated list of index names; use `_all` or - empty string to perform the operation on all indices + metrics. Valid choices: _all, blocks, metadata, nodes, routing_table, + routing_nodes, master_node, cluster_manager_node, version + :arg index: Comma-separated list of indices; use `_all` or empty + string to perform the operation on all indices. :arg allow_no_indices: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` - string or when no indices have been specified) + 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 - concrete indices that are open, closed or both. Valid choices: open, - closed, hidden, none, all Default: open - :arg flat_settings: Return settings in flat format (default: + concrete indices that are open, closed or both. Valid choices: all, + open, closed, hidden, none + :arg flat_settings: Return settings in flat format. (default: false) :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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. :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 - wait_for_metadata_version before timing out + wait_for_metadata_version before timing out. """ if index and metric in SKIP_IN_PATH: metric = "_all" @@ -154,13 +175,13 @@ def stats(self, node_id=None, params=None, headers=None): Returns high-level overview of cluster statistics. - :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 flat_settings: Return settings in flat format (default: + :arg node_id: 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 flat_settings: Return settings in flat format. (default: false) - :arg timeout: Explicit operation timeout + :arg timeout: Operation timeout. """ return self.transport.perform_request( "GET", @@ -172,10 +193,10 @@ def stats(self, node_id=None, params=None, headers=None): ) @query_params( + "cluster_manager_timeout", "dry_run", "explain", "master_timeout", - "cluster_manager_timeout", "metric", "retry_failed", "timeout", @@ -187,30 +208,30 @@ def reroute(self, body=None, params=None, headers=None): :arg body: The definition of `commands` to perform (`move`, `cancel`, `allocate`) + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :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 - cannot be executed - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node + cannot be executed. + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. :arg metric: Limit the information returned to the specified - metrics. Defaults to all but metadata Valid choices: _all, blocks, - metadata, nodes, routing_table, master_node, version + metrics. Defaults to all but metadata. :arg retry_failed: Retries allocation of shards that are blocked - due to too many subsequent allocation failures - :arg timeout: Explicit operation timeout + due to too many subsequent allocation failures. + :arg timeout: Operation timeout. """ return self.transport.perform_request( "POST", "/_cluster/reroute", params=params, headers=headers, body=body ) @query_params( + "cluster_manager_timeout", "flat_settings", "include_defaults", "master_timeout", - "cluster_manager_timeout", "timeout", ) def get_settings(self, params=None, headers=None): @@ -218,22 +239,23 @@ def get_settings(self, params=None, headers=None): 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) :arg include_defaults: Whether to return all default clusters - setting. - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node - :arg timeout: Explicit operation timeout + setting. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ return self.transport.perform_request( "GET", "/_cluster/settings", params=params, headers=headers ) @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): """ @@ -242,13 +264,14 @@ def put_settings(self, body, params=None, headers=None): :arg body: The settings to be updated. Can be either `transient` 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) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - 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 body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") @@ -276,9 +299,9 @@ def allocation_explain(self, body=None, params=None, headers=None): :arg body: The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' :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 - explanation (default: false) + explanation. (default: false) """ return self.transport.perform_request( "POST", @@ -288,16 +311,19 @@ def allocation_explain(self, body=None, params=None, headers=None): 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): """ - Deletes a component template + Deletes a component 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: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + :arg name: The name of the template. + :arg cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. + :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: raise ValueError("Empty value passed for a required argument 'name'.") @@ -309,19 +335,20 @@ def delete_component_template(self, name, params=None, headers=None): 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): """ - 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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ return self.transport.perform_request( "GET", @@ -330,19 +357,22 @@ def get_component_template(self, name=None, params=None, headers=None): 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): """ - 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 cluster_manager_timeout: Operation timeout for connection + to cluster-manager node. :arg create: Whether the index template should only be added if - new or can also replace an existing one - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout + new or can also replace an existing one. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. + :arg timeout: Operation timeout. """ for param in (name, body): if param in SKIP_IN_PATH: @@ -356,19 +386,18 @@ def put_component_template(self, name, body, params=None, headers=None): 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): """ - 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 - from cluster_manager node (default: false) - :arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection - to master node - :arg cluster_manager_timeout: Explicit operation timeout for connection - to cluster_manager node + from cluster-manager node. (default: false) + :arg master_timeout (Deprecated: To promote inclusive language, + use 'cluster_manager_timeout' instead): Operation timeout for connection + to master node. """ if name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'name'.") @@ -388,7 +417,7 @@ def delete_voting_config_exclusions(self, params=None, headers=None): :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 + configuration exclusions list. (default: True) """ return self.transport.perform_request( "DELETE", @@ -403,14 +432,136 @@ def post_voting_config_exclusions(self, params=None, headers=None): Updates the cluster voting config exclusions by node ids or node names. - :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 + :arg node_ids: Comma-separated list of the persistent ids 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 + not also specify ?node_names. + :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( "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, + ) diff --git a/opensearchpy/client/cluster.pyi b/opensearchpy/client/cluster.pyi index 49b27c54..ccc3737a 100644 --- a/opensearchpy/client/cluster.pyi +++ b/opensearchpy/client/cluster.pyi @@ -24,6 +24,15 @@ # specific language governing permissions and limitations # 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 .utils import NamespacedClient @@ -33,11 +42,12 @@ class ClusterClient(NamespacedClient): self, *, index: Optional[Any] = ..., + awareness_attribute: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., level: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., wait_for_active_shards: Optional[Any] = ..., wait_for_events: Optional[Any] = ..., @@ -61,9 +71,9 @@ class ClusterClient(NamespacedClient): def pending_tasks( self, *, + cluster_manager_timeout: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -83,12 +93,12 @@ class ClusterClient(NamespacedClient): metric: Optional[Any] = ..., index: Optional[Any] = ..., allow_no_indices: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., expand_wildcards: Optional[Any] = ..., flat_settings: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., wait_for_metadata_version: Optional[Any] = ..., wait_for_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., @@ -127,10 +137,10 @@ class ClusterClient(NamespacedClient): self, *, body: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., dry_run: Optional[Any] = ..., explain: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., metric: Optional[Any] = ..., retry_failed: Optional[Any] = ..., timeout: Optional[Any] = ..., @@ -150,10 +160,10 @@ class ClusterClient(NamespacedClient): def get_settings( self, *, + cluster_manager_timeout: Optional[Any] = ..., flat_settings: Optional[Any] = ..., include_defaults: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -172,9 +182,9 @@ class ClusterClient(NamespacedClient): self, *, body: Any, + cluster_manager_timeout: Optional[Any] = ..., flat_settings: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -228,8 +238,8 @@ class ClusterClient(NamespacedClient): self, name: Any, *, - master_timeout: Optional[Any] = ..., cluster_manager_timeout: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -248,9 +258,9 @@ class ClusterClient(NamespacedClient): self, *, name: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -269,9 +279,9 @@ class ClusterClient(NamespacedClient): name: Any, *, body: Any, + cluster_manager_timeout: Optional[Any] = ..., create: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., @@ -292,7 +302,6 @@ class ClusterClient(NamespacedClient): *, local: Optional[Any] = ..., master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., pretty: Optional[bool] = ..., human: Optional[bool] = ..., error_trace: Optional[bool] = ..., @@ -342,3 +351,104 @@ class ClusterClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> 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: ... diff --git a/utils/generate-api.py b/utils/generate-api.py index 2cb93eb5..fffd0e82 100644 --- a/utils/generate-api.py +++ b/utils/generate-api.py @@ -502,6 +502,12 @@ def read_modules(): if p["x-operation-group"] != "nodes.hot_threads" and "type" in params_new: 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): p.update({"params": params_new})