From c781f3e78c0eeca0ed79dc20a8fcb5d277c7e564 Mon Sep 17 00:00:00 2001 From: Seth Michael Larson Date: Fri, 4 Jun 2021 10:17:58 -0500 Subject: [PATCH] Update APIs to 7.x-SNAPSHOT --- elasticsearch/_async/client/__init__.py | 30 +++++++++++ elasticsearch/_async/client/__init__.pyi | 18 +++++++ elasticsearch/_async/client/security.py | 20 +++++++ elasticsearch/_async/client/security.pyi | 17 ++++++ elasticsearch/_async/client/snapshot.py | 54 +++++++++++++++++++ elasticsearch/_async/client/snapshot.pyi | 28 ++++++++++ elasticsearch/client/__init__.py | 30 +++++++++++ elasticsearch/client/__init__.pyi | 18 +++++++ elasticsearch/client/security.py | 20 +++++++ elasticsearch/client/security.pyi | 17 ++++++ elasticsearch/client/snapshot.py | 54 +++++++++++++++++++ elasticsearch/client/snapshot.pyi | 28 ++++++++++ .../test_server/test_rest_api_spec.py | 3 ++ 13 files changed, 337 insertions(+) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 485a0a09..62856cc4 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -2145,3 +2145,33 @@ class AsyncElasticsearch(object): return await self.transport.perform_request( "POST", _make_path(index, "_pit"), params=params, headers=headers ) + + @query_params() + async def terms_enum(self, index, body=None, params=None, headers=None): + """ + The terms enum API can be used to discover terms in the index that begin with + the provided string. It is designed for low-latency look-ups used in auto- + complete scenarios. + + ``_ + + .. warning:: + + This API is **beta** so may include breaking changes + or be removed in a future version + + :arg index: A comma-separated list of index names to search; use + `_all` or empty string to perform the operation on all indices + :arg body: field name, string which is the prefix expected in + matching terms, timeout and size for max number of results + """ + if index in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index'.") + + return await self.transport.perform_request( + "POST", + _make_path(index, "_terms_enum"), + params=params, + headers=headers, + body=body, + ) diff --git a/elasticsearch/_async/client/__init__.pyi b/elasticsearch/_async/client/__init__.pyi index d962025e..1dda5afb 100644 --- a/elasticsearch/_async/client/__init__.pyi +++ b/elasticsearch/_async/client/__init__.pyi @@ -1150,3 +1150,21 @@ class AsyncElasticsearch(object): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + async def terms_enum( + self, + index: Any, + *, + body: 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: ... diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index 93cc4ac8..cedefe93 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -762,3 +762,23 @@ class SecurityClient(NamespacedClient): params=params, headers=headers, ) + + @query_params() + async def saml_complete_logout(self, body, params=None, headers=None): + """ + Verifies the logout response sent from the SAML IdP + + ``_ + + :arg body: The logout response to verify + """ + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") + + return await self.transport.perform_request( + "POST", + "/_security/saml/complete_logout", + params=params, + headers=headers, + body=body, + ) diff --git a/elasticsearch/_async/client/security.pyi b/elasticsearch/_async/client/security.pyi index 31492975..42dd549f 100644 --- a/elasticsearch/_async/client/security.pyi +++ b/elasticsearch/_async/client/security.pyi @@ -630,3 +630,20 @@ class SecurityClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + async def saml_complete_logout( + self, + *, + body: 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: ... diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index 42c35bcd..c656a420 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -285,3 +285,57 @@ class SnapshotClient(NamespacedClient): headers=headers, body=body, ) + + @query_params( + "blob_count", + "concurrency", + "detailed", + "early_read_node_count", + "max_blob_size", + "max_total_data_size", + "rare_action_probability", + "rarely_abort_writes", + "read_node_count", + "seed", + "timeout", + ) + async def repository_analyze(self, repository, params=None, headers=None): + """ + Analyzes a repository for correctness and performance + + ``_ + + :arg repository: A repository name + :arg blob_count: Number of blobs to create during the test. + Defaults to 100. + :arg concurrency: Number of operations to run concurrently + during the test. Defaults to 10. + :arg detailed: Whether to return detailed results or a summary. + Defaults to 'false' so that only the summary is returned. + :arg early_read_node_count: Number of nodes on which to perform + an early read on a blob, i.e. before writing has completed. Early reads + are rare actions so the 'rare_action_probability' parameter is also + relevant. Defaults to 2. + :arg max_blob_size: Maximum size of a blob to create during the + test, e.g '1gb' or '100mb'. Defaults to '10mb'. + :arg max_total_data_size: Maximum total size of all blobs to + create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. + :arg rare_action_probability: Probability of taking a rare + action such as an early read or an overwrite. Defaults to 0.02. + :arg rarely_abort_writes: Whether to rarely abort writes before + they complete. Defaults to 'true'. + :arg read_node_count: Number of nodes on which to read a blob + after writing. Defaults to 10. + :arg seed: Seed for the random number generator used to create + the test workload. Defaults to a random value. + :arg timeout: Explicit operation timeout. Defaults to '30s'. + """ + if repository in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'repository'.") + + return await self.transport.perform_request( + "POST", + _make_path("_snapshot", repository, "_analyze"), + params=params, + headers=headers, + ) diff --git a/elasticsearch/_async/client/snapshot.pyi b/elasticsearch/_async/client/snapshot.pyi index 6bf733a9..2ee4b6e7 100644 --- a/elasticsearch/_async/client/snapshot.pyi +++ b/elasticsearch/_async/client/snapshot.pyi @@ -241,3 +241,31 @@ class SnapshotClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + async def repository_analyze( + self, + repository: Any, + *, + blob_count: Optional[Any] = ..., + concurrency: Optional[Any] = ..., + detailed: Optional[Any] = ..., + early_read_node_count: Optional[Any] = ..., + max_blob_size: Optional[Any] = ..., + max_total_data_size: Optional[Any] = ..., + rare_action_probability: Optional[Any] = ..., + rarely_abort_writes: Optional[Any] = ..., + read_node_count: Optional[Any] = ..., + seed: 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: ... diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index f6ec7cf1..4ba75db0 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -2133,3 +2133,33 @@ class Elasticsearch(object): return self.transport.perform_request( "POST", _make_path(index, "_pit"), params=params, headers=headers ) + + @query_params() + def terms_enum(self, index, body=None, params=None, headers=None): + """ + The terms enum API can be used to discover terms in the index that begin with + the provided string. It is designed for low-latency look-ups used in auto- + complete scenarios. + + ``_ + + .. warning:: + + This API is **beta** so may include breaking changes + or be removed in a future version + + :arg index: A comma-separated list of index names to search; use + `_all` or empty string to perform the operation on all indices + :arg body: field name, string which is the prefix expected in + matching terms, timeout and size for max number of results + """ + if index in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index'.") + + return self.transport.perform_request( + "POST", + _make_path(index, "_terms_enum"), + params=params, + headers=headers, + body=body, + ) diff --git a/elasticsearch/client/__init__.pyi b/elasticsearch/client/__init__.pyi index 1a747996..31d2728b 100644 --- a/elasticsearch/client/__init__.pyi +++ b/elasticsearch/client/__init__.pyi @@ -1150,3 +1150,21 @@ class Elasticsearch(object): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + def terms_enum( + self, + index: Any, + *, + body: 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: ... diff --git a/elasticsearch/client/security.py b/elasticsearch/client/security.py index 1adb591e..5eb0286d 100644 --- a/elasticsearch/client/security.py +++ b/elasticsearch/client/security.py @@ -756,3 +756,23 @@ class SecurityClient(NamespacedClient): params=params, headers=headers, ) + + @query_params() + def saml_complete_logout(self, body, params=None, headers=None): + """ + Verifies the logout response sent from the SAML IdP + + ``_ + + :arg body: The logout response to verify + """ + if body in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'body'.") + + return self.transport.perform_request( + "POST", + "/_security/saml/complete_logout", + params=params, + headers=headers, + body=body, + ) diff --git a/elasticsearch/client/security.pyi b/elasticsearch/client/security.pyi index d3b268d3..a195fa96 100644 --- a/elasticsearch/client/security.pyi +++ b/elasticsearch/client/security.pyi @@ -630,3 +630,20 @@ class SecurityClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + def saml_complete_logout( + self, + *, + body: 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: ... diff --git a/elasticsearch/client/snapshot.py b/elasticsearch/client/snapshot.py index e72c002d..92f5a170 100644 --- a/elasticsearch/client/snapshot.py +++ b/elasticsearch/client/snapshot.py @@ -285,3 +285,57 @@ class SnapshotClient(NamespacedClient): headers=headers, body=body, ) + + @query_params( + "blob_count", + "concurrency", + "detailed", + "early_read_node_count", + "max_blob_size", + "max_total_data_size", + "rare_action_probability", + "rarely_abort_writes", + "read_node_count", + "seed", + "timeout", + ) + def repository_analyze(self, repository, params=None, headers=None): + """ + Analyzes a repository for correctness and performance + + ``_ + + :arg repository: A repository name + :arg blob_count: Number of blobs to create during the test. + Defaults to 100. + :arg concurrency: Number of operations to run concurrently + during the test. Defaults to 10. + :arg detailed: Whether to return detailed results or a summary. + Defaults to 'false' so that only the summary is returned. + :arg early_read_node_count: Number of nodes on which to perform + an early read on a blob, i.e. before writing has completed. Early reads + are rare actions so the 'rare_action_probability' parameter is also + relevant. Defaults to 2. + :arg max_blob_size: Maximum size of a blob to create during the + test, e.g '1gb' or '100mb'. Defaults to '10mb'. + :arg max_total_data_size: Maximum total size of all blobs to + create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. + :arg rare_action_probability: Probability of taking a rare + action such as an early read or an overwrite. Defaults to 0.02. + :arg rarely_abort_writes: Whether to rarely abort writes before + they complete. Defaults to 'true'. + :arg read_node_count: Number of nodes on which to read a blob + after writing. Defaults to 10. + :arg seed: Seed for the random number generator used to create + the test workload. Defaults to a random value. + :arg timeout: Explicit operation timeout. Defaults to '30s'. + """ + if repository in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'repository'.") + + return self.transport.perform_request( + "POST", + _make_path("_snapshot", repository, "_analyze"), + params=params, + headers=headers, + ) diff --git a/elasticsearch/client/snapshot.pyi b/elasticsearch/client/snapshot.pyi index 2b8d9064..efa685b0 100644 --- a/elasticsearch/client/snapshot.pyi +++ b/elasticsearch/client/snapshot.pyi @@ -241,3 +241,31 @@ class SnapshotClient(NamespacedClient): params: Optional[MutableMapping[str, Any]] = ..., headers: Optional[MutableMapping[str, str]] = ..., ) -> Any: ... + def repository_analyze( + self, + repository: Any, + *, + blob_count: Optional[Any] = ..., + concurrency: Optional[Any] = ..., + detailed: Optional[Any] = ..., + early_read_node_count: Optional[Any] = ..., + max_blob_size: Optional[Any] = ..., + max_total_data_size: Optional[Any] = ..., + rare_action_probability: Optional[Any] = ..., + rarely_abort_writes: Optional[Any] = ..., + read_node_count: Optional[Any] = ..., + seed: 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: ... diff --git a/test_elasticsearch/test_server/test_rest_api_spec.py b/test_elasticsearch/test_server/test_rest_api_spec.py index ca75121e..aa7122f0 100644 --- a/test_elasticsearch/test_server/test_rest_api_spec.py +++ b/test_elasticsearch/test_server/test_rest_api_spec.py @@ -60,6 +60,8 @@ IMPLEMENTED_FEATURES = { # broken YAML tests on some releases SKIP_TESTS = { + "ml/job_cat_apis[0]", + "ml/post_data[0]", "ml/post_data[1]", "ml/post_data[2]", "ml/post_data[3]", @@ -69,6 +71,7 @@ SKIP_TESTS = { "ml/get_trained_model_stats[1]", "ml/get_trained_model_stats[2]", "ml/get_trained_model_stats[3]", + "ml/set_upgrade_mode[0]", "ml/set_upgrade_mode[1]", "ml/set_upgrade_mode[2]", "ml/set_upgrade_mode[3]",