Integrated generated APIs into the existing module, ensuring alignment with the server and maintaining backward compatibility (#508)

Signed-off-by: saimedhi <saimedhi@amazon.com>
This commit is contained in:
Sai Medhini Reddy Maryada
2023-09-26 09:49:25 -07:00
committed by GitHub
parent c6c7df5461
commit 2feccc22bb
6 changed files with 84 additions and 73 deletions
+1
View File
@@ -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
+30 -34
View File
@@ -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 @@ class TasksClient(NamespacedClient):
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 @@ class TasksClient(NamespacedClient):
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 @@ class TasksClient(NamespacedClient):
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(
+9
View File
@@ -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
+30 -34
View File
@@ -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 @@ class TasksClient(NamespacedClient):
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 @@ class TasksClient(NamespacedClient):
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 @@ class TasksClient(NamespacedClient):
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(
+9
View File
@@ -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
+5 -5
View File
@@ -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
# -----------------------------------------------------
# -----------------------------------------------------