Backblaze-B2
view release on metacpan or search on metacpan
NAME
Backblaze::B2 - interface to the Backblaze B2 API
SYNOPSIS
METHODS
Backblaze::B2->new %options
version
Allows you to specify the API version. The current default is v1,
which corresponds to the Backblaze B2 API version 1 as documented at
https://www.backblaze.com/b2/docs/.
SETUP
0. Have a telephone / mobile phone number you're willing to share with
Backblaze
1. Register at for Backblaze B2 Cloud Storage at
https://secure.backblaze.com/account_settings.htm?showPhone=true
2. Add the phone number to your account at
https://secure.backblaze.com/account_settings.htm?showPhone=true
3. Enable Two-Factor verification through your phone at
https://secure.backblaze.com/account_settings.htm?showPhone=true
4. Create a JSON file named B2.credentials
This file should live in your home directory with the application key
and the account key:
{ "accountId": "...",
"applicationKey": ".............."
}
NAME
Backblaze::B2::v1 - Backblaze B2 API account
METHODS
->new %options
my $b2 = Backblaze::B2::v1->new(
api => 'Backblaze::B2::v1::Synchronous', # the default
);
Creates a new instance. Depending on whether you pass in
<Backblaze::B2::v1::Synchronous> or <Backblaze::B2::v1::AnyEvent>, you
will get a synchronous or asynchronous API.
The synchronous API is what is documented here, as this is the most
likely use case.
my @buckets = $b2->buckets();
for( @buckets ) {
...
}
The asynchronous API is identical to the synchronous API in spirit, but
will return Promises . These condvars usually return two or more
parameters upon completion:
my $results = $b2->buckets();
$results->then( sub{
my( @buckets ) = @_;
for( @buckets ) {
...
}
}
The asynchronous API puts the burden of error handling into your code.
->buckets
my @buckets = $b2->buckets();
Returns a list of Backblaze::B2::Bucket objects associated with the B2
account.
->bucket_from_id
my @buckets = $b2->bucket_from_id(
'deadbeef'
);
Returns a Backblaze::B2::Bucket object that has the given ID. It does
( run in 0.493 second using v1.01-cache-2.11-cpan-39bf76dae61 )