Skip to content

Commit

Permalink
Move security api from plugins to clients (opensearch-project#442)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
florianvazelle authored Jul 21, 2023
1 parent 4dba35d commit 5dc51d4
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions docs/source/api-ref/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/source/api-ref/clients/security_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security Client

```{eval-rst}
.. autoclass:: opensearchpy.clients.security.SecurityClient
```
1 change: 0 additions & 1 deletion docs/source/api-ref/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ maxdepth: 1
plugins/alerting_plugin
plugins/index_management_plugin
plugins/security_plugin
```
5 changes: 0 additions & 5 deletions docs/source/api-ref/plugins/security_plugin.md

This file was deleted.

5 changes: 4 additions & 1 deletion opensearchpy/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
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
Expand Down Expand Up @@ -196,12 +197,14 @@ class as kwargs, or a string in the format of ``host[:port]`` which will be
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
Expand Down
2 changes: 2 additions & 0 deletions opensearchpy/_async/client/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -54,6 +55,7 @@ class AsyncOpenSearch(object):
ingest: IngestClient
nodes: NodesClient
remote: RemoteClient
security: SecurityClient
snapshot: SnapshotClient
tasks: TasksClient
def __init__(
Expand Down
3 changes: 0 additions & 3 deletions opensearchpy/_async/client/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient
from ..plugins.security import SecurityClient
from .utils import NamespacedClient


Expand All @@ -25,7 +24,6 @@ def __init__(self, client):
# self.anomaly_detection = AnomalyDetectionClient(client)
# self.trace_analytics = TraceAnalyticsClient(client)
self.index_management = IndexManagementClient(client)
self.security = SecurityClient(client)

self._dynamic_lookup(client)

Expand All @@ -40,7 +38,6 @@ def _dynamic_lookup(self, client):
# "anomaly_detection",
# "trace_analytics",
"index_management",
"security",
]
for plugin in plugins:
if not hasattr(client, plugin):
Expand Down
1 change: 0 additions & 1 deletion opensearchpy/_async/client/plugins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions opensearchpy/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
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
Expand Down Expand Up @@ -197,6 +198,7 @@ class as kwargs, or a string in the format of ``host[:port]`` which will be
self.ingest = IngestClient(self)
self.nodes = NodesClient(self)
self.remote = RemoteClient(self)
self.security = SecurityClient(self)
self.snapshot = SnapshotClient(self)
self.tasks = TasksClient(self)

Expand Down
2 changes: 2 additions & 0 deletions opensearchpy/client/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -54,6 +55,7 @@ class OpenSearch(object):
ingest: IngestClient
nodes: NodesClient
remote: RemoteClient
security: SecurityClient
snapshot: SnapshotClient
tasks: TasksClient
def __init__(
Expand Down
3 changes: 0 additions & 3 deletions opensearchpy/client/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient
from ..plugins.security import SecurityClient
from .utils import NamespacedClient


Expand All @@ -26,7 +25,6 @@ def __init__(self, client):
# self.anomaly_detection = AnomalyDetectionClient(client)
# self.trace_analytics = TraceAnalyticsClient(client)
self.index_management = IndexManagementClient(client)
self.security = SecurityClient(client)

self._dynamic_lookup(client)

Expand All @@ -41,7 +39,6 @@ def _dynamic_lookup(self, client):
# "anomaly_detection",
# "trace_analytics",
"index_management",
"security",
]
for plugin in plugins:
if not hasattr(client, plugin):
Expand Down
1 change: 0 additions & 1 deletion opensearchpy/client/plugins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
File renamed without changes.
File renamed without changes.

0 comments on commit 5dc51d4

Please sign in to comment.