#!/usr/bin/perl

use strict;
use Data::Dumper;
use freeipa;


# Create new client and login to the ipa server
my $ipaClient=new freeipa;
$ipaClient->set('user', 'admin');
$ipaClient->set('password', 'secret');
$ipaClient->set('baseUrl', 'https://ipa.kreditwerk.de');
$ipaClient->set('version', '2.151');
print "Log into IPA:\n";
$ipaClient->connect();


# Send a ping to see if the server is reachable
print "\nping IPA\n";
my $retObj=$ipaClient->ipaMethod({'method' => 'ping'});
print Dumper $retObj; 


# get all users from IPA
print "\nGet all users\n";
$retObj=$ipaClient->ipaMethod({'method' => 'user_find'});
print Dumper $retObj;


# Logout from the IPA
print "\nLogout from IPA\n";
# It is not necessary, to provide the id, this is simp,y for showing howto provide
# multiple options to the method, that should be called
$retObj=$ipaClient->ipaMethod({'id' => '2', 'method' => 'session_logout'});
print Dumper $retObj;
