NAME

Search::Elasticsearch::Plugin::XPack::5_0::Shield - Plugin providing Shield API for Search::Elasticsearch 2.x

VERSION

version 5.00

SYNOPSIS

use Search::Elasticsearch();

my $es = Search::Elasticsearch->new(
    nodes    => \@nodes,
    plugins  => ['XPack'],
    userinfo => "username:password"
);

my $response = $es->shield->authenticate();

DESCRIPTION

This class extends the Search::Elasticsearch client with a shield namespace, to support the API for the Shield plugin for Elasticsearch. In other words, it can be used as follows:

use Search::Elasticsearch();
my $es = Search::Elasticsearch->new(
    nodes    => \@nodes,
    plugins  => ['XPack'],
    userinfo => "username:password"
);

my $response = $es->shield->authenticate();

METHODS

The full documentation for the Shield plugin is available here: http://www.elastic.co/guide/en/shield/current/

authenticate()

$response = $es->shield->authenticate()

The authenticate() method checks that the userinfo is correct and returns a list of which roles are assigned to the user.

See the authenticate docs for more information.

put_user()

$response = $es->shield->put_user(
    username => $username,     # required
    body     => {...}          # required
);

The put_user() method creates a new user or updates an existing user.

See the put_user docs for more information.

get_user()

$response = $es->shield->get_user(
    username => $username | \@usernames     # optional
);

The get_user() method retrieves info for the specified users (or all users).

See the get_user docs for more information.

delete_user()

$response = $es->shield->delete_user(
    username => $username       # required
);

The delete_user() method deletes the specified user.

See the delete_user docs for more information.

clear_cached_realms()

$response = $es->shield->clear_cached_realms(
    realms => $realms       # required  (comma-separated string)
);

The clear_cached_realms() method clears the caches for the specified realms

Query string parameters: usernames

See the clear_cached_realms docs for more information.

put_role()

$response = $es->shield->put_role(
    name => $name,             # required
    body     => {...}          # required
);

The put_role() method creates a new role or updates an existing role.

See the put_role docs for more information.

get_role()

$response = $es->shield->get_role(
    name => $name | \@names     # optional
);

The get_role() method retrieves info for the specified roles (or all roles).

See the get_role docs for more information.

delete_role()

$response = $es->shield->delete_role(
    name => $name       # required
);

The delete_role() method deletes the specified role.

See the delete_role docs for more information.

clear_cached_roles()

$response = $es->shield->clear_cached_roles(
    names => $names       # required  (comma-separated string)
);

The clear_cached_roles() method clears the caches for the specified roles.

See the clear_cached_roles docs for more information.

AUTHOR

Clinton Gormley <drtech@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by Elasticsearch BV.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004