1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15declare(strict_types = 1);
16
17namespace Elasticsearch\Namespaces;
18
19use Elasticsearch\Namespaces\AbstractNamespace;
20
21/**
22 * Class SecurityNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class SecurityNamespace extends AbstractNamespace
28{
29
30    /**
31     * Enables authentication as a user and retrieve information about the authenticated user.
32     *
33     *
34     * @param array $params Associative array of parameters
35     * @return array
36     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html
37     */
38    public function authenticate(array $params = [])
39    {
40
41        $endpointBuilder = $this->endpoints;
42        $endpoint = $endpointBuilder('Security\Authenticate');
43        $endpoint->setParams($params);
44
45        return $this->performRequest($endpoint);
46    }
47    /**
48     * Changes the passwords of users in the native realm and built-in users.
49     *
50     * $params['username'] = (string) The username of the user to change the password for
51     * $params['refresh']  = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
52     * $params['body']     = (array) the new password for the user (Required)
53     *
54     * @param array $params Associative array of parameters
55     * @return array
56     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-change-password.html
57     */
58    public function changePassword(array $params = [])
59    {
60        $username = $this->extractArgument($params, 'username');
61        $body = $this->extractArgument($params, 'body');
62
63        $endpointBuilder = $this->endpoints;
64        $endpoint = $endpointBuilder('Security\ChangePassword');
65        $endpoint->setParams($params);
66        $endpoint->setUsername($username);
67        $endpoint->setBody($body);
68
69        return $this->performRequest($endpoint);
70    }
71    /**
72     * Clear a subset or all entries from the API key cache.
73     *
74     * $params['ids'] = (list) A comma-separated list of IDs of API keys to clear from the cache
75     *
76     * @param array $params Associative array of parameters
77     * @return array
78     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-api-key-cache.html
79     */
80    public function clearApiKeyCache(array $params = [])
81    {
82        $ids = $this->extractArgument($params, 'ids');
83
84        $endpointBuilder = $this->endpoints;
85        $endpoint = $endpointBuilder('Security\ClearApiKeyCache');
86        $endpoint->setParams($params);
87        $endpoint->setIds($ids);
88
89        return $this->performRequest($endpoint);
90    }
91    /**
92     * Evicts application privileges from the native application privileges cache.
93     *
94     * $params['application'] = (list) A comma-separated list of application names
95     *
96     * @param array $params Associative array of parameters
97     * @return array
98     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-privilege-cache.html
99     */
100    public function clearCachedPrivileges(array $params = [])
101    {
102        $application = $this->extractArgument($params, 'application');
103
104        $endpointBuilder = $this->endpoints;
105        $endpoint = $endpointBuilder('Security\ClearCachedPrivileges');
106        $endpoint->setParams($params);
107        $endpoint->setApplication($application);
108
109        return $this->performRequest($endpoint);
110    }
111    /**
112     * Evicts users from the user cache. Can completely clear the cache or evict specific users.
113     *
114     * $params['realms']    = (list) Comma-separated list of realms to clear
115     * $params['usernames'] = (list) Comma-separated list of usernames to clear from the cache
116     *
117     * @param array $params Associative array of parameters
118     * @return array
119     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html
120     */
121    public function clearCachedRealms(array $params = [])
122    {
123        $realms = $this->extractArgument($params, 'realms');
124
125        $endpointBuilder = $this->endpoints;
126        $endpoint = $endpointBuilder('Security\ClearCachedRealms');
127        $endpoint->setParams($params);
128        $endpoint->setRealms($realms);
129
130        return $this->performRequest($endpoint);
131    }
132    /**
133     * Evicts roles from the native role cache.
134     *
135     * $params['name'] = (list) Role name
136     *
137     * @param array $params Associative array of parameters
138     * @return array
139     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-role-cache.html
140     */
141    public function clearCachedRoles(array $params = [])
142    {
143        $name = $this->extractArgument($params, 'name');
144
145        $endpointBuilder = $this->endpoints;
146        $endpoint = $endpointBuilder('Security\ClearCachedRoles');
147        $endpoint->setParams($params);
148        $endpoint->setName($name);
149
150        return $this->performRequest($endpoint);
151    }
152    /**
153     * Evicts tokens from the service account token caches.
154     *
155     * $params['namespace'] = (string) An identifier for the namespace
156     * $params['service']   = (string) An identifier for the service name
157     * $params['name']      = (list) A comma-separated list of service token names
158     *
159     * @param array $params Associative array of parameters
160     * @return array
161     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-service-token-caches.html
162     *
163     * @note This API is BETA and may change in ways that are not backwards compatible
164     *
165     */
166    public function clearCachedServiceTokens(array $params = [])
167    {
168        $namespace = $this->extractArgument($params, 'namespace');
169        $service = $this->extractArgument($params, 'service');
170        $name = $this->extractArgument($params, 'name');
171
172        $endpointBuilder = $this->endpoints;
173        $endpoint = $endpointBuilder('Security\ClearCachedServiceTokens');
174        $endpoint->setParams($params);
175        $endpoint->setNamespace($namespace);
176        $endpoint->setService($service);
177        $endpoint->setName($name);
178
179        return $this->performRequest($endpoint);
180    }
181    /**
182     * Creates an API key for access without requiring basic authentication.
183     *
184     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
185     * $params['body']    = (array) The api key request to create an API key (Required)
186     *
187     * @param array $params Associative array of parameters
188     * @return array
189     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
190     */
191    public function createApiKey(array $params = [])
192    {
193        $body = $this->extractArgument($params, 'body');
194
195        $endpointBuilder = $this->endpoints;
196        $endpoint = $endpointBuilder('Security\CreateApiKey');
197        $endpoint->setParams($params);
198        $endpoint->setBody($body);
199
200        return $this->performRequest($endpoint);
201    }
202    /**
203     * Creates a service account token for access without requiring basic authentication.
204     *
205     * $params['namespace'] = (string) An identifier for the namespace (Required)
206     * $params['service']   = (string) An identifier for the service name (Required)
207     * $params['name']      = (string) An identifier for the token name
208     * $params['refresh']   = (enum) If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
209     *
210     * @param array $params Associative array of parameters
211     * @return array
212     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html
213     *
214     * @note This API is BETA and may change in ways that are not backwards compatible
215     *
216     */
217    public function createServiceToken(array $params = [])
218    {
219        $namespace = $this->extractArgument($params, 'namespace');
220        $service = $this->extractArgument($params, 'service');
221        $name = $this->extractArgument($params, 'name');
222
223        $endpointBuilder = $this->endpoints;
224        $endpoint = $endpointBuilder('Security\CreateServiceToken');
225        $endpoint->setParams($params);
226        $endpoint->setNamespace($namespace);
227        $endpoint->setService($service);
228        $endpoint->setName($name);
229
230        return $this->performRequest($endpoint);
231    }
232    /**
233     * Removes application privileges.
234     *
235     * $params['application'] = (string) Application name
236     * $params['name']        = (string) Privilege name
237     * $params['refresh']     = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
238     *
239     * @param array $params Associative array of parameters
240     * @return array
241     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-privilege.html
242     */
243    public function deletePrivileges(array $params = [])
244    {
245        $application = $this->extractArgument($params, 'application');
246        $name = $this->extractArgument($params, 'name');
247
248        $endpointBuilder = $this->endpoints;
249        $endpoint = $endpointBuilder('Security\DeletePrivileges');
250        $endpoint->setParams($params);
251        $endpoint->setApplication($application);
252        $endpoint->setName($name);
253
254        return $this->performRequest($endpoint);
255    }
256    /**
257     * Removes roles in the native realm.
258     *
259     * $params['name']    = (string) Role name
260     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
261     *
262     * @param array $params Associative array of parameters
263     * @return array
264     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role.html
265     */
266    public function deleteRole(array $params = [])
267    {
268        $name = $this->extractArgument($params, 'name');
269
270        $endpointBuilder = $this->endpoints;
271        $endpoint = $endpointBuilder('Security\DeleteRole');
272        $endpoint->setParams($params);
273        $endpoint->setName($name);
274
275        return $this->performRequest($endpoint);
276    }
277    /**
278     * Removes role mappings.
279     *
280     * $params['name']    = (string) Role-mapping name
281     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
282     *
283     * @param array $params Associative array of parameters
284     * @return array
285     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-role-mapping.html
286     */
287    public function deleteRoleMapping(array $params = [])
288    {
289        $name = $this->extractArgument($params, 'name');
290
291        $endpointBuilder = $this->endpoints;
292        $endpoint = $endpointBuilder('Security\DeleteRoleMapping');
293        $endpoint->setParams($params);
294        $endpoint->setName($name);
295
296        return $this->performRequest($endpoint);
297    }
298    /**
299     * Deletes a service account token.
300     *
301     * $params['namespace'] = (string) An identifier for the namespace
302     * $params['service']   = (string) An identifier for the service name
303     * $params['name']      = (string) An identifier for the token name
304     * $params['refresh']   = (enum) If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` (the default) then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
305     *
306     * @param array $params Associative array of parameters
307     * @return array
308     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-service-token.html
309     *
310     * @note This API is BETA and may change in ways that are not backwards compatible
311     *
312     */
313    public function deleteServiceToken(array $params = [])
314    {
315        $namespace = $this->extractArgument($params, 'namespace');
316        $service = $this->extractArgument($params, 'service');
317        $name = $this->extractArgument($params, 'name');
318
319        $endpointBuilder = $this->endpoints;
320        $endpoint = $endpointBuilder('Security\DeleteServiceToken');
321        $endpoint->setParams($params);
322        $endpoint->setNamespace($namespace);
323        $endpoint->setService($service);
324        $endpoint->setName($name);
325
326        return $this->performRequest($endpoint);
327    }
328    /**
329     * Deletes users from the native realm.
330     *
331     * $params['username'] = (string) username
332     * $params['refresh']  = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
333     *
334     * @param array $params Associative array of parameters
335     * @return array
336     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-user.html
337     */
338    public function deleteUser(array $params = [])
339    {
340        $username = $this->extractArgument($params, 'username');
341
342        $endpointBuilder = $this->endpoints;
343        $endpoint = $endpointBuilder('Security\DeleteUser');
344        $endpoint->setParams($params);
345        $endpoint->setUsername($username);
346
347        return $this->performRequest($endpoint);
348    }
349    /**
350     * Disables users in the native realm.
351     *
352     * $params['username'] = (string) The username of the user to disable
353     * $params['refresh']  = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
354     *
355     * @param array $params Associative array of parameters
356     * @return array
357     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-disable-user.html
358     */
359    public function disableUser(array $params = [])
360    {
361        $username = $this->extractArgument($params, 'username');
362
363        $endpointBuilder = $this->endpoints;
364        $endpoint = $endpointBuilder('Security\DisableUser');
365        $endpoint->setParams($params);
366        $endpoint->setUsername($username);
367
368        return $this->performRequest($endpoint);
369    }
370    /**
371     * Enables users in the native realm.
372     *
373     * $params['username'] = (string) The username of the user to enable
374     * $params['refresh']  = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
375     *
376     * @param array $params Associative array of parameters
377     * @return array
378     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-enable-user.html
379     */
380    public function enableUser(array $params = [])
381    {
382        $username = $this->extractArgument($params, 'username');
383
384        $endpointBuilder = $this->endpoints;
385        $endpoint = $endpointBuilder('Security\EnableUser');
386        $endpoint->setParams($params);
387        $endpoint->setUsername($username);
388
389        return $this->performRequest($endpoint);
390    }
391    /**
392     * Retrieves information for one or more API keys.
393     *
394     * $params['id']         = (string) API key id of the API key to be retrieved
395     * $params['name']       = (string) API key name of the API key to be retrieved
396     * $params['username']   = (string) user name of the user who created this API key to be retrieved
397     * $params['realm_name'] = (string) realm name of the user who created this API key to be retrieved
398     * $params['owner']      = (boolean) flag to query API keys owned by the currently authenticated user (Default = false)
399     *
400     * @param array $params Associative array of parameters
401     * @return array
402     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html
403     */
404    public function getApiKey(array $params = [])
405    {
406
407        $endpointBuilder = $this->endpoints;
408        $endpoint = $endpointBuilder('Security\GetApiKey');
409        $endpoint->setParams($params);
410
411        return $this->performRequest($endpoint);
412    }
413    /**
414     * Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch.
415     *
416     *
417     * @param array $params Associative array of parameters
418     * @return array
419     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-builtin-privileges.html
420     */
421    public function getBuiltinPrivileges(array $params = [])
422    {
423
424        $endpointBuilder = $this->endpoints;
425        $endpoint = $endpointBuilder('Security\GetBuiltinPrivileges');
426        $endpoint->setParams($params);
427
428        return $this->performRequest($endpoint);
429    }
430    /**
431     * Retrieves application privileges.
432     *
433     * $params['application'] = (string) Application name
434     * $params['name']        = (string) Privilege name
435     *
436     * @param array $params Associative array of parameters
437     * @return array
438     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html
439     */
440    public function getPrivileges(array $params = [])
441    {
442        $application = $this->extractArgument($params, 'application');
443        $name = $this->extractArgument($params, 'name');
444
445        $endpointBuilder = $this->endpoints;
446        $endpoint = $endpointBuilder('Security\GetPrivileges');
447        $endpoint->setParams($params);
448        $endpoint->setApplication($application);
449        $endpoint->setName($name);
450
451        return $this->performRequest($endpoint);
452    }
453    /**
454     * Retrieves roles in the native realm.
455     *
456     * $params['name'] = (list) A comma-separated list of role names
457     *
458     * @param array $params Associative array of parameters
459     * @return array
460     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html
461     */
462    public function getRole(array $params = [])
463    {
464        $name = $this->extractArgument($params, 'name');
465
466        $endpointBuilder = $this->endpoints;
467        $endpoint = $endpointBuilder('Security\GetRole');
468        $endpoint->setParams($params);
469        $endpoint->setName($name);
470
471        return $this->performRequest($endpoint);
472    }
473    /**
474     * Retrieves role mappings.
475     *
476     * $params['name'] = (list) A comma-separated list of role-mapping names
477     *
478     * @param array $params Associative array of parameters
479     * @return array
480     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role-mapping.html
481     */
482    public function getRoleMapping(array $params = [])
483    {
484        $name = $this->extractArgument($params, 'name');
485
486        $endpointBuilder = $this->endpoints;
487        $endpoint = $endpointBuilder('Security\GetRoleMapping');
488        $endpoint->setParams($params);
489        $endpoint->setName($name);
490
491        return $this->performRequest($endpoint);
492    }
493    /**
494     * Retrieves information about service accounts.
495     *
496     * $params['namespace'] = (string) An identifier for the namespace
497     * $params['service']   = (string) An identifier for the service name
498     *
499     * @param array $params Associative array of parameters
500     * @return array
501     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-accounts.html
502     *
503     * @note This API is BETA and may change in ways that are not backwards compatible
504     *
505     */
506    public function getServiceAccounts(array $params = [])
507    {
508        $namespace = $this->extractArgument($params, 'namespace');
509        $service = $this->extractArgument($params, 'service');
510
511        $endpointBuilder = $this->endpoints;
512        $endpoint = $endpointBuilder('Security\GetServiceAccounts');
513        $endpoint->setParams($params);
514        $endpoint->setNamespace($namespace);
515        $endpoint->setService($service);
516
517        return $this->performRequest($endpoint);
518    }
519    /**
520     * Retrieves information of all service credentials for a service account.
521     *
522     * $params['namespace'] = (string) An identifier for the namespace
523     * $params['service']   = (string) An identifier for the service name
524     *
525     * @param array $params Associative array of parameters
526     * @return array
527     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-service-credentials.html
528     *
529     * @note This API is BETA and may change in ways that are not backwards compatible
530     *
531     */
532    public function getServiceCredentials(array $params = [])
533    {
534        $namespace = $this->extractArgument($params, 'namespace');
535        $service = $this->extractArgument($params, 'service');
536
537        $endpointBuilder = $this->endpoints;
538        $endpoint = $endpointBuilder('Security\GetServiceCredentials');
539        $endpoint->setParams($params);
540        $endpoint->setNamespace($namespace);
541        $endpoint->setService($service);
542
543        return $this->performRequest($endpoint);
544    }
545    /**
546     * Creates a bearer token for access without requiring basic authentication.
547     *
548     * $params['body'] = (array) The token request to get (Required)
549     *
550     * @param array $params Associative array of parameters
551     * @return array
552     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html
553     */
554    public function getToken(array $params = [])
555    {
556        $body = $this->extractArgument($params, 'body');
557
558        $endpointBuilder = $this->endpoints;
559        $endpoint = $endpointBuilder('Security\GetToken');
560        $endpoint->setParams($params);
561        $endpoint->setBody($body);
562
563        return $this->performRequest($endpoint);
564    }
565    /**
566     * Retrieves information about users in the native realm and built-in users.
567     *
568     * $params['username'] = (list) A comma-separated list of usernames
569     *
570     * @param array $params Associative array of parameters
571     * @return array
572     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html
573     */
574    public function getUser(array $params = [])
575    {
576        $username = $this->extractArgument($params, 'username');
577
578        $endpointBuilder = $this->endpoints;
579        $endpoint = $endpointBuilder('Security\GetUser');
580        $endpoint->setParams($params);
581        $endpoint->setUsername($username);
582
583        return $this->performRequest($endpoint);
584    }
585    /**
586     * Retrieves security privileges for the logged in user.
587     *
588     *
589     * @param array $params Associative array of parameters
590     * @return array
591     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user-privileges.html
592     */
593    public function getUserPrivileges(array $params = [])
594    {
595
596        $endpointBuilder = $this->endpoints;
597        $endpoint = $endpointBuilder('Security\GetUserPrivileges');
598        $endpoint->setParams($params);
599
600        return $this->performRequest($endpoint);
601    }
602    /**
603     * Creates an API key on behalf of another user.
604     *
605     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
606     * $params['body']    = (array) The api key request to create an API key (Required)
607     *
608     * @param array $params Associative array of parameters
609     * @return array
610     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-grant-api-key.html
611     */
612    public function grantApiKey(array $params = [])
613    {
614        $body = $this->extractArgument($params, 'body');
615
616        $endpointBuilder = $this->endpoints;
617        $endpoint = $endpointBuilder('Security\GrantApiKey');
618        $endpoint->setParams($params);
619        $endpoint->setBody($body);
620
621        return $this->performRequest($endpoint);
622    }
623    /**
624     * Determines whether the specified user has a specified list of privileges.
625     *
626     * $params['user'] = (string) Username
627     * $params['body'] = (array) The privileges to test (Required)
628     *
629     * @param array $params Associative array of parameters
630     * @return array
631     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html
632     */
633    public function hasPrivileges(array $params = [])
634    {
635        $user = $this->extractArgument($params, 'user');
636        $body = $this->extractArgument($params, 'body');
637
638        $endpointBuilder = $this->endpoints;
639        $endpoint = $endpointBuilder('Security\HasPrivileges');
640        $endpoint->setParams($params);
641        $endpoint->setUser($user);
642        $endpoint->setBody($body);
643
644        return $this->performRequest($endpoint);
645    }
646    /**
647     * Invalidates one or more API keys.
648     *
649     * $params['body'] = (array) The api key request to invalidate API key(s) (Required)
650     *
651     * @param array $params Associative array of parameters
652     * @return array
653     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html
654     */
655    public function invalidateApiKey(array $params = [])
656    {
657        $body = $this->extractArgument($params, 'body');
658
659        $endpointBuilder = $this->endpoints;
660        $endpoint = $endpointBuilder('Security\InvalidateApiKey');
661        $endpoint->setParams($params);
662        $endpoint->setBody($body);
663
664        return $this->performRequest($endpoint);
665    }
666    /**
667     * Invalidates one or more access tokens or refresh tokens.
668     *
669     * $params['body'] = (array) The token to invalidate (Required)
670     *
671     * @param array $params Associative array of parameters
672     * @return array
673     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-token.html
674     */
675    public function invalidateToken(array $params = [])
676    {
677        $body = $this->extractArgument($params, 'body');
678
679        $endpointBuilder = $this->endpoints;
680        $endpoint = $endpointBuilder('Security\InvalidateToken');
681        $endpoint->setParams($params);
682        $endpoint->setBody($body);
683
684        return $this->performRequest($endpoint);
685    }
686    /**
687     * Adds or updates application privileges.
688     *
689     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
690     * $params['body']    = (array) The privilege(s) to add (Required)
691     *
692     * @param array $params Associative array of parameters
693     * @return array
694     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html
695     */
696    public function putPrivileges(array $params = [])
697    {
698        $body = $this->extractArgument($params, 'body');
699
700        $endpointBuilder = $this->endpoints;
701        $endpoint = $endpointBuilder('Security\PutPrivileges');
702        $endpoint->setParams($params);
703        $endpoint->setBody($body);
704
705        return $this->performRequest($endpoint);
706    }
707    /**
708     * Adds and updates roles in the native realm.
709     *
710     * $params['name']    = (string) Role name
711     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
712     * $params['body']    = (array) The role to add (Required)
713     *
714     * @param array $params Associative array of parameters
715     * @return array
716     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role.html
717     */
718    public function putRole(array $params = [])
719    {
720        $name = $this->extractArgument($params, 'name');
721        $body = $this->extractArgument($params, 'body');
722
723        $endpointBuilder = $this->endpoints;
724        $endpoint = $endpointBuilder('Security\PutRole');
725        $endpoint->setParams($params);
726        $endpoint->setName($name);
727        $endpoint->setBody($body);
728
729        return $this->performRequest($endpoint);
730    }
731    /**
732     * Creates and updates role mappings.
733     *
734     * $params['name']    = (string) Role-mapping name
735     * $params['refresh'] = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
736     * $params['body']    = (array) The role mapping to add (Required)
737     *
738     * @param array $params Associative array of parameters
739     * @return array
740     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-role-mapping.html
741     */
742    public function putRoleMapping(array $params = [])
743    {
744        $name = $this->extractArgument($params, 'name');
745        $body = $this->extractArgument($params, 'body');
746
747        $endpointBuilder = $this->endpoints;
748        $endpoint = $endpointBuilder('Security\PutRoleMapping');
749        $endpoint->setParams($params);
750        $endpoint->setName($name);
751        $endpoint->setBody($body);
752
753        return $this->performRequest($endpoint);
754    }
755    /**
756     * Adds and updates users in the native realm. These users are commonly referred to as native users.
757     *
758     * $params['username'] = (string) The username of the User
759     * $params['refresh']  = (enum) If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. (Options = true,false,wait_for)
760     * $params['body']     = (array) The user to add (Required)
761     *
762     * @param array $params Associative array of parameters
763     * @return array
764     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html
765     */
766    public function putUser(array $params = [])
767    {
768        $username = $this->extractArgument($params, 'username');
769        $body = $this->extractArgument($params, 'body');
770
771        $endpointBuilder = $this->endpoints;
772        $endpoint = $endpointBuilder('Security\PutUser');
773        $endpoint->setParams($params);
774        $endpoint->setUsername($username);
775        $endpoint->setBody($body);
776
777        return $this->performRequest($endpoint);
778    }
779    /**
780     * Retrieves information for API keys using a subset of query DSL
781     *
782     * $params['body'] = (array) From, size, query, sort and search_after
783     *
784     * @param array $params Associative array of parameters
785     * @return array
786     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-api-key.html
787     */
788    public function queryApiKeys(array $params = [])
789    {
790        $body = $this->extractArgument($params, 'body');
791
792        $endpointBuilder = $this->endpoints;
793        $endpoint = $endpointBuilder('Security\QueryApiKeys');
794        $endpoint->setParams($params);
795        $endpoint->setBody($body);
796
797        return $this->performRequest($endpoint);
798    }
799    /**
800     * Exchanges a SAML Response message for an Elasticsearch access token and refresh token pair
801     *
802     * $params['body'] = (array) The SAML response to authenticate (Required)
803     *
804     * @param array $params Associative array of parameters
805     * @return array
806     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-authenticate.html
807     */
808    public function samlAuthenticate(array $params = [])
809    {
810        $body = $this->extractArgument($params, 'body');
811
812        $endpointBuilder = $this->endpoints;
813        $endpoint = $endpointBuilder('Security\SamlAuthenticate');
814        $endpoint->setParams($params);
815        $endpoint->setBody($body);
816
817        return $this->performRequest($endpoint);
818    }
819    /**
820     * Verifies the logout response sent from the SAML IdP
821     *
822     * $params['body'] = (array) The logout response to verify (Required)
823     *
824     * @param array $params Associative array of parameters
825     * @return array
826     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-complete-logout.html
827     */
828    public function samlCompleteLogout(array $params = [])
829    {
830        $body = $this->extractArgument($params, 'body');
831
832        $endpointBuilder = $this->endpoints;
833        $endpoint = $endpointBuilder('Security\SamlCompleteLogout');
834        $endpoint->setParams($params);
835        $endpoint->setBody($body);
836
837        return $this->performRequest($endpoint);
838    }
839    /**
840     * Consumes a SAML LogoutRequest
841     *
842     * $params['body'] = (array) The LogoutRequest message (Required)
843     *
844     * @param array $params Associative array of parameters
845     * @return array
846     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-invalidate.html
847     */
848    public function samlInvalidate(array $params = [])
849    {
850        $body = $this->extractArgument($params, 'body');
851
852        $endpointBuilder = $this->endpoints;
853        $endpoint = $endpointBuilder('Security\SamlInvalidate');
854        $endpoint->setParams($params);
855        $endpoint->setBody($body);
856
857        return $this->performRequest($endpoint);
858    }
859    /**
860     * Invalidates an access token and a refresh token that were generated via the SAML Authenticate API
861     *
862     * $params['body'] = (array) The tokens to invalidate (Required)
863     *
864     * @param array $params Associative array of parameters
865     * @return array
866     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-logout.html
867     */
868    public function samlLogout(array $params = [])
869    {
870        $body = $this->extractArgument($params, 'body');
871
872        $endpointBuilder = $this->endpoints;
873        $endpoint = $endpointBuilder('Security\SamlLogout');
874        $endpoint->setParams($params);
875        $endpoint->setBody($body);
876
877        return $this->performRequest($endpoint);
878    }
879    /**
880     * Creates a SAML authentication request
881     *
882     * $params['body'] = (array) The realm for which to create the authentication request, identified by either its name or the ACS URL (Required)
883     *
884     * @param array $params Associative array of parameters
885     * @return array
886     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-prepare-authentication.html
887     */
888    public function samlPrepareAuthentication(array $params = [])
889    {
890        $body = $this->extractArgument($params, 'body');
891
892        $endpointBuilder = $this->endpoints;
893        $endpoint = $endpointBuilder('Security\SamlPrepareAuthentication');
894        $endpoint->setParams($params);
895        $endpoint->setBody($body);
896
897        return $this->performRequest($endpoint);
898    }
899    /**
900     * Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider
901     *
902     * $params['realm_name'] = (string) The name of the SAML realm to get the metadata for
903     *
904     * @param array $params Associative array of parameters
905     * @return array
906     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-saml-sp-metadata.html
907     */
908    public function samlServiceProviderMetadata(array $params = [])
909    {
910        $realm_name = $this->extractArgument($params, 'realm_name');
911
912        $endpointBuilder = $this->endpoints;
913        $endpoint = $endpointBuilder('Security\SamlServiceProviderMetadata');
914        $endpoint->setParams($params);
915        $endpoint->setRealmName($realm_name);
916
917        return $this->performRequest($endpoint);
918    }
919}
920