App-MBUtiny

 view release on metacpan or  search on metacpan

lib/App/MBUtiny/Collector/Client.pm  view on Meta::CPAN

package App::MBUtiny::Collector::Client; # $Id: Client.pm 121 2019-07-01 19:51:50Z abalama $
use strict;
use utf8;

=encoding utf-8

=head1 NAME

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

=head1 VIRSION

Version 1.00

=head1 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;

=head1 DESCRIPTION

Client for access to App::MBUtiny collector server

This module is based on L<WWW::MLite::Client> class

=head2 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

=over 4

=item B<timeout>

Timeout of requests

Default: 180 sec

=item B<url>

The Full URL of the collector location

=item B<verbose>

Verbose flag. 0 = off, 1 = on

Default: 0

=back

See L<WWW::MLite::Client>

=head2 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

=head2 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'
    }

=head2 del

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

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.966 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )