elasticsearch 8.17.0__py3-none-any.whl → 8.17.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch/__init__.py +2 -2
- elasticsearch/_async/client/__init__.py +2034 -740
- elasticsearch/_async/client/async_search.py +33 -22
- elasticsearch/_async/client/autoscaling.py +27 -21
- elasticsearch/_async/client/cat.py +280 -336
- elasticsearch/_async/client/ccr.py +96 -70
- elasticsearch/_async/client/cluster.py +152 -144
- elasticsearch/_async/client/connector.py +488 -55
- elasticsearch/_async/client/dangling_indices.py +22 -16
- elasticsearch/_async/client/enrich.py +25 -6
- elasticsearch/_async/client/eql.py +22 -9
- elasticsearch/_async/client/esql.py +295 -3
- elasticsearch/_async/client/features.py +25 -25
- elasticsearch/_async/client/fleet.py +15 -9
- elasticsearch/_async/client/graph.py +9 -8
- elasticsearch/_async/client/ilm.py +91 -61
- elasticsearch/_async/client/indices.py +746 -324
- elasticsearch/_async/client/inference.py +101 -4
- elasticsearch/_async/client/ingest.py +231 -19
- elasticsearch/_async/client/license.py +48 -31
- elasticsearch/_async/client/logstash.py +20 -6
- elasticsearch/_async/client/migration.py +25 -7
- elasticsearch/_async/client/ml.py +532 -278
- elasticsearch/_async/client/monitoring.py +5 -1
- elasticsearch/_async/client/nodes.py +46 -30
- elasticsearch/_async/client/query_rules.py +65 -18
- elasticsearch/_async/client/rollup.py +126 -13
- elasticsearch/_async/client/search_application.py +170 -13
- elasticsearch/_async/client/searchable_snapshots.py +45 -23
- elasticsearch/_async/client/security.py +1299 -340
- elasticsearch/_async/client/shutdown.py +43 -15
- elasticsearch/_async/client/simulate.py +145 -0
- elasticsearch/_async/client/slm.py +163 -19
- elasticsearch/_async/client/snapshot.py +288 -23
- elasticsearch/_async/client/sql.py +94 -53
- elasticsearch/_async/client/ssl.py +16 -17
- elasticsearch/_async/client/synonyms.py +67 -26
- elasticsearch/_async/client/tasks.py +103 -28
- elasticsearch/_async/client/text_structure.py +475 -46
- elasticsearch/_async/client/transform.py +108 -72
- elasticsearch/_async/client/watcher.py +245 -43
- elasticsearch/_async/client/xpack.py +20 -6
- elasticsearch/_async/helpers.py +1 -1
- elasticsearch/_sync/client/__init__.py +2034 -740
- elasticsearch/_sync/client/async_search.py +33 -22
- elasticsearch/_sync/client/autoscaling.py +27 -21
- elasticsearch/_sync/client/cat.py +280 -336
- elasticsearch/_sync/client/ccr.py +96 -70
- elasticsearch/_sync/client/cluster.py +152 -144
- elasticsearch/_sync/client/connector.py +488 -55
- elasticsearch/_sync/client/dangling_indices.py +22 -16
- elasticsearch/_sync/client/enrich.py +25 -6
- elasticsearch/_sync/client/eql.py +22 -9
- elasticsearch/_sync/client/esql.py +295 -3
- elasticsearch/_sync/client/features.py +25 -25
- elasticsearch/_sync/client/fleet.py +15 -9
- elasticsearch/_sync/client/graph.py +9 -8
- elasticsearch/_sync/client/ilm.py +91 -61
- elasticsearch/_sync/client/indices.py +746 -324
- elasticsearch/_sync/client/inference.py +101 -4
- elasticsearch/_sync/client/ingest.py +231 -19
- elasticsearch/_sync/client/license.py +48 -31
- elasticsearch/_sync/client/logstash.py +20 -6
- elasticsearch/_sync/client/migration.py +25 -7
- elasticsearch/_sync/client/ml.py +532 -278
- elasticsearch/_sync/client/monitoring.py +5 -1
- elasticsearch/_sync/client/nodes.py +46 -30
- elasticsearch/_sync/client/query_rules.py +65 -18
- elasticsearch/_sync/client/rollup.py +126 -13
- elasticsearch/_sync/client/search_application.py +170 -13
- elasticsearch/_sync/client/searchable_snapshots.py +45 -23
- elasticsearch/_sync/client/security.py +1299 -340
- elasticsearch/_sync/client/shutdown.py +43 -15
- elasticsearch/_sync/client/simulate.py +145 -0
- elasticsearch/_sync/client/slm.py +163 -19
- elasticsearch/_sync/client/snapshot.py +288 -23
- elasticsearch/_sync/client/sql.py +94 -53
- elasticsearch/_sync/client/ssl.py +16 -17
- elasticsearch/_sync/client/synonyms.py +67 -26
- elasticsearch/_sync/client/tasks.py +103 -28
- elasticsearch/_sync/client/text_structure.py +475 -46
- elasticsearch/_sync/client/transform.py +108 -72
- elasticsearch/_sync/client/utils.py +1 -1
- elasticsearch/_sync/client/watcher.py +245 -43
- elasticsearch/_sync/client/xpack.py +20 -6
- elasticsearch/_version.py +1 -1
- elasticsearch/client.py +4 -0
- elasticsearch/helpers/actions.py +1 -1
- elasticsearch/helpers/vectorstore/_sync/vectorstore.py +4 -1
- {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.2.dist-info}/METADATA +1 -1
- elasticsearch-8.17.2.dist-info/RECORD +119 -0
- elasticsearch-8.17.0.dist-info/RECORD +0 -117
- {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.2.dist-info}/WHEEL +0 -0
- {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.2.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-8.17.0.dist-info → elasticsearch-8.17.2.dist-info}/licenses/NOTICE +0 -0
|
@@ -44,15 +44,32 @@ class SecurityClient(NamespacedClient):
|
|
|
44
44
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
45
45
|
) -> ObjectApiResponse[t.Any]:
|
|
46
46
|
"""
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
.. raw:: html
|
|
48
|
+
|
|
49
|
+
<p>Activate a user profile.</p>
|
|
50
|
+
<p>Create or update a user profile on behalf of another user.</p>
|
|
51
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
|
|
52
|
+
Individual users and external applications should not call this API directly.
|
|
53
|
+
The calling application must have either an <code>access_token</code> or a combination of <code>username</code> and <code>password</code> for the user that the profile document is intended for.
|
|
54
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
55
|
+
<p>This API creates or updates a profile document for end users with information that is extracted from the user's authentication object including <code>username</code>, <code>full_name,</code> <code>roles</code>, and the authentication realm.
|
|
56
|
+
For example, in the JWT <code>access_token</code> case, the profile user's <code>username</code> is extracted from the JWT token claim pointed to by the <code>claims.principal</code> setting of the JWT realm that authenticated the token.</p>
|
|
57
|
+
<p>When updating a profile document, the API enables the document if it was disabled.
|
|
58
|
+
Any updates do not change existing content for either the <code>labels</code> or <code>data</code> fields.</p>
|
|
59
|
+
|
|
49
60
|
|
|
50
61
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-activate-user-profile.html>`_
|
|
51
62
|
|
|
52
|
-
:param grant_type:
|
|
53
|
-
:param access_token:
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
:param grant_type: The type of grant.
|
|
64
|
+
:param access_token: The user's Elasticsearch access token or JWT. Both `access`
|
|
65
|
+
and `id` JWT token types are supported and they depend on the underlying
|
|
66
|
+
JWT realm configuration. If you specify the `access_token` grant type, this
|
|
67
|
+
parameter is required. It is not valid with other grant types.
|
|
68
|
+
:param password: The user's password. If you specify the `password` grant type,
|
|
69
|
+
this parameter is required. It is not valid with other grant types.
|
|
70
|
+
:param username: The username that identifies the user. If you specify the `password`
|
|
71
|
+
grant type, this parameter is required. It is not valid with other grant
|
|
72
|
+
types.
|
|
56
73
|
"""
|
|
57
74
|
if grant_type is None and body is None:
|
|
58
75
|
raise ValueError("Empty value passed for parameter 'grant_type'")
|
|
@@ -98,12 +115,14 @@ class SecurityClient(NamespacedClient):
|
|
|
98
115
|
pretty: t.Optional[bool] = None,
|
|
99
116
|
) -> ObjectApiResponse[t.Any]:
|
|
100
117
|
"""
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
.. raw:: html
|
|
119
|
+
|
|
120
|
+
<p>Authenticate a user.</p>
|
|
121
|
+
<p>Authenticates a user and returns information about the authenticated user.
|
|
122
|
+
Include the user information in a <a href="https://en.wikipedia.org/wiki/Basic_access_authentication">basic auth header</a>.
|
|
123
|
+
A successful call returns a JSON structure that shows user information such as their username, the roles that are assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user.
|
|
124
|
+
If the user cannot be authenticated, this API returns a 401 status code.</p>
|
|
125
|
+
|
|
107
126
|
|
|
108
127
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-authenticate.html>`_
|
|
109
128
|
"""
|
|
@@ -145,9 +164,12 @@ class SecurityClient(NamespacedClient):
|
|
|
145
164
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
146
165
|
) -> ObjectApiResponse[t.Any]:
|
|
147
166
|
"""
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
167
|
+
.. raw:: html
|
|
168
|
+
|
|
169
|
+
<p>Bulk delete roles.</p>
|
|
170
|
+
<p>The role management APIs are generally the preferred way to manage roles, rather than using file-based role management.
|
|
171
|
+
The bulk delete roles API cannot delete roles that are defined in roles files.</p>
|
|
172
|
+
|
|
151
173
|
|
|
152
174
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-bulk-delete-role.html>`_
|
|
153
175
|
|
|
@@ -203,9 +225,12 @@ class SecurityClient(NamespacedClient):
|
|
|
203
225
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
204
226
|
) -> ObjectApiResponse[t.Any]:
|
|
205
227
|
"""
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
228
|
+
.. raw:: html
|
|
229
|
+
|
|
230
|
+
<p>Bulk create or update roles.</p>
|
|
231
|
+
<p>The role management APIs are generally the preferred way to manage roles, rather than using file-based role management.
|
|
232
|
+
The bulk create or update roles API cannot update roles that are defined in roles files.</p>
|
|
233
|
+
|
|
209
234
|
|
|
210
235
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-bulk-put-role.html>`_
|
|
211
236
|
|
|
@@ -244,6 +269,90 @@ class SecurityClient(NamespacedClient):
|
|
|
244
269
|
path_parts=__path_parts,
|
|
245
270
|
)
|
|
246
271
|
|
|
272
|
+
@_rewrite_parameters(
|
|
273
|
+
body_fields=("ids", "expiration", "metadata", "role_descriptors"),
|
|
274
|
+
)
|
|
275
|
+
async def bulk_update_api_keys(
|
|
276
|
+
self,
|
|
277
|
+
*,
|
|
278
|
+
ids: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
279
|
+
error_trace: t.Optional[bool] = None,
|
|
280
|
+
expiration: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
281
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
282
|
+
human: t.Optional[bool] = None,
|
|
283
|
+
metadata: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
284
|
+
pretty: t.Optional[bool] = None,
|
|
285
|
+
role_descriptors: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
|
|
286
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
287
|
+
) -> ObjectApiResponse[t.Any]:
|
|
288
|
+
"""
|
|
289
|
+
.. raw:: html
|
|
290
|
+
|
|
291
|
+
<p>Bulk update API keys.
|
|
292
|
+
Update the attributes for multiple API keys.</p>
|
|
293
|
+
<p>IMPORTANT: It is not possible to use an API key as the authentication credential for this API. To update API keys, the owner user's credentials are required.</p>
|
|
294
|
+
<p>This API is similar to the update API key API but enables you to apply the same update to multiple API keys in one API call. This operation can greatly improve performance over making individual updates.</p>
|
|
295
|
+
<p>It is not possible to update expired or invalidated API keys.</p>
|
|
296
|
+
<p>This API supports updates to API key access scope, metadata and expiration.
|
|
297
|
+
The access scope of each API key is derived from the <code>role_descriptors</code> you specify in the request and a snapshot of the owner user's permissions at the time of the request.
|
|
298
|
+
The snapshot of the owner's permissions is updated automatically on every call.</p>
|
|
299
|
+
<p>IMPORTANT: If you don't specify <code>role_descriptors</code> in the request, a call to this API might still change an API key's access scope. This change can occur if the owner user's permissions have changed since the API key was created or last modified.</p>
|
|
300
|
+
<p>A successful request returns a JSON structure that contains the IDs of all updated API keys, the IDs of API keys that already had the requested changes and did not require an update, and error details for any failed update.</p>
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-bulk-update-api-keys.html>`_
|
|
304
|
+
|
|
305
|
+
:param ids: The API key identifiers.
|
|
306
|
+
:param expiration: Expiration time for the API keys. By default, API keys never
|
|
307
|
+
expire. This property can be omitted to leave the value unchanged.
|
|
308
|
+
:param metadata: Arbitrary nested metadata to associate with the API keys. Within
|
|
309
|
+
the `metadata` object, top-level keys beginning with an underscore (`_`)
|
|
310
|
+
are reserved for system usage. Any information specified with this parameter
|
|
311
|
+
fully replaces metadata previously associated with the API key.
|
|
312
|
+
:param role_descriptors: The role descriptors to assign to the API keys. An API
|
|
313
|
+
key's effective permissions are an intersection of its assigned privileges
|
|
314
|
+
and the point-in-time snapshot of permissions of the owner user. You can
|
|
315
|
+
assign new privileges by specifying them in this parameter. To remove assigned
|
|
316
|
+
privileges, supply the `role_descriptors` parameter as an empty object `{}`.
|
|
317
|
+
If an API key has no assigned privileges, it inherits the owner user's full
|
|
318
|
+
permissions. The snapshot of the owner's permissions is always updated, whether
|
|
319
|
+
you supply the `role_descriptors` parameter. The structure of a role descriptor
|
|
320
|
+
is the same as the request for the create API keys API.
|
|
321
|
+
"""
|
|
322
|
+
if ids is None and body is None:
|
|
323
|
+
raise ValueError("Empty value passed for parameter 'ids'")
|
|
324
|
+
__path_parts: t.Dict[str, str] = {}
|
|
325
|
+
__path = "/_security/api_key/_bulk_update"
|
|
326
|
+
__query: t.Dict[str, t.Any] = {}
|
|
327
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
328
|
+
if error_trace is not None:
|
|
329
|
+
__query["error_trace"] = error_trace
|
|
330
|
+
if filter_path is not None:
|
|
331
|
+
__query["filter_path"] = filter_path
|
|
332
|
+
if human is not None:
|
|
333
|
+
__query["human"] = human
|
|
334
|
+
if pretty is not None:
|
|
335
|
+
__query["pretty"] = pretty
|
|
336
|
+
if not __body:
|
|
337
|
+
if ids is not None:
|
|
338
|
+
__body["ids"] = ids
|
|
339
|
+
if expiration is not None:
|
|
340
|
+
__body["expiration"] = expiration
|
|
341
|
+
if metadata is not None:
|
|
342
|
+
__body["metadata"] = metadata
|
|
343
|
+
if role_descriptors is not None:
|
|
344
|
+
__body["role_descriptors"] = role_descriptors
|
|
345
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
346
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
347
|
+
"POST",
|
|
348
|
+
__path,
|
|
349
|
+
params=__query,
|
|
350
|
+
headers=__headers,
|
|
351
|
+
body=__body,
|
|
352
|
+
endpoint_id="security.bulk_update_api_keys",
|
|
353
|
+
path_parts=__path_parts,
|
|
354
|
+
)
|
|
355
|
+
|
|
247
356
|
@_rewrite_parameters(
|
|
248
357
|
body_fields=("password", "password_hash"),
|
|
249
358
|
)
|
|
@@ -263,8 +372,11 @@ class SecurityClient(NamespacedClient):
|
|
|
263
372
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
264
373
|
) -> ObjectApiResponse[t.Any]:
|
|
265
374
|
"""
|
|
266
|
-
|
|
267
|
-
|
|
375
|
+
.. raw:: html
|
|
376
|
+
|
|
377
|
+
<p>Change passwords.</p>
|
|
378
|
+
<p>Change the passwords of users in the native realm and built-in users.</p>
|
|
379
|
+
|
|
268
380
|
|
|
269
381
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-change-password.html>`_
|
|
270
382
|
|
|
@@ -326,8 +438,12 @@ class SecurityClient(NamespacedClient):
|
|
|
326
438
|
pretty: t.Optional[bool] = None,
|
|
327
439
|
) -> ObjectApiResponse[t.Any]:
|
|
328
440
|
"""
|
|
329
|
-
|
|
330
|
-
|
|
441
|
+
.. raw:: html
|
|
442
|
+
|
|
443
|
+
<p>Clear the API key cache.</p>
|
|
444
|
+
<p>Evict a subset of all entries from the API key cache.
|
|
445
|
+
The cache is also automatically cleared on state changes of the security index.</p>
|
|
446
|
+
|
|
331
447
|
|
|
332
448
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-clear-api-key-cache.html>`_
|
|
333
449
|
|
|
@@ -368,13 +484,17 @@ class SecurityClient(NamespacedClient):
|
|
|
368
484
|
pretty: t.Optional[bool] = None,
|
|
369
485
|
) -> ObjectApiResponse[t.Any]:
|
|
370
486
|
"""
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
487
|
+
.. raw:: html
|
|
488
|
+
|
|
489
|
+
<p>Clear the privileges cache.</p>
|
|
490
|
+
<p>Evict privileges from the native application privilege cache.
|
|
491
|
+
The cache is also automatically cleared for applications that have their privileges updated.</p>
|
|
492
|
+
|
|
374
493
|
|
|
375
494
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-clear-privilege-cache.html>`_
|
|
376
495
|
|
|
377
|
-
:param application: A comma-separated list of
|
|
496
|
+
:param application: A comma-separated list of applications. To clear all applications,
|
|
497
|
+
use an asterism (`*`). It does not support other wildcard patterns.
|
|
378
498
|
"""
|
|
379
499
|
if application in SKIP_IN_PATH:
|
|
380
500
|
raise ValueError("Empty value passed for parameter 'application'")
|
|
@@ -411,13 +531,23 @@ class SecurityClient(NamespacedClient):
|
|
|
411
531
|
usernames: t.Optional[t.Sequence[str]] = None,
|
|
412
532
|
) -> ObjectApiResponse[t.Any]:
|
|
413
533
|
"""
|
|
414
|
-
|
|
415
|
-
|
|
534
|
+
.. raw:: html
|
|
535
|
+
|
|
536
|
+
<p>Clear the user cache.</p>
|
|
537
|
+
<p>Evict users from the user cache.
|
|
538
|
+
You can completely clear the cache or evict specific users.</p>
|
|
539
|
+
<p>User credentials are cached in memory on each node to avoid connecting to a remote authentication service or hitting the disk for every incoming request.
|
|
540
|
+
There are realm settings that you can use to configure the user cache.
|
|
541
|
+
For more information, refer to the documentation about controlling the user cache.</p>
|
|
542
|
+
|
|
416
543
|
|
|
417
544
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-clear-cache.html>`_
|
|
418
545
|
|
|
419
|
-
:param realms:
|
|
420
|
-
|
|
546
|
+
:param realms: A comma-separated list of realms. To clear all realms, use an
|
|
547
|
+
asterisk (`*`). It does not support other wildcard patterns.
|
|
548
|
+
:param usernames: A comma-separated list of the users to clear from the cache.
|
|
549
|
+
If you do not specify this parameter, the API evicts all users from the user
|
|
550
|
+
cache.
|
|
421
551
|
"""
|
|
422
552
|
if realms in SKIP_IN_PATH:
|
|
423
553
|
raise ValueError("Empty value passed for parameter 'realms'")
|
|
@@ -455,11 +585,17 @@ class SecurityClient(NamespacedClient):
|
|
|
455
585
|
pretty: t.Optional[bool] = None,
|
|
456
586
|
) -> ObjectApiResponse[t.Any]:
|
|
457
587
|
"""
|
|
458
|
-
|
|
588
|
+
.. raw:: html
|
|
589
|
+
|
|
590
|
+
<p>Clear the roles cache.</p>
|
|
591
|
+
<p>Evict roles from the native role cache.</p>
|
|
592
|
+
|
|
459
593
|
|
|
460
594
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-clear-role-cache.html>`_
|
|
461
595
|
|
|
462
|
-
:param name:
|
|
596
|
+
:param name: A comma-separated list of roles to evict from the role cache. To
|
|
597
|
+
evict all roles, use an asterisk (`*`). It does not support other wildcard
|
|
598
|
+
patterns.
|
|
463
599
|
"""
|
|
464
600
|
if name in SKIP_IN_PATH:
|
|
465
601
|
raise ValueError("Empty value passed for parameter 'name'")
|
|
@@ -497,14 +633,23 @@ class SecurityClient(NamespacedClient):
|
|
|
497
633
|
pretty: t.Optional[bool] = None,
|
|
498
634
|
) -> ObjectApiResponse[t.Any]:
|
|
499
635
|
"""
|
|
500
|
-
|
|
501
|
-
|
|
636
|
+
.. raw:: html
|
|
637
|
+
|
|
638
|
+
<p>Clear service account token caches.</p>
|
|
639
|
+
<p>Evict a subset of all entries from the service account token caches.
|
|
640
|
+
Two separate caches exist for service account tokens: one cache for tokens backed by the <code>service_tokens</code> file, and another for tokens backed by the <code>.security</code> index.
|
|
641
|
+
This API clears matching entries from both caches.</p>
|
|
642
|
+
<p>The cache for service account tokens backed by the <code>.security</code> index is cleared automatically on state changes of the security index.
|
|
643
|
+
The cache for tokens backed by the <code>service_tokens</code> file is cleared automatically on file changes.</p>
|
|
644
|
+
|
|
502
645
|
|
|
503
646
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-clear-service-token-caches.html>`_
|
|
504
647
|
|
|
505
|
-
:param namespace:
|
|
506
|
-
:param service:
|
|
507
|
-
:param name: A comma-separated list of
|
|
648
|
+
:param namespace: The namespace, which is a top-level grouping of service accounts.
|
|
649
|
+
:param service: The name of the service, which must be unique within its namespace.
|
|
650
|
+
:param name: A comma-separated list of token names to evict from the service
|
|
651
|
+
account token caches. Use a wildcard (`*`) to evict all tokens that belong
|
|
652
|
+
to a service account. It does not support other wildcard patterns.
|
|
508
653
|
"""
|
|
509
654
|
if namespace in SKIP_IN_PATH:
|
|
510
655
|
raise ValueError("Empty value passed for parameter 'namespace'")
|
|
@@ -557,31 +702,43 @@ class SecurityClient(NamespacedClient):
|
|
|
557
702
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
558
703
|
) -> ObjectApiResponse[t.Any]:
|
|
559
704
|
"""
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
705
|
+
.. raw:: html
|
|
706
|
+
|
|
707
|
+
<p>Create an API key.</p>
|
|
708
|
+
<p>Create an API key for access without requiring basic authentication.</p>
|
|
709
|
+
<p>IMPORTANT: If the credential that is used to authenticate this request is an API key, the derived API key cannot have any privileges.
|
|
710
|
+
If you specify privileges, the API returns an error.</p>
|
|
711
|
+
<p>A successful request returns a JSON structure that contains the API key, its unique id, and its name.
|
|
712
|
+
If applicable, it also returns expiration information for the API key in milliseconds.</p>
|
|
713
|
+
<p>NOTE: By default, API keys never expire. You can specify expiration information when you create the API keys.</p>
|
|
714
|
+
<p>The API keys are created by the Elasticsearch API key service, which is automatically enabled.
|
|
715
|
+
To configure or turn off the API key service, refer to API key service setting documentation.</p>
|
|
716
|
+
|
|
565
717
|
|
|
566
718
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-create-api-key.html>`_
|
|
567
719
|
|
|
568
|
-
:param expiration:
|
|
569
|
-
expire.
|
|
720
|
+
:param expiration: The expiration time for the API key. By default, API keys
|
|
721
|
+
never expire.
|
|
570
722
|
:param metadata: Arbitrary metadata that you want to associate with the API key.
|
|
571
723
|
It supports nested data structure. Within the metadata object, keys beginning
|
|
572
724
|
with `_` are reserved for system usage.
|
|
573
|
-
:param name:
|
|
725
|
+
:param name: A name for the API key.
|
|
574
726
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
575
727
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
576
728
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
577
|
-
:param role_descriptors: An array of role descriptors for this API key.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
or update roles API.
|
|
729
|
+
:param role_descriptors: An array of role descriptors for this API key. When
|
|
730
|
+
it is not specified or it is an empty array, the API key will have a point
|
|
731
|
+
in time snapshot of permissions of the authenticated user. If you supply
|
|
732
|
+
role descriptors, the resultant permissions are an intersection of API keys
|
|
733
|
+
permissions and the authenticated user's permissions thereby limiting the
|
|
734
|
+
access scope for API keys. The structure of role descriptor is the same as
|
|
735
|
+
the request for the create role API. For more details, refer to the create
|
|
736
|
+
or update roles API. NOTE: Due to the way in which this permission intersection
|
|
737
|
+
is calculated, it is not possible to create an API key that is a child of
|
|
738
|
+
another API key, unless the derived key is created without any privileges.
|
|
739
|
+
In this case, you must explicitly specify a role descriptor with no privileges.
|
|
740
|
+
The derived API key can be used for authentication; it will not have authority
|
|
741
|
+
to call Elasticsearch APIs.
|
|
585
742
|
"""
|
|
586
743
|
__path_parts: t.Dict[str, str] = {}
|
|
587
744
|
__path = "/_security/api_key"
|
|
@@ -634,21 +791,19 @@ class SecurityClient(NamespacedClient):
|
|
|
634
791
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
635
792
|
) -> ObjectApiResponse[t.Any]:
|
|
636
793
|
"""
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
API key API. Attempting to update them with the update REST API key API or the
|
|
651
|
-
bulk update REST API keys API will result in an error.
|
|
794
|
+
.. raw:: html
|
|
795
|
+
|
|
796
|
+
<p>Create a cross-cluster API key.</p>
|
|
797
|
+
<p>Create an API key of the <code>cross_cluster</code> type for the API key based remote cluster access.
|
|
798
|
+
A <code>cross_cluster</code> API key cannot be used to authenticate through the REST interface.</p>
|
|
799
|
+
<p>IMPORTANT: To authenticate this request you must use a credential that is not an API key. Even if you use an API key that has the required privilege, the API returns an error.</p>
|
|
800
|
+
<p>Cross-cluster API keys are created by the Elasticsearch API key service, which is automatically enabled.</p>
|
|
801
|
+
<p>NOTE: Unlike REST API keys, a cross-cluster API key does not capture permissions of the authenticated user. The API key’s effective permission is exactly as specified with the <code>access</code> property.</p>
|
|
802
|
+
<p>A successful request returns a JSON structure that contains the API key, its unique ID, and its name. If applicable, it also returns expiration information for the API key in milliseconds.</p>
|
|
803
|
+
<p>By default, API keys never expire. You can specify expiration information when you create the API keys.</p>
|
|
804
|
+
<p>Cross-cluster API keys can only be updated with the update cross-cluster API key API.
|
|
805
|
+
Attempting to update them with the update REST API key API or the bulk update REST API keys API will result in an error.</p>
|
|
806
|
+
|
|
652
807
|
|
|
653
808
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-create-cross-cluster-api-key.html>`_
|
|
654
809
|
|
|
@@ -717,14 +872,26 @@ class SecurityClient(NamespacedClient):
|
|
|
717
872
|
] = None,
|
|
718
873
|
) -> ObjectApiResponse[t.Any]:
|
|
719
874
|
"""
|
|
720
|
-
|
|
721
|
-
|
|
875
|
+
.. raw:: html
|
|
876
|
+
|
|
877
|
+
<p>Create a service account token.</p>
|
|
878
|
+
<p>Create a service accounts token for access without requiring basic authentication.</p>
|
|
879
|
+
<p>NOTE: Service account tokens never expire.
|
|
880
|
+
You must actively delete them if they are no longer needed.</p>
|
|
881
|
+
|
|
722
882
|
|
|
723
883
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-create-service-token.html>`_
|
|
724
884
|
|
|
725
|
-
:param namespace:
|
|
726
|
-
|
|
727
|
-
:param
|
|
885
|
+
:param namespace: The name of the namespace, which is a top-level grouping of
|
|
886
|
+
service accounts.
|
|
887
|
+
:param service: The name of the service.
|
|
888
|
+
:param name: The name for the service account token. If omitted, a random name
|
|
889
|
+
will be generated. Token names must be at least one and no more than 256
|
|
890
|
+
characters. They can contain alphanumeric characters (a-z, A-Z, 0-9), dashes
|
|
891
|
+
(`-`), and underscores (`_`), but cannot begin with an underscore. NOTE:
|
|
892
|
+
Token names must be unique in the context of the associated service account.
|
|
893
|
+
They must also be globally unique with their fully qualified names, which
|
|
894
|
+
are comprised of the service account principal and token name, such as `<namespace>/<service>/<token-name>`.
|
|
728
895
|
:param refresh: If `true` then refresh the affected shards to make this operation
|
|
729
896
|
visible to search, if `wait_for` (the default) then wait for a refresh to
|
|
730
897
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -773,6 +940,71 @@ class SecurityClient(NamespacedClient):
|
|
|
773
940
|
path_parts=__path_parts,
|
|
774
941
|
)
|
|
775
942
|
|
|
943
|
+
@_rewrite_parameters(
|
|
944
|
+
body_fields=("x509_certificate_chain",),
|
|
945
|
+
)
|
|
946
|
+
async def delegate_pki(
|
|
947
|
+
self,
|
|
948
|
+
*,
|
|
949
|
+
x509_certificate_chain: t.Optional[t.Sequence[str]] = None,
|
|
950
|
+
error_trace: t.Optional[bool] = None,
|
|
951
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
952
|
+
human: t.Optional[bool] = None,
|
|
953
|
+
pretty: t.Optional[bool] = None,
|
|
954
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
955
|
+
) -> ObjectApiResponse[t.Any]:
|
|
956
|
+
"""
|
|
957
|
+
.. raw:: html
|
|
958
|
+
|
|
959
|
+
<p>Delegate PKI authentication.</p>
|
|
960
|
+
<p>This API implements the exchange of an X509Certificate chain for an Elasticsearch access token.
|
|
961
|
+
The certificate chain is validated, according to RFC 5280, by sequentially considering the trust configuration of every installed PKI realm that has <code>delegation.enabled</code> set to <code>true</code>.
|
|
962
|
+
A successfully trusted client certificate is also subject to the validation of the subject distinguished name according to thw <code>username_pattern</code> of the respective realm.</p>
|
|
963
|
+
<p>This API is called by smart and trusted proxies, such as Kibana, which terminate the user's TLS session but still want to authenticate the user by using a PKI realm—-as if the user connected directly to Elasticsearch.</p>
|
|
964
|
+
<p>IMPORTANT: The association between the subject public key in the target certificate and the corresponding private key is not validated.
|
|
965
|
+
This is part of the TLS authentication process and it is delegated to the proxy that calls this API.
|
|
966
|
+
The proxy is trusted to have performed the TLS authentication and this API translates that authentication into an Elasticsearch access token.</p>
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delegate-pki-authentication.html>`_
|
|
970
|
+
|
|
971
|
+
:param x509_certificate_chain: The X509Certificate chain, which is represented
|
|
972
|
+
as an ordered string array. Each string in the array is a base64-encoded
|
|
973
|
+
(Section 4 of RFC4648 - not base64url-encoded) of the certificate's DER encoding.
|
|
974
|
+
The first element is the target certificate that contains the subject distinguished
|
|
975
|
+
name that is requesting access. This may be followed by additional certificates;
|
|
976
|
+
each subsequent certificate is used to certify the previous one.
|
|
977
|
+
"""
|
|
978
|
+
if x509_certificate_chain is None and body is None:
|
|
979
|
+
raise ValueError(
|
|
980
|
+
"Empty value passed for parameter 'x509_certificate_chain'"
|
|
981
|
+
)
|
|
982
|
+
__path_parts: t.Dict[str, str] = {}
|
|
983
|
+
__path = "/_security/delegate_pki"
|
|
984
|
+
__query: t.Dict[str, t.Any] = {}
|
|
985
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
986
|
+
if error_trace is not None:
|
|
987
|
+
__query["error_trace"] = error_trace
|
|
988
|
+
if filter_path is not None:
|
|
989
|
+
__query["filter_path"] = filter_path
|
|
990
|
+
if human is not None:
|
|
991
|
+
__query["human"] = human
|
|
992
|
+
if pretty is not None:
|
|
993
|
+
__query["pretty"] = pretty
|
|
994
|
+
if not __body:
|
|
995
|
+
if x509_certificate_chain is not None:
|
|
996
|
+
__body["x509_certificate_chain"] = x509_certificate_chain
|
|
997
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
998
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
999
|
+
"POST",
|
|
1000
|
+
__path,
|
|
1001
|
+
params=__query,
|
|
1002
|
+
headers=__headers,
|
|
1003
|
+
body=__body,
|
|
1004
|
+
endpoint_id="security.delegate_pki",
|
|
1005
|
+
path_parts=__path_parts,
|
|
1006
|
+
)
|
|
1007
|
+
|
|
776
1008
|
@_rewrite_parameters()
|
|
777
1009
|
async def delete_privileges(
|
|
778
1010
|
self,
|
|
@@ -788,12 +1020,21 @@ class SecurityClient(NamespacedClient):
|
|
|
788
1020
|
] = None,
|
|
789
1021
|
) -> ObjectApiResponse[t.Any]:
|
|
790
1022
|
"""
|
|
791
|
-
|
|
1023
|
+
.. raw:: html
|
|
1024
|
+
|
|
1025
|
+
<p>Delete application privileges.</p>
|
|
1026
|
+
<p>To use this API, you must have one of the following privileges:</p>
|
|
1027
|
+
<ul>
|
|
1028
|
+
<li>The <code>manage_security</code> cluster privilege (or a greater privilege such as <code>all</code>).</li>
|
|
1029
|
+
<li>The "Manage Application Privileges" global privilege for the application being referenced in the request.</li>
|
|
1030
|
+
</ul>
|
|
1031
|
+
|
|
792
1032
|
|
|
793
1033
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delete-privilege.html>`_
|
|
794
1034
|
|
|
795
|
-
:param application: Application
|
|
796
|
-
|
|
1035
|
+
:param application: The name of the application. Application privileges are always
|
|
1036
|
+
associated with exactly one application.
|
|
1037
|
+
:param name: The name of the privilege.
|
|
797
1038
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
798
1039
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
799
1040
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -844,11 +1085,17 @@ class SecurityClient(NamespacedClient):
|
|
|
844
1085
|
] = None,
|
|
845
1086
|
) -> ObjectApiResponse[t.Any]:
|
|
846
1087
|
"""
|
|
847
|
-
|
|
1088
|
+
.. raw:: html
|
|
1089
|
+
|
|
1090
|
+
<p>Delete roles.</p>
|
|
1091
|
+
<p>Delete roles in the native realm.
|
|
1092
|
+
The role management APIs are generally the preferred way to manage roles, rather than using file-based role management.
|
|
1093
|
+
The delete roles API cannot remove roles that are defined in roles files.</p>
|
|
1094
|
+
|
|
848
1095
|
|
|
849
1096
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delete-role.html>`_
|
|
850
1097
|
|
|
851
|
-
:param name:
|
|
1098
|
+
:param name: The name of the role.
|
|
852
1099
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
853
1100
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
854
1101
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -892,11 +1139,19 @@ class SecurityClient(NamespacedClient):
|
|
|
892
1139
|
] = None,
|
|
893
1140
|
) -> ObjectApiResponse[t.Any]:
|
|
894
1141
|
"""
|
|
895
|
-
|
|
1142
|
+
.. raw:: html
|
|
1143
|
+
|
|
1144
|
+
<p>Delete role mappings.</p>
|
|
1145
|
+
<p>Role mappings define which roles are assigned to each user.
|
|
1146
|
+
The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files.
|
|
1147
|
+
The delete role mappings API cannot remove role mappings that are defined in role mapping files.</p>
|
|
1148
|
+
|
|
896
1149
|
|
|
897
1150
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delete-role-mapping.html>`_
|
|
898
1151
|
|
|
899
|
-
:param name:
|
|
1152
|
+
:param name: The distinct name that identifies the role mapping. The name is
|
|
1153
|
+
used solely as an identifier to facilitate interaction via the API; it does
|
|
1154
|
+
not affect the behavior of the mapping in any way.
|
|
900
1155
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
901
1156
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
902
1157
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -942,14 +1197,17 @@ class SecurityClient(NamespacedClient):
|
|
|
942
1197
|
] = None,
|
|
943
1198
|
) -> ObjectApiResponse[t.Any]:
|
|
944
1199
|
"""
|
|
945
|
-
|
|
946
|
-
|
|
1200
|
+
.. raw:: html
|
|
1201
|
+
|
|
1202
|
+
<p>Delete service account tokens.</p>
|
|
1203
|
+
<p>Delete service account tokens for a service in a specified namespace.</p>
|
|
1204
|
+
|
|
947
1205
|
|
|
948
1206
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delete-service-token.html>`_
|
|
949
1207
|
|
|
950
|
-
:param namespace:
|
|
951
|
-
:param service:
|
|
952
|
-
:param name:
|
|
1208
|
+
:param namespace: The namespace, which is a top-level grouping of service accounts.
|
|
1209
|
+
:param service: The service name.
|
|
1210
|
+
:param name: The name of the service account token.
|
|
953
1211
|
:param refresh: If `true` then refresh the affected shards to make this operation
|
|
954
1212
|
visible to search, if `wait_for` (the default) then wait for a refresh to
|
|
955
1213
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -1001,11 +1259,15 @@ class SecurityClient(NamespacedClient):
|
|
|
1001
1259
|
] = None,
|
|
1002
1260
|
) -> ObjectApiResponse[t.Any]:
|
|
1003
1261
|
"""
|
|
1004
|
-
|
|
1262
|
+
.. raw:: html
|
|
1263
|
+
|
|
1264
|
+
<p>Delete users.</p>
|
|
1265
|
+
<p>Delete users from the native realm.</p>
|
|
1266
|
+
|
|
1005
1267
|
|
|
1006
1268
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-delete-user.html>`_
|
|
1007
1269
|
|
|
1008
|
-
:param username:
|
|
1270
|
+
:param username: An identifier for the user.
|
|
1009
1271
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
1010
1272
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
1011
1273
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -1049,11 +1311,17 @@ class SecurityClient(NamespacedClient):
|
|
|
1049
1311
|
] = None,
|
|
1050
1312
|
) -> ObjectApiResponse[t.Any]:
|
|
1051
1313
|
"""
|
|
1052
|
-
|
|
1314
|
+
.. raw:: html
|
|
1315
|
+
|
|
1316
|
+
<p>Disable users.</p>
|
|
1317
|
+
<p>Disable users in the native realm.
|
|
1318
|
+
By default, when you create users, they are enabled.
|
|
1319
|
+
You can use this API to revoke a user's access to Elasticsearch.</p>
|
|
1320
|
+
|
|
1053
1321
|
|
|
1054
1322
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-disable-user.html>`_
|
|
1055
1323
|
|
|
1056
|
-
:param username:
|
|
1324
|
+
:param username: An identifier for the user.
|
|
1057
1325
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
1058
1326
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
1059
1327
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -1097,15 +1365,23 @@ class SecurityClient(NamespacedClient):
|
|
|
1097
1365
|
] = None,
|
|
1098
1366
|
) -> ObjectApiResponse[t.Any]:
|
|
1099
1367
|
"""
|
|
1100
|
-
|
|
1101
|
-
|
|
1368
|
+
.. raw:: html
|
|
1369
|
+
|
|
1370
|
+
<p>Disable a user profile.</p>
|
|
1371
|
+
<p>Disable user profiles so that they are not visible in user profile searches.</p>
|
|
1372
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
|
|
1373
|
+
Individual users and external applications should not call this API directly.
|
|
1374
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
1375
|
+
<p>When you activate a user profile, its automatically enabled and visible in user profile searches. You can use the disable user profile API to disable a user profile so it’s not visible in these searches.
|
|
1376
|
+
To re-enable a disabled user profile, use the enable user profile API .</p>
|
|
1377
|
+
|
|
1102
1378
|
|
|
1103
1379
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-disable-user-profile.html>`_
|
|
1104
1380
|
|
|
1105
1381
|
:param uid: Unique identifier for the user profile.
|
|
1106
1382
|
:param refresh: If 'true', Elasticsearch refreshes the affected shards to make
|
|
1107
|
-
this operation visible to search
|
|
1108
|
-
make this operation visible to search
|
|
1383
|
+
this operation visible to search. If 'wait_for', it waits for a refresh to
|
|
1384
|
+
make this operation visible to search. If 'false', it does nothing with refreshes.
|
|
1109
1385
|
"""
|
|
1110
1386
|
if uid in SKIP_IN_PATH:
|
|
1111
1387
|
raise ValueError("Empty value passed for parameter 'uid'")
|
|
@@ -1146,11 +1422,16 @@ class SecurityClient(NamespacedClient):
|
|
|
1146
1422
|
] = None,
|
|
1147
1423
|
) -> ObjectApiResponse[t.Any]:
|
|
1148
1424
|
"""
|
|
1149
|
-
|
|
1425
|
+
.. raw:: html
|
|
1426
|
+
|
|
1427
|
+
<p>Enable users.</p>
|
|
1428
|
+
<p>Enable users in the native realm.
|
|
1429
|
+
By default, when you create users, they are enabled.</p>
|
|
1430
|
+
|
|
1150
1431
|
|
|
1151
1432
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-enable-user.html>`_
|
|
1152
1433
|
|
|
1153
|
-
:param username:
|
|
1434
|
+
:param username: An identifier for the user.
|
|
1154
1435
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
1155
1436
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
1156
1437
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
@@ -1194,15 +1475,23 @@ class SecurityClient(NamespacedClient):
|
|
|
1194
1475
|
] = None,
|
|
1195
1476
|
) -> ObjectApiResponse[t.Any]:
|
|
1196
1477
|
"""
|
|
1197
|
-
|
|
1198
|
-
|
|
1478
|
+
.. raw:: html
|
|
1479
|
+
|
|
1480
|
+
<p>Enable a user profile.</p>
|
|
1481
|
+
<p>Enable user profiles to make them visible in user profile searches.</p>
|
|
1482
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
|
|
1483
|
+
Individual users and external applications should not call this API directly.
|
|
1484
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
1485
|
+
<p>When you activate a user profile, it's automatically enabled and visible in user profile searches.
|
|
1486
|
+
If you later disable the user profile, you can use the enable user profile API to make the profile visible in these searches again.</p>
|
|
1487
|
+
|
|
1199
1488
|
|
|
1200
1489
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-enable-user-profile.html>`_
|
|
1201
1490
|
|
|
1202
|
-
:param uid:
|
|
1491
|
+
:param uid: A unique identifier for the user profile.
|
|
1203
1492
|
:param refresh: If 'true', Elasticsearch refreshes the affected shards to make
|
|
1204
|
-
this operation visible to search
|
|
1205
|
-
make this operation visible to search
|
|
1493
|
+
this operation visible to search. If 'wait_for', it waits for a refresh to
|
|
1494
|
+
make this operation visible to search. If 'false', nothing is done with refreshes.
|
|
1206
1495
|
"""
|
|
1207
1496
|
if uid in SKIP_IN_PATH:
|
|
1208
1497
|
raise ValueError("Empty value passed for parameter 'uid'")
|
|
@@ -1239,8 +1528,13 @@ class SecurityClient(NamespacedClient):
|
|
|
1239
1528
|
pretty: t.Optional[bool] = None,
|
|
1240
1529
|
) -> ObjectApiResponse[t.Any]:
|
|
1241
1530
|
"""
|
|
1242
|
-
|
|
1243
|
-
|
|
1531
|
+
.. raw:: html
|
|
1532
|
+
|
|
1533
|
+
<p>Enroll Kibana.</p>
|
|
1534
|
+
<p>Enable a Kibana instance to configure itself for communication with a secured Elasticsearch cluster.</p>
|
|
1535
|
+
<p>NOTE: This API is currently intended for internal use only by Kibana.
|
|
1536
|
+
Kibana uses this API internally to configure itself for communications with an Elasticsearch cluster that already has security features enabled.</p>
|
|
1537
|
+
|
|
1244
1538
|
|
|
1245
1539
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-kibana-enrollment.html>`_
|
|
1246
1540
|
"""
|
|
@@ -1275,8 +1569,13 @@ class SecurityClient(NamespacedClient):
|
|
|
1275
1569
|
pretty: t.Optional[bool] = None,
|
|
1276
1570
|
) -> ObjectApiResponse[t.Any]:
|
|
1277
1571
|
"""
|
|
1278
|
-
|
|
1279
|
-
|
|
1572
|
+
.. raw:: html
|
|
1573
|
+
|
|
1574
|
+
<p>Enroll a node.</p>
|
|
1575
|
+
<p>Enroll a new node to allow it to join an existing cluster with security features enabled.</p>
|
|
1576
|
+
<p>The response contains all the necessary information for the joining node to bootstrap discovery and security related settings so that it can successfully join the cluster.
|
|
1577
|
+
The response contains key and certificate material that allows the caller to generate valid signed certificates for the HTTP layer of all nodes in the cluster.</p>
|
|
1578
|
+
|
|
1280
1579
|
|
|
1281
1580
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-node-enrollment.html>`_
|
|
1282
1581
|
"""
|
|
@@ -1319,11 +1618,13 @@ class SecurityClient(NamespacedClient):
|
|
|
1319
1618
|
with_profile_uid: t.Optional[bool] = None,
|
|
1320
1619
|
) -> ObjectApiResponse[t.Any]:
|
|
1321
1620
|
"""
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1621
|
+
.. raw:: html
|
|
1622
|
+
|
|
1623
|
+
<p>Get API key information.</p>
|
|
1624
|
+
<p>Retrieves information for one or more API keys.
|
|
1625
|
+
NOTE: If you have only the <code>manage_own_api_key</code> privilege, this API returns only the API keys that you own.
|
|
1626
|
+
If you have <code>read_security</code>, <code>manage_api_key</code> or greater privileges (including <code>manage_security</code>), this API returns all API keys regardless of ownership.</p>
|
|
1627
|
+
|
|
1327
1628
|
|
|
1328
1629
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-api-key.html>`_
|
|
1329
1630
|
|
|
@@ -1397,8 +1698,11 @@ class SecurityClient(NamespacedClient):
|
|
|
1397
1698
|
pretty: t.Optional[bool] = None,
|
|
1398
1699
|
) -> ObjectApiResponse[t.Any]:
|
|
1399
1700
|
"""
|
|
1400
|
-
|
|
1401
|
-
|
|
1701
|
+
.. raw:: html
|
|
1702
|
+
|
|
1703
|
+
<p>Get builtin privileges.</p>
|
|
1704
|
+
<p>Get the list of cluster privileges and index privileges that are available in this version of Elasticsearch.</p>
|
|
1705
|
+
|
|
1402
1706
|
|
|
1403
1707
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-builtin-privileges.html>`_
|
|
1404
1708
|
"""
|
|
@@ -1435,12 +1739,23 @@ class SecurityClient(NamespacedClient):
|
|
|
1435
1739
|
pretty: t.Optional[bool] = None,
|
|
1436
1740
|
) -> ObjectApiResponse[t.Any]:
|
|
1437
1741
|
"""
|
|
1438
|
-
|
|
1742
|
+
.. raw:: html
|
|
1743
|
+
|
|
1744
|
+
<p>Get application privileges.</p>
|
|
1745
|
+
<p>To use this API, you must have one of the following privileges:</p>
|
|
1746
|
+
<ul>
|
|
1747
|
+
<li>The <code>read_security</code> cluster privilege (or a greater privilege such as <code>manage_security</code> or <code>all</code>).</li>
|
|
1748
|
+
<li>The "Manage Application Privileges" global privilege for the application being referenced in the request.</li>
|
|
1749
|
+
</ul>
|
|
1750
|
+
|
|
1439
1751
|
|
|
1440
1752
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-privileges.html>`_
|
|
1441
1753
|
|
|
1442
|
-
:param application: Application
|
|
1443
|
-
|
|
1754
|
+
:param application: The name of the application. Application privileges are always
|
|
1755
|
+
associated with exactly one application. If you do not specify this parameter,
|
|
1756
|
+
the API returns information about all privileges for all applications.
|
|
1757
|
+
:param name: The name of the privilege. If you do not specify this parameter,
|
|
1758
|
+
the API returns information about all privileges for the requested application.
|
|
1444
1759
|
"""
|
|
1445
1760
|
__path_parts: t.Dict[str, str]
|
|
1446
1761
|
if application not in SKIP_IN_PATH and name not in SKIP_IN_PATH:
|
|
@@ -1482,9 +1797,13 @@ class SecurityClient(NamespacedClient):
|
|
|
1482
1797
|
pretty: t.Optional[bool] = None,
|
|
1483
1798
|
) -> ObjectApiResponse[t.Any]:
|
|
1484
1799
|
"""
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1800
|
+
.. raw:: html
|
|
1801
|
+
|
|
1802
|
+
<p>Get roles.</p>
|
|
1803
|
+
<p>Get roles in the native realm.
|
|
1804
|
+
The role management APIs are generally the preferred way to manage roles, rather than using file-based role management.
|
|
1805
|
+
The get roles API cannot retrieve roles that are defined in roles files.</p>
|
|
1806
|
+
|
|
1488
1807
|
|
|
1489
1808
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-role.html>`_
|
|
1490
1809
|
|
|
@@ -1529,10 +1848,13 @@ class SecurityClient(NamespacedClient):
|
|
|
1529
1848
|
pretty: t.Optional[bool] = None,
|
|
1530
1849
|
) -> ObjectApiResponse[t.Any]:
|
|
1531
1850
|
"""
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1851
|
+
.. raw:: html
|
|
1852
|
+
|
|
1853
|
+
<p>Get role mappings.</p>
|
|
1854
|
+
<p>Role mappings define which roles are assigned to each user.
|
|
1855
|
+
The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files.
|
|
1856
|
+
The get role mappings API cannot retrieve role mappings that are defined in role mapping files.</p>
|
|
1857
|
+
|
|
1536
1858
|
|
|
1537
1859
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-role-mapping.html>`_
|
|
1538
1860
|
|
|
@@ -1580,15 +1902,19 @@ class SecurityClient(NamespacedClient):
|
|
|
1580
1902
|
pretty: t.Optional[bool] = None,
|
|
1581
1903
|
) -> ObjectApiResponse[t.Any]:
|
|
1582
1904
|
"""
|
|
1583
|
-
|
|
1584
|
-
|
|
1905
|
+
.. raw:: html
|
|
1906
|
+
|
|
1907
|
+
<p>Get service accounts.</p>
|
|
1908
|
+
<p>Get a list of service accounts that match the provided path parameters.</p>
|
|
1909
|
+
<p>NOTE: Currently, only the <code>elastic/fleet-server</code> service account is available.</p>
|
|
1910
|
+
|
|
1585
1911
|
|
|
1586
1912
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-service-accounts.html>`_
|
|
1587
1913
|
|
|
1588
|
-
:param namespace:
|
|
1589
|
-
about all service accounts. If you omit this parameter, you must
|
|
1590
|
-
the `service` parameter.
|
|
1591
|
-
:param service:
|
|
1914
|
+
:param namespace: The name of the namespace. Omit this parameter to retrieve
|
|
1915
|
+
information about all service accounts. If you omit this parameter, you must
|
|
1916
|
+
also omit the `service` parameter.
|
|
1917
|
+
:param service: The service name. Omit this parameter to retrieve information
|
|
1592
1918
|
about all service accounts that belong to the specified `namespace`.
|
|
1593
1919
|
"""
|
|
1594
1920
|
__path_parts: t.Dict[str, str]
|
|
@@ -1632,12 +1958,19 @@ class SecurityClient(NamespacedClient):
|
|
|
1632
1958
|
pretty: t.Optional[bool] = None,
|
|
1633
1959
|
) -> ObjectApiResponse[t.Any]:
|
|
1634
1960
|
"""
|
|
1635
|
-
|
|
1961
|
+
.. raw:: html
|
|
1962
|
+
|
|
1963
|
+
<p>Get service account credentials.</p>
|
|
1964
|
+
<p>To use this API, you must have at least the <code>read_security</code> cluster privilege (or a greater privilege such as <code>manage_service_account</code> or <code>manage_security</code>).</p>
|
|
1965
|
+
<p>The response includes service account tokens that were created with the create service account tokens API as well as file-backed tokens from all nodes of the cluster.</p>
|
|
1966
|
+
<p>NOTE: For tokens backed by the <code>service_tokens</code> file, the API collects them from all nodes of the cluster.
|
|
1967
|
+
Tokens with the same name from different nodes are assumed to be the same token and are only counted once towards the total number of service tokens.</p>
|
|
1968
|
+
|
|
1636
1969
|
|
|
1637
1970
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-service-credentials.html>`_
|
|
1638
1971
|
|
|
1639
|
-
:param namespace:
|
|
1640
|
-
:param service:
|
|
1972
|
+
:param namespace: The name of the namespace.
|
|
1973
|
+
:param service: The service name.
|
|
1641
1974
|
"""
|
|
1642
1975
|
if namespace in SKIP_IN_PATH:
|
|
1643
1976
|
raise ValueError("Empty value passed for parameter 'namespace'")
|
|
@@ -1667,6 +2000,58 @@ class SecurityClient(NamespacedClient):
|
|
|
1667
2000
|
path_parts=__path_parts,
|
|
1668
2001
|
)
|
|
1669
2002
|
|
|
2003
|
+
@_rewrite_parameters()
|
|
2004
|
+
async def get_settings(
|
|
2005
|
+
self,
|
|
2006
|
+
*,
|
|
2007
|
+
error_trace: t.Optional[bool] = None,
|
|
2008
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2009
|
+
human: t.Optional[bool] = None,
|
|
2010
|
+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
2011
|
+
pretty: t.Optional[bool] = None,
|
|
2012
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2013
|
+
"""
|
|
2014
|
+
.. raw:: html
|
|
2015
|
+
|
|
2016
|
+
<p>Get security index settings.</p>
|
|
2017
|
+
<p>Get the user-configurable settings for the security internal index (<code>.security</code> and associated indices).
|
|
2018
|
+
Only a subset of the index settings — those that are user-configurable—will be shown.
|
|
2019
|
+
This includes:</p>
|
|
2020
|
+
<ul>
|
|
2021
|
+
<li><code>index.auto_expand_replicas</code></li>
|
|
2022
|
+
<li><code>index.number_of_replicas</code></li>
|
|
2023
|
+
</ul>
|
|
2024
|
+
|
|
2025
|
+
|
|
2026
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-settings.html>`_
|
|
2027
|
+
|
|
2028
|
+
:param master_timeout: Period to wait for a connection to the master node. If
|
|
2029
|
+
no response is received before the timeout expires, the request fails and
|
|
2030
|
+
returns an error.
|
|
2031
|
+
"""
|
|
2032
|
+
__path_parts: t.Dict[str, str] = {}
|
|
2033
|
+
__path = "/_security/settings"
|
|
2034
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2035
|
+
if error_trace is not None:
|
|
2036
|
+
__query["error_trace"] = error_trace
|
|
2037
|
+
if filter_path is not None:
|
|
2038
|
+
__query["filter_path"] = filter_path
|
|
2039
|
+
if human is not None:
|
|
2040
|
+
__query["human"] = human
|
|
2041
|
+
if master_timeout is not None:
|
|
2042
|
+
__query["master_timeout"] = master_timeout
|
|
2043
|
+
if pretty is not None:
|
|
2044
|
+
__query["pretty"] = pretty
|
|
2045
|
+
__headers = {"accept": "application/json"}
|
|
2046
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
2047
|
+
"GET",
|
|
2048
|
+
__path,
|
|
2049
|
+
params=__query,
|
|
2050
|
+
headers=__headers,
|
|
2051
|
+
endpoint_id="security.get_settings",
|
|
2052
|
+
path_parts=__path_parts,
|
|
2053
|
+
)
|
|
2054
|
+
|
|
1670
2055
|
@_rewrite_parameters(
|
|
1671
2056
|
body_fields=(
|
|
1672
2057
|
"grant_type",
|
|
@@ -1700,16 +2085,39 @@ class SecurityClient(NamespacedClient):
|
|
|
1700
2085
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1701
2086
|
) -> ObjectApiResponse[t.Any]:
|
|
1702
2087
|
"""
|
|
1703
|
-
|
|
2088
|
+
.. raw:: html
|
|
2089
|
+
|
|
2090
|
+
<p>Get a token.</p>
|
|
2091
|
+
<p>Create a bearer token for access without requiring basic authentication.
|
|
2092
|
+
The tokens are created by the Elasticsearch Token Service, which is automatically enabled when you configure TLS on the HTTP interface.
|
|
2093
|
+
Alternatively, you can explicitly enable the <code>xpack.security.authc.token.enabled</code> setting.
|
|
2094
|
+
When you are running in production mode, a bootstrap check prevents you from enabling the token service unless you also enable TLS on the HTTP interface.</p>
|
|
2095
|
+
<p>The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.</p>
|
|
2096
|
+
<p>A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.</p>
|
|
2097
|
+
<p>The tokens returned by the get token API have a finite period of time for which they are valid and after that time period, they can no longer be used.
|
|
2098
|
+
That time period is defined by the <code>xpack.security.authc.token.timeout</code> setting.
|
|
2099
|
+
If you want to invalidate a token immediately, you can do so by using the invalidate token API.</p>
|
|
2100
|
+
|
|
1704
2101
|
|
|
1705
2102
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-token.html>`_
|
|
1706
2103
|
|
|
1707
|
-
:param grant_type:
|
|
1708
|
-
|
|
1709
|
-
:param
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
:param
|
|
2104
|
+
:param grant_type: The type of grant. Supported grant types are: `password`,
|
|
2105
|
+
`_kerberos`, `client_credentials`, and `refresh_token`.
|
|
2106
|
+
:param kerberos_ticket: The base64 encoded kerberos ticket. If you specify the
|
|
2107
|
+
`_kerberos` grant type, this parameter is required. This parameter is not
|
|
2108
|
+
valid with any other supported grant type.
|
|
2109
|
+
:param password: The user's password. If you specify the `password` grant type,
|
|
2110
|
+
this parameter is required. This parameter is not valid with any other supported
|
|
2111
|
+
grant type.
|
|
2112
|
+
:param refresh_token: The string that was returned when you created the token,
|
|
2113
|
+
which enables you to extend its life. If you specify the `refresh_token`
|
|
2114
|
+
grant type, this parameter is required. This parameter is not valid with
|
|
2115
|
+
any other supported grant type.
|
|
2116
|
+
:param scope: The scope of the token. Currently tokens are only issued for a
|
|
2117
|
+
scope of FULL regardless of the value sent with the request.
|
|
2118
|
+
:param username: The username that identifies the user. If you specify the `password`
|
|
2119
|
+
grant type, this parameter is required. This parameter is not valid with
|
|
2120
|
+
any other supported grant type.
|
|
1713
2121
|
"""
|
|
1714
2122
|
__path_parts: t.Dict[str, str] = {}
|
|
1715
2123
|
__path = "/_security/oauth2/token"
|
|
@@ -1759,15 +2167,19 @@ class SecurityClient(NamespacedClient):
|
|
|
1759
2167
|
with_profile_uid: t.Optional[bool] = None,
|
|
1760
2168
|
) -> ObjectApiResponse[t.Any]:
|
|
1761
2169
|
"""
|
|
1762
|
-
|
|
2170
|
+
.. raw:: html
|
|
2171
|
+
|
|
2172
|
+
<p>Get users.</p>
|
|
2173
|
+
<p>Get information about users in the native realm and built-in users.</p>
|
|
2174
|
+
|
|
1763
2175
|
|
|
1764
2176
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-user.html>`_
|
|
1765
2177
|
|
|
1766
2178
|
:param username: An identifier for the user. You can specify multiple usernames
|
|
1767
2179
|
as a comma-separated list. If you omit this parameter, the API retrieves
|
|
1768
2180
|
information about all users.
|
|
1769
|
-
:param with_profile_uid:
|
|
1770
|
-
if
|
|
2181
|
+
:param with_profile_uid: Determines whether to retrieve the user profile UID,
|
|
2182
|
+
if it exists, for the users.
|
|
1771
2183
|
"""
|
|
1772
2184
|
__path_parts: t.Dict[str, str]
|
|
1773
2185
|
if username not in SKIP_IN_PATH:
|
|
@@ -1810,7 +2222,14 @@ class SecurityClient(NamespacedClient):
|
|
|
1810
2222
|
username: t.Optional[t.Union[None, str]] = None,
|
|
1811
2223
|
) -> ObjectApiResponse[t.Any]:
|
|
1812
2224
|
"""
|
|
1813
|
-
|
|
2225
|
+
.. raw:: html
|
|
2226
|
+
|
|
2227
|
+
<p>Get user privileges.</p>
|
|
2228
|
+
<p>Get the security privileges for the logged in user.
|
|
2229
|
+
All users can use this API, but only to determine their own privileges.
|
|
2230
|
+
To check the privileges of other users, you must use the run as feature.
|
|
2231
|
+
To check whether a user has a specific list of privileges, use the has privileges API.</p>
|
|
2232
|
+
|
|
1814
2233
|
|
|
1815
2234
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-user-privileges.html>`_
|
|
1816
2235
|
|
|
@@ -1860,15 +2279,22 @@ class SecurityClient(NamespacedClient):
|
|
|
1860
2279
|
pretty: t.Optional[bool] = None,
|
|
1861
2280
|
) -> ObjectApiResponse[t.Any]:
|
|
1862
2281
|
"""
|
|
1863
|
-
|
|
2282
|
+
.. raw:: html
|
|
2283
|
+
|
|
2284
|
+
<p>Get a user profile.</p>
|
|
2285
|
+
<p>Get a user's profile using the unique profile ID.</p>
|
|
2286
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
|
|
2287
|
+
Individual users and external applications should not call this API directly.
|
|
2288
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
2289
|
+
|
|
1864
2290
|
|
|
1865
2291
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-get-user-profile.html>`_
|
|
1866
2292
|
|
|
1867
2293
|
:param uid: A unique identifier for the user profile.
|
|
1868
|
-
:param data:
|
|
1869
|
-
return all content use `data=*`. To return a subset of content
|
|
1870
|
-
to retrieve content nested under the specified `<key>`.
|
|
1871
|
-
no `data` content.
|
|
2294
|
+
:param data: A comma-separated list of filters for the `data` field of the profile
|
|
2295
|
+
document. To return all content use `data=*`. To return a subset of content
|
|
2296
|
+
use `data=<key>` to retrieve content nested under the specified `<key>`.
|
|
2297
|
+
By default returns no `data` content.
|
|
1872
2298
|
"""
|
|
1873
2299
|
if uid in SKIP_IN_PATH:
|
|
1874
2300
|
raise ValueError("Empty value passed for parameter 'uid'")
|
|
@@ -1924,31 +2350,37 @@ class SecurityClient(NamespacedClient):
|
|
|
1924
2350
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1925
2351
|
) -> ObjectApiResponse[t.Any]:
|
|
1926
2352
|
"""
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2353
|
+
.. raw:: html
|
|
2354
|
+
|
|
2355
|
+
<p>Grant an API key.</p>
|
|
2356
|
+
<p>Create an API key on behalf of another user.
|
|
2357
|
+
This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API.
|
|
2358
|
+
The caller must have authentication credentials for the user on whose behalf the API key will be created.
|
|
2359
|
+
It is not possible to use this API to create an API key without that user's credentials.
|
|
2360
|
+
The supported user authentication credential types are:</p>
|
|
2361
|
+
<ul>
|
|
2362
|
+
<li>username and password</li>
|
|
2363
|
+
<li>Elasticsearch access tokens</li>
|
|
2364
|
+
<li>JWTs</li>
|
|
2365
|
+
</ul>
|
|
2366
|
+
<p>The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user.
|
|
2367
|
+
In this case, the API key will be created on behalf of the impersonated user.</p>
|
|
2368
|
+
<p>This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf.
|
|
2369
|
+
The API keys are created by the Elasticsearch API key service, which is automatically enabled.</p>
|
|
2370
|
+
<p>A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name.
|
|
2371
|
+
If applicable, it also returns expiration information for the API key in milliseconds.</p>
|
|
2372
|
+
<p>By default, API keys never expire. You can specify expiration information when you create the API keys.</p>
|
|
2373
|
+
|
|
1942
2374
|
|
|
1943
2375
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-grant-api-key.html>`_
|
|
1944
2376
|
|
|
1945
|
-
:param api_key:
|
|
2377
|
+
:param api_key: The API key.
|
|
1946
2378
|
:param grant_type: The type of grant. Supported grant types are: `access_token`,
|
|
1947
2379
|
`password`.
|
|
1948
|
-
:param access_token: The user
|
|
2380
|
+
:param access_token: The user's access token. If you specify the `access_token`
|
|
1949
2381
|
grant type, this parameter is required. It is not valid with other grant
|
|
1950
2382
|
types.
|
|
1951
|
-
:param password: The user
|
|
2383
|
+
:param password: The user's password. If you specify the `password` grant type,
|
|
1952
2384
|
this parameter is required. It is not valid with other grant types.
|
|
1953
2385
|
:param run_as: The name of the user to be impersonated.
|
|
1954
2386
|
:param username: The user name that identifies the user. If you specify the `password`
|
|
@@ -2079,8 +2511,13 @@ class SecurityClient(NamespacedClient):
|
|
|
2079
2511
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2080
2512
|
) -> ObjectApiResponse[t.Any]:
|
|
2081
2513
|
"""
|
|
2082
|
-
|
|
2083
|
-
|
|
2514
|
+
.. raw:: html
|
|
2515
|
+
|
|
2516
|
+
<p>Check user privileges.</p>
|
|
2517
|
+
<p>Determine whether the specified user has a specified list of privileges.
|
|
2518
|
+
All users can use this API, but only to determine their own privileges.
|
|
2519
|
+
To check the privileges of other users, you must use the run as feature.</p>
|
|
2520
|
+
|
|
2084
2521
|
|
|
2085
2522
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-has-privileges.html>`_
|
|
2086
2523
|
|
|
@@ -2139,12 +2576,17 @@ class SecurityClient(NamespacedClient):
|
|
|
2139
2576
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2140
2577
|
) -> ObjectApiResponse[t.Any]:
|
|
2141
2578
|
"""
|
|
2142
|
-
|
|
2143
|
-
|
|
2579
|
+
.. raw:: html
|
|
2580
|
+
|
|
2581
|
+
<p>Check user profile privileges.</p>
|
|
2582
|
+
<p>Determine whether the users associated with the specified user profile IDs have all the requested privileges.</p>
|
|
2583
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly.
|
|
2584
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
2585
|
+
|
|
2144
2586
|
|
|
2145
2587
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-has-privileges-user-profile.html>`_
|
|
2146
2588
|
|
|
2147
|
-
:param privileges:
|
|
2589
|
+
:param privileges: An object containing all the privileges to be checked.
|
|
2148
2590
|
:param uids: A list of profile IDs. The privileges are checked for associated
|
|
2149
2591
|
users of the profiles.
|
|
2150
2592
|
"""
|
|
@@ -2199,17 +2641,22 @@ class SecurityClient(NamespacedClient):
|
|
|
2199
2641
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2200
2642
|
) -> ObjectApiResponse[t.Any]:
|
|
2201
2643
|
"""
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2644
|
+
.. raw:: html
|
|
2645
|
+
|
|
2646
|
+
<p>Invalidate API keys.</p>
|
|
2647
|
+
<p>This API invalidates API keys created by the create API key or grant API key APIs.
|
|
2648
|
+
Invalidated API keys fail authentication, but they can still be viewed using the get API key information and query API key information APIs, for at least the configured retention period, until they are automatically deleted.</p>
|
|
2649
|
+
<p>To use this API, you must have at least the <code>manage_security</code>, <code>manage_api_key</code>, or <code>manage_own_api_key</code> cluster privileges.
|
|
2650
|
+
The <code>manage_security</code> privilege allows deleting any API key, including both REST and cross cluster API keys.
|
|
2651
|
+
The <code>manage_api_key</code> privilege allows deleting any REST API key, but not cross cluster API keys.
|
|
2652
|
+
The <code>manage_own_api_key</code> only allows deleting REST API keys that are owned by the user.
|
|
2653
|
+
In addition, with the <code>manage_own_api_key</code> privilege, an invalidation request must be issued in one of the three formats:</p>
|
|
2654
|
+
<ul>
|
|
2655
|
+
<li>Set the parameter <code>owner=true</code>.</li>
|
|
2656
|
+
<li>Or, set both <code>username</code> and <code>realm_name</code> to match the user's identity.</li>
|
|
2657
|
+
<li>Or, if the request is issued by an API key, that is to say an API key invalidates itself, specify its ID in the <code>ids</code> field.</li>
|
|
2658
|
+
</ul>
|
|
2659
|
+
|
|
2213
2660
|
|
|
2214
2661
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-invalidate-api-key.html>`_
|
|
2215
2662
|
|
|
@@ -2218,14 +2665,15 @@ class SecurityClient(NamespacedClient):
|
|
|
2218
2665
|
`name`, `realm_name`, or `username`.
|
|
2219
2666
|
:param name: An API key name. This parameter cannot be used with any of `ids`,
|
|
2220
2667
|
`realm_name` or `username`.
|
|
2221
|
-
:param owner:
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2668
|
+
:param owner: Query API keys owned by the currently authenticated user. The `realm_name`
|
|
2669
|
+
or `username` parameters cannot be specified when this parameter is set to
|
|
2670
|
+
`true` as they are assumed to be the currently authenticated ones. NOTE:
|
|
2671
|
+
At least one of `ids`, `name`, `username`, and `realm_name` must be specified
|
|
2672
|
+
if `owner` is `false`.
|
|
2225
2673
|
:param realm_name: The name of an authentication realm. This parameter cannot
|
|
2226
2674
|
be used with either `ids` or `name`, or when `owner` flag is set to `true`.
|
|
2227
2675
|
:param username: The username of a user. This parameter cannot be used with either
|
|
2228
|
-
`ids` or `name
|
|
2676
|
+
`ids` or `name` or when `owner` flag is set to `true`.
|
|
2229
2677
|
"""
|
|
2230
2678
|
__path_parts: t.Dict[str, str] = {}
|
|
2231
2679
|
__path = "/_security/api_key"
|
|
@@ -2280,19 +2728,30 @@ class SecurityClient(NamespacedClient):
|
|
|
2280
2728
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2281
2729
|
) -> ObjectApiResponse[t.Any]:
|
|
2282
2730
|
"""
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2731
|
+
.. raw:: html
|
|
2732
|
+
|
|
2733
|
+
<p>Invalidate a token.</p>
|
|
2734
|
+
<p>The access tokens returned by the get token API have a finite period of time for which they are valid.
|
|
2735
|
+
After that time period, they can no longer be used.
|
|
2736
|
+
The time period is defined by the <code>xpack.security.authc.token.timeout</code> setting.</p>
|
|
2737
|
+
<p>The refresh tokens returned by the get token API are only valid for 24 hours.
|
|
2738
|
+
They can also be used exactly once.
|
|
2739
|
+
If you want to invalidate one or more access or refresh tokens immediately, use this invalidate token API.</p>
|
|
2740
|
+
<p>NOTE: While all parameters are optional, at least one of them is required.
|
|
2741
|
+
More specifically, either one of <code>token</code> or <code>refresh_token</code> parameters is required.
|
|
2742
|
+
If none of these two are specified, then <code>realm_name</code> and/or <code>username</code> need to be specified.</p>
|
|
2743
|
+
|
|
2289
2744
|
|
|
2290
2745
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-invalidate-token.html>`_
|
|
2291
2746
|
|
|
2292
|
-
:param realm_name:
|
|
2293
|
-
|
|
2294
|
-
:param token
|
|
2295
|
-
|
|
2747
|
+
:param realm_name: The name of an authentication realm. This parameter cannot
|
|
2748
|
+
be used with either `refresh_token` or `token`.
|
|
2749
|
+
:param refresh_token: A refresh token. This parameter cannot be used if any of
|
|
2750
|
+
`refresh_token`, `realm_name`, or `username` are used.
|
|
2751
|
+
:param token: An access token. This parameter cannot be used if any of `refresh_token`,
|
|
2752
|
+
`realm_name`, or `username` are used.
|
|
2753
|
+
:param username: The username of a user. This parameter cannot be used with either
|
|
2754
|
+
`refresh_token` or `token`.
|
|
2296
2755
|
"""
|
|
2297
2756
|
__path_parts: t.Dict[str, str] = {}
|
|
2298
2757
|
__path = "/_security/oauth2/token"
|
|
@@ -2326,6 +2785,229 @@ class SecurityClient(NamespacedClient):
|
|
|
2326
2785
|
path_parts=__path_parts,
|
|
2327
2786
|
)
|
|
2328
2787
|
|
|
2788
|
+
@_rewrite_parameters(
|
|
2789
|
+
body_fields=("nonce", "redirect_uri", "state", "realm"),
|
|
2790
|
+
)
|
|
2791
|
+
async def oidc_authenticate(
|
|
2792
|
+
self,
|
|
2793
|
+
*,
|
|
2794
|
+
nonce: t.Optional[str] = None,
|
|
2795
|
+
redirect_uri: t.Optional[str] = None,
|
|
2796
|
+
state: t.Optional[str] = None,
|
|
2797
|
+
error_trace: t.Optional[bool] = None,
|
|
2798
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2799
|
+
human: t.Optional[bool] = None,
|
|
2800
|
+
pretty: t.Optional[bool] = None,
|
|
2801
|
+
realm: t.Optional[str] = None,
|
|
2802
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2803
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2804
|
+
"""
|
|
2805
|
+
.. raw:: html
|
|
2806
|
+
|
|
2807
|
+
<p>Authenticate OpenID Connect.</p>
|
|
2808
|
+
<p>Exchange an OpenID Connect authentication response message for an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.</p>
|
|
2809
|
+
<p>Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs.
|
|
2810
|
+
These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.</p>
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-oidc-authenticate.html>`_
|
|
2814
|
+
|
|
2815
|
+
:param nonce: Associate a client session with an ID token and mitigate replay
|
|
2816
|
+
attacks. This value needs to be the same as the one that was provided to
|
|
2817
|
+
the `/_security/oidc/prepare` API or the one that was generated by Elasticsearch
|
|
2818
|
+
and included in the response to that call.
|
|
2819
|
+
:param redirect_uri: The URL to which the OpenID Connect Provider redirected
|
|
2820
|
+
the User Agent in response to an authentication request after a successful
|
|
2821
|
+
authentication. This URL must be provided as-is (URL encoded), taken from
|
|
2822
|
+
the body of the response or as the value of a location header in the response
|
|
2823
|
+
from the OpenID Connect Provider.
|
|
2824
|
+
:param state: Maintain state between the authentication request and the response.
|
|
2825
|
+
This value needs to be the same as the one that was provided to the `/_security/oidc/prepare`
|
|
2826
|
+
API or the one that was generated by Elasticsearch and included in the response
|
|
2827
|
+
to that call.
|
|
2828
|
+
:param realm: The name of the OpenID Connect realm. This property is useful in
|
|
2829
|
+
cases where multiple realms are defined.
|
|
2830
|
+
"""
|
|
2831
|
+
if nonce is None and body is None:
|
|
2832
|
+
raise ValueError("Empty value passed for parameter 'nonce'")
|
|
2833
|
+
if redirect_uri is None and body is None:
|
|
2834
|
+
raise ValueError("Empty value passed for parameter 'redirect_uri'")
|
|
2835
|
+
if state is None and body is None:
|
|
2836
|
+
raise ValueError("Empty value passed for parameter 'state'")
|
|
2837
|
+
__path_parts: t.Dict[str, str] = {}
|
|
2838
|
+
__path = "/_security/oidc/authenticate"
|
|
2839
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2840
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2841
|
+
if error_trace is not None:
|
|
2842
|
+
__query["error_trace"] = error_trace
|
|
2843
|
+
if filter_path is not None:
|
|
2844
|
+
__query["filter_path"] = filter_path
|
|
2845
|
+
if human is not None:
|
|
2846
|
+
__query["human"] = human
|
|
2847
|
+
if pretty is not None:
|
|
2848
|
+
__query["pretty"] = pretty
|
|
2849
|
+
if not __body:
|
|
2850
|
+
if nonce is not None:
|
|
2851
|
+
__body["nonce"] = nonce
|
|
2852
|
+
if redirect_uri is not None:
|
|
2853
|
+
__body["redirect_uri"] = redirect_uri
|
|
2854
|
+
if state is not None:
|
|
2855
|
+
__body["state"] = state
|
|
2856
|
+
if realm is not None:
|
|
2857
|
+
__body["realm"] = realm
|
|
2858
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2859
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
2860
|
+
"POST",
|
|
2861
|
+
__path,
|
|
2862
|
+
params=__query,
|
|
2863
|
+
headers=__headers,
|
|
2864
|
+
body=__body,
|
|
2865
|
+
endpoint_id="security.oidc_authenticate",
|
|
2866
|
+
path_parts=__path_parts,
|
|
2867
|
+
)
|
|
2868
|
+
|
|
2869
|
+
@_rewrite_parameters(
|
|
2870
|
+
body_fields=("access_token", "refresh_token"),
|
|
2871
|
+
)
|
|
2872
|
+
async def oidc_logout(
|
|
2873
|
+
self,
|
|
2874
|
+
*,
|
|
2875
|
+
access_token: t.Optional[str] = None,
|
|
2876
|
+
error_trace: t.Optional[bool] = None,
|
|
2877
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2878
|
+
human: t.Optional[bool] = None,
|
|
2879
|
+
pretty: t.Optional[bool] = None,
|
|
2880
|
+
refresh_token: t.Optional[str] = None,
|
|
2881
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2882
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2883
|
+
"""
|
|
2884
|
+
.. raw:: html
|
|
2885
|
+
|
|
2886
|
+
<p>Logout of OpenID Connect.</p>
|
|
2887
|
+
<p>Invalidate an access token and a refresh token that were generated as a response to the <code>/_security/oidc/authenticate</code> API.</p>
|
|
2888
|
+
<p>If the OpenID Connect authentication realm in Elasticsearch is accordingly configured, the response to this call will contain a URI pointing to the end session endpoint of the OpenID Connect Provider in order to perform single logout.</p>
|
|
2889
|
+
<p>Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs.
|
|
2890
|
+
These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.</p>
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-oidc-logout.html>`_
|
|
2894
|
+
|
|
2895
|
+
:param access_token: The access token to be invalidated.
|
|
2896
|
+
:param refresh_token: The refresh token to be invalidated.
|
|
2897
|
+
"""
|
|
2898
|
+
if access_token is None and body is None:
|
|
2899
|
+
raise ValueError("Empty value passed for parameter 'access_token'")
|
|
2900
|
+
__path_parts: t.Dict[str, str] = {}
|
|
2901
|
+
__path = "/_security/oidc/logout"
|
|
2902
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2903
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2904
|
+
if error_trace is not None:
|
|
2905
|
+
__query["error_trace"] = error_trace
|
|
2906
|
+
if filter_path is not None:
|
|
2907
|
+
__query["filter_path"] = filter_path
|
|
2908
|
+
if human is not None:
|
|
2909
|
+
__query["human"] = human
|
|
2910
|
+
if pretty is not None:
|
|
2911
|
+
__query["pretty"] = pretty
|
|
2912
|
+
if not __body:
|
|
2913
|
+
if access_token is not None:
|
|
2914
|
+
__body["access_token"] = access_token
|
|
2915
|
+
if refresh_token is not None:
|
|
2916
|
+
__body["refresh_token"] = refresh_token
|
|
2917
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2918
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
2919
|
+
"POST",
|
|
2920
|
+
__path,
|
|
2921
|
+
params=__query,
|
|
2922
|
+
headers=__headers,
|
|
2923
|
+
body=__body,
|
|
2924
|
+
endpoint_id="security.oidc_logout",
|
|
2925
|
+
path_parts=__path_parts,
|
|
2926
|
+
)
|
|
2927
|
+
|
|
2928
|
+
@_rewrite_parameters(
|
|
2929
|
+
body_fields=("iss", "login_hint", "nonce", "realm", "state"),
|
|
2930
|
+
)
|
|
2931
|
+
async def oidc_prepare_authentication(
|
|
2932
|
+
self,
|
|
2933
|
+
*,
|
|
2934
|
+
error_trace: t.Optional[bool] = None,
|
|
2935
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2936
|
+
human: t.Optional[bool] = None,
|
|
2937
|
+
iss: t.Optional[str] = None,
|
|
2938
|
+
login_hint: t.Optional[str] = None,
|
|
2939
|
+
nonce: t.Optional[str] = None,
|
|
2940
|
+
pretty: t.Optional[bool] = None,
|
|
2941
|
+
realm: t.Optional[str] = None,
|
|
2942
|
+
state: t.Optional[str] = None,
|
|
2943
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2944
|
+
) -> ObjectApiResponse[t.Any]:
|
|
2945
|
+
"""
|
|
2946
|
+
.. raw:: html
|
|
2947
|
+
|
|
2948
|
+
<p>Prepare OpenID connect authentication.</p>
|
|
2949
|
+
<p>Create an oAuth 2.0 authentication request as a URL string based on the configuration of the OpenID Connect authentication realm in Elasticsearch.</p>
|
|
2950
|
+
<p>The response of this API is a URL pointing to the Authorization Endpoint of the configured OpenID Connect Provider, which can be used to redirect the browser of the user in order to continue the authentication process.</p>
|
|
2951
|
+
<p>Elasticsearch exposes all the necessary OpenID Connect related functionality with the OpenID Connect APIs.
|
|
2952
|
+
These APIs are used internally by Kibana in order to provide OpenID Connect based authentication, but can also be used by other, custom web applications or other clients.</p>
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-oidc-prepare-authentication.html>`_
|
|
2956
|
+
|
|
2957
|
+
:param iss: In the case of a third party initiated single sign on, this is the
|
|
2958
|
+
issuer identifier for the OP that the RP is to send the authentication request
|
|
2959
|
+
to. It cannot be specified when *realm* is specified. One of *realm* or *iss*
|
|
2960
|
+
is required.
|
|
2961
|
+
:param login_hint: In the case of a third party initiated single sign on, it
|
|
2962
|
+
is a string value that is included in the authentication request as the *login_hint*
|
|
2963
|
+
parameter. This parameter is not valid when *realm* is specified.
|
|
2964
|
+
:param nonce: The value used to associate a client session with an ID token and
|
|
2965
|
+
to mitigate replay attacks. If the caller of the API does not provide a value,
|
|
2966
|
+
Elasticsearch will generate one with sufficient entropy and return it in
|
|
2967
|
+
the response.
|
|
2968
|
+
:param realm: The name of the OpenID Connect realm in Elasticsearch the configuration
|
|
2969
|
+
of which should be used in order to generate the authentication request.
|
|
2970
|
+
It cannot be specified when *iss* is specified. One of *realm* or *iss* is
|
|
2971
|
+
required.
|
|
2972
|
+
:param state: The value used to maintain state between the authentication request
|
|
2973
|
+
and the response, typically used as a Cross-Site Request Forgery mitigation.
|
|
2974
|
+
If the caller of the API does not provide a value, Elasticsearch will generate
|
|
2975
|
+
one with sufficient entropy and return it in the response.
|
|
2976
|
+
"""
|
|
2977
|
+
__path_parts: t.Dict[str, str] = {}
|
|
2978
|
+
__path = "/_security/oidc/prepare"
|
|
2979
|
+
__query: t.Dict[str, t.Any] = {}
|
|
2980
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2981
|
+
if error_trace is not None:
|
|
2982
|
+
__query["error_trace"] = error_trace
|
|
2983
|
+
if filter_path is not None:
|
|
2984
|
+
__query["filter_path"] = filter_path
|
|
2985
|
+
if human is not None:
|
|
2986
|
+
__query["human"] = human
|
|
2987
|
+
if pretty is not None:
|
|
2988
|
+
__query["pretty"] = pretty
|
|
2989
|
+
if not __body:
|
|
2990
|
+
if iss is not None:
|
|
2991
|
+
__body["iss"] = iss
|
|
2992
|
+
if login_hint is not None:
|
|
2993
|
+
__body["login_hint"] = login_hint
|
|
2994
|
+
if nonce is not None:
|
|
2995
|
+
__body["nonce"] = nonce
|
|
2996
|
+
if realm is not None:
|
|
2997
|
+
__body["realm"] = realm
|
|
2998
|
+
if state is not None:
|
|
2999
|
+
__body["state"] = state
|
|
3000
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
3001
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
3002
|
+
"POST",
|
|
3003
|
+
__path,
|
|
3004
|
+
params=__query,
|
|
3005
|
+
headers=__headers,
|
|
3006
|
+
body=__body,
|
|
3007
|
+
endpoint_id="security.oidc_prepare_authentication",
|
|
3008
|
+
path_parts=__path_parts,
|
|
3009
|
+
)
|
|
3010
|
+
|
|
2329
3011
|
@_rewrite_parameters(
|
|
2330
3012
|
body_name="privileges",
|
|
2331
3013
|
)
|
|
@@ -2345,7 +3027,26 @@ class SecurityClient(NamespacedClient):
|
|
|
2345
3027
|
] = None,
|
|
2346
3028
|
) -> ObjectApiResponse[t.Any]:
|
|
2347
3029
|
"""
|
|
2348
|
-
|
|
3030
|
+
.. raw:: html
|
|
3031
|
+
|
|
3032
|
+
<p>Create or update application privileges.</p>
|
|
3033
|
+
<p>To use this API, you must have one of the following privileges:</p>
|
|
3034
|
+
<ul>
|
|
3035
|
+
<li>The <code>manage_security</code> cluster privilege (or a greater privilege such as <code>all</code>).</li>
|
|
3036
|
+
<li>The "Manage Application Privileges" global privilege for the application being referenced in the request.</li>
|
|
3037
|
+
</ul>
|
|
3038
|
+
<p>Application names are formed from a prefix, with an optional suffix that conform to the following rules:</p>
|
|
3039
|
+
<ul>
|
|
3040
|
+
<li>The prefix must begin with a lowercase ASCII letter.</li>
|
|
3041
|
+
<li>The prefix must contain only ASCII letters or digits.</li>
|
|
3042
|
+
<li>The prefix must be at least 3 characters long.</li>
|
|
3043
|
+
<li>If the suffix exists, it must begin with either a dash <code>-</code> or <code>_</code>.</li>
|
|
3044
|
+
<li>The suffix cannot contain any of the following characters: <code>\\</code>, <code>/</code>, <code>*</code>, <code>?</code>, <code>"</code>, <code><</code>, <code>></code>, <code>|</code>, <code>,</code>, <code>*</code>.</li>
|
|
3045
|
+
<li>No part of the name can contain whitespace.</li>
|
|
3046
|
+
</ul>
|
|
3047
|
+
<p>Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters <code>_</code>, <code>-</code>, and <code>.</code>.</p>
|
|
3048
|
+
<p>Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: <code>/</code>, <code>*</code>, <code>:</code>.</p>
|
|
3049
|
+
|
|
2349
3050
|
|
|
2350
3051
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-put-privileges.html>`_
|
|
2351
3052
|
|
|
@@ -2491,10 +3192,13 @@ class SecurityClient(NamespacedClient):
|
|
|
2491
3192
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2492
3193
|
) -> ObjectApiResponse[t.Any]:
|
|
2493
3194
|
"""
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
3195
|
+
.. raw:: html
|
|
3196
|
+
|
|
3197
|
+
<p>Create or update roles.</p>
|
|
3198
|
+
<p>The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management.
|
|
3199
|
+
The create or update roles API cannot update roles that are defined in roles files.
|
|
3200
|
+
File-based role management is not available in Elastic Serverless.</p>
|
|
3201
|
+
|
|
2498
3202
|
|
|
2499
3203
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-put-role.html>`_
|
|
2500
3204
|
|
|
@@ -2513,7 +3217,10 @@ class SecurityClient(NamespacedClient):
|
|
|
2513
3217
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
2514
3218
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
2515
3219
|
:param remote_cluster: A list of remote cluster permissions entries.
|
|
2516
|
-
:param remote_indices: A list of remote indices permissions entries.
|
|
3220
|
+
:param remote_indices: A list of remote indices permissions entries. NOTE: Remote
|
|
3221
|
+
indices are effective for remote clusters configured with the API key based
|
|
3222
|
+
model. They have no effect for remote clusters configured with the certificate
|
|
3223
|
+
based model.
|
|
2517
3224
|
:param run_as: A list of users that the owners of this role can impersonate.
|
|
2518
3225
|
*Note*: in Serverless, the run-as feature is disabled. For API compatibility,
|
|
2519
3226
|
you can still specify an empty `run_as` field, but a non-empty list will
|
|
@@ -2603,26 +3310,48 @@ class SecurityClient(NamespacedClient):
|
|
|
2603
3310
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2604
3311
|
) -> ObjectApiResponse[t.Any]:
|
|
2605
3312
|
"""
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
3313
|
+
.. raw:: html
|
|
3314
|
+
|
|
3315
|
+
<p>Create or update role mappings.</p>
|
|
3316
|
+
<p>Role mappings define which roles are assigned to each user.
|
|
3317
|
+
Each mapping has rules that identify users and a list of roles that are granted to those users.
|
|
3318
|
+
The role mapping APIs are generally the preferred way to manage role mappings rather than using role mapping files. The create or update role mappings API cannot update role mappings that are defined in role mapping files.</p>
|
|
3319
|
+
<p>NOTE: This API does not create roles. Rather, it maps users to existing roles.
|
|
3320
|
+
Roles can be created by using the create or update roles API or roles files.</p>
|
|
3321
|
+
<p><strong>Role templates</strong></p>
|
|
3322
|
+
<p>The most common use for role mappings is to create a mapping from a known value on the user to a fixed role name.
|
|
3323
|
+
For example, all users in the <code>cn=admin,dc=example,dc=com</code> LDAP group should be given the superuser role in Elasticsearch.
|
|
3324
|
+
The <code>roles</code> field is used for this purpose.</p>
|
|
3325
|
+
<p>For more complex needs, it is possible to use Mustache templates to dynamically determine the names of the roles that should be granted to the user.
|
|
3326
|
+
The <code>role_templates</code> field is used for this purpose.</p>
|
|
3327
|
+
<p>NOTE: To use role templates successfully, the relevant scripting feature must be enabled.
|
|
3328
|
+
Otherwise, all attempts to create a role mapping with role templates fail.</p>
|
|
3329
|
+
<p>All of the user fields that are available in the role mapping rules are also available in the role templates.
|
|
3330
|
+
Thus it is possible to assign a user to a role that reflects their username, their groups, or the name of the realm to which they authenticated.</p>
|
|
3331
|
+
<p>By default a template is evaluated to produce a single string that is the name of the role which should be assigned to the user.
|
|
3332
|
+
If the format of the template is set to "json" then the template is expected to produce a JSON string or an array of JSON strings for the role names.</p>
|
|
3333
|
+
|
|
2614
3334
|
|
|
2615
3335
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-put-role-mapping.html>`_
|
|
2616
3336
|
|
|
2617
|
-
:param name:
|
|
2618
|
-
|
|
2619
|
-
|
|
3337
|
+
:param name: The distinct name that identifies the role mapping. The name is
|
|
3338
|
+
used solely as an identifier to facilitate interaction via the API; it does
|
|
3339
|
+
not affect the behavior of the mapping in any way.
|
|
3340
|
+
:param enabled: Mappings that have `enabled` set to `false` are ignored when
|
|
3341
|
+
role mapping is performed.
|
|
3342
|
+
:param metadata: Additional metadata that helps define which roles are assigned
|
|
3343
|
+
to each user. Within the metadata object, keys beginning with `_` are reserved
|
|
3344
|
+
for system usage.
|
|
2620
3345
|
:param refresh: If `true` (the default) then refresh the affected shards to make
|
|
2621
3346
|
this operation visible to search, if `wait_for` then wait for a refresh to
|
|
2622
3347
|
make this operation visible to search, if `false` then do nothing with refreshes.
|
|
2623
|
-
:param role_templates:
|
|
2624
|
-
|
|
2625
|
-
|
|
3348
|
+
:param role_templates: A list of Mustache templates that will be evaluated to
|
|
3349
|
+
determine the roles names that should granted to the users that match the
|
|
3350
|
+
role mapping rules. Exactly one of `roles` or `role_templates` must be specified.
|
|
3351
|
+
:param roles: A list of role names that are granted to the users that match the
|
|
3352
|
+
role mapping rules. Exactly one of `roles` or `role_templates` must be specified.
|
|
3353
|
+
:param rules: The rules that determine which users should be matched by the mapping.
|
|
3354
|
+
A rule is a logical condition that is expressed by using a JSON DSL.
|
|
2626
3355
|
:param run_as:
|
|
2627
3356
|
"""
|
|
2628
3357
|
if name in SKIP_IN_PATH:
|
|
@@ -2697,23 +3426,41 @@ class SecurityClient(NamespacedClient):
|
|
|
2697
3426
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2698
3427
|
) -> ObjectApiResponse[t.Any]:
|
|
2699
3428
|
"""
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
3429
|
+
.. raw:: html
|
|
3430
|
+
|
|
3431
|
+
<p>Create or update users.</p>
|
|
3432
|
+
<p>Add and update users in the native realm.
|
|
3433
|
+
A password is required for adding a new user but is optional when updating an existing user.
|
|
3434
|
+
To change a user's password without updating any other fields, use the change password API.</p>
|
|
3435
|
+
|
|
2703
3436
|
|
|
2704
3437
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-put-user.html>`_
|
|
2705
3438
|
|
|
2706
|
-
:param username:
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
:param
|
|
2711
|
-
:param
|
|
2712
|
-
:param
|
|
2713
|
-
:param
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
3439
|
+
:param username: An identifier for the user. NOTE: Usernames must be at least
|
|
3440
|
+
1 and no more than 507 characters. They can contain alphanumeric characters
|
|
3441
|
+
(a-z, A-Z, 0-9), spaces, punctuation, and printable symbols in the Basic
|
|
3442
|
+
Latin (ASCII) block. Leading or trailing whitespace is not allowed.
|
|
3443
|
+
:param email: The email of the user.
|
|
3444
|
+
:param enabled: Specifies whether the user is enabled.
|
|
3445
|
+
:param full_name: The full name of the user.
|
|
3446
|
+
:param metadata: Arbitrary metadata that you want to associate with the user.
|
|
3447
|
+
:param password: The user's password. Passwords must be at least 6 characters
|
|
3448
|
+
long. When adding a user, one of `password` or `password_hash` is required.
|
|
3449
|
+
When updating an existing user, the password is optional, so that other fields
|
|
3450
|
+
on the user (such as their roles) may be updated without modifying the user's
|
|
3451
|
+
password
|
|
3452
|
+
:param password_hash: A hash of the user's password. This must be produced using
|
|
3453
|
+
the same hashing algorithm as has been configured for password storage. For
|
|
3454
|
+
more details, see the explanation of the `xpack.security.authc.password_hashing.algorithm`
|
|
3455
|
+
setting in the user cache and password hash algorithm documentation. Using
|
|
3456
|
+
this parameter allows the client to pre-hash the password for performance
|
|
3457
|
+
and/or confidentiality reasons. The `password` parameter and the `password_hash`
|
|
3458
|
+
parameter cannot be used in the same request.
|
|
3459
|
+
:param refresh: Valid values are `true`, `false`, and `wait_for`. These values
|
|
3460
|
+
have the same meaning as in the index API, but the default value for this
|
|
3461
|
+
API is true.
|
|
3462
|
+
:param roles: A set of roles the user has. The roles determine the user's access
|
|
3463
|
+
permissions. To create a user without any roles, specify an empty list (`[]`).
|
|
2717
3464
|
"""
|
|
2718
3465
|
if username in SKIP_IN_PATH:
|
|
2719
3466
|
raise ValueError("Empty value passed for parameter 'username'")
|
|
@@ -2796,8 +3543,15 @@ class SecurityClient(NamespacedClient):
|
|
|
2796
3543
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2797
3544
|
) -> ObjectApiResponse[t.Any]:
|
|
2798
3545
|
"""
|
|
2799
|
-
|
|
2800
|
-
|
|
3546
|
+
.. raw:: html
|
|
3547
|
+
|
|
3548
|
+
<p>Find API keys with a query.</p>
|
|
3549
|
+
<p>Get a paginated list of API keys and their information.
|
|
3550
|
+
You can optionally filter the results with a query.</p>
|
|
3551
|
+
<p>To use this API, you must have at least the <code>manage_own_api_key</code> or the <code>read_security</code> cluster privileges.
|
|
3552
|
+
If you have only the <code>manage_own_api_key</code> privilege, this API returns only the API keys that you own.
|
|
3553
|
+
If you have the <code>read_security</code>, <code>manage_api_key</code>, or greater privileges (including <code>manage_security</code>), this API returns all API keys regardless of ownership.</p>
|
|
3554
|
+
|
|
2801
3555
|
|
|
2802
3556
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-query-api-key.html>`_
|
|
2803
3557
|
|
|
@@ -2813,30 +3567,39 @@ class SecurityClient(NamespacedClient):
|
|
|
2813
3567
|
`terms`, `range`, `date_range`, `missing`, `cardinality`, `value_count`,
|
|
2814
3568
|
`composite`, `filter`, and `filters`. Additionally, aggregations only run
|
|
2815
3569
|
over the same subset of fields that query works with.
|
|
2816
|
-
:param from_:
|
|
2817
|
-
than 10,000 hits using the from and size
|
|
2818
|
-
hits, use the `search_after` parameter.
|
|
3570
|
+
:param from_: The starting document offset. It must not be negative. By default,
|
|
3571
|
+
you cannot page through more than 10,000 hits using the `from` and `size`
|
|
3572
|
+
parameters. To page through more hits, use the `search_after` parameter.
|
|
2819
3573
|
:param query: A query to filter which API keys to return. If the query parameter
|
|
2820
3574
|
is missing, it is equivalent to a `match_all` query. The query supports a
|
|
2821
3575
|
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
|
|
2822
3576
|
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
|
|
2823
3577
|
You can query the following public information associated with an API key:
|
|
2824
3578
|
`id`, `type`, `name`, `creation`, `expiration`, `invalidated`, `invalidation`,
|
|
2825
|
-
`username`, `realm`, and `metadata`.
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
:param
|
|
2831
|
-
|
|
2832
|
-
|
|
3579
|
+
`username`, `realm`, and `metadata`. NOTE: The queryable string values associated
|
|
3580
|
+
with API keys are internally mapped as keywords. Consequently, if no `analyzer`
|
|
3581
|
+
parameter is specified for a `match` query, then the provided match query
|
|
3582
|
+
string is interpreted as a single keyword value. Such a match query is hence
|
|
3583
|
+
equivalent to a `term` query.
|
|
3584
|
+
:param search_after: The search after definition.
|
|
3585
|
+
:param size: The number of hits to return. It must not be negative. The `size`
|
|
3586
|
+
parameter can be set to `0`, in which case no API key matches are returned,
|
|
3587
|
+
only the aggregation results. By default, you cannot page through more than
|
|
3588
|
+
10,000 hits using the `from` and `size` parameters. To page through more
|
|
3589
|
+
hits, use the `search_after` parameter.
|
|
3590
|
+
:param sort: The sort definition. Other than `id`, all public fields of an API
|
|
3591
|
+
key are eligible for sorting. In addition, sort can also be applied to the
|
|
3592
|
+
`_doc` field to sort by index order.
|
|
2833
3593
|
:param typed_keys: Determines whether aggregation names are prefixed by their
|
|
2834
3594
|
respective types in the response.
|
|
2835
3595
|
:param with_limited_by: Return the snapshot of the owner user's role descriptors
|
|
2836
3596
|
associated with the API key. An API key's actual permission is the intersection
|
|
2837
|
-
of its assigned role descriptors and the owner user's role descriptors
|
|
2838
|
-
|
|
2839
|
-
|
|
3597
|
+
of its assigned role descriptors and the owner user's role descriptors (effectively
|
|
3598
|
+
limited by it). An API key cannot retrieve any API key’s limited-by role
|
|
3599
|
+
descriptors (including itself) unless it has `manage_api_key` or higher privileges.
|
|
3600
|
+
:param with_profile_uid: Determines whether to also retrieve the profile UID
|
|
3601
|
+
for the API key owner principal. If it exists, the profile UID is returned
|
|
3602
|
+
under the `profile_uid` response field for each API key.
|
|
2840
3603
|
"""
|
|
2841
3604
|
__path_parts: t.Dict[str, str] = {}
|
|
2842
3605
|
__path = "/_security/_query/api_key"
|
|
@@ -2923,26 +3686,34 @@ class SecurityClient(NamespacedClient):
|
|
|
2923
3686
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2924
3687
|
) -> ObjectApiResponse[t.Any]:
|
|
2925
3688
|
"""
|
|
2926
|
-
|
|
2927
|
-
|
|
3689
|
+
.. raw:: html
|
|
3690
|
+
|
|
3691
|
+
<p>Find roles with a query.</p>
|
|
3692
|
+
<p>Get roles in a paginated manner.
|
|
3693
|
+
The role management APIs are generally the preferred way to manage roles, rather than using file-based role management.
|
|
3694
|
+
The query roles API does not retrieve roles that are defined in roles files, nor built-in ones.
|
|
3695
|
+
You can optionally filter the results with a query.
|
|
3696
|
+
Also, the results can be paginated and sorted.</p>
|
|
3697
|
+
|
|
2928
3698
|
|
|
2929
3699
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-query-role.html>`_
|
|
2930
3700
|
|
|
2931
|
-
:param from_:
|
|
2932
|
-
than 10,000 hits using the from and size
|
|
2933
|
-
hits, use the `search_after` parameter.
|
|
3701
|
+
:param from_: The starting document offset. It must not be negative. By default,
|
|
3702
|
+
you cannot page through more than 10,000 hits using the `from` and `size`
|
|
3703
|
+
parameters. To page through more hits, use the `search_after` parameter.
|
|
2934
3704
|
:param query: A query to filter which roles to return. If the query parameter
|
|
2935
3705
|
is missing, it is equivalent to a `match_all` query. The query supports a
|
|
2936
3706
|
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
|
|
2937
3707
|
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
|
|
2938
3708
|
You can query the following information associated with roles: `name`, `description`,
|
|
2939
|
-
`metadata`, `applications.application`, `applications.privileges`, `applications.resources`.
|
|
2940
|
-
:param search_after:
|
|
2941
|
-
:param size: The number of hits to return.
|
|
2942
|
-
more than 10,000 hits using the `from` and `size`
|
|
2943
|
-
more hits, use the `search_after` parameter.
|
|
2944
|
-
:param sort:
|
|
2945
|
-
sort can also be applied to the `_doc` field to sort by index
|
|
3709
|
+
`metadata`, `applications.application`, `applications.privileges`, and `applications.resources`.
|
|
3710
|
+
:param search_after: The search after definition.
|
|
3711
|
+
:param size: The number of hits to return. It must not be negative. By default,
|
|
3712
|
+
you cannot page through more than 10,000 hits using the `from` and `size`
|
|
3713
|
+
parameters. To page through more hits, use the `search_after` parameter.
|
|
3714
|
+
:param sort: The sort definition. You can sort on `username`, `roles`, or `enabled`.
|
|
3715
|
+
In addition, sort can also be applied to the `_doc` field to sort by index
|
|
3716
|
+
order.
|
|
2946
3717
|
"""
|
|
2947
3718
|
__path_parts: t.Dict[str, str] = {}
|
|
2948
3719
|
__path = "/_security/_query/role"
|
|
@@ -3009,28 +3780,35 @@ class SecurityClient(NamespacedClient):
|
|
|
3009
3780
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3010
3781
|
) -> ObjectApiResponse[t.Any]:
|
|
3011
3782
|
"""
|
|
3012
|
-
|
|
3013
|
-
|
|
3783
|
+
.. raw:: html
|
|
3784
|
+
|
|
3785
|
+
<p>Find users with a query.</p>
|
|
3786
|
+
<p>Get information for users in a paginated manner.
|
|
3787
|
+
You can optionally filter the results with a query.</p>
|
|
3788
|
+
<p>NOTE: As opposed to the get user API, built-in users are excluded from the result.
|
|
3789
|
+
This API is only for native users.</p>
|
|
3790
|
+
|
|
3014
3791
|
|
|
3015
3792
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-query-user.html>`_
|
|
3016
3793
|
|
|
3017
|
-
:param from_:
|
|
3018
|
-
than 10,000 hits using the from and size
|
|
3019
|
-
hits, use the `search_after` parameter.
|
|
3794
|
+
:param from_: The starting document offset. It must not be negative. By default,
|
|
3795
|
+
you cannot page through more than 10,000 hits using the `from` and `size`
|
|
3796
|
+
parameters. To page through more hits, use the `search_after` parameter.
|
|
3020
3797
|
:param query: A query to filter which users to return. If the query parameter
|
|
3021
3798
|
is missing, it is equivalent to a `match_all` query. The query supports a
|
|
3022
3799
|
subset of query types, including `match_all`, `bool`, `term`, `terms`, `match`,
|
|
3023
3800
|
`ids`, `prefix`, `wildcard`, `exists`, `range`, and `simple_query_string`.
|
|
3024
3801
|
You can query the following information associated with user: `username`,
|
|
3025
|
-
`roles`, `enabled`
|
|
3026
|
-
:param search_after:
|
|
3027
|
-
:param size: The number of hits to return.
|
|
3028
|
-
more than 10,000 hits using the `from` and `size`
|
|
3029
|
-
more hits, use the `search_after` parameter.
|
|
3030
|
-
:param sort: Fields eligible for sorting are: username
|
|
3031
|
-
sort can also be applied to the `_doc` field
|
|
3032
|
-
|
|
3033
|
-
|
|
3802
|
+
`roles`, `enabled`, `full_name`, and `email`.
|
|
3803
|
+
:param search_after: The search after definition
|
|
3804
|
+
:param size: The number of hits to return. It must not be negative. By default,
|
|
3805
|
+
you cannot page through more than 10,000 hits using the `from` and `size`
|
|
3806
|
+
parameters. To page through more hits, use the `search_after` parameter.
|
|
3807
|
+
:param sort: The sort definition. Fields eligible for sorting are: `username`,
|
|
3808
|
+
`roles`, `enabled`. In addition, sort can also be applied to the `_doc` field
|
|
3809
|
+
to sort by index order.
|
|
3810
|
+
:param with_profile_uid: Determines whether to retrieve the user profile UID,
|
|
3811
|
+
if it exists, for the users.
|
|
3034
3812
|
"""
|
|
3035
3813
|
__path_parts: t.Dict[str, str] = {}
|
|
3036
3814
|
__path = "/_security/_query/user"
|
|
@@ -3088,13 +3866,27 @@ class SecurityClient(NamespacedClient):
|
|
|
3088
3866
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3089
3867
|
) -> ObjectApiResponse[t.Any]:
|
|
3090
3868
|
"""
|
|
3091
|
-
|
|
3869
|
+
.. raw:: html
|
|
3870
|
+
|
|
3871
|
+
<p>Authenticate SAML.</p>
|
|
3872
|
+
<p>Submit a SAML response message to Elasticsearch for consumption.</p>
|
|
3873
|
+
<p>NOTE: This API is intended for use by custom web applications other than Kibana.
|
|
3874
|
+
If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.</p>
|
|
3875
|
+
<p>The SAML message that is submitted can be:</p>
|
|
3876
|
+
<ul>
|
|
3877
|
+
<li>A response to a SAML authentication request that was previously created using the SAML prepare authentication API.</li>
|
|
3878
|
+
<li>An unsolicited SAML message in the case of an IdP-initiated single sign-on (SSO) flow.</li>
|
|
3879
|
+
</ul>
|
|
3880
|
+
<p>In either case, the SAML message needs to be a base64 encoded XML document with a root element of <code><Response></code>.</p>
|
|
3881
|
+
<p>After successful validation, Elasticsearch responds with an Elasticsearch internal access token and refresh token that can be subsequently used for authentication.
|
|
3882
|
+
This API endpoint essentially exchanges SAML responses that indicate successful authentication in the IdP for Elasticsearch access and refresh tokens, which can be used for authentication against Elasticsearch.</p>
|
|
3883
|
+
|
|
3092
3884
|
|
|
3093
3885
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-saml-authenticate.html>`_
|
|
3094
3886
|
|
|
3095
|
-
:param content: The SAML response as it was sent by the user
|
|
3887
|
+
:param content: The SAML response as it was sent by the user's browser, usually
|
|
3096
3888
|
a Base64 encoded XML document.
|
|
3097
|
-
:param ids: A
|
|
3889
|
+
:param ids: A JSON array with all the valid SAML Request Ids that the caller
|
|
3098
3890
|
of the API has for the current user.
|
|
3099
3891
|
:param realm: The name of the realm that should authenticate the SAML response.
|
|
3100
3892
|
Useful in cases where many SAML realms are defined.
|
|
@@ -3150,11 +3942,22 @@ class SecurityClient(NamespacedClient):
|
|
|
3150
3942
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3151
3943
|
) -> ObjectApiResponse[t.Any]:
|
|
3152
3944
|
"""
|
|
3153
|
-
|
|
3945
|
+
.. raw:: html
|
|
3946
|
+
|
|
3947
|
+
<p>Logout of SAML completely.</p>
|
|
3948
|
+
<p>Verifies the logout response sent from the SAML IdP.</p>
|
|
3949
|
+
<p>NOTE: This API is intended for use by custom web applications other than Kibana.
|
|
3950
|
+
If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.</p>
|
|
3951
|
+
<p>The SAML IdP may send a logout response back to the SP after handling the SP-initiated SAML Single Logout.
|
|
3952
|
+
This API verifies the response by ensuring the content is relevant and validating its signature.
|
|
3953
|
+
An empty response is returned if the verification process is successful.
|
|
3954
|
+
The response can be sent by the IdP with either the HTTP-Redirect or the HTTP-Post binding.
|
|
3955
|
+
The caller of this API must prepare the request accordingly so that this API can handle either of them.</p>
|
|
3956
|
+
|
|
3154
3957
|
|
|
3155
3958
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-saml-complete-logout.html>`_
|
|
3156
3959
|
|
|
3157
|
-
:param ids: A
|
|
3960
|
+
:param ids: A JSON array with all the valid SAML Request Ids that the caller
|
|
3158
3961
|
of the API has for the current user.
|
|
3159
3962
|
:param realm: The name of the SAML realm in Elasticsearch for which the configuration
|
|
3160
3963
|
is used to verify the logout response.
|
|
@@ -3216,25 +4019,35 @@ class SecurityClient(NamespacedClient):
|
|
|
3216
4019
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3217
4020
|
) -> ObjectApiResponse[t.Any]:
|
|
3218
4021
|
"""
|
|
3219
|
-
|
|
4022
|
+
.. raw:: html
|
|
4023
|
+
|
|
4024
|
+
<p>Invalidate SAML.</p>
|
|
4025
|
+
<p>Submit a SAML LogoutRequest message to Elasticsearch for consumption.</p>
|
|
4026
|
+
<p>NOTE: This API is intended for use by custom web applications other than Kibana.
|
|
4027
|
+
If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.</p>
|
|
4028
|
+
<p>The logout request comes from the SAML IdP during an IdP initiated Single Logout.
|
|
4029
|
+
The custom web application can use this API to have Elasticsearch process the <code>LogoutRequest</code>.
|
|
4030
|
+
After successful validation of the request, Elasticsearch invalidates the access token and refresh token that corresponds to that specific SAML principal and provides a URL that contains a SAML LogoutResponse message.
|
|
4031
|
+
Thus the user can be redirected back to their IdP.</p>
|
|
4032
|
+
|
|
3220
4033
|
|
|
3221
4034
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-saml-invalidate.html>`_
|
|
3222
4035
|
|
|
3223
4036
|
:param query_string: The query part of the URL that the user was redirected to
|
|
3224
4037
|
by the SAML IdP to initiate the Single Logout. This query should include
|
|
3225
|
-
a single parameter named SAMLRequest that contains a SAML logout request
|
|
4038
|
+
a single parameter named `SAMLRequest` that contains a SAML logout request
|
|
3226
4039
|
that is deflated and Base64 encoded. If the SAML IdP has signed the logout
|
|
3227
|
-
request, the URL should include two extra parameters named SigAlg and Signature
|
|
4040
|
+
request, the URL should include two extra parameters named `SigAlg` and `Signature`
|
|
3228
4041
|
that contain the algorithm used for the signature and the signature value
|
|
3229
|
-
itself. In order for Elasticsearch to be able to verify the IdP
|
|
3230
|
-
the value of the query_string field must be an exact match to the string
|
|
4042
|
+
itself. In order for Elasticsearch to be able to verify the IdP's signature,
|
|
4043
|
+
the value of the `query_string` field must be an exact match to the string
|
|
3231
4044
|
provided by the browser. The client application must not attempt to parse
|
|
3232
4045
|
or process the string in any way.
|
|
3233
4046
|
:param acs: The Assertion Consumer Service URL that matches the one of the SAML
|
|
3234
4047
|
realm in Elasticsearch that should be used. You must specify either this
|
|
3235
|
-
parameter or the realm parameter.
|
|
4048
|
+
parameter or the `realm` parameter.
|
|
3236
4049
|
:param realm: The name of the SAML realm in Elasticsearch the configuration.
|
|
3237
|
-
You must specify either this parameter or the acs parameter.
|
|
4050
|
+
You must specify either this parameter or the `acs` parameter.
|
|
3238
4051
|
"""
|
|
3239
4052
|
if query_string is None and body is None:
|
|
3240
4053
|
raise ValueError("Empty value passed for parameter 'query_string'")
|
|
@@ -3283,13 +4096,21 @@ class SecurityClient(NamespacedClient):
|
|
|
3283
4096
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3284
4097
|
) -> ObjectApiResponse[t.Any]:
|
|
3285
4098
|
"""
|
|
3286
|
-
|
|
4099
|
+
.. raw:: html
|
|
4100
|
+
|
|
4101
|
+
<p>Logout of SAML.</p>
|
|
4102
|
+
<p>Submits a request to invalidate an access token and refresh token.</p>
|
|
4103
|
+
<p>NOTE: This API is intended for use by custom web applications other than Kibana.
|
|
4104
|
+
If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.</p>
|
|
4105
|
+
<p>This API invalidates the tokens that were generated for a user by the SAML authenticate API.
|
|
4106
|
+
If the SAML realm in Elasticsearch is configured accordingly and the SAML IdP supports this, the Elasticsearch response contains a URL to redirect the user to the IdP that contains a SAML logout request (starting an SP-initiated SAML Single Logout).</p>
|
|
4107
|
+
|
|
3287
4108
|
|
|
3288
4109
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-saml-logout.html>`_
|
|
3289
4110
|
|
|
3290
4111
|
:param token: The access token that was returned as a response to calling the
|
|
3291
4112
|
SAML authenticate API. Alternatively, the most recent token that was received
|
|
3292
|
-
after refreshing the original one by using a refresh_token
|
|
4113
|
+
after refreshing the original one by using a `refresh_token`.
|
|
3293
4114
|
:param refresh_token: The refresh token that was returned as a response to calling
|
|
3294
4115
|
the SAML authenticate API. Alternatively, the most recent refresh token that
|
|
3295
4116
|
was received after refreshing the original access token.
|
|
@@ -3340,19 +4161,31 @@ class SecurityClient(NamespacedClient):
|
|
|
3340
4161
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3341
4162
|
) -> ObjectApiResponse[t.Any]:
|
|
3342
4163
|
"""
|
|
3343
|
-
|
|
3344
|
-
|
|
4164
|
+
.. raw:: html
|
|
4165
|
+
|
|
4166
|
+
<p>Prepare SAML authentication.</p>
|
|
4167
|
+
<p>Create a SAML authentication request (<code><AuthnRequest></code>) as a URL string based on the configuration of the respective SAML realm in Elasticsearch.</p>
|
|
4168
|
+
<p>NOTE: This API is intended for use by custom web applications other than Kibana.
|
|
4169
|
+
If you are using Kibana, refer to the documentation for configuring SAML single-sign-on on the Elastic Stack.</p>
|
|
4170
|
+
<p>This API returns a URL pointing to the SAML Identity Provider.
|
|
4171
|
+
You can use the URL to redirect the browser of the user in order to continue the authentication process.
|
|
4172
|
+
The URL includes a single parameter named <code>SAMLRequest</code>, which contains a SAML Authentication request that is deflated and Base64 encoded.
|
|
4173
|
+
If the configuration dictates that SAML authentication requests should be signed, the URL has two extra parameters named <code>SigAlg</code> and <code>Signature</code>.
|
|
4174
|
+
These parameters contain the algorithm used for the signature and the signature value itself.
|
|
4175
|
+
It also returns a random string that uniquely identifies this SAML Authentication request.
|
|
4176
|
+
The caller of this API needs to store this identifier as it needs to be used in a following step of the authentication process.</p>
|
|
4177
|
+
|
|
3345
4178
|
|
|
3346
4179
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-saml-prepare-authentication.html>`_
|
|
3347
4180
|
|
|
3348
4181
|
:param acs: The Assertion Consumer Service URL that matches the one of the SAML
|
|
3349
4182
|
realms in Elasticsearch. The realm is used to generate the authentication
|
|
3350
|
-
request. You must specify either this parameter or the realm parameter.
|
|
4183
|
+
request. You must specify either this parameter or the `realm` parameter.
|
|
3351
4184
|
:param realm: The name of the SAML realm in Elasticsearch for which the configuration
|
|
3352
4185
|
is used to generate the authentication request. You must specify either this
|
|
3353
|
-
parameter or the acs parameter.
|
|
4186
|
+
parameter or the `acs` parameter.
|
|
3354
4187
|
:param relay_state: A string that will be included in the redirect URL that this
|
|
3355
|
-
API returns as the RelayState query parameter. If the Authentication Request
|
|
4188
|
+
API returns as the `RelayState` query parameter. If the Authentication Request
|
|
3356
4189
|
is signed, this value is used as part of the signature computation.
|
|
3357
4190
|
"""
|
|
3358
4191
|
__path_parts: t.Dict[str, str] = {}
|
|
@@ -3396,8 +4229,13 @@ class SecurityClient(NamespacedClient):
|
|
|
3396
4229
|
pretty: t.Optional[bool] = None,
|
|
3397
4230
|
) -> ObjectApiResponse[t.Any]:
|
|
3398
4231
|
"""
|
|
3399
|
-
|
|
3400
|
-
|
|
4232
|
+
.. raw:: html
|
|
4233
|
+
|
|
4234
|
+
<p>Create SAML service provider metadata.</p>
|
|
4235
|
+
<p>Generate SAML metadata for a SAML 2.0 Service Provider.</p>
|
|
4236
|
+
<p>The SAML 2.0 specification provides a mechanism for Service Providers to describe their capabilities and configuration using a metadata file.
|
|
4237
|
+
This API generates Service Provider metadata based on the configuration of a SAML realm in Elasticsearch.</p>
|
|
4238
|
+
|
|
3401
4239
|
|
|
3402
4240
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-saml-sp-metadata.html>`_
|
|
3403
4241
|
|
|
@@ -3443,22 +4281,30 @@ class SecurityClient(NamespacedClient):
|
|
|
3443
4281
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3444
4282
|
) -> ObjectApiResponse[t.Any]:
|
|
3445
4283
|
"""
|
|
3446
|
-
|
|
3447
|
-
|
|
4284
|
+
.. raw:: html
|
|
4285
|
+
|
|
4286
|
+
<p>Suggest a user profile.</p>
|
|
4287
|
+
<p>Get suggestions for user profiles that match specified search criteria.</p>
|
|
4288
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
|
|
4289
|
+
Individual users and external applications should not call this API directly.
|
|
4290
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
4291
|
+
|
|
3448
4292
|
|
|
3449
4293
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-suggest-user-profile.html>`_
|
|
3450
4294
|
|
|
3451
|
-
:param data:
|
|
3452
|
-
return all content use `data=*`. To return a subset of content
|
|
3453
|
-
to retrieve content nested under the specified `<key>`.
|
|
3454
|
-
no `data` content.
|
|
4295
|
+
:param data: A comma-separated list of filters for the `data` field of the profile
|
|
4296
|
+
document. To return all content use `data=*`. To return a subset of content,
|
|
4297
|
+
use `data=<key>` to retrieve content nested under the specified `<key>`.
|
|
4298
|
+
By default, the API returns no `data` content. It is an error to specify
|
|
4299
|
+
`data` as both the query parameter and the request body field.
|
|
3455
4300
|
:param hint: Extra search criteria to improve relevance of the suggestion result.
|
|
3456
4301
|
Profiles matching the spcified hint are ranked higher in the response. Profiles
|
|
3457
|
-
not matching the hint
|
|
3458
|
-
|
|
3459
|
-
:param name:
|
|
3460
|
-
Name-related fields are the user's `username`, `full_name`, and
|
|
3461
|
-
|
|
4302
|
+
not matching the hint aren't excluded from the response as long as the profile
|
|
4303
|
+
matches the `name` field query.
|
|
4304
|
+
:param name: A query string used to match name-related fields in user profile
|
|
4305
|
+
documents. Name-related fields are the user's `username`, `full_name`, and
|
|
4306
|
+
`email`.
|
|
4307
|
+
:param size: The number of profiles to return.
|
|
3462
4308
|
"""
|
|
3463
4309
|
__path_parts: t.Dict[str, str] = {}
|
|
3464
4310
|
__path = "/_security/profile/_suggest"
|
|
@@ -3513,38 +4359,43 @@ class SecurityClient(NamespacedClient):
|
|
|
3513
4359
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3514
4360
|
) -> ObjectApiResponse[t.Any]:
|
|
3515
4361
|
"""
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
4362
|
+
.. raw:: html
|
|
4363
|
+
|
|
4364
|
+
<p>Update an API key.</p>
|
|
4365
|
+
<p>Update attributes of an existing API key.
|
|
4366
|
+
This API supports updates to an API key's access scope, expiration, and metadata.</p>
|
|
4367
|
+
<p>To use this API, you must have at least the <code>manage_own_api_key</code> cluster privilege.
|
|
4368
|
+
Users can only update API keys that they created or that were granted to them.
|
|
4369
|
+
To update another user’s API key, use the <code>run_as</code> feature to submit a request on behalf of another user.</p>
|
|
4370
|
+
<p>IMPORTANT: It's not possible to use an API key as the authentication credential for this API. The owner user’s credentials are required.</p>
|
|
4371
|
+
<p>Use this API to update API keys created by the create API key or grant API Key APIs.
|
|
4372
|
+
If you need to apply the same update to many API keys, you can use the bulk update API keys API to reduce overhead.
|
|
4373
|
+
It's not possible to update expired API keys or API keys that have been invalidated by the invalidate API key API.</p>
|
|
4374
|
+
<p>The access scope of an API key is derived from the <code>role_descriptors</code> you specify in the request and a snapshot of the owner user's permissions at the time of the request.
|
|
4375
|
+
The snapshot of the owner's permissions is updated automatically on every call.</p>
|
|
4376
|
+
<p>IMPORTANT: If you don't specify <code>role_descriptors</code> in the request, a call to this API might still change the API key's access scope.
|
|
4377
|
+
This change can occur if the owner user's permissions have changed since the API key was created or last modified.</p>
|
|
4378
|
+
|
|
3532
4379
|
|
|
3533
4380
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-update-api-key.html>`_
|
|
3534
4381
|
|
|
3535
4382
|
:param id: The ID of the API key to update.
|
|
3536
|
-
:param expiration:
|
|
4383
|
+
:param expiration: The expiration time for the API key. By default, API keys
|
|
4384
|
+
never expire. This property can be omitted to leave the expiration unchanged.
|
|
3537
4385
|
:param metadata: Arbitrary metadata that you want to associate with the API key.
|
|
3538
|
-
It supports nested data structure. Within the metadata object, keys beginning
|
|
3539
|
-
with _ are reserved for system usage.
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
4386
|
+
It supports a nested data structure. Within the metadata object, keys beginning
|
|
4387
|
+
with `_` are reserved for system usage. When specified, this value fully
|
|
4388
|
+
replaces the metadata previously associated with the API key.
|
|
4389
|
+
:param role_descriptors: The role descriptors to assign to this API key. The
|
|
4390
|
+
API key's effective permissions are an intersection of its assigned privileges
|
|
4391
|
+
and the point in time snapshot of permissions of the owner user. You can
|
|
4392
|
+
assign new privileges by specifying them in this parameter. To remove assigned
|
|
4393
|
+
privileges, you can supply an empty `role_descriptors` parameter, that is
|
|
4394
|
+
to say, an empty object `{}`. If an API key has no assigned privileges, it
|
|
4395
|
+
inherits the owner user's full permissions. The snapshot of the owner's permissions
|
|
4396
|
+
is always updated, whether you supply the `role_descriptors` parameter or
|
|
4397
|
+
not. The structure of a role descriptor is the same as the request for the
|
|
4398
|
+
create API keys API.
|
|
3548
4399
|
"""
|
|
3549
4400
|
if id in SKIP_IN_PATH:
|
|
3550
4401
|
raise ValueError("Empty value passed for parameter 'id'")
|
|
@@ -3599,8 +4450,20 @@ class SecurityClient(NamespacedClient):
|
|
|
3599
4450
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3600
4451
|
) -> ObjectApiResponse[t.Any]:
|
|
3601
4452
|
"""
|
|
3602
|
-
|
|
3603
|
-
|
|
4453
|
+
.. raw:: html
|
|
4454
|
+
|
|
4455
|
+
<p>Update a cross-cluster API key.</p>
|
|
4456
|
+
<p>Update the attributes of an existing cross-cluster API key, which is used for API key based remote cluster access.</p>
|
|
4457
|
+
<p>To use this API, you must have at least the <code>manage_security</code> cluster privilege.
|
|
4458
|
+
Users can only update API keys that they created.
|
|
4459
|
+
To update another user's API key, use the <code>run_as</code> feature to submit a request on behalf of another user.</p>
|
|
4460
|
+
<p>IMPORTANT: It's not possible to use an API key as the authentication credential for this API.
|
|
4461
|
+
To update an API key, the owner user's credentials are required.</p>
|
|
4462
|
+
<p>It's not possible to update expired API keys, or API keys that have been invalidated by the invalidate API key API.</p>
|
|
4463
|
+
<p>This API supports updates to an API key's access scope, metadata, and expiration.
|
|
4464
|
+
The owner user's information, such as the <code>username</code> and <code>realm</code>, is also updated automatically on every call.</p>
|
|
4465
|
+
<p>NOTE: This API cannot update REST API keys, which should be updated by either the update API key or bulk update API keys API.</p>
|
|
4466
|
+
|
|
3604
4467
|
|
|
3605
4468
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-update-cross-cluster-api-key.html>`_
|
|
3606
4469
|
|
|
@@ -3609,8 +4472,8 @@ class SecurityClient(NamespacedClient):
|
|
|
3609
4472
|
of permissions for cross cluster search and cross cluster replication. At
|
|
3610
4473
|
least one of them must be specified. When specified, the new access assignment
|
|
3611
4474
|
fully replaces the previously assigned access.
|
|
3612
|
-
:param expiration:
|
|
3613
|
-
expire. This property can be omitted to leave the value unchanged.
|
|
4475
|
+
:param expiration: The expiration time for the API key. By default, API keys
|
|
4476
|
+
never expire. This property can be omitted to leave the value unchanged.
|
|
3614
4477
|
:param metadata: Arbitrary metadata that you want to associate with the API key.
|
|
3615
4478
|
It supports nested data structure. Within the metadata object, keys beginning
|
|
3616
4479
|
with `_` are reserved for system usage. When specified, this information
|
|
@@ -3650,6 +4513,83 @@ class SecurityClient(NamespacedClient):
|
|
|
3650
4513
|
path_parts=__path_parts,
|
|
3651
4514
|
)
|
|
3652
4515
|
|
|
4516
|
+
@_rewrite_parameters(
|
|
4517
|
+
body_fields=("security", "security_profile", "security_tokens"),
|
|
4518
|
+
parameter_aliases={
|
|
4519
|
+
"security-profile": "security_profile",
|
|
4520
|
+
"security-tokens": "security_tokens",
|
|
4521
|
+
},
|
|
4522
|
+
)
|
|
4523
|
+
async def update_settings(
|
|
4524
|
+
self,
|
|
4525
|
+
*,
|
|
4526
|
+
error_trace: t.Optional[bool] = None,
|
|
4527
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
4528
|
+
human: t.Optional[bool] = None,
|
|
4529
|
+
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
4530
|
+
pretty: t.Optional[bool] = None,
|
|
4531
|
+
security: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
4532
|
+
security_profile: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
4533
|
+
security_tokens: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
4534
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
4535
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4536
|
+
) -> ObjectApiResponse[t.Any]:
|
|
4537
|
+
"""
|
|
4538
|
+
.. raw:: html
|
|
4539
|
+
|
|
4540
|
+
<p>Update security index settings.</p>
|
|
4541
|
+
<p>Update the user-configurable settings for the security internal index (<code>.security</code> and associated indices). Only a subset of settings are allowed to be modified. This includes <code>index.auto_expand_replicas</code> and <code>index.number_of_replicas</code>.</p>
|
|
4542
|
+
<p>NOTE: If <code>index.auto_expand_replicas</code> is set, <code>index.number_of_replicas</code> will be ignored during updates.</p>
|
|
4543
|
+
<p>If a specific index is not in use on the system and settings are provided for it, the request will be rejected.
|
|
4544
|
+
This API does not yet support configuring the settings for indices before they are in use.</p>
|
|
4545
|
+
|
|
4546
|
+
|
|
4547
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-update-settings.html>`_
|
|
4548
|
+
|
|
4549
|
+
:param master_timeout: The period to wait for a connection to the master node.
|
|
4550
|
+
If no response is received before the timeout expires, the request fails
|
|
4551
|
+
and returns an error.
|
|
4552
|
+
:param security: Settings for the index used for most security configuration,
|
|
4553
|
+
including native realm users and roles configured with the API.
|
|
4554
|
+
:param security_profile: Settings for the index used to store profile information.
|
|
4555
|
+
:param security_tokens: Settings for the index used to store tokens.
|
|
4556
|
+
:param timeout: The period to wait for a response. If no response is received
|
|
4557
|
+
before the timeout expires, the request fails and returns an error.
|
|
4558
|
+
"""
|
|
4559
|
+
__path_parts: t.Dict[str, str] = {}
|
|
4560
|
+
__path = "/_security/settings"
|
|
4561
|
+
__query: t.Dict[str, t.Any] = {}
|
|
4562
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
4563
|
+
if error_trace is not None:
|
|
4564
|
+
__query["error_trace"] = error_trace
|
|
4565
|
+
if filter_path is not None:
|
|
4566
|
+
__query["filter_path"] = filter_path
|
|
4567
|
+
if human is not None:
|
|
4568
|
+
__query["human"] = human
|
|
4569
|
+
if master_timeout is not None:
|
|
4570
|
+
__query["master_timeout"] = master_timeout
|
|
4571
|
+
if pretty is not None:
|
|
4572
|
+
__query["pretty"] = pretty
|
|
4573
|
+
if timeout is not None:
|
|
4574
|
+
__query["timeout"] = timeout
|
|
4575
|
+
if not __body:
|
|
4576
|
+
if security is not None:
|
|
4577
|
+
__body["security"] = security
|
|
4578
|
+
if security_profile is not None:
|
|
4579
|
+
__body["security-profile"] = security_profile
|
|
4580
|
+
if security_tokens is not None:
|
|
4581
|
+
__body["security-tokens"] = security_tokens
|
|
4582
|
+
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4583
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
4584
|
+
"PUT",
|
|
4585
|
+
__path,
|
|
4586
|
+
params=__query,
|
|
4587
|
+
headers=__headers,
|
|
4588
|
+
body=__body,
|
|
4589
|
+
endpoint_id="security.update_settings",
|
|
4590
|
+
path_parts=__path_parts,
|
|
4591
|
+
)
|
|
4592
|
+
|
|
3653
4593
|
@_rewrite_parameters(
|
|
3654
4594
|
body_fields=("data", "labels"),
|
|
3655
4595
|
)
|
|
@@ -3671,23 +4611,42 @@ class SecurityClient(NamespacedClient):
|
|
|
3671
4611
|
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3672
4612
|
) -> ObjectApiResponse[t.Any]:
|
|
3673
4613
|
"""
|
|
3674
|
-
|
|
3675
|
-
|
|
4614
|
+
.. raw:: html
|
|
4615
|
+
|
|
4616
|
+
<p>Update user profile data.</p>
|
|
4617
|
+
<p>Update specific data for the user profile that is associated with a unique ID.</p>
|
|
4618
|
+
<p>NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions.
|
|
4619
|
+
Individual users and external applications should not call this API directly.
|
|
4620
|
+
Elastic reserves the right to change or remove this feature in future releases without prior notice.</p>
|
|
4621
|
+
<p>To use this API, you must have one of the following privileges:</p>
|
|
4622
|
+
<ul>
|
|
4623
|
+
<li>The <code>manage_user_profile</code> cluster privilege.</li>
|
|
4624
|
+
<li>The <code>update_profile_data</code> global privilege for the namespaces that are referenced in the request.</li>
|
|
4625
|
+
</ul>
|
|
4626
|
+
<p>This API updates the <code>labels</code> and <code>data</code> fields of an existing user profile document with JSON objects.
|
|
4627
|
+
New keys and their values are added to the profile document and conflicting keys are replaced by data that's included in the request.</p>
|
|
4628
|
+
<p>For both labels and data, content is namespaced by the top-level fields.
|
|
4629
|
+
The <code>update_profile_data</code> global privilege grants privileges for updating only the allowed namespaces.</p>
|
|
4630
|
+
|
|
3676
4631
|
|
|
3677
4632
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/security-api-update-user-profile-data.html>`_
|
|
3678
4633
|
|
|
3679
4634
|
:param uid: A unique identifier for the user profile.
|
|
3680
4635
|
:param data: Non-searchable data that you want to associate with the user profile.
|
|
3681
|
-
This field supports a nested data structure.
|
|
4636
|
+
This field supports a nested data structure. Within the `data` object, top-level
|
|
4637
|
+
keys cannot begin with an underscore (`_`) or contain a period (`.`). The
|
|
4638
|
+
data object is not searchable, but can be retrieved with the get user profile
|
|
4639
|
+
API.
|
|
3682
4640
|
:param if_primary_term: Only perform the operation if the document has this primary
|
|
3683
4641
|
term.
|
|
3684
4642
|
:param if_seq_no: Only perform the operation if the document has this sequence
|
|
3685
4643
|
number.
|
|
3686
4644
|
:param labels: Searchable data that you want to associate with the user profile.
|
|
3687
|
-
This field supports a nested data structure.
|
|
4645
|
+
This field supports a nested data structure. Within the labels object, top-level
|
|
4646
|
+
keys cannot begin with an underscore (`_`) or contain a period (`.`).
|
|
3688
4647
|
:param refresh: If 'true', Elasticsearch refreshes the affected shards to make
|
|
3689
|
-
this operation visible to search
|
|
3690
|
-
make this operation visible to search
|
|
4648
|
+
this operation visible to search. If 'wait_for', it waits for a refresh to
|
|
4649
|
+
make this operation visible to search. If 'false', nothing is done with refreshes.
|
|
3691
4650
|
"""
|
|
3692
4651
|
if uid in SKIP_IN_PATH:
|
|
3693
4652
|
raise ValueError("Empty value passed for parameter 'uid'")
|