Andrew Colin Kissa
and 1 contributors

NAME

Net::BaruwaAPI - Perl bindings for Baruwa REST API

VERSION

Version 0.03

SYNOPSIS

Baruwa Enterprise Edition https://www.baruwa.com is a fully fledged Mail Security solution, based on best of breed open source software packages. It provides protection from spam, viruses, phishing attempts and malware.

This distribution provides easy methods to access Baruwa servers via the REST API.

Check https://www.baruwa.com/docs/api for more details of the REST API. Read Net::BaruwaAPI for API usage.

    use Net::BaruwaAPI;
    my $api = Net::BaruwaAPI->new(
        api_token => 'oauth token',
        api_url => 'https://baruwa.example.com'
    );

DESCRIPTION

This module implements Baruwa Enterprise Editions RESTful API.

ATTRIBUTES

api_token

The OAUTH authorization token.

api_url

The Baruwa server url

METHODS

get_users

    my $data = $api->get_users($page);

    for ($data->{items}) {
        say $_->{username};
    }

Lists user accounts on the server.

More info: https://www.baruwa.com/docs/api/#list-all-accounts.

get_user($userid)

    my $data = $api->get_user($userid);

Arguments:

Int $userid

The user id.

Retrieves the specified user account.

More info: https://www.baruwa.com/docs/api/#retrieve-an-existing-account.

create_user($data)

    my $data = $api->create_user($data);

Arguments:

Str $data{username}

The username.

Str $data{firstname}

The firstname.

Str $data{lastname}

The last name.

Str $data{email}

The email address

Str $data{password1}

The password.

Str $data{password2}

The password confirmation.

Int $data{account_type}

The account type.

Str $data{low_score}

The probable spam score.

Int $data{active}

Account status.

Str $data{timezone}

The user timezone.

Str $data{spam_checks}

Enable spam checks.

Str $data{high_score}

Definite spam score.

Str $data{send_report}

Send reports.

Str $data{domains}

The domains the user belongs to.

Creates a new user account.

More info: https://www.baruwa.com/docs/api/#create-a-new-account.

update_user($data)

    my $data = $api->update_user($data);

Arguments:

Str $data{username}

The username.

Str $data{firstname}

The firstname.

Str $data{lastname}

The last name.

Str $data{email}

The email address

Str $data{password1}

The password.

Str $data{password2}

The password confirmation.

Int $data{account_type}

The account type.

Str $data{low_score}

The probable spam score.

Int $data{active}

Account status.

Str $data{timezone}

The user timezone.

Str $data{spam_checks}

Enable spam checks.

Str $data{high_score}

Definite spam score.

Str $data{send_report}

Send reports.

Str $data{domains}

The domains the user belongs to.

Updates a user account.

More info: https://www.baruwa.com/docs/api/#update-an-account.

delete_user($data)

    my $data = $api->delete_user($data);

Arguments:

Str $data{username}

The username.

Str $data{firstname}

The firstname.

Str $data{lastname}

The last name.

Str $data{email}

The email address

Str $data{password1}

The password.

Str $data{password2}

The password confirmation.

Int $data{account_type}

The account type.

Str $data{low_score}

The probable spam score.

Int $data{active}

Account status.

Str $data{timezone}

The user timezone.

Str $data{spam_checks}

Enable spam checks.

Str $data{high_score}

Definite spam score.

Str $data{send_report}

Send reports.

Str $data{domains}

The domains the user belongs to.

Deletes a user account

More info: https://www.baruwa.com/docs/api/#delete-an-account.

set_user_passwd($userid, $data)

    my $data = $api->set_user_passwd($userid, $data);

Arguments:

Str $data{password1}

The password.

Str $data{password2}

The password confirmation.

Changes a user password.

More info: https://www.baruwa.com/docs/api/#change-a-password.

get_aliases($addressid)

    my $data = $api->get_aliases($addressid);

Arguments:

Int $addressid

The alias address id.

Retrieves a user account's email alias addresses.

create_alias($userid, $data)

my $data = $api->create_alias($userid, $data);

Arguments:

Int $userid

The user id.

Str $data{enabled}

Enable the address.

Str $data{address}

The alias address.

Creates an alias address.

More info: https://www.baruwa.com/docs/api/#create-an-alias-address.

update_alias($addressid, $data)

    my $data = $api->update_alias($addressid, $data);

Arguments:

Int $addressid

The alias address id.

Str $data{enabled}

Enable the address.

Str $data{address}

The alias address.

Updates an alias address.

More info: https://www.baruwa.com/docs/api/#update-an-alias-address.

delete_alias($addressid, $data)

    my $data = $api->delete_alias($addressid, $data);

Deletes an alias address

More info: https://www.baruwa.com/docs/api/#delete-an-alias-address.

get_domains

    my $data = $api->get_domains();

More info: https://www.baruwa.com/docs/api/#list-all-domains.

get_domain($domainid)

    my $data = $api->get_domain($domainid);

create_domain($data)

    my $data = $api->create_domain($data);

update_domain($domainid, $data)

    my $data = $api->update_domain($domainid, $data);

delete_domain($domainid)

    my $data = $api->delete_domain($domainid);

get_domainaliases($domainid)

    my $data = $api->get_domainaliases($domainid);

get_domainalias($domainid, $aliasid)

    my $data = $api->get_domainalias($domainid, $aliasid);

create_domainalias($domainid, $data)

    my $data = $api->create_domainalias($domainid, $data);

update_domainalias($domainid, $aliasid, $data)

    my $data = $api->update_domainalias($domainid, $aliasid, $data);

