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

Crashplan::Client - Client to the Crashplan PROe server

VERSION

Version 0.002.0

SYNOPSIS

Crashplan::Client allow you to access an Crashplan PROe server (hopefully) in a easy way.

This version only provides a low level API matching part of the server REST API.

This version (0.2.0) provides the new highlevel API which will add syntaxic sugar and more functional goodies in the near future.

What you can do now :

    use Crashplan::Client;

    my $client = Crashplan::Client->new();
    
    my @orgs = $client->orgs;

    my $org = shift @orgs;

    ...

It's planned to offer (NOT IMPLEMENTED YET) something more like :

    use Crashplan::Client;

    my $client = Crashplan::Client->new();
    
    my $org = $client->orgs->first;

    ...

The first lowlevel API is still present

    use Crashplan::Client;

    my $client = Crashplan::Client->new();
    
    $client->GET('/rest/orgs');

    my @orgs = $client->parse_response;

    my $org = shift @orgs;

    ...

SUBROUTINES/METHODS - Highlevel API

new ()

Constructor for the Crashplan::Client class

users ()

    Return all the users entity from the server

    Input  : None

    Output : An array of Crashplan::Client::User

orgs ()

    Return all the orgs entity from the server

    Input  : None

    Output : An array of Crashplan::Client::Org

computers ()

    Return all the computers entity from the server

    Input  : None

    Output : An array of Crashplan::Client::Computer

user ($id)

    Return the user entity whose id is passed as parameter 

    Input  : None

    Output : A Crashplan::Client::User object

computer ($id)

    Return the computer entity whose id is passed as parameter 

    Input  : None

    Output : A Crashplan::Client::Computer object

org ($id)

    Return the org entity whose id is passed as parameter 

    Input  : None

    Output : A Crashplan::Client::Org object

SUBROUTINES/METHODS - Lowlevel API

set_rest_header ($key, $value)

    Set a rest header

    Input  : header, value the name and the value of the header to be set

    Output : None

unset_rest_header ($key)

    Unset a rest header

    Input  : $key the name of the header to be unset

    Output : None

request ($method, $url [,$content, $header_ref])

    Request against the rest API

    Input  :    $method the method to be used (GET, POST, PUT, DELETE)
                $url the url to be used with the server
                $content (OPTIONAL) content of the request
                $header  (OPTIONAL) hash reference of a header

    Output : None
             Will set internal attributes responseCode and responseContent

responseContent ()

    Get the response content (for the previous request)

    Input  : None

    Output : A string with the response as a JSON structure

responseCode ()

    Get the response code (for the previous request)

    Input  : None

    Output : An integer

default_header ()

    Build a default header based on $self object attribute
    In particular user and password attributes are used to
    build the Basic Authentication credentials.

    Input  : None

    Output : A hash ref

GET ($url [,$header])

    GET request against the REST server

    Input  : $url the url to be requested

    Output : None
             The state of the response is store in the internal 'rest' attribute which is 
             currently an REST::Client object

parse_response ()

    Parse a server response to populate Crashplan objects

    Input  : None (use $self->responseContent) 

    Output : Array or single Crashplan::Client::<entity> object based on the 
             previous request answer

_populate ($entity_name, $hashref)

    Return an array of Crashplan::Client::$entity_name objects from the $hashref.

    Input  : Class name

    Output : Array of object

TESTING

To enable testing against a Crashplan server, set the following environment variables before running 'make test' .

TEST_SERVER, TEST_USER, TEST_PASSWORD

AUTHOR

Arnaud (Arhuman) ASSAD, <arnaud.assad at jaguar-network.com>

BUGS

Please report any bugs or feature requests to bug-crashplan-client at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Crashplan-Client. 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 Crashplan::Client

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2011 Arnaud (Arhuman) ASSAD.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO

See http://support.crashplanpro.com/doku.php/api

For a detailed API description.