Skip to content

Commit b6d17f8

Browse files
authored
update API to 8.3
1 parent 9632533 commit b6d17f8

File tree

2 files changed

+124
-12
lines changed

2 files changed

+124
-12
lines changed

elasticsearch/_async/client/security.py

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,13 +1516,13 @@ async def has_privileges(
15161516
t.Union[
15171517
t.List[
15181518
t.Union[
1519-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1519+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
15201520
str,
15211521
]
15221522
],
15231523
t.Tuple[
15241524
t.Union[
1525-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1525+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
15261526
str,
15271527
],
15281528
...,
@@ -1574,6 +1574,55 @@ async def has_privileges(
15741574
"POST", __path, params=__query, headers=__headers, body=__body
15751575
)
15761576

1577+
@_rewrite_parameters(
1578+
body_fields=True,
1579+
)
1580+
async def has_privileges_user_profile(
1581+
self,
1582+
*,
1583+
privileges: t.Mapping[str, t.Any],
1584+
uids: t.Union[t.List[str], t.Tuple[str, ...]],
1585+
error_trace: t.Optional[bool] = None,
1586+
filter_path: t.Optional[
1587+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
1588+
] = None,
1589+
human: t.Optional[bool] = None,
1590+
pretty: t.Optional[bool] = None,
1591+
) -> ObjectApiResponse[t.Any]:
1592+
"""
1593+
Determines whether the users associated with the specified profile IDs have all
1594+
the requested privileges.
1595+
1596+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-has-privileges-user-profile.html>`_
1597+
1598+
:param privileges:
1599+
:param uids: A list of profile IDs. The privileges are checked for associated
1600+
users of the profiles.
1601+
"""
1602+
if privileges is None:
1603+
raise ValueError("Empty value passed for parameter 'privileges'")
1604+
if uids is None:
1605+
raise ValueError("Empty value passed for parameter 'uids'")
1606+
__path = "/_security/profile/_has_privileges"
1607+
__body: t.Dict[str, t.Any] = {}
1608+
__query: t.Dict[str, t.Any] = {}
1609+
if privileges is not None:
1610+
__body["privileges"] = privileges
1611+
if uids is not None:
1612+
__body["uids"] = uids
1613+
if error_trace is not None:
1614+
__query["error_trace"] = error_trace
1615+
if filter_path is not None:
1616+
__query["filter_path"] = filter_path
1617+
if human is not None:
1618+
__query["human"] = human
1619+
if pretty is not None:
1620+
__query["pretty"] = pretty
1621+
__headers = {"accept": "application/json", "content-type": "application/json"}
1622+
return await self.perform_request( # type: ignore[return-value]
1623+
"POST", __path, params=__query, headers=__headers, body=__body
1624+
)
1625+
15771626
@_rewrite_parameters(
15781627
body_fields=True,
15791628
)
@@ -1746,13 +1795,13 @@ async def put_role(
17461795
t.Union[
17471796
t.List[
17481797
t.Union[
1749-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1798+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
17501799
str,
17511800
]
17521801
],
17531802
t.Tuple[
17541803
t.Union[
1755-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1804+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
17561805
str,
17571806
],
17581807
...,
@@ -2396,6 +2445,7 @@ async def suggest_user_profiles(
23962445
filter_path: t.Optional[
23972446
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
23982447
] = None,
2448+
hint: t.Optional[t.Mapping[str, t.Any]] = None,
23992449
human: t.Optional[bool] = None,
24002450
name: t.Optional[str] = None,
24012451
pretty: t.Optional[bool] = None,
@@ -2410,19 +2460,25 @@ async def suggest_user_profiles(
24102460
return all content use `data=*`. To return a subset of content use `data=<key>`
24112461
to retrieve content nested under the specified `<key>`. By default returns
24122462
no `data` content.
2463+
:param hint: Extra search criteria to improve relevance of the suggestion result.
2464+
Profiles matching the spcified hint are ranked higher in the response. Profiles
2465+
not matching the hint don't exclude the profile from the response as long
2466+
as the profile matches the `name` field query.
24132467
:param name: Query string used to match name-related fields in user profile documents.
24142468
Name-related fields are the user's `username`, `full_name`, and `email`.
24152469
:param size: Number of profiles to return.
24162470
"""
24172471
__path = "/_security/profile/_suggest"
2418-
__query: t.Dict[str, t.Any] = {}
24192472
__body: t.Dict[str, t.Any] = {}
2473+
__query: t.Dict[str, t.Any] = {}
24202474
if data is not None:
2421-
__query["data"] = data
2475+
__body["data"] = data
24222476
if error_trace is not None:
24232477
__query["error_trace"] = error_trace
24242478
if filter_path is not None:
24252479
__query["filter_path"] = filter_path
2480+
if hint is not None:
2481+
__body["hint"] = hint
24262482
if human is not None:
24272483
__query["human"] = human
24282484
if name is not None:

elasticsearch/_sync/client/security.py

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,13 +1516,13 @@ def has_privileges(
15161516
t.Union[
15171517
t.List[
15181518
t.Union[
1519-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1519+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
15201520
str,
15211521
]
15221522
],
15231523
t.Tuple[
15241524
t.Union[
1525-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1525+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
15261526
str,
15271527
],
15281528
...,
@@ -1574,6 +1574,55 @@ def has_privileges(
15741574
"POST", __path, params=__query, headers=__headers, body=__body
15751575
)
15761576

1577+
@_rewrite_parameters(
1578+
body_fields=True,
1579+
)
1580+
def has_privileges_user_profile(
1581+
self,
1582+
*,
1583+
privileges: t.Mapping[str, t.Any],
1584+
uids: t.Union[t.List[str], t.Tuple[str, ...]],
1585+
error_trace: t.Optional[bool] = None,
1586+
filter_path: t.Optional[
1587+
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
1588+
] = None,
1589+
human: t.Optional[bool] = None,
1590+
pretty: t.Optional[bool] = None,
1591+
) -> ObjectApiResponse[t.Any]:
1592+
"""
1593+
Determines whether the users associated with the specified profile IDs have all
1594+
the requested privileges.
1595+
1596+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.3/security-api-has-privileges-user-profile.html>`_
1597+
1598+
:param privileges:
1599+
:param uids: A list of profile IDs. The privileges are checked for associated
1600+
users of the profiles.
1601+
"""
1602+
if privileges is None:
1603+
raise ValueError("Empty value passed for parameter 'privileges'")
1604+
if uids is None:
1605+
raise ValueError("Empty value passed for parameter 'uids'")
1606+
__path = "/_security/profile/_has_privileges"
1607+
__body: t.Dict[str, t.Any] = {}
1608+
__query: t.Dict[str, t.Any] = {}
1609+
if privileges is not None:
1610+
__body["privileges"] = privileges
1611+
if uids is not None:
1612+
__body["uids"] = uids
1613+
if error_trace is not None:
1614+
__query["error_trace"] = error_trace
1615+
if filter_path is not None:
1616+
__query["filter_path"] = filter_path
1617+
if human is not None:
1618+
__query["human"] = human
1619+
if pretty is not None:
1620+
__query["pretty"] = pretty
1621+
__headers = {"accept": "application/json", "content-type": "application/json"}
1622+
return self.perform_request( # type: ignore[return-value]
1623+
"POST", __path, params=__query, headers=__headers, body=__body
1624+
)
1625+
15771626
@_rewrite_parameters(
15781627
body_fields=True,
15791628
)
@@ -1746,13 +1795,13 @@ def put_role(
17461795
t.Union[
17471796
t.List[
17481797
t.Union[
1749-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1798+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
17501799
str,
17511800
]
17521801
],
17531802
t.Tuple[
17541803
t.Union[
1755-
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
1804+
"t.Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client']",
17561805
str,
17571806
],
17581807
...,
@@ -2396,6 +2445,7 @@ def suggest_user_profiles(
23962445
filter_path: t.Optional[
23972446
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
23982447
] = None,
2448+
hint: t.Optional[t.Mapping[str, t.Any]] = None,
23992449
human: t.Optional[bool] = None,
24002450
name: t.Optional[str] = None,
24012451
pretty: t.Optional[bool] = None,
@@ -2410,19 +2460,25 @@ def suggest_user_profiles(
24102460
return all content use `data=*`. To return a subset of content use `data=<key>`
24112461
to retrieve content nested under the specified `<key>`. By default returns
24122462
no `data` content.
2463+
:param hint: Extra search criteria to improve relevance of the suggestion result.
2464+
Profiles matching the spcified hint are ranked higher in the response. Profiles
2465+
not matching the hint don't exclude the profile from the response as long
2466+
as the profile matches the `name` field query.
24132467
:param name: Query string used to match name-related fields in user profile documents.
24142468
Name-related fields are the user's `username`, `full_name`, and `email`.
24152469
:param size: Number of profiles to return.
24162470
"""
24172471
__path = "/_security/profile/_suggest"
2418-
__query: t.Dict[str, t.Any] = {}
24192472
__body: t.Dict[str, t.Any] = {}
2473+
__query: t.Dict[str, t.Any] = {}
24202474
if data is not None:
2421-
__query["data"] = data
2475+
__body["data"] = data
24222476
if error_trace is not None:
24232477
__query["error_trace"] = error_trace
24242478
if filter_path is not None:
24252479
__query["filter_path"] = filter_path
2480+
if hint is not None:
2481+
__body["hint"] = hint
24262482
if human is not None:
24272483
__query["human"] = human
24282484
if name is not None:

0 commit comments

Comments
 (0)