Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Perl Modules

    Net::Amazon::S3::ACL 0.1.0

    Download button

    No screenshots available
    Downloads: 99  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Flavio Poletti | More programs
    Perl Artistic License / FREE
    January 19th, 2011, 08:22 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Net::Amazon::S3::ACL description

    Work with Amazon S3 Access Control Lists

    Net::Amazon::S3::ACL is a Perl module that represents an S3 Access Control List; it is a representation of the XML ACL that is easier to handle. As such, there are methods that ease passing from one representation to the other, namely "parse" (to parse an XML document into an object) and "stringify" (to get the XML representation of the ACL).

    SYNOPSIS

     use Net::Amazon::S3::ACL;

     # analysis. Say you have a Net::Amazon::S3::Bucket...
     my $xml_acl = $bucket->get_acl();
     my $acl = Net::Amazon::S3::ACL->new({xml => $xml_acl});

     # Now you can use it
     print $acl->dump();

     my $owner_id = $acl->owner_id();
     my $owner_display_name = $acl->owner_displayname();

     while (my ($name, $grant) = each %{$acl->grants()}) {
     print "Policy for '$name':\n";

     (my $type = ref $grant) =~ s/.*:://;
     print " Type: $grant->{type}\n";

     if ($type eq 'ID') {
     print " AWS ID: ", $grant->id(), "\n";
     print " AWS Display Name: ", $grant->displayname(), "\n";
     }
     elsif ($type eq 'Email') {
     print " email address: ", $grant->email(), "\n";
     }
     elsif ($type eq 'URI') {
     print " group definition URI: ", $grant->URI(), "\n";
     }

     print ' Permissions: ', join(', ', @{$grant->{permissions}}), "\n";
     }

     $acl->clear(); # wipe all grants in ACL object

     # Straightforward addition of permissions, DWIM
     $acl->add(
     'foo@example.com' => 'READ', # seems email, added as such
     'http://whatever/' => 'WRITE', # seems URI, added as such
     'dafadfda908940394...' => '*', # added as AWS identifier
     );

     # Detailed addition of permissions, e.g. by ID
     my $grant = Net::Amazon::S3::Grant::ID->new(
     {
     ID => 'long-AWS-ID-here',
     displayname => 'display-name-here',
     permissions => [qw( WRITE READ READ_ACP )],
     }
     );
     $acl->add($grant);

     my $ID = 'some-AWS-ID';
     $acl->delete($ID); # remove whole ACL for given ID
     $acl->delete($ID => 'READ'); # remove this permission only
     $acl->delete($ID => [qw( READ WRITE )]); # remove these permissions only

     # install new ACL
     $bucket->set_acl({acl_xml => $acl->stringify()});
     $bucket->set_acl({acl_xml => $acl->stringify(), key => 'whatever'});



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Amazon S3 | Access Control Lists | Perl module | Amazon | S3 | ACL



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM