Skip to content

Commit e529585

Browse files
Auto-generated API code (elastic#2409)
1 parent 997d8a8 commit e529585

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

elasticsearch/_async/client/security.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ async def enroll_node(
935935
async def get_api_key(
936936
self,
937937
*,
938+
active_only: t.Optional[bool] = None,
938939
error_trace: t.Optional[bool] = None,
939940
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
940941
human: t.Optional[bool] = None,
@@ -951,6 +952,11 @@ async def get_api_key(
951952
952953
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-api-key.html>`_
953954
955+
:param active_only: A boolean flag that can be used to query API keys that are
956+
currently active. An API key is considered active if it is neither invalidated,
957+
nor expired at query time. You can specify this together with other parameters
958+
such as `owner` or `name`. If `active_only` is false, the response will include
959+
both active and inactive (expired or invalidated) keys.
954960
:param id: An API key id. This parameter cannot be used with any of `name`, `realm_name`
955961
or `username`.
956962
:param name: An API key name. This parameter cannot be used with any of `id`,
@@ -969,6 +975,8 @@ async def get_api_key(
969975
"""
970976
__path = "/_security/api_key"
971977
__query: t.Dict[str, t.Any] = {}
978+
if active_only is not None:
979+
__query["active_only"] = active_only
972980
if error_trace is not None:
973981
__query["error_trace"] = error_trace
974982
if filter_path is not None:
@@ -1875,7 +1883,14 @@ async def put_role(
18751883
)
18761884

18771885
@_rewrite_parameters(
1878-
body_fields=("enabled", "metadata", "roles", "rules", "run_as"),
1886+
body_fields=(
1887+
"enabled",
1888+
"metadata",
1889+
"role_templates",
1890+
"roles",
1891+
"rules",
1892+
"run_as",
1893+
),
18791894
)
18801895
async def put_role_mapping(
18811896
self,
@@ -1890,6 +1905,7 @@ async def put_role_mapping(
18901905
refresh: t.Optional[
18911906
t.Union["t.Literal['false', 'true', 'wait_for']", bool, str]
18921907
] = None,
1908+
role_templates: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
18931909
roles: t.Optional[t.Sequence[str]] = None,
18941910
rules: t.Optional[t.Mapping[str, t.Any]] = None,
18951911
run_as: t.Optional[t.Sequence[str]] = None,
@@ -1906,6 +1922,7 @@ async def put_role_mapping(
19061922
:param refresh: If `true` (the default) then refresh the affected shards to make
19071923
this operation visible to search, if `wait_for` then wait for a refresh to
19081924
make this operation visible to search, if `false` then do nothing with refreshes.
1925+
:param role_templates:
19091926
:param roles:
19101927
:param rules:
19111928
:param run_as:
@@ -1930,6 +1947,8 @@ async def put_role_mapping(
19301947
__body["enabled"] = enabled
19311948
if metadata is not None:
19321949
__body["metadata"] = metadata
1950+
if role_templates is not None:
1951+
__body["role_templates"] = role_templates
19331952
if roles is not None:
19341953
__body["roles"] = roles
19351954
if rules is not None:

elasticsearch/_sync/client/security.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ def enroll_node(
935935
def get_api_key(
936936
self,
937937
*,
938+
active_only: t.Optional[bool] = None,
938939
error_trace: t.Optional[bool] = None,
939940
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
940941
human: t.Optional[bool] = None,
@@ -951,6 +952,11 @@ def get_api_key(
951952
952953
`<https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-api-key.html>`_
953954
955+
:param active_only: A boolean flag that can be used to query API keys that are
956+
currently active. An API key is considered active if it is neither invalidated,
957+
nor expired at query time. You can specify this together with other parameters
958+
such as `owner` or `name`. If `active_only` is false, the response will include
959+
both active and inactive (expired or invalidated) keys.
954960
:param id: An API key id. This parameter cannot be used with any of `name`, `realm_name`
955961
or `username`.
956962
:param name: An API key name. This parameter cannot be used with any of `id`,
@@ -969,6 +975,8 @@ def get_api_key(
969975
"""
970976
__path = "/_security/api_key"
971977
__query: t.Dict[str, t.Any] = {}
978+
if active_only is not None:
979+
__query["active_only"] = active_only
972980
if error_trace is not None:
973981
__query["error_trace"] = error_trace
974982
if filter_path is not None:
@@ -1875,7 +1883,14 @@ def put_role(
18751883
)
18761884

18771885
@_rewrite_parameters(
1878-
body_fields=("enabled", "metadata", "roles", "rules", "run_as"),
1886+
body_fields=(
1887+
"enabled",
1888+
"metadata",
1889+
"role_templates",
1890+
"roles",
1891+
"rules",
1892+
"run_as",
1893+
),
18791894
)
18801895
def put_role_mapping(
18811896
self,
@@ -1890,6 +1905,7 @@ def put_role_mapping(
18901905
refresh: t.Optional[
18911906
t.Union["t.Literal['false', 'true', 'wait_for']", bool, str]
18921907
] = None,
1908+
role_templates: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
18931909
roles: t.Optional[t.Sequence[str]] = None,
18941910
rules: t.Optional[t.Mapping[str, t.Any]] = None,
18951911
run_as: t.Optional[t.Sequence[str]] = None,
@@ -1906,6 +1922,7 @@ def put_role_mapping(
19061922
:param refresh: If `true` (the default) then refresh the affected shards to make
19071923
this operation visible to search, if `wait_for` then wait for a refresh to
19081924
make this operation visible to search, if `false` then do nothing with refreshes.
1925+
:param role_templates:
19091926
:param roles:
19101927
:param rules:
19111928
:param run_as:
@@ -1930,6 +1947,8 @@ def put_role_mapping(
19301947
__body["enabled"] = enabled
19311948
if metadata is not None:
19321949
__body["metadata"] = metadata
1950+
if role_templates is not None:
1951+
__body["role_templates"] = role_templates
19331952
if roles is not None:
19341953
__body["roles"] = roles
19351954
if rules is not None:

0 commit comments

Comments
 (0)