Skip to content

Commit

Permalink
Updated the get_policy API in the index_management plugin to allow th…
Browse files Browse the repository at this point in the history
…e policy_id argument as optional (opensearch-project#633)

Signed-off-by: saimedhi <saimedhi@amazon.com>
  • Loading branch information
saimedhi authored Jan 11, 2024
1 parent 33c2060 commit 2ab3a40
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added a log collection guide ([#579](https://github.com/opensearch-project/opensearch-py/pull/579))
- Added GHA release ([#614](https://github.com/opensearch-project/opensearch-py/pull/614))
### Changed
- Updated the `get_policy` API in the index_management plugin to allow the policy_id argument as optional ([#633](https://github.com/opensearch-project/opensearch-py/pull/633))
### Deprecated
### Removed
- Removed unnecessary `# -*- coding: utf-8 -*-` headers from .py files ([#615](https://github.com/opensearch-project/opensearch-py/pull/615), [#617](https://github.com/opensearch-project/opensearch-py/pull/617))
Expand Down
6 changes: 2 additions & 4 deletions opensearchpy/_async/plugins/index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ async def add_policy(

@query_params()
async def get_policy(
self, policy: Any, params: Any = None, headers: Any = None
self, policy: Any = None, params: Any = None, headers: Any = None
) -> Any:
"""
Gets the policy by `policy_id`.
Gets the policy by `policy_id`; returns all policies if no policy_id is provided.
:arg policy: The name of the policy
"""
if policy in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'policy'.")

return await self.transport.perform_request(
"GET",
Expand Down
8 changes: 4 additions & 4 deletions opensearchpy/plugins/index_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def add_policy(
)

@query_params()
def get_policy(self, policy: Any, params: Any = None, headers: Any = None) -> Any:
def get_policy(
self, policy: Any = None, params: Any = None, headers: Any = None
) -> Any:
"""
Gets the policy by `policy_id`.
Gets the policy by `policy_id`; returns all policies if no policy_id is provided.
:arg policy: The name of the policy
"""
if policy in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'policy'.")

return self.transport.perform_request(
"GET",
Expand Down

0 comments on commit 2ab3a40

Please sign in to comment.