noblesamurai / as3awss3lib

Automatically exported from code.google.com/p/as3awss3lib
0 stars 0 forks source link

Not an issue, a 'code donation' #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi folks,

I just wanted to let you know I used this library recently for my Zarqon
Active License Control System product. 

The library was tremendously helpful at getting good stuff happening with
S3 in short order. Thanks so much for putting it out there for us!

Along the way, I had to make a few additions / modifications. I'm attaching
a .zip archive of the modified project as I'm using it at the moment. Feel
free to fold these back into the project if you like. 

Cheers,
-=Cliff>

List of changes made:

AWSS3Event:
Added a field to track when the bucket is truncated:

// Set for LIST_BUCKETS type
public var isTruncated:Boolean = false;

AWSS3:
* Modified listBuckets method to return AWSS3Event.ERROR instead of an
empty AWSS3Event.LIST_BUCKETS if the S3 credentials are invalid.

* Modified listObjects method to return AWSS3Event.ERROR instead of an
empty AWSS3Event.LIST_OBJECTS if the bucket doesn't exist.

* Modified listObjects method to set the new isTruncated flag on AWSS3Event
if the object list is truncated. (this lets you iterate until you get an
exhaustive list)

* Modified getObject method to return AWSS3Event.ERROR instead of an empty
AWSS3Event.OBJECT_RETRIEVED if the object doesn't exist.

* For handling Canned Access Policies, Added these constants:

// Access Policy: Private - Owner gets FULL_CONTROL.
public static const AP_PRIVATE:String   = "private";

// Access Policy: Owner gets FULL_CONTROL and the anonymous principal is
granted READ access.
public static const AP_PUBLIC_READ:String  = "public-read";

// Access Policy: Owner gets FULL_CONTROL, the anonymous principal is
granted READ and WRITE access. 
public static const AP_PUBLIC_READ_WRTIE:String  = "public-read-write";

// Access Policy: Owner gets FULL_CONTROL, and any principal authenticated
as a registered Amazon S3 user is granted READ access.
public static const AP_AUTHENTICATED_READ:String  = "authenticated-read";

* And modified methods to optionally accept these policies and, if present
write them with the x-amz-acl header, and include that in the signature.

public function createNewBucket(bucketName:String,
accessPolicy:String=null):void

public function saveObject(bucketName:String, objectName:String,
contentType:String, objectFile:File, accessPolicy:String=null):void

private function getURLRequest(method:String, resource:String,
contentType:String = null, hash:String = null, secure:Boolean = true,
accessPolicy:String=null):URLRequest

private function getAuthenticationHeader(verb:String, dateString:String,
resource:String, contentType:String = null, hash:String = null,
accessPolicy:String=null):String

private function getAuthenticationString(verb:String, dateString:String,
resource:String, contentType:String = null, hash:String = null,
accessPolicy:String=null):String

Original issue reported on code.google.com by futuresc...@gmail.com on 26 Mar 2010 at 7:11

Attachments: