NAME
Net::IPA.pm -- Perl 5 interface of the (Free)IPA JSON-RPC API
SYNOPSIS
use Net::IPA;
my $ipa = new Net::IPA(
hostname => 'ipa.server.com',
cacert => '/etc/ipa/ca.cert',
);
# (a) Login can be done via Kerberos
$ipa->login();
# (b) Login can be done via Kerberos (creating the ticket)
$ipa->login(
username => 'admin',
keytab => '/etc/ipa/admin.keytab'
);
# (c) Login can be done using username and password
$ipa->login(
username => 'admin',
password => 'admin-password'
);
# Control error
die $ipa->error if($ipa->error);
# $user_show is of the type Net::IPA::Response
my $user_show = $ipa->user_show('username');
die 'Error: ' . $user_show->error_string() if($user_show->is_error);
# Requests can be batched
use Net::IPA::Methods;
my @users_show = $ipa->batch(
Net::IPA::Methods::user_show('username1'),
Net::IPA::Methods::user_show('username2'),
Net::IPA::Methods::user_show('username3'),
);
foreach my $user_show (@users_show){
# $user_show is of the type Net::IPA::Response
if($user_show->is_error){
print 'Error: ' . $user_show->error_string() . "\n";
next;
}
# Do something
}
For methods look at the Net::IPA::Methods module.