[7.x] Generate APIs using Elastic build artifacts API
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ To run the code generation make sure you have pre-requisites installed:
|
|||||||
Then you should be able to run the code generation by invoking:
|
Then you should be able to run the code generation by invoking:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ python utils/generate-api.py
|
$ python utils/generate-api.py 8.0.0-SNAPSHOT
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing Code Changes
|
## Contributing Code Changes
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ from .deprecation import DeprecationClient
|
|||||||
from .enrich import EnrichClient
|
from .enrich import EnrichClient
|
||||||
from .eql import EqlClient
|
from .eql import EqlClient
|
||||||
from .features import FeaturesClient
|
from .features import FeaturesClient
|
||||||
|
from .fleet import FleetClient
|
||||||
from .graph import GraphClient
|
from .graph import GraphClient
|
||||||
from .ilm import IlmClient
|
from .ilm import IlmClient
|
||||||
from .indices import IndicesClient
|
from .indices import IndicesClient
|
||||||
@@ -46,6 +47,7 @@ from .remote import RemoteClient
|
|||||||
from .rollup import RollupClient
|
from .rollup import RollupClient
|
||||||
from .searchable_snapshots import SearchableSnapshotsClient
|
from .searchable_snapshots import SearchableSnapshotsClient
|
||||||
from .security import SecurityClient
|
from .security import SecurityClient
|
||||||
|
from .shutdown import ShutdownClient
|
||||||
from .slm import SlmClient
|
from .slm import SlmClient
|
||||||
from .snapshot import SnapshotClient
|
from .snapshot import SnapshotClient
|
||||||
from .sql import SqlClient
|
from .sql import SqlClient
|
||||||
@@ -224,6 +226,7 @@ class AsyncElasticsearch(object):
|
|||||||
self.enrich = EnrichClient(self)
|
self.enrich = EnrichClient(self)
|
||||||
self.eql = EqlClient(self)
|
self.eql = EqlClient(self)
|
||||||
self.features = FeaturesClient(self)
|
self.features = FeaturesClient(self)
|
||||||
|
self.fleet = FleetClient(self)
|
||||||
self.graph = GraphClient(self)
|
self.graph = GraphClient(self)
|
||||||
self.ilm = IlmClient(self)
|
self.ilm = IlmClient(self)
|
||||||
self.license = LicenseClient(self)
|
self.license = LicenseClient(self)
|
||||||
@@ -235,6 +238,7 @@ class AsyncElasticsearch(object):
|
|||||||
self.searchable_snapshots = SearchableSnapshotsClient(self)
|
self.searchable_snapshots = SearchableSnapshotsClient(self)
|
||||||
self.security = SecurityClient(self)
|
self.security = SecurityClient(self)
|
||||||
self.slm = SlmClient(self)
|
self.slm = SlmClient(self)
|
||||||
|
self.shutdown = ShutdownClient(self)
|
||||||
self.sql = SqlClient(self)
|
self.sql = SqlClient(self)
|
||||||
self.ssl = SslClient(self)
|
self.ssl = SslClient(self)
|
||||||
self.text_structure = TextStructureClient(self)
|
self.text_structure = TextStructureClient(self)
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class ClusterClient(NamespacedClient):
|
|||||||
"""
|
"""
|
||||||
Returns cluster settings.
|
Returns cluster settings.
|
||||||
|
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-update-settings.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-get-settings.html>`_
|
||||||
|
|
||||||
:arg flat_settings: Return settings in flat format (default:
|
:arg flat_settings: Return settings in flat format (default:
|
||||||
false)
|
false)
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# 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 .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
||||||
|
|
||||||
|
|
||||||
|
class FleetClient(NamespacedClient):
|
||||||
|
@query_params("checkpoints", "timeout", "wait_for_advance")
|
||||||
|
async def global_checkpoints(self, index, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Returns the current global checkpoints for an index. This API is design for
|
||||||
|
internal use by the fleet server project.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg index: The name of the index.
|
||||||
|
:arg checkpoints: Comma separated list of checkpoints
|
||||||
|
:arg timeout: Timeout to wait for global checkpoint to advance
|
||||||
|
Default: 30s
|
||||||
|
:arg wait_for_advance: Whether to wait for the global checkpoint
|
||||||
|
to advance past the specified current checkpoints Default: false
|
||||||
|
"""
|
||||||
|
if index in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||||
|
|
||||||
|
return await self.transport.perform_request(
|
||||||
|
"GET",
|
||||||
|
_make_path(index, "_fleet", "global_checkpoints"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# 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, Union
|
||||||
|
|
||||||
|
from .utils import NamespacedClient
|
||||||
|
|
||||||
|
class FleetClient(NamespacedClient):
|
||||||
|
async def global_checkpoints(
|
||||||
|
self,
|
||||||
|
index: Any,
|
||||||
|
*,
|
||||||
|
checkpoints: Optional[Any] = ...,
|
||||||
|
timeout: Optional[Any] = ...,
|
||||||
|
wait_for_advance: 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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
@@ -117,3 +117,14 @@ class IngestClient(NamespacedClient):
|
|||||||
return await self.transport.perform_request(
|
return await self.transport.perform_request(
|
||||||
"GET", "/_ingest/processor/grok", params=params, headers=headers
|
"GET", "/_ingest/processor/grok", params=params, headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
async def geo_ip_stats(self, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Returns statistical information about geoip databases
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/geoip-stats-api.html>`_
|
||||||
|
"""
|
||||||
|
return await self.transport.perform_request(
|
||||||
|
"GET", "/_ingest/geoip/stats", params=params, headers=headers
|
||||||
|
)
|
||||||
|
|||||||
@@ -103,3 +103,17 @@ class IngestClient(NamespacedClient):
|
|||||||
params: Optional[MutableMapping[str, Any]] = ...,
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
headers: Optional[MutableMapping[str, str]] = ...
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
|
async def geo_ip_stats(
|
||||||
|
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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
|||||||
@@ -826,24 +826,24 @@ class MlClient(NamespacedClient):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
async def preview_datafeed(self, datafeed_id, params=None, headers=None):
|
async def preview_datafeed(
|
||||||
|
self, body=None, datafeed_id=None, params=None, headers=None
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Previews a datafeed.
|
Previews a datafeed.
|
||||||
|
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-preview-datafeed.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-preview-datafeed.html>`_
|
||||||
|
|
||||||
|
:arg body: The datafeed config and job config with which to
|
||||||
|
execute the preview
|
||||||
:arg datafeed_id: The ID of the datafeed to preview
|
:arg datafeed_id: The ID of the datafeed to preview
|
||||||
"""
|
"""
|
||||||
if datafeed_id in SKIP_IN_PATH:
|
|
||||||
raise ValueError(
|
|
||||||
"Empty value passed for a required argument 'datafeed_id'."
|
|
||||||
)
|
|
||||||
|
|
||||||
return await self.transport.perform_request(
|
return await self.transport.perform_request(
|
||||||
"GET",
|
"POST",
|
||||||
_make_path("_ml", "datafeeds", datafeed_id, "_preview"),
|
_make_path("_ml", "datafeeds", datafeed_id, "_preview"),
|
||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
body=body,
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
@@ -1762,3 +1762,76 @@ class MlClient(NamespacedClient):
|
|||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@query_params(
|
||||||
|
"charset",
|
||||||
|
"column_names",
|
||||||
|
"delimiter",
|
||||||
|
"explain",
|
||||||
|
"format",
|
||||||
|
"grok_pattern",
|
||||||
|
"has_header_row",
|
||||||
|
"line_merge_size_limit",
|
||||||
|
"lines_to_sample",
|
||||||
|
"quote",
|
||||||
|
"should_trim_fields",
|
||||||
|
"timeout",
|
||||||
|
"timestamp_field",
|
||||||
|
"timestamp_format",
|
||||||
|
)
|
||||||
|
async def find_file_structure(self, body, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Finds the structure of a text file. The text file must contain data that is
|
||||||
|
suitable to be ingested into Elasticsearch.
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg body: The contents of the file to be analyzed
|
||||||
|
:arg charset: Optional parameter to specify the character set of
|
||||||
|
the file
|
||||||
|
:arg column_names: Optional parameter containing a comma
|
||||||
|
separated list of the column names for a delimited file
|
||||||
|
:arg delimiter: Optional parameter to specify the delimiter
|
||||||
|
character for a delimited file - must be a single character
|
||||||
|
:arg explain: Whether to include a commentary on how the
|
||||||
|
structure was derived
|
||||||
|
:arg format: Optional parameter to specify the high level file
|
||||||
|
format Valid choices: ndjson, xml, delimited, semi_structured_text
|
||||||
|
:arg grok_pattern: Optional parameter to specify the Grok
|
||||||
|
pattern that should be used to extract fields from messages in a semi-
|
||||||
|
structured text file
|
||||||
|
:arg has_header_row: Optional parameter to specify whether a
|
||||||
|
delimited file includes the column names in its first row
|
||||||
|
:arg line_merge_size_limit: Maximum number of characters
|
||||||
|
permitted in a single message when lines are merged to create messages.
|
||||||
|
Default: 10000
|
||||||
|
:arg lines_to_sample: How many lines of the file should be
|
||||||
|
included in the analysis Default: 1000
|
||||||
|
:arg quote: Optional parameter to specify the quote character
|
||||||
|
for a delimited file - must be a single character
|
||||||
|
:arg should_trim_fields: Optional parameter to specify whether
|
||||||
|
the values between delimiters in a delimited file should have whitespace
|
||||||
|
trimmed from them
|
||||||
|
:arg timeout: Timeout after which the analysis will be aborted
|
||||||
|
Default: 25s
|
||||||
|
:arg timestamp_field: Optional parameter to specify the
|
||||||
|
timestamp field in the file
|
||||||
|
:arg timestamp_format: Optional parameter to specify the
|
||||||
|
timestamp format in the file - may be either a Joda or Java time format
|
||||||
|
"""
|
||||||
|
if body in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||||
|
|
||||||
|
body = _bulk_body(self.transport.serializer, body)
|
||||||
|
return await self.transport.perform_request(
|
||||||
|
"POST",
|
||||||
|
"/_ml/find_file_structure",
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|||||||
@@ -557,8 +557,9 @@ class MlClient(NamespacedClient):
|
|||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
async def preview_datafeed(
|
async def preview_datafeed(
|
||||||
self,
|
self,
|
||||||
datafeed_id: Any,
|
|
||||||
*,
|
*,
|
||||||
|
body: Optional[Any] = ...,
|
||||||
|
datafeed_id: Optional[Any] = ...,
|
||||||
pretty: Optional[bool] = ...,
|
pretty: Optional[bool] = ...,
|
||||||
human: Optional[bool] = ...,
|
human: Optional[bool] = ...,
|
||||||
error_trace: Optional[bool] = ...,
|
error_trace: Optional[bool] = ...,
|
||||||
@@ -1134,3 +1135,31 @@ class MlClient(NamespacedClient):
|
|||||||
params: Optional[MutableMapping[str, Any]] = ...,
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
headers: Optional[MutableMapping[str, str]] = ...
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
|
async def find_file_structure(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
body: Any,
|
||||||
|
charset: Optional[Any] = ...,
|
||||||
|
column_names: Optional[Any] = ...,
|
||||||
|
delimiter: Optional[Any] = ...,
|
||||||
|
explain: Optional[Any] = ...,
|
||||||
|
format: Optional[Any] = ...,
|
||||||
|
grok_pattern: Optional[Any] = ...,
|
||||||
|
has_header_row: Optional[Any] = ...,
|
||||||
|
line_merge_size_limit: Optional[Any] = ...,
|
||||||
|
lines_to_sample: Optional[Any] = ...,
|
||||||
|
quote: Optional[Any] = ...,
|
||||||
|
should_trim_fields: Optional[Any] = ...,
|
||||||
|
timeout: Optional[Any] = ...,
|
||||||
|
timestamp_field: Optional[Any] = ...,
|
||||||
|
timestamp_format: Optional[Any] = ...,
|
||||||
|
pretty: Optional[bool] = ...,
|
||||||
|
human: Optional[bool] = ...,
|
||||||
|
error_trace: Optional[bool] = ...,
|
||||||
|
filter_path: Optional[Union[str, Collection[str]]] = ...,
|
||||||
|
request_timeout: Optional[Union[int, float]] = ...,
|
||||||
|
ignore: Optional[Union[int, Collection[int]]] = ...,
|
||||||
|
opaque_id: Optional[str] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
# 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 .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
||||||
|
|
||||||
|
|
||||||
|
class ShutdownClient(NamespacedClient):
|
||||||
|
@query_params()
|
||||||
|
async def delete_node(self, node_id, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Removes a node from the shutdown list
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg node_id: The node id of node to be removed from the
|
||||||
|
shutdown state
|
||||||
|
"""
|
||||||
|
if node_id in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'node_id'.")
|
||||||
|
|
||||||
|
return await self.transport.perform_request(
|
||||||
|
"DELETE",
|
||||||
|
_make_path("_nodes", node_id, "shutdown"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
async def get_node(self, node_id=None, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Retrieve status of a node or nodes that are currently marked as shutting down
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg node_id: Which node for which to retrieve the shutdown
|
||||||
|
status
|
||||||
|
"""
|
||||||
|
return await self.transport.perform_request(
|
||||||
|
"GET",
|
||||||
|
_make_path("_nodes", node_id, "shutdown"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
async def put_node(self, node_id, body, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Adds a node to be shut down
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg node_id: The node id of node to be shut down
|
||||||
|
:arg body: The shutdown type definition to register
|
||||||
|
"""
|
||||||
|
for param in (node_id, body):
|
||||||
|
if param in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument.")
|
||||||
|
|
||||||
|
return await self.transport.perform_request(
|
||||||
|
"PUT",
|
||||||
|
_make_path("_nodes", node_id, "shutdown"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# 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, Union
|
||||||
|
|
||||||
|
from .utils import NamespacedClient
|
||||||
|
|
||||||
|
class ShutdownClient(NamespacedClient):
|
||||||
|
async def delete_node(
|
||||||
|
self,
|
||||||
|
node_id: 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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
async def get_node(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
node_id: 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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
async def put_node(
|
||||||
|
self,
|
||||||
|
node_id: Any,
|
||||||
|
*,
|
||||||
|
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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
@@ -42,11 +42,6 @@ class TextStructureClient(NamespacedClient):
|
|||||||
|
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html>`_
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
This API is **experimental** so may include breaking changes
|
|
||||||
or be removed in a future version
|
|
||||||
|
|
||||||
:arg body: The contents of the file to be analyzed
|
:arg body: The contents of the file to be analyzed
|
||||||
:arg charset: Optional parameter to specify the character set of
|
:arg charset: Optional parameter to specify the character set of
|
||||||
the file
|
the file
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ from .deprecation import DeprecationClient
|
|||||||
from .enrich import EnrichClient
|
from .enrich import EnrichClient
|
||||||
from .eql import EqlClient
|
from .eql import EqlClient
|
||||||
from .features import FeaturesClient
|
from .features import FeaturesClient
|
||||||
|
from .fleet import FleetClient
|
||||||
from .graph import GraphClient
|
from .graph import GraphClient
|
||||||
from .ilm import IlmClient
|
from .ilm import IlmClient
|
||||||
from .indices import IndicesClient
|
from .indices import IndicesClient
|
||||||
@@ -46,6 +47,7 @@ from .remote import RemoteClient
|
|||||||
from .rollup import RollupClient
|
from .rollup import RollupClient
|
||||||
from .searchable_snapshots import SearchableSnapshotsClient
|
from .searchable_snapshots import SearchableSnapshotsClient
|
||||||
from .security import SecurityClient
|
from .security import SecurityClient
|
||||||
|
from .shutdown import ShutdownClient
|
||||||
from .slm import SlmClient
|
from .slm import SlmClient
|
||||||
from .snapshot import SnapshotClient
|
from .snapshot import SnapshotClient
|
||||||
from .sql import SqlClient
|
from .sql import SqlClient
|
||||||
@@ -224,6 +226,7 @@ class Elasticsearch(object):
|
|||||||
self.enrich = EnrichClient(self)
|
self.enrich = EnrichClient(self)
|
||||||
self.eql = EqlClient(self)
|
self.eql = EqlClient(self)
|
||||||
self.features = FeaturesClient(self)
|
self.features = FeaturesClient(self)
|
||||||
|
self.fleet = FleetClient(self)
|
||||||
self.graph = GraphClient(self)
|
self.graph = GraphClient(self)
|
||||||
self.ilm = IlmClient(self)
|
self.ilm = IlmClient(self)
|
||||||
self.license = LicenseClient(self)
|
self.license = LicenseClient(self)
|
||||||
@@ -235,6 +238,7 @@ class Elasticsearch(object):
|
|||||||
self.searchable_snapshots = SearchableSnapshotsClient(self)
|
self.searchable_snapshots = SearchableSnapshotsClient(self)
|
||||||
self.security = SecurityClient(self)
|
self.security = SecurityClient(self)
|
||||||
self.slm = SlmClient(self)
|
self.slm = SlmClient(self)
|
||||||
|
self.shutdown = ShutdownClient(self)
|
||||||
self.sql = SqlClient(self)
|
self.sql = SqlClient(self)
|
||||||
self.ssl = SslClient(self)
|
self.ssl = SslClient(self)
|
||||||
self.text_structure = TextStructureClient(self)
|
self.text_structure = TextStructureClient(self)
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class ClusterClient(NamespacedClient):
|
|||||||
"""
|
"""
|
||||||
Returns cluster settings.
|
Returns cluster settings.
|
||||||
|
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-update-settings.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/cluster-get-settings.html>`_
|
||||||
|
|
||||||
:arg flat_settings: Return settings in flat format (default:
|
:arg flat_settings: Return settings in flat format (default:
|
||||||
false)
|
false)
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# 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 .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
||||||
|
|
||||||
|
|
||||||
|
class FleetClient(NamespacedClient):
|
||||||
|
@query_params("checkpoints", "timeout", "wait_for_advance")
|
||||||
|
def global_checkpoints(self, index, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Returns the current global checkpoints for an index. This API is design for
|
||||||
|
internal use by the fleet server project.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg index: The name of the index.
|
||||||
|
:arg checkpoints: Comma separated list of checkpoints
|
||||||
|
:arg timeout: Timeout to wait for global checkpoint to advance
|
||||||
|
Default: 30s
|
||||||
|
:arg wait_for_advance: Whether to wait for the global checkpoint
|
||||||
|
to advance past the specified current checkpoints Default: false
|
||||||
|
"""
|
||||||
|
if index in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'index'.")
|
||||||
|
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"GET",
|
||||||
|
_make_path(index, "_fleet", "global_checkpoints"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# 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, Union
|
||||||
|
|
||||||
|
from .utils import NamespacedClient
|
||||||
|
|
||||||
|
class FleetClient(NamespacedClient):
|
||||||
|
def global_checkpoints(
|
||||||
|
self,
|
||||||
|
index: Any,
|
||||||
|
*,
|
||||||
|
checkpoints: Optional[Any] = ...,
|
||||||
|
timeout: Optional[Any] = ...,
|
||||||
|
wait_for_advance: 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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
@@ -117,3 +117,14 @@ class IngestClient(NamespacedClient):
|
|||||||
return self.transport.perform_request(
|
return self.transport.perform_request(
|
||||||
"GET", "/_ingest/processor/grok", params=params, headers=headers
|
"GET", "/_ingest/processor/grok", params=params, headers=headers
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
def geo_ip_stats(self, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Returns statistical information about geoip databases
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/geoip-stats-api.html>`_
|
||||||
|
"""
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"GET", "/_ingest/geoip/stats", params=params, headers=headers
|
||||||
|
)
|
||||||
|
|||||||
@@ -103,3 +103,17 @@ class IngestClient(NamespacedClient):
|
|||||||
params: Optional[MutableMapping[str, Any]] = ...,
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
headers: Optional[MutableMapping[str, str]] = ...
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
|
def geo_ip_stats(
|
||||||
|
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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
|||||||
@@ -814,24 +814,22 @@ class MlClient(NamespacedClient):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
def preview_datafeed(self, datafeed_id, params=None, headers=None):
|
def preview_datafeed(self, body=None, datafeed_id=None, params=None, headers=None):
|
||||||
"""
|
"""
|
||||||
Previews a datafeed.
|
Previews a datafeed.
|
||||||
|
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-preview-datafeed.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-preview-datafeed.html>`_
|
||||||
|
|
||||||
|
:arg body: The datafeed config and job config with which to
|
||||||
|
execute the preview
|
||||||
:arg datafeed_id: The ID of the datafeed to preview
|
:arg datafeed_id: The ID of the datafeed to preview
|
||||||
"""
|
"""
|
||||||
if datafeed_id in SKIP_IN_PATH:
|
|
||||||
raise ValueError(
|
|
||||||
"Empty value passed for a required argument 'datafeed_id'."
|
|
||||||
)
|
|
||||||
|
|
||||||
return self.transport.perform_request(
|
return self.transport.perform_request(
|
||||||
"GET",
|
"POST",
|
||||||
_make_path("_ml", "datafeeds", datafeed_id, "_preview"),
|
_make_path("_ml", "datafeeds", datafeed_id, "_preview"),
|
||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
body=body,
|
||||||
)
|
)
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
@@ -1744,3 +1742,76 @@ class MlClient(NamespacedClient):
|
|||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@query_params(
|
||||||
|
"charset",
|
||||||
|
"column_names",
|
||||||
|
"delimiter",
|
||||||
|
"explain",
|
||||||
|
"format",
|
||||||
|
"grok_pattern",
|
||||||
|
"has_header_row",
|
||||||
|
"line_merge_size_limit",
|
||||||
|
"lines_to_sample",
|
||||||
|
"quote",
|
||||||
|
"should_trim_fields",
|
||||||
|
"timeout",
|
||||||
|
"timestamp_field",
|
||||||
|
"timestamp_format",
|
||||||
|
)
|
||||||
|
def find_file_structure(self, body, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Finds the structure of a text file. The text file must contain data that is
|
||||||
|
suitable to be ingested into Elasticsearch.
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg body: The contents of the file to be analyzed
|
||||||
|
:arg charset: Optional parameter to specify the character set of
|
||||||
|
the file
|
||||||
|
:arg column_names: Optional parameter containing a comma
|
||||||
|
separated list of the column names for a delimited file
|
||||||
|
:arg delimiter: Optional parameter to specify the delimiter
|
||||||
|
character for a delimited file - must be a single character
|
||||||
|
:arg explain: Whether to include a commentary on how the
|
||||||
|
structure was derived
|
||||||
|
:arg format: Optional parameter to specify the high level file
|
||||||
|
format Valid choices: ndjson, xml, delimited, semi_structured_text
|
||||||
|
:arg grok_pattern: Optional parameter to specify the Grok
|
||||||
|
pattern that should be used to extract fields from messages in a semi-
|
||||||
|
structured text file
|
||||||
|
:arg has_header_row: Optional parameter to specify whether a
|
||||||
|
delimited file includes the column names in its first row
|
||||||
|
:arg line_merge_size_limit: Maximum number of characters
|
||||||
|
permitted in a single message when lines are merged to create messages.
|
||||||
|
Default: 10000
|
||||||
|
:arg lines_to_sample: How many lines of the file should be
|
||||||
|
included in the analysis Default: 1000
|
||||||
|
:arg quote: Optional parameter to specify the quote character
|
||||||
|
for a delimited file - must be a single character
|
||||||
|
:arg should_trim_fields: Optional parameter to specify whether
|
||||||
|
the values between delimiters in a delimited file should have whitespace
|
||||||
|
trimmed from them
|
||||||
|
:arg timeout: Timeout after which the analysis will be aborted
|
||||||
|
Default: 25s
|
||||||
|
:arg timestamp_field: Optional parameter to specify the
|
||||||
|
timestamp field in the file
|
||||||
|
:arg timestamp_format: Optional parameter to specify the
|
||||||
|
timestamp format in the file - may be either a Joda or Java time format
|
||||||
|
"""
|
||||||
|
if body in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'body'.")
|
||||||
|
|
||||||
|
body = _bulk_body(self.transport.serializer, body)
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"POST",
|
||||||
|
"/_ml/find_file_structure",
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|||||||
@@ -557,8 +557,9 @@ class MlClient(NamespacedClient):
|
|||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
def preview_datafeed(
|
def preview_datafeed(
|
||||||
self,
|
self,
|
||||||
datafeed_id: Any,
|
|
||||||
*,
|
*,
|
||||||
|
body: Optional[Any] = ...,
|
||||||
|
datafeed_id: Optional[Any] = ...,
|
||||||
pretty: Optional[bool] = ...,
|
pretty: Optional[bool] = ...,
|
||||||
human: Optional[bool] = ...,
|
human: Optional[bool] = ...,
|
||||||
error_trace: Optional[bool] = ...,
|
error_trace: Optional[bool] = ...,
|
||||||
@@ -1134,3 +1135,31 @@ class MlClient(NamespacedClient):
|
|||||||
params: Optional[MutableMapping[str, Any]] = ...,
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
headers: Optional[MutableMapping[str, str]] = ...
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
) -> Any: ...
|
) -> Any: ...
|
||||||
|
def find_file_structure(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
body: Any,
|
||||||
|
charset: Optional[Any] = ...,
|
||||||
|
column_names: Optional[Any] = ...,
|
||||||
|
delimiter: Optional[Any] = ...,
|
||||||
|
explain: Optional[Any] = ...,
|
||||||
|
format: Optional[Any] = ...,
|
||||||
|
grok_pattern: Optional[Any] = ...,
|
||||||
|
has_header_row: Optional[Any] = ...,
|
||||||
|
line_merge_size_limit: Optional[Any] = ...,
|
||||||
|
lines_to_sample: Optional[Any] = ...,
|
||||||
|
quote: Optional[Any] = ...,
|
||||||
|
should_trim_fields: Optional[Any] = ...,
|
||||||
|
timeout: Optional[Any] = ...,
|
||||||
|
timestamp_field: Optional[Any] = ...,
|
||||||
|
timestamp_format: Optional[Any] = ...,
|
||||||
|
pretty: Optional[bool] = ...,
|
||||||
|
human: Optional[bool] = ...,
|
||||||
|
error_trace: Optional[bool] = ...,
|
||||||
|
filter_path: Optional[Union[str, Collection[str]]] = ...,
|
||||||
|
request_timeout: Optional[Union[int, float]] = ...,
|
||||||
|
ignore: Optional[Union[int, Collection[int]]] = ...,
|
||||||
|
opaque_id: Optional[str] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
# 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 .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
||||||
|
|
||||||
|
|
||||||
|
class ShutdownClient(NamespacedClient):
|
||||||
|
@query_params()
|
||||||
|
def delete_node(self, node_id, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Removes a node from the shutdown list
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg node_id: The node id of node to be removed from the
|
||||||
|
shutdown state
|
||||||
|
"""
|
||||||
|
if node_id in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument 'node_id'.")
|
||||||
|
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"DELETE",
|
||||||
|
_make_path("_nodes", node_id, "shutdown"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
def get_node(self, node_id=None, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Retrieve status of a node or nodes that are currently marked as shutting down
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg node_id: Which node for which to retrieve the shutdown
|
||||||
|
status
|
||||||
|
"""
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"GET",
|
||||||
|
_make_path("_nodes", node_id, "shutdown"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
def put_node(self, node_id, body, params=None, headers=None):
|
||||||
|
"""
|
||||||
|
Adds a node to be shut down
|
||||||
|
|
||||||
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/current>`_
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This API is **experimental** so may include breaking changes
|
||||||
|
or be removed in a future version
|
||||||
|
|
||||||
|
:arg node_id: The node id of node to be shut down
|
||||||
|
:arg body: The shutdown type definition to register
|
||||||
|
"""
|
||||||
|
for param in (node_id, body):
|
||||||
|
if param in SKIP_IN_PATH:
|
||||||
|
raise ValueError("Empty value passed for a required argument.")
|
||||||
|
|
||||||
|
return self.transport.perform_request(
|
||||||
|
"PUT",
|
||||||
|
_make_path("_nodes", node_id, "shutdown"),
|
||||||
|
params=params,
|
||||||
|
headers=headers,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# 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, Union
|
||||||
|
|
||||||
|
from .utils import NamespacedClient
|
||||||
|
|
||||||
|
class ShutdownClient(NamespacedClient):
|
||||||
|
def delete_node(
|
||||||
|
self,
|
||||||
|
node_id: 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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
def get_node(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
node_id: 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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
|
def put_node(
|
||||||
|
self,
|
||||||
|
node_id: Any,
|
||||||
|
*,
|
||||||
|
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] = ...,
|
||||||
|
params: Optional[MutableMapping[str, Any]] = ...,
|
||||||
|
headers: Optional[MutableMapping[str, str]] = ...
|
||||||
|
) -> Any: ...
|
||||||
@@ -42,11 +42,6 @@ class TextStructureClient(NamespacedClient):
|
|||||||
|
|
||||||
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html>`_
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html>`_
|
||||||
|
|
||||||
.. warning::
|
|
||||||
|
|
||||||
This API is **experimental** so may include breaking changes
|
|
||||||
or be removed in a future version
|
|
||||||
|
|
||||||
:arg body: The contents of the file to be analyzed
|
:arg body: The contents of the file to be analyzed
|
||||||
:arg charset: Optional parameter to specify the character set of
|
:arg charset: Optional parameter to specify the character set of
|
||||||
the file
|
the file
|
||||||
|
|||||||
+43
-24
@@ -16,9 +16,15 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import contextlib
|
||||||
|
import io
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import zipfile
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -38,27 +44,6 @@ SUBSTITUTIONS = {"type": "doc_type", "from": "from_"}
|
|||||||
# api path(s)
|
# api path(s)
|
||||||
BRANCH_NAME = "7.x"
|
BRANCH_NAME = "7.x"
|
||||||
CODE_ROOT = Path(__file__).absolute().parent.parent
|
CODE_ROOT = Path(__file__).absolute().parent.parent
|
||||||
BASE_PATH = (
|
|
||||||
CODE_ROOT.parent
|
|
||||||
/ "elasticsearch"
|
|
||||||
/ "rest-api-spec"
|
|
||||||
/ "src"
|
|
||||||
/ "main"
|
|
||||||
/ "resources"
|
|
||||||
/ "rest-api-spec"
|
|
||||||
/ "api"
|
|
||||||
)
|
|
||||||
XPACK_PATH = (
|
|
||||||
CODE_ROOT.parent
|
|
||||||
/ "elasticsearch"
|
|
||||||
/ "x-pack"
|
|
||||||
/ "plugin"
|
|
||||||
/ "src"
|
|
||||||
/ "test"
|
|
||||||
/ "resources"
|
|
||||||
/ "rest-api-spec"
|
|
||||||
/ "api"
|
|
||||||
)
|
|
||||||
GLOBAL_QUERY_PARAMS = {
|
GLOBAL_QUERY_PARAMS = {
|
||||||
"pretty": "Optional[bool]",
|
"pretty": "Optional[bool]",
|
||||||
"human": "Optional[bool]",
|
"human": "Optional[bool]",
|
||||||
@@ -335,10 +320,43 @@ class API:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def read_modules():
|
@contextlib.contextmanager
|
||||||
|
def download_artifact(version):
|
||||||
|
# Download the list of all artifacts for a version
|
||||||
|
# and find the latest build URL for 'rest-api-spec-X.jar'
|
||||||
|
resp = http.request(
|
||||||
|
"GET", f"https://artifacts-api.elastic.co/v1/versions/{version}"
|
||||||
|
)
|
||||||
|
packages = json.loads(resp.data)["version"]["builds"][0]["projects"][
|
||||||
|
"elasticsearch"
|
||||||
|
]["packages"]
|
||||||
|
for package in packages:
|
||||||
|
if re.match(r"^rest-api-spec-.*-sources\.jar$", package):
|
||||||
|
zip_url = packages[package]["url"]
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise ValueError("Could not find 'rest-api-spec'")
|
||||||
|
|
||||||
|
# Download the .jar file and unzip only the API
|
||||||
|
# .json files into a temporary directory
|
||||||
|
resp = http.request("GET", zip_url)
|
||||||
|
|
||||||
|
tmp = Path(tempfile.mkdtemp())
|
||||||
|
zip = zipfile.ZipFile(io.BytesIO(resp.data))
|
||||||
|
for name in zip.namelist():
|
||||||
|
if not name.endswith(".json") or name == "schema.json":
|
||||||
|
continue
|
||||||
|
with (tmp / name.replace("rest-api-spec/api/", "")).open("wb") as f:
|
||||||
|
f.write(zip.read(name))
|
||||||
|
|
||||||
|
yield tmp
|
||||||
|
shutil.rmtree(tmp)
|
||||||
|
|
||||||
|
|
||||||
|
def read_modules(version):
|
||||||
modules = {}
|
modules = {}
|
||||||
|
|
||||||
for path in (BASE_PATH, XPACK_PATH):
|
with download_artifact(version) as path:
|
||||||
for f in sorted(os.listdir(path)):
|
for f in sorted(os.listdir(path)):
|
||||||
name, ext = f.rsplit(".", 1)
|
name, ext = f.rsplit(".", 1)
|
||||||
|
|
||||||
@@ -403,4 +421,5 @@ def dump_modules(modules):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dump_modules(read_modules())
|
version = sys.argv[1]
|
||||||
|
dump_modules(read_modules(version))
|
||||||
|
|||||||
Reference in New Issue
Block a user