NAME
Manta::Client - a Manta client implementation in Perl
SYNOPSIS
my $manta = Manta::Client->new(user => $username,
url => "https://us-east.manta.joyent.com",
key_file => "/root/.ssh/id_rsa");
my $object = $manta->get("/$username/stor/file.txt");
$manta->put(path => "/$username/stor/file.txt",
content => $content,
"content-type" => "text/plain");
$manta->rm("$username/stor/file.txt");
$manta->mkdir("/$username/stor/new_directory");
my $files = $manta->ls("$username/stor");
DESCRIPTION
Manta::Client communicates with some of the API endpoints defined at https://apidocs.joyent.com/manta/.
CLASS METHODS
new
This is the constructor method. It requires a hash argument containing three elements: user
- the Manta username; url
- the URL of the Manta API endpoint; and key_file
- the path to an SSH private key file
get
Gets an object. It requires a single argument, the Manta path of the object to retrieve. It returns the contents of the object, or undef on failure.
put
Put an object. It requires a hash argument containing: path
- destination Manta path; content
- contents of the object to be uploaded; and content-type
(optional) - the MIME type of the object (defaults to application/octet-stream)
It returns true on success and false on failure.
rm
Destroy an object. It requires a single argument, the Manta path of the object to destroy. It returns true on success and false on failure.
mkdir
Create a directory. It requires a single argument, the Manta path of the directory to create. It returns true on success and false on failure.
ls
List contents of a directory. It requires a single argument, the Manta path of the directory to list. It returns a hashref (keying on the object path) of hashrefs (or undef on failure). Each hashref has the following keys: type
- the MIME type; mtime
- the modification time in YYYY-mm-ddTHH:MM:ss.sssZ format; size
- size of the object in bytes; and etag
- UUID of the object
ln
Create a snaplink. It requires two parameters, the path from the source object and the path to the new snaplink.
It returns true on success and false on failure.