Skip to content

Commit

Permalink
Integrated generated 'nodes' client APIs into the existing module, en…
Browse files Browse the repository at this point in the history
…suring alignment with the server and maintaining backward compatibility

Signed-off-by: saimedhi <[email protected]>
  • Loading branch information
saimedhi committed Oct 3, 2023
1 parent 2feccc2 commit f9d4652
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 114 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added point-in-time APIs (create_pit, delete_pit, delete_all_pits, get_all_pits) and Security Client APIs (health and update_audit_configuration) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502))
### Changed
- Integrated generated `tasks client` APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility ([#508](https://github.com/opensearch-project/opensearch-py/pull/508))
- Integrated generated `nodes client` APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility ([#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))
### Removed
Expand Down
118 changes: 62 additions & 56 deletions opensearchpy/_async/client/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
# 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 NamespacedClient, _make_path, query_params


Expand All @@ -37,12 +47,12 @@ async def reload_secure_settings(
Reloads secure settings.
:arg body: An object containing the password for the
opensearch keystore
:arg node_id: A comma-separated list of node IDs to span the
:arg body: An object containing the password for the opensearch
keystore
:arg node_id: Comma-separated list of node IDs to span the
reload/reinit call. Should stay empty because reloading usually involves
all cluster nodes.
:arg timeout: Explicit operation timeout
:arg timeout: Operation timeout.
"""
return await self.transport.perform_request(
"POST",
Expand All @@ -58,16 +68,16 @@ async def info(self, node_id=None, metric=None, params=None, headers=None):
Returns information about nodes in the cluster.
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg metric: A comma-separated list of metrics you wish
returned. Leave empty to return all. Valid choices: settings, os,
process, jvm, thread_pool, transport, http, plugins, ingest
: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 metric: Comma-separated list of metrics you wish returned.
Leave empty to return all. Valid choices: settings, os, process, jvm,
thread_pool, transport, http, plugins, ingest
: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", _make_path("_nodes", node_id, metric), params=params, headers=headers
Expand All @@ -79,7 +89,6 @@ async def info(self, node_id=None, metric=None, params=None, headers=None):
"fields",
"groups",
"include_segment_file_sizes",
"include_unloaded_segments",
"level",
"timeout",
"types",
Expand All @@ -91,37 +100,34 @@ async def stats(
Returns statistical information about nodes in the cluster.
: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 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 metric: Limit the information returned to the specified
metrics Valid choices: _all, breaker, fs, http, indices, jvm, os,
metrics. Valid choices: _all, breaker, fs, http, indices, jvm, os,
process, thread_pool, transport, discovery, indexing_pressure
:arg index_metric: Limit the information returned for `indices`
metric to the specific index metrics. Isn't used if `indices` (or `all`)
metric isn't specified. Valid choices: _all, completion, docs,
fielddata, query_cache, flush, get, indexing, merge, request_cache,
refresh, search, segments, store, warmer, suggest
:arg completion_fields: A comma-separated list of fields for
`fielddata` and `suggest` index metric (supports wildcards)
:arg fielddata_fields: A comma-separated list of fields for
`fielddata` index metric (supports wildcards)
:arg fields: A comma-separated list of fields for `fielddata`
and `completion` index metric (supports wildcards)
:arg groups: A comma-separated list of search groups for
`search` index metric
metric isn't specified. Valid choices: _all, store, indexing, get,
search, merge, flush, refresh, query_cache, fielddata, docs, warmer,
completion, segments, translog, suggest, request_cache, recovery
:arg completion_fields: Comma-separated list of fields for
`fielddata` and `suggest` index metric (supports wildcards).
:arg fielddata_fields: Comma-separated list of fields for
`fielddata` index metric (supports wildcards).
:arg fields: Comma-separated list of fields for `fielddata` and
`completion` index metric (supports wildcards).
:arg groups: Comma-separated list of search groups for `search`
index metric.
:arg include_segment_file_sizes: Whether to report the
aggregated disk usage of each one of the Lucene index files (only
applies if segment stats are requested)
:arg include_unloaded_segments: If set to true segment stats
will include stats for segments that are not currently loaded into
memory
applies if segment stats are requested). (default: false)
:arg level: Return indices stats aggregated at index, node or
shard level Valid choices: indices, node, shards Default: node
:arg timeout: Explicit operation timeout
:arg types: A comma-separated list of document types for the
`indexing` index metric
shard level. Valid choices: indices, node, shards
:arg timeout: Operation timeout.
:arg types: Comma-separated list of document types for the
`indexing` index metric.
"""
return await self.transport.perform_request(
"GET",
Expand All @@ -138,21 +144,21 @@ async def hot_threads(self, node_id=None, params=None, headers=None):
Returns information about hot threads on each node in the cluster.
: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 doc_type: The type to sample (default: cpu) Valid choices:
cpu, wait, block
: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 doc_type: The type to sample. Valid choices: cpu, wait,
block
:arg ignore_idle_threads: Don't show threads that are in known-
idle places, such as waiting on a socket select or pulling from an empty
task queue (default: true)
:arg interval: The interval for the second sampling of threads
:arg snapshots: Number of samples of thread stacktrace (default:
10)
task queue. (default: True)
:arg interval: The interval for the second sampling of threads.
:arg snapshots: Number of samples of thread stacktrace.
(default: 10)
:arg threads: Specify the number of threads to provide
information for (default: 3)
:arg timeout: Explicit operation timeout
information for. (default: 3)
:arg timeout: Operation timeout.
"""
# type is a reserved word so it cannot be used, use doc_type instead
if "doc_type" in params:
Expand All @@ -171,13 +177,13 @@ async def usage(self, node_id=None, metric=None, params=None, headers=None):
Returns low-level information about REST actions usage on nodes.
: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 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 metric: Limit the information returned to the specified
metrics Valid choices: _all, rest_actions
:arg timeout: Explicit operation timeout
metrics. Valid choices: _all, rest_actions
:arg timeout: Operation timeout.
"""
return await self.transport.perform_request(
"GET",
Expand Down
10 changes: 9 additions & 1 deletion opensearchpy/_async/client/nodes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -79,7 +88,6 @@ class NodesClient(NamespacedClient):
fields: Optional[Any] = ...,
groups: Optional[Any] = ...,
include_segment_file_sizes: Optional[Any] = ...,
include_unloaded_segments: Optional[Any] = ...,
level: Optional[Any] = ...,
timeout: Optional[Any] = ...,
types: Optional[Any] = ...,
Expand Down
Loading

0 comments on commit f9d4652

Please sign in to comment.