From c56ca9885cc6cc8e6f40d001cd7575286af573f4 Mon Sep 17 00:00:00 2001 From: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:49:25 -0700 Subject: [PATCH 1/3] Integrated generated APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility (#508) Signed-off-by: saimedhi Signed-off-by: AkshathRaghav --- CHANGELOG.md | 1 + opensearchpy/_async/client/tasks.py | 64 +++++++++++++--------------- opensearchpy/_async/client/tasks.pyi | 9 ++++ opensearchpy/client/tasks.py | 64 +++++++++++++--------------- opensearchpy/client/tasks.pyi | 9 ++++ utils/generated_file_headers.txt | 10 ++--- 6 files changed, 84 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5de04d90..e4646f50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added generating imports and headers to API generator ([#467](https://github.com/opensearch-project/opensearch-py/pull/467)) - Added point-in-time APIs (create_pit, delete_pit, delete_all_pits, get_all_pits) and Security Client APIs (health and update_audit_configuration) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502)) ### Changed +- Integrated generated `tasks client` APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility ([#508](https://github.com/opensearch-project/opensearch-py/pull/508)) ### Deprecated - Deprecated point-in-time APIs (list_all_point_in_time, create_point_in_time, delete_point_in_time) and Security Client APIs (health_check and update_audit_config) ([#502](https://github.com/opensearch-project/opensearch-py/pull/502)) ### Removed diff --git a/opensearchpy/_async/client/tasks.py b/opensearchpy/_async/client/tasks.py index 2b49ddc0..212b9e56 100644 --- a/opensearchpy/_async/client/tasks.py +++ b/opensearchpy/_async/client/tasks.py @@ -25,6 +25,16 @@ # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + + import warnings from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params @@ -45,24 +55,20 @@ async def list(self, params=None, headers=None): Returns a list of tasks. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - - :arg actions: A comma-separated list of actions that should be + :arg actions: Comma-separated list of actions that should be returned. Leave empty to return all. - :arg detailed: Return detailed task information (default: false) + :arg detailed: Return detailed task information. :arg group_by: Group tasks by nodes or parent/child - relationships Valid choices: nodes, parents, none Default: nodes - :arg nodes: A comma-separated list of node IDs or names to limit + relationships. Valid choices: nodes, parents, none + :arg nodes: Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the - node you're connecting to, leave empty to get information from all nodes + node you're connecting to, leave empty to get information from all + nodes. :arg parent_task_id: Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. - :arg timeout: Explicit operation timeout - :arg wait_for_completion: Wait for the matching tasks to - complete (default: false) + :arg timeout: Operation timeout. + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. """ return await self.transport.perform_request( "GET", "/_tasks", params=params, headers=headers @@ -74,23 +80,18 @@ async def cancel(self, task_id=None, params=None, headers=None): Cancels a task, if it can be cancelled through an API. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - :arg task_id: Cancel the task with specified task id - (node_id:task_number) - :arg actions: A comma-separated list of actions that should be + (node_id:task_number). + :arg actions: Comma-separated list of actions that should be cancelled. Leave empty to cancel all. - :arg nodes: A comma-separated list of node IDs or names to limit + :arg nodes: Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the - node you're connecting to, leave empty to get information from all nodes + node you're connecting to, leave empty to get information from all + nodes. :arg parent_task_id: Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. - :arg wait_for_completion: Should the request block until the - cancellation of the task and its descendant tasks is completed. Defaults - to false + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. """ return await self.transport.perform_request( "POST", @@ -105,16 +106,11 @@ async def get(self, task_id=None, params=None, headers=None): Returns information about a task. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - :arg task_id: Return the task with specified id - (node_id:task_number) - :arg timeout: Explicit operation timeout - :arg wait_for_completion: Wait for the matching tasks to - complete (default: false) + (node_id:task_number). + :arg timeout: Operation timeout. + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. """ if task_id in SKIP_IN_PATH: warnings.warn( diff --git a/opensearchpy/_async/client/tasks.pyi b/opensearchpy/_async/client/tasks.pyi index ae777158..14081a2d 100644 --- a/opensearchpy/_async/client/tasks.pyi +++ b/opensearchpy/_async/client/tasks.pyi @@ -24,6 +24,15 @@ # specific language governing permissions and limitations # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + from typing import Any, Collection, MutableMapping, Optional, Tuple, Union from .utils import NamespacedClient diff --git a/opensearchpy/client/tasks.py b/opensearchpy/client/tasks.py index fff32dd7..ff76a3a6 100644 --- a/opensearchpy/client/tasks.py +++ b/opensearchpy/client/tasks.py @@ -25,6 +25,16 @@ # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + + import warnings from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params @@ -45,24 +55,20 @@ def list(self, params=None, headers=None): Returns a list of tasks. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - - :arg actions: A comma-separated list of actions that should be + :arg actions: Comma-separated list of actions that should be returned. Leave empty to return all. - :arg detailed: Return detailed task information (default: false) + :arg detailed: Return detailed task information. :arg group_by: Group tasks by nodes or parent/child - relationships Valid choices: nodes, parents, none Default: nodes - :arg nodes: A comma-separated list of node IDs or names to limit + relationships. Valid choices: nodes, parents, none + :arg nodes: Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the - node you're connecting to, leave empty to get information from all nodes + node you're connecting to, leave empty to get information from all + nodes. :arg parent_task_id: Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. - :arg timeout: Explicit operation timeout - :arg wait_for_completion: Wait for the matching tasks to - complete (default: false) + :arg timeout: Operation timeout. + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. """ return self.transport.perform_request( "GET", "/_tasks", params=params, headers=headers @@ -74,23 +80,18 @@ def cancel(self, task_id=None, params=None, headers=None): Cancels a task, if it can be cancelled through an API. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - :arg task_id: Cancel the task with specified task id - (node_id:task_number) - :arg actions: A comma-separated list of actions that should be + (node_id:task_number). + :arg actions: Comma-separated list of actions that should be cancelled. Leave empty to cancel all. - :arg nodes: A comma-separated list of node IDs or names to limit + :arg nodes: Comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the - node you're connecting to, leave empty to get information from all nodes + node you're connecting to, leave empty to get information from all + nodes. :arg parent_task_id: Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. - :arg wait_for_completion: Should the request block until the - cancellation of the task and its descendant tasks is completed. Defaults - to false + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. """ return self.transport.perform_request( "POST", @@ -105,16 +106,11 @@ def get(self, task_id=None, params=None, headers=None): Returns information about a task. - .. warning:: - - This API is **experimental** so may include breaking changes - or be removed in a future version - :arg task_id: Return the task with specified id - (node_id:task_number) - :arg timeout: Explicit operation timeout - :arg wait_for_completion: Wait for the matching tasks to - complete (default: false) + (node_id:task_number). + :arg timeout: Operation timeout. + :arg wait_for_completion: Should this request wait until the + operation has completed before returning. """ if task_id in SKIP_IN_PATH: warnings.warn( diff --git a/opensearchpy/client/tasks.pyi b/opensearchpy/client/tasks.pyi index 3577bae3..50ad69bb 100644 --- a/opensearchpy/client/tasks.pyi +++ b/opensearchpy/client/tasks.pyi @@ -24,6 +24,15 @@ # specific language governing permissions and limitations # under the License. +# ---------------------------------------------------- +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": +# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py +# or the "OpenSearch API specification" available at: +# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json +# ----------------------------------------------------- + from typing import Any, Collection, MutableMapping, Optional, Tuple, Union from .utils import NamespacedClient diff --git a/utils/generated_file_headers.txt b/utils/generated_file_headers.txt index 16c8aba5..135828ce 100644 --- a/utils/generated_file_headers.txt +++ b/utils/generated_file_headers.txt @@ -1,8 +1,8 @@ # ---------------------------------------------------- -# THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. -# -# To contribute, please make necessary modifications to either "Python generator": +# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST. +# +# To contribute, kindly make essential modifications through either the "opensearch-py client generator": # https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py -# or "OpenAPI specs": +# or the "OpenSearch API specification" available at: # https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json -# ----------------------------------------------------- \ No newline at end of file +# ----------------------------------------------------- From c81a2414946b68db7c95f052555997400a10300a Mon Sep 17 00:00:00 2001 From: AkshathRaghav Date: Thu, 28 Sep 2023 18:03:21 -0400 Subject: [PATCH 2/3] Changing urllib3 version Signed-off-by: AkshathRaghav --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3bce64d1..19103a9f 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ if package == module_dir or package.startswith(module_dir + ".") ] install_requires = [ - "urllib3>=1.21.1", + "urllib3>=1.26.5", "requests>=2.4.0, <3.0.0", "six", "python-dateutil", From 14d3d77c753c3d07478c5bb6d869cefe5952abe8 Mon Sep 17 00:00:00 2001 From: AkshathRaghav Date: Thu, 28 Sep 2023 20:57:39 -0400 Subject: [PATCH 3/3] Edited CHANGELOG.md Signed-off-by: AkshathRaghav --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4646f50..f1956fd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Security ### Dependencies - Bumps `sphinx` from <7.1 to <7.3 -- Bumps `urllib3` from >=1.21.1, <2 to >=1.21.1 ([#466](https://github.com/opensearch-project/opensearch-py/pull/466)) +- Bumps `urllib3` from >=1.21.1, <2 to >=1.26.5 ([#515](https://github.com/opensearch-project/opensearch-py/pull/515)) ## [2.3.1] ### Added