ict;
use warnings;
use Readonly;
use Data::Dumper;
use Log::Log4perl qw(get_logger :levels);
use JSON::XS;
BEGIN {
unshift(@INC, 'lib');
};
use Net::FreeIPA;
use Net::FreeIPA::API;
use Template
ata.pm and Data.pod from JSON API
GEN_API_DEBUG=1 GEN_API_HOSTNAME=host.example.com ./gen_api/gen_api.pl
=head2 Functions
=over
=item get_api
Get the API from the JSON API.
Args/opts are pas
module_name => $MODULE_NAME,
script_name => $SCRIPT_NAME,
encode_json => sub { return encode_json(Net::FreeIPA::API::Magic::cache(shift));},
check_hash => sub {
::FreeIPA::Request;
# cannout use 'use Types::Serialiser'; it is incompatible with JSON::XS 2.X (eg on EL6)
use JSON::XS;
use Readonly;
use base qw(Exporter);
our @EXPORT_OK = qw(process_args);
#
l;}, # Force internal conversion to float
bool => sub {my $val = shift; return $val ? JSON::XS::true : JSON::XS::false;},
};
# Aliases for each dispatch
Readonly::Hash my %CONVERT_ALIAS => {
ew(@_);
}
=item new
Create new error instance from options, e.g. from a (decoded dereferenced) JSON response.
Arguments are handled by C<set_error>.
=cut
sub new
{
my $this = shift;
my $
:FreeIPA::RPC::VERSION = '3.0.3';
use strict;
use warnings;
use Readonly;
use REST::Client;
use JSON::XS;
use Net::FreeIPA::Error;
use Net::FreeIPA::API::Magic;
use Net::FreeIPA::Request;
use Net::
only my $IPA_URL_LOGIN_KERBEROS => '/ipa/session/login_kerberos';
Readonly my $IPA_URL_JSON => '/ipa/session/json';
Readonly my $IPA_URL_REFERER => '/ipa';
=head1 NAME
Net::FreeIPA::RPC provides RPC
g("Successful login");
# prep JSON REST API
$rc->addHeader("Content-Type", "application/json");
$rc->addHeader("Accept", "applicaton/json");
$rc->addHeader('referer',
bless $self, $class;
return $self;
};
=item post_data
Return the RPC::POST hashref (no JSON encoding).
Returns undef if the id is not defined.
=cut
sub post_data
{
my $self = shift;
I::Magic::VERSION = '3.0.3';
use strict;
use warnings;
use Types::Serialiser; # is used by JSON::XS
use JSON::XS;
use Net::FreeIPA::API::Data;
use Readonly;
use base qw(Exporter);
our @EXPORT_OK
shref, cache (and return) the relevant
(filtered) command data.
C<data> is typically the decoded JSON command response.
=cut
sub cache
{
my ($data) = @_;
my $name = $data->{name};
for
# Get the JSON data from Net::FreeIPA::API::Data
# TODO: get the JSON data from the JSON api
my $data;
my $json = $Net::FreeIPA::API::Data::API_DATA{$name};
if (! $json) {
"v2.230");
use Readonly;
# Generated API data using Net::FreeIPA::API::cache
# All commands are JSON encoded.
Readonly our %API_DATA => {
aci_add => '{"takes_args":[{"required":true,"autof
se,"multivalue":false,"name":"version","type":"unicode","class":"Str"}],"name":"join"}',
json_metadata => '{"takes_args":[{"required":false,"autofill":false,"multivalue":false,"name":"objname
lse,"autofill":false,"multivalue":false,"name":"version","type":"unicode","class":"Str"}],"name":"json_metadata"}',
kra_is_enabled => '{"takes_args":[],"takes_options":[{"required":false,"aut
=pod
=head2 Generated API data version v2.230
=over
=cut
=item aci_add
JSON data for API method aci_add
Create new ACI.
=over
=item Required arguments
=over
=item aciname: ACI na
h C<__> are passed as options to C<Net::FreeIPA::RPC::rpc>.
=back
=back
=cut
=item aci_del
JSON data for API method aci_del
Delete ACI.
=over
=item Required arguments
=over
=item
C<__> are passed as options to C<Net::FreeIPA::RPC::rpc>.
=back
=back
=cut
=item aci_find
JSON data for API method aci_find
Search for ACIs.
Returns a list of ACIs
EXAMPLES:
package Net::FreeIPA;
# dzil abstract
# ABSTRACT: Net::FreeIPA is a perl FreeIPA JSON API client class
$Net::FreeIPA::VERSION = '3.0.3';
use strict;
use warnings;
use Net::FreeIPA::DummyLogger;
use
t::FreeIPA::API
Net::FreeIPA::Common);
=head1 NAME
Net::FreeIPA is a perl FreeIPA JSON API client class
=head1 SYNOPSIS
'ipa user-find' equivalent using API call and basic result pos
rror/warn/info/debug methods)
(e.g. L<LOG::Log4perl>).
=item debugapi
When true, log the JSON POST and JSON reply data with debug.
=back
All other arguments and options are passed to L<Net::FreeIP