Move security api from plugins to clients (#442)

* fix(security): move security api from plugins to clients

Signed-off-by: florian <florian@harfanglab.fr>

* chore(CHANGELOG): update CHANGELOG for the PR#442

Signed-off-by: florian <florian@harfanglab.fr>

---------

Signed-off-by: florian <florian@harfanglab.fr>
This commit is contained in:
florianvazelle
2023-07-21 19:07:20 +02:00
committed by GitHub
parent 4dba35deea
commit 5dc51d4b7f
17 changed files with 17 additions and 15 deletions
+1
View File
@@ -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))
+1
View File
@@ -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
@@ -0,0 +1,5 @@
# Security Client
```{eval-rst}
.. autoclass:: opensearchpy.clients.security.SecurityClient
```
-1
View File
@@ -9,5 +9,4 @@ maxdepth: 1
plugins/alerting_plugin
plugins/index_management_plugin
plugins/security_plugin
```
@@ -1,5 +0,0 @@
# Security Plugin
```{eval-rst}
.. autoclass:: opensearchpy.plugins.security.SecurityClient
```
+4 -1
View File
@@ -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
+2
View File
@@ -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__(
-3
View File
@@ -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):
-1
View File
@@ -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: ...
+2
View File
@@ -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)
+2
View File
@@ -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__(
-3
View File
@@ -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):
-1
View File
@@ -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: ...