Updated the get_policy API in the index_management plugin to allow the policy_id argument as optional (#633)

Signed-off-by: saimedhi <saimedhi@amazon.com>
This commit is contained in:
Sai Medhini Reddy Maryada
2024-01-10 23:08:41 -08:00
committed by GitHub
parent 33c2060f6b
commit 2ab3a40307
3 changed files with 7 additions and 8 deletions
+1
View File
@@ -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))
@@ -56,15 +56,13 @@ class IndexManagementClient(NamespacedClient):
@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",
+4 -4
View File
@@ -55,14 +55,14 @@ class IndexManagementClient(NamespacedClient):
)
@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",