Skip to content

Commit

Permalink
Update APIs to 7.x-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Jun 4, 2021
1 parent ae522eb commit c781f3e
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 0 deletions.
30 changes: 30 additions & 0 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2145,3 +2145,33 @@ async def open_point_in_time(self, index=None, params=None, headers=None):
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.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-terms-enum.html>`_
.. 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,
)
18 changes: 18 additions & 0 deletions elasticsearch/_async/client/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
20 changes: 20 additions & 0 deletions elasticsearch/_async/client/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,3 +762,23 @@ async def get_service_credentials(
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
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-saml-complete-logout.html>`_
: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,
)
17 changes: 17 additions & 0 deletions elasticsearch/_async/client/security.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
54 changes: 54 additions & 0 deletions elasticsearch/_async/client/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,57 @@ async def clone(
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
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
: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,
)
28 changes: 28 additions & 0 deletions elasticsearch/_async/client/snapshot.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
30 changes: 30 additions & 0 deletions elasticsearch/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2133,3 +2133,33 @@ def open_point_in_time(self, index=None, params=None, headers=None):
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.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-terms-enum.html>`_
.. 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,
)
18 changes: 18 additions & 0 deletions elasticsearch/client/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
20 changes: 20 additions & 0 deletions elasticsearch/client/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,3 +756,23 @@ def get_service_credentials(self, namespace, service, params=None, headers=None)
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
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-saml-complete-logout.html>`_
: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,
)
17 changes: 17 additions & 0 deletions elasticsearch/client/security.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
54 changes: 54 additions & 0 deletions elasticsearch/client/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,57 @@ def clone(
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
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/modules-snapshots.html>`_
: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,
)
28 changes: 28 additions & 0 deletions elasticsearch/client/snapshot.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
3 changes: 3 additions & 0 deletions test_elasticsearch/test_server/test_rest_api_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@

# 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]",
Expand All @@ -69,6 +71,7 @@
"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]",
Expand Down

0 comments on commit c781f3e

Please sign in to comment.