From a520de3f83df0a02d7bce7ba7e511181f8e6b340 Mon Sep 17 00:00:00 2001 From: Theo Truong Date: Tue, 15 Aug 2023 10:50:56 -0600 Subject: [PATCH 1/2] Moved dangling_indices into its own folder --- .../{dangling_indices.py => dangling_indices/__init__.py} | 2 +- .../{dangling_indices.pyi => dangling_indices/__init__.pyi} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename opensearchpy/client/{dangling_indices.py => dangling_indices/__init__.py} (97%) rename opensearchpy/client/{dangling_indices.pyi => dangling_indices/__init__.pyi} (98%) diff --git a/opensearchpy/client/dangling_indices.py b/opensearchpy/client/dangling_indices/__init__.py similarity index 97% rename from opensearchpy/client/dangling_indices.py rename to opensearchpy/client/dangling_indices/__init__.py index 4d1b5a36..0c4c3bbd 100644 --- a/opensearchpy/client/dangling_indices.py +++ b/opensearchpy/client/dangling_indices/__init__.py @@ -25,7 +25,7 @@ # under the License. -from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params +from opensearchpy.client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params class DanglingIndicesClient(NamespacedClient): diff --git a/opensearchpy/client/dangling_indices.pyi b/opensearchpy/client/dangling_indices/__init__.pyi similarity index 98% rename from opensearchpy/client/dangling_indices.pyi rename to opensearchpy/client/dangling_indices/__init__.pyi index 56e4a72f..43b7190a 100644 --- a/opensearchpy/client/dangling_indices.pyi +++ b/opensearchpy/client/dangling_indices/__init__.pyi @@ -26,7 +26,7 @@ from typing import Any, Collection, MutableMapping, Optional, Tuple, Union -from .utils import NamespacedClient +from opensearchpy.client.utils import NamespacedClient class DanglingIndicesClient(NamespacedClient): def delete_dangling_index( From 433b0efd28435363ec8def59fce7d9361e8862e9 Mon Sep 17 00:00:00 2001 From: Theo Truong Date: Tue, 15 Aug 2023 14:35:32 -0600 Subject: [PATCH 2/2] Split dangling_indices methods into seperate files --- opensearchpy/client/__init__.pyi | 1 + .../client/dangling_indices/__init__.py | 62 ++---------------- .../client/dangling_indices/__init__.pyi | 64 ++----------------- .../dangling_indices/delete_dangling_index.py | 53 +++++++++++++++ .../delete_dangling_index.pyi | 50 +++++++++++++++ .../dangling_indices/import_dangling_index.py | 50 +++++++++++++++ .../import_dangling_index.pyi | 50 +++++++++++++++ .../dangling_indices/list_dangling_indices.py | 38 +++++++++++ .../list_dangling_indices.pyi | 45 +++++++++++++ 9 files changed, 295 insertions(+), 118 deletions(-) create mode 100644 opensearchpy/client/dangling_indices/delete_dangling_index.py create mode 100644 opensearchpy/client/dangling_indices/delete_dangling_index.pyi create mode 100644 opensearchpy/client/dangling_indices/import_dangling_index.py create mode 100644 opensearchpy/client/dangling_indices/import_dangling_index.pyi create mode 100644 opensearchpy/client/dangling_indices/list_dangling_indices.py create mode 100644 opensearchpy/client/dangling_indices/list_dangling_indices.pyi diff --git a/opensearchpy/client/__init__.pyi b/opensearchpy/client/__init__.pyi index 64f21ca7..8647393a 100644 --- a/opensearchpy/client/__init__.pyi +++ b/opensearchpy/client/__init__.pyi @@ -50,6 +50,7 @@ class OpenSearch(object): cat: CatClient cluster: ClusterClient + dangling_indices: DanglingIndicesClient features: FeaturesClient indices: IndicesClient ingest: IngestClient diff --git a/opensearchpy/client/dangling_indices/__init__.py b/opensearchpy/client/dangling_indices/__init__.py index 0c4c3bbd..752d9748 100644 --- a/opensearchpy/client/dangling_indices/__init__.py +++ b/opensearchpy/client/dangling_indices/__init__.py @@ -24,64 +24,10 @@ # specific language governing permissions and limitations # under the License. - -from opensearchpy.client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params +from opensearchpy.client.utils import NamespacedClient class DanglingIndicesClient(NamespacedClient): - @query_params( - "accept_data_loss", "master_timeout", "cluster_manager_timeout", "timeout" - ) - def delete_dangling_index(self, index_uuid, params=None, headers=None): - """ - Deletes the specified dangling index - - - :arg index_uuid: The UUID of the dangling index - :arg accept_data_loss: Must be set to true in order to delete - the dangling index - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout - """ - if index_uuid in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'index_uuid'.") - - return self.transport.perform_request( - "DELETE", - _make_path("_dangling", index_uuid), - params=params, - headers=headers, - ) - - @query_params( - "accept_data_loss", "master_timeout", "cluster_manager_timeout", "timeout" - ) - def import_dangling_index(self, index_uuid, params=None, headers=None): - """ - Imports the specified dangling index - - - :arg index_uuid: The UUID of the dangling index - :arg accept_data_loss: Must be set to true in order to import - the dangling index - :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master - :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager - :arg timeout: Explicit operation timeout - """ - if index_uuid in SKIP_IN_PATH: - raise ValueError("Empty value passed for a required argument 'index_uuid'.") - - return self.transport.perform_request( - "POST", _make_path("_dangling", index_uuid), params=params, headers=headers - ) - - @query_params() - def list_dangling_indices(self, params=None, headers=None): - """ - Returns all dangling indices. - - """ - return self.transport.perform_request( - "GET", "/_dangling", params=params, headers=headers - ) + from .delete_dangling_index import delete_dangling_index + from .import_dangling_index import import_dangling_index + from .list_dangling_indices import list_dangling_indices diff --git a/opensearchpy/client/dangling_indices/__init__.pyi b/opensearchpy/client/dangling_indices/__init__.pyi index 43b7190a..752d9748 100644 --- a/opensearchpy/client/dangling_indices/__init__.pyi +++ b/opensearchpy/client/dangling_indices/__init__.pyi @@ -24,66 +24,10 @@ # specific language governing permissions and limitations # under the License. -from typing import Any, Collection, MutableMapping, Optional, Tuple, Union - from opensearchpy.client.utils import NamespacedClient + class DanglingIndicesClient(NamespacedClient): - def delete_dangling_index( - self, - index_uuid: Any, - *, - accept_data_loss: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - timeout: 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: ... - def import_dangling_index( - self, - index_uuid: Any, - *, - accept_data_loss: Optional[Any] = ..., - master_timeout: Optional[Any] = ..., - cluster_manager_timeout: Optional[Any] = ..., - timeout: 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: ... - def list_dangling_indices( - self, - *, - 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: ... + from .delete_dangling_index import delete_dangling_index + from .import_dangling_index import import_dangling_index + from .list_dangling_indices import list_dangling_indices diff --git a/opensearchpy/client/dangling_indices/delete_dangling_index.py b/opensearchpy/client/dangling_indices/delete_dangling_index.py new file mode 100644 index 00000000..1ffd3a0b --- /dev/null +++ b/opensearchpy/client/dangling_indices/delete_dangling_index.py @@ -0,0 +1,53 @@ +# 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. +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from opensearchpy.client.utils import SKIP_IN_PATH, _make_path, query_params + + +@query_params( + "accept_data_loss", "master_timeout", "cluster_manager_timeout", "timeout" +) +def delete_dangling_index(self, index_uuid, params=None, headers=None): + """ + Deletes the specified dangling index + + + :arg index_uuid: The UUID of the dangling index + :arg accept_data_loss: Must be set to true in order to delete + the dangling index + :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master + :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + :arg timeout: Explicit operation timeout + """ + if index_uuid in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index_uuid'.") + + return self.transport.perform_request( + "DELETE", + _make_path("_dangling", index_uuid), + params=params, + headers=headers, + ) diff --git a/opensearchpy/client/dangling_indices/delete_dangling_index.pyi b/opensearchpy/client/dangling_indices/delete_dangling_index.pyi new file mode 100644 index 00000000..43a8aea2 --- /dev/null +++ b/opensearchpy/client/dangling_indices/delete_dangling_index.pyi @@ -0,0 +1,50 @@ +# 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. +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from typing import Any, Collection, MutableMapping, Optional, Tuple, Union + + +def delete_dangling_index( + self, + index_uuid: Any, + *, + accept_data_loss: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + timeout: 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: str = ..., +) -> Any: ... \ No newline at end of file diff --git a/opensearchpy/client/dangling_indices/import_dangling_index.py b/opensearchpy/client/dangling_indices/import_dangling_index.py new file mode 100644 index 00000000..48dabaac --- /dev/null +++ b/opensearchpy/client/dangling_indices/import_dangling_index.py @@ -0,0 +1,50 @@ +# 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. +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from opensearchpy.client.utils import SKIP_IN_PATH, _make_path, query_params + + +@query_params( + "accept_data_loss", "master_timeout", "cluster_manager_timeout", "timeout" +) +def import_dangling_index(self, index_uuid, params=None, headers=None): + """ + Imports the specified dangling index + + + :arg index_uuid: The UUID of the dangling index + :arg accept_data_loss: Must be set to true in order to import + the dangling index + :arg master_timeout (Deprecated: use cluster_manager_timeout): Specify timeout for connection to master + :arg cluster_manager_timeout: Specify timeout for connection to cluster_manager + :arg timeout: Explicit operation timeout + """ + if index_uuid in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index_uuid'.") + + return self.transport.perform_request( + "POST", _make_path("_dangling", index_uuid), params=params, headers=headers + ) diff --git a/opensearchpy/client/dangling_indices/import_dangling_index.pyi b/opensearchpy/client/dangling_indices/import_dangling_index.pyi new file mode 100644 index 00000000..0d726394 --- /dev/null +++ b/opensearchpy/client/dangling_indices/import_dangling_index.pyi @@ -0,0 +1,50 @@ +# 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. +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from typing import Any, Collection, MutableMapping, Optional, Tuple, Union + + +def import_dangling_index( + self, + index_uuid: Any, + *, + accept_data_loss: Optional[Any] = ..., + master_timeout: Optional[Any] = ..., + cluster_manager_timeout: Optional[Any] = ..., + timeout: 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: ... \ No newline at end of file diff --git a/opensearchpy/client/dangling_indices/list_dangling_indices.py b/opensearchpy/client/dangling_indices/list_dangling_indices.py new file mode 100644 index 00000000..9e7c9c17 --- /dev/null +++ b/opensearchpy/client/dangling_indices/list_dangling_indices.py @@ -0,0 +1,38 @@ +# 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. +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from opensearchpy.client.utils import SKIP_IN_PATH, _make_path, query_params + + +@query_params() +def list_dangling_indices(self, params=None, headers=None): + """ + Returns all dangling indices. + + """ + return self.transport.perform_request( + "GET", "/_dangling", params=params, headers=headers + ) diff --git a/opensearchpy/client/dangling_indices/list_dangling_indices.pyi b/opensearchpy/client/dangling_indices/list_dangling_indices.pyi new file mode 100644 index 00000000..4dd248df --- /dev/null +++ b/opensearchpy/client/dangling_indices/list_dangling_indices.pyi @@ -0,0 +1,45 @@ +# 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. +# +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from typing import Any, Collection, MutableMapping, Optional, Tuple, Union + + +def list_dangling_indices( + self, + *, + 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: ... \ No newline at end of file