The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::MBUtiny::Collector::Client - Client for access to App::MBUtiny collector server

VIRSION

Version 1.00

SYNOPSIS

    use App::MBUtiny::Collector::Client;

    my $client = new App::MBUtiny::Collector::Client(
        url     => 'http://test:test@localhost/mbutiny', # Base URL
        timeout => 180, # default: 180
        verbose => 1, # Show req/res data
    );

    my $check_struct = $client->check;

    print STDERR $client->error unless $check_status;

DESCRIPTION

Client for access to App::MBUtiny collector server

This module is based on WWW::MLite::Client class

new

    my $client = new App::MBUtiny::Collector::Client(
        url     => 'http://test:test@localhost/mbutiny', # Base URL
        timeout => 180, # default: 180
        verbose => 1, # Show req/res data
    );

Returns the collector client object

timeout

Timeout of requests

Default: 180 sec

url

The Full URL of the collector location

verbose

Verbose flag. 0 = off, 1 = on

Default: 0

See WWW::MLite::Client

add

    $client->add(
        type => 1,
        name => "foo",
        file => "foo-2019-06-25.tar.gz",
        size => 123456,
        md5  => "3a5fb8a1e0564eed5a6f5c4389ec5fa0",
        sha1 => "22d12324fa2256e275761b55d5c063b8d9fc3b95",
        status => 1,
        error => "",
        comment => "Test external fixup"
    ) or die $client->error;

Request for fixupping of backup on collector by name and others parameters.

The method returns status of operation: 0 - Error; 1 - Ok

check

    my $check = $client->check;

Performs the checking of MBUtiny collector server and returns structure in format:

    {
       'description' => 'Check collectors',
       'dsn' => 'dbi:SQLite:dbname=/var/lib/mbutiny/mbutiny.db',
       'error' => '',
       'method' => 'GET',
       'name' => 'check',
       'path' => '/mbutiny',
       'status' => 1,
       'time' => '0.004'
    }

del

    $client->del(
        type => 1,
        name => "foo",
        file => "foo-2019-06-25.tar.gz",
    ) or die $client->error;

Delete file-record from collector

The method returns status of operation: 0 - Error; 1 - Ok

get

    my %info = $client->get(
            name => "foo",
            file => "foo-2019-06-25.tar.gz",
        );

Request for getting information about file on collector by name and filename.

The method returns info-structure. See "get" in App::MBUtiny::Collector::DBI

list

    my @list = $client->list(name => "foo");

Request for getting list of files on collector by name.

The method returns array of info-structures. See "list" in App::MBUtiny::Collector::DBI

report

    my @list = $client->report(start => 123456789);

Request for getting report of backup on collector by name. See "report" in App::MBUtiny::Collector::DBI

request

    my $struct = $client->request();

Performs request to collector server over WWW::MLite::Client

HISTORY

See Changes file

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

App::MBUtiny, WWW::MLite::Client

AUTHOR

Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/