| 1 | # Licensed to Elasticsearch B.V under one or more agreements. | ||
| 2 | # Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
| 3 | # See the LICENSE file in the project root for more information | ||
| 4 | |||
| 5 | package Search::Elasticsearch::Client::7_0::Direct::Security; | ||
| 6 | $Search::Elasticsearch::Client::7_0::Direct::Security::VERSION = '7.30_1'; # TRIAL | ||
| 7 | |||
| 8 | $Search::Elasticsearch::Client::7_0::Direct::Security::VERSION = '7.301'; | ||
| 9 | use Moo; | ||
| 10 | with 'Search::Elasticsearch::Client::7_0::Role::API'; | ||
| 11 | with 'Search::Elasticsearch::Role::Client::Direct'; | ||
| 12 | use namespace::clean; | ||
| 13 | |||
| 14 | __PACKAGE__->_install_api('security'); | ||
| 15 | |||
| 16 | 1; | ||
| 17 | |||
| 18 | =pod | ||
| 19 | |||
| 20 | =encoding UTF-8 | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | Search::Elasticsearch::Client::7_0::Direct::Security - Plugin providing Security API for Search::Elasticsearch 7.x | ||
| 25 | |||
| 26 | =head1 VERSION | ||
| 27 | |||
| 28 | version 7.30_1 | ||
| 29 | |||
| 30 | =head1 SYNOPSIS | ||
| 31 | |||
| 32 | my $response = $es->security->authenticate(); | ||
| 33 | |||
| 34 | =head2 DESCRIPTION | ||
| 35 | |||
| 36 | This class extends the L<Search::Elasticsearch> client with a C<security> | ||
| 37 | namespace, to support the | ||
| 38 | L<Security APIs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api.html>. | ||
| 39 | |||
| 40 | The full documentation for the Security feature is available here: | ||
| 41 | L<https://www.elastic.co/guide/en/x-pack/current/xpack-security.html> | ||
| 42 | |||
| 43 | =head1 GENERAL METHODS | ||
| 44 | |||
| 45 | =head2 C<authenticate()> | ||
| 46 | |||
| 47 | $response = $es->security->authenticate() | ||
| 48 | |||
| 49 | The C<authenticate()> method checks that the C<userinfo> is correct and returns | ||
| 50 | a list of which roles are assigned to the user. | ||
| 51 | |||
| 52 | See the L<authenticate docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-authenticate.html> | ||
| 53 | for more information. | ||
| 54 | |||
| 55 | Query string parameters: | ||
| 56 | C<error_trace>, | ||
| 57 | C<human> | ||
| 58 | |||
| 59 | =head2 C<clear_cached_realms()> | ||
| 60 | |||
| 61 | $response = $es->security->clear_cached_realms( | ||
| 62 | realms => $realms # required (comma-separated string) | ||
| 63 | ); | ||
| 64 | |||
| 65 | The C<clear_cached_realms()> method clears the caches for the specified realms | ||
| 66 | |||
| 67 | Query string parameters: | ||
| 68 | C<error_trace>, | ||
| 69 | C<human>, | ||
| 70 | C<usernames> | ||
| 71 | |||
| 72 | See the L<clear_cached_realms docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-clear-cache.html> | ||
| 73 | for more information. | ||
| 74 | |||
| 75 | =head1 USER METHODS | ||
| 76 | |||
| 77 | =head2 C<put_user()> | ||
| 78 | |||
| 79 | $response = $es->security->put_user( | ||
| 80 | username => $username, # required | ||
| 81 | body => {...} # required | ||
| 82 | ); | ||
| 83 | |||
| 84 | The C<put_user()> method creates a new user or updates an existing user. | ||
| 85 | |||
| 86 | See the L<User Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html> | ||
| 87 | for more information. | ||
| 88 | |||
| 89 | Query string parameters: | ||
| 90 | C<error_trace>, | ||
| 91 | C<human> | ||
| 92 | |||
| 93 | =head2 C<get_user()> | ||
| 94 | |||
| 95 | $response = $es->security->get_user( | ||
| 96 | username => $username | \@usernames # optional | ||
| 97 | ); | ||
| 98 | |||
| 99 | The C<get_user()> method retrieves info for the specified users (or all users). | ||
| 100 | |||
| 101 | See the L<User Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html> | ||
| 102 | for more information. | ||
| 103 | |||
| 104 | Query string parameters: | ||
| 105 | C<error_trace>, | ||
| 106 | C<human> | ||
| 107 | |||
| 108 | =head2 C<delete_user()> | ||
| 109 | |||
| 110 | $response = $es->security->delete_user( | ||
| 111 | username => $username # required | ||
| 112 | ); | ||
| 113 | |||
| 114 | The C<delete_user()> method deletes the specified user. | ||
| 115 | |||
| 116 | See the L<User Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html> | ||
| 117 | for more information. | ||
| 118 | |||
| 119 | Query string parameters: | ||
| 120 | C<error_trace>, | ||
| 121 | C<human> | ||
| 122 | |||
| 123 | =head2 C<change_password()> | ||
| 124 | |||
| 125 | $response = $es->security->change_password( | ||
| 126 | username => $username # optional | ||
| 127 | body => { | ||
| 128 | password => $password # required | ||
| 129 | } | ||
| 130 | ) | ||
| 131 | |||
| 132 | The C<change_password()> method changes the password for the specified user. | ||
| 133 | |||
| 134 | See the L<User Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html> | ||
| 135 | for more information. | ||
| 136 | |||
| 137 | =head2 C<disable_user()> | ||
| 138 | |||
| 139 | $response = $es->security->disable_user( | ||
| 140 | username => $username # required | ||
| 141 | ); | ||
| 142 | |||
| 143 | The C<disable_user()> method disables the specified user. | ||
| 144 | |||
| 145 | See the L<User Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html> | ||
| 146 | for more information. | ||
| 147 | |||
| 148 | Query string parameters: | ||
| 149 | C<error_trace>, | ||
| 150 | C<human> | ||
| 151 | |||
| 152 | =head2 C<enable_user()> | ||
| 153 | |||
| 154 | $response = $es->security->enable_user( | ||
| 155 | username => $username # required | ||
| 156 | ); | ||
| 157 | |||
| 158 | The C<enable_user()> method enables the specified user. | ||
| 159 | |||
| 160 | See the L<User Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-users.html> | ||
| 161 | for more information. | ||
| 162 | |||
| 163 | Query string parameters: | ||
| 164 | C<error_trace>, | ||
| 165 | C<human> | ||
| 166 | |||
| 167 | =head1 ROLE METHODS | ||
| 168 | |||
| 169 | =head2 C<put_role()> | ||
| 170 | |||
| 171 | $response = $es->security->put_role( | ||
| 172 | name => $name, # required | ||
| 173 | body => {...} # required | ||
| 174 | ); | ||
| 175 | |||
| 176 | The C<put_role()> method creates a new role or updates an existing role. | ||
| 177 | |||
| 178 | See the L<Role Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-roles.html> | ||
| 179 | for more information. | ||
| 180 | |||
| 181 | Query string parameters: | ||
| 182 | C<error_trace>, | ||
| 183 | C<human> | ||
| 184 | |||
| 185 | =head2 C<get_role()> | ||
| 186 | |||
| 187 | $response = $es->security->get_role( | ||
| 188 | name => $name | \@names # optional | ||
| 189 | ); | ||
| 190 | |||
| 191 | The C<get_role()> method retrieves info for the specified roles (or all roles). | ||
| 192 | |||
| 193 | See the L<Role Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-roles.html> | ||
| 194 | for more information. | ||
| 195 | |||
| 196 | Query string parameters: | ||
| 197 | C<error_trace>, | ||
| 198 | C<human> | ||
| 199 | |||
| 200 | =head2 C<delete_role()> | ||
| 201 | |||
| 202 | $response = $es->security->delete_role( | ||
| 203 | name => $name # required | ||
| 204 | ); | ||
| 205 | |||
| 206 | The C<delete_role()> method deletes the specified role. | ||
| 207 | |||
| 208 | See the L<Role Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-roles.html> | ||
| 209 | for more information. | ||
| 210 | |||
| 211 | Query string parameters: | ||
| 212 | C<error_trace>, | ||
| 213 | C<human> | ||
| 214 | |||
| 215 | =head2 C<clear_cached_roles()> | ||
| 216 | |||
| 217 | $response = $es->security->clear_cached_roles( | ||
| 218 | names => $names # required (comma-separated string) | ||
| 219 | ); | ||
| 220 | |||
| 221 | The C<clear_cached_roles()> method clears the caches for the specified roles. | ||
| 222 | |||
| 223 | See the L<Role Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-roles.html> | ||
| 224 | for more information. | ||
| 225 | |||
| 226 | Query string parameters: | ||
| 227 | C<error_trace>, | ||
| 228 | C<human> | ||
| 229 | |||
| 230 | =head1 ROLE MAPPING METHODS | ||
| 231 | |||
| 232 | =head2 C<put_role_mapping()> | ||
| 233 | |||
| 234 | $response = $es->security->put_role_mapping( | ||
| 235 | name => $name, # required | ||
| 236 | body => {...} # required | ||
| 237 | ); | ||
| 238 | |||
| 239 | The C<put_role_mapping()> method creates a new role mapping or updates an existing role mapping. | ||
| 240 | |||
| 241 | See the L<Role Mapping docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html> | ||
| 242 | for more information. | ||
| 243 | |||
| 244 | Query string parameters: | ||
| 245 | C<error_trace>, | ||
| 246 | C<human> | ||
| 247 | |||
| 248 | =head2 C<get_role_mapping()> | ||
| 249 | |||
| 250 | $response = $es->security->get_role_mapping( | ||
| 251 | name => $name, # optional | ||
| 252 | ); | ||
| 253 | |||
| 254 | The C<get_role_mapping()> method retrieves one or more role mappings. | ||
| 255 | |||
| 256 | See the L<Role Mapping docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html> | ||
| 257 | for more information. | ||
| 258 | |||
| 259 | Query string parameters: | ||
| 260 | C<error_trace>, | ||
| 261 | C<human> | ||
| 262 | |||
| 263 | =head2 C<delete_role_mapping()> | ||
| 264 | |||
| 265 | $response = $es->security->delete_role_mapping( | ||
| 266 | name => $name, # required | ||
| 267 | ); | ||
| 268 | |||
| 269 | The C<delete_role_mapping()> method deletes a role mapping. | ||
| 270 | |||
| 271 | See the L<Role Mapping docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-role-mapping.html> | ||
| 272 | for more information. | ||
| 273 | |||
| 274 | Query string parameters: | ||
| 275 | C<error_trace>, | ||
| 276 | C<human> | ||
| 277 | |||
| 278 | =head1 TOKEN METHODS | ||
| 279 | |||
| 280 | =head2 C<get_token()> | ||
| 281 | |||
| 282 | $response = $es->security->get_token( | ||
| 283 | body => {...} # required | ||
| 284 | ); | ||
| 285 | |||
| 286 | The C<get_token()> method enables you to create bearer tokens for access without | ||
| 287 | requiring basic authentication. | ||
| 288 | |||
| 289 | See the L<Token Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-tokens.html> | ||
| 290 | for more information. | ||
| 291 | |||
| 292 | Query string parameters: | ||
| 293 | C<error_trace>, | ||
| 294 | C<human> | ||
| 295 | |||
| 296 | =head2 C<invalidate_token()> | ||
| 297 | |||
| 298 | $response = $es->security->invalidate_token( | ||
| 299 | body => {...} # required | ||
| 300 | ); | ||
| 301 | |||
| 302 | The C<invalidate_token()> method enables you to invalidate bearer tokens for access without | ||
| 303 | requiring basic authentication. | ||
| 304 | |||
| 305 | See the L<Token Management docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-tokens.html> | ||
| 306 | for more information. | ||
| 307 | |||
| 308 | Query string parameters: | ||
| 309 | C<error_trace>, | ||
| 310 | C<human> | ||
| 311 | |||
| 312 | =head1 API KEY METHODS | ||
| 313 | |||
| 314 | =head2 C<create_api_key()> | ||
| 315 | |||
| 316 | $response = $es->security->create_api_key( | ||
| 317 | body => {...} # required | ||
| 318 | ) | ||
| 319 | |||
| 320 | The C<create_api_key()> API is used to create API keys which can be used for access instead | ||
| 321 | of basic authentication. | ||
| 322 | |||
| 323 | Query string parameters: | ||
| 324 | C<error_trace>, | ||
| 325 | C<filter_path>, | ||
| 326 | C<human>, | ||
| 327 | C<refresh> | ||
| 328 | |||
| 329 | See the L<Create API Key docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html> for more. | ||
| 330 | |||
| 331 | =head2 C<get_api_key()> | ||
| 332 | |||
| 333 | $response = $es->security->get_api_key( | ||
| 334 | id => $id, # optional | ||
| 335 | name => $name, # optional | ||
| 336 | realm_name => $realm, # optional | ||
| 337 | username => $username # optional | ||
| 338 | ) | ||
| 339 | |||
| 340 | The C<get_api_key()> API is used to get information about an API key. | ||
| 341 | |||
| 342 | Query string parameters: | ||
| 343 | C<error_trace>, | ||
| 344 | C<filter_path>, | ||
| 345 | C<human>, | ||
| 346 | C<id>, | ||
| 347 | C<name>, | ||
| 348 | C<realm_name>, | ||
| 349 | C<username> | ||
| 350 | |||
| 351 | See the L<Get API Key docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-api-key.html> for more. | ||
| 352 | |||
| 353 | =head2 C<invalidate_api_key()> | ||
| 354 | |||
| 355 | $response = $es->security->invalidate_api_key( | ||
| 356 | id => $id, # optional | ||
| 357 | name => $name, # optional | ||
| 358 | realm_name => $realm, # optional | ||
| 359 | username => $username # optional | ||
| 360 | ) | ||
| 361 | |||
| 362 | The C<invalidate_api_key()> API is used to invalidate an API key. | ||
| 363 | |||
| 364 | Query string parameters: | ||
| 365 | C<error_trace>, | ||
| 366 | C<filter_path>, | ||
| 367 | C<human>, | ||
| 368 | C<id>, | ||
| 369 | C<name>, | ||
| 370 | C<realm_name>, | ||
| 371 | C<username> | ||
| 372 | |||
| 373 | See the L<Invalidate API Key docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-invalidate-api-key.html> for more. | ||
| 374 | |||
| 375 | =head1 USER PRIVILEGE METHODS | ||
| 376 | |||
| 377 | =head2 C<get_user_privileges()> | ||
| 378 | |||
| 379 | $response = $es->get_user_privileges(); | ||
| 380 | |||
| 381 | The C<get_user_privileges()> method retrieves the privileges granted to the current user. | ||
| 382 | |||
| 383 | Query string parameters: | ||
| 384 | C<error_trace>, | ||
| 385 | C<filter_path>, | ||
| 386 | C<human> | ||
| 387 | |||
| 388 | =head2 C<has_privileges()> | ||
| 389 | $response = $es->has_privileges( | ||
| 390 | user => $user, # optional | ||
| 391 | body => {...} # required | ||
| 392 | ); | ||
| 393 | |||
| 394 | The C<has_privileges()> method checks whether the current or specified user has the listed privileges. | ||
| 395 | |||
| 396 | Query string parameters: | ||
| 397 | C<error_trace>, | ||
| 398 | C<filter_path>, | ||
| 399 | C<human> | ||
| 400 | |||
| 401 | See the L<Has Privileges docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-has-privileges.html> for more. | ||
| 402 | |||
| 403 | =head1 APPLICATION PRIVILEGE METHODS | ||
| 404 | |||
| 405 | =head2 C<put_privileges()> | ||
| 406 | |||
| 407 | $response = $es->put_privileges( | ||
| 408 | application => $application, # required | ||
| 409 | name => $name, # required | ||
| 410 | body => {...} # required | ||
| 411 | ); | ||
| 412 | |||
| 413 | The C<put_privileges()> method creates or updates the named privilege for a particular application. | ||
| 414 | |||
| 415 | Query string parameters: | ||
| 416 | C<error_trace>, | ||
| 417 | C<filter_path>, | ||
| 418 | C<human>, | ||
| 419 | C<refresh> | ||
| 420 | |||
| 421 | See the L<Create or Update Application Privileges docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html> for more. | ||
| 422 | |||
| 423 | =head2 C<get_privileges()> | ||
| 424 | |||
| 425 | $response = $es->get_privileges( | ||
| 426 | application => $application, # required | ||
| 427 | name => $name, # required | ||
| 428 | ); | ||
| 429 | |||
| 430 | The C<get_privileges()> method retrieves the named privilege for a particular application. | ||
| 431 | |||
| 432 | Query string parameters: | ||
| 433 | C<error_trace>, | ||
| 434 | C<filter_path>, | ||
| 435 | C<human> | ||
| 436 | |||
| 437 | See the L<Get Application Privileges docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-privileges.html> for more. | ||
| 438 | |||
| 439 | =head2 C<delete_privileges()> | ||
| 440 | |||
| 441 | $response = $es->delete_privileges( | ||
| 442 | application => $application, # required | ||
| 443 | name => $name, # required | ||
| 444 | ); | ||
| 445 | |||
| 446 | The C<delete_privileges()> method deletes the named privilege for a particular application. | ||
| 447 | |||
| 448 | Query string parameters: | ||
| 449 | C<error_trace>, | ||
| 450 | C<filter_path>, | ||
| 451 | C<human>, | ||
| 452 | C<refresh> | ||
| 453 | |||
| 454 | See the L<Delete Application Privileges docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-delete-privilege.html> for more. | ||
| 455 | |||
| 456 | =head1 AUTHOR | ||
| 457 | |||
| 458 | Enrico Zimuel <enrico.zimuel@elastic.co> | ||
| 459 | |||
| 460 | =head1 COPYRIGHT AND LICENSE | ||
| 461 | |||
| 462 | This software is Copyright (c) 2020 by Elasticsearch BV. | ||
| 463 | |||
| 464 | This is free software, licensed under: | ||
| 465 | |||
| 466 | The Apache License, Version 2.0, January 2004 | ||
| 467 | |||
| 468 | =cut | ||
| 469 | |||
| 470 | __END__ |