NAME

WebService::Rackspace::CloudFiles::Container - Represent a Cloud Files container

DESCRIPTION

This class represents a container in Cloud Files. It is created by calling new_container or container on a WebService::Rackspace::CloudFiles object.

METHODS

name

Returns the name of the container:

say 'have container ' . $container->name;

cdn_enabled

Return true if the container is public.

ttl

The TTL (Time To Live) of the container and its objects.

log_retention

cdn_uri

HTTP CDN URL to container, only applies when the container is public.

cdn_ssl_uri

HTTPS CDN URL to container, only applies when the container is public.

cdn_init

Retrieve CDN settings if the container is public.

cdn_enable($ttl, $log_retention)

Enable CDN to make contents of container public. $ttl Defaults to 72-hours and $log_retention defaults to false.

cdn_disable

Disable the CDN enabled container. Doesn't purge objects from CDN which means that they'll be available until their TTL expires.

Perform a HEAD request.

object_count

Returns the total number of objects in the container:

my $object_count = $container->object_count;

bytes_used

Returns the total number of bytes used by objects in the container:

my $bytes_used = $container->bytes_used;

objects

Returns a list of objects in the container as WebService::Rackspace::CloudFiles::Object objects. As the API only returns ten thousand objects per request, this module may have to do multiple requests to fetch all the objects in the container. This is exposed by using a Rackspace::CloudFiles::Object::Iterator object. You can also pass in a prefix:

foreach my $object ($container->objects->all) {
  ...
}

my @objects = $container->objects(prefix => 'dir/')->all;

object

This returns a WebService::Rackspace::CloudFiles::Object representing an object.

my $xxx = $container->object( name => 'XXX' );
my $yyy = $container->object( name => 'YYY', content_type => 'text/plain' );

delete

Deletes the container, which should be empty:

$container->delete;

purge_cdn

Purges a CDN enabled container without having to wait for the TTL to expire.

$container->purge_cdn;

Purging a CDN enabled container may take a very long time. So you can optionally provide one or more emails to be notified after the container is fully purged.

my @emails = ('foo@example.com', 'bar@example.com');
$container->purge_cdn(@emails);

cloudfiles

SEE ALSO

WebService::Rackspace::CloudFiles, WebService::Rackspace::CloudFiles::Object.

AUTHORS

Christiaan Kras <ckras@cpan.org>. Leon Brocard <acme@astray.com>.

COPYRIGHT

Copyright (C) 2010-2011, Christiaan Kras Copyright (C) 2008-9, Leon Brocard

LICENSE

This module is free software; you can redistribute it or modify it under the same terms as Perl itself.