diff --git a/CHANGELOG.md b/CHANGELOG.md index a85497c9..6d651101 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Changed - Upgrading pytest-asyncio to latest version - 0.21.0 ([#339](https://github.com/opensearch-project/opensearch-py/pull/339)) - Fixed flaky CI tests by replacing httpbin with a simple http_server ([#395](https://github.com/opensearch-project/opensearch-py/pull/395)) +- Move security from plugins to clients ([#442](https://github.com/opensearch-project/opensearch-py/pull/442)) ### Deprecated ### Removed - Removed tests against Python 2.7 in github workflows ([#421](https://github.com/opensearch-project/opensearch-py/pull/421)) diff --git a/docs/source/api-ref/client.md b/docs/source/api-ref/client.md index ce84a12e..3a2d2c2b 100644 --- a/docs/source/api-ref/client.md +++ b/docs/source/api-ref/client.md @@ -28,6 +28,7 @@ clients/ingest_client clients/indices_client clients/nodes_client clients/remote_client +clients/security_client clients/snapshot_client clients/tasks_client clients/features_client diff --git a/docs/source/api-ref/clients/security_client.md b/docs/source/api-ref/clients/security_client.md new file mode 100644 index 00000000..f8995ebf --- /dev/null +++ b/docs/source/api-ref/clients/security_client.md @@ -0,0 +1,5 @@ +# Security Client + +```{eval-rst} +.. autoclass:: opensearchpy.clients.security.SecurityClient +``` diff --git a/docs/source/api-ref/plugins.md b/docs/source/api-ref/plugins.md index 15865d10..a4dacd9b 100644 --- a/docs/source/api-ref/plugins.md +++ b/docs/source/api-ref/plugins.md @@ -9,5 +9,4 @@ maxdepth: 1 plugins/alerting_plugin plugins/index_management_plugin -plugins/security_plugin ``` \ No newline at end of file diff --git a/docs/source/api-ref/plugins/security_plugin.md b/docs/source/api-ref/plugins/security_plugin.md deleted file mode 100644 index b633d242..00000000 --- a/docs/source/api-ref/plugins/security_plugin.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security Plugin - -```{eval-rst} -.. autoclass:: opensearchpy.plugins.security.SecurityClient -``` diff --git a/opensearchpy/_async/client/__init__.py b/opensearchpy/_async/client/__init__.py index 2f615515..57f56b0f 100644 --- a/opensearchpy/_async/client/__init__.py +++ b/opensearchpy/_async/client/__init__.py @@ -39,6 +39,7 @@ from .ingest import IngestClient from .nodes import NodesClient from .plugins import PluginsClient from .remote import RemoteClient +from .security import SecurityClient from .snapshot import SnapshotClient from .tasks import TasksClient from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params @@ -196,12 +197,14 @@ class AsyncOpenSearch(object): self.ingest = IngestClient(self) self.nodes = NodesClient(self) self.remote = RemoteClient(self) + self.security = SecurityClient(self) self.snapshot = SnapshotClient(self) self.tasks = TasksClient(self) - self.plugins = PluginsClient(self) self.features = FeaturesClient(self) + self.plugins = PluginsClient(self) + def __repr__(self): try: # get a list of all connections diff --git a/opensearchpy/_async/client/__init__.pyi b/opensearchpy/_async/client/__init__.pyi index f81c978b..27a47ed9 100644 --- a/opensearchpy/_async/client/__init__.pyi +++ b/opensearchpy/_async/client/__init__.pyi @@ -39,6 +39,7 @@ from .indices import IndicesClient from .ingest import IngestClient from .nodes import NodesClient from .remote import RemoteClient +from .security import SecurityClient from .snapshot import SnapshotClient from .tasks import TasksClient @@ -54,6 +55,7 @@ class AsyncOpenSearch(object): ingest: IngestClient nodes: NodesClient remote: RemoteClient + security: SecurityClient snapshot: SnapshotClient tasks: TasksClient def __init__( diff --git a/opensearchpy/_async/client/plugins.py b/opensearchpy/_async/client/plugins.py index dd9ea936..2b762ba3 100644 --- a/opensearchpy/_async/client/plugins.py +++ b/opensearchpy/_async/client/plugins.py @@ -11,7 +11,6 @@ import warnings from ..plugins.alerting import AlertingClient from ..plugins.index_management import IndexManagementClient -from ..plugins.security import SecurityClient from .utils import NamespacedClient @@ -25,7 +24,6 @@ class PluginsClient(NamespacedClient): # self.anomaly_detection = AnomalyDetectionClient(client) # self.trace_analytics = TraceAnalyticsClient(client) self.index_management = IndexManagementClient(client) - self.security = SecurityClient(client) self._dynamic_lookup(client) @@ -40,7 +38,6 @@ class PluginsClient(NamespacedClient): # "anomaly_detection", # "trace_analytics", "index_management", - "security", ] for plugin in plugins: if not hasattr(client, plugin): diff --git a/opensearchpy/_async/client/plugins.pyi b/opensearchpy/_async/client/plugins.pyi index 81fa69d8..88383d01 100644 --- a/opensearchpy/_async/client/plugins.pyi +++ b/opensearchpy/_async/client/plugins.pyi @@ -15,5 +15,4 @@ from .utils import NamespacedClient as NamespacedClient class PluginsClient(NamespacedClient): alerting: Any index_management: Any - security: Any def __init__(self, client: AsyncOpenSearch) -> None: ... diff --git a/opensearchpy/_async/plugins/security.py b/opensearchpy/_async/client/security.py similarity index 100% rename from opensearchpy/_async/plugins/security.py rename to opensearchpy/_async/client/security.py diff --git a/opensearchpy/_async/plugins/security.pyi b/opensearchpy/_async/client/security.pyi similarity index 100% rename from opensearchpy/_async/plugins/security.pyi rename to opensearchpy/_async/client/security.pyi diff --git a/opensearchpy/client/__init__.py b/opensearchpy/client/__init__.py index 48501d87..1fe0c959 100644 --- a/opensearchpy/client/__init__.py +++ b/opensearchpy/client/__init__.py @@ -40,6 +40,7 @@ from .ingest import IngestClient from .nodes import NodesClient from .plugins import PluginsClient from .remote import RemoteClient +from .security import SecurityClient from .snapshot import SnapshotClient from .tasks import TasksClient from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params @@ -197,6 +198,7 @@ class OpenSearch(object): self.ingest = IngestClient(self) self.nodes = NodesClient(self) self.remote = RemoteClient(self) + self.security = SecurityClient(self) self.snapshot = SnapshotClient(self) self.tasks = TasksClient(self) diff --git a/opensearchpy/client/__init__.pyi b/opensearchpy/client/__init__.pyi index 3357ca1c..64f21ca7 100644 --- a/opensearchpy/client/__init__.pyi +++ b/opensearchpy/client/__init__.pyi @@ -39,6 +39,7 @@ from .indices import IndicesClient from .ingest import IngestClient from .nodes import NodesClient from .remote import RemoteClient +from .security import SecurityClient from .snapshot import SnapshotClient from .tasks import TasksClient @@ -54,6 +55,7 @@ class OpenSearch(object): ingest: IngestClient nodes: NodesClient remote: RemoteClient + security: SecurityClient snapshot: SnapshotClient tasks: TasksClient def __init__( diff --git a/opensearchpy/client/plugins.py b/opensearchpy/client/plugins.py index 17293ae4..7fba8c32 100644 --- a/opensearchpy/client/plugins.py +++ b/opensearchpy/client/plugins.py @@ -12,7 +12,6 @@ import warnings from ..plugins.alerting import AlertingClient from ..plugins.index_management import IndexManagementClient -from ..plugins.security import SecurityClient from .utils import NamespacedClient @@ -26,7 +25,6 @@ class PluginsClient(NamespacedClient): # self.anomaly_detection = AnomalyDetectionClient(client) # self.trace_analytics = TraceAnalyticsClient(client) self.index_management = IndexManagementClient(client) - self.security = SecurityClient(client) self._dynamic_lookup(client) @@ -41,7 +39,6 @@ class PluginsClient(NamespacedClient): # "anomaly_detection", # "trace_analytics", "index_management", - "security", ] for plugin in plugins: if not hasattr(client, plugin): diff --git a/opensearchpy/client/plugins.pyi b/opensearchpy/client/plugins.pyi index 9bbb0027..2e4b2630 100644 --- a/opensearchpy/client/plugins.pyi +++ b/opensearchpy/client/plugins.pyi @@ -15,5 +15,4 @@ from .utils import NamespacedClient as NamespacedClient class PluginsClient(NamespacedClient): alerting: Any index_management: Any - security: Any def __init__(self, client: OpenSearch) -> None: ... diff --git a/opensearchpy/plugins/security.py b/opensearchpy/client/security.py similarity index 100% rename from opensearchpy/plugins/security.py rename to opensearchpy/client/security.py diff --git a/opensearchpy/plugins/security.pyi b/opensearchpy/client/security.pyi similarity index 100% rename from opensearchpy/plugins/security.pyi rename to opensearchpy/client/security.pyi