AWS-S3

 view release on metacpan or  search on metacpan

lib/AWS/S3/Bucket.pm  view on Meta::CPAN

    }
);

# XXX: Not tested.
sub enable_cloudfront_distribution {
    my ( $s, $cloudfront_dist ) = @_;

    $cloudfront_dist->isa( 'AWS::CloudFront::Distribution' )
      or die "Usage: enable_cloudfront_distribution( <AWS::CloudFront::Distribution object> )";

    my $ident = $cloudfront_dist->cf->create_origin_access_identity( Comment => "Access to s3://" . $s->name, );
    $s->policy( <<"JSON");
{
	"Version":"2008-10-17",
	"Id":"PolicyForCloudFrontPrivateContent",
	"Statement":[{
			"Sid": "Grant a CloudFront Origin Identity access to support private content",
			"Effect":"Allow",
			"Principal": {
			  "CanonicalUser":"@{[ $ident->S3CanonicalUserId ]}"
			},

lib/AWS/S3/ResponseParser.pm  view on Meta::CPAN

has 'expect_nothing' => (
    is       => 'ro',
    isa      => 'Bool',
    required => 1,
    default  => 0,
    trigger  => sub {
        my ( $self, $expect_nothing) = @_;
        if ( $expect_nothing ) {
            my $code = $self->response->code;
            if ( $code =~ m{^2\d\d} && !$self->response->content ) {
                return; # not sure what jdrago wanted this to do originally
            }
            else {
                if ( $self->_parse_errors() ) {
                    # die $self->friendly_error();
                }
                else {
                    return;
                }
            }
        }

t/010_basic.t  view on Meta::CPAN

#  my $acl = $bucket->acl;
#  ok $bucket->acl( 'private' ), 'set bucket.acl to private';
#  is $acl, $bucket->acl, 'get bucket.acl returns private';

#  ok $bucket->location_constraint( 'us-east-1' ), 'set bucket.location_constraint to us-east-1';
#  is $bucket->location_constraint, 'us-east-1', 'get bucket.location returns us-east-1';
#  is $s3->bucket($bucket->name)->location_constraint, 'us-east-1', 'get bucket.location returns us-east-1 second time';

#  is $bucket->policy, '', 'get bucket.policy returns empty string';

  my $test_str = "This is the original value right here!"x20;
  my $filename = 'foo/bar.txt';
  ADD_FILE: {
    my $file = $bucket->add_file(
      key       => $filename,
      contents  => \$test_str
    );
    ok( $file, 'bucket.add_file() works' );
    unlike $file->etag, qr("), 'file.etag does not contain any double-quotes (")';
  };
  



( run in 0.262 second using v1.01-cache-2.11-cpan-f985c23238c )