delete_domainalias($domainid, $aliasid, $data)

    my $data = $api->delete_domainalias($domainid, $aliasid, $data);

get_deliveryservers($domainid)

    my $data = $api->get_deliveryservers($domainid);

get_deliveryserver($domainid, $serverid)

    my $data = $api->get_deliveryserver($domainid, $serverid);

create_deliveryserver($domainid, $data)

    my $data = $api->create_deliveryserver($domainid, $data);

update_deliveryserver($domainid, $serverid, $data)

    my $data = $api->update_deliveryserver($domainid, $serverid, $data);

delete_deliveryserver($domainid, $serverid, $data)

    my $data = $api->delete_deliveryserver($domainid, $serverid, $data);

get_user_deliveryservers($domainid)

    my $data = $api->get_user_deliveryservers($domainid);

get_user_deliveryserver($domainid, $serverid)

    my $data = $api->get_user_deliveryserver($domainid, $serverid);

create_user_deliveryserver($domainid, $data)

    my $data = $api->create_user_deliveryserver($domainid, $data);

update_user_deliveryserver($domainid, $serverid, $data)

    my $data = $api->update_user_deliveryserver($domainid, $serverid, $data);

delete_user_deliveryserver($domainid, $serverid, $data)

    my $data = $api->delete_user_deliveryserver($domainid, $serverid, $data);

get_authservers($domainid)

    my $data = $api->get_authservers($domainid);

get_authserver($domainid, $serverid)

    my $data = $api->get_authserver($domainid, $serverid);

create_authserver($domainid, $data)

    my $data = $api->create_authserver($domainid, $data);

update_authserver($domainid, $serverid, $data)

    my $data = $api->update_authserver($domainid, $serverid, $data);

delete_authserver($domainid, $serverid, $data)

    my $data = $api->delete_authserver($domainid, $serverid, $data);

get_ldapsettings($domainid, $serverid, $settingsid)

    my $data = $api->get_ldapsettings($domainid, $serverid, $settingsid);

create_ldapsettings($domainid, $serverid, $data)

    my $data = $api->create_ldapsettings($domainid, $serverid, $data);

update_ldapsettings($domainid, $serverid, $settingsid, $data)

    my $data = $api->update_ldapsettings($domainid, $serverid, $settingsid, $data);

delete_ldapsettings($domainid, $serverid, $settingsid, $data)

    my $data = $api->delete_ldapsettings($domainid, $serverid, $settingsid, $data);

get_radiussettings($domainid, $serverid, $settingsid)

    my $data = $api->get_radiussettings($domainid, $serverid, $settingsid);

create_radiussettings($domainid, $serverid, $data)

    my $data = $api->create_radiussettings($domainid, $serverid, $data);

update_radiussettings($domainid, $serverid, $settingsid, $data)

    my $data = $api->update_radiussettings($domainid, $serverid, $settingsid, $data);

delete_radiussettings($domainid, $serverid, $settingsid, $data)

    my $data = $api->delete_radiussettings($domainid, $serverid, $settingsid, $data);

get_domain_smarthosts($domainid)

    my $data = $api->get_domain_smarthosts($domainid);

get_domain_smarthost($domainid, $serverid)

    my $data = $api->get_domain_smarthost($domainid, $serverid);

create_domain_smarthost($domainid, $data)

    my $data = $api->create_domain_smarthost($domainid, $data);

update_domain_smarthost($domainid, $serverid, $data)

    my $data = $api->update_domain_smarthost($domainid, $serverid, $data);

delete_domain_smarthost($domainid, $serverid, $data)

    my $data = $api->delete_domain_smarthost($domainid, $serverid, $data);

get_organizations

    my $data = $api->get_organizations();

get_organization($orgid)

    my $data = $api->get_organization($orgid);

create_organization($data)

    my $data = $api->create_organization($data);

update_organization($orgid, $data)

    my $data = $api->update_organization($orgid, $data);

delete_organization($orgid)

    my $data = $api->delete_organization($orgid);

get_fallbackservers($orgid)

    my $data = $api->get_fallbackservers($orgid);

get_fallbackserver($serverid)

    my $data = $api->get_fallbackserver($serverid);

create_fallbackserver($orgid, $data)

    my $data = $api->create_fallbackserver($orgid, $data);

update_fallbackserver($serverid, $data)

    my $data = $api->update_fallbackserver($serverid, $data);

delete_fallbackserver($serverid, $data)

    my $data = $api->delete_fallbackserver($serverid, $data);

get_relay($relayid)

    my $data = $api->get_relay($relayid);

create_relay($orgid, $data)

    my $data = $api->create_relay($orgid, $data);

update_relay($relayid, $data)

    my $data = $api->update_relay($relayid, $data);

delete_relay($relayid, $data)

    my $data = $api->delete_relay($relayid, $data);

get_org_smarthosts($orgid)

    my $data = $api->get_org_smarthosts($orgid);

get_org_smarthost($orgid, $serverid)

    my $data = $api->get_org_smarthost($orgid, $serverid);

create_org_smarthost($orgid, $data)

    my $data = $api->create_org_smarthost($orgid, $data);

update_org_smarthost($orgid, $serverid, $data)

    my $data = $api->update_org_smarthost($orgid, $serverid, $data);

delete_org_smarthost($orgid, $serverid, $data)

    my $data = $api->delete_org_smarthost($orgid, $serverid, $data);

get_status

    my $data = $api->get_status();

AUTHOR

Andrew Colin Kissa, <andrew at topdog.za.net>

BUGS

Please report any bugs or feature requests to bug-net-baruwaapi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-BaruwaAPI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Net::BaruwaAPI

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2015-2019 Andrew Colin Kissa.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.