diff --git a/opensearchpy/_async/client/plugins.py b/opensearchpy/_async/client/plugins.py index 526e1cab..acf1ec57 100644 --- a/opensearchpy/_async/client/plugins.py +++ b/opensearchpy/_async/client/plugins.py @@ -28,6 +28,15 @@ class PluginsClient(NamespacedClient): alerting: Any index_management: Any + knn: Any + ml: Any + notifications: Any + observability: Any + ppl: Any + query: Any + rollups: Any + sql: Any + transforms: Any def __init__(self, client: Client) -> None: super().__init__(client) @@ -50,13 +59,17 @@ def _dynamic_lookup(self, client: Any) -> None: # Issue : https://github.com/opensearch-project/opensearch-py/issues/90#issuecomment-1003396742 plugins = [ - # "query_workbench", - # "reporting", - # "notebooks", "alerting", - # "anomaly_detection", - # "trace_analytics", "index_management", + "knn", + "ml", + "notifications", + "observability", + "ppl", + "query", + "rollups", + "sql", + "transforms", ] for plugin in plugins: if not hasattr(client, plugin): diff --git a/utils/generate_api.py b/utils/generate_api.py index 1385b3ad..c85ed8d2 100644 --- a/utils/generate_api.py +++ b/utils/generate_api.py @@ -178,18 +178,26 @@ def dump(self) -> None: "opensearchpy/_async/client/plugins.py", "r+", encoding="utf-8" ) as file: content = file.read() - file_content = content.replace( - "super(PluginsClient, self).__init__(client)", - f"super(PluginsClient, self).__init__(client)\n self.{self.namespace} = {self.namespace_new}Client(client)", # pylint: disable=line-too-long + content = content.replace( + "super().__init__(client)\n", + f"super().__init__(client)\n\n self.{self.namespace} = {self.namespace_new}Client(client)", # pylint: disable=line-too-long 1, ) - new_file_content = file_content.replace( + content = content.replace( "from .client import Client", f"from ..plugins.{self.namespace} import {self.namespace_new}Client\nfrom .client import Client", # pylint: disable=line-too-long 1, ) + content = content.replace( + "class PluginsClient(NamespacedClient):\n", + f"class PluginsClient(NamespacedClient): \n {self.namespace}: Any\n", # pylint: disable=line-too-long + 1, + ) + content = content.replace( + "plugins = [", f'plugins = [\n "{self.namespace}",\n' + ) file.seek(0) - file.write(new_file_content) + file.write(content) file.truncate() else: