NAME
AWS::S3::Bucket - Object representation of S3 Buckets
SYNOPSIS
See The SYNOPSIS from AWS::S3 for usage details.
CONSTRUCTOR
Call new()
with the following parameters.
PUBLIC PROPERTIES
s3
Required. An AWS::S3 object.
Read-only.
name
Required. String.
The name of the bucket.
Read-only.
creation_date
String. Returned from the S3 service itself.
Read-only.
acl
String. Returns XML string.
Read-only.
See also PUT Bucket ACL
location_constraint
String. Read-only.
EU
us-west-1
us-west-2
ap-southeast-1
ap-northeast-1
The default value is undef which means 'US'.
See also PUT Bucket
policy
Read-only. String of JSON.
Looks something like this:
{
"Version":"2008-10-17",
"Id":"aaaa-bbbb-cccc-dddd",
"Statement" : [
{
"Effect":"Deny",
"Sid":"1",
"Principal" : {
"AWS":["1-22-333-4444","3-55-678-9100"]
},
"Action":["s3:*"],
"Resource":"arn:aws:s3:::bucket/*",
}
]
}
See also GET Bucket Policy
PUBLIC METHODS
files( page_size => $size, page_number => $number, [[marker => $marker,] pattern => qr/$pattern/ ] )
Returns a AWS::S3::FileIterator object with the supplied arguments.
Use the AWS::S3::FileIterator to page through your results.
file( $key )
Finds the file with that $key
and returns an AWS::S3::File object for it.
delete_multi( \@keys )
Given an ArrayRef of the keys you want to delete, delete_multi
can only delete up to 1000 keys at once. Empty your buckets for deletion quickly like this:
my $deleted = 0;
my $bucket = $s->bucket( 'foobar' );
my $iter = $bucket->files( page_size => 1000, page_number => 1 );
while( my @files = $iter->next_page )
{
$bucket->delete_multi( map { $_->key } @files );
$deleted += @files;
# Reset to page 1:
$iter->page_number( 1 );
warn "Deleted $deleted files so far\n";
}# end while()
# NOW you can delete your bucket (if you want) because it's empty:
$bucket->delete;