Merge .pyi type stubs inline (#563)

* Merged types into .py code.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: nox -rs generate.

Signed-off-by: dblock <dblock@amazon.com>

* Updated CHANGELOG.

Signed-off-by: dblock <dblock@amazon.com>

* Use lowest common python version for lint.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: don't typeshed.

Signed-off-by: dblock <dblock@amazon.com>

* Removed unneeded comment.

Signed-off-by: dblock <dblock@amazon.com>

* Simplify OPENSEARCH_URL.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: positional ignore_status used as chunk_size.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: parse version string.

Signed-off-by: dblock <dblock@amazon.com>

* Remove future annotations for Python 3.6.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: types in documentation.

Signed-off-by: dblock <dblock@amazon.com>

* Improve CHANGELOG text.

Signed-off-by: dblock <dblock@amazon.com>

* Re-added missing separator.

Signed-off-by: dblock <dblock@amazon.com>

* Remove duplicate licenses.

Signed-off-by: dblock <dblock@amazon.com>

* Get rid of Optional[Any].

Signed-off-by: dblock <dblock@amazon.com>

* Fix docs with AsyncOpenSearch.

Signed-off-by: dblock <dblock@amazon.com>

* Fix: undo comment.

Signed-off-by: dblock <dblock@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
This commit is contained in:
Daniel (dB.) Doubrovkine
2023-11-06 13:08:19 -05:00
committed by GitHub
parent 0d8a23dd78
commit dcb79cc322
268 changed files with 6218 additions and 16378 deletions
+1
View File
@@ -23,6 +23,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- 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))
- Use API generator for all APIs ([#551](https://github.com/opensearch-project/opensearch-py/pull/551)) - Use API generator for all APIs ([#551](https://github.com/opensearch-project/opensearch-py/pull/551))
- Merge `.pyi` type stubs inline ([#563](https://github.com/opensearch-project/opensearch-py/pull/563))
### Deprecated ### 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)) - 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 ### Removed
+3 -1
View File
@@ -66,9 +66,11 @@ If you want to auto-start one, the following will start a new instance and run t
If your OpenSearch docker instance is running, you can execute the test suite directly. If your OpenSearch docker instance is running, you can execute the test suite directly.
``` ```
$ nox -rs test $ nox -rs test-3.9
``` ```
Substitute `3.9` with your Python version above, or use `nox -rs test` to run with multiple.
To run tests against different versions of OpenSearch, use `run-tests [with/without security] [version]`: To run tests against different versions of OpenSearch, use `run-tests [with/without security] [version]`:
``` ```
+1 -1
View File
@@ -5,7 +5,7 @@ include LICENSE
include MANIFEST.in include MANIFEST.in
include README.md include README.md
include setup.py include setup.py
recursive-include opensearch* py.typed *.pyi recursive-include opensearch* py.typed
prune test_opensearch prune test_opensearch
recursive-exclude * __pycache__ recursive-exclude * __pycache__
+8 -8
View File
@@ -22,7 +22,7 @@ index_name = "test-index-async"
item_count = 100 item_count = 100
async def index_records(client, item_count): async def index_records(client, item_count) -> None:
await asyncio.gather( await asyncio.gather(
*[ *[
client.index( client.index(
@@ -71,34 +71,34 @@ async def test_async(client_count=1, item_count=1):
await asyncio.gather(*[client.close() for client in clients]) await asyncio.gather(*[client.close() for client in clients])
def test(item_count=1, client_count=1): def test(item_count: int = 1, client_count: int = 1) -> None:
loop = asyncio.new_event_loop() loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
loop.run_until_complete(test_async(item_count, client_count)) loop.run_until_complete(test_async(item_count, client_count))
loop.close() loop.close()
def test_1(): def test_1() -> None:
test(1, 32 * item_count) test(1, 32 * item_count)
def test_2(): def test_2() -> None:
test(2, 16 * item_count) test(2, 16 * item_count)
def test_4(): def test_4() -> None:
test(4, 8 * item_count) test(4, 8 * item_count)
def test_8(): def test_8() -> None:
test(8, 4 * item_count) test(8, 4 * item_count)
def test_16(): def test_16() -> None:
test(16, 2 * item_count) test(16, 2 * item_count)
def test_32(): def test_32() -> None:
test(32, item_count) test(32, item_count)
+5 -5
View File
@@ -75,23 +75,23 @@ def test(thread_count=1, request_count=1, client_count=1):
print(f"latency={latency}") print(f"latency={latency}")
def test_1(): def test_1() -> None:
test(1, 32 * request_count, 1) test(1, 32 * request_count, 1)
def test_2(): def test_2() -> None:
test(2, 16 * request_count, 2) test(2, 16 * request_count, 2)
def test_4(): def test_4() -> None:
test(4, 8 * request_count, 3) test(4, 8 * request_count, 3)
def test_8(): def test_8() -> None:
test(8, 4 * request_count, 8) test(8, 4 * request_count, 8)
def test_32(): def test_32() -> None:
test(32, request_count, 32) test(32, request_count, 32)
+5 -5
View File
@@ -112,23 +112,23 @@ def test(thread_count=1, item_count=1, client_count=1):
print(f"{count}, latency={latency}") print(f"{count}, latency={latency}")
def test_1(): def test_1() -> None:
test(1, 32 * item_count, 1) test(1, 32 * item_count, 1)
def test_2(): def test_2() -> None:
test(2, 16 * item_count, 2) test(2, 16 * item_count, 2)
def test_4(): def test_4() -> None:
test(4, 8 * item_count, 3) test(4, 8 * item_count, 3)
def test_8(): def test_8() -> None:
test(8, 4 * item_count, 8) test(8, 4 * item_count, 8)
def test_32(): def test_32() -> None:
test(32, item_count, 32) test(32, item_count, 32)
+16 -7
View File
@@ -41,7 +41,7 @@ SOURCE_FILES = (
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]) @nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"])
def test(session): def test(session) -> None:
session.install(".") session.install(".")
session.install("-r", "dev-requirements.txt") session.install("-r", "dev-requirements.txt")
@@ -49,7 +49,7 @@ def test(session):
@nox.session() @nox.session()
def format(session): def format(session) -> None:
session.install("black", "isort") session.install("black", "isort")
session.run("isort", "--profile=black", *SOURCE_FILES) session.run("isort", "--profile=black", *SOURCE_FILES)
@@ -59,9 +59,18 @@ def format(session):
lint(session) lint(session)
@nox.session() @nox.session(python=["3.7"])
def lint(session): def lint(session) -> None:
session.install("flake8", "black", "mypy", "isort", "types-requests", "types-six") session.install(
"flake8",
"black",
"mypy",
"isort",
"types-requests",
"types-six",
"types-simplejson",
"types-python-dateutil",
)
session.run("isort", "--check", "--profile=black", *SOURCE_FILES) session.run("isort", "--check", "--profile=black", *SOURCE_FILES)
session.run("black", "--target-version=py33", "--check", *SOURCE_FILES) session.run("black", "--target-version=py33", "--check", *SOURCE_FILES)
@@ -85,7 +94,7 @@ def lint(session):
@nox.session() @nox.session()
def docs(session): def docs(session) -> None:
session.install(".") session.install(".")
session.install( session.install(
"-rdev-requirements.txt", "sphinx-rtd-theme", "sphinx-autodoc-typehints" "-rdev-requirements.txt", "sphinx-rtd-theme", "sphinx-autodoc-typehints"
@@ -94,7 +103,7 @@ def docs(session):
@nox.session() @nox.session()
def generate(session): def generate(session) -> None:
session.install("-rdev-requirements.txt") session.install("-rdev-requirements.txt")
session.run("python", "utils/generate-api.py") session.run("python", "utils/generate-api.py")
format(session) format(session)
+6 -10
View File
@@ -31,21 +31,25 @@ from __future__ import absolute_import
import logging import logging
import re import re
import sys
import warnings import warnings
from ._version import __versionstr__ from ._version import __versionstr__
_major, _minor, _patch = [ _major, _minor, _patch = [
int(x) for x in re.search(r"^(\d+)\.(\d+)\.(\d+)", __versionstr__).groups() int(x) for x in re.search(r"^(\d+)\.(\d+)\.(\d+)", __versionstr__).groups() # type: ignore
] ]
VERSION = __version__ = (_major, _minor, _patch) VERSION = __version__ = (_major, _minor, _patch)
logger = logging.getLogger("opensearch") logger = logging.getLogger("opensearch")
logger.addHandler(logging.NullHandler()) logger.addHandler(logging.NullHandler())
from ._async.client import AsyncOpenSearch
from ._async.http_aiohttp import AIOHttpConnection, AsyncConnection
from ._async.transport import AsyncTransport
from .client import OpenSearch from .client import OpenSearch
from .connection import ( from .connection import (
AsyncHttpConnection,
Connection, Connection,
RequestsHttpConnection, RequestsHttpConnection,
Urllib3HttpConnection, Urllib3HttpConnection,
@@ -247,14 +251,6 @@ __all__ = [
"normalizer", "normalizer",
"token_filter", "token_filter",
"tokenizer", "tokenizer",
]
from ._async.client import AsyncOpenSearch
from ._async.http_aiohttp import AIOHttpConnection, AsyncConnection
from ._async.transport import AsyncTransport
from .connection import AsyncHttpConnection
__all__ += [
"AIOHttpConnection", "AIOHttpConnection",
"AsyncConnection", "AsyncConnection",
"AsyncTransport", "AsyncTransport",
-132
View File
@@ -1,132 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import sys
from typing import Tuple
from ._async.client import AsyncOpenSearch as AsyncOpenSearch
from ._async.http_aiohttp import AIOHttpConnection as AIOHttpConnection
from ._async.http_aiohttp import AsyncConnection as AsyncConnection
from ._async.transport import AsyncTransport as AsyncTransport
from .client import OpenSearch as OpenSearch
from .connection import AsyncHttpConnection as AsyncHttpConnection
from .connection import Connection as Connection
from .connection import RequestsHttpConnection as RequestsHttpConnection
from .connection import Urllib3HttpConnection as Urllib3HttpConnection
from .connection import connections as connections
from .connection_pool import ConnectionPool as ConnectionPool
from .connection_pool import ConnectionSelector as ConnectionSelector
from .connection_pool import RoundRobinSelector as RoundRobinSelector
from .exceptions import AuthenticationException as AuthenticationException
from .exceptions import AuthorizationException as AuthorizationException
from .exceptions import ConflictError as ConflictError
from .exceptions import ConnectionError as ConnectionError
from .exceptions import ConnectionTimeout as ConnectionTimeout
from .exceptions import IllegalOperation as IllegalOperation
from .exceptions import ImproperlyConfigured as ImproperlyConfigured
from .exceptions import NotFoundError as NotFoundError
from .exceptions import OpenSearchDeprecationWarning as OpenSearchDeprecationWarning
from .exceptions import OpenSearchDslException as OpenSearchDslException
from .exceptions import OpenSearchException as OpenSearchException
from .exceptions import OpenSearchWarning as OpenSearchWarning
from .exceptions import RequestError as RequestError
from .exceptions import SerializationError as SerializationError
from .exceptions import SSLError as SSLError
from .exceptions import TransportError as TransportError
from .exceptions import UnknownDslObject as UnknownDslObject
from .exceptions import ValidationException as ValidationException
from .helpers import AWSV4SignerAsyncAuth as AWSV4SignerAsyncAuth
from .helpers import AWSV4SignerAuth as AWSV4SignerAuth
from .helpers.aggs import A as A
from .helpers.analysis import Analyzer, CharFilter, Normalizer, TokenFilter, Tokenizer
from .helpers.document import Document as Document
from .helpers.document import InnerDoc as InnerDoc
from .helpers.document import MetaField as MetaField
from .helpers.faceted_search import DateHistogramFacet as DateHistogramFacet
from .helpers.faceted_search import Facet as Facet
from .helpers.faceted_search import FacetedResponse as FacetedResponse
from .helpers.faceted_search import FacetedSearch as FacetedSearch
from .helpers.faceted_search import HistogramFacet as HistogramFacet
from .helpers.faceted_search import NestedFacet as NestedFacet
from .helpers.faceted_search import RangeFacet as RangeFacet
from .helpers.faceted_search import TermsFacet as TermsFacet
from .helpers.field import Binary as Binary
from .helpers.field import Boolean as Boolean
from .helpers.field import Byte as Byte
from .helpers.field import Completion as Completion
from .helpers.field import CustomField as CustomField
from .helpers.field import Date as Date
from .helpers.field import DateRange as DateRange
from .helpers.field import DenseVector as DenseVector
from .helpers.field import Double as Double
from .helpers.field import DoubleRange as DoubleRange
from .helpers.field import Field as Field
from .helpers.field import Float as Float
from .helpers.field import FloatRange as FloatRange
from .helpers.field import GeoPoint as GeoPoint
from .helpers.field import GeoShape as GeoShape
from .helpers.field import HalfFloat as HalfFloat
from .helpers.field import Integer as Integer
from .helpers.field import IntegerRange as IntegerRange
from .helpers.field import Ip as Ip
from .helpers.field import IpRange as IpRange
from .helpers.field import Join as Join
from .helpers.field import Keyword as Keyword
from .helpers.field import Long as Long
from .helpers.field import LongRange as LongRange
from .helpers.field import Murmur3 as Murmur3
from .helpers.field import Nested as Nested
from .helpers.field import Object as Object
from .helpers.field import Percolator as Percolator
from .helpers.field import RangeField as RangeField
from .helpers.field import RankFeature as RankFeature
from .helpers.field import RankFeatures as RankFeatures
from .helpers.field import ScaledFloat as ScaledFloat
from .helpers.field import SearchAsYouType as SearchAsYouType
from .helpers.field import Short as Short
from .helpers.field import SparseVector as SparseVector
from .helpers.field import Text as Text
from .helpers.field import TokenCount as TokenCount
from .helpers.field import construct_field as construct_field
from .helpers.function import SF as SF
from .helpers.index import Index as Index
from .helpers.index import IndexTemplate as IndexTemplate
from .helpers.mapping import Mapping as Mapping
from .helpers.query import Q as Q
from .helpers.search import MultiSearch as MultiSearch
from .helpers.search import Search as Search
from .helpers.update_by_query import UpdateByQuery as UpdateByQuery
from .helpers.utils import AttrDict as AttrDict
from .helpers.utils import AttrList as AttrList
from .helpers.utils import DslBase as DslBase
from .helpers.wrappers import Range as Range
from .serializer import JSONSerializer as JSONSerializer
from .transport import Transport as Transport
VERSION: Tuple[int, int, int]
__version__: Tuple[int, int, int]
__versionstr__: str
+295 -53
View File
@@ -39,9 +39,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import logging import logging
from typing import Any, Type
from ..transport import AsyncTransport, TransportError from ..transport import AsyncTransport, TransportError
from .cat import CatClient from .cat import CatClient
from .client import Client
from .cluster import ClusterClient from .cluster import ClusterClient
from .dangling_indices import DanglingIndicesClient from .dangling_indices import DanglingIndicesClient
from .features import FeaturesClient from .features import FeaturesClient
@@ -54,12 +56,12 @@ from .remote_store import RemoteStoreClient
from .security import SecurityClient from .security import SecurityClient
from .snapshot import SnapshotClient from .snapshot import SnapshotClient
from .tasks import TasksClient from .tasks import TasksClient
from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params from .utils import SKIP_IN_PATH, _bulk_body, _make_path, query_params
logger = logging.getLogger("opensearch") logger = logging.getLogger("opensearch")
class AsyncOpenSearch(object): class AsyncOpenSearch(Client):
""" """
OpenSearch client. Provides a straightforward mapping from OpenSearch client. Provides a straightforward mapping from
Python to OpenSearch REST endpoints. Python to OpenSearch REST endpoints.
@@ -184,13 +186,19 @@ class AsyncOpenSearch(object):
""" """
from ._patch import ( # include PIT functions inside _patch.py
from ._patch import ( # type: ignore
create_point_in_time, create_point_in_time,
delete_point_in_time, delete_point_in_time,
list_all_point_in_time, list_all_point_in_time,
) )
def __init__(self, hosts=None, transport_class=AsyncTransport, **kwargs): def __init__(
self,
hosts: Any = None,
transport_class: Type[AsyncTransport] = AsyncTransport,
**kwargs: Any
) -> None:
""" """
:arg hosts: list of nodes, or a single node, we should connect to. :arg hosts: list of nodes, or a single node, we should connect to.
Node should be a dictionary ({"host": "localhost", "port": 9200}), Node should be a dictionary ({"host": "localhost", "port": 9200}),
@@ -205,7 +213,7 @@ class AsyncOpenSearch(object):
:class:`~opensearchpy.Transport` class and, subsequently, to the :class:`~opensearchpy.Transport` class and, subsequently, to the
:class:`~opensearchpy.Connection` instances. :class:`~opensearchpy.Connection` instances.
""" """
self.transport = transport_class(_normalize_hosts(hosts), **kwargs) super().__init__(hosts, transport_class, **kwargs)
# namespaced clients for compatibility with API names # namespaced clients for compatibility with API names
self.cat = CatClient(self) self.cat = CatClient(self)
@@ -224,10 +232,10 @@ class AsyncOpenSearch(object):
self.plugins = PluginsClient(self) self.plugins = PluginsClient(self)
def __repr__(self): def __repr__(self) -> Any:
try: try:
# get a list of all connections # get a list of all connections
cons = self.transport.hosts cons: Any = self.transport.hosts
# truncate to 5 if there are too many # truncate to 5 if there are too many
if len(cons) > 5: if len(cons) > 5:
cons = cons[:5] + ["..."] cons = cons[:5] + ["..."]
@@ -236,21 +244,25 @@ class AsyncOpenSearch(object):
# probably operating on custom transport and connection_pool, ignore # probably operating on custom transport and connection_pool, ignore
return super(AsyncOpenSearch, self).__repr__() return super(AsyncOpenSearch, self).__repr__()
async def __aenter__(self): async def __aenter__(self) -> Any:
if hasattr(self.transport, "_async_call"): if hasattr(self.transport, "_async_call"):
await self.transport._async_call() await self.transport._async_call()
return self return self
async def __aexit__(self, *_): async def __aexit__(self, *_: Any) -> None:
await self.close() await self.close()
async def close(self): async def close(self) -> None:
"""Closes the Transport and all internal connections""" """Closes the Transport and all internal connections"""
await self.transport.close() await self.transport.close()
# AUTO-GENERATED-API-DEFINITIONS # # AUTO-GENERATED-API-DEFINITIONS #
@query_params() @query_params()
async def ping(self, params=None, headers=None): async def ping(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns whether the cluster is running. Returns whether the cluster is running.
@@ -263,7 +275,11 @@ class AsyncOpenSearch(object):
return False return False
@query_params() @query_params()
async def info(self, params=None, headers=None): async def info(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns basic information about the cluster. Returns basic information about the cluster.
@@ -281,7 +297,14 @@ class AsyncOpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def create(self, index, id, body, params=None, headers=None): async def create(
self,
index: Any,
id: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates a new document in the index. Returns a 409 response when a document Creates a new document in the index. Returns a 409 response when a document
with a same ID already exists in the index. with a same ID already exists in the index.
@@ -330,7 +353,14 @@ class AsyncOpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def index(self, index, body, id=None, params=None, headers=None): async def index(
self,
index: Any,
body: Any,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a document in an index. Creates or updates a document in an index.
@@ -387,7 +417,13 @@ class AsyncOpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def bulk(self, body, index=None, params=None, headers=None): async def bulk(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to perform multiple index/update/delete operations in a single request. Allows to perform multiple index/update/delete operations in a single request.
@@ -431,7 +467,13 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def clear_scroll(self, body=None, scroll_id=None, params=None, headers=None): async def clear_scroll(
self,
body: Any = None,
scroll_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Explicitly clears the search context for a scroll. Explicitly clears the search context for a scroll.
@@ -467,7 +509,13 @@ class AsyncOpenSearch(object):
"routing", "routing",
"terminate_after", "terminate_after",
) )
async def count(self, body=None, index=None, params=None, headers=None): async def count(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns number of documents matching a query. Returns number of documents matching a query.
@@ -523,7 +571,13 @@ class AsyncOpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def delete(self, index, id, params=None, headers=None): async def delete(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Removes a document from the index. Removes a document from the index.
@@ -592,7 +646,13 @@ class AsyncOpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
async def delete_by_query(self, index, body, params=None, headers=None): async def delete_by_query(
self,
index: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes documents matching the provided query. Deletes documents matching the provided query.
@@ -685,7 +745,12 @@ class AsyncOpenSearch(object):
) )
@query_params("requests_per_second") @query_params("requests_per_second")
async def delete_by_query_rethrottle(self, task_id, params=None, headers=None): async def delete_by_query_rethrottle(
self,
task_id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the number of requests per second for a particular Delete By Query Changes the number of requests per second for a particular Delete By Query
operation. operation.
@@ -706,7 +771,12 @@ class AsyncOpenSearch(object):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def delete_script(self, id, params=None, headers=None): async def delete_script(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a script. Deletes a script.
@@ -738,7 +808,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def exists(self, index, id, params=None, headers=None): async def exists(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a document exists in an index. Returns information about whether a document exists in an index.
@@ -783,7 +859,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def exists_source(self, index, id, params=None, headers=None): async def exists_source(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a document source exists in an index. Returns information about whether a document source exists in an index.
@@ -831,7 +913,14 @@ class AsyncOpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
async def explain(self, index, id, body=None, params=None, headers=None): async def explain(
self,
index: Any,
id: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about why a specific matches (or doesn't match) a query. Returns information about why a specific matches (or doesn't match) a query.
@@ -878,7 +967,13 @@ class AsyncOpenSearch(object):
"ignore_unavailable", "ignore_unavailable",
"include_unmapped", "include_unmapped",
) )
async def field_caps(self, body=None, index=None, params=None, headers=None): async def field_caps(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the information about the capabilities of fields among multiple Returns the information about the capabilities of fields among multiple
indices. indices.
@@ -919,7 +1014,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def get(self, index, id, params=None, headers=None): async def get(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a document. Returns a document.
@@ -954,7 +1055,12 @@ class AsyncOpenSearch(object):
) )
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
async def get_script(self, id, params=None, headers=None): async def get_script(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a script. Returns a script.
@@ -984,7 +1090,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def get_source(self, index, id, params=None, headers=None): async def get_source(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the source of a document. Returns the source of a document.
@@ -1028,7 +1140,13 @@ class AsyncOpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
async def mget(self, body, index=None, params=None, headers=None): async def mget(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to get multiple documents in one request. Allows to get multiple documents in one request.
@@ -1073,7 +1191,13 @@ class AsyncOpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
async def msearch(self, body, index=None, params=None, headers=None): async def msearch(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to execute several search operations in one request. Allows to execute several search operations in one request.
@@ -1125,7 +1249,13 @@ class AsyncOpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
async def msearch_template(self, body, index=None, params=None, headers=None): async def msearch_template(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to execute several search template operations in one request. Allows to execute several search template operations in one request.
@@ -1173,7 +1303,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def mtermvectors(self, body=None, index=None, params=None, headers=None): async def mtermvectors(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns multiple termvectors in one request. Returns multiple termvectors in one request.
@@ -1221,7 +1357,14 @@ class AsyncOpenSearch(object):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def put_script(self, id, body, context=None, params=None, headers=None): async def put_script(
self,
id: Any,
body: Any,
context: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a script. Creates or updates a script.
@@ -1251,7 +1394,13 @@ class AsyncOpenSearch(object):
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "search_type" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "search_type"
) )
async def rank_eval(self, body, index=None, params=None, headers=None): async def rank_eval(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to evaluate the quality of ranked search results over a set of typical Allows to evaluate the quality of ranked search results over a set of typical
search queries. search queries.
@@ -1293,7 +1442,12 @@ class AsyncOpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
async def reindex(self, body, params=None, headers=None): async def reindex(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to copy documents from one index to another, optionally filtering the Allows to copy documents from one index to another, optionally filtering the
source documents by a query, changing the destination index settings, or source documents by a query, changing the destination index settings, or
@@ -1330,7 +1484,12 @@ class AsyncOpenSearch(object):
) )
@query_params("requests_per_second") @query_params("requests_per_second")
async def reindex_rethrottle(self, task_id, params=None, headers=None): async def reindex_rethrottle(
self,
task_id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the number of requests per second for a particular Reindex operation. Changes the number of requests per second for a particular Reindex operation.
@@ -1351,8 +1510,12 @@ class AsyncOpenSearch(object):
@query_params() @query_params()
async def render_search_template( async def render_search_template(
self, body=None, id=None, params=None, headers=None self,
): body: Any = None,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to use the Mustache language to pre-render a search definition. Allows to use the Mustache language to pre-render a search definition.
@@ -1369,7 +1532,12 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def scripts_painless_execute(self, body=None, params=None, headers=None): async def scripts_painless_execute(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows an arbitrary script to be executed and a result to be returned. Allows an arbitrary script to be executed and a result to be returned.
@@ -1385,7 +1553,13 @@ class AsyncOpenSearch(object):
) )
@query_params("rest_total_hits_as_int", "scroll") @query_params("rest_total_hits_as_int", "scroll")
async def scroll(self, body=None, scroll_id=None, params=None, headers=None): async def scroll(
self,
body: Any = None,
scroll_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to retrieve a large numbers of results from a single search request. Allows to retrieve a large numbers of results from a single search request.
@@ -1454,7 +1628,13 @@ class AsyncOpenSearch(object):
"typed_keys", "typed_keys",
"version", "version",
) )
async def search(self, body=None, index=None, params=None, headers=None): async def search(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns results matching a query. Returns results matching a query.
@@ -1574,7 +1754,12 @@ class AsyncOpenSearch(object):
"preference", "preference",
"routing", "routing",
) )
async def search_shards(self, index=None, params=None, headers=None): async def search_shards(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the indices and shards that a search request would be Returns information about the indices and shards that a search request would be
executed against. executed against.
@@ -1615,7 +1800,13 @@ class AsyncOpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
async def search_template(self, body, index=None, params=None, headers=None): async def search_template(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to use the Mustache language to pre-render a search definition. Allows to use the Mustache language to pre-render a search definition.
@@ -1677,7 +1868,14 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def termvectors(self, index, body=None, id=None, params=None, headers=None): async def termvectors(
self,
index: Any,
body: Any = None,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information and statistics about terms in the fields of a particular Returns information and statistics about terms in the fields of a particular
document. document.
@@ -1732,7 +1930,14 @@ class AsyncOpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def update(self, index, id, body, params=None, headers=None): async def update(
self,
index: Any,
id: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates a document with a script or partial document. Updates a document with a script or partial document.
@@ -1814,7 +2019,13 @@ class AsyncOpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
async def update_by_query(self, index, body=None, params=None, headers=None): async def update_by_query(
self,
index: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs an update on every document in the index without changing the source, Performs an update on every document in the index without changing the source,
for example to pick up a mapping change. for example to pick up a mapping change.
@@ -1908,7 +2119,12 @@ class AsyncOpenSearch(object):
) )
@query_params("requests_per_second") @query_params("requests_per_second")
async def update_by_query_rethrottle(self, task_id, params=None, headers=None): async def update_by_query_rethrottle(
self,
task_id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the number of requests per second for a particular Update By Query Changes the number of requests per second for a particular Update By Query
operation. operation.
@@ -1929,7 +2145,11 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def get_script_context(self, params=None, headers=None): async def get_script_context(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns all script contexts. Returns all script contexts.
@@ -1939,7 +2159,11 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def get_script_languages(self, params=None, headers=None): async def get_script_languages(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns available script types, languages and contexts. Returns available script types, languages and contexts.
@@ -1955,7 +2179,12 @@ class AsyncOpenSearch(object):
"preference", "preference",
"routing", "routing",
) )
async def create_pit(self, index, params=None, headers=None): async def create_pit(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates point in time context. Creates point in time context.
@@ -1983,7 +2212,11 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def delete_all_pits(self, params=None, headers=None): async def delete_all_pits(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes all active point in time searches. Deletes all active point in time searches.
@@ -1993,7 +2226,12 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def delete_pit(self, body=None, params=None, headers=None): async def delete_pit(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes one or more point in time searches based on the IDs passed. Deletes one or more point in time searches based on the IDs passed.
@@ -2009,7 +2247,11 @@ class AsyncOpenSearch(object):
) )
@query_params() @query_params()
async def get_all_pits(self, params=None, headers=None): async def get_all_pits(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Lists all active point in time searches. Lists all active point in time searches.
File diff suppressed because it is too large Load Diff
+18 -5
View File
@@ -9,12 +9,15 @@
# GitHub history for details. # GitHub history for details.
import warnings import warnings
from typing import Any
from .utils import SKIP_IN_PATH, query_params from .utils import SKIP_IN_PATH, query_params
@query_params() @query_params()
async def list_all_point_in_time(self, params=None, headers=None): async def list_all_point_in_time(
self: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Returns the list of active point in times searches Returns the list of active point in times searches
@@ -35,7 +38,9 @@ async def list_all_point_in_time(self, params=None, headers=None):
@query_params( @query_params(
"expand_wildcards", "ignore_unavailable", "keep_alive", "preference", "routing" "expand_wildcards", "ignore_unavailable", "keep_alive", "preference", "routing"
) )
async def create_point_in_time(self, index, params=None, headers=None): async def create_point_in_time(
self: Any, index: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Create a point in time that can be used in subsequent searches Create a point in time that can be used in subsequent searches
@@ -68,7 +73,13 @@ async def create_point_in_time(self, index, params=None, headers=None):
@query_params() @query_params()
async def delete_point_in_time(self, body=None, all=False, params=None, headers=None): async def delete_point_in_time(
self: Any,
body: Any = None,
all: bool = False,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete a point in time Delete a point in time
@@ -94,7 +105,7 @@ async def delete_point_in_time(self, body=None, all=False, params=None, headers=
@query_params() @query_params()
async def health_check(self, params=None, headers=None): async def health_check(self: Any, params: Any = None, headers: Any = None) -> Any:
""" """
Checks to see if the Security plugin is up and running. Checks to see if the Security plugin is up and running.
@@ -113,7 +124,9 @@ async def health_check(self, params=None, headers=None):
@query_params() @query_params()
async def update_audit_config(self, body, params=None, headers=None): async def update_audit_config(
self: Any, body: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
A PUT call updates the audit configuration. A PUT call updates the audit configuration.
-71
View File
@@ -1,71 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any, Collection, MutableMapping, Optional, Tuple, Type, Union
async def list_all_point_in_time(
*,
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 create_point_in_time(
*,
index: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
keep_alive: Optional[Any] = ...,
preference: Optional[Any] = ...,
routing: Optional[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 delete_point_in_time(
*,
body: Optional[Any] = ...,
all: Optional[bool] = ...,
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 health_check(
params: Union[Any, None] = ..., headers: Union[Any, None] = ...
) -> Union[bool, Any]: ...
async def update_audit_config(
body: Any, params: Union[Any, None] = ..., headers: Union[Any, None] = ...
) -> Union[bool, Any]: ...
+397 -286
View File
@@ -36,12 +36,19 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import NamespacedClient, _make_path, query_params from .utils import NamespacedClient, _make_path, query_params
class CatClient(NamespacedClient): class CatClient(NamespacedClient):
@query_params("expand_wildcards", "format", "h", "help", "local", "s", "v") @query_params("expand_wildcards", "format", "h", "help", "local", "s", "v")
async def aliases(self, name=None, params=None, headers=None): async def aliases(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Shows information about currently configured aliases to indices including Shows information about currently configured aliases to indices including
filter and routing infos. filter and routing infos.
@@ -65,6 +72,20 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "aliases", name), params=params, headers=headers "GET", _make_path("_cat", "aliases", name), params=params, headers=headers
) )
@query_params()
async def all_pit_segments(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Lists all active point-in-time segments.
"""
return await self.transport.perform_request(
"GET", "/_cat/pit_segments/_all", params=params, headers=headers
)
@query_params( @query_params(
"bytes", "bytes",
"cluster_manager_timeout", "cluster_manager_timeout",
@@ -76,7 +97,12 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
async def allocation(self, node_id=None, params=None, headers=None): async def allocation(
self,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides a snapshot of how many shards are allocated to each data node and how Provides a snapshot of how many shards are allocated to each data node and how
much disk space they are using. much disk space they are using.
@@ -108,8 +134,51 @@ class CatClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
async def cluster_manager(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about the cluster-manager node.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/cluster_manager", params=params, headers=headers
)
@query_params("format", "h", "help", "s", "v") @query_params("format", "h", "help", "s", "v")
async def count(self, index=None, params=None, headers=None): async def count(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides quick access to the document count of the entire cluster, or Provides quick access to the document count of the entire cluster, or
individual indices. individual indices.
@@ -129,8 +198,43 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "count", index), params=params, headers=headers "GET", _make_path("_cat", "count", index), params=params, headers=headers
) )
@query_params("bytes", "format", "h", "help", "s", "v")
async def fielddata(
self,
fields: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Shows how much heap memory is currently being used by fielddata on every data
node in the cluster.
:arg fields: Comma-separated list of fields to return in the
output.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET",
_make_path("_cat", "fielddata", fields),
params=params,
headers=headers,
)
@query_params("format", "h", "help", "s", "time", "ts", "v") @query_params("format", "h", "help", "s", "time", "ts", "v")
async def health(self, params=None, headers=None): async def health(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a concise representation of the cluster health. Returns a concise representation of the cluster health.
@@ -151,7 +255,11 @@ class CatClient(NamespacedClient):
) )
@query_params("help", "s") @query_params("help", "s")
async def help(self, params=None, headers=None): async def help(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns help for the Cat APIs. Returns help for the Cat APIs.
@@ -180,7 +288,12 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
async def indices(self, index=None, params=None, headers=None): async def indices(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about indices: number of primaries and replicas, document Returns information about indices: number of primaries and replicas, document
counts, disk size, ... counts, disk size, ...
@@ -232,7 +345,11 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
async def master(self, params=None, headers=None): async def master(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the cluster-manager node. Returns information about the cluster-manager node.
@@ -271,9 +388,13 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
async def cluster_manager(self, params=None, headers=None): async def nodeattrs(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the cluster-manager node. Returns information about custom node attributes.
:arg cluster_manager_timeout: Operation timeout for connection :arg cluster_manager_timeout: Operation timeout for connection
@@ -292,7 +413,7 @@ class CatClient(NamespacedClient):
:arg v: Verbose mode. Display column headers. Default is false. :arg v: Verbose mode. Display column headers. Default is false.
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "/_cat/cluster_manager", params=params, headers=headers "GET", "/_cat/nodeattrs", params=params, headers=headers
) )
@query_params( @query_params(
@@ -308,7 +429,11 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
async def nodes(self, params=None, headers=None): async def nodes(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns basic statistics about performance of cluster nodes. Returns basic statistics about performance of cluster nodes.
@@ -339,10 +464,110 @@ class CatClient(NamespacedClient):
"GET", "/_cat/nodes", params=params, headers=headers "GET", "/_cat/nodes", params=params, headers=headers
) )
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"time",
"v",
)
async def pending_tasks(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns a concise representation of the cluster pending tasks.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/pending_tasks", params=params, headers=headers
)
@query_params()
async def pit_segments(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
List segments for one or several PITs.
"""
return await self.transport.perform_request(
"GET", "/_cat/pit_segments", params=params, headers=headers, body=body
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
async def plugins(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about installed plugins across nodes node.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/plugins", params=params, headers=headers
)
@query_params( @query_params(
"active_only", "bytes", "detailed", "format", "h", "help", "s", "time", "v" "active_only", "bytes", "detailed", "format", "h", "help", "s", "time", "v"
) )
async def recovery(self, index=None, params=None, headers=None): async def recovery(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about index shard recoveries, both on-going completed. Returns information about index shard recoveries, both on-going completed.
@@ -369,6 +594,137 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "recovery", index), params=params, headers=headers "GET", _make_path("_cat", "recovery", index), params=params, headers=headers
) )
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
async def repositories(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about snapshot repositories registered in the cluster.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/repositories", params=params, headers=headers
)
@query_params(
"active_only",
"bytes",
"completed_only",
"detailed",
"format",
"h",
"help",
"s",
"shards",
"time",
"v",
)
async def segment_replication(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about both on-going and latest completed Segment
Replication events.
:arg index: Comma-separated list or wildcard expression of index
names to limit the returned information.
:arg active_only: If `true`, the response only includes ongoing
segment replication events. Default is false.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg completed_only: If `true`, the response only includes
latest completed segment replication events. Default is false.
:arg detailed: If `true`, the response includes detailed
information about segment replications. Default is false.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg shards: Comma-separated list of shards to display.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET",
_make_path("_cat", "segment_replication", index),
params=params,
headers=headers,
)
@query_params(
"bytes",
"cluster_manager_timeout",
"format",
"h",
"help",
"master_timeout",
"s",
"v",
)
async def segments(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Provides low-level information about the segments in the shards of an index.
:arg index: Comma-separated list of indices to limit the
returned information.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", _make_path("_cat", "segments", index), params=params, headers=headers
)
@query_params( @query_params(
"bytes", "bytes",
"cluster_manager_timeout", "cluster_manager_timeout",
@@ -381,7 +737,12 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
async def shards(self, index=None, params=None, headers=None): async def shards(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides a detailed view of shard allocation on nodes. Provides a detailed view of shard allocation on nodes.
@@ -411,79 +772,6 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "shards", index), params=params, headers=headers "GET", _make_path("_cat", "shards", index), params=params, headers=headers
) )
@query_params(
"bytes",
"cluster_manager_timeout",
"format",
"h",
"help",
"master_timeout",
"s",
"v",
)
async def segments(self, index=None, params=None, headers=None):
"""
Provides low-level information about the segments in the shards of an index.
:arg index: Comma-separated list of indices to limit the
returned information.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", _make_path("_cat", "segments", index), params=params, headers=headers
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"time",
"v",
)
async def pending_tasks(self, params=None, headers=None):
"""
Returns a concise representation of the cluster pending tasks.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/pending_tasks", params=params, headers=headers
)
@query_params( @query_params(
"cluster_manager_timeout", "cluster_manager_timeout",
"format", "format",
@@ -495,7 +783,12 @@ class CatClient(NamespacedClient):
"size", "size",
"v", "v",
) )
async def thread_pool(self, thread_pool_patterns=None, params=None, headers=None): async def thread_pool(
self,
thread_pool_patterns: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns cluster-wide thread pool statistics per node. By default the active, Returns cluster-wide thread pool statistics per node. By default the active,
queue and rejected statistics are returned for all thread pools. queue and rejected statistics are returned for all thread pools.
@@ -526,134 +819,6 @@ class CatClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("bytes", "format", "h", "help", "s", "v")
async def fielddata(self, fields=None, params=None, headers=None):
"""
Shows how much heap memory is currently being used by fielddata on every data
node in the cluster.
:arg fields: Comma-separated list of fields to return in the
output.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET",
_make_path("_cat", "fielddata", fields),
params=params,
headers=headers,
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
async def plugins(self, params=None, headers=None):
"""
Returns information about installed plugins across nodes node.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/plugins", params=params, headers=headers
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
async def nodeattrs(self, params=None, headers=None):
"""
Returns information about custom node attributes.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/nodeattrs", params=params, headers=headers
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
async def repositories(self, params=None, headers=None):
"""
Returns information about snapshot repositories registered in the cluster.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET", "/_cat/repositories", params=params, headers=headers
)
@query_params( @query_params(
"cluster_manager_timeout", "cluster_manager_timeout",
"format", "format",
@@ -665,7 +830,12 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
async def snapshots(self, repository=None, params=None, headers=None): async def snapshots(
self,
repository: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns all snapshots in a specific repository. Returns all snapshots in a specific repository.
@@ -708,7 +878,11 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
async def tasks(self, params=None, headers=None): async def tasks(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the tasks currently executing on one or more nodes in Returns information about the tasks currently executing on one or more nodes in
the cluster. the cluster.
@@ -748,7 +922,12 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
async def templates(self, name=None, params=None, headers=None): async def templates(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about existing templates. Returns information about existing templates.
@@ -772,71 +951,3 @@ class CatClient(NamespacedClient):
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", _make_path("_cat", "templates", name), params=params, headers=headers "GET", _make_path("_cat", "templates", name), params=params, headers=headers
) )
@query_params()
async def all_pit_segments(self, params=None, headers=None):
"""
Lists all active point-in-time segments.
"""
return await self.transport.perform_request(
"GET", "/_cat/pit_segments/_all", params=params, headers=headers
)
@query_params()
async def pit_segments(self, body=None, params=None, headers=None):
"""
List segments for one or several PITs.
"""
return await self.transport.perform_request(
"GET", "/_cat/pit_segments", params=params, headers=headers, body=body
)
@query_params(
"active_only",
"bytes",
"completed_only",
"detailed",
"format",
"h",
"help",
"s",
"shards",
"time",
"v",
)
async def segment_replication(self, index=None, params=None, headers=None):
"""
Returns information about both on-going and latest completed Segment
Replication events.
:arg index: Comma-separated list or wildcard expression of index
names to limit the returned information.
:arg active_only: If `true`, the response only includes ongoing
segment replication events. Default is false.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg completed_only: If `true`, the response only includes
latest completed segment replication events. Default is false.
:arg detailed: If `true`, the response includes detailed
information about segment replications. Default is false.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg shards: Comma-separated list of shards to display.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return await self.transport.perform_request(
"GET",
_make_path("_cat", "segment_replication", index),
params=params,
headers=headers,
)
-601
View File
@@ -1,601 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class CatClient(NamespacedClient):
async def aliases(
self,
*,
name: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 allocation(
self,
*,
node_id: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 count(
self,
*,
index: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 health(
self,
*,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
ts: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 help(
self,
*,
help: Optional[Any] = ...,
s: Optional[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 indices(
self,
*,
index: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
health: Optional[Any] = ...,
help: Optional[Any] = ...,
include_unloaded_segments: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pri: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 master(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 cluster_manager(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 nodes(
self,
*,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
full_id: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 recovery(
self,
*,
index: Optional[Any] = ...,
active_only: Optional[Any] = ...,
bytes: Optional[Any] = ...,
detailed: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 shards(
self,
*,
index: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 segments(
self,
*,
index: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 pending_tasks(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 thread_pool(
self,
*,
thread_pool_patterns: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
size: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 fielddata(
self,
*,
fields: Optional[Any] = ...,
bytes: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 plugins(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 nodeattrs(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 repositories(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 snapshots(
self,
*,
repository: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 tasks(
self,
*,
actions: Optional[Any] = ...,
detailed: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
nodes: Optional[Any] = ...,
parent_task_id: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 templates(
self,
*,
name: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 all_pit_segments(
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 pit_segments(
self,
*,
body: Optional[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 segment_replication(
self,
*,
index: Optional[Any] = ...,
active_only: Optional[Any] = ...,
bytes: Optional[Any] = ...,
completed_only: Optional[Any] = ...,
detailed: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
shards: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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: ...
+42
View File
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any, Optional, Type
from opensearchpy.client.utils import _normalize_hosts
from opensearchpy.transport import Transport
class Client(object):
"""
A generic async OpenSearch client.
"""
def __init__(
self,
hosts: Optional[str] = None,
transport_class: Type[Transport] = Transport,
**kwargs: Any
) -> None:
"""
:arg hosts: list of nodes, or a single node, we should connect to.
Node should be a dictionary ({"host": "localhost", "port": 9200}),
the entire dictionary will be passed to the :class:`~opensearchpy.Connection`
class as kwargs, or a string in the format of ``host[:port]`` which will be
translated to a dictionary automatically. If no value is given the
:class:`~opensearchpy.Connection` class defaults will be used.
:arg transport_class: :class:`~opensearchpy.Transport` subclass to use.
:arg kwargs: any additional arguments will be passed on to the
:class:`~opensearchpy.Transport` class and, subsequently, to the
:class:`~opensearchpy.Connection` instances.
"""
self.transport = transport_class(_normalize_hosts(hosts), **kwargs)
+121 -26
View File
@@ -36,6 +36,8 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
@@ -55,7 +57,12 @@ class ClusterClient(NamespacedClient):
"wait_for_nodes", "wait_for_nodes",
"wait_for_status", "wait_for_status",
) )
async def health(self, index=None, params=None, headers=None): async def health(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns basic information about the health of the cluster. Returns basic information about the health of the cluster.
@@ -99,7 +106,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
async def pending_tasks(self, params=None, headers=None): async def pending_tasks(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
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.
@@ -128,7 +139,13 @@ class ClusterClient(NamespacedClient):
"wait_for_metadata_version", "wait_for_metadata_version",
"wait_for_timeout", "wait_for_timeout",
) )
async def state(self, metric=None, index=None, params=None, headers=None): async def state(
self,
metric: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a comprehensive information about the state of the cluster. Returns a comprehensive information about the state of the cluster.
@@ -171,7 +188,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("flat_settings", "timeout") @query_params("flat_settings", "timeout")
async def stats(self, node_id=None, params=None, headers=None): async def stats(
self,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns high-level overview of cluster statistics. Returns high-level overview of cluster statistics.
@@ -202,7 +224,12 @@ class ClusterClient(NamespacedClient):
"retry_failed", "retry_failed",
"timeout", "timeout",
) )
async def reroute(self, body=None, params=None, headers=None): async def reroute(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to manually change the allocation of individual shards in the cluster. Allows to manually change the allocation of individual shards in the cluster.
@@ -235,7 +262,11 @@ class ClusterClient(NamespacedClient):
"master_timeout", "master_timeout",
"timeout", "timeout",
) )
async def get_settings(self, params=None, headers=None): async def get_settings(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns cluster settings. Returns cluster settings.
@@ -258,7 +289,12 @@ class ClusterClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "flat_settings", "master_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: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the cluster settings. Updates the cluster settings.
@@ -282,7 +318,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
async def remote_info(self, params=None, headers=None): async def remote_info(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the information about configured remote clusters. Returns the information about configured remote clusters.
@@ -292,7 +332,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("include_disk_info", "include_yes_decisions") @query_params("include_disk_info", "include_yes_decisions")
async def allocation_explain(self, body=None, params=None, headers=None): async def allocation_explain(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides explanations for shard allocations in the cluster. Provides explanations for shard allocations in the cluster.
@@ -313,7 +358,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_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: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a component template. Deletes a component template.
@@ -337,7 +387,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_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: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns one or more component templates. Returns one or more component templates.
@@ -359,7 +414,13 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "create", "master_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: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a component template. Creates or updates a component template.
@@ -388,7 +449,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
async def exists_component_template(self, name, params=None, headers=None): async def exists_component_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular component template exist. Returns information about whether a particular component template exist.
@@ -413,7 +479,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params("wait_for_removal") @query_params("wait_for_removal")
async def delete_voting_config_exclusions(self, params=None, headers=None): async def delete_voting_config_exclusions(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clears cluster voting config exclusions. Clears cluster voting config exclusions.
@@ -430,7 +500,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params("node_ids", "node_names", "timeout") @query_params("node_ids", "node_names", "timeout")
async def post_voting_config_exclusions(self, params=None, headers=None): async def post_voting_config_exclusions(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the cluster voting config exclusions by node ids or node names. Updates the cluster voting config exclusions by node ids or node names.
@@ -448,7 +522,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_decommission_awareness(self, params=None, headers=None): async def delete_decommission_awareness(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete any existing decommission. Delete any existing decommission.
@@ -461,7 +539,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_weighted_routing(self, params=None, headers=None): async def delete_weighted_routing(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete weighted shard routing weights. Delete weighted shard routing weights.
@@ -475,8 +557,11 @@ class ClusterClient(NamespacedClient):
@query_params() @query_params()
async def get_decommission_awareness( async def get_decommission_awareness(
self, awareness_attribute_name, params=None, headers=None self,
): awareness_attribute_name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Get details and status of decommissioned attribute. Get details and status of decommissioned attribute.
@@ -502,7 +587,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_weighted_routing(self, attribute, params=None, headers=None): async def get_weighted_routing(
self,
attribute: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Fetches weighted shard routing weights. Fetches weighted shard routing weights.
@@ -522,11 +612,11 @@ class ClusterClient(NamespacedClient):
@query_params() @query_params()
async def put_decommission_awareness( async def put_decommission_awareness(
self, self,
awareness_attribute_name, awareness_attribute_name: Any,
awareness_attribute_value, awareness_attribute_value: Any,
params=None, params: Any = None,
headers=None, headers: Any = None,
): ) -> Any:
""" """
Decommissions an awareness attribute. Decommissions an awareness attribute.
@@ -552,7 +642,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
async def put_weighted_routing(self, attribute, params=None, headers=None): async def put_weighted_routing(
self,
attribute: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates weighted shard routing weights. Updates weighted shard routing weights.
-456
View File
@@ -1,456 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class ClusterClient(NamespacedClient):
async def health(
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] = ...,
timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ...,
wait_for_events: Optional[Any] = ...,
wait_for_no_initializing_shards: Optional[Any] = ...,
wait_for_no_relocating_shards: Optional[Any] = ...,
wait_for_nodes: Optional[Any] = ...,
wait_for_status: Optional[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 pending_tasks(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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 state(
self,
*,
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] = ...,
wait_for_metadata_version: Optional[Any] = ...,
wait_for_timeout: Optional[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 stats(
self,
*,
node_id: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
timeout: Optional[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 reroute(
self,
*,
body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
dry_run: Optional[Any] = ...,
explain: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
metric: Optional[Any] = ...,
retry_failed: Optional[Any] = ...,
timeout: Optional[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_settings(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
include_defaults: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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_settings(
self,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 remote_info(
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 allocation_explain(
self,
*,
body: Optional[Any] = ...,
include_disk_info: Optional[Any] = ...,
include_yes_decisions: Optional[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 delete_component_template(
self,
name: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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_component_template(
self,
*,
name: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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_component_template(
self,
name: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
create: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 exists_component_template(
self,
name: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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]] = ...,
) -> bool: ...
async def delete_voting_config_exclusions(
self,
*,
wait_for_removal: Optional[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 post_voting_config_exclusions(
self,
*,
node_ids: Optional[Any] = ...,
node_names: Optional[Any] = ...,
timeout: Optional[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 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: ...
+19 -3
View File
@@ -36,6 +36,8 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
@@ -43,7 +45,12 @@ class DanglingIndicesClient(NamespacedClient):
@query_params( @query_params(
"accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout" "accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout"
) )
async def delete_dangling_index(self, index_uuid, params=None, headers=None): async def delete_dangling_index(
self,
index_uuid: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes the specified dangling index. Deletes the specified dangling index.
@@ -71,7 +78,12 @@ class DanglingIndicesClient(NamespacedClient):
@query_params( @query_params(
"accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout" "accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout"
) )
async def import_dangling_index(self, index_uuid, params=None, headers=None): async def import_dangling_index(
self,
index_uuid: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Imports the specified dangling index. Imports the specified dangling index.
@@ -94,7 +106,11 @@ class DanglingIndicesClient(NamespacedClient):
) )
@query_params() @query_params()
async def list_dangling_indices(self, params=None, headers=None): async def list_dangling_indices(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns all dangling indices. Returns all dangling indices.
@@ -1,99 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class DanglingIndicesClient(NamespacedClient):
async def delete_dangling_index(
self,
index_uuid: Any,
*,
accept_data_loss: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 import_dangling_index(
self,
index_uuid: Any,
*,
accept_data_loss: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 list_dangling_indices(
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: ...
+4 -2
View File
@@ -26,12 +26,14 @@
# under the License. # under the License.
from typing import Any
from .utils import NamespacedClient, query_params from .utils import NamespacedClient, query_params
class FeaturesClient(NamespacedClient): class FeaturesClient(NamespacedClient):
@query_params("master_timeout", "cluster_manager_timeout") @query_params("master_timeout", "cluster_manager_timeout")
async def get_features(self, params=None, headers=None): async def get_features(self, params: Any = None, headers: Any = None) -> Any:
""" """
Gets a list of features which can be included in snapshots using the Gets a list of features which can be included in snapshots using the
feature_states field when creating a snapshot feature_states field when creating a snapshot
@@ -47,7 +49,7 @@ class FeaturesClient(NamespacedClient):
) )
@query_params() @query_params()
async def reset_features(self, params=None, headers=None): async def reset_features(self, params: Any = None, headers: Any = None) -> Any:
""" """
Resets the internal state of features, usually by deleting system indices Resets the internal state of features, usually by deleting system indices
-66
View File
@@ -1,66 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Collection, MutableMapping, Optional, Tuple, Union
from .utils import NamespacedClient
class FeaturesClient(NamespacedClient):
async def get_features(
self,
*,
master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[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 reset_features(
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: ...
+316 -49
View File
@@ -36,12 +36,20 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IndicesClient(NamespacedClient): class IndicesClient(NamespacedClient):
@query_params() @query_params()
async def analyze(self, body=None, index=None, params=None, headers=None): async def analyze(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the analysis process on a text and return the tokens breakdown of the Performs the analysis process on a text and return the tokens breakdown of the
text. text.
@@ -60,7 +68,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
async def refresh(self, index=None, params=None, headers=None): async def refresh(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the refresh operation in one or more indices. Performs the refresh operation in one or more indices.
@@ -87,7 +100,12 @@ class IndicesClient(NamespacedClient):
"ignore_unavailable", "ignore_unavailable",
"wait_if_ongoing", "wait_if_ongoing",
) )
async def flush(self, index=None, params=None, headers=None): async def flush(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the flush operation on one or more indices. Performs the flush operation on one or more indices.
@@ -119,7 +137,13 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards" "cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards"
) )
async def create(self, index, body=None, params=None, headers=None): async def create(
self,
index: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates an index with optional settings and mappings. Creates an index with optional settings and mappings.
@@ -146,7 +170,14 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards" "cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards"
) )
async def clone(self, index, target, body=None, params=None, headers=None): async def clone(
self,
index: Any,
target: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clones an index. Clones an index.
@@ -186,7 +217,12 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
async def get(self, index, params=None, headers=None): async def get(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about one or more indices. Returns information about one or more indices.
@@ -229,7 +265,12 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def open(self, index, params=None, headers=None): async def open(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Opens an index. Opens an index.
@@ -268,7 +309,12 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def close(self, index, params=None, headers=None): async def close(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Closes an index. Closes an index.
@@ -306,7 +352,12 @@ class IndicesClient(NamespacedClient):
"master_timeout", "master_timeout",
"timeout", "timeout",
) )
async def delete(self, index, params=None, headers=None): async def delete(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an index. Deletes an index.
@@ -344,7 +395,12 @@ class IndicesClient(NamespacedClient):
"include_defaults", "include_defaults",
"local", "local",
) )
async def exists(self, index, params=None, headers=None): async def exists(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular index exists. Returns information about whether a particular index exists.
@@ -382,7 +438,13 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"write_index_only", "write_index_only",
) )
async def put_mapping(self, body, index=None, params=None, headers=None): async def put_mapping(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the index mappings. Updates the index mappings.
@@ -429,7 +491,12 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
async def get_mapping(self, index=None, params=None, headers=None): async def get_mapping(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns mappings for one or more indices. Returns mappings for one or more indices.
@@ -463,7 +530,13 @@ class IndicesClient(NamespacedClient):
"include_defaults", "include_defaults",
"local", "local",
) )
async def get_field_mapping(self, fields, index=None, params=None, headers=None): async def get_field_mapping(
self,
fields: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns mapping for one or more fields. Returns mapping for one or more fields.
@@ -494,7 +567,14 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def put_alias(self, index, name, body=None, params=None, headers=None): async def put_alias(
self,
index: Any,
name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates an alias. Creates or updates an alias.
@@ -524,7 +604,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local")
async def exists_alias(self, name, index=None, params=None, headers=None): async def exists_alias(
self,
name: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular alias exists. Returns information about whether a particular alias exists.
@@ -550,7 +636,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local")
async def get_alias(self, index=None, name=None, params=None, headers=None): async def get_alias(
self,
index: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns an alias. Returns an alias.
@@ -573,7 +665,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def update_aliases(self, body, params=None, headers=None): async def update_aliases(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates index aliases. Updates index aliases.
@@ -594,7 +691,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def delete_alias(self, index, name, params=None, headers=None): async def delete_alias(
self,
index: Any,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an alias. Deletes an alias.
@@ -619,7 +722,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "create", "master_timeout", "order") @query_params("cluster_manager_timeout", "create", "master_timeout", "order")
async def put_template(self, name, body, params=None, headers=None): async def put_template(
self,
name: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates an index template. Creates or updates an index template.
@@ -650,7 +759,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
async def exists_template(self, name, params=None, headers=None): async def exists_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular index template exists. Returns information about whether a particular index template exists.
@@ -674,7 +788,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
async def get_template(self, name=None, params=None, headers=None): async def get_template(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns an index template. Returns an index template.
@@ -695,7 +814,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def delete_template(self, name, params=None, headers=None): async def delete_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an index template. Deletes an index template.
@@ -725,7 +849,13 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
async def get_settings(self, index=None, name=None, params=None, headers=None): async def get_settings(
self,
index: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns settings for one or more indices. Returns settings for one or more indices.
@@ -767,7 +897,13 @@ class IndicesClient(NamespacedClient):
"preserve_existing", "preserve_existing",
"timeout", "timeout",
) )
async def put_settings(self, body, index=None, params=None, headers=None): async def put_settings(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the index settings. Updates the index settings.
@@ -817,7 +953,13 @@ class IndicesClient(NamespacedClient):
"include_unloaded_segments", "include_unloaded_segments",
"level", "level",
) )
async def stats(self, index=None, metric=None, params=None, headers=None): async def stats(
self,
index: Any = None,
metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides statistics on operations happening in an index. Provides statistics on operations happening in an index.
@@ -858,7 +1000,12 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose"
) )
async def segments(self, index=None, params=None, headers=None): async def segments(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides low-level information about segments in a Lucene index. Provides low-level information about segments in a Lucene index.
@@ -894,7 +1041,13 @@ class IndicesClient(NamespacedClient):
"q", "q",
"rewrite", "rewrite",
) )
async def validate_query(self, body=None, index=None, params=None, headers=None): async def validate_query(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows a user to validate a potentially expensive query without executing it. Allows a user to validate a potentially expensive query without executing it.
@@ -943,7 +1096,12 @@ class IndicesClient(NamespacedClient):
"query", "query",
"request", "request",
) )
async def clear_cache(self, index=None, params=None, headers=None): async def clear_cache(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clears all or specific caches for one or more indices. Clears all or specific caches for one or more indices.
@@ -969,7 +1127,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("active_only", "detailed") @query_params("active_only", "detailed")
async def recovery(self, index=None, params=None, headers=None): async def recovery(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about ongoing index shard recoveries. Returns information about ongoing index shard recoveries.
@@ -992,7 +1155,12 @@ class IndicesClient(NamespacedClient):
"only_ancient_segments", "only_ancient_segments",
"wait_for_completion", "wait_for_completion",
) )
async def upgrade(self, index=None, params=None, headers=None): async def upgrade(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
The _upgrade API is no longer useful and will be removed. The _upgrade API is no longer useful and will be removed.
@@ -1017,7 +1185,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
async def get_upgrade(self, index=None, params=None, headers=None): async def get_upgrade(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
The _upgrade API is no longer useful and will be removed. The _upgrade API is no longer useful and will be removed.
@@ -1040,7 +1213,12 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status"
) )
async def shard_stores(self, index=None, params=None, headers=None): async def shard_stores(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides store information for shard copies of indices. Provides store information for shard copies of indices.
@@ -1070,7 +1248,12 @@ class IndicesClient(NamespacedClient):
"max_num_segments", "max_num_segments",
"only_expunge_deletes", "only_expunge_deletes",
) )
async def forcemerge(self, index=None, params=None, headers=None): async def forcemerge(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the force merge operation on one or more indices. Performs the force merge operation on one or more indices.
@@ -1103,7 +1286,14 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def shrink(self, index, target, body=None, params=None, headers=None): async def shrink(
self,
index: Any,
target: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allow to shrink an existing index into a new index with fewer primary shards. Allow to shrink an existing index into a new index with fewer primary shards.
@@ -1142,7 +1332,14 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def split(self, index, target, body=None, params=None, headers=None): async def split(
self,
index: Any,
target: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows you to split an existing index into a new index with more primary Allows you to split an existing index into a new index with more primary
shards. shards.
@@ -1183,8 +1380,13 @@ class IndicesClient(NamespacedClient):
"wait_for_active_shards", "wait_for_active_shards",
) )
async def rollover( async def rollover(
self, alias, body=None, new_index=None, params=None, headers=None self,
): alias: Any,
body: Any = None,
new_index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates an alias to point to a new index when the existing index is considered Updates an alias to point to a new index when the existing index is considered
to be too large or too old. to be too large or too old.
@@ -1219,7 +1421,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_data_stream(self, name, body=None, params=None, headers=None): async def create_data_stream(
self,
name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a data stream. Creates or updates a data stream.
@@ -1239,7 +1447,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_data_stream(self, name, params=None, headers=None): async def delete_data_stream(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a data stream. Deletes a data stream.
@@ -1255,7 +1468,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def delete_index_template(self, name, params=None, headers=None): async def delete_index_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an index template. Deletes an index template.
@@ -1279,7 +1497,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
async def exists_index_template(self, name, params=None, headers=None): async def exists_index_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular index template exists. Returns information about whether a particular index template exists.
@@ -1303,7 +1526,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
async def get_index_template(self, name=None, params=None, headers=None): async def get_index_template(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns an index template. Returns an index template.
@@ -1324,7 +1552,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cause", "cluster_manager_timeout", "create", "master_timeout") @query_params("cause", "cluster_manager_timeout", "create", "master_timeout")
async def put_index_template(self, name, body, params=None, headers=None): async def put_index_template(
self,
name: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates an index template. Creates or updates an index template.
@@ -1354,7 +1588,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cause", "cluster_manager_timeout", "create", "master_timeout") @query_params("cause", "cluster_manager_timeout", "create", "master_timeout")
async def simulate_index_template(self, name, body=None, params=None, headers=None): async def simulate_index_template(
self,
name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Simulate matching the given index name against the index templates in the Simulate matching the given index name against the index templates in the
system. system.
@@ -1387,7 +1627,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_data_stream(self, name=None, params=None, headers=None): async def get_data_stream(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns data streams. Returns data streams.
@@ -1400,7 +1645,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cause", "cluster_manager_timeout", "create", "master_timeout") @query_params("cause", "cluster_manager_timeout", "create", "master_timeout")
async def simulate_template(self, body=None, name=None, params=None, headers=None): async def simulate_template(
self,
body: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Simulate resolving the given template name or body. Simulate resolving the given template name or body.
@@ -1428,7 +1679,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("expand_wildcards") @query_params("expand_wildcards")
async def resolve_index(self, name, params=None, headers=None): async def resolve_index(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about any matching indices, aliases, and data streams. Returns information about any matching indices, aliases, and data streams.
@@ -1454,7 +1710,13 @@ class IndicesClient(NamespacedClient):
"master_timeout", "master_timeout",
"timeout", "timeout",
) )
async def add_block(self, index, block, params=None, headers=None): async def add_block(
self,
index: Any,
block: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Adds a block to an index. Adds a block to an index.
@@ -1486,7 +1748,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
async def data_streams_stats(self, name=None, params=None, headers=None): async def data_streams_stats(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides statistics on operations happening in a data stream. Provides statistics on operations happening in a data stream.
File diff suppressed because it is too large Load Diff
+33 -5
View File
@@ -36,12 +36,19 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IngestClient(NamespacedClient): class IngestClient(NamespacedClient):
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
async def get_pipeline(self, id=None, params=None, headers=None): async def get_pipeline(
self,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a pipeline. Returns a pipeline.
@@ -59,7 +66,13 @@ class IngestClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def put_pipeline(self, id, body, params=None, headers=None): async def put_pipeline(
self,
id: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a pipeline. Creates or updates a pipeline.
@@ -86,7 +99,12 @@ class IngestClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def delete_pipeline(self, id, params=None, headers=None): async def delete_pipeline(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a pipeline. Deletes a pipeline.
@@ -110,7 +128,13 @@ class IngestClient(NamespacedClient):
) )
@query_params("verbose") @query_params("verbose")
async def simulate(self, body, id=None, params=None, headers=None): async def simulate(
self,
body: Any,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to simulate a pipeline with example documents. Allows to simulate a pipeline with example documents.
@@ -132,7 +156,11 @@ class IngestClient(NamespacedClient):
) )
@query_params() @query_params()
async def processor_grok(self, params=None, headers=None): async def processor_grok(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a list of the built-in patterns. Returns a list of the built-in patterns.
-136
View File
@@ -1,136 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class IngestClient(NamespacedClient):
async def get_pipeline(
self,
*,
id: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[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_pipeline(
self,
id: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 delete_pipeline(
self,
id: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 simulate(
self,
*,
body: Any,
id: Optional[Any] = ...,
verbose: Optional[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 processor_grok(
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: ...
+35 -7
View File
@@ -36,14 +36,20 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import NamespacedClient, _make_path, query_params from .utils import NamespacedClient, _make_path, query_params
class NodesClient(NamespacedClient): class NodesClient(NamespacedClient):
@query_params("timeout") @query_params("timeout")
async def reload_secure_settings( async def reload_secure_settings(
self, body=None, node_id=None, params=None, headers=None self,
): body: Any = None,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Reloads secure settings. Reloads secure settings.
@@ -64,7 +70,13 @@ class NodesClient(NamespacedClient):
) )
@query_params("flat_settings", "timeout") @query_params("flat_settings", "timeout")
async def info(self, node_id=None, metric=None, params=None, headers=None): async def info(
self,
node_id: Any = None,
metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about nodes in the cluster. Returns information about nodes in the cluster.
@@ -95,8 +107,13 @@ class NodesClient(NamespacedClient):
"types", "types",
) )
async def stats( async def stats(
self, node_id=None, metric=None, index_metric=None, params=None, headers=None self,
): node_id: Any = None,
metric: Any = None,
index_metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns statistical information about nodes in the cluster. Returns statistical information about nodes in the cluster.
@@ -140,7 +157,12 @@ class NodesClient(NamespacedClient):
@query_params( @query_params(
"doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout" "doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout"
) )
async def hot_threads(self, node_id=None, params=None, headers=None): async def hot_threads(
self,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about hot threads on each node in the cluster. Returns information about hot threads on each node in the cluster.
@@ -173,7 +195,13 @@ class NodesClient(NamespacedClient):
) )
@query_params("timeout") @query_params("timeout")
async def usage(self, node_id=None, metric=None, params=None, headers=None): async def usage(
self,
node_id: Any = None,
metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns low-level information about REST actions usage on nodes. Returns low-level information about REST actions usage on nodes.
-149
View File
@@ -1,149 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class NodesClient(NamespacedClient):
async def reload_secure_settings(
self,
*,
body: Optional[Any] = ...,
node_id: Optional[Any] = ...,
timeout: Optional[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 info(
self,
*,
node_id: Optional[Any] = ...,
metric: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
timeout: Optional[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 stats(
self,
*,
node_id: Optional[Any] = ...,
metric: Optional[Any] = ...,
index_metric: Optional[Any] = ...,
completion_fields: Optional[Any] = ...,
fielddata_fields: Optional[Any] = ...,
fields: Optional[Any] = ...,
groups: Optional[Any] = ...,
include_segment_file_sizes: Optional[Any] = ...,
level: Optional[Any] = ...,
timeout: Optional[Any] = ...,
types: Optional[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 hot_threads(
self,
*,
node_id: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
ignore_idle_threads: Optional[Any] = ...,
interval: Optional[Any] = ...,
snapshots: Optional[Any] = ...,
threads: Optional[Any] = ...,
timeout: Optional[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 usage(
self,
*,
node_id: Optional[Any] = ...,
metric: Optional[Any] = ...,
timeout: Optional[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: ...
+7 -2
View File
@@ -9,14 +9,19 @@
# GitHub history for details. # GitHub history for details.
import warnings import warnings
from typing import Any
from ..plugins.alerting import AlertingClient from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient from ..plugins.index_management import IndexManagementClient
from .client import Client
from .utils import NamespacedClient from .utils import NamespacedClient
class PluginsClient(NamespacedClient): class PluginsClient(NamespacedClient):
def __init__(self, client): alerting: Any
index_management: Any
def __init__(self, client: Client) -> None:
super(PluginsClient, self).__init__(client) super(PluginsClient, self).__init__(client)
# self.query_workbench = QueryWorkbenchClient(client) # self.query_workbench = QueryWorkbenchClient(client)
# self.reporting = ReportingClient(client) # self.reporting = ReportingClient(client)
@@ -28,7 +33,7 @@ class PluginsClient(NamespacedClient):
self._dynamic_lookup(client) self._dynamic_lookup(client)
def _dynamic_lookup(self, client): def _dynamic_lookup(self, client: Any) -> None:
# Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742
plugins = [ plugins = [
-19
View File
@@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any
from ..client import AsyncOpenSearch
from ..plugins.alerting import AlertingClient as AlertingClient
from .utils import NamespacedClient as NamespacedClient
class PluginsClient(NamespacedClient):
alerting: Any
index_management: Any
def __init__(self, client: AsyncOpenSearch) -> None: ...
+3 -1
View File
@@ -26,12 +26,14 @@
# under the License. # under the License.
from typing import Any
from .utils import NamespacedClient, query_params from .utils import NamespacedClient, query_params
class RemoteClient(NamespacedClient): class RemoteClient(NamespacedClient):
@query_params() @query_params()
async def info(self, params=None, headers=None): async def info(self, params: Any = None, headers: Any = None) -> Any:
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "/_remote/info", params=params, headers=headers "GET", "/_remote/info", params=params, headers=headers
) )
-46
View File
@@ -1,46 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Collection, MutableMapping, Optional, Tuple, Union
from .utils import NamespacedClient
class RemoteClient(NamespacedClient):
async def info(
self,
*,
timeout: Optional[Any] = None,
pretty: Optional[bool] = None,
human: Optional[bool] = None,
error_trace: Optional[bool] = None,
format: Optional[str] = None,
filter_path: Optional[Union[str, Collection[str]]] = None,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = None,
headers: Optional[MutableMapping[str, str]] = None,
) -> Any: ...
+9 -1
View File
@@ -7,6 +7,7 @@
# #
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
# ---------------------------------------------------- # ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. # THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
# #
@@ -17,12 +18,19 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, query_params from .utils import SKIP_IN_PATH, NamespacedClient, query_params
class RemoteStoreClient(NamespacedClient): class RemoteStoreClient(NamespacedClient):
@query_params("cluster_manager_timeout", "wait_for_completion") @query_params("cluster_manager_timeout", "wait_for_completion")
async def restore(self, body, params=None, headers=None): async def restore(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Restores from remote store. Restores from remote store.
@@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ----------------------------------------------------
# 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
class RemoteStoreClient(NamespacedClient):
async def restore(
self,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
wait_for_completion: Optional[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: ...
+281 -51
View File
@@ -8,7 +8,6 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
# ---------------------------------------------------- # ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. # THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
# #
@@ -19,14 +18,20 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SecurityClient(NamespacedClient): class SecurityClient(NamespacedClient):
from ._patch import health_check, update_audit_config from ._patch import health_check, update_audit_config # type: ignore
@query_params() @query_params()
async def get_account_details(self, params=None, headers=None): async def get_account_details(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns account details for the current user. Returns account details for the current user.
@@ -36,7 +41,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def change_password(self, body, params=None, headers=None): async def change_password(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the password for the current user. Changes the password for the current user.
@@ -54,7 +64,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_action_group(self, action_group, params=None, headers=None): async def get_action_group(
self,
action_group: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one action group. Retrieves one action group.
@@ -74,7 +89,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_action_groups(self, params=None, headers=None): async def get_action_groups(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all action groups. Retrieves all action groups.
@@ -87,7 +106,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_action_group(self, action_group, params=None, headers=None): async def delete_action_group(
self,
action_group: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete a specified action group. Delete a specified action group.
@@ -107,7 +131,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_action_group(self, action_group, body, params=None, headers=None): async def create_action_group(
self,
action_group: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified action group. Creates or replaces the specified action group.
@@ -128,7 +158,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_action_group(self, action_group, body, params=None, headers=None): async def patch_action_group(
self,
action_group: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of an action group. Updates individual attributes of an action group.
@@ -147,7 +183,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_action_groups(self, body, params=None, headers=None): async def patch_action_groups(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates, updates, or deletes multiple action groups in a single call. Creates, updates, or deletes multiple action groups in a single call.
@@ -165,7 +206,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_user(self, username, params=None, headers=None): async def get_user(
self,
username: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieve one internal user. Retrieve one internal user.
@@ -182,7 +228,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_users(self, params=None, headers=None): async def get_users(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieve all internal users. Retrieve all internal users.
@@ -195,7 +245,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_user(self, username, params=None, headers=None): async def delete_user(
self,
username: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete the specified user. Delete the specified user.
@@ -212,7 +267,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_user(self, username, body, params=None, headers=None): async def create_user(
self,
username: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified user. Creates or replaces the specified user.
@@ -231,7 +292,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_user(self, username, body, params=None, headers=None): async def patch_user(
self,
username: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of an internal user. Updates individual attributes of an internal user.
@@ -250,7 +317,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_users(self, body, params=None, headers=None): async def patch_users(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates, updates, or deletes multiple internal users in a single call. Creates, updates, or deletes multiple internal users in a single call.
@@ -268,7 +340,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_role(self, role, params=None, headers=None): async def get_role(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one role. Retrieves one role.
@@ -285,7 +362,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_roles(self, params=None, headers=None): async def get_roles(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all roles. Retrieves all roles.
@@ -295,7 +376,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_role(self, role, params=None, headers=None): async def delete_role(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete the specified role. Delete the specified role.
@@ -312,7 +398,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_role(self, role, body, params=None, headers=None): async def create_role(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified role. Creates or replaces the specified role.
@@ -331,7 +423,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_role(self, role, body, params=None, headers=None): async def patch_role(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of a role. Updates individual attributes of a role.
@@ -350,7 +448,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_roles(self, body, params=None, headers=None): async def patch_roles(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates, updates, or deletes multiple roles in a single call. Creates, updates, or deletes multiple roles in a single call.
@@ -368,7 +471,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_role_mapping(self, role, params=None, headers=None): async def get_role_mapping(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one role mapping. Retrieves one role mapping.
@@ -385,7 +493,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_role_mappings(self, params=None, headers=None): async def get_role_mappings(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all role mappings. Retrieves all role mappings.
@@ -398,7 +510,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_role_mapping(self, role, params=None, headers=None): async def delete_role_mapping(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes the specified role mapping. Deletes the specified role mapping.
@@ -415,7 +532,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_role_mapping(self, role, body, params=None, headers=None): async def create_role_mapping(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified role mapping. Creates or replaces the specified role mapping.
@@ -434,7 +557,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_role_mapping(self, role, body, params=None, headers=None): async def patch_role_mapping(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of a role mapping. Updates individual attributes of a role mapping.
@@ -453,7 +582,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_role_mappings(self, body, params=None, headers=None): async def patch_role_mappings(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates multiple role mappings in a single call. Creates or updates multiple role mappings in a single call.
@@ -471,7 +605,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_tenant(self, tenant, params=None, headers=None): async def get_tenant(
self,
tenant: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one tenant. Retrieves one tenant.
@@ -488,7 +627,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_tenants(self, params=None, headers=None): async def get_tenants(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all tenants. Retrieves all tenants.
@@ -498,7 +641,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_tenant(self, tenant, params=None, headers=None): async def delete_tenant(
self,
tenant: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete the specified tenant. Delete the specified tenant.
@@ -515,7 +663,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_tenant(self, tenant, body, params=None, headers=None): async def create_tenant(
self,
tenant: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified tenant. Creates or replaces the specified tenant.
@@ -534,7 +688,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_tenant(self, tenant, body, params=None, headers=None): async def patch_tenant(
self,
tenant: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Add, delete, or modify a single tenant. Add, delete, or modify a single tenant.
@@ -553,7 +713,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_tenants(self, body, params=None, headers=None): async def patch_tenants(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Add, delete, or modify multiple tenants in a single call. Add, delete, or modify multiple tenants in a single call.
@@ -571,7 +736,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_configuration(self, params=None, headers=None): async def get_configuration(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the current Security plugin configuration in JSON format. Returns the current Security plugin configuration in JSON format.
@@ -584,7 +753,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def update_configuration(self, body, params=None, headers=None): async def update_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Adds or updates the existing configuration using the REST API. Adds or updates the existing configuration using the REST API.
@@ -602,7 +776,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_configuration(self, body, params=None, headers=None): async def patch_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
A PATCH call is used to update the existing configuration using the REST API. A PATCH call is used to update the existing configuration using the REST API.
@@ -621,8 +800,11 @@ class SecurityClient(NamespacedClient):
@query_params() @query_params()
async def get_distinguished_names( async def get_distinguished_names(
self, cluster_name=None, params=None, headers=None self,
): cluster_name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all distinguished names in the allow list. Retrieves all distinguished names in the allow list.
@@ -637,8 +819,12 @@ class SecurityClient(NamespacedClient):
@query_params() @query_params()
async def update_distinguished_names( async def update_distinguished_names(
self, cluster_name, body=None, params=None, headers=None self,
): cluster_name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Adds or updates the specified distinguished names in the clusters or nodes Adds or updates the specified distinguished names in the clusters or nodes
allow list. allow list.
@@ -659,7 +845,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_distinguished_names(self, cluster_name, params=None, headers=None): async def delete_distinguished_names(
self,
cluster_name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes all distinguished names in the specified clusters or nodes allow Deletes all distinguished names in the specified clusters or nodes allow
list. list.
@@ -679,7 +870,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_certificates(self, params=None, headers=None): async def get_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves the clusters security certificates. Retrieves the clusters security certificates.
@@ -689,7 +884,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def reload_transport_certificates(self, params=None, headers=None): async def reload_transport_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Reload transport layer communication certificates. Reload transport layer communication certificates.
@@ -702,7 +901,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def reload_http_certificates(self, params=None, headers=None): async def reload_http_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Reload HTTP layer communication certificates. Reload HTTP layer communication certificates.
@@ -715,7 +918,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def flush_cache(self, params=None, headers=None): async def flush_cache(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Flushes the Security plugin user, authentication, and authorization cache. Flushes the Security plugin user, authentication, and authorization cache.
@@ -725,7 +932,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def health(self, params=None, headers=None): async def health(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Checks to see if the Security plugin is up and running. Checks to see if the Security plugin is up and running.
@@ -735,7 +946,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_audit_configuration(self, params=None, headers=None): async def get_audit_configuration(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves the audit configuration. Retrieves the audit configuration.
@@ -745,7 +960,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def update_audit_configuration(self, body, params=None, headers=None): async def update_audit_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the audit configuration. Updates the audit configuration.
@@ -763,7 +983,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_audit_configuration(self, body, params=None, headers=None): async def patch_audit_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
A PATCH call is used to update specified fields in the audit configuration. A PATCH call is used to update specified fields in the audit configuration.
@@ -781,7 +1006,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
async def patch_distinguished_names(self, body, params=None, headers=None): async def patch_distinguished_names(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Bulk update of distinguished names. Bulk update of distinguished names.
-821
View File
@@ -1,821 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ----------------------------------------------------
# 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
class SecurityClient(NamespacedClient):
async def get_account_details(
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 change_password(
self,
*,
body: 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_action_group(
self,
action_group: 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_action_groups(
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_action_group(
self,
action_group: 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 create_action_group(
self,
action_group: Any,
*,
body: 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 patch_action_group(
self,
action_group: Any,
*,
body: 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 patch_action_groups(
self,
*,
body: 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_user(
self,
username: 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_users(
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_user(
self,
username: 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 create_user(
self,
username: Any,
*,
body: 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 patch_user(
self,
username: Any,
*,
body: 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 patch_users(
self,
*,
body: 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_role(
self,
role: 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_roles(
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_role(
self,
role: 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 create_role(
self,
role: Any,
*,
body: 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 patch_role(
self,
role: Any,
*,
body: 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 patch_roles(
self,
*,
body: 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_role_mapping(
self,
role: 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_role_mappings(
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_role_mapping(
self,
role: 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 create_role_mapping(
self,
role: Any,
*,
body: 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 patch_role_mapping(
self,
role: Any,
*,
body: 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 patch_role_mappings(
self,
*,
body: 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_tenant(
self,
tenant: 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_tenants(
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_tenant(
self,
tenant: 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 create_tenant(
self,
tenant: Any,
*,
body: 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 patch_tenant(
self,
tenant: Any,
*,
body: 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 patch_tenants(
self,
*,
body: 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_configuration(
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 update_configuration(
self,
*,
body: 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 patch_configuration(
self,
*,
body: 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_distinguished_names(
self,
*,
cluster_name: Optional[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 update_distinguished_names(
self,
cluster_name: Any,
*,
body: Optional[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 delete_distinguished_names(
self,
cluster_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_certificates(
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 reload_transport_certificates(
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 reload_http_certificates(
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 flush_cache(
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 health(
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_audit_configuration(
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 update_audit_configuration(
self,
*,
body: 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 patch_audit_configuration(
self,
*,
body: 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 patch_distinguished_names(
self,
*,
body: 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: ...
+78 -12
View File
@@ -36,12 +36,21 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SnapshotClient(NamespacedClient): class SnapshotClient(NamespacedClient):
@query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion") @query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion")
async def create(self, repository, snapshot, body=None, params=None, headers=None): async def create(
self,
repository: Any,
snapshot: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates a snapshot in a repository. Creates a snapshot in a repository.
@@ -70,7 +79,13 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
async def delete(self, repository, snapshot, params=None, headers=None): async def delete(
self,
repository: Any,
snapshot: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a snapshot. Deletes a snapshot.
@@ -97,7 +112,13 @@ class SnapshotClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "ignore_unavailable", "master_timeout", "verbose" "cluster_manager_timeout", "ignore_unavailable", "master_timeout", "verbose"
) )
async def get(self, repository, snapshot, params=None, headers=None): async def get(
self,
repository: Any,
snapshot: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about a snapshot. Returns information about a snapshot.
@@ -127,7 +148,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def delete_repository(self, repository, params=None, headers=None): async def delete_repository(
self,
repository: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a repository. Deletes a repository.
@@ -152,7 +178,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
async def get_repository(self, repository=None, params=None, headers=None): async def get_repository(
self,
repository: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about a repository. Returns information about a repository.
@@ -171,7 +202,13 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout", "verify") @query_params("cluster_manager_timeout", "master_timeout", "timeout", "verify")
async def create_repository(self, repository, body, params=None, headers=None): async def create_repository(
self,
repository: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates a repository. Creates a repository.
@@ -199,7 +236,14 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion") @query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion")
async def restore(self, repository, snapshot, body=None, params=None, headers=None): async def restore(
self,
repository: Any,
snapshot: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Restores a snapshot. Restores a snapshot.
@@ -228,7 +272,13 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "ignore_unavailable", "master_timeout") @query_params("cluster_manager_timeout", "ignore_unavailable", "master_timeout")
async def status(self, repository=None, snapshot=None, params=None, headers=None): async def status(
self,
repository: Any = None,
snapshot: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the status of a snapshot. Returns information about the status of a snapshot.
@@ -252,7 +302,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def verify_repository(self, repository, params=None, headers=None): async def verify_repository(
self,
repository: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Verifies a repository. Verifies a repository.
@@ -276,7 +331,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
async def cleanup_repository(self, repository, params=None, headers=None): async def cleanup_repository(
self,
repository: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Removes stale data from repository. Removes stale data from repository.
@@ -301,8 +361,14 @@ class SnapshotClient(NamespacedClient):
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
async def clone( async def clone(
self, repository, snapshot, target_snapshot, body, params=None, headers=None self,
): repository: Any,
snapshot: Any,
target_snapshot: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clones indices from one snapshot into another snapshot in the same repository. Clones indices from one snapshot into another snapshot in the same repository.
-272
View File
@@ -1,272 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class SnapshotClient(NamespacedClient):
async def create(
self,
repository: Any,
snapshot: Any,
*,
body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
wait_for_completion: Optional[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 delete(
self,
repository: Any,
snapshot: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[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(
self,
repository: Any,
snapshot: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
verbose: Optional[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 delete_repository(
self,
repository: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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_repository(
self,
*,
repository: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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 create_repository(
self,
repository: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
verify: Optional[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 restore(
self,
repository: Any,
snapshot: Any,
*,
body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
wait_for_completion: Optional[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 status(
self,
*,
repository: Optional[Any] = ...,
snapshot: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
master_timeout: Optional[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 verify_repository(
self,
repository: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 cleanup_repository(
self,
repository: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 clone(
self,
repository: Any,
snapshot: Any,
target_snapshot: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[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: ...
+18 -3
View File
@@ -37,6 +37,7 @@
import warnings import warnings
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
@@ -51,7 +52,11 @@ class TasksClient(NamespacedClient):
"timeout", "timeout",
"wait_for_completion", "wait_for_completion",
) )
async def list(self, params=None, headers=None): async def list(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a list of tasks. Returns a list of tasks.
@@ -77,7 +82,12 @@ class TasksClient(NamespacedClient):
) )
@query_params("actions", "nodes", "parent_task_id", "wait_for_completion") @query_params("actions", "nodes", "parent_task_id", "wait_for_completion")
async def cancel(self, task_id=None, params=None, headers=None): async def cancel(
self,
task_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Cancels a task, if it can be cancelled through an API. Cancels a task, if it can be cancelled through an API.
@@ -103,7 +113,12 @@ class TasksClient(NamespacedClient):
) )
@query_params("timeout", "wait_for_completion") @query_params("timeout", "wait_for_completion")
async def get(self, task_id=None, params=None, headers=None): async def get(
self,
task_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about a task. Returns information about a task.
-104
View File
@@ -1,104 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class TasksClient(NamespacedClient):
async def list(
self,
*,
actions: Optional[Any] = ...,
detailed: Optional[Any] = ...,
group_by: Optional[Any] = ...,
nodes: Optional[Any] = ...,
parent_task_id: Optional[Any] = ...,
timeout: Optional[Any] = ...,
wait_for_completion: Optional[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 cancel(
self,
*,
task_id: Optional[Any] = ...,
actions: Optional[Any] = ...,
nodes: Optional[Any] = ...,
parent_task_id: Optional[Any] = ...,
wait_for_completion: Optional[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(
self,
*,
task_id: Optional[Any] = ...,
timeout: Optional[Any] = ...,
wait_for_completion: Optional[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: ...
+10
View File
@@ -35,3 +35,13 @@ from ...client.utils import ( # noqa
_normalize_hosts, _normalize_hosts,
query_params, query_params,
) )
__all__ = [
"SKIP_IN_PATH",
"NamespacedClient",
"_make_path",
"query_params",
"_bulk_body",
"_escape",
"_normalize_hosts",
]
-41
View File
@@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from ...client.utils import SKIP_IN_PATH as SKIP_IN_PATH
from ...client.utils import _bulk_body as _bulk_body
from ...client.utils import _escape as _escape
from ...client.utils import _make_path as _make_path # noqa
from ...client.utils import _normalize_hosts as _normalize_hosts
from ...client.utils import query_params as query_params
from ..client import AsyncOpenSearch
from ..transport import AsyncTransport
class NamespacedClient:
client: AsyncOpenSearch
def __init__(self, client: AsyncOpenSearch) -> None: ...
@property
def transport(self) -> AsyncTransport: ...
+1 -1
View File
@@ -39,7 +39,7 @@ try:
from asyncio import get_running_loop from asyncio import get_running_loop
except ImportError: except ImportError:
def get_running_loop(): def get_running_loop() -> asyncio.AbstractEventLoop:
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
if not loop.is_running(): if not loop.is_running():
raise RuntimeError("no running event loop") raise RuntimeError("no running event loop")
-30
View File
@@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import asyncio
def get_running_loop() -> asyncio.AbstractEventLoop: ...
+81 -56
View File
@@ -32,6 +32,18 @@
import asyncio import asyncio
import logging import logging
from typing import (
Any,
AsyncGenerator,
AsyncIterable,
Collection,
Iterable,
List,
Optional,
Tuple,
TypeVar,
Union,
)
from ...compat import map from ...compat import map
from ...exceptions import TransportError from ...exceptions import TransportError
@@ -43,10 +55,12 @@ from ...helpers.actions import (
) )
from ...helpers.errors import ScanError from ...helpers.errors import ScanError
logger = logging.getLogger("opensearchpy.helpers") logger: logging.Logger = logging.getLogger("opensearchpy.helpers")
async def _chunk_actions(actions, chunk_size, max_chunk_bytes, serializer): async def _chunk_actions(
actions: Any, chunk_size: int, max_chunk_bytes: int, serializer: Any
) -> AsyncGenerator[Any, None]:
""" """
Split actions into chunks by number or size, serialize them into strings in Split actions into chunks by number or size, serialize them into strings in
the process. the process.
@@ -64,15 +78,15 @@ async def _chunk_actions(actions, chunk_size, max_chunk_bytes, serializer):
async def _process_bulk_chunk( async def _process_bulk_chunk(
client, client: Any,
bulk_actions, bulk_actions: Any,
bulk_data, bulk_data: Any,
raise_on_exception=True, raise_on_exception: bool = True,
raise_on_error=True, raise_on_error: bool = True,
ignore_status=(), ignore_status: Any = (),
*args, *args: Any,
**kwargs **kwargs: Any
): ) -> AsyncGenerator[Tuple[bool, Any], None]:
""" """
Send a bulk request to opensearch and process the output. Send a bulk request to opensearch and process the output.
""" """
@@ -101,21 +115,26 @@ async def _process_bulk_chunk(
yield item yield item
def aiter(x): T = TypeVar("T")
def aiter(x: Union[Iterable[T], AsyncIterable[T]]) -> Any:
"""Turns an async iterable or iterable into an async iterator""" """Turns an async iterable or iterable into an async iterator"""
if hasattr(x, "__anext__"): if hasattr(x, "__anext__"):
return x return x
elif hasattr(x, "__aiter__"): elif hasattr(x, "__aiter__"):
return x.__aiter__() return x.__aiter__()
async def f(): async def f() -> Any:
for item in x: for item in x:
yield item yield item
return f().__aiter__() return f().__aiter__()
async def azip(*iterables): async def azip(
*iterables: Union[Iterable[T], AsyncIterable[T]]
) -> AsyncGenerator[Tuple[T, ...], None]:
"""Zips async iterables and iterables into an async iterator """Zips async iterables and iterables into an async iterator
with the same behavior as zip() with the same behavior as zip()
""" """
@@ -128,21 +147,21 @@ async def azip(*iterables):
async def async_streaming_bulk( async def async_streaming_bulk(
client, client: Any,
actions, actions: Any,
chunk_size=500, chunk_size: int = 500,
max_chunk_bytes=100 * 1024 * 1024, max_chunk_bytes: int = 100 * 1024 * 1024,
raise_on_error=True, raise_on_error: bool = True,
expand_action_callback=expand_action, expand_action_callback: Any = expand_action,
raise_on_exception=True, raise_on_exception: bool = True,
max_retries=0, max_retries: int = 0,
initial_backoff=2, initial_backoff: Union[float, int] = 2,
max_backoff=600, max_backoff: Union[float, int] = 600,
yield_ok=True, yield_ok: bool = True,
ignore_status=(), ignore_status: Any = (),
*args, *args: Any,
**kwargs **kwargs: Any
): ) -> AsyncGenerator[Tuple[bool, Any], None]:
""" """
Streaming bulk consumes actions from the iterable passed in and yields Streaming bulk consumes actions from the iterable passed in and yields
results per action. For non-streaming usecases use results per action. For non-streaming usecases use
@@ -177,7 +196,7 @@ async def async_streaming_bulk(
:arg ignore_status: list of HTTP status code that you want to ignore :arg ignore_status: list of HTTP status code that you want to ignore
""" """
async def map_actions(): async def map_actions() -> Any:
async for item in aiter(actions): async for item in aiter(actions):
yield expand_action_callback(item) yield expand_action_callback(item)
@@ -185,7 +204,8 @@ async def async_streaming_bulk(
map_actions(), chunk_size, max_chunk_bytes, client.transport.serializer map_actions(), chunk_size, max_chunk_bytes, client.transport.serializer
): ):
for attempt in range(max_retries + 1): for attempt in range(max_retries + 1):
to_retry, to_retry_data = [], [] to_retry: Any = []
to_retry_data: Any = []
if attempt: if attempt:
await asyncio.sleep( await asyncio.sleep(
min(max_backoff, initial_backoff * 2 ** (attempt - 1)) min(max_backoff, initial_backoff * 2 ** (attempt - 1))
@@ -237,8 +257,13 @@ async def async_streaming_bulk(
async def async_bulk( async def async_bulk(
client, actions, stats_only=False, ignore_status=(), *args, **kwargs client: Any,
): actions: Union[Iterable[Any], AsyncIterable[Any]],
stats_only: bool = False,
ignore_status: Optional[Union[int, Collection[int]]] = (),
*args: Any,
**kwargs: Any
) -> Tuple[int, Union[int, List[Any]]]:
""" """
Helper for the :meth:`~opensearchpy.AsyncOpenSearch.bulk` api that provides Helper for the :meth:`~opensearchpy.AsyncOpenSearch.bulk` api that provides
a more human friendly interface - it consumes an iterator of actions and a more human friendly interface - it consumes an iterator of actions and
@@ -274,7 +299,7 @@ async def async_bulk(
# make streaming_bulk yield successful results so we can count them # make streaming_bulk yield successful results so we can count them
kwargs["yield_ok"] = True kwargs["yield_ok"] = True
async for ok, item in async_streaming_bulk( async for ok, item in async_streaming_bulk( # type: ignore
client, actions, ignore_status=ignore_status, *args, **kwargs client, actions, ignore_status=ignore_status, *args, **kwargs
): ):
# go through request-response pairs and detect failures # go through request-response pairs and detect failures
@@ -289,17 +314,17 @@ async def async_bulk(
async def async_scan( async def async_scan(
client, client: Any,
query=None, query: Any = None,
scroll="5m", scroll: str = "5m",
raise_on_error=True, raise_on_error: bool = True,
preserve_order=False, preserve_order: bool = False,
size=1000, size: int = 1000,
request_timeout=None, request_timeout: Any = None,
clear_scroll=True, clear_scroll: bool = True,
scroll_kwargs=None, scroll_kwargs: Any = None,
**kwargs **kwargs: Any
): ) -> Any:
""" """
Simple abstraction on top of the Simple abstraction on top of the
:meth:`~opensearchpy.AsyncOpenSearch.scroll` api - a simple iterator that :meth:`~opensearchpy.AsyncOpenSearch.scroll` api - a simple iterator that
@@ -409,16 +434,16 @@ async def async_scan(
async def async_reindex( async def async_reindex(
client, client: Any,
source_index, source_index: Union[str, Collection[str]],
target_index, target_index: str,
query=None, query: Any = None,
target_client=None, target_client: Any = None,
chunk_size=500, chunk_size: int = 500,
scroll="5m", scroll: str = "5m",
scan_kwargs={}, scan_kwargs: Any = {},
bulk_kwargs={}, bulk_kwargs: Any = {},
): ) -> Tuple[int, Union[int, List[Any]]]:
""" """
Reindex all documents from one index that satisfy a given query Reindex all documents from one index that satisfy a given query
to another, potentially (if `target_client` is specified) on a different cluster. to another, potentially (if `target_client` is specified) on a different cluster.
@@ -454,7 +479,7 @@ async def async_reindex(
client, query=query, index=source_index, scroll=scroll, **scan_kwargs client, query=query, index=source_index, scroll=scroll, **scan_kwargs
) )
async def _change_doc_index(hits, index): async def _change_doc_index(hits: Any, index: Any) -> Any:
async for h in hits: async for h in hits:
h["_index"] = index h["_index"] = index
if "fields" in h: if "fields" in h:
-115
View File
@@ -1,115 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import logging
from typing import (
Any,
AsyncGenerator,
AsyncIterable,
Callable,
Collection,
Dict,
Iterable,
List,
Mapping,
Optional,
Tuple,
TypeVar,
Union,
)
from ...serializer import Serializer
from ..client import AsyncOpenSearch
logger: logging.Logger
T = TypeVar("T")
def _chunk_actions(
actions: Any, chunk_size: int, max_chunk_bytes: int, serializer: Serializer
) -> AsyncGenerator[Any, None]: ...
def _process_bulk_chunk(
client: AsyncOpenSearch,
bulk_actions: Any,
bulk_data: Any,
raise_on_exception: bool = ...,
raise_on_error: bool = ...,
ignore_status: Optional[Union[int, Collection[int]]] = ...,
*args: Any,
**kwargs: Any
) -> AsyncGenerator[Tuple[bool, Any], None]: ...
def aiter(x: Union[Iterable[T], AsyncIterable[T]]) -> AsyncGenerator[T, None]: ...
def azip(
*iterables: Union[Iterable[T], AsyncIterable[T]]
) -> AsyncGenerator[Tuple[T, ...], None]: ...
def async_streaming_bulk(
client: AsyncOpenSearch,
actions: Union[Iterable[Any], AsyncIterable[Any]],
chunk_size: int = ...,
max_chunk_bytes: int = ...,
raise_on_error: bool = ...,
expand_action_callback: Callable[[Any], Tuple[Dict[str, Any], Optional[Any]]] = ...,
raise_on_exception: bool = ...,
max_retries: int = ...,
initial_backoff: Union[float, int] = ...,
max_backoff: Union[float, int] = ...,
yield_ok: bool = ...,
ignore_status: Optional[Union[int, Collection[int]]] = ...,
*args: Any,
**kwargs: Any
) -> AsyncGenerator[Tuple[bool, Any], None]: ...
async def async_bulk(
client: AsyncOpenSearch,
actions: Union[Iterable[Any], AsyncIterable[Any]],
stats_only: bool = ...,
ignore_status: Optional[Union[int, Collection[int]]] = ...,
*args: Any,
**kwargs: Any
) -> Tuple[int, Union[int, List[Any]]]: ...
def async_scan(
client: AsyncOpenSearch,
query: Optional[Any] = ...,
scroll: str = ...,
raise_on_error: bool = ...,
preserve_order: bool = ...,
size: int = ...,
request_timeout: Optional[Union[float, int]] = ...,
clear_scroll: bool = ...,
scroll_kwargs: Optional[Mapping[str, Any]] = ...,
**kwargs: Any
) -> AsyncGenerator[dict[str, Any], None]: ...
async def async_reindex(
client: AsyncOpenSearch,
source_index: Union[str, Collection[str]],
target_index: str,
query: Any = ...,
target_client: Optional[AsyncOpenSearch] = ...,
chunk_size: int = ...,
scroll: str = ...,
scan_kwargs: Optional[Mapping[str, Any]] = ...,
bulk_kwargs: Optional[Mapping[str, Any]] = ...,
) -> Tuple[int, Union[int, List[Any]]]: ...
+84 -48
View File
@@ -8,15 +8,13 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
try: import collections.abc as collections_abc
import collections.abc as collections_abc # only works on python 3.3+
except ImportError:
import collections as collections_abc
from fnmatch import fnmatch from fnmatch import fnmatch
from typing import Any, Optional, Sequence, Tuple, Type
from six import add_metaclass from six import add_metaclass
from opensearchpy._async.client import AsyncOpenSearch
from opensearchpy._async.helpers.index import AsyncIndex from opensearchpy._async.helpers.index import AsyncIndex
from opensearchpy._async.helpers.search import AsyncSearch from opensearchpy._async.helpers.search import AsyncSearch
from opensearchpy.connection.async_connections import get_connection from opensearchpy.connection.async_connections import get_connection
@@ -35,7 +33,12 @@ class AsyncIndexMeta(DocumentMeta):
# class, only user defined subclasses should have an _index attr # class, only user defined subclasses should have an _index attr
_document_initialized = False _document_initialized = False
def __new__(cls, name, bases, attrs): def __new__(
cls,
name: str,
bases: Tuple[Type[ObjectBase]],
attrs: Any,
) -> Any:
new_cls = super(AsyncIndexMeta, cls).__new__(cls, name, bases, attrs) new_cls = super(AsyncIndexMeta, cls).__new__(cls, name, bases, attrs)
if cls._document_initialized: if cls._document_initialized:
index_opts = attrs.pop("Index", None) index_opts = attrs.pop("Index", None)
@@ -46,7 +49,7 @@ class AsyncIndexMeta(DocumentMeta):
return new_cls return new_cls
@classmethod @classmethod
def construct_index(cls, opts, bases): def construct_index(cls, opts: Any, bases: Any) -> Any:
if opts is None: if opts is None:
for b in bases: for b in bases:
if hasattr(b, "_index"): if hasattr(b, "_index"):
@@ -72,25 +75,27 @@ class AsyncDocument(ObjectBase):
""" """
@classmethod @classmethod
def _matches(cls, hit): def _matches(cls: Any, hit: Any) -> bool:
if cls._index._name is None: if cls._index._name is None:
return True return True
return fnmatch(hit.get("_index", ""), cls._index._name) return fnmatch(hit.get("_index", ""), cls._index._name)
@classmethod @classmethod
def _get_using(cls, using=None): def _get_using(cls: Any, using: Any = None) -> Any:
return using or cls._index._using return using or cls._index._using
@classmethod @classmethod
async def _get_connection(cls, using=None): async def _get_connection(cls, using: Optional[AsyncOpenSearch] = None) -> Any:
return await get_connection(cls._get_using(using)) return await get_connection(cls._get_using(using))
@classmethod @classmethod
def _default_index(cls, index=None): def _default_index(cls: Any, index: Any = None) -> Any:
return index or cls._index._name return index or cls._index._name
@classmethod @classmethod
async def init(cls, index=None, using=None): async def init(
cls: Any, index: Optional[str] = None, using: Optional[AsyncOpenSearch] = None
) -> None:
""" """
Create the index and populate the mappings in opensearch. Create the index and populate the mappings in opensearch.
""" """
@@ -99,7 +104,9 @@ class AsyncDocument(ObjectBase):
i = i.clone(name=index) i = i.clone(name=index)
await i.save(using=using) await i.save(using=using)
def _get_index(self, index=None, required=True): def _get_index(
self, index: Optional[str] = None, required: Optional[bool] = True
) -> Any:
if index is None: if index is None:
index = getattr(self.meta, "index", None) index = getattr(self.meta, "index", None)
if index is None: if index is None:
@@ -110,7 +117,7 @@ class AsyncDocument(ObjectBase):
raise ValidationException("You cannot write to a wildcard index.") raise ValidationException("You cannot write to a wildcard index.")
return index return index
def __repr__(self): def __repr__(self) -> str:
return "{}({})".format( return "{}({})".format(
self.__class__.__name__, self.__class__.__name__,
", ".join( ", ".join(
@@ -121,7 +128,9 @@ class AsyncDocument(ObjectBase):
) )
@classmethod @classmethod
def search(cls, using=None, index=None): def search(
cls, using: Optional[AsyncOpenSearch] = None, index: Optional[str] = None
) -> AsyncSearch:
""" """
Create an :class:`~opensearchpy.AsyncSearch` instance that will search Create an :class:`~opensearchpy.AsyncSearch` instance that will search
over this ``Document``. over this ``Document``.
@@ -131,7 +140,13 @@ class AsyncDocument(ObjectBase):
) )
@classmethod @classmethod
async def get(cls, id, using=None, index=None, **kwargs): async def get( # type: ignore
cls,
id: str,
using: Optional[AsyncOpenSearch] = None,
index: Optional[str] = None,
**kwargs: Any,
) -> Any:
""" """
Retrieve a single document from opensearch using its ``id``. Retrieve a single document from opensearch using its ``id``.
@@ -150,7 +165,13 @@ class AsyncDocument(ObjectBase):
return cls.from_opensearch(doc) return cls.from_opensearch(doc)
@classmethod @classmethod
async def exists(cls, id, using=None, index=None, **kwargs): async def exists(
cls,
id: str,
using: Optional[AsyncOpenSearch] = None,
index: Optional[str] = None,
**kwargs: Any,
) -> Any:
""" """
check if exists a single document from opensearch using its ``id``. check if exists a single document from opensearch using its ``id``.
@@ -167,13 +188,19 @@ class AsyncDocument(ObjectBase):
@classmethod @classmethod
async def mget( async def mget(
cls, docs, using=None, index=None, raise_on_error=True, missing="none", **kwargs cls,
): docs: Sequence[str],
r""" using: Optional[AsyncOpenSearch] = None,
Retrieve multiple document by their ``id``\s. Returns a list of instances index: Optional[str] = None,
raise_on_error: Optional[bool] = True,
missing: Optional[str] = "none",
**kwargs: Any,
) -> Any:
"""
Retrieve multiple document by their ``id``'s. Returns a list of instances
in the same order as requested. in the same order as requested.
:arg docs: list of ``id``\s of the documents to be retrieved or a list :arg docs: list of ``id``'s of the documents to be retrieved or a list
of document specifications as per of document specifications as per
https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/multi-get/ https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/multi-get/
:arg index: opensearch index to use, if the ``Document`` is :arg index: opensearch index to use, if the ``Document`` is
@@ -197,7 +224,9 @@ class AsyncDocument(ObjectBase):
} }
results = await opensearch.mget(body, index=cls._default_index(index), **kwargs) results = await opensearch.mget(body, index=cls._default_index(index), **kwargs)
objs, error_docs, missing_docs = [], [], [] objs: Any = []
error_docs: Any = []
missing_docs: Any = []
for doc in results["docs"]: for doc in results["docs"]:
if doc.get("found"): if doc.get("found"):
if error_docs or missing_docs: if error_docs or missing_docs:
@@ -230,7 +259,12 @@ class AsyncDocument(ObjectBase):
raise NotFoundError(404, message, {"docs": missing_docs}) raise NotFoundError(404, message, {"docs": missing_docs})
return objs return objs
async def delete(self, using=None, index=None, **kwargs): async def delete(
self,
using: Optional[AsyncOpenSearch] = None,
index: Optional[str] = None,
**kwargs: Any,
) -> Any:
""" """
Delete the instance in opensearch. Delete the instance in opensearch.
@@ -253,7 +287,9 @@ class AsyncDocument(ObjectBase):
doc_meta.update(kwargs) doc_meta.update(kwargs)
await opensearch.delete(index=self._get_index(index), **doc_meta) await opensearch.delete(index=self._get_index(index), **doc_meta)
def to_dict(self, include_meta=False, skip_empty=True): def to_dict( # type: ignore
self, include_meta: Optional[bool] = False, skip_empty: Optional[bool] = True
) -> Any:
""" """
Serialize the instance into a dictionary so that it can be saved in opensearch. Serialize the instance into a dictionary so that it can be saved in opensearch.
@@ -264,7 +300,7 @@ class AsyncDocument(ObjectBase):
``[]``, ``{}``) to be left on the document. Those values will be ``[]``, ``{}``) to be left on the document. Those values will be
stripped out otherwise as they make no difference in opensearch. stripped out otherwise as they make no difference in opensearch.
""" """
d = super(AsyncDocument, self).to_dict(skip_empty=skip_empty) d = super(AsyncDocument, self).to_dict(skip_empty)
if not include_meta: if not include_meta:
return d return d
@@ -280,19 +316,19 @@ class AsyncDocument(ObjectBase):
async def update( async def update(
self, self,
using=None, using: Optional[AsyncOpenSearch] = None,
index=None, index: Optional[str] = None,
detect_noop=True, detect_noop: Optional[bool] = True,
doc_as_upsert=False, doc_as_upsert: Optional[bool] = False,
refresh=False, refresh: Optional[bool] = False,
retry_on_conflict=None, retry_on_conflict: Optional[bool] = None,
script=None, script: Any = None,
script_id=None, script_id: Optional[str] = None,
scripted_upsert=False, scripted_upsert: Optional[bool] = False,
upsert=None, upsert: Optional[bool] = None,
return_doc_meta=False, return_doc_meta: Optional[bool] = False,
**fields **fields: Any,
): ) -> Any:
""" """
Partial update of the document, specify fields you wish to update and Partial update of the document, specify fields you wish to update and
both the instance and the document in opensearch will be updated:: both the instance and the document in opensearch will be updated::
@@ -321,7 +357,7 @@ class AsyncDocument(ObjectBase):
:return operation result noop/updated :return operation result noop/updated
""" """
body = { body: Any = {
"doc_as_upsert": doc_as_upsert, "doc_as_upsert": doc_as_upsert,
"detect_noop": detect_noop, "detect_noop": detect_noop,
} }
@@ -385,13 +421,13 @@ class AsyncDocument(ObjectBase):
async def save( async def save(
self, self,
using=None, using: Optional[AsyncOpenSearch] = None,
index=None, index: Optional[str] = None,
validate=True, validate: Optional[bool] = True,
skip_empty=True, skip_empty: Optional[bool] = True,
return_doc_meta=False, return_doc_meta: Optional[bool] = False,
**kwargs **kwargs: Any,
): ) -> Any:
""" """
Save the document into opensearch. If the document doesn't exist it Save the document into opensearch. If the document doesn't exist it
is created, it is overwritten otherwise. Returns ``True`` if this is created, it is overwritten otherwise. Returns ``True`` if this
@@ -428,7 +464,7 @@ class AsyncDocument(ObjectBase):
meta = await opensearch.index( meta = await opensearch.index(
index=self._get_index(index), index=self._get_index(index),
body=self.to_dict(skip_empty=skip_empty), body=self.to_dict(skip_empty=skip_empty),
**doc_meta **doc_meta,
) )
# update meta information from OpenSearch # update meta information from OpenSearch
for k in META_FIELDS: for k in META_FIELDS:
-15
View File
@@ -1,15 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from opensearchpy.helpers.document import DocumentMeta
from opensearchpy.helpers.utils import ObjectBase
class AsyncIndexMeta(DocumentMeta): ...
class AsyncDocument(ObjectBase): ...
+22 -20
View File
@@ -9,6 +9,8 @@
# GitHub history for details. # GitHub history for details.
from typing import Any
from six import iteritems, itervalues from six import iteritems, itervalues
from opensearchpy._async.helpers.search import AsyncSearch from opensearchpy._async.helpers.search import AsyncSearch
@@ -58,38 +60,38 @@ class AsyncFacetedSearch(object):
""" """
index = None index: Any = None
doc_types = None doc_types: Any = None
fields = None fields: Any = None
facets = {} facets: Any = {}
using = "default" using: str = "default"
def __init__(self, query=None, filters={}, sort=()): def __init__(self, query: Any = None, filters: Any = {}, sort: Any = ()) -> None:
""" """
:arg query: the text to search for :arg query: the text to search for
:arg filters: facet values to filter :arg filters: facet values to filter
:arg sort: sort information to be passed to :class:`~opensearchpy.AsyncSearch` :arg sort: sort information to be passed to :class:`~opensearchpy.AsyncSearch`
""" """
self._query = query self._query = query
self._filters = {} self._filters: Any = {}
self._sort = sort self._sort = sort
self.filter_values = {} self.filter_values: Any = {}
for name, value in iteritems(filters): for name, value in iteritems(filters):
self.add_filter(name, value) self.add_filter(name, value)
self._s = self.build_search() self._s = self.build_search()
async def count(self): async def count(self) -> Any:
return await self._s.count() return await self._s.count()
def __getitem__(self, k): def __getitem__(self, k: Any) -> Any:
self._s = self._s[k] self._s = self._s[k]
return self return self
def __iter__(self): def __iter__(self) -> Any:
return iter(self._s) return iter(self._s)
def add_filter(self, name, filter_values): def add_filter(self, name: Any, filter_values: Any) -> None:
""" """
Add a filter for a facet. Add a filter for a facet.
""" """
@@ -111,7 +113,7 @@ class AsyncFacetedSearch(object):
self._filters[name] = f self._filters[name] = f
def search(self): def search(self) -> Any:
""" """
Returns the base Search object to which the facets are added. Returns the base Search object to which the facets are added.
@@ -121,7 +123,7 @@ class AsyncFacetedSearch(object):
s = AsyncSearch(doc_type=self.doc_types, index=self.index, using=self.using) s = AsyncSearch(doc_type=self.doc_types, index=self.index, using=self.using)
return s.response_class(FacetedResponse) return s.response_class(FacetedResponse)
def query(self, search, query): def query(self, search: Any, query: Any) -> Any:
""" """
Add query part to ``search``. Add query part to ``search``.
@@ -134,7 +136,7 @@ class AsyncFacetedSearch(object):
return search.query("multi_match", query=query) return search.query("multi_match", query=query)
return search return search
def aggregate(self, search): def aggregate(self, search: Any) -> Any:
""" """
Add aggregations representing the facets selected, including potential Add aggregations representing the facets selected, including potential
filters. filters.
@@ -150,7 +152,7 @@ class AsyncFacetedSearch(object):
f, agg f, agg
) )
def filter(self, search): def filter(self, search: Any) -> Any:
""" """
Add a ``post_filter`` to the search request narrowing the results based Add a ``post_filter`` to the search request narrowing the results based
on the facet filters. on the facet filters.
@@ -163,7 +165,7 @@ class AsyncFacetedSearch(object):
post_filter &= f post_filter &= f
return search.post_filter(post_filter) return search.post_filter(post_filter)
def highlight(self, search): def highlight(self, search: Any) -> Any:
""" """
Add highlighting for all the fields Add highlighting for all the fields
""" """
@@ -171,7 +173,7 @@ class AsyncFacetedSearch(object):
*(f if "^" not in f else f.split("^", 1)[0] for f in self.fields) *(f if "^" not in f else f.split("^", 1)[0] for f in self.fields)
) )
def sort(self, search): def sort(self, search: Any) -> Any:
""" """
Add sorting information to the request. Add sorting information to the request.
""" """
@@ -179,7 +181,7 @@ class AsyncFacetedSearch(object):
search = search.sort(*self._sort) search = search.sort(*self._sort)
return search return search
def build_search(self): def build_search(self) -> Any:
""" """
Construct the ``AsyncSearch`` object. Construct the ``AsyncSearch`` object.
""" """
@@ -192,7 +194,7 @@ class AsyncFacetedSearch(object):
self.aggregate(s) self.aggregate(s)
return s return s
async def execute(self): async def execute(self) -> Any:
""" """
Execute the search and return the response. Execute the search and return the response.
""" """
@@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
class AsyncFacetedSearch(object): ...
+68 -57
View File
@@ -8,6 +8,8 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
from typing import Any
from opensearchpy._async.helpers.mapping import AsyncMapping from opensearchpy._async.helpers.mapping import AsyncMapping
from opensearchpy._async.helpers.search import AsyncSearch from opensearchpy._async.helpers.search import AsyncSearch
from opensearchpy._async.helpers.update_by_query import AsyncUpdateByQuery from opensearchpy._async.helpers.update_by_query import AsyncUpdateByQuery
@@ -18,7 +20,14 @@ from opensearchpy.helpers.utils import merge
class AsyncIndexTemplate(object): class AsyncIndexTemplate(object):
def __init__(self, name, template, index=None, order=None, **kwargs): def __init__(
self,
name: Any,
template: Any,
index: Any = None,
order: Any = None,
**kwargs: Any
) -> None:
if index is None: if index is None:
self._index = AsyncIndex(template, **kwargs) self._index = AsyncIndex(template, **kwargs)
else: else:
@@ -32,17 +41,17 @@ class AsyncIndexTemplate(object):
self._template_name = name self._template_name = name
self.order = order self.order = order
def __getattr__(self, attr_name): def __getattr__(self, attr_name: Any) -> Any:
return getattr(self._index, attr_name) return getattr(self._index, attr_name)
def to_dict(self): def to_dict(self) -> Any:
d = self._index.to_dict() d = self._index.to_dict()
d["index_patterns"] = [self._index._name] d["index_patterns"] = [self._index._name]
if self.order is not None: if self.order is not None:
d["order"] = self.order d["order"] = self.order
return d return d
async def save(self, using=None): async def save(self, using: Any = None) -> Any:
opensearch = await get_connection(using or self._index._using) opensearch = await get_connection(using or self._index._using)
return await opensearch.indices.put_template( return await opensearch.indices.put_template(
name=self._template_name, body=self.to_dict() name=self._template_name, body=self.to_dict()
@@ -50,25 +59,27 @@ class AsyncIndexTemplate(object):
class AsyncIndex(object): class AsyncIndex(object):
def __init__(self, name, using="default"): def __init__(self, name: Any, using: str = "default") -> None:
""" """
:arg name: name of the index :arg name: name of the index
:arg using: connection alias to use, defaults to ``'default'`` :arg using: connection alias to use, defaults to ``'default'``
""" """
self._name = name self._name = name
self._doc_types = [] self._doc_types: Any = []
self._using = using self._using = using
self._settings = {} self._settings: Any = {}
self._aliases = {} self._aliases: Any = {}
self._analysis = {} self._analysis: Any = {}
self._mapping = None self._mapping: Any = None
def get_or_create_mapping(self): def get_or_create_mapping(self) -> Any:
if self._mapping is None: if self._mapping is None:
self._mapping = AsyncMapping() self._mapping = AsyncMapping()
return self._mapping return self._mapping
def as_template(self, template_name, pattern=None, order=None): def as_template(
self, template_name: Any, pattern: Any = None, order: Any = None
) -> Any:
# TODO: should we allow pattern to be a top-level arg? # TODO: should we allow pattern to be a top-level arg?
# or maybe have an IndexPattern that allows for it and have # or maybe have an IndexPattern that allows for it and have
# AsyncDocument._index be that? # AsyncDocument._index be that?
@@ -76,7 +87,7 @@ class AsyncIndex(object):
template_name, pattern or self._name, index=self, order=order template_name, pattern or self._name, index=self, order=order
) )
def resolve_nested(self, field_path): def resolve_nested(self, field_path: Any) -> Any:
for doc in self._doc_types: for doc in self._doc_types:
nested, field = doc._doc_type.mapping.resolve_nested(field_path) nested, field = doc._doc_type.mapping.resolve_nested(field_path)
if field is not None: if field is not None:
@@ -85,7 +96,7 @@ class AsyncIndex(object):
return self._mapping.resolve_nested(field_path) return self._mapping.resolve_nested(field_path)
return (), None return (), None
def resolve_field(self, field_path): def resolve_field(self, field_path: Any) -> Any:
for doc in self._doc_types: for doc in self._doc_types:
field = doc._doc_type.mapping.resolve_field(field_path) field = doc._doc_type.mapping.resolve_field(field_path)
if field is not None: if field is not None:
@@ -94,12 +105,12 @@ class AsyncIndex(object):
return self._mapping.resolve_field(field_path) return self._mapping.resolve_field(field_path)
return None return None
async def load_mappings(self, using=None): async def load_mappings(self, using: Any = None) -> None:
await self.get_or_create_mapping().update_from_opensearch( await self.get_or_create_mapping().update_from_opensearch(
self._name, using=using or self._using self._name, using=using or self._using
) )
def clone(self, name=None, using=None): def clone(self, name: Any = None, using: Any = None) -> Any:
""" """
Create a copy of the instance with another name or connection alias. Create a copy of the instance with another name or connection alias.
Useful for creating multiple indices with shared configuration:: Useful for creating multiple indices with shared configuration::
@@ -123,14 +134,14 @@ class AsyncIndex(object):
i._mapping = self._mapping._clone() i._mapping = self._mapping._clone()
return i return i
async def _get_connection(self, using=None): async def _get_connection(self, using: Any = None) -> Any:
if self._name is None: if self._name is None:
raise ValueError("You cannot perform API calls on the default index.") raise ValueError("You cannot perform API calls on the default index.")
return await get_connection(using or self._using) return await get_connection(using or self._using)
connection = property(_get_connection) connection = property(_get_connection)
def mapping(self, mapping): def mapping(self, mapping: Any) -> None:
""" """
Associate a mapping (an instance of Associate a mapping (an instance of
:class:`~opensearchpy.AsyncMapping`) with this index. :class:`~opensearchpy.AsyncMapping`) with this index.
@@ -139,7 +150,7 @@ class AsyncIndex(object):
""" """
self.get_or_create_mapping().update(mapping) self.get_or_create_mapping().update(mapping)
def document(self, document): def document(self, document: Any) -> Any:
""" """
Associate a :class:`~opensearchpy.AsyncDocument` subclass with an index. Associate a :class:`~opensearchpy.AsyncDocument` subclass with an index.
This means that, when this index is created, it will contain the This means that, when this index is created, it will contain the
@@ -170,7 +181,7 @@ class AsyncIndex(object):
return document return document
def settings(self, **kwargs): def settings(self, **kwargs: Any) -> "AsyncIndex":
""" """
Add settings to the index:: Add settings to the index::
@@ -183,7 +194,7 @@ class AsyncIndex(object):
self._settings.update(kwargs) self._settings.update(kwargs)
return self return self
def aliases(self, **kwargs): def aliases(self, **kwargs: Any) -> "AsyncIndex":
""" """
Add aliases to the index definition:: Add aliases to the index definition::
@@ -193,7 +204,7 @@ class AsyncIndex(object):
self._aliases.update(kwargs) self._aliases.update(kwargs)
return self return self
def analyzer(self, *args, **kwargs): def analyzer(self, *args: Any, **kwargs: Any) -> Any:
""" """
Explicitly add an analyzer to an index. Note that all custom analyzers Explicitly add an analyzer to an index. Note that all custom analyzers
defined in mappings will also be created. This is useful for search analyzers. defined in mappings will also be created. This is useful for search analyzers.
@@ -220,14 +231,14 @@ class AsyncIndex(object):
# merge the definition # merge the definition
merge(self._analysis, d, True) merge(self._analysis, d, True)
def to_dict(self): def to_dict(self) -> Any:
out = {} out = {}
if self._settings: if self._settings:
out["settings"] = self._settings out["settings"] = self._settings
if self._aliases: if self._aliases:
out["aliases"] = self._aliases out["aliases"] = self._aliases
mappings = self._mapping.to_dict() if self._mapping else {} mappings: Any = self._mapping.to_dict() if self._mapping else {}
analysis = self._mapping._collect_analysis() if self._mapping else {} analysis: Any = self._mapping._collect_analysis() if self._mapping else {}
for d in self._doc_types: for d in self._doc_types:
mapping = d._doc_type.mapping mapping = d._doc_type.mapping
merge(mappings, mapping.to_dict(), True) merge(mappings, mapping.to_dict(), True)
@@ -239,7 +250,7 @@ class AsyncIndex(object):
out.setdefault("settings", {})["analysis"] = analysis out.setdefault("settings", {})["analysis"] = analysis
return out return out
def search(self, using=None): def search(self, using: Any = None) -> Any:
""" """
Return a :class:`~opensearchpy.AsyncSearch` object searching over the Return a :class:`~opensearchpy.AsyncSearch` object searching over the
index (or all the indices belonging to this template) and its index (or all the indices belonging to this template) and its
@@ -249,7 +260,7 @@ class AsyncIndex(object):
using=using or self._using, index=self._name, doc_type=self._doc_types using=using or self._using, index=self._name, doc_type=self._doc_types
) )
def updateByQuery(self, using=None): def updateByQuery(self, using: Any = None) -> Any:
""" """
Return a :class:`~opensearchpy.AsyncUpdateByQuery` object searching over the index Return a :class:`~opensearchpy.AsyncUpdateByQuery` object searching over the index
(or all the indices belonging to this template) and updating Documents that match (or all the indices belonging to this template) and updating Documents that match
@@ -263,7 +274,7 @@ class AsyncIndex(object):
index=self._name, index=self._name,
) )
async def create(self, using=None, **kwargs): async def create(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Creates the index in opensearch. Creates the index in opensearch.
@@ -274,13 +285,13 @@ class AsyncIndex(object):
index=self._name, body=self.to_dict(), **kwargs index=self._name, body=self.to_dict(), **kwargs
) )
async def is_closed(self, using=None): async def is_closed(self, using: Any = None) -> Any:
state = await (await self._get_connection(using)).cluster.state( state = await (await self._get_connection(using)).cluster.state(
index=self._name, metric="metadata" index=self._name, metric="metadata"
) )
return state["metadata"]["indices"][self._name]["state"] == "close" return state["metadata"]["indices"][self._name]["state"] == "close"
async def save(self, using=None): async def save(self, using: Any = None) -> Any:
""" """
Sync the index definition with opensearch, creating the index if it Sync the index definition with opensearch, creating the index if it
doesn't exist and updating its settings and mappings if it does. doesn't exist and updating its settings and mappings if it does.
@@ -334,7 +345,7 @@ class AsyncIndex(object):
if mappings: if mappings:
await self.put_mapping(using=using, body=mappings) await self.put_mapping(using=using, body=mappings)
async def analyze(self, using=None, **kwargs): async def analyze(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Perform the analysis process on a text and return the tokens breakdown Perform the analysis process on a text and return the tokens breakdown
of the text. of the text.
@@ -346,7 +357,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def refresh(self, using=None, **kwargs): async def refresh(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Performs a refresh operation on the index. Performs a refresh operation on the index.
@@ -357,7 +368,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def flush(self, using=None, **kwargs): async def flush(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Performs a flush operation on the index. Performs a flush operation on the index.
@@ -368,7 +379,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def get(self, using=None, **kwargs): async def get(self, using: Any = None, **kwargs: Any) -> Any:
""" """
The get index API allows to retrieve information about the index. The get index API allows to retrieve information about the index.
@@ -379,7 +390,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def open(self, using=None, **kwargs): async def open(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Opens the index in opensearch. Opens the index in opensearch.
@@ -390,7 +401,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def close(self, using=None, **kwargs): async def close(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Closes the index in opensearch. Closes the index in opensearch.
@@ -401,7 +412,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def delete(self, using=None, **kwargs): async def delete(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Deletes the index in opensearch. Deletes the index in opensearch.
@@ -412,7 +423,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def exists(self, using=None, **kwargs): async def exists(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Returns ``True`` if the index already exists in opensearch. Returns ``True`` if the index already exists in opensearch.
@@ -423,7 +434,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def put_mapping(self, using=None, **kwargs): async def put_mapping(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Register specific mapping definition for a specific type. Register specific mapping definition for a specific type.
@@ -434,7 +445,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def get_mapping(self, using=None, **kwargs): async def get_mapping(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Retrieve specific mapping definition for a specific type. Retrieve specific mapping definition for a specific type.
@@ -445,7 +456,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def get_field_mapping(self, using=None, **kwargs): async def get_field_mapping(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Retrieve mapping definition of a specific field. Retrieve mapping definition of a specific field.
@@ -456,7 +467,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def put_alias(self, using=None, **kwargs): async def put_alias(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Create an alias for the index. Create an alias for the index.
@@ -467,7 +478,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def exists_alias(self, using=None, **kwargs): async def exists_alias(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Return a boolean indicating whether given alias exists for this index. Return a boolean indicating whether given alias exists for this index.
@@ -478,7 +489,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def get_alias(self, using=None, **kwargs): async def get_alias(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Retrieve a specified alias. Retrieve a specified alias.
@@ -489,7 +500,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def delete_alias(self, using=None, **kwargs): async def delete_alias(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Delete specific alias. Delete specific alias.
@@ -500,7 +511,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def get_settings(self, using=None, **kwargs): async def get_settings(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Retrieve settings for the index. Retrieve settings for the index.
@@ -511,7 +522,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def put_settings(self, using=None, **kwargs): async def put_settings(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Change specific index level settings in real time. Change specific index level settings in real time.
@@ -522,7 +533,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def stats(self, using=None, **kwargs): async def stats(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Retrieve statistics on different operations happening on the index. Retrieve statistics on different operations happening on the index.
@@ -533,7 +544,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def segments(self, using=None, **kwargs): async def segments(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Provide low level segments information that a Lucene index (shard Provide low level segments information that a Lucene index (shard
level) is built with. level) is built with.
@@ -545,7 +556,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def validate_query(self, using=None, **kwargs): async def validate_query(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Validate a potentially expensive query without executing it. Validate a potentially expensive query without executing it.
@@ -556,7 +567,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def clear_cache(self, using=None, **kwargs): async def clear_cache(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Clear all caches or specific cached associated with the index. Clear all caches or specific cached associated with the index.
@@ -567,7 +578,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def recovery(self, using=None, **kwargs): async def recovery(self, using: Any = None, **kwargs: Any) -> Any:
""" """
The indices recovery API provides insight into on-going shard The indices recovery API provides insight into on-going shard
recoveries for the index. recoveries for the index.
@@ -579,7 +590,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def upgrade(self, using=None, **kwargs): async def upgrade(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Upgrade the index to the latest format. Upgrade the index to the latest format.
@@ -590,7 +601,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def get_upgrade(self, using=None, **kwargs): async def get_upgrade(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Monitor how much of the index is upgraded. Monitor how much of the index is upgraded.
@@ -601,7 +612,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def shard_stores(self, using=None, **kwargs): async def shard_stores(self, using: Any = None, **kwargs: Any) -> Any:
""" """
Provides store information for shard copies of the index. Store Provides store information for shard copies of the index. Store
information reports on which nodes shard copies exist, the shard copy information reports on which nodes shard copies exist, the shard copy
@@ -615,7 +626,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def forcemerge(self, using=None, **kwargs): async def forcemerge(self, using: Any = None, **kwargs: Any) -> Any:
""" """
The force merge API allows to force merging of the index through an The force merge API allows to force merging of the index through an
API. The merge relates to the number of segments a Lucene index holds API. The merge relates to the number of segments a Lucene index holds
@@ -633,7 +644,7 @@ class AsyncIndex(object):
index=self._name, **kwargs index=self._name, **kwargs
) )
async def shrink(self, using=None, **kwargs): async def shrink(self, using: Any = None, **kwargs: Any) -> Any:
""" """
The shrink index API allows you to shrink an existing index into a new The shrink index API allows you to shrink an existing index into a new
index with fewer primary shards. The number of primary shards in the index with fewer primary shards. The number of primary shards in the
-12
View File
@@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
class AsyncIndexTemplate(object): ...
class AsyncIndex(object): ...
+25 -25
View File
@@ -8,12 +8,9 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
try: import collections.abc as collections_abc
import collections.abc as collections_abc # only works on python 3.3+
except ImportError:
import collections as collections_abc
from itertools import chain from itertools import chain
from typing import Any
from six import iteritems from six import iteritems
@@ -23,25 +20,28 @@ from opensearchpy.helpers.mapping import META_FIELDS, Properties
class AsyncMapping(object): class AsyncMapping(object):
def __init__(self): _meta: Any
properties: Properties
def __init__(self) -> None:
self.properties = Properties() self.properties = Properties()
self._meta = {} self._meta = {}
def __repr__(self): def __repr__(self) -> str:
return "Mapping()" return "Mapping()"
def _clone(self): def _clone(self) -> Any:
m = AsyncMapping() m = AsyncMapping()
m.properties._params = self.properties._params.copy() m.properties._params = self.properties._params.copy()
return m return m
@classmethod @classmethod
async def from_opensearch(cls, index, using="default"): async def from_opensearch(cls, index: Any, using: str = "default") -> Any:
m = cls() m = cls()
await m.update_from_opensearch(index, using) await m.update_from_opensearch(index, using)
return m return m
def resolve_nested(self, field_path): def resolve_nested(self, field_path: str) -> Any:
field = self field = self
nested = [] nested = []
parts = field_path.split(".") parts = field_path.split(".")
@@ -54,18 +54,18 @@ class AsyncMapping(object):
nested.append(".".join(parts[: i + 1])) nested.append(".".join(parts[: i + 1]))
return nested, field return nested, field
def resolve_field(self, field_path): def resolve_field(self, field_path: Any) -> Any:
field = self field = self
for step in field_path.split("."): for step in field_path.split("."):
try: try:
field = field[step] field = field[step]
except KeyError: except KeyError:
return return None
return field return field
def _collect_analysis(self): def _collect_analysis(self) -> Any:
analysis = {} analysis: Any = {}
fields = [] fields: Any = []
if "_all" in self._meta: if "_all" in self._meta:
fields.append(Text(**self._meta["_all"])) fields.append(Text(**self._meta["_all"]))
@@ -91,20 +91,20 @@ class AsyncMapping(object):
return analysis return analysis
async def save(self, index, using="default"): async def save(self, index: Any, using: str = "default") -> Any:
from opensearchpy._async.helpers.index import AsyncIndex from opensearchpy._async.helpers.index import AsyncIndex
index = AsyncIndex(index, using=using) index = AsyncIndex(index, using=using)
index.mapping(self) index.mapping(self)
return await index.save() return await index.save()
async def update_from_opensearch(self, index, using="default"): async def update_from_opensearch(self, index: Any, using: str = "default") -> None:
opensearch = await get_connection(using) opensearch = await get_connection(using)
raw = await opensearch.indices.get_mapping(index=index) raw = await opensearch.indices.get_mapping(index=index)
_, raw = raw.popitem() _, raw = raw.popitem()
self._update_from_dict(raw["mappings"]) self._update_from_dict(raw["mappings"])
def _update_from_dict(self, raw): def _update_from_dict(self, raw: Any) -> None:
for name, definition in iteritems(raw.get("properties", {})): for name, definition in iteritems(raw.get("properties", {})):
self.field(name, definition) self.field(name, definition)
@@ -116,7 +116,7 @@ class AsyncMapping(object):
else: else:
self.meta(name, value) self.meta(name, value)
def update(self, mapping, update_only=False): def update(self, mapping: Any, update_only: bool = False) -> None:
for name in mapping: for name in mapping:
if update_only and name in self: if update_only and name in self:
# nested and inner objects, merge recursively # nested and inner objects, merge recursively
@@ -133,20 +133,20 @@ class AsyncMapping(object):
else: else:
self._meta.update(mapping._meta) self._meta.update(mapping._meta)
def __contains__(self, name): def __contains__(self, name: Any) -> bool:
return name in self.properties.properties return name in self.properties.properties
def __getitem__(self, name): def __getitem__(self, name: Any) -> Any:
return self.properties.properties[name] return self.properties.properties[name]
def __iter__(self): def __iter__(self) -> Any:
return iter(self.properties.properties) return iter(self.properties.properties)
def field(self, *args, **kwargs): def field(self, *args: Any, **kwargs: Any) -> "AsyncMapping":
self.properties.field(*args, **kwargs) self.properties.field(*args, **kwargs)
return self return self
def meta(self, name, params=None, **kwargs): def meta(self, name: Any, params: Any = None, **kwargs: Any) -> "AsyncMapping":
if not name.startswith("_") and name not in META_FIELDS: if not name.startswith("_") and name not in META_FIELDS:
name = "_" + name name = "_" + name
@@ -156,7 +156,7 @@ class AsyncMapping(object):
self._meta[name] = kwargs if params is None else params self._meta[name] = kwargs if params is None else params
return self return self
def to_dict(self): def to_dict(self) -> Any:
meta = self._meta meta = self._meta
# hard coded serialization of analyzers in _all # hard coded serialization of analyzers in _all
-11
View File
@@ -1,11 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
class AsyncMapping(object): ...
+37 -34
View File
@@ -9,6 +9,7 @@
# GitHub history for details. # GitHub history for details.
import copy import copy
from typing import Any, Sequence
from six import iteritems, string_types from six import iteritems, string_types
@@ -26,7 +27,7 @@ class AsyncSearch(Request):
query = ProxyDescriptor("query") query = ProxyDescriptor("query")
post_filter = ProxyDescriptor("post_filter") post_filter = ProxyDescriptor("post_filter")
def __init__(self, **kwargs): def __init__(self, **kwargs: Any) -> None:
""" """
Search request to opensearch. Search request to opensearch.
@@ -40,24 +41,24 @@ class AsyncSearch(Request):
super(AsyncSearch, self).__init__(**kwargs) super(AsyncSearch, self).__init__(**kwargs)
self.aggs = AggsProxy(self) self.aggs = AggsProxy(self)
self._sort = [] self._sort: Sequence[Any] = []
self._source = None self._source: Any = None
self._highlight = {} self._highlight: Any = {}
self._highlight_opts = {} self._highlight_opts: Any = {}
self._suggest = {} self._suggest: Any = {}
self._script_fields = {} self._script_fields: Any = {}
self._response_class = Response self._response_class: Any = Response
self._query_proxy = QueryProxy(self, "query") self._query_proxy = QueryProxy(self, "query")
self._post_filter_proxy = QueryProxy(self, "post_filter") self._post_filter_proxy = QueryProxy(self, "post_filter")
def filter(self, *args, **kwargs): def filter(self, *args: Any, **kwargs: Any) -> Any:
return self.query(Bool(filter=[Q(*args, **kwargs)])) return self.query(Bool(filter=[Q(*args, **kwargs)]))
def exclude(self, *args, **kwargs): def exclude(self, *args: Any, **kwargs: Any) -> Any:
return self.query(Bool(filter=[~Q(*args, **kwargs)])) return self.query(Bool(filter=[~Q(*args, **kwargs)]))
def __getitem__(self, n): def __getitem__(self, n: Any) -> Any:
""" """
Support slicing the `AsyncSearch` instance for pagination. Support slicing the `AsyncSearch` instance for pagination.
@@ -92,7 +93,7 @@ class AsyncSearch(Request):
return s return s
@classmethod @classmethod
def from_dict(cls, d): def from_dict(cls, d: Any) -> Any:
""" """
Construct a new `AsyncSearch` instance from a raw dict containing the search Construct a new `AsyncSearch` instance from a raw dict containing the search
body. Useful when migrating from raw dictionaries. body. Useful when migrating from raw dictionaries.
@@ -113,7 +114,7 @@ class AsyncSearch(Request):
s.update_from_dict(d) s.update_from_dict(d)
return s return s
def _clone(self): def _clone(self) -> Any:
""" """
Return a clone of the current search request. Performs a shallow copy Return a clone of the current search request. Performs a shallow copy
of all the underlying objects. Used internally by most state modifying of all the underlying objects. Used internally by most state modifying
@@ -136,7 +137,7 @@ class AsyncSearch(Request):
s.aggs._params = {"aggs": self.aggs._params["aggs"].copy()} s.aggs._params = {"aggs": self.aggs._params["aggs"].copy()}
return s return s
def response_class(self, cls): def response_class(self, cls: Any) -> Any:
""" """
Override the default wrapper used for the response. Override the default wrapper used for the response.
""" """
@@ -144,7 +145,7 @@ class AsyncSearch(Request):
s._response_class = cls s._response_class = cls
return s return s
def update_from_dict(self, d): def update_from_dict(self, d: Any) -> "AsyncSearch":
""" """
Apply options from a serialized body to the current instance. Modifies Apply options from a serialized body to the current instance. Modifies
the object in-place. Used mostly by ``from_dict``. the object in-place. Used mostly by ``from_dict``.
@@ -179,7 +180,7 @@ class AsyncSearch(Request):
self._extra.update(d) self._extra.update(d)
return self return self
def script_fields(self, **kwargs): def script_fields(self, **kwargs: Any) -> Any:
""" """
Define script fields to be calculated on hits. Define script fields to be calculated on hits.
@@ -205,7 +206,7 @@ class AsyncSearch(Request):
s._script_fields.update(kwargs) s._script_fields.update(kwargs)
return s return s
def source(self, fields=None, **kwargs): def source(self, fields: Any = None, **kwargs: Any) -> Any:
""" """
Selectively control how the _source field is returned. Selectively control how the _source field is returned.
@@ -250,7 +251,7 @@ class AsyncSearch(Request):
return s return s
def sort(self, *keys): def sort(self, *keys: Any) -> Any:
""" """
Add sorting information to the search request. If called without Add sorting information to the search request. If called without
arguments it will remove all sort requirements. Otherwise it will arguments it will remove all sort requirements. Otherwise it will
@@ -283,7 +284,7 @@ class AsyncSearch(Request):
s._sort.append(k) s._sort.append(k)
return s return s
def highlight_options(self, **kwargs): def highlight_options(self, **kwargs: Any) -> Any:
""" """
Update the global highlighting options used for this request. For Update the global highlighting options used for this request. For
example:: example::
@@ -295,7 +296,7 @@ class AsyncSearch(Request):
s._highlight_opts.update(kwargs) s._highlight_opts.update(kwargs)
return s return s
def highlight(self, *fields, **kwargs): def highlight(self, *fields: Any, **kwargs: Any) -> Any:
""" """
Request highlighting of some fields. All keyword arguments passed in will be Request highlighting of some fields. All keyword arguments passed in will be
used as parameters for all the fields in the ``fields`` parameter. Example:: used as parameters for all the fields in the ``fields`` parameter. Example::
@@ -335,7 +336,7 @@ class AsyncSearch(Request):
s._highlight[f] = kwargs s._highlight[f] = kwargs
return s return s
def suggest(self, name, text, **kwargs): def suggest(self, name: str, text: str, **kwargs: Any) -> Any:
""" """
Add a suggestions request to the search. Add a suggestions request to the search.
@@ -352,7 +353,7 @@ class AsyncSearch(Request):
s._suggest[name].update(kwargs) s._suggest[name].update(kwargs)
return s return s
def to_dict(self, count=False, **kwargs): def to_dict(self, count: bool = False, **kwargs: Any) -> Any:
""" """
Serialize the search into the dictionary that will be sent over as the Serialize the search into the dictionary that will be sent over as the
request's body. request's body.
@@ -396,7 +397,7 @@ class AsyncSearch(Request):
d.update(recursive_to_dict(kwargs)) d.update(recursive_to_dict(kwargs))
return d return d
async def count(self): async def count(self) -> Any:
""" """
Return the number of hits matching the query and filters. Note that Return the number of hits matching the query and filters. Note that
only the actual number is returned. only the actual number is returned.
@@ -412,7 +413,7 @@ class AsyncSearch(Request):
"count" "count"
] ]
async def execute(self, ignore_cache=False): async def execute(self, ignore_cache: bool = False) -> Any:
""" """
Execute the search and return an instance of ``Response`` wrapping all Execute the search and return an instance of ``Response`` wrapping all
the data. the data.
@@ -431,7 +432,7 @@ class AsyncSearch(Request):
) )
return self._response return self._response
async def scan(self): async def scan(self) -> Any:
""" """
Turn the search into a scan search and return a generator that will Turn the search into a scan search and return a generator that will
iterate over all the documents matching the query. iterate over all the documents matching the query.
@@ -449,7 +450,7 @@ class AsyncSearch(Request):
): ):
yield self._get_result(hit) yield self._get_result(hit)
async def delete(self): async def delete(self) -> Any:
""" """
delete() executes the query by delegating to delete_by_query() delete() executes the query by delegating to delete_by_query()
""" """
@@ -469,22 +470,22 @@ class AsyncMultiSearch(Request):
request. request.
""" """
def __init__(self, **kwargs): def __init__(self, **kwargs: Any) -> None:
super(AsyncMultiSearch, self).__init__(**kwargs) super(AsyncMultiSearch, self).__init__(**kwargs)
self._searches = [] self._searches: Any = []
def __getitem__(self, key): def __getitem__(self, key: Any) -> Any:
return self._searches[key] return self._searches[key]
def __iter__(self): def __iter__(self) -> Any:
return iter(self._searches) return iter(self._searches)
def _clone(self): def _clone(self) -> Any:
ms = super(AsyncMultiSearch, self)._clone() ms = super(AsyncMultiSearch, self)._clone()
ms._searches = self._searches[:] ms._searches = self._searches[:]
return ms return ms
def add(self, search): def add(self, search: Any) -> Any:
""" """
Adds a new :class:`~opensearchpy.AsyncSearch` object to the request:: Adds a new :class:`~opensearchpy.AsyncSearch` object to the request::
@@ -496,7 +497,7 @@ class AsyncMultiSearch(Request):
ms._searches.append(search) ms._searches.append(search)
return ms return ms
def to_dict(self): def to_dict(self) -> Any:
out = [] out = []
for s in self._searches: for s in self._searches:
meta = {} meta = {}
@@ -509,7 +510,9 @@ class AsyncMultiSearch(Request):
return out return out
async def execute(self, ignore_cache=False, raise_on_error=True): async def execute(
self, ignore_cache: bool = False, raise_on_error: bool = True
) -> Any:
""" """
Execute the multi search request and return a list of search results. Execute the multi search request and return a list of search results.
""" """
-14
View File
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from opensearchpy.helpers.search import Request
class AsyncSearch(Request): ...
class AsyncMultiSearch(Request): ...
+4 -6
View File
@@ -10,18 +10,16 @@
import os import os
import time import time
from typing import Any
from unittest import SkipTest from unittest import SkipTest
from opensearchpy import AsyncOpenSearch from opensearchpy import AsyncOpenSearch
from opensearchpy.exceptions import ConnectionError from opensearchpy.exceptions import ConnectionError
if "OPENSEARCH_URL" in os.environ: OPENSEARCH_URL = os.environ.get("OPENSEARCH_URL", "https://admin:admin@localhost:9200")
OPENSEARCH_URL = os.environ["OPENSEARCH_URL"]
else:
OPENSEARCH_URL = "https://admin:admin@localhost:9200"
async def get_test_client(nowait=False, **kwargs): async def get_test_client(nowait: bool = False, **kwargs: Any) -> Any:
# construct kwargs from the environment # construct kwargs from the environment
kw = {"timeout": 30} kw = {"timeout": 30}
@@ -32,7 +30,7 @@ async def get_test_client(nowait=False, **kwargs):
kw["connection_class"] = getattr(async_connection, "AIOHttpConnection") kw["connection_class"] = getattr(async_connection, "AIOHttpConnection")
kw.update(kwargs) kw.update(kwargs)
client = AsyncOpenSearch(OPENSEARCH_URL, **kw) client = AsyncOpenSearch(OPENSEARCH_URL, **kw) # type: ignore
# wait for yellow status # wait for yellow status
for _ in range(1 if nowait else 100): for _ in range(1 if nowait else 100):
-20
View File
@@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any
from _typeshed import Incomplete
from opensearchpy import AsyncOpenSearch as AsyncOpenSearch
from opensearchpy.exceptions import ConnectionError as ConnectionError
OPENSEARCH_URL: Incomplete
async def get_test_client(nowait: bool = ..., **kwargs: Any) -> Any: ...
+13 -11
View File
@@ -8,6 +8,8 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
from typing import Any
from opensearchpy.connection.async_connections import get_connection from opensearchpy.connection.async_connections import get_connection
from opensearchpy.helpers.query import Bool, Q from opensearchpy.helpers.query import Bool, Q
from opensearchpy.helpers.response import UpdateByQueryResponse from opensearchpy.helpers.response import UpdateByQueryResponse
@@ -18,7 +20,7 @@ from opensearchpy.helpers.utils import recursive_to_dict
class AsyncUpdateByQuery(Request): class AsyncUpdateByQuery(Request):
query = ProxyDescriptor("query") query = ProxyDescriptor("query")
def __init__(self, **kwargs): def __init__(self, **kwargs: Any) -> None:
""" """
Update by query request to opensearch. Update by query request to opensearch.
@@ -32,17 +34,17 @@ class AsyncUpdateByQuery(Request):
""" """
super(AsyncUpdateByQuery, self).__init__(**kwargs) super(AsyncUpdateByQuery, self).__init__(**kwargs)
self._response_class = UpdateByQueryResponse self._response_class = UpdateByQueryResponse
self._script = {} self._script: Any = {}
self._query_proxy = QueryProxy(self, "query") self._query_proxy = QueryProxy(self, "query")
def filter(self, *args, **kwargs): def filter(self, *args: Any, **kwargs: Any) -> Any:
return self.query(Bool(filter=[Q(*args, **kwargs)])) return self.query(Bool(filter=[Q(*args, **kwargs)]))
def exclude(self, *args, **kwargs): def exclude(self, *args: Any, **kwargs: Any) -> Any:
return self.query(Bool(filter=[~Q(*args, **kwargs)])) return self.query(Bool(filter=[~Q(*args, **kwargs)]))
@classmethod @classmethod
def from_dict(cls, d): def from_dict(cls, d: Any) -> Any:
""" """
Construct a new `AsyncUpdateByQuery` instance from a raw dict containing the search Construct a new `AsyncUpdateByQuery` instance from a raw dict containing the search
body. Useful when migrating from raw dictionaries. body. Useful when migrating from raw dictionaries.
@@ -63,7 +65,7 @@ class AsyncUpdateByQuery(Request):
u.update_from_dict(d) u.update_from_dict(d)
return u return u
def _clone(self): def _clone(self) -> Any:
""" """
Return a clone of the current search request. Performs a shallow copy Return a clone of the current search request. Performs a shallow copy
of all the underlying objects. Used internally by most state modifying of all the underlying objects. Used internally by most state modifying
@@ -76,7 +78,7 @@ class AsyncUpdateByQuery(Request):
ubq.query._proxied = self.query._proxied ubq.query._proxied = self.query._proxied
return ubq return ubq
def response_class(self, cls): def response_class(self, cls: Any) -> Any:
""" """
Override the default wrapper used for the response. Override the default wrapper used for the response.
""" """
@@ -84,7 +86,7 @@ class AsyncUpdateByQuery(Request):
ubq._response_class = cls ubq._response_class = cls
return ubq return ubq
def update_from_dict(self, d): def update_from_dict(self, d: Any) -> "AsyncUpdateByQuery":
""" """
Apply options from a serialized body to the current instance. Modifies Apply options from a serialized body to the current instance. Modifies
the object in-place. Used mostly by ``from_dict``. the object in-place. Used mostly by ``from_dict``.
@@ -97,7 +99,7 @@ class AsyncUpdateByQuery(Request):
self._extra.update(d) self._extra.update(d)
return self return self
def script(self, **kwargs): def script(self, **kwargs: Any) -> Any:
""" """
Define update action to take: Define update action to take:
@@ -118,7 +120,7 @@ class AsyncUpdateByQuery(Request):
ubq._script.update(kwargs) ubq._script.update(kwargs)
return ubq return ubq
def to_dict(self, **kwargs): def to_dict(self, **kwargs: Any) -> Any:
""" """
Serialize the search into the dictionary that will be sent over as the Serialize the search into the dictionary that will be sent over as the
request'ubq body. request'ubq body.
@@ -136,7 +138,7 @@ class AsyncUpdateByQuery(Request):
d.update(recursive_to_dict(kwargs)) d.update(recursive_to_dict(kwargs))
return d return d
async def execute(self): async def execute(self) -> Any:
""" """
Execute the search and return an instance of ``Response`` wrapping all Execute the search and return an instance of ``Response`` wrapping all
the data. the data.
@@ -1,13 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from opensearchpy.helpers.search import Request
class AsyncUpdateByQuery(Request): ...
+51 -43
View File
@@ -30,8 +30,9 @@ import asyncio
import os import os
import ssl import ssl
import warnings import warnings
from typing import Any, Collection, Mapping, Optional, Union
import urllib3 # type: ignore import urllib3
from ..compat import reraise_exceptions, urlencode from ..compat import reraise_exceptions, urlencode
from ..connection.base import Connection from ..connection.base import Connection
@@ -41,12 +42,9 @@ from ..exceptions import (
ImproperlyConfigured, ImproperlyConfigured,
SSLError, SSLError,
) )
from ._extra_imports import aiohttp, aiohttp_exceptions, yarl from ._extra_imports import aiohttp, aiohttp_exceptions, yarl # type: ignore
from .compat import get_running_loop from .compat import get_running_loop
# sentinel value for `verify_certs`.
# This is used to detect if a user is passing in a value
# for SSL kwargs if also using an SSLContext.
VERIFY_CERTS_DEFAULT = object() VERIFY_CERTS_DEFAULT = object()
SSL_SHOW_WARN_DEFAULT = object() SSL_SHOW_WARN_DEFAULT = object()
@@ -56,45 +54,48 @@ class AsyncConnection(Connection):
async def perform_request( async def perform_request(
self, self,
method, method: str,
url, url: str,
params=None, params: Optional[Mapping[str, Any]] = None,
body=None, body: Optional[bytes] = None,
timeout=None, timeout: Optional[Union[int, float]] = None,
ignore=(), ignore: Collection[int] = (),
headers=None, headers: Optional[Mapping[str, str]] = None,
): ) -> Any:
raise NotImplementedError() raise NotImplementedError()
async def close(self): async def close(self) -> None:
raise NotImplementedError() raise NotImplementedError()
class AIOHttpConnection(AsyncConnection): class AIOHttpConnection(AsyncConnection):
session: Optional[aiohttp.ClientSession]
ssl_assert_fingerprint: Optional[str]
def __init__( def __init__(
self, self,
host="localhost", host: str = "localhost",
port=None, port: Optional[int] = None,
url_prefix="", url_prefix: str = "",
timeout=10, timeout: int = 10,
http_auth=None, http_auth: Any = None,
use_ssl=False, use_ssl: bool = False,
verify_certs=VERIFY_CERTS_DEFAULT, verify_certs: Any = VERIFY_CERTS_DEFAULT,
ssl_show_warn=SSL_SHOW_WARN_DEFAULT, ssl_show_warn: Any = SSL_SHOW_WARN_DEFAULT,
ca_certs=None, ca_certs: Any = None,
client_cert=None, client_cert: Any = None,
client_key=None, client_key: Any = None,
ssl_version=None, ssl_version: Any = None,
ssl_assert_fingerprint=None, ssl_assert_fingerprint: Any = None,
maxsize=10, maxsize: Optional[int] = 10,
headers=None, headers: Any = None,
ssl_context=None, ssl_context: Any = None,
http_compress=None, http_compress: Optional[bool] = None,
opaque_id=None, opaque_id: Optional[str] = None,
loop=None, loop: Any = None,
trust_env=False, trust_env: Optional[bool] = False,
**kwargs **kwargs: Any
): ) -> None:
""" """
Default connection class for ``AsyncOpenSearch`` using the `aiohttp` library and the http protocol. Default connection class for ``AsyncOpenSearch`` using the `aiohttp` library and the http protocol.
@@ -224,8 +225,15 @@ class AIOHttpConnection(AsyncConnection):
self._trust_env = trust_env self._trust_env = trust_env
async def perform_request( async def perform_request(
self, method, url, params=None, body=None, timeout=None, ignore=(), headers=None self,
): method: str,
url: str,
params: Optional[Mapping[str, Any]] = None,
body: Optional[bytes] = None,
timeout: Optional[Union[int, float]] = None,
ignore: Collection[int] = (),
headers: Optional[Mapping[str, str]] = None,
) -> Any:
if self.session is None: if self.session is None:
await self._create_aiohttp_session() await self._create_aiohttp_session()
assert self.session is not None assert self.session is not None
@@ -346,14 +354,14 @@ class AIOHttpConnection(AsyncConnection):
return response.status, response.headers, raw_data return response.status, response.headers, raw_data
async def close(self): async def close(self) -> Any:
""" """
Explicitly closes connection Explicitly closes connection
""" """
if self.session: if self.session:
await self.session.close() await self.session.close()
async def _create_aiohttp_session(self): async def _create_aiohttp_session(self) -> Any:
"""Creates an aiohttp.ClientSession(). This is delayed until """Creates an aiohttp.ClientSession(). This is delayed until
the first call to perform_request() so that AsyncTransport has the first call to perform_request() so that AsyncTransport has
a chance to set AIOHttpConnection.loop a chance to set AIOHttpConnection.loop
@@ -374,9 +382,9 @@ class AIOHttpConnection(AsyncConnection):
) )
class OpenSearchClientResponse(aiohttp.ClientResponse): class OpenSearchClientResponse(aiohttp.ClientResponse): # type: ignore
async def text(self, encoding=None, errors="strict"): async def text(self, encoding: Any = None, errors: str = "strict") -> Any:
if self._body is None: if self._body is None:
await self.read() await self.read()
return self._body.decode("utf-8", "surrogatepass") return self._body.decode("utf-8", "surrogatepass") # type: ignore
-73
View File
@@ -1,73 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from asyncio import AbstractEventLoop
from typing import Any, Collection, Mapping, Optional, Tuple, Union
from ..connection import Connection
from ._extra_imports import aiohttp # type: ignore
class AsyncConnection(Connection):
async def perform_request( # type: ignore
self,
method: str,
url: str,
params: Optional[Mapping[str, Any]] = ...,
body: Optional[bytes] = ...,
timeout: Optional[Union[int, float]] = ...,
ignore: Collection[int] = ...,
headers: Optional[Mapping[str, str]] = ...,
) -> Tuple[int, Mapping[str, str], str]: ...
async def close(self) -> None: ...
class AIOHttpConnection(AsyncConnection):
session: Optional[aiohttp.ClientSession]
ssl_assert_fingerprint: Optional[str]
def __init__(
self,
host: str = ...,
port: Optional[int] = ...,
url_prefix: str = ...,
timeout: int = ...,
http_auth: Optional[Any] = ...,
use_ssl: bool = ...,
verify_certs: bool = ...,
ssl_show_warn: bool = ...,
ca_certs: Optional[Any] = ...,
client_cert: Optional[Any] = ...,
client_key: Optional[Any] = ...,
ssl_version: Optional[Any] = ...,
ssl_assert_fingerprint: Optional[Any] = ...,
maxsize: int = ...,
headers: Optional[Mapping[str, str]] = ...,
ssl_context: Optional[Any] = ...,
http_compress: Optional[bool] = ...,
opaque_id: Optional[str] = ...,
loop: Optional[AbstractEventLoop] = ...,
trust_env: bool = ...,
**kwargs: Any
) -> None: ...
-9
View File
@@ -1,9 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
+73 -13
View File
@@ -8,12 +8,19 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
from typing import Any, Union
from ..client.utils import NamespacedClient, _make_path, query_params from ..client.utils import NamespacedClient, _make_path, query_params
class AlertingClient(NamespacedClient): class AlertingClient(NamespacedClient):
@query_params() @query_params()
async def search_monitor(self, body, params=None, headers=None): async def search_monitor(
self,
body: Any,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Returns the search result for a monitor. Returns the search result for a monitor.
@@ -28,7 +35,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_monitor(self, monitor_id, params=None, headers=None): async def get_monitor(
self,
monitor_id: Any,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Returns the details of a specific monitor. Returns the details of a specific monitor.
@@ -42,7 +54,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params("dryrun") @query_params("dryrun")
async def run_monitor(self, monitor_id, params=None, headers=None): async def run_monitor(
self,
monitor_id: Any,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Runs/Executes a specific monitor. Runs/Executes a specific monitor.
@@ -57,7 +74,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_monitor(self, body=None, params=None, headers=None): async def create_monitor(
self,
body: Union[Any, None] = None,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Creates a monitor with inputs, triggers, and actions. Creates a monitor with inputs, triggers, and actions.
@@ -72,7 +94,13 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def update_monitor(self, monitor_id, body=None, params=None, headers=None): async def update_monitor(
self,
monitor_id: Any,
body: Union[Any, None] = None,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Updates a monitor's inputs, triggers, and actions. Updates a monitor's inputs, triggers, and actions.
@@ -88,7 +116,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_monitor(self, monitor_id, params=None, headers=None): async def delete_monitor(
self,
monitor_id: Any,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Deletes a specific monitor. Deletes a specific monitor.
@@ -102,7 +135,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_destination(self, destination_id=None, params=None, headers=None): async def get_destination(
self,
destination_id: Union[Any, None] = None,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Returns the details of a specific destination. Returns the details of a specific destination.
@@ -118,7 +156,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def create_destination(self, body=None, params=None, headers=None): async def create_destination(
self,
body: Union[Any, None] = None,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Creates a destination for slack, mail, or custom-webhook. Creates a destination for slack, mail, or custom-webhook.
@@ -134,8 +177,12 @@ class AlertingClient(NamespacedClient):
@query_params() @query_params()
async def update_destination( async def update_destination(
self, destination_id, body=None, params=None, headers=None self,
): destination_id: Any,
body: Union[Any, None] = None,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Updates a destination's inputs, triggers, and actions. Updates a destination's inputs, triggers, and actions.
@@ -151,7 +198,12 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_destination(self, destination_id, params=None, headers=None): async def delete_destination(
self,
destination_id: Any,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Deletes a specific destination. Deletes a specific destination.
@@ -165,7 +217,9 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_alerts(self, params=None, headers=None): async def get_alerts(
self, params: Union[Any, None] = None, headers: Union[Any, None] = None
) -> Union[bool, Any]:
""" """
Returns all alerts. Returns all alerts.
@@ -178,7 +232,13 @@ class AlertingClient(NamespacedClient):
) )
@query_params() @query_params()
async def acknowledge_alert(self, monitor_id, body=None, params=None, headers=None): async def acknowledge_alert(
self,
monitor_id: Any,
body: Union[Any, None] = None,
params: Union[Any, None] = None,
headers: Union[Any, None] = None,
) -> Union[bool, Any]:
""" """
Acknowledges an alert. Acknowledges an alert.
-83
View File
@@ -1,83 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any, Union
from ..client.utils import NamespacedClient as NamespacedClient
class AlertingClient(NamespacedClient):
def search_monitor(
self, body: Any, params: Union[Any, None] = ..., headers: Union[Any, None] = ...
) -> Union[bool, Any]: ...
def get_monitor(
self,
monitor_id: Any,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def run_monitor(
self,
monitor_id: Any,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def create_monitor(
self,
body: Union[Any, None] = ...,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def update_monitor(
self,
monitor_id: Any,
body: Union[Any, None] = ...,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def delete_monitor(
self,
monitor_id: Any,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def get_destination(
self,
destination_id: Union[Any, None] = ...,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def create_destination(
self,
body: Union[Any, None] = ...,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def update_destination(
self,
destination_id: Any,
body: Union[Any, None] = ...,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def delete_destination(
self,
destination_id: Any,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
def get_alerts(
self, params: Union[Any, None] = ..., headers: Union[Any, None] = ...
) -> Union[bool, Any]: ...
def acknowledge_alert(
self,
monitor_id: Any,
body: Union[Any, None] = ...,
params: Union[Any, None] = ...,
headers: Union[Any, None] = ...,
) -> Union[bool, Any]: ...
@@ -9,12 +9,16 @@
# GitHub history for details. # GitHub history for details.
from typing import Any
from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IndexManagementClient(NamespacedClient): class IndexManagementClient(NamespacedClient):
@query_params() @query_params()
async def put_policy(self, policy, body=None, params=None, headers=None): async def put_policy(
self, policy: Any, body: Any = None, params: Any = None, headers: Any = None
) -> Any:
""" """
Creates, or updates, a policy. Creates, or updates, a policy.
@@ -32,7 +36,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params() @query_params()
async def add_policy(self, index, body=None, params=None, headers=None): async def add_policy(
self, index: Any, body: Any = None, params: Any = None, headers: Any = None
) -> Any:
""" """
Adds a policy to an index. This operation does not change the policy if the index already has one. Adds a policy to an index. This operation does not change the policy if the index already has one.
@@ -50,7 +56,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params() @query_params()
async def get_policy(self, policy, params=None, headers=None): async def get_policy(
self, policy: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Gets the policy by `policy_id`. Gets the policy by `policy_id`.
@@ -67,7 +75,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params() @query_params()
async def remove_policy_from_index(self, index, params=None, headers=None): async def remove_policy_from_index(
self, index: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Removes any ISM policy from the index. Removes any ISM policy from the index.
@@ -84,7 +94,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params() @query_params()
async def change_policy(self, index, body=None, params=None, headers=None): async def change_policy(
self, index: Any, body: Any = None, params: Any = None, headers: Any = None
) -> Any:
""" """
Updates the managed index policy to a new policy (or to a new version of the policy). Updates the managed index policy to a new policy (or to a new version of the policy).
@@ -102,7 +114,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params() @query_params()
async def retry(self, index, body=None, params=None, headers=None): async def retry(
self, index: Any, body: Any = None, params: Any = None, headers: Any = None
) -> Any:
""" """
Retries the failed action for an index. Retries the failed action for an index.
@@ -120,7 +134,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params("show_policy") @query_params("show_policy")
async def explain_index(self, index, params=None, headers=None): async def explain_index(
self, index: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Gets the current state of the index. Gets the current state of the index.
@@ -137,7 +153,9 @@ class IndexManagementClient(NamespacedClient):
) )
@query_params() @query_params()
async def delete_policy(self, policy, params=None, headers=None): async def delete_policy(
self, policy: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Deletes the policy by `policy_id`. Deletes the policy by `policy_id`.
@@ -1,72 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any, Union
from ..client.utils import NamespacedClient as NamespacedClient
from ..client.utils import query_params as query_params
class IndexManagementClient(NamespacedClient):
async def put_policy(
self,
policy: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def add_policy(
self,
index: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def get_policy(
self,
policy: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def remove_policy_from_index(
self,
index: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def change_policy(
self,
index: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def retry(
self,
index: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def explain_index(
self,
index: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
async def delete_policy(
self,
policy: Any,
body: Any | None = ...,
params: Any | None = ...,
headers: Any | None = ...,
) -> Union[bool, Any]: ...
+51 -33
View File
@@ -30,6 +30,10 @@ import asyncio
import logging import logging
import sys import sys
from itertools import chain from itertools import chain
from typing import Any, Collection, Mapping, Optional, Type, Union
from opensearchpy.connection.base import Connection
from opensearchpy.serializer import Serializer
from ..connection_pool import ConnectionPool from ..connection_pool import ConnectionPool
from ..exceptions import ( from ..exceptions import (
@@ -56,25 +60,27 @@ class AsyncTransport(Transport):
DEFAULT_CONNECTION_CLASS = AIOHttpConnection DEFAULT_CONNECTION_CLASS = AIOHttpConnection
sniffing_task: Any = None
def __init__( def __init__(
self, self,
hosts, hosts: Any,
connection_class=None, connection_class: Any = None,
connection_pool_class=ConnectionPool, connection_pool_class: Type[ConnectionPool] = ConnectionPool,
host_info_callback=get_host_info, host_info_callback: Any = get_host_info,
sniff_on_start=False, sniff_on_start: bool = False,
sniffer_timeout=None, sniffer_timeout: Any = None,
sniff_timeout=0.1, sniff_timeout: float = 0.1,
sniff_on_connection_fail=False, sniff_on_connection_fail: bool = False,
serializer=JSONSerializer(), serializer: Serializer = JSONSerializer(),
serializers=None, serializers: Any = None,
default_mimetype="application/json", default_mimetype: str = "application/json",
max_retries=3, max_retries: int = 3,
retry_on_status=(502, 503, 504), retry_on_status: Any = (502, 503, 504),
retry_on_timeout=False, retry_on_timeout: bool = False,
send_get_body_as="GET", send_get_body_as: str = "GET",
**kwargs **kwargs: Any
): ) -> None:
""" """
:arg hosts: list of dictionaries, each containing keyword arguments to :arg hosts: list of dictionaries, each containing keyword arguments to
create a `connection_class` instance create a `connection_class` instance
@@ -113,9 +119,9 @@ class AsyncTransport(Transport):
options provided as part of the hosts parameter. options provided as part of the hosts parameter.
""" """
self.sniffing_task = None self.sniffing_task = None
self.loop = None self.loop: Any = None
self._async_init_called = False self._async_init_called = False
self._sniff_on_start_event = None # type: asyncio.Event self._sniff_on_start_event: Optional[asyncio.Event] = None
super(AsyncTransport, self).__init__( super(AsyncTransport, self).__init__(
hosts=[], hosts=[],
@@ -142,7 +148,7 @@ class AsyncTransport(Transport):
self.hosts = hosts self.hosts = hosts
self.sniff_on_start = sniff_on_start self.sniff_on_start = sniff_on_start
async def _async_init(self): async def _async_init(self) -> None:
"""This is our stand-in for an async constructor. Everything """This is our stand-in for an async constructor. Everything
that was deferred within __init__() should be done here now. that was deferred within __init__() should be done here now.
@@ -171,7 +177,7 @@ class AsyncTransport(Transport):
# Since this is the first one we wait for it to complete # Since this is the first one we wait for it to complete
# in case there's an error it'll get raised here. # in case there's an error it'll get raised here.
await self.sniffing_task await self.sniffing_task # type: ignore
# If the task gets cancelled here it likely means the # If the task gets cancelled here it likely means the
# transport got closed. # transport got closed.
@@ -184,7 +190,7 @@ class AsyncTransport(Transport):
finally: finally:
self._sniff_on_start_event.set() self._sniff_on_start_event.set()
async def _async_call(self): async def _async_call(self) -> None:
"""This method is called within any async method of AsyncTransport """This method is called within any async method of AsyncTransport
where the transport is not closing. This will check to see if we should where the transport is not closing. This will check to see if we should
call our _async_init() or create a new sniffing task call our _async_init() or create a new sniffing task
@@ -205,7 +211,7 @@ class AsyncTransport(Transport):
if self.loop.time() >= self.last_sniff + self.sniffer_timeout: if self.loop.time() >= self.last_sniff + self.sniffer_timeout:
self.create_sniff_task() self.create_sniff_task()
async def _get_node_info(self, conn, initial): async def _get_node_info(self, conn: Any, initial: Any) -> Any:
try: try:
# use small timeout for the sniffing request, should be a fast api call # use small timeout for the sniffing request, should be a fast api call
_, headers, node_info = await conn.perform_request( _, headers, node_info = await conn.perform_request(
@@ -218,7 +224,7 @@ class AsyncTransport(Transport):
pass pass
return None return None
async def _get_sniff_data(self, initial=False): async def _get_sniff_data(self, initial: Any = False) -> Any:
previous_sniff = self.last_sniff previous_sniff = self.last_sniff
# reset last_sniff timestamp # reset last_sniff timestamp
@@ -227,7 +233,7 @@ class AsyncTransport(Transport):
# use small timeout for the sniffing request, should be a fast api call # use small timeout for the sniffing request, should be a fast api call
timeout = self.sniff_timeout if not initial else None timeout = self.sniff_timeout if not initial else None
def _sniff_request(conn): def _sniff_request(conn: Any) -> Any:
return self.loop.create_task( return self.loop.create_task(
conn.perform_request("GET", "/_nodes/_all/http", timeout=timeout) conn.perform_request("GET", "/_nodes/_all/http", timeout=timeout)
) )
@@ -243,7 +249,7 @@ class AsyncTransport(Transport):
continue continue
tasks.append(_sniff_request(conn)) tasks.append(_sniff_request(conn))
done = () done: Any = ()
try: try:
while tasks: while tasks:
# The 'loop' keyword is deprecated in 3.8+ so don't # The 'loop' keyword is deprecated in 3.8+ so don't
@@ -283,7 +289,7 @@ class AsyncTransport(Transport):
for task in chain(done, tasks): for task in chain(done, tasks):
task.cancel() task.cancel()
async def sniff_hosts(self, initial=False): async def sniff_hosts(self, initial: bool = False) -> Any:
"""Either spawns a sniffing_task which does regular sniffing """Either spawns a sniffing_task which does regular sniffing
over time or does a single sniffing session and awaits the results. over time or does a single sniffing session and awaits the results.
""" """
@@ -294,7 +300,7 @@ class AsyncTransport(Transport):
return return
node_info = await self._get_sniff_data(initial) node_info = await self._get_sniff_data(initial)
hosts = list(filter(None, (self._get_host_info(n) for n in node_info))) hosts: Any = list(filter(None, (self._get_host_info(n) for n in node_info)))
# we weren't able to get any nodes, maybe using an incompatible # we weren't able to get any nodes, maybe using an incompatible
# transport_schema or host_info_callback blocked all - raise error. # transport_schema or host_info_callback blocked all - raise error.
@@ -311,7 +317,7 @@ class AsyncTransport(Transport):
if c not in self.connection_pool.connections: if c not in self.connection_pool.connections:
await c.close() await c.close()
def create_sniff_task(self, initial=False): def create_sniff_task(self, initial: bool = False) -> None:
""" """
Initiate a sniffing task. Make sure we only have one sniff request Initiate a sniffing task. Make sure we only have one sniff request
running at any given time. If a finished sniffing request is around, running at any given time. If a finished sniffing request is around,
@@ -327,7 +333,7 @@ class AsyncTransport(Transport):
if self.sniffing_task is None: if self.sniffing_task is None:
self.sniffing_task = self.loop.create_task(self.sniff_hosts(initial)) self.sniffing_task = self.loop.create_task(self.sniff_hosts(initial))
def mark_dead(self, connection): def mark_dead(self, connection: Connection) -> None:
""" """
Mark a connection as dead (failed) in the connection pool. If sniffing Mark a connection as dead (failed) in the connection pool. If sniffing
on failure is enabled this will initiate the sniffing process. on failure is enabled this will initiate the sniffing process.
@@ -338,10 +344,19 @@ class AsyncTransport(Transport):
if self.sniff_on_connection_fail: if self.sniff_on_connection_fail:
self.create_sniff_task() self.create_sniff_task()
def get_connection(self): def get_connection(self) -> Any:
return self.connection_pool.get_connection() return self.connection_pool.get_connection()
async def perform_request(self, method, url, headers=None, params=None, body=None): async def perform_request(
self,
method: str,
url: str,
params: Optional[Mapping[str, Any]] = None,
body: Optional[bytes] = None,
timeout: Optional[Union[int, float]] = None,
ignore: Collection[int] = (),
headers: Optional[Mapping[str, str]] = None,
) -> Any:
""" """
Perform the actual request. Retrieve a connection from the connection Perform the actual request. Retrieve a connection from the connection
pool, pass all the information to its perform_request method and pool, pass all the information to its perform_request method and
@@ -425,7 +440,7 @@ class AsyncTransport(Transport):
) )
return data return data
async def close(self): async def close(self) -> None:
""" """
Explicitly closes connections Explicitly closes connections
""" """
@@ -439,3 +454,6 @@ class AsyncTransport(Transport):
for connection in self.connection_pool.connections: for connection in self.connection_pool.connections:
await connection.close() await connection.close()
__all__ = ["TransportError"]
-91
View File
@@ -1,91 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Callable, Collection, Dict, List, Mapping, Optional, Type, Union
from ..connection import Connection
from ..connection_pool import ConnectionPool
from ..serializer import Deserializer, Serializer
class AsyncTransport(object):
DEFAULT_CONNECTION_CLASS: Type[Connection]
connection_pool: ConnectionPool
deserializer: Deserializer
max_retries: int
retry_on_timeout: bool
retry_on_status: Collection[int]
send_get_body_as: str
serializer: Serializer
connection_pool_class: Type[ConnectionPool]
connection_class: Type[Connection]
kwargs: Any
hosts: Optional[List[Dict[str, Any]]]
seed_connections: List[Connection]
sniffer_timeout: Optional[float]
sniff_on_start: bool
sniff_on_connection_fail: bool
last_sniff: float
sniff_timeout: Optional[float]
host_info_callback: Callable[
[Dict[str, Any], Optional[Dict[str, Any]]], Dict[str, Any]
]
def __init__(
self,
hosts: Any,
connection_class: Optional[Type[Any]] = ...,
connection_pool_class: Type[ConnectionPool] = ...,
host_info_callback: Callable[
[Dict[str, Any], Dict[str, Any]], Optional[Dict[str, Any]]
] = ...,
sniff_on_start: bool = ...,
sniffer_timeout: Optional[float] = ...,
sniff_timeout: float = ...,
sniff_on_connection_fail: bool = ...,
serializer: Serializer = ...,
serializers: Optional[Mapping[str, Serializer]] = ...,
default_mimetype: str = ...,
max_retries: int = ...,
retry_on_status: Collection[int] = ...,
retry_on_timeout: bool = ...,
send_get_body_as: str = ...,
**kwargs: Any
) -> None: ...
def add_connection(self, host: Any) -> None: ...
def set_connections(self, hosts: Collection[Any]) -> None: ...
def get_connection(self) -> Connection: ...
def sniff_hosts(self, initial: bool = ...) -> None: ...
def mark_dead(self, connection: Connection) -> None: ...
async def perform_request(
self,
method: str,
url: str,
headers: Optional[Mapping[str, str]] = ...,
params: Optional[Mapping[str, Any]] = ...,
body: Optional[Any] = ...,
) -> Union[bool, Any]: ...
async def close(self) -> None: ...
+1 -1
View File
@@ -25,4 +25,4 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
__versionstr__ = "2.3.2" __versionstr__: str = "2.3.2"
+296 -52
View File
@@ -39,9 +39,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import logging import logging
from typing import Any, Type
from ..transport import Transport, TransportError from ..transport import Transport, TransportError
from .cat import CatClient from .cat import CatClient
from .client import Client
from .cluster import ClusterClient from .cluster import ClusterClient
from .dangling_indices import DanglingIndicesClient from .dangling_indices import DanglingIndicesClient
from .features import FeaturesClient from .features import FeaturesClient
@@ -54,12 +56,12 @@ from .remote_store import RemoteStoreClient
from .security import SecurityClient from .security import SecurityClient
from .snapshot import SnapshotClient from .snapshot import SnapshotClient
from .tasks import TasksClient from .tasks import TasksClient
from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params from .utils import SKIP_IN_PATH, _bulk_body, _make_path, query_params
logger = logging.getLogger("opensearch") logger = logging.getLogger("opensearch")
class OpenSearch(object): class OpenSearch(Client):
""" """
OpenSearch client. Provides a straightforward mapping from OpenSearch client. Provides a straightforward mapping from
Python to OpenSearch REST endpoints. Python to OpenSearch REST endpoints.
@@ -184,13 +186,19 @@ class OpenSearch(object):
""" """
from ._patch import ( # include PIT functions inside _patch.py
from ._patch import ( # type: ignore
create_point_in_time, create_point_in_time,
delete_point_in_time, delete_point_in_time,
list_all_point_in_time, list_all_point_in_time,
) )
def __init__(self, hosts=None, transport_class=Transport, **kwargs): def __init__(
self,
hosts: Any = None,
transport_class: Type[Transport] = Transport,
**kwargs: Any
) -> None:
""" """
:arg hosts: list of nodes, or a single node, we should connect to. :arg hosts: list of nodes, or a single node, we should connect to.
Node should be a dictionary ({"host": "localhost", "port": 9200}), Node should be a dictionary ({"host": "localhost", "port": 9200}),
@@ -205,7 +213,7 @@ class OpenSearch(object):
:class:`~opensearchpy.Transport` class and, subsequently, to the :class:`~opensearchpy.Transport` class and, subsequently, to the
:class:`~opensearchpy.Connection` instances. :class:`~opensearchpy.Connection` instances.
""" """
self.transport = transport_class(_normalize_hosts(hosts), **kwargs) super().__init__(hosts, transport_class, **kwargs)
# namespaced clients for compatibility with API names # namespaced clients for compatibility with API names
self.cat = CatClient(self) self.cat = CatClient(self)
@@ -224,10 +232,10 @@ class OpenSearch(object):
self.plugins = PluginsClient(self) self.plugins = PluginsClient(self)
def __repr__(self): def __repr__(self) -> Any:
try: try:
# get a list of all connections # get a list of all connections
cons = self.transport.hosts cons: Any = self.transport.hosts
# truncate to 5 if there are too many # truncate to 5 if there are too many
if len(cons) > 5: if len(cons) > 5:
cons = cons[:5] + ["..."] cons = cons[:5] + ["..."]
@@ -236,21 +244,25 @@ class OpenSearch(object):
# probably operating on custom transport and connection_pool, ignore # probably operating on custom transport and connection_pool, ignore
return super(OpenSearch, self).__repr__() return super(OpenSearch, self).__repr__()
def __enter__(self): def __enter__(self) -> Any:
if hasattr(self.transport, "_async_call"): if hasattr(self.transport, "_async_call"):
self.transport._async_call() self.transport._async_call()
return self return self
def __exit__(self, *_): def __exit__(self, *_: Any) -> None:
self.close() self.close()
def close(self): def close(self) -> None:
"""Closes the Transport and all internal connections""" """Closes the Transport and all internal connections"""
self.transport.close() self.transport.close()
# AUTO-GENERATED-API-DEFINITIONS # # AUTO-GENERATED-API-DEFINITIONS #
@query_params() @query_params()
def ping(self, params=None, headers=None): def ping(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns whether the cluster is running. Returns whether the cluster is running.
@@ -263,7 +275,11 @@ class OpenSearch(object):
return False return False
@query_params() @query_params()
def info(self, params=None, headers=None): def info(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns basic information about the cluster. Returns basic information about the cluster.
@@ -281,7 +297,14 @@ class OpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
def create(self, index, id, body, params=None, headers=None): def create(
self,
index: Any,
id: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates a new document in the index. Returns a 409 response when a document Creates a new document in the index. Returns a 409 response when a document
with a same ID already exists in the index. with a same ID already exists in the index.
@@ -330,7 +353,14 @@ class OpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
def index(self, index, body, id=None, params=None, headers=None): def index(
self,
index: Any,
body: Any,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a document in an index. Creates or updates a document in an index.
@@ -387,7 +417,13 @@ class OpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def bulk(self, body, index=None, params=None, headers=None): def bulk(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to perform multiple index/update/delete operations in a single request. Allows to perform multiple index/update/delete operations in a single request.
@@ -431,7 +467,13 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def clear_scroll(self, body=None, scroll_id=None, params=None, headers=None): def clear_scroll(
self,
body: Any = None,
scroll_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Explicitly clears the search context for a scroll. Explicitly clears the search context for a scroll.
@@ -467,7 +509,13 @@ class OpenSearch(object):
"routing", "routing",
"terminate_after", "terminate_after",
) )
def count(self, body=None, index=None, params=None, headers=None): def count(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns number of documents matching a query. Returns number of documents matching a query.
@@ -523,7 +571,13 @@ class OpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
def delete(self, index, id, params=None, headers=None): def delete(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Removes a document from the index. Removes a document from the index.
@@ -592,7 +646,13 @@ class OpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
def delete_by_query(self, index, body, params=None, headers=None): def delete_by_query(
self,
index: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes documents matching the provided query. Deletes documents matching the provided query.
@@ -685,7 +745,12 @@ class OpenSearch(object):
) )
@query_params("requests_per_second") @query_params("requests_per_second")
def delete_by_query_rethrottle(self, task_id, params=None, headers=None): def delete_by_query_rethrottle(
self,
task_id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the number of requests per second for a particular Delete By Query Changes the number of requests per second for a particular Delete By Query
operation. operation.
@@ -706,7 +771,12 @@ class OpenSearch(object):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_script(self, id, params=None, headers=None): def delete_script(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a script. Deletes a script.
@@ -738,7 +808,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def exists(self, index, id, params=None, headers=None): def exists(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a document exists in an index. Returns information about whether a document exists in an index.
@@ -783,7 +859,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def exists_source(self, index, id, params=None, headers=None): def exists_source(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a document source exists in an index. Returns information about whether a document source exists in an index.
@@ -831,7 +913,14 @@ class OpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
def explain(self, index, id, body=None, params=None, headers=None): def explain(
self,
index: Any,
id: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about why a specific matches (or doesn't match) a query. Returns information about why a specific matches (or doesn't match) a query.
@@ -878,7 +967,13 @@ class OpenSearch(object):
"ignore_unavailable", "ignore_unavailable",
"include_unmapped", "include_unmapped",
) )
def field_caps(self, body=None, index=None, params=None, headers=None): def field_caps(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the information about the capabilities of fields among multiple Returns the information about the capabilities of fields among multiple
indices. indices.
@@ -919,7 +1014,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def get(self, index, id, params=None, headers=None): def get(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a document. Returns a document.
@@ -954,7 +1055,12 @@ class OpenSearch(object):
) )
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
def get_script(self, id, params=None, headers=None): def get_script(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a script. Returns a script.
@@ -984,7 +1090,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def get_source(self, index, id, params=None, headers=None): def get_source(
self,
index: Any,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the source of a document. Returns the source of a document.
@@ -1028,7 +1140,13 @@ class OpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
def mget(self, body, index=None, params=None, headers=None): def mget(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to get multiple documents in one request. Allows to get multiple documents in one request.
@@ -1073,7 +1191,13 @@ class OpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
def msearch(self, body, index=None, params=None, headers=None): def msearch(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to execute several search operations in one request. Allows to execute several search operations in one request.
@@ -1125,7 +1249,13 @@ class OpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
def msearch_template(self, body, index=None, params=None, headers=None): def msearch_template(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to execute several search template operations in one request. Allows to execute several search template operations in one request.
@@ -1173,7 +1303,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def mtermvectors(self, body=None, index=None, params=None, headers=None): def mtermvectors(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns multiple termvectors in one request. Returns multiple termvectors in one request.
@@ -1221,7 +1357,14 @@ class OpenSearch(object):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def put_script(self, id, body, context=None, params=None, headers=None): def put_script(
self,
id: Any,
body: Any,
context: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a script. Creates or updates a script.
@@ -1251,7 +1394,13 @@ class OpenSearch(object):
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "search_type" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "search_type"
) )
def rank_eval(self, body, index=None, params=None, headers=None): def rank_eval(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to evaluate the quality of ranked search results over a set of typical Allows to evaluate the quality of ranked search results over a set of typical
search queries. search queries.
@@ -1293,7 +1442,12 @@ class OpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
def reindex(self, body, params=None, headers=None): def reindex(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to copy documents from one index to another, optionally filtering the Allows to copy documents from one index to another, optionally filtering the
source documents by a query, changing the destination index settings, or source documents by a query, changing the destination index settings, or
@@ -1330,7 +1484,12 @@ class OpenSearch(object):
) )
@query_params("requests_per_second") @query_params("requests_per_second")
def reindex_rethrottle(self, task_id, params=None, headers=None): def reindex_rethrottle(
self,
task_id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the number of requests per second for a particular Reindex operation. Changes the number of requests per second for a particular Reindex operation.
@@ -1350,7 +1509,13 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def render_search_template(self, body=None, id=None, params=None, headers=None): def render_search_template(
self,
body: Any = None,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to use the Mustache language to pre-render a search definition. Allows to use the Mustache language to pre-render a search definition.
@@ -1367,7 +1532,12 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def scripts_painless_execute(self, body=None, params=None, headers=None): def scripts_painless_execute(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows an arbitrary script to be executed and a result to be returned. Allows an arbitrary script to be executed and a result to be returned.
@@ -1383,7 +1553,13 @@ class OpenSearch(object):
) )
@query_params("rest_total_hits_as_int", "scroll") @query_params("rest_total_hits_as_int", "scroll")
def scroll(self, body=None, scroll_id=None, params=None, headers=None): def scroll(
self,
body: Any = None,
scroll_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to retrieve a large numbers of results from a single search request. Allows to retrieve a large numbers of results from a single search request.
@@ -1452,7 +1628,13 @@ class OpenSearch(object):
"typed_keys", "typed_keys",
"version", "version",
) )
def search(self, body=None, index=None, params=None, headers=None): def search(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns results matching a query. Returns results matching a query.
@@ -1572,7 +1754,12 @@ class OpenSearch(object):
"preference", "preference",
"routing", "routing",
) )
def search_shards(self, index=None, params=None, headers=None): def search_shards(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the indices and shards that a search request would be Returns information about the indices and shards that a search request would be
executed against. executed against.
@@ -1613,7 +1800,13 @@ class OpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
def search_template(self, body, index=None, params=None, headers=None): def search_template(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to use the Mustache language to pre-render a search definition. Allows to use the Mustache language to pre-render a search definition.
@@ -1675,7 +1868,14 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def termvectors(self, index, body=None, id=None, params=None, headers=None): def termvectors(
self,
index: Any,
body: Any = None,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information and statistics about terms in the fields of a particular Returns information and statistics about terms in the fields of a particular
document. document.
@@ -1730,7 +1930,14 @@ class OpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def update(self, index, id, body, params=None, headers=None): def update(
self,
index: Any,
id: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates a document with a script or partial document. Updates a document with a script or partial document.
@@ -1812,7 +2019,13 @@ class OpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
def update_by_query(self, index, body=None, params=None, headers=None): def update_by_query(
self,
index: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs an update on every document in the index without changing the source, Performs an update on every document in the index without changing the source,
for example to pick up a mapping change. for example to pick up a mapping change.
@@ -1906,7 +2119,12 @@ class OpenSearch(object):
) )
@query_params("requests_per_second") @query_params("requests_per_second")
def update_by_query_rethrottle(self, task_id, params=None, headers=None): def update_by_query_rethrottle(
self,
task_id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the number of requests per second for a particular Update By Query Changes the number of requests per second for a particular Update By Query
operation. operation.
@@ -1927,7 +2145,11 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def get_script_context(self, params=None, headers=None): def get_script_context(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns all script contexts. Returns all script contexts.
@@ -1937,7 +2159,11 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def get_script_languages(self, params=None, headers=None): def get_script_languages(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns available script types, languages and contexts. Returns available script types, languages and contexts.
@@ -1953,7 +2179,12 @@ class OpenSearch(object):
"preference", "preference",
"routing", "routing",
) )
def create_pit(self, index, params=None, headers=None): def create_pit(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates point in time context. Creates point in time context.
@@ -1981,7 +2212,11 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def delete_all_pits(self, params=None, headers=None): def delete_all_pits(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes all active point in time searches. Deletes all active point in time searches.
@@ -1991,7 +2226,12 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def delete_pit(self, body=None, params=None, headers=None): def delete_pit(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes one or more point in time searches based on the IDs passed. Deletes one or more point in time searches based on the IDs passed.
@@ -2007,7 +2247,11 @@ class OpenSearch(object):
) )
@query_params() @query_params()
def get_all_pits(self, params=None, headers=None): def get_all_pits(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Lists all active point in time searches. Lists all active point in time searches.
File diff suppressed because it is too large Load Diff
+16 -5
View File
@@ -9,12 +9,13 @@
# GitHub history for details. # GitHub history for details.
import warnings import warnings
from typing import Any
from .utils import SKIP_IN_PATH, query_params from .utils import SKIP_IN_PATH, query_params
@query_params() @query_params()
def list_all_point_in_time(self, params=None, headers=None): def list_all_point_in_time(self: Any, params: Any = None, headers: Any = None) -> Any:
""" """
Returns the list of active point in times searches Returns the list of active point in times searches
@@ -35,7 +36,9 @@ def list_all_point_in_time(self, params=None, headers=None):
@query_params( @query_params(
"expand_wildcards", "ignore_unavailable", "keep_alive", "preference", "routing" "expand_wildcards", "ignore_unavailable", "keep_alive", "preference", "routing"
) )
def create_point_in_time(self, index, params=None, headers=None): def create_point_in_time(
self: Any, index: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
Create a point in time that can be used in subsequent searches Create a point in time that can be used in subsequent searches
@@ -68,7 +71,13 @@ def create_point_in_time(self, index, params=None, headers=None):
@query_params() @query_params()
def delete_point_in_time(self, body=None, all=False, params=None, headers=None): def delete_point_in_time(
self: Any,
body: Any = None,
all: bool = False,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete a point in time Delete a point in time
@@ -94,7 +103,7 @@ def delete_point_in_time(self, body=None, all=False, params=None, headers=None):
@query_params() @query_params()
def health_check(self, params=None, headers=None): def health_check(self: Any, params: Any = None, headers: Any = None) -> Any:
""" """
Checks to see if the Security plugin is up and running. Checks to see if the Security plugin is up and running.
@@ -113,7 +122,9 @@ def health_check(self, params=None, headers=None):
@query_params() @query_params()
def update_audit_config(self, body, params=None, headers=None): def update_audit_config(
self: Any, body: Any, params: Any = None, headers: Any = None
) -> Any:
""" """
A PUT call updates the audit configuration. A PUT call updates the audit configuration.
-71
View File
@@ -1,71 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any, Collection, MutableMapping, Optional, Tuple, Type, Union
def list_all_point_in_time(
*,
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 create_point_in_time(
*,
index: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
keep_alive: Optional[Any] = ...,
preference: Optional[Any] = ...,
routing: Optional[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 delete_point_in_time(
*,
body: Optional[Any] = ...,
all: Optional[bool] = ...,
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 health_check(
params: Union[Any, None] = ..., headers: Union[Any, None] = ...
) -> Union[bool, Any]: ...
def update_audit_config(
body: Any, params: Union[Any, None] = ..., headers: Union[Any, None] = ...
) -> Union[bool, Any]: ...
+397 -286
View File
@@ -36,12 +36,19 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import NamespacedClient, _make_path, query_params from .utils import NamespacedClient, _make_path, query_params
class CatClient(NamespacedClient): class CatClient(NamespacedClient):
@query_params("expand_wildcards", "format", "h", "help", "local", "s", "v") @query_params("expand_wildcards", "format", "h", "help", "local", "s", "v")
def aliases(self, name=None, params=None, headers=None): def aliases(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Shows information about currently configured aliases to indices including Shows information about currently configured aliases to indices including
filter and routing infos. filter and routing infos.
@@ -65,6 +72,20 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "aliases", name), params=params, headers=headers "GET", _make_path("_cat", "aliases", name), params=params, headers=headers
) )
@query_params()
def all_pit_segments(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Lists all active point-in-time segments.
"""
return self.transport.perform_request(
"GET", "/_cat/pit_segments/_all", params=params, headers=headers
)
@query_params( @query_params(
"bytes", "bytes",
"cluster_manager_timeout", "cluster_manager_timeout",
@@ -76,7 +97,12 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
def allocation(self, node_id=None, params=None, headers=None): def allocation(
self,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides a snapshot of how many shards are allocated to each data node and how Provides a snapshot of how many shards are allocated to each data node and how
much disk space they are using. much disk space they are using.
@@ -108,8 +134,51 @@ class CatClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
def cluster_manager(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about the cluster-manager node.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/cluster_manager", params=params, headers=headers
)
@query_params("format", "h", "help", "s", "v") @query_params("format", "h", "help", "s", "v")
def count(self, index=None, params=None, headers=None): def count(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides quick access to the document count of the entire cluster, or Provides quick access to the document count of the entire cluster, or
individual indices. individual indices.
@@ -129,8 +198,43 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "count", index), params=params, headers=headers "GET", _make_path("_cat", "count", index), params=params, headers=headers
) )
@query_params("bytes", "format", "h", "help", "s", "v")
def fielddata(
self,
fields: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Shows how much heap memory is currently being used by fielddata on every data
node in the cluster.
:arg fields: Comma-separated list of fields to return in the
output.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET",
_make_path("_cat", "fielddata", fields),
params=params,
headers=headers,
)
@query_params("format", "h", "help", "s", "time", "ts", "v") @query_params("format", "h", "help", "s", "time", "ts", "v")
def health(self, params=None, headers=None): def health(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a concise representation of the cluster health. Returns a concise representation of the cluster health.
@@ -151,7 +255,11 @@ class CatClient(NamespacedClient):
) )
@query_params("help", "s") @query_params("help", "s")
def help(self, params=None, headers=None): def help(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns help for the Cat APIs. Returns help for the Cat APIs.
@@ -180,7 +288,12 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
def indices(self, index=None, params=None, headers=None): def indices(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about indices: number of primaries and replicas, document Returns information about indices: number of primaries and replicas, document
counts, disk size, ... counts, disk size, ...
@@ -232,7 +345,11 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
def master(self, params=None, headers=None): def master(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the cluster-manager node. Returns information about the cluster-manager node.
@@ -271,9 +388,13 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
def cluster_manager(self, params=None, headers=None): def nodeattrs(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the cluster-manager node. Returns information about custom node attributes.
:arg cluster_manager_timeout: Operation timeout for connection :arg cluster_manager_timeout: Operation timeout for connection
@@ -292,7 +413,7 @@ class CatClient(NamespacedClient):
:arg v: Verbose mode. Display column headers. Default is false. :arg v: Verbose mode. Display column headers. Default is false.
""" """
return self.transport.perform_request( return self.transport.perform_request(
"GET", "/_cat/cluster_manager", params=params, headers=headers "GET", "/_cat/nodeattrs", params=params, headers=headers
) )
@query_params( @query_params(
@@ -308,7 +429,11 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
def nodes(self, params=None, headers=None): def nodes(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns basic statistics about performance of cluster nodes. Returns basic statistics about performance of cluster nodes.
@@ -339,10 +464,110 @@ class CatClient(NamespacedClient):
"GET", "/_cat/nodes", params=params, headers=headers "GET", "/_cat/nodes", params=params, headers=headers
) )
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"time",
"v",
)
def pending_tasks(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns a concise representation of the cluster pending tasks.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/pending_tasks", params=params, headers=headers
)
@query_params()
def pit_segments(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
List segments for one or several PITs.
"""
return self.transport.perform_request(
"GET", "/_cat/pit_segments", params=params, headers=headers, body=body
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
def plugins(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about installed plugins across nodes node.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/plugins", params=params, headers=headers
)
@query_params( @query_params(
"active_only", "bytes", "detailed", "format", "h", "help", "s", "time", "v" "active_only", "bytes", "detailed", "format", "h", "help", "s", "time", "v"
) )
def recovery(self, index=None, params=None, headers=None): def recovery(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about index shard recoveries, both on-going completed. Returns information about index shard recoveries, both on-going completed.
@@ -369,6 +594,137 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "recovery", index), params=params, headers=headers "GET", _make_path("_cat", "recovery", index), params=params, headers=headers
) )
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
def repositories(
self,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about snapshot repositories registered in the cluster.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/repositories", params=params, headers=headers
)
@query_params(
"active_only",
"bytes",
"completed_only",
"detailed",
"format",
"h",
"help",
"s",
"shards",
"time",
"v",
)
def segment_replication(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Returns information about both on-going and latest completed Segment
Replication events.
:arg index: Comma-separated list or wildcard expression of index
names to limit the returned information.
:arg active_only: If `true`, the response only includes ongoing
segment replication events. Default is false.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg completed_only: If `true`, the response only includes
latest completed segment replication events. Default is false.
:arg detailed: If `true`, the response includes detailed
information about segment replications. Default is false.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg shards: Comma-separated list of shards to display.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET",
_make_path("_cat", "segment_replication", index),
params=params,
headers=headers,
)
@query_params(
"bytes",
"cluster_manager_timeout",
"format",
"h",
"help",
"master_timeout",
"s",
"v",
)
def segments(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Provides low-level information about the segments in the shards of an index.
:arg index: Comma-separated list of indices to limit the
returned information.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", _make_path("_cat", "segments", index), params=params, headers=headers
)
@query_params( @query_params(
"bytes", "bytes",
"cluster_manager_timeout", "cluster_manager_timeout",
@@ -381,7 +737,12 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
def shards(self, index=None, params=None, headers=None): def shards(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides a detailed view of shard allocation on nodes. Provides a detailed view of shard allocation on nodes.
@@ -411,79 +772,6 @@ class CatClient(NamespacedClient):
"GET", _make_path("_cat", "shards", index), params=params, headers=headers "GET", _make_path("_cat", "shards", index), params=params, headers=headers
) )
@query_params(
"bytes",
"cluster_manager_timeout",
"format",
"h",
"help",
"master_timeout",
"s",
"v",
)
def segments(self, index=None, params=None, headers=None):
"""
Provides low-level information about the segments in the shards of an index.
:arg index: Comma-separated list of indices to limit the
returned information.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", _make_path("_cat", "segments", index), params=params, headers=headers
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"time",
"v",
)
def pending_tasks(self, params=None, headers=None):
"""
Returns a concise representation of the cluster pending tasks.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/pending_tasks", params=params, headers=headers
)
@query_params( @query_params(
"cluster_manager_timeout", "cluster_manager_timeout",
"format", "format",
@@ -495,7 +783,12 @@ class CatClient(NamespacedClient):
"size", "size",
"v", "v",
) )
def thread_pool(self, thread_pool_patterns=None, params=None, headers=None): def thread_pool(
self,
thread_pool_patterns: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns cluster-wide thread pool statistics per node. By default the active, Returns cluster-wide thread pool statistics per node. By default the active,
queue and rejected statistics are returned for all thread pools. queue and rejected statistics are returned for all thread pools.
@@ -526,134 +819,6 @@ class CatClient(NamespacedClient):
headers=headers, headers=headers,
) )
@query_params("bytes", "format", "h", "help", "s", "v")
def fielddata(self, fields=None, params=None, headers=None):
"""
Shows how much heap memory is currently being used by fielddata on every data
node in the cluster.
:arg fields: Comma-separated list of fields to return in the
output.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET",
_make_path("_cat", "fielddata", fields),
params=params,
headers=headers,
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
def plugins(self, params=None, headers=None):
"""
Returns information about installed plugins across nodes node.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/plugins", params=params, headers=headers
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
def nodeattrs(self, params=None, headers=None):
"""
Returns information about custom node attributes.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/nodeattrs", params=params, headers=headers
)
@query_params(
"cluster_manager_timeout",
"format",
"h",
"help",
"local",
"master_timeout",
"s",
"v",
)
def repositories(self, params=None, headers=None):
"""
Returns information about snapshot repositories registered in the cluster.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg local: Return local information, do not retrieve the state
from cluster-manager node. Default is false.
:arg master_timeout (Deprecated: To promote inclusive language,
use 'cluster_manager_timeout' instead.): Operation timeout for
connection to master node.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET", "/_cat/repositories", params=params, headers=headers
)
@query_params( @query_params(
"cluster_manager_timeout", "cluster_manager_timeout",
"format", "format",
@@ -665,7 +830,12 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
def snapshots(self, repository=None, params=None, headers=None): def snapshots(
self,
repository: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns all snapshots in a specific repository. Returns all snapshots in a specific repository.
@@ -708,7 +878,11 @@ class CatClient(NamespacedClient):
"time", "time",
"v", "v",
) )
def tasks(self, params=None, headers=None): def tasks(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the tasks currently executing on one or more nodes in Returns information about the tasks currently executing on one or more nodes in
the cluster. the cluster.
@@ -748,7 +922,12 @@ class CatClient(NamespacedClient):
"s", "s",
"v", "v",
) )
def templates(self, name=None, params=None, headers=None): def templates(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about existing templates. Returns information about existing templates.
@@ -772,71 +951,3 @@ class CatClient(NamespacedClient):
return self.transport.perform_request( return self.transport.perform_request(
"GET", _make_path("_cat", "templates", name), params=params, headers=headers "GET", _make_path("_cat", "templates", name), params=params, headers=headers
) )
@query_params()
def all_pit_segments(self, params=None, headers=None):
"""
Lists all active point-in-time segments.
"""
return self.transport.perform_request(
"GET", "/_cat/pit_segments/_all", params=params, headers=headers
)
@query_params()
def pit_segments(self, body=None, params=None, headers=None):
"""
List segments for one or several PITs.
"""
return self.transport.perform_request(
"GET", "/_cat/pit_segments", params=params, headers=headers, body=body
)
@query_params(
"active_only",
"bytes",
"completed_only",
"detailed",
"format",
"h",
"help",
"s",
"shards",
"time",
"v",
)
def segment_replication(self, index=None, params=None, headers=None):
"""
Returns information about both on-going and latest completed Segment
Replication events.
:arg index: Comma-separated list or wildcard expression of index
names to limit the returned information.
:arg active_only: If `true`, the response only includes ongoing
segment replication events. Default is false.
:arg bytes: The unit in which to display byte values. Valid
choices are b, k, kb, m, mb, g, gb, t, tb, p, pb.
:arg completed_only: If `true`, the response only includes
latest completed segment replication events. Default is false.
:arg detailed: If `true`, the response includes detailed
information about segment replications. Default is false.
:arg format: A short version of the Accept header, e.g. json,
yaml.
:arg h: Comma-separated list of column names to display.
:arg help: Return help information. Default is false.
:arg s: Comma-separated list of column names or column aliases
to sort by.
:arg shards: Comma-separated list of shards to display.
:arg time: The unit in which to display time values. Valid
choices are d, h, m, s, ms, micros, nanos.
:arg v: Verbose mode. Display column headers. Default is false.
"""
return self.transport.perform_request(
"GET",
_make_path("_cat", "segment_replication", index),
params=params,
headers=headers,
)
-601
View File
@@ -1,601 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class CatClient(NamespacedClient):
def aliases(
self,
*,
name: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 allocation(
self,
*,
node_id: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 count(
self,
*,
index: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 health(
self,
*,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
ts: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 help(
self,
*,
help: Optional[Any] = ...,
s: Optional[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 indices(
self,
*,
index: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
health: Optional[Any] = ...,
help: Optional[Any] = ...,
include_unloaded_segments: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
pri: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 master(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 cluster_manager(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 nodes(
self,
*,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
full_id: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 recovery(
self,
*,
index: Optional[Any] = ...,
active_only: Optional[Any] = ...,
bytes: Optional[Any] = ...,
detailed: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 shards(
self,
*,
index: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 segments(
self,
*,
index: Optional[Any] = ...,
bytes: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 pending_tasks(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 thread_pool(
self,
*,
thread_pool_patterns: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
size: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 fielddata(
self,
*,
fields: Optional[Any] = ...,
bytes: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 plugins(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 nodeattrs(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 repositories(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 snapshots(
self,
*,
repository: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 tasks(
self,
*,
actions: Optional[Any] = ...,
detailed: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
nodes: Optional[Any] = ...,
parent_task_id: Optional[Any] = ...,
s: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 templates(
self,
*,
name: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
s: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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 all_pit_segments(
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 pit_segments(
self,
*,
body: Optional[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 segment_replication(
self,
*,
index: Optional[Any] = ...,
active_only: Optional[Any] = ...,
bytes: Optional[Any] = ...,
completed_only: Optional[Any] = ...,
detailed: Optional[Any] = ...,
format: Optional[Any] = ...,
h: Optional[Any] = ...,
help: Optional[Any] = ...,
s: Optional[Any] = ...,
shards: Optional[Any] = ...,
time: Optional[Any] = ...,
v: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
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: ...
+42
View File
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any, Optional, Type
from opensearchpy.client.utils import _normalize_hosts
from opensearchpy.transport import Transport
class Client(object):
"""
A generic async OpenSearch client.
"""
def __init__(
self,
hosts: Optional[str] = None,
transport_class: Type[Transport] = Transport,
**kwargs: Any
) -> None:
"""
:arg hosts: list of nodes, or a single node, we should connect to.
Node should be a dictionary ({"host": "localhost", "port": 9200}),
the entire dictionary will be passed to the :class:`~opensearchpy.Connection`
class as kwargs, or a string in the format of ``host[:port]`` which will be
translated to a dictionary automatically. If no value is given the
:class:`~opensearchpy.Connection` class defaults will be used.
:arg transport_class: :class:`~opensearchpy.Transport` subclass to use.
:arg kwargs: any additional arguments will be passed on to the
:class:`~opensearchpy.Transport` class and, subsequently, to the
:class:`~opensearchpy.Connection` instances.
"""
self.transport = transport_class(_normalize_hosts(hosts), **kwargs)
+121 -26
View File
@@ -36,6 +36,8 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
@@ -55,7 +57,12 @@ class ClusterClient(NamespacedClient):
"wait_for_nodes", "wait_for_nodes",
"wait_for_status", "wait_for_status",
) )
def health(self, index=None, params=None, headers=None): def health(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns basic information about the health of the cluster. Returns basic information about the health of the cluster.
@@ -99,7 +106,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
def pending_tasks(self, params=None, headers=None): def pending_tasks(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
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.
@@ -128,7 +139,13 @@ class ClusterClient(NamespacedClient):
"wait_for_metadata_version", "wait_for_metadata_version",
"wait_for_timeout", "wait_for_timeout",
) )
def state(self, metric=None, index=None, params=None, headers=None): def state(
self,
metric: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a comprehensive information about the state of the cluster. Returns a comprehensive information about the state of the cluster.
@@ -171,7 +188,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("flat_settings", "timeout") @query_params("flat_settings", "timeout")
def stats(self, node_id=None, params=None, headers=None): def stats(
self,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns high-level overview of cluster statistics. Returns high-level overview of cluster statistics.
@@ -202,7 +224,12 @@ class ClusterClient(NamespacedClient):
"retry_failed", "retry_failed",
"timeout", "timeout",
) )
def reroute(self, body=None, params=None, headers=None): def reroute(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to manually change the allocation of individual shards in the cluster. Allows to manually change the allocation of individual shards in the cluster.
@@ -235,7 +262,11 @@ class ClusterClient(NamespacedClient):
"master_timeout", "master_timeout",
"timeout", "timeout",
) )
def get_settings(self, params=None, headers=None): def get_settings(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns cluster settings. Returns cluster settings.
@@ -258,7 +289,12 @@ class ClusterClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "flat_settings", "master_timeout", "timeout" "cluster_manager_timeout", "flat_settings", "master_timeout", "timeout"
) )
def put_settings(self, body, params=None, headers=None): def put_settings(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the cluster settings. Updates the cluster settings.
@@ -282,7 +318,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
def remote_info(self, params=None, headers=None): def remote_info(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the information about configured remote clusters. Returns the information about configured remote clusters.
@@ -292,7 +332,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("include_disk_info", "include_yes_decisions") @query_params("include_disk_info", "include_yes_decisions")
def allocation_explain(self, body=None, params=None, headers=None): def allocation_explain(
self,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides explanations for shard allocations in the cluster. Provides explanations for shard allocations in the cluster.
@@ -313,7 +358,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_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: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a component template. Deletes a component template.
@@ -337,7 +387,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_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: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns one or more component templates. Returns one or more component templates.
@@ -359,7 +414,13 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "create", "master_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: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a component template. Creates or updates a component template.
@@ -388,7 +449,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
def exists_component_template(self, name, params=None, headers=None): def exists_component_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular component template exist. Returns information about whether a particular component template exist.
@@ -413,7 +479,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params("wait_for_removal") @query_params("wait_for_removal")
def delete_voting_config_exclusions(self, params=None, headers=None): def delete_voting_config_exclusions(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clears cluster voting config exclusions. Clears cluster voting config exclusions.
@@ -430,7 +500,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params("node_ids", "node_names", "timeout") @query_params("node_ids", "node_names", "timeout")
def post_voting_config_exclusions(self, params=None, headers=None): def post_voting_config_exclusions(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the cluster voting config exclusions by node ids or node names. Updates the cluster voting config exclusions by node ids or node names.
@@ -448,7 +522,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_decommission_awareness(self, params=None, headers=None): def delete_decommission_awareness(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete any existing decommission. Delete any existing decommission.
@@ -461,7 +539,11 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_weighted_routing(self, params=None, headers=None): def delete_weighted_routing(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete weighted shard routing weights. Delete weighted shard routing weights.
@@ -475,8 +557,11 @@ class ClusterClient(NamespacedClient):
@query_params() @query_params()
def get_decommission_awareness( def get_decommission_awareness(
self, awareness_attribute_name, params=None, headers=None self,
): awareness_attribute_name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Get details and status of decommissioned attribute. Get details and status of decommissioned attribute.
@@ -502,7 +587,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
def get_weighted_routing(self, attribute, params=None, headers=None): def get_weighted_routing(
self,
attribute: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Fetches weighted shard routing weights. Fetches weighted shard routing weights.
@@ -522,11 +612,11 @@ class ClusterClient(NamespacedClient):
@query_params() @query_params()
def put_decommission_awareness( def put_decommission_awareness(
self, self,
awareness_attribute_name, awareness_attribute_name: Any,
awareness_attribute_value, awareness_attribute_value: Any,
params=None, params: Any = None,
headers=None, headers: Any = None,
): ) -> Any:
""" """
Decommissions an awareness attribute. Decommissions an awareness attribute.
@@ -552,7 +642,12 @@ class ClusterClient(NamespacedClient):
) )
@query_params() @query_params()
def put_weighted_routing(self, attribute, params=None, headers=None): def put_weighted_routing(
self,
attribute: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates weighted shard routing weights. Updates weighted shard routing weights.
-456
View File
@@ -1,456 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class ClusterClient(NamespacedClient):
def health(
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] = ...,
timeout: Optional[Any] = ...,
wait_for_active_shards: Optional[Any] = ...,
wait_for_events: Optional[Any] = ...,
wait_for_no_initializing_shards: Optional[Any] = ...,
wait_for_no_relocating_shards: Optional[Any] = ...,
wait_for_nodes: Optional[Any] = ...,
wait_for_status: Optional[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 pending_tasks(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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 state(
self,
*,
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] = ...,
wait_for_metadata_version: Optional[Any] = ...,
wait_for_timeout: Optional[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 stats(
self,
*,
node_id: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
timeout: Optional[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 reroute(
self,
*,
body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
dry_run: Optional[Any] = ...,
explain: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
metric: Optional[Any] = ...,
retry_failed: Optional[Any] = ...,
timeout: Optional[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_settings(
self,
*,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
include_defaults: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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_settings(
self,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 remote_info(
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 allocation_explain(
self,
*,
body: Optional[Any] = ...,
include_disk_info: Optional[Any] = ...,
include_yes_decisions: Optional[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 delete_component_template(
self,
name: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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_component_template(
self,
*,
name: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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_component_template(
self,
name: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
create: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 exists_component_template(
self,
name: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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]] = ...,
) -> bool: ...
def delete_voting_config_exclusions(
self,
*,
wait_for_removal: Optional[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 post_voting_config_exclusions(
self,
*,
node_ids: Optional[Any] = ...,
node_names: Optional[Any] = ...,
timeout: Optional[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 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: ...
+19 -3
View File
@@ -36,6 +36,8 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
@@ -43,7 +45,12 @@ class DanglingIndicesClient(NamespacedClient):
@query_params( @query_params(
"accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout" "accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout"
) )
def delete_dangling_index(self, index_uuid, params=None, headers=None): def delete_dangling_index(
self,
index_uuid: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes the specified dangling index. Deletes the specified dangling index.
@@ -71,7 +78,12 @@ class DanglingIndicesClient(NamespacedClient):
@query_params( @query_params(
"accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout" "accept_data_loss", "cluster_manager_timeout", "master_timeout", "timeout"
) )
def import_dangling_index(self, index_uuid, params=None, headers=None): def import_dangling_index(
self,
index_uuid: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Imports the specified dangling index. Imports the specified dangling index.
@@ -94,7 +106,11 @@ class DanglingIndicesClient(NamespacedClient):
) )
@query_params() @query_params()
def list_dangling_indices(self, params=None, headers=None): def list_dangling_indices(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns all dangling indices. Returns all dangling indices.
-99
View File
@@ -1,99 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class DanglingIndicesClient(NamespacedClient):
def delete_dangling_index(
self,
index_uuid: Any,
*,
accept_data_loss: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 import_dangling_index(
self,
index_uuid: Any,
*,
accept_data_loss: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 list_dangling_indices(
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: ...
+4 -2
View File
@@ -26,12 +26,14 @@
# under the License. # under the License.
from typing import Any
from .utils import NamespacedClient, query_params from .utils import NamespacedClient, query_params
class FeaturesClient(NamespacedClient): class FeaturesClient(NamespacedClient):
@query_params("master_timeout", "cluster_manager_timeout") @query_params("master_timeout", "cluster_manager_timeout")
def get_features(self, params=None, headers=None): def get_features(self, params: Any = None, headers: Any = None) -> Any:
""" """
Gets a list of features which can be included in snapshots using the Gets a list of features which can be included in snapshots using the
feature_states field when creating a snapshot feature_states field when creating a snapshot
@@ -47,7 +49,7 @@ class FeaturesClient(NamespacedClient):
) )
@query_params() @query_params()
def reset_features(self, params=None, headers=None): def reset_features(self, params: Any = None, headers: Any = None) -> Any:
""" """
Resets the internal state of features, usually by deleting system indices Resets the internal state of features, usually by deleting system indices
-66
View File
@@ -1,66 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Collection, MutableMapping, Optional, Tuple, Union
from .utils import NamespacedClient
class FeaturesClient(NamespacedClient):
def get_features(
self,
*,
master_timeout: Optional[Any] = ...,
cluster_manager_timeout: Optional[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 reset_features(
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: ...
+317 -48
View File
@@ -36,12 +36,20 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IndicesClient(NamespacedClient): class IndicesClient(NamespacedClient):
@query_params() @query_params()
def analyze(self, body=None, index=None, params=None, headers=None): def analyze(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the analysis process on a text and return the tokens breakdown of the Performs the analysis process on a text and return the tokens breakdown of the
text. text.
@@ -60,7 +68,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
def refresh(self, index=None, params=None, headers=None): def refresh(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the refresh operation in one or more indices. Performs the refresh operation in one or more indices.
@@ -87,7 +100,12 @@ class IndicesClient(NamespacedClient):
"ignore_unavailable", "ignore_unavailable",
"wait_if_ongoing", "wait_if_ongoing",
) )
def flush(self, index=None, params=None, headers=None): def flush(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the flush operation on one or more indices. Performs the flush operation on one or more indices.
@@ -119,7 +137,13 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards" "cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards"
) )
def create(self, index, body=None, params=None, headers=None): def create(
self,
index: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates an index with optional settings and mappings. Creates an index with optional settings and mappings.
@@ -146,7 +170,14 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards" "cluster_manager_timeout", "master_timeout", "timeout", "wait_for_active_shards"
) )
def clone(self, index, target, body=None, params=None, headers=None): def clone(
self,
index: Any,
target: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clones an index. Clones an index.
@@ -186,7 +217,12 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
def get(self, index, params=None, headers=None): def get(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about one or more indices. Returns information about one or more indices.
@@ -229,7 +265,12 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def open(self, index, params=None, headers=None): def open(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Opens an index. Opens an index.
@@ -268,7 +309,12 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def close(self, index, params=None, headers=None): def close(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Closes an index. Closes an index.
@@ -306,7 +352,12 @@ class IndicesClient(NamespacedClient):
"master_timeout", "master_timeout",
"timeout", "timeout",
) )
def delete(self, index, params=None, headers=None): def delete(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an index. Deletes an index.
@@ -344,7 +395,12 @@ class IndicesClient(NamespacedClient):
"include_defaults", "include_defaults",
"local", "local",
) )
def exists(self, index, params=None, headers=None): def exists(
self,
index: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular index exists. Returns information about whether a particular index exists.
@@ -382,7 +438,13 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"write_index_only", "write_index_only",
) )
def put_mapping(self, body, index=None, params=None, headers=None): def put_mapping(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the index mappings. Updates the index mappings.
@@ -429,7 +491,12 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
def get_mapping(self, index=None, params=None, headers=None): def get_mapping(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns mappings for one or more indices. Returns mappings for one or more indices.
@@ -463,7 +530,13 @@ class IndicesClient(NamespacedClient):
"include_defaults", "include_defaults",
"local", "local",
) )
def get_field_mapping(self, fields, index=None, params=None, headers=None): def get_field_mapping(
self,
fields: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns mapping for one or more fields. Returns mapping for one or more fields.
@@ -494,7 +567,14 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def put_alias(self, index, name, body=None, params=None, headers=None): def put_alias(
self,
index: Any,
name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates an alias. Creates or updates an alias.
@@ -524,7 +604,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local")
def exists_alias(self, name, index=None, params=None, headers=None): def exists_alias(
self,
name: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular alias exists. Returns information about whether a particular alias exists.
@@ -550,7 +636,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local")
def get_alias(self, index=None, name=None, params=None, headers=None): def get_alias(
self,
index: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns an alias. Returns an alias.
@@ -573,7 +665,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def update_aliases(self, body, params=None, headers=None): def update_aliases(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates index aliases. Updates index aliases.
@@ -594,7 +691,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_alias(self, index, name, params=None, headers=None): def delete_alias(
self,
index: Any,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an alias. Deletes an alias.
@@ -619,7 +722,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "create", "master_timeout", "order") @query_params("cluster_manager_timeout", "create", "master_timeout", "order")
def put_template(self, name, body, params=None, headers=None): def put_template(
self,
name: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates an index template. Creates or updates an index template.
@@ -650,7 +759,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
def exists_template(self, name, params=None, headers=None): def exists_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular index template exists. Returns information about whether a particular index template exists.
@@ -674,7 +788,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
def get_template(self, name=None, params=None, headers=None): def get_template(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns an index template. Returns an index template.
@@ -695,7 +814,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_template(self, name, params=None, headers=None): def delete_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an index template. Deletes an index template.
@@ -725,7 +849,13 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
def get_settings(self, index=None, name=None, params=None, headers=None): def get_settings(
self,
index: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns settings for one or more indices. Returns settings for one or more indices.
@@ -767,7 +897,13 @@ class IndicesClient(NamespacedClient):
"preserve_existing", "preserve_existing",
"timeout", "timeout",
) )
def put_settings(self, body, index=None, params=None, headers=None): def put_settings(
self,
body: Any,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the index settings. Updates the index settings.
@@ -817,7 +953,13 @@ class IndicesClient(NamespacedClient):
"include_unloaded_segments", "include_unloaded_segments",
"level", "level",
) )
def stats(self, index=None, metric=None, params=None, headers=None): def stats(
self,
index: Any = None,
metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides statistics on operations happening in an index. Provides statistics on operations happening in an index.
@@ -858,7 +1000,12 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "verbose"
) )
def segments(self, index=None, params=None, headers=None): def segments(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides low-level information about segments in a Lucene index. Provides low-level information about segments in a Lucene index.
@@ -894,7 +1041,13 @@ class IndicesClient(NamespacedClient):
"q", "q",
"rewrite", "rewrite",
) )
def validate_query(self, body=None, index=None, params=None, headers=None): def validate_query(
self,
body: Any = None,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows a user to validate a potentially expensive query without executing it. Allows a user to validate a potentially expensive query without executing it.
@@ -943,7 +1096,12 @@ class IndicesClient(NamespacedClient):
"query", "query",
"request", "request",
) )
def clear_cache(self, index=None, params=None, headers=None): def clear_cache(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clears all or specific caches for one or more indices. Clears all or specific caches for one or more indices.
@@ -969,7 +1127,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("active_only", "detailed") @query_params("active_only", "detailed")
def recovery(self, index=None, params=None, headers=None): def recovery(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about ongoing index shard recoveries. Returns information about ongoing index shard recoveries.
@@ -992,7 +1155,12 @@ class IndicesClient(NamespacedClient):
"only_ancient_segments", "only_ancient_segments",
"wait_for_completion", "wait_for_completion",
) )
def upgrade(self, index=None, params=None, headers=None): def upgrade(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
The _upgrade API is no longer useful and will be removed. The _upgrade API is no longer useful and will be removed.
@@ -1017,7 +1185,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable") @query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
def get_upgrade(self, index=None, params=None, headers=None): def get_upgrade(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
The _upgrade API is no longer useful and will be removed. The _upgrade API is no longer useful and will be removed.
@@ -1040,7 +1213,12 @@ class IndicesClient(NamespacedClient):
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status"
) )
def shard_stores(self, index=None, params=None, headers=None): def shard_stores(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides store information for shard copies of indices. Provides store information for shard copies of indices.
@@ -1070,7 +1248,12 @@ class IndicesClient(NamespacedClient):
"max_num_segments", "max_num_segments",
"only_expunge_deletes", "only_expunge_deletes",
) )
def forcemerge(self, index=None, params=None, headers=None): def forcemerge(
self,
index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Performs the force merge operation on one or more indices. Performs the force merge operation on one or more indices.
@@ -1103,7 +1286,14 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def shrink(self, index, target, body=None, params=None, headers=None): def shrink(
self,
index: Any,
target: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allow to shrink an existing index into a new index with fewer primary shards. Allow to shrink an existing index into a new index with fewer primary shards.
@@ -1142,7 +1332,14 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def split(self, index, target, body=None, params=None, headers=None): def split(
self,
index: Any,
target: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows you to split an existing index into a new index with more primary Allows you to split an existing index into a new index with more primary
shards. shards.
@@ -1182,7 +1379,14 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def rollover(self, alias, body=None, new_index=None, params=None, headers=None): def rollover(
self,
alias: Any,
body: Any = None,
new_index: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates an alias to point to a new index when the existing index is considered Updates an alias to point to a new index when the existing index is considered
to be too large or too old. to be too large or too old.
@@ -1217,7 +1421,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
def create_data_stream(self, name, body=None, params=None, headers=None): def create_data_stream(
self,
name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a data stream. Creates or updates a data stream.
@@ -1237,7 +1447,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_data_stream(self, name, params=None, headers=None): def delete_data_stream(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a data stream. Deletes a data stream.
@@ -1253,7 +1468,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_index_template(self, name, params=None, headers=None): def delete_index_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes an index template. Deletes an index template.
@@ -1277,7 +1497,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
def exists_index_template(self, name, params=None, headers=None): def exists_index_template(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about whether a particular index template exists. Returns information about whether a particular index template exists.
@@ -1301,7 +1526,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout") @query_params("cluster_manager_timeout", "flat_settings", "local", "master_timeout")
def get_index_template(self, name=None, params=None, headers=None): def get_index_template(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns an index template. Returns an index template.
@@ -1322,7 +1552,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cause", "cluster_manager_timeout", "create", "master_timeout") @query_params("cause", "cluster_manager_timeout", "create", "master_timeout")
def put_index_template(self, name, body, params=None, headers=None): def put_index_template(
self,
name: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates an index template. Creates or updates an index template.
@@ -1352,7 +1588,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cause", "cluster_manager_timeout", "create", "master_timeout") @query_params("cause", "cluster_manager_timeout", "create", "master_timeout")
def simulate_index_template(self, name, body=None, params=None, headers=None): def simulate_index_template(
self,
name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Simulate matching the given index name against the index templates in the Simulate matching the given index name against the index templates in the
system. system.
@@ -1385,7 +1627,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
def get_data_stream(self, name=None, params=None, headers=None): def get_data_stream(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns data streams. Returns data streams.
@@ -1398,7 +1645,13 @@ class IndicesClient(NamespacedClient):
) )
@query_params("cause", "cluster_manager_timeout", "create", "master_timeout") @query_params("cause", "cluster_manager_timeout", "create", "master_timeout")
def simulate_template(self, body=None, name=None, params=None, headers=None): def simulate_template(
self,
body: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Simulate resolving the given template name or body. Simulate resolving the given template name or body.
@@ -1426,7 +1679,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params("expand_wildcards") @query_params("expand_wildcards")
def resolve_index(self, name, params=None, headers=None): def resolve_index(
self,
name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about any matching indices, aliases, and data streams. Returns information about any matching indices, aliases, and data streams.
@@ -1452,7 +1710,13 @@ class IndicesClient(NamespacedClient):
"master_timeout", "master_timeout",
"timeout", "timeout",
) )
def add_block(self, index, block, params=None, headers=None): def add_block(
self,
index: Any,
block: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Adds a block to an index. Adds a block to an index.
@@ -1484,7 +1748,12 @@ class IndicesClient(NamespacedClient):
) )
@query_params() @query_params()
def data_streams_stats(self, name=None, params=None, headers=None): def data_streams_stats(
self,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Provides statistics on operations happening in a data stream. Provides statistics on operations happening in a data stream.
File diff suppressed because it is too large Load Diff
+33 -5
View File
@@ -36,12 +36,19 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class IngestClient(NamespacedClient): class IngestClient(NamespacedClient):
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
def get_pipeline(self, id=None, params=None, headers=None): def get_pipeline(
self,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a pipeline. Returns a pipeline.
@@ -59,7 +66,13 @@ class IngestClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def put_pipeline(self, id, body, params=None, headers=None): def put_pipeline(
self,
id: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates a pipeline. Creates or updates a pipeline.
@@ -86,7 +99,12 @@ class IngestClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_pipeline(self, id, params=None, headers=None): def delete_pipeline(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a pipeline. Deletes a pipeline.
@@ -110,7 +128,13 @@ class IngestClient(NamespacedClient):
) )
@query_params("verbose") @query_params("verbose")
def simulate(self, body, id=None, params=None, headers=None): def simulate(
self,
body: Any,
id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Allows to simulate a pipeline with example documents. Allows to simulate a pipeline with example documents.
@@ -132,7 +156,11 @@ class IngestClient(NamespacedClient):
) )
@query_params() @query_params()
def processor_grok(self, params=None, headers=None): def processor_grok(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a list of the built-in patterns. Returns a list of the built-in patterns.
-136
View File
@@ -1,136 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class IngestClient(NamespacedClient):
def get_pipeline(
self,
*,
id: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[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_pipeline(
self,
id: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 delete_pipeline(
self,
id: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 simulate(
self,
*,
body: Any,
id: Optional[Any] = ...,
verbose: Optional[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 processor_grok(
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: ...
+35 -7
View File
@@ -36,14 +36,20 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import NamespacedClient, _make_path, query_params from .utils import NamespacedClient, _make_path, query_params
class NodesClient(NamespacedClient): class NodesClient(NamespacedClient):
@query_params("timeout") @query_params("timeout")
def reload_secure_settings( def reload_secure_settings(
self, body=None, node_id=None, params=None, headers=None self,
): body: Any = None,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Reloads secure settings. Reloads secure settings.
@@ -64,7 +70,13 @@ class NodesClient(NamespacedClient):
) )
@query_params("flat_settings", "timeout") @query_params("flat_settings", "timeout")
def info(self, node_id=None, metric=None, params=None, headers=None): def info(
self,
node_id: Any = None,
metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about nodes in the cluster. Returns information about nodes in the cluster.
@@ -95,8 +107,13 @@ class NodesClient(NamespacedClient):
"types", "types",
) )
def stats( def stats(
self, node_id=None, metric=None, index_metric=None, params=None, headers=None self,
): node_id: Any = None,
metric: Any = None,
index_metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns statistical information about nodes in the cluster. Returns statistical information about nodes in the cluster.
@@ -140,7 +157,12 @@ class NodesClient(NamespacedClient):
@query_params( @query_params(
"doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout" "doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout"
) )
def hot_threads(self, node_id=None, params=None, headers=None): def hot_threads(
self,
node_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about hot threads on each node in the cluster. Returns information about hot threads on each node in the cluster.
@@ -173,7 +195,13 @@ class NodesClient(NamespacedClient):
) )
@query_params("timeout") @query_params("timeout")
def usage(self, node_id=None, metric=None, params=None, headers=None): def usage(
self,
node_id: Any = None,
metric: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns low-level information about REST actions usage on nodes. Returns low-level information about REST actions usage on nodes.
-149
View File
@@ -1,149 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class NodesClient(NamespacedClient):
def reload_secure_settings(
self,
*,
body: Optional[Any] = ...,
node_id: Optional[Any] = ...,
timeout: Optional[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 info(
self,
*,
node_id: Optional[Any] = ...,
metric: Optional[Any] = ...,
flat_settings: Optional[Any] = ...,
timeout: Optional[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 stats(
self,
*,
node_id: Optional[Any] = ...,
metric: Optional[Any] = ...,
index_metric: Optional[Any] = ...,
completion_fields: Optional[Any] = ...,
fielddata_fields: Optional[Any] = ...,
fields: Optional[Any] = ...,
groups: Optional[Any] = ...,
include_segment_file_sizes: Optional[Any] = ...,
level: Optional[Any] = ...,
timeout: Optional[Any] = ...,
types: Optional[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 hot_threads(
self,
*,
node_id: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
ignore_idle_threads: Optional[Any] = ...,
interval: Optional[Any] = ...,
snapshots: Optional[Any] = ...,
threads: Optional[Any] = ...,
timeout: Optional[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 usage(
self,
*,
node_id: Optional[Any] = ...,
metric: Optional[Any] = ...,
timeout: Optional[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: ...
+7 -2
View File
@@ -9,14 +9,19 @@
# GitHub history for details. # GitHub history for details.
import warnings import warnings
from typing import Any
from ..plugins.alerting import AlertingClient from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient from ..plugins.index_management import IndexManagementClient
from .client import Client
from .utils import NamespacedClient from .utils import NamespacedClient
class PluginsClient(NamespacedClient): class PluginsClient(NamespacedClient):
def __init__(self, client): alerting: Any
index_management: Any
def __init__(self, client: Client) -> None:
super(PluginsClient, self).__init__(client) super(PluginsClient, self).__init__(client)
# self.query_workbench = QueryWorkbenchClient(client) # self.query_workbench = QueryWorkbenchClient(client)
# self.reporting = ReportingClient(client) # self.reporting = ReportingClient(client)
@@ -28,7 +33,7 @@ class PluginsClient(NamespacedClient):
self._dynamic_lookup(client) self._dynamic_lookup(client)
def _dynamic_lookup(self, client): def _dynamic_lookup(self, client: Any) -> None:
# Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742
plugins = [ plugins = [
-19
View File
@@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
from typing import Any
from ..client import OpenSearch
from ..plugins.alerting import AlertingClient as AlertingClient
from .utils import NamespacedClient as NamespacedClient
class PluginsClient(NamespacedClient):
alerting: Any
index_management: Any
def __init__(self, client: OpenSearch) -> None: ...
+3 -1
View File
@@ -26,12 +26,14 @@
# under the License. # under the License.
from typing import Any
from .utils import NamespacedClient, query_params from .utils import NamespacedClient, query_params
class RemoteClient(NamespacedClient): class RemoteClient(NamespacedClient):
@query_params() @query_params()
def info(self, params=None, headers=None): def info(self, params: Any = None, headers: Any = None) -> Any:
return self.transport.perform_request( return self.transport.perform_request(
"GET", "/_remote/info", params=params, headers=headers "GET", "/_remote/info", params=params, headers=headers
) )
-46
View File
@@ -1,46 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Collection, MutableMapping, Optional, Tuple, Union
from .utils import NamespacedClient
class RemoteClient(NamespacedClient):
def info(
self,
*,
timeout: Optional[Any] = None,
pretty: Optional[bool] = None,
human: Optional[bool] = None,
error_trace: Optional[bool] = None,
format: Optional[str] = None,
filter_path: Optional[Union[str, Collection[str]]] = None,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = None,
headers: Optional[MutableMapping[str, str]] = None,
) -> Any: ...
+9 -1
View File
@@ -7,6 +7,7 @@
# #
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
# ---------------------------------------------------- # ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. # THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
# #
@@ -17,12 +18,19 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, query_params from .utils import SKIP_IN_PATH, NamespacedClient, query_params
class RemoteStoreClient(NamespacedClient): class RemoteStoreClient(NamespacedClient):
@query_params("cluster_manager_timeout", "wait_for_completion") @query_params("cluster_manager_timeout", "wait_for_completion")
def restore(self, body, params=None, headers=None): def restore(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Restores from remote store. Restores from remote store.
-42
View File
@@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ----------------------------------------------------
# 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
class RemoteStoreClient(NamespacedClient):
def restore(
self,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
wait_for_completion: Optional[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: ...
+282 -50
View File
@@ -8,7 +8,6 @@
# Modifications Copyright OpenSearch Contributors. See # Modifications Copyright OpenSearch Contributors. See
# GitHub history for details. # GitHub history for details.
# ---------------------------------------------------- # ----------------------------------------------------
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. # THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
# #
@@ -19,14 +18,20 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SecurityClient(NamespacedClient): class SecurityClient(NamespacedClient):
from ._patch import health_check, update_audit_config from ._patch import health_check, update_audit_config # type: ignore
@query_params() @query_params()
def get_account_details(self, params=None, headers=None): def get_account_details(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns account details for the current user. Returns account details for the current user.
@@ -36,7 +41,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def change_password(self, body, params=None, headers=None): def change_password(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Changes the password for the current user. Changes the password for the current user.
@@ -54,7 +64,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_action_group(self, action_group, params=None, headers=None): def get_action_group(
self,
action_group: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one action group. Retrieves one action group.
@@ -74,7 +89,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_action_groups(self, params=None, headers=None): def get_action_groups(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all action groups. Retrieves all action groups.
@@ -87,7 +106,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_action_group(self, action_group, params=None, headers=None): def delete_action_group(
self,
action_group: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete a specified action group. Delete a specified action group.
@@ -107,7 +131,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def create_action_group(self, action_group, body, params=None, headers=None): def create_action_group(
self,
action_group: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified action group. Creates or replaces the specified action group.
@@ -128,7 +158,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_action_group(self, action_group, body, params=None, headers=None): def patch_action_group(
self,
action_group: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of an action group. Updates individual attributes of an action group.
@@ -147,7 +183,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_action_groups(self, body, params=None, headers=None): def patch_action_groups(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates, updates, or deletes multiple action groups in a single call. Creates, updates, or deletes multiple action groups in a single call.
@@ -165,7 +206,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_user(self, username, params=None, headers=None): def get_user(
self,
username: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieve one internal user. Retrieve one internal user.
@@ -182,7 +228,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_users(self, params=None, headers=None): def get_users(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieve all internal users. Retrieve all internal users.
@@ -195,7 +245,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_user(self, username, params=None, headers=None): def delete_user(
self,
username: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete the specified user. Delete the specified user.
@@ -212,7 +267,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def create_user(self, username, body, params=None, headers=None): def create_user(
self,
username: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified user. Creates or replaces the specified user.
@@ -231,7 +292,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_user(self, username, body, params=None, headers=None): def patch_user(
self,
username: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of an internal user. Updates individual attributes of an internal user.
@@ -250,7 +317,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_users(self, body, params=None, headers=None): def patch_users(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates, updates, or deletes multiple internal users in a single call. Creates, updates, or deletes multiple internal users in a single call.
@@ -268,7 +340,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_role(self, role, params=None, headers=None): def get_role(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one role. Retrieves one role.
@@ -285,7 +362,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_roles(self, params=None, headers=None): def get_roles(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all roles. Retrieves all roles.
@@ -295,7 +376,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_role(self, role, params=None, headers=None): def delete_role(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete the specified role. Delete the specified role.
@@ -312,7 +398,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def create_role(self, role, body, params=None, headers=None): def create_role(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified role. Creates or replaces the specified role.
@@ -331,7 +423,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_role(self, role, body, params=None, headers=None): def patch_role(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of a role. Updates individual attributes of a role.
@@ -350,7 +448,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_roles(self, body, params=None, headers=None): def patch_roles(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates, updates, or deletes multiple roles in a single call. Creates, updates, or deletes multiple roles in a single call.
@@ -368,7 +471,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_role_mapping(self, role, params=None, headers=None): def get_role_mapping(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one role mapping. Retrieves one role mapping.
@@ -385,7 +493,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_role_mappings(self, params=None, headers=None): def get_role_mappings(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all role mappings. Retrieves all role mappings.
@@ -398,7 +510,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_role_mapping(self, role, params=None, headers=None): def delete_role_mapping(
self,
role: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes the specified role mapping. Deletes the specified role mapping.
@@ -415,7 +532,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def create_role_mapping(self, role, body, params=None, headers=None): def create_role_mapping(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified role mapping. Creates or replaces the specified role mapping.
@@ -434,7 +557,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_role_mapping(self, role, body, params=None, headers=None): def patch_role_mapping(
self,
role: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates individual attributes of a role mapping. Updates individual attributes of a role mapping.
@@ -453,7 +582,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_role_mappings(self, body, params=None, headers=None): def patch_role_mappings(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or updates multiple role mappings in a single call. Creates or updates multiple role mappings in a single call.
@@ -471,7 +605,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_tenant(self, tenant, params=None, headers=None): def get_tenant(
self,
tenant: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves one tenant. Retrieves one tenant.
@@ -488,7 +627,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_tenants(self, params=None, headers=None): def get_tenants(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all tenants. Retrieves all tenants.
@@ -498,7 +641,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_tenant(self, tenant, params=None, headers=None): def delete_tenant(
self,
tenant: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Delete the specified tenant. Delete the specified tenant.
@@ -515,7 +663,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def create_tenant(self, tenant, body, params=None, headers=None): def create_tenant(
self,
tenant: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates or replaces the specified tenant. Creates or replaces the specified tenant.
@@ -534,7 +688,13 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_tenant(self, tenant, body, params=None, headers=None): def patch_tenant(
self,
tenant: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Add, delete, or modify a single tenant. Add, delete, or modify a single tenant.
@@ -553,7 +713,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_tenants(self, body, params=None, headers=None): def patch_tenants(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Add, delete, or modify multiple tenants in a single call. Add, delete, or modify multiple tenants in a single call.
@@ -571,7 +736,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_configuration(self, params=None, headers=None): def get_configuration(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns the current Security plugin configuration in JSON format. Returns the current Security plugin configuration in JSON format.
@@ -584,7 +753,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def update_configuration(self, body, params=None, headers=None): def update_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Adds or updates the existing configuration using the REST API. Adds or updates the existing configuration using the REST API.
@@ -602,7 +776,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_configuration(self, body, params=None, headers=None): def patch_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
A PATCH call is used to update the existing configuration using the REST API. A PATCH call is used to update the existing configuration using the REST API.
@@ -620,7 +799,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_distinguished_names(self, cluster_name=None, params=None, headers=None): def get_distinguished_names(
self,
cluster_name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves all distinguished names in the allow list. Retrieves all distinguished names in the allow list.
@@ -635,8 +819,12 @@ class SecurityClient(NamespacedClient):
@query_params() @query_params()
def update_distinguished_names( def update_distinguished_names(
self, cluster_name, body=None, params=None, headers=None self,
): cluster_name: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Adds or updates the specified distinguished names in the clusters or nodes Adds or updates the specified distinguished names in the clusters or nodes
allow list. allow list.
@@ -657,7 +845,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def delete_distinguished_names(self, cluster_name, params=None, headers=None): def delete_distinguished_names(
self,
cluster_name: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes all distinguished names in the specified clusters or nodes allow Deletes all distinguished names in the specified clusters or nodes allow
list. list.
@@ -677,7 +870,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_certificates(self, params=None, headers=None): def get_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves the clusters security certificates. Retrieves the clusters security certificates.
@@ -687,7 +884,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def reload_transport_certificates(self, params=None, headers=None): def reload_transport_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Reload transport layer communication certificates. Reload transport layer communication certificates.
@@ -700,7 +901,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def reload_http_certificates(self, params=None, headers=None): def reload_http_certificates(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Reload HTTP layer communication certificates. Reload HTTP layer communication certificates.
@@ -713,7 +918,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def flush_cache(self, params=None, headers=None): def flush_cache(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Flushes the Security plugin user, authentication, and authorization cache. Flushes the Security plugin user, authentication, and authorization cache.
@@ -723,7 +932,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def health(self, params=None, headers=None): def health(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Checks to see if the Security plugin is up and running. Checks to see if the Security plugin is up and running.
@@ -733,7 +946,11 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def get_audit_configuration(self, params=None, headers=None): def get_audit_configuration(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Retrieves the audit configuration. Retrieves the audit configuration.
@@ -743,7 +960,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def update_audit_configuration(self, body, params=None, headers=None): def update_audit_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Updates the audit configuration. Updates the audit configuration.
@@ -761,7 +983,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_audit_configuration(self, body, params=None, headers=None): def patch_audit_configuration(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
A PATCH call is used to update specified fields in the audit configuration. A PATCH call is used to update specified fields in the audit configuration.
@@ -779,7 +1006,12 @@ class SecurityClient(NamespacedClient):
) )
@query_params() @query_params()
def patch_distinguished_names(self, body, params=None, headers=None): def patch_distinguished_names(
self,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Bulk update of distinguished names. Bulk update of distinguished names.
-821
View File
@@ -1,821 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ----------------------------------------------------
# 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
class SecurityClient(NamespacedClient):
def get_account_details(
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 change_password(
self,
*,
body: 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_action_group(
self,
action_group: 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_action_groups(
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_action_group(
self,
action_group: 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 create_action_group(
self,
action_group: Any,
*,
body: 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 patch_action_group(
self,
action_group: Any,
*,
body: 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 patch_action_groups(
self,
*,
body: 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_user(
self,
username: 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_users(
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_user(
self,
username: 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 create_user(
self,
username: Any,
*,
body: 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 patch_user(
self,
username: Any,
*,
body: 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 patch_users(
self,
*,
body: 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_role(
self,
role: 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_roles(
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_role(
self,
role: 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 create_role(
self,
role: Any,
*,
body: 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 patch_role(
self,
role: Any,
*,
body: 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 patch_roles(
self,
*,
body: 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_role_mapping(
self,
role: 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_role_mappings(
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_role_mapping(
self,
role: 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 create_role_mapping(
self,
role: Any,
*,
body: 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 patch_role_mapping(
self,
role: Any,
*,
body: 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 patch_role_mappings(
self,
*,
body: 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_tenant(
self,
tenant: 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_tenants(
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_tenant(
self,
tenant: 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 create_tenant(
self,
tenant: Any,
*,
body: 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 patch_tenant(
self,
tenant: Any,
*,
body: 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 patch_tenants(
self,
*,
body: 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_configuration(
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 update_configuration(
self,
*,
body: 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 patch_configuration(
self,
*,
body: 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_distinguished_names(
self,
*,
cluster_name: Optional[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 update_distinguished_names(
self,
cluster_name: Any,
*,
body: Optional[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 delete_distinguished_names(
self,
cluster_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_certificates(
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 reload_transport_certificates(
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 reload_http_certificates(
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 flush_cache(
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 health(
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_audit_configuration(
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 update_audit_configuration(
self,
*,
body: 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 patch_audit_configuration(
self,
*,
body: 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 patch_distinguished_names(
self,
*,
body: 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: ...
+78 -12
View File
@@ -36,12 +36,21 @@
# ----------------------------------------------------- # -----------------------------------------------------
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class SnapshotClient(NamespacedClient): class SnapshotClient(NamespacedClient):
@query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion") @query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion")
def create(self, repository, snapshot, body=None, params=None, headers=None): def create(
self,
repository: Any,
snapshot: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates a snapshot in a repository. Creates a snapshot in a repository.
@@ -70,7 +79,13 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
def delete(self, repository, snapshot, params=None, headers=None): def delete(
self,
repository: Any,
snapshot: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a snapshot. Deletes a snapshot.
@@ -97,7 +112,13 @@ class SnapshotClient(NamespacedClient):
@query_params( @query_params(
"cluster_manager_timeout", "ignore_unavailable", "master_timeout", "verbose" "cluster_manager_timeout", "ignore_unavailable", "master_timeout", "verbose"
) )
def get(self, repository, snapshot, params=None, headers=None): def get(
self,
repository: Any,
snapshot: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about a snapshot. Returns information about a snapshot.
@@ -127,7 +148,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def delete_repository(self, repository, params=None, headers=None): def delete_repository(
self,
repository: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Deletes a repository. Deletes a repository.
@@ -152,7 +178,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "local", "master_timeout") @query_params("cluster_manager_timeout", "local", "master_timeout")
def get_repository(self, repository=None, params=None, headers=None): def get_repository(
self,
repository: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about a repository. Returns information about a repository.
@@ -171,7 +202,13 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout", "verify") @query_params("cluster_manager_timeout", "master_timeout", "timeout", "verify")
def create_repository(self, repository, body, params=None, headers=None): def create_repository(
self,
repository: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Creates a repository. Creates a repository.
@@ -199,7 +236,14 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion") @query_params("cluster_manager_timeout", "master_timeout", "wait_for_completion")
def restore(self, repository, snapshot, body=None, params=None, headers=None): def restore(
self,
repository: Any,
snapshot: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Restores a snapshot. Restores a snapshot.
@@ -228,7 +272,13 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "ignore_unavailable", "master_timeout") @query_params("cluster_manager_timeout", "ignore_unavailable", "master_timeout")
def status(self, repository=None, snapshot=None, params=None, headers=None): def status(
self,
repository: Any = None,
snapshot: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about the status of a snapshot. Returns information about the status of a snapshot.
@@ -252,7 +302,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def verify_repository(self, repository, params=None, headers=None): def verify_repository(
self,
repository: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Verifies a repository. Verifies a repository.
@@ -276,7 +331,12 @@ class SnapshotClient(NamespacedClient):
) )
@query_params("cluster_manager_timeout", "master_timeout", "timeout") @query_params("cluster_manager_timeout", "master_timeout", "timeout")
def cleanup_repository(self, repository, params=None, headers=None): def cleanup_repository(
self,
repository: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Removes stale data from repository. Removes stale data from repository.
@@ -301,8 +361,14 @@ class SnapshotClient(NamespacedClient):
@query_params("cluster_manager_timeout", "master_timeout") @query_params("cluster_manager_timeout", "master_timeout")
def clone( def clone(
self, repository, snapshot, target_snapshot, body, params=None, headers=None self,
): repository: Any,
snapshot: Any,
target_snapshot: Any,
body: Any,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Clones indices from one snapshot into another snapshot in the same repository. Clones indices from one snapshot into another snapshot in the same repository.
-272
View File
@@ -1,272 +0,0 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# 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
class SnapshotClient(NamespacedClient):
def create(
self,
repository: Any,
snapshot: Any,
*,
body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
wait_for_completion: Optional[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 delete(
self,
repository: Any,
snapshot: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[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(
self,
repository: Any,
snapshot: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
verbose: Optional[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 delete_repository(
self,
repository: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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_repository(
self,
*,
repository: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
local: Optional[Any] = ...,
master_timeout: Optional[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 create_repository(
self,
repository: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[Any] = ...,
verify: Optional[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 restore(
self,
repository: Any,
snapshot: Any,
*,
body: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
wait_for_completion: Optional[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 status(
self,
*,
repository: Optional[Any] = ...,
snapshot: Optional[Any] = ...,
cluster_manager_timeout: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
master_timeout: Optional[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 verify_repository(
self,
repository: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 cleanup_repository(
self,
repository: Any,
*,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[Any] = ...,
timeout: Optional[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 clone(
self,
repository: Any,
snapshot: Any,
target_snapshot: Any,
*,
body: Any,
cluster_manager_timeout: Optional[Any] = ...,
master_timeout: Optional[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: ...
+18 -3
View File
@@ -37,6 +37,7 @@
import warnings import warnings
from typing import Any
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
@@ -51,7 +52,11 @@ class TasksClient(NamespacedClient):
"timeout", "timeout",
"wait_for_completion", "wait_for_completion",
) )
def list(self, params=None, headers=None): def list(
self,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns a list of tasks. Returns a list of tasks.
@@ -77,7 +82,12 @@ class TasksClient(NamespacedClient):
) )
@query_params("actions", "nodes", "parent_task_id", "wait_for_completion") @query_params("actions", "nodes", "parent_task_id", "wait_for_completion")
def cancel(self, task_id=None, params=None, headers=None): def cancel(
self,
task_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Cancels a task, if it can be cancelled through an API. Cancels a task, if it can be cancelled through an API.
@@ -103,7 +113,12 @@ class TasksClient(NamespacedClient):
) )
@query_params("timeout", "wait_for_completion") @query_params("timeout", "wait_for_completion")
def get(self, task_id=None, params=None, headers=None): def get(
self,
task_id: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
""" """
Returns information about a task. Returns information about a task.

Some files were not shown because too many files have changed in this diff Show More