Skip to content

Commit

Permalink
Added restore API in RemoteStoreClient
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <saimedhi@amazon.com>
  • Loading branch information
saimedhi committed Jul 20, 2023
1 parent 4dba35d commit b8f38f2
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Enhanced YAML test runner to use OpenSearch rest-api-spec YAML tests ([#414](https://github.com/opensearch-project/opensearch-py/pull/414)
- Added `Search#collapse` ([#409](https://github.com/opensearch-project/opensearch-py/issues/409))
- Added support for the ISM API ([#398](https://github.com/opensearch-project/opensearch-py/pull/398))
- Added `trust_env` to `AIOHttpConnection` ([#398](https://github.com/opensearch-project/opensearch-py/pull/438))
- Added `trust_env` to `AIOHttpConnection` ([#438](https://github.com/opensearch-project/opensearch-py/pull/438))
- Added "restore" API in "RemoteStoreClient" ([#443](https://github.com/opensearch-project/opensearch-py/pull/443))

### Changed
- Upgrading pytest-asyncio to latest version - 0.21.0 ([#339](https://github.com/opensearch-project/opensearch-py/pull/339))
Expand Down
39 changes: 39 additions & 0 deletions opensearchpy/_async/client/remote_store.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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. MANUAL EDITS WILL BE LOST.

# To contribute, please make necessary modifications to either "Python generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or "OpenAPI specs":
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------

from .utils import SKIP_IN_PATH, NamespacedClient, query_params

Check warning on line 18 in opensearchpy/_async/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/_async/client/remote_store.py#L18

Added line #L18 was not covered by tests


class RemoteStoreClient(NamespacedClient):
@query_params("cluster_manager_timeout", "wait_for_completion")
async def restore(self, body, params=None, headers=None):

Check warning on line 23 in opensearchpy/_async/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/_async/client/remote_store.py#L21-L23

Added lines #L21 - L23 were not covered by tests
"""
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.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")

Check warning on line 35 in opensearchpy/_async/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/_async/client/remote_store.py#L34-L35

Added lines #L34 - L35 were not covered by tests

return await self.transport.perform_request(

Check warning on line 37 in opensearchpy/_async/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/_async/client/remote_store.py#L37

Added line #L37 was not covered by tests
"POST", "/_remotestore/_restore", params=params, headers=headers, body=body
)
41 changes: 41 additions & 0 deletions opensearchpy/_async/client/remote_store.pyi
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. MANUAL EDITS WILL BE LOST.

# To contribute, please make necessary modifications to either "Python generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or "OpenAPI specs":
# 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: ...
39 changes: 39 additions & 0 deletions opensearchpy/client/remote_store.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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. MANUAL EDITS WILL BE LOST.

# To contribute, please make necessary modifications to either "Python generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or "OpenAPI specs":
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
# -----------------------------------------------------

from .utils import SKIP_IN_PATH, NamespacedClient, query_params

Check warning on line 18 in opensearchpy/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/client/remote_store.py#L18

Added line #L18 was not covered by tests


class RemoteStoreClient(NamespacedClient):
@query_params("cluster_manager_timeout", "wait_for_completion")
def restore(self, body, params=None, headers=None):

Check warning on line 23 in opensearchpy/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/client/remote_store.py#L21-L23

Added lines #L21 - L23 were not covered by tests
"""
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.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")

Check warning on line 35 in opensearchpy/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/client/remote_store.py#L34-L35

Added lines #L34 - L35 were not covered by tests

return self.transport.perform_request(

Check warning on line 37 in opensearchpy/client/remote_store.py

View check run for this annotation

Codecov / codecov/patch

opensearchpy/client/remote_store.py#L37

Added line #L37 was not covered by tests
"POST", "/_remotestore/_restore", params=params, headers=headers, body=body
)
41 changes: 41 additions & 0 deletions opensearchpy/client/remote_store.pyi
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. MANUAL EDITS WILL BE LOST.

# To contribute, please make necessary modifications to either "Python generator":
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
# or "OpenAPI specs":
# 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: ...

0 comments on commit b8f38f2

Please sign in to comment.