Updated opensearch-py to reflect the latest OpenSearch API spec (2024-05-15) (#742)

Signed-off-by: GitHub <[email protected]>
Co-authored-by: saimedhi <[email protected]>
This commit is contained in:
opensearch-trigger-bot[bot]
2024-05-15 09:55:45 -07:00
committed by GitHub
co-authored by saimedhi
parent 243b509fb6
commit 72173c3fb0
5 changed files with 475 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed ### Fixed
- Updated code generator to use native OpenAPI specification ([#721](https://github.com/opensearch-project/opensearch-py/pull/721)) - Updated code generator to use native OpenAPI specification ([#721](https://github.com/opensearch-project/opensearch-py/pull/721))
### Updated APIs ### Updated APIs
- Updated opensearch-py APIs to reflect [opensearch-api-specification@deeb400](https://github.com/opensearch-project/opensearch-api-specification/commit/deeb4005291dd499d1e637dffb2db9cd3bfb14b6)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@de939d2](https://github.com/opensearch-project/opensearch-api-specification/commit/de939d2b116ae15f364fae588f67e139198d0c56) - Updated opensearch-py APIs to reflect [opensearch-api-specification@de939d2](https://github.com/opensearch-project/opensearch-api-specification/commit/de939d2b116ae15f364fae588f67e139198d0c56)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@d3783f1](https://github.com/opensearch-project/opensearch-api-specification/commit/d3783f1200fdc5799eba861842ee611f2c7e30e7) - Updated opensearch-py APIs to reflect [opensearch-api-specification@d3783f1](https://github.com/opensearch-project/opensearch-api-specification/commit/d3783f1200fdc5799eba861842ee611f2c7e30e7)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@3ed6aaf](https://github.com/opensearch-project/opensearch-api-specification/commit/3ed6aaff0ce51af3aad00fe57c34d1a7056bd6d1) - Updated opensearch-py APIs to reflect [opensearch-api-specification@3ed6aaf](https://github.com/opensearch-project/opensearch-api-specification/commit/3ed6aaff0ce51af3aad00fe57c34d1a7056bd6d1)
+2
View File
@@ -14,6 +14,7 @@ from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient from ..plugins.index_management import IndexManagementClient
from ..plugins.knn import KnnClient from ..plugins.knn import KnnClient
from ..plugins.notifications import NotificationsClient from ..plugins.notifications import NotificationsClient
from ..plugins.rollups import RollupsClient
from .client import Client from .client import Client
from .utils import NamespacedClient from .utils import NamespacedClient
@@ -24,6 +25,7 @@ class PluginsClient(NamespacedClient):
def __init__(self, client: Client) -> None: def __init__(self, client: Client) -> None:
super(PluginsClient, self).__init__(client) super(PluginsClient, self).__init__(client)
self.rollups = RollupsClient(client)
self.notifications = NotificationsClient(client) self.notifications = NotificationsClient(client)
self.knn = KnnClient(client) self.knn = KnnClient(client)
# self.query_workbench = QueryWorkbenchClient(client) # self.query_workbench = QueryWorkbenchClient(client)
+235
View File
@@ -0,0 +1,235 @@
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ------------------------------------------------------------------------------------------
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
#
# To contribute, kindly make modifications in the opensearch-py client generator
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
# and https://github.com/opensearch-project/opensearch-api-specification for details.
# -----------------------------------------------------------------------------------------+
from typing import Any
from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class RollupsClient(NamespacedClient):
@query_params("error_trace", "filter_path", "human", "pretty", "source")
async def delete(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Delete index rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"DELETE",
_make_path("_plugins", "_rollup", "jobs", id),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
async def explain(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Get a rollup's current status.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"GET",
_make_path("_plugins", "_rollup", "jobs", id, "_explain"),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
async def get(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Get an index rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"GET",
_make_path("_plugins", "_rollup", "jobs", id),
params=params,
headers=headers,
)
@query_params(
"error_trace",
"filter_path",
"human",
"if_primary_term",
"if_seq_no",
"pretty",
"source",
)
async def put(
self,
id: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Create or update index rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg if_primary_term: Only perform the operation if the document
has this primary term.
:arg if_seq_no: Only perform the operation if the document has
this sequence number.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"PUT",
_make_path("_plugins", "_rollup", "jobs", id),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
async def start(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Start rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"POST",
_make_path("_plugins", "_rollup", "jobs", id, "_start"),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
async def stop(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Stop rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"POST",
_make_path("_plugins", "_rollup", "jobs", id, "_stop"),
params=params,
headers=headers,
)
+2
View File
@@ -14,6 +14,7 @@ from ..plugins.alerting import AlertingClient
from ..plugins.index_management import IndexManagementClient from ..plugins.index_management import IndexManagementClient
from ..plugins.knn import KnnClient from ..plugins.knn import KnnClient
from ..plugins.notifications import NotificationsClient from ..plugins.notifications import NotificationsClient
from ..plugins.rollups import RollupsClient
from .client import Client from .client import Client
from .utils import NamespacedClient from .utils import NamespacedClient
@@ -24,6 +25,7 @@ class PluginsClient(NamespacedClient):
def __init__(self, client: Client) -> None: def __init__(self, client: Client) -> None:
super(PluginsClient, self).__init__(client) super(PluginsClient, self).__init__(client)
self.rollups = RollupsClient(client)
self.notifications = NotificationsClient(client) self.notifications = NotificationsClient(client)
self.knn = KnnClient(client) self.knn = KnnClient(client)
# self.query_workbench = QueryWorkbenchClient(client) # self.query_workbench = QueryWorkbenchClient(client)
+235
View File
@@ -0,0 +1,235 @@
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# ------------------------------------------------------------------------------------------
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
#
# To contribute, kindly make modifications in the opensearch-py client generator
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
# and https://github.com/opensearch-project/opensearch-api-specification for details.
# -----------------------------------------------------------------------------------------+
from typing import Any
from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
class RollupsClient(NamespacedClient):
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def delete(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Delete index rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"DELETE",
_make_path("_plugins", "_rollup", "jobs", id),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def explain(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Get a rollup's current status.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"GET",
_make_path("_plugins", "_rollup", "jobs", id, "_explain"),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def get(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Get an index rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"GET",
_make_path("_plugins", "_rollup", "jobs", id),
params=params,
headers=headers,
)
@query_params(
"error_trace",
"filter_path",
"human",
"if_primary_term",
"if_seq_no",
"pretty",
"source",
)
def put(
self,
id: Any,
body: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Create or update index rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg if_primary_term: Only perform the operation if the document
has this primary term.
:arg if_seq_no: Only perform the operation if the document has
this sequence number.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"PUT",
_make_path("_plugins", "_rollup", "jobs", id),
params=params,
headers=headers,
body=body,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def start(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Start rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"POST",
_make_path("_plugins", "_rollup", "jobs", id, "_start"),
params=params,
headers=headers,
)
@query_params("error_trace", "filter_path", "human", "pretty", "source")
def stop(
self,
id: Any,
params: Any = None,
headers: Any = None,
) -> Any:
"""
Stop rollup.
:arg id: Rollup to access
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg filter_path: Comma-separated list of filters used to reduce
the response.
:arg human: Whether to return human readable values for
statistics.
:arg pretty: Whether to pretty format the returned JSON
response.
:arg source: The URL-encoded request definition. Useful for
libraries that do not accept a request body for non-POST requests.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return self.transport.perform_request(
"POST",
_make_path("_plugins", "_rollup", "jobs", id, "_stop"),
params=params,
headers=headers,
)