forked from opensearch-project/opensearch-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added remote store client (opensearch-project#552)
Signed-off-by: saimedhi <[email protected]> Signed-off-by: roma2023 <[email protected]>
- Loading branch information
Showing
10 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# 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 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 .utils import SKIP_IN_PATH, NamespacedClient, query_params | ||
|
||
|
||
class RemoteStoreClient(NamespacedClient): | ||
@query_params("cluster_manager_timeout", "wait_for_completion") | ||
async def restore(self, body, params=None, headers=None): | ||
""" | ||
Restores from remote store. | ||
:arg body: Comma-separated list of index IDs | ||
:arg cluster_manager_timeout: Operation timeout for connection | ||
to cluster-manager node. | ||
:arg wait_for_completion: Should this request wait until the | ||
operation has completed before returning. (default: false) | ||
""" | ||
if body in SKIP_IN_PATH: | ||
raise ValueError("Empty value passed for a required argument 'body'.") | ||
|
||
return await self.transport.perform_request( | ||
"POST", "/_remotestore/_restore", params=params, headers=headers, body=body | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 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 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 | ||
|
||
class RemoteStoreClient(NamespacedClient): | ||
async def restore( | ||
self, | ||
*, | ||
body: Any, | ||
cluster_manager_timeout: Optional[Any] = ..., | ||
wait_for_completion: Optional[Any] = ..., | ||
pretty: Optional[bool] = ..., | ||
human: Optional[bool] = ..., | ||
error_trace: Optional[bool] = ..., | ||
format: Optional[str] = ..., | ||
filter_path: Optional[Union[str, Collection[str]]] = ..., | ||
request_timeout: Optional[Union[int, float]] = ..., | ||
ignore: Optional[Union[int, Collection[int]]] = ..., | ||
opaque_id: Optional[str] = ..., | ||
http_auth: Optional[Union[str, Tuple[str, str]]] = ..., | ||
api_key: Optional[Union[str, Tuple[str, str]]] = ..., | ||
params: Optional[MutableMapping[str, Any]] = ..., | ||
headers: Optional[MutableMapping[str, str]] = ..., | ||
) -> Any: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# 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 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 .utils import SKIP_IN_PATH, NamespacedClient, query_params | ||
|
||
|
||
class RemoteStoreClient(NamespacedClient): | ||
@query_params("cluster_manager_timeout", "wait_for_completion") | ||
def restore(self, body, params=None, headers=None): | ||
""" | ||
Restores from remote store. | ||
:arg body: Comma-separated list of index IDs | ||
:arg cluster_manager_timeout: Operation timeout for connection | ||
to cluster-manager node. | ||
:arg wait_for_completion: Should this request wait until the | ||
operation has completed before returning. (default: false) | ||
""" | ||
if body in SKIP_IN_PATH: | ||
raise ValueError("Empty value passed for a required argument 'body'.") | ||
|
||
return self.transport.perform_request( | ||
"POST", "/_remotestore/_restore", params=params, headers=headers, body=body | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 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 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 | ||
|
||
class RemoteStoreClient(NamespacedClient): | ||
def restore( | ||
self, | ||
*, | ||
body: Any, | ||
cluster_manager_timeout: Optional[Any] = ..., | ||
wait_for_completion: Optional[Any] = ..., | ||
pretty: Optional[bool] = ..., | ||
human: Optional[bool] = ..., | ||
error_trace: Optional[bool] = ..., | ||
format: Optional[str] = ..., | ||
filter_path: Optional[Union[str, Collection[str]]] = ..., | ||
request_timeout: Optional[Union[int, float]] = ..., | ||
ignore: Optional[Union[int, Collection[int]]] = ..., | ||
opaque_id: Optional[str] = ..., | ||
http_auth: Optional[Union[str, Tuple[str, str]]] = ..., | ||
api_key: Optional[Union[str, Tuple[str, str]]] = ..., | ||
params: Optional[MutableMapping[str, Any]] = ..., | ||
headers: Optional[MutableMapping[str, str]] = ..., | ||
) -> Any: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 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. | ||
from test_opensearchpy.test_cases import OpenSearchTestCase | ||
|
||
|
||
class TestRemoteStore(OpenSearchTestCase): | ||
def test_remote_store_restore(self): | ||
self.client.remote_store.restore(body=["index-1"]) | ||
self.assert_url_called("POST", "/_remotestore/_restore") |