Skip to content

Commit 7a501d7

Browse files
authored
Update APIs on master
1 parent a1fdc8d commit 7a501d7

File tree

8 files changed

+164
-8
lines changed

8 files changed

+164
-8
lines changed

elasticsearch/_async/client/indices.py

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,8 @@ async def delete_data_stream(self, name, params=None, headers=None):
12411241
Deletes a data stream.
12421242
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html>`_
12431243
1244-
:arg name: The name of the data stream
1244+
:arg name: A comma-separated list of data streams to delete; use
1245+
`*` to delete all data streams
12451246
"""
12461247
if name in SKIP_IN_PATH:
12471248
raise ValueError("Empty value passed for a required argument 'name'.")
@@ -1370,8 +1371,8 @@ async def get_data_stream(self, name=None, params=None, headers=None):
13701371
Returns data streams.
13711372
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html>`_
13721373
1373-
:arg name: The name or wildcard expression of the requested data
1374-
streams
1374+
:arg name: A comma-separated list of data streams to get; use
1375+
`*` to get all data streams
13751376
"""
13761377
return await self.transport.perform_request(
13771378
"GET", _make_path("_data_stream", name), params=params, headers=headers
@@ -1419,3 +1420,37 @@ async def resolve_index(self, name, params=None, headers=None):
14191420
return await self.transport.perform_request(
14201421
"GET", _make_path("_resolve", "index", name), params=params, headers=headers
14211422
)
1423+
1424+
@query_params(
1425+
"allow_no_indices",
1426+
"expand_wildcards",
1427+
"ignore_unavailable",
1428+
"master_timeout",
1429+
"timeout",
1430+
)
1431+
async def add_block(self, index, block, params=None, headers=None):
1432+
"""
1433+
Adds a block to an index.
1434+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-blocks.html>`_
1435+
1436+
:arg index: A comma separated list of indices to add a block to
1437+
:arg block: The block to add (one of read, write, read_only or
1438+
metadata)
1439+
:arg allow_no_indices: Whether to ignore if a wildcard indices
1440+
expression resolves into no concrete indices. (This includes `_all`
1441+
string or when no indices have been specified)
1442+
:arg expand_wildcards: Whether to expand wildcard expression to
1443+
concrete indices that are open, closed or both. Valid choices: open,
1444+
closed, hidden, none, all Default: open
1445+
:arg ignore_unavailable: Whether specified concrete indices
1446+
should be ignored when unavailable (missing or closed)
1447+
:arg master_timeout: Specify timeout for connection to master
1448+
:arg timeout: Explicit operation timeout
1449+
"""
1450+
for param in (index, block):
1451+
if param in SKIP_IN_PATH:
1452+
raise ValueError("Empty value passed for a required argument.")
1453+
1454+
return await self.transport.perform_request(
1455+
"PUT", _make_path(index, "_block", block), params=params, headers=headers
1456+
)

elasticsearch/_async/client/ml.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,3 +1529,24 @@ async def update_model_snapshot(
15291529
headers=headers,
15301530
body=body,
15311531
)
1532+
1533+
@query_params()
1534+
async def update_data_frame_analytics(self, id, body, params=None, headers=None):
1535+
"""
1536+
Updates certain properties of a data frame analytics job.
1537+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-dfanalytics.html>`_
1538+
1539+
:arg id: The ID of the data frame analytics to update
1540+
:arg body: The data frame analytics settings to update
1541+
"""
1542+
for param in (id, body):
1543+
if param in SKIP_IN_PATH:
1544+
raise ValueError("Empty value passed for a required argument.")
1545+
1546+
return await self.transport.perform_request(
1547+
"POST",
1548+
_make_path("_ml", "data_frame", "analytics", id, "_update"),
1549+
params=params,
1550+
headers=headers,
1551+
body=body,
1552+
)

elasticsearch/_async/client/security.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,23 @@ async def get_builtin_privileges(self, params=None, headers=None):
510510
return await self.transport.perform_request(
511511
"GET", "/_security/privilege/_builtin", params=params, headers=headers
512512
)
513+
514+
@query_params()
515+
async def clear_cached_privileges(self, application, params=None, headers=None):
516+
"""
517+
Evicts application privileges from the native application privileges cache.
518+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-privilege-cache.html>`_
519+
520+
:arg application: A comma-separated list of application names
521+
"""
522+
if application in SKIP_IN_PATH:
523+
raise ValueError(
524+
"Empty value passed for a required argument 'application'."
525+
)
526+
527+
return await self.transport.perform_request(
528+
"POST",
529+
_make_path("_security", "privilege", application, "_clear_cache"),
530+
params=params,
531+
headers=headers,
532+
)

elasticsearch/_async/client/xpack.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ def __getattr__(self, attr_name):
2323
return getattr(self.client, attr_name)
2424

2525
# AUTO-GENERATED-API-DEFINITIONS #
26-
@query_params("categories")
26+
@query_params("accept_enterprise", "categories")
2727
async def info(self, params=None, headers=None):
2828
"""
2929
Retrieves information about the installed X-Pack features.
3030
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/info-api.html>`_
3131
32+
:arg accept_enterprise: Supported for backwards compatibility
33+
with 7.x. If this param is used it must be set to true
3234
:arg categories: Comma-separated list of info categories. Can be
3335
any of: build, license, features
3436
"""

elasticsearch/client/indices.py

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,8 @@ def delete_data_stream(self, name, params=None, headers=None):
12391239
Deletes a data stream.
12401240
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html>`_
12411241
1242-
:arg name: The name of the data stream
1242+
:arg name: A comma-separated list of data streams to delete; use
1243+
`*` to delete all data streams
12431244
"""
12441245
if name in SKIP_IN_PATH:
12451246
raise ValueError("Empty value passed for a required argument 'name'.")
@@ -1368,8 +1369,8 @@ def get_data_stream(self, name=None, params=None, headers=None):
13681369
Returns data streams.
13691370
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/data-streams.html>`_
13701371
1371-
:arg name: The name or wildcard expression of the requested data
1372-
streams
1372+
:arg name: A comma-separated list of data streams to get; use
1373+
`*` to get all data streams
13731374
"""
13741375
return self.transport.perform_request(
13751376
"GET", _make_path("_data_stream", name), params=params, headers=headers
@@ -1417,3 +1418,37 @@ def resolve_index(self, name, params=None, headers=None):
14171418
return self.transport.perform_request(
14181419
"GET", _make_path("_resolve", "index", name), params=params, headers=headers
14191420
)
1421+
1422+
@query_params(
1423+
"allow_no_indices",
1424+
"expand_wildcards",
1425+
"ignore_unavailable",
1426+
"master_timeout",
1427+
"timeout",
1428+
)
1429+
def add_block(self, index, block, params=None, headers=None):
1430+
"""
1431+
Adds a block to an index.
1432+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-blocks.html>`_
1433+
1434+
:arg index: A comma separated list of indices to add a block to
1435+
:arg block: The block to add (one of read, write, read_only or
1436+
metadata)
1437+
:arg allow_no_indices: Whether to ignore if a wildcard indices
1438+
expression resolves into no concrete indices. (This includes `_all`
1439+
string or when no indices have been specified)
1440+
:arg expand_wildcards: Whether to expand wildcard expression to
1441+
concrete indices that are open, closed or both. Valid choices: open,
1442+
closed, hidden, none, all Default: open
1443+
:arg ignore_unavailable: Whether specified concrete indices
1444+
should be ignored when unavailable (missing or closed)
1445+
:arg master_timeout: Specify timeout for connection to master
1446+
:arg timeout: Explicit operation timeout
1447+
"""
1448+
for param in (index, block):
1449+
if param in SKIP_IN_PATH:
1450+
raise ValueError("Empty value passed for a required argument.")
1451+
1452+
return self.transport.perform_request(
1453+
"PUT", _make_path(index, "_block", block), params=params, headers=headers
1454+
)

elasticsearch/client/ml.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,3 +1515,24 @@ def update_model_snapshot(
15151515
headers=headers,
15161516
body=body,
15171517
)
1518+
1519+
@query_params()
1520+
def update_data_frame_analytics(self, id, body, params=None, headers=None):
1521+
"""
1522+
Updates certain properties of a data frame analytics job.
1523+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/update-dfanalytics.html>`_
1524+
1525+
:arg id: The ID of the data frame analytics to update
1526+
:arg body: The data frame analytics settings to update
1527+
"""
1528+
for param in (id, body):
1529+
if param in SKIP_IN_PATH:
1530+
raise ValueError("Empty value passed for a required argument.")
1531+
1532+
return self.transport.perform_request(
1533+
"POST",
1534+
_make_path("_ml", "data_frame", "analytics", id, "_update"),
1535+
params=params,
1536+
headers=headers,
1537+
body=body,
1538+
)

elasticsearch/client/security.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,3 +508,23 @@ def get_builtin_privileges(self, params=None, headers=None):
508508
return self.transport.perform_request(
509509
"GET", "/_security/privilege/_builtin", params=params, headers=headers
510510
)
511+
512+
@query_params()
513+
def clear_cached_privileges(self, application, params=None, headers=None):
514+
"""
515+
Evicts application privileges from the native application privileges cache.
516+
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-clear-privilege-cache.html>`_
517+
518+
:arg application: A comma-separated list of application names
519+
"""
520+
if application in SKIP_IN_PATH:
521+
raise ValueError(
522+
"Empty value passed for a required argument 'application'."
523+
)
524+
525+
return self.transport.perform_request(
526+
"POST",
527+
_make_path("_security", "privilege", application, "_clear_cache"),
528+
params=params,
529+
headers=headers,
530+
)

elasticsearch/client/xpack.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ def __getattr__(self, attr_name):
2323
return getattr(self.client, attr_name)
2424

2525
# AUTO-GENERATED-API-DEFINITIONS #
26-
@query_params("categories")
26+
@query_params("accept_enterprise", "categories")
2727
def info(self, params=None, headers=None):
2828
"""
2929
Retrieves information about the installed X-Pack features.
3030
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/info-api.html>`_
3131
32+
:arg accept_enterprise: Supported for backwards compatibility
33+
with 7.x. If this param is used it must be set to true
3234
:arg categories: Comma-separated list of info categories. Can be
3335
any of: build, license, features
3436
"""

0 commit comments

Comments
 (0)