NAME
Crashplan::Client - Client to the Crashplan PROe server
VERSION
Version 0.003.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.3.0) extends the new highlevel API which add syntaxic sugar.
What you can do now :
use Crashplan::Client;
my $client = Crashplan::Client->new();
# Get all Orgs entity
my @orgs = $client->orgs;
my $org = shift @orgs;
# Get all Orgs active entity entity
my @orgs = $client->orgs(status => 'Active');
my $org = shift @orgs;
# Modify an org and update the server
$org->name('My Org');
$org->update;
# Create an org and modify it
use Crashplan::Client::Org;
my $neworg = Crashplan::Client::Org->new(name => 'New Org', parentId => 3);
$client->create($neworg);
$neworg->name('No longer new Org');
$neworg->update;
...
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
create
Create an entity entry in the database
users ([$property => $value])
Return all the users entity from the server
Input : $property the property to be used to filter the result list
(currently this can be : id, email, status, username, firstName, lastName, orgId)
$value only the entity matching $property = $value will be returned
Output : An array of Crashplan::Client::User
orgs ([$property => $value])
Return all the orgs entity from the server
Input : $property the property to be used to filter the result list
(currently this can be : id, name, status, parentId)
$value only the entity matching $property = $value will be returned
Output : An array of Crashplan::Client::Org
computers ()
Return all the computers entity from the server
Input : $property the property to be used to filter the result list
(currently this can be : id, name, status, guid, $userid)
$value only the entity matching $property = $value will be returned
Output : An array of Crashplan::Client::Computer
serverstatistics ()
Return all the serverStatistics 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
get_full_header ()
Get the REST header use by the inner REST::Client
Input : None
Output : A hashref to the current REST header
set_header ($key, $value)
Set a rest header
Input : header, value the name and the value of the header to be set
Output : None
unset_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
POST ($url [, $body [,$header]])
POST request against the REST server
Input : $url the url to be requested, $body the content in JSON format
Output : None
The state of the response is store in the internal 'rest' attribute which is
currently an REST::Client object
PUT ($url, [$body [,$header]])
PUT request against the REST server
Input : $url the url to be requested, $body the content in JSON format
Output : None
The state of the response is store in the internal 'rest' attribute which is
currently an REST::Client object
DELETE ($url)
DELETE 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, $crashplanclien)
Return an array of Crashplan::Client::$entity_name objects from the $hashref.
Input : $entity_name = The class name
$hashref = The hash ref used by the constructor
$crashplanclient = the Crashplan::Client reference
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:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
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
For a detailed API description, see http://support.crashplanpro.com/doku.php/api