Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the get_policy API in the index_management plugin #633

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading