NAME
Net::Google::Storage - Access the Google Storage JSON API (currently experimental).
VERSION
version 0.1.2
SYNOPSIS
my
$gs
= Net::Google::Storage->new(
projectId
=>
$projectId
,
%agent_args
);
See Net::Google::Storage::Agent for a decription of %agent_args
.
my
$buckets
=
$gs
->list_buckets();
my
$bucket
=
$gs
->get_bucket(
$bucket_name
);
my
$new_bucket
=
$gs
->insert_bucket({
id
=>
$new_bucket_name
});
$gs
->delete_bucket(
$bucket_name
);
my
$objects
=
$gs
->list_objects(
$bucket_name
);
my
$object
=
$gs
->get_object(
bucket
=>
$bucket_name
,
object
=>
$object_name
);
$gs
->download_object(
bucket
=>
$bucket_name
,
object
=>
$object_name
,
filename
=>
$filename
);
my
$object
=
$gs
->insert_object(
bucket
=>
$bucket_name
,
object
=> {
name
=>
$object_name
},
filename
=>
$filename
);
$gs
->delete_object(
bucket
=>
$bucket_name
,
object
=>
$object_name
);
DESCRIPTION
Net::Google::Storage is a library for interacting with the JSON version of the Google Storage API, which is currently (as at 2012-09-17) marked as experimental.
This module does not (yet) cover the entire surface of the API, but it is a decent attempt at providing the most important functionality.
See https://developers.google.com/storage/docs/json_api/ for documentation of the API itself.
ATTRIBUTES
projectId
Google's identifier of the project you are accessing. Available from the API Console.
METHODS
new
Constructs a shiny new Net::Google::Storage object. Arguments include projectId
and the attributes of Net::Google::Storage::Agent
list_buckets
Returns an arrayref of Net::Google::Storage::Bucket objects for the current projectId.
get_bucket
Takes a bucket name as the only argument, returns the matching Net::Google::Storage::Bucket object or undef if nothing matches.
insert_bucket
Takes some bucket metadata as the only argument (could be as simple as {id => $bucket_name}
), creates a new bucket and returns the matching Net::Google::Storage::Bucket object.
delete_bucket
Takes a bucket name as the only argument, deletes the bucket.
list_objects
Takes a bucket name as the only argument, returns an arrayref of Net::Google::Storage::Object objects.
get_object
Takes a hash (not hashref) of arguments with keys: bucket and object and returns the matching Net::Google::Storage::Object object (or undef if no match was found).
download_object
Takes a hash (not hashref) of arguments with keys: bucket, object, and filename and downloads the matching object as the desired filename.
Returns undef if the object doesn't exist, true for success.
insert_object
Takes a hash of arguments with keys: bucket, filename and object where object contains the necessary metadata to upload the file, which is, at minimum, the name field.
delete_object
Takes a hash of arguments with keys: bucket and object and deletes the matching object.
AUTHOR
Glenn Fowler <cebjyre@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Glenn Fowler.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.