Skip to content

Auto-generated code for 8.15 #2612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions elasticsearch/_async/client/query_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,20 +250,23 @@ async def list_rulesets(
)

@_rewrite_parameters(
body_fields=("actions", "criteria", "type"),
body_fields=("actions", "criteria", "type", "priority"),
)
async def put_rule(
self,
*,
ruleset_id: str,
rule_id: str,
actions: t.Optional[t.Mapping[str, t.Any]] = None,
criteria: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
criteria: t.Optional[
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
] = None,
type: t.Optional[t.Union["t.Literal['pinned']", str]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
priority: t.Optional[int] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Expand All @@ -278,6 +281,7 @@ async def put_rule(
:param actions:
:param criteria:
:param type:
:param priority:
"""
if ruleset_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'ruleset_id'")
Expand Down Expand Up @@ -311,6 +315,8 @@ async def put_rule(
__body["criteria"] = criteria
if type is not None:
__body["type"] = type
if priority is not None:
__body["priority"] = priority
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"PUT",
Expand All @@ -329,7 +335,9 @@ async def put_ruleset(
self,
*,
ruleset_id: str,
rules: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
rules: t.Optional[
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
Expand Down
296 changes: 296 additions & 0 deletions elasticsearch/_async/client/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,122 @@ async def authenticate(
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("names",),
)
async def bulk_delete_role(
self,
*,
names: t.Optional[t.Sequence[str]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
refresh: t.Optional[
t.Union["t.Literal['false', 'true', 'wait_for']", bool, str]
] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
The role management APIs are generally the preferred way to manage roles, rather
than using file-based role management. The bulk delete roles API cannot delete
roles that are defined in roles files.

`<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-bulk-delete-role.html>`_

:param names: An array of role names to delete
:param refresh: If `true` (the default) then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh to
make this operation visible to search, if `false` then do nothing with refreshes.
"""
if names is None and body is None:
raise ValueError("Empty value passed for parameter 'names'")
__path_parts: t.Dict[str, str] = {}
__path = "/_security/role"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if refresh is not None:
__query["refresh"] = refresh
if not __body:
if names is not None:
__body["names"] = names
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"DELETE",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="security.bulk_delete_role",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("roles",),
)
async def bulk_put_role(
self,
*,
roles: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
refresh: t.Optional[
t.Union["t.Literal['false', 'true', 'wait_for']", bool, str]
] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
The role management APIs are generally the preferred way to manage roles, rather
than using file-based role management. The bulk create or update roles API cannot
update roles that are defined in roles files.

`<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-bulk-put-role.html>`_

:param roles: A dictionary of role name to RoleDescriptor objects to add or update
:param refresh: If `true` (the default) then refresh the affected shards to make
this operation visible to search, if `wait_for` then wait for a refresh to
make this operation visible to search, if `false` then do nothing with refreshes.
"""
if roles is None and body is None:
raise ValueError("Empty value passed for parameter 'roles'")
__path_parts: t.Dict[str, str] = {}
__path = "/_security/role"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if refresh is not None:
__query["refresh"] = refresh
if not __body:
if roles is not None:
__body["roles"] = roles
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="security.bulk_put_role",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("password", "password_hash"),
)
Expand Down Expand Up @@ -2102,6 +2218,7 @@ async def put_privileges(
body_fields=(
"applications",
"cluster",
"description",
"global_",
"indices",
"metadata",
Expand All @@ -2123,6 +2240,7 @@ async def put_role(
]
]
] = None,
description: t.Optional[str] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
global_: t.Optional[t.Mapping[str, t.Any]] = None,
Expand All @@ -2148,6 +2266,7 @@ async def put_role(
:param applications: A list of application privilege entries.
:param cluster: A list of cluster privileges. These privileges define the cluster-level
actions for users with this role.
:param description: Optional description of the role descriptor
:param global_: An object defining global privileges. A global privilege is a
form of cluster privilege that is request-aware. Support for global privileges
is currently limited to the management of application privileges.
Expand Down Expand Up @@ -2189,6 +2308,8 @@ async def put_role(
__body["applications"] = applications
if cluster is not None:
__body["cluster"] = cluster
if description is not None:
__body["description"] = description
if global_ is not None:
__body["global"] = global_
if indices is not None:
Expand Down Expand Up @@ -2526,6 +2647,181 @@ async def query_api_keys(
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("from_", "query", "search_after", "size", "sort"),
parameter_aliases={"from": "from_"},
)
async def query_role(
self,
*,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
from_: t.Optional[int] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[t.Mapping[str, t.Any]] = None,
search_after: t.Optional[
t.Sequence[t.Union[None, bool, float, int, str, t.Any]]
] = None,
size: t.Optional[int] = None,
sort: t.Optional[
t.Union[
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
t.Union[str, t.Mapping[str, t.Any]],
]
] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Retrieves roles in a paginated manner. You can optionally filter the results
with a query.

`<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-query-role.html>`_

:param from_: Starting document offset. By default, you cannot page through more
than 10,000 hits using the from and size parameters. To page through more
hits, use the `search_after` parameter.
:param query: A query to filter which roles to return. If the query parameter
is missing, it is equivalent to a `match_all` query. The query supports a
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
You can query the following information associated with roles: `name`, `description`,
`metadata`, `applications.application`, `applications.privileges`, `applications.resources`.
:param search_after: Search after definition
:param size: The number of hits to return. By default, you cannot page through
more than 10,000 hits using the `from` and `size` parameters. To page through
more hits, use the `search_after` parameter.
:param sort: All public fields of a role are eligible for sorting. In addition,
sort can also be applied to the `_doc` field to sort by index order.
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_security/_query/role"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if not __body:
if from_ is not None:
__body["from"] = from_
if query is not None:
__body["query"] = query
if search_after is not None:
__body["search_after"] = search_after
if size is not None:
__body["size"] = size
if sort is not None:
__body["sort"] = sort
if not __body:
__body = None # type: ignore[assignment]
__headers = {"accept": "application/json"}
if __body is not None:
__headers["content-type"] = "application/json"
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="security.query_role",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("from_", "query", "search_after", "size", "sort"),
parameter_aliases={"from": "from_"},
)
async def query_user(
self,
*,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
from_: t.Optional[int] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[t.Mapping[str, t.Any]] = None,
search_after: t.Optional[
t.Sequence[t.Union[None, bool, float, int, str, t.Any]]
] = None,
size: t.Optional[int] = None,
sort: t.Optional[
t.Union[
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
t.Union[str, t.Mapping[str, t.Any]],
]
] = None,
with_profile_uid: t.Optional[bool] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
Retrieves information for Users in a paginated manner. You can optionally filter
the results with a query.

`<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/security-api-query-user.html>`_

:param from_: Starting document offset. By default, you cannot page through more
than 10,000 hits using the from and size parameters. To page through more
hits, use the `search_after` parameter.
:param query: A query to filter which users to return. If the query parameter
is missing, it is equivalent to a `match_all` query. The query supports a
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
You can query the following information associated with user: `username`,
`roles`, `enabled`
:param search_after: Search after definition
:param size: The number of hits to return. By default, you cannot page through
more than 10,000 hits using the `from` and `size` parameters. To page through
more hits, use the `search_after` parameter.
:param sort: Fields eligible for sorting are: username, roles, enabled In addition,
sort can also be applied to the `_doc` field to sort by index order.
:param with_profile_uid: If true will return the User Profile ID for the users
in the query result, if any.
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_security/_query/user"
__query: t.Dict[str, t.Any] = {}
__body: t.Dict[str, t.Any] = body if body is not None else {}
if error_trace is not None:
__query["error_trace"] = error_trace
if filter_path is not None:
__query["filter_path"] = filter_path
if human is not None:
__query["human"] = human
if pretty is not None:
__query["pretty"] = pretty
if with_profile_uid is not None:
__query["with_profile_uid"] = with_profile_uid
if not __body:
if from_ is not None:
__body["from"] = from_
if query is not None:
__body["query"] = query
if search_after is not None:
__body["search_after"] = search_after
if size is not None:
__body["size"] = size
if sort is not None:
__body["sort"] = sort
if not __body:
__body = None # type: ignore[assignment]
__headers = {"accept": "application/json"}
if __body is not None:
__headers["content-type"] = "application/json"
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="security.query_user",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("content", "ids", "realm"),
)
Expand Down
Loading
Loading