Manta::Client - a Manta client implementation in Perl
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");
Manta::Client communicates with some of the API endpoints defined at https://apidocs.joyent.com/manta/.
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
user
url
key_file
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 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)
path
content
content-type
It returns true on success and false on failure.
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.
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.
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
type
mtime
size
etag
Create a snaplink. It requires two parameters, the path from the source object and the path to the new snaplink.
To install Manta::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Manta::Client
CPAN shell
perl -MCPAN -e shell install Manta::Client
For more information on module installation, please visit the detailed CPAN module installation guide.