śĪĮž»T      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS AAn Amazon Web Services connection. Everything needed to connect  and authenticate requests. Service provider hostname Service provider port number Access Key ID Secret Access Key &Hostname used for connecting to Amazon's production S3 service (s3.amazonaws.com). )Port number used for connecting to Amazon's production S3 service (80). >Create an AWSConnection to Amazon from credentials. Uses the  production service. Access Key ID Secret Access Key Connection to Amazon S3 ;Retrieve Access and Secret keys from environment variables > AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, respectively. ; Either variable being undefined or empty will result in  T.     BAn error from an S3 request, either at the network layer, or from  S3 itself. AWSError code message% constructs an error message from S3  itself. See   Hhttp://docs.amazonwebservices.com/AmazonS3/2006-03-01/ErrorCodeList.html * for a detailed list of possible codes. 'Connection error at the network layer. ?A result from processing a request to S3. Either some success  value, or a . Pretty print an error message. /$An action to be performed using S3. *Connection and authentication information 'Name of bucket to act on (URL encoded) 'Name of object to act on (URL encoded) 'Query parameters (requires a prefix of ?) !Additional header fields to send  Body of action, if sending data Type of action, U, V, etc. W Transform an % into an HTTP request. Does not add A authentication or date information, so it is not suitable for  sending directly to AWS. Action to transform 'Action represented as an HTTP Request. XCreate YZ objects from an action. [Inspect HTTP body, and add a Content-Length header with the  correct length. \2Add AWS authentication header to an HTTP request.  Action with authentication data Request to transform Authenticated request ]2Sign a string using the given authentication data  Action with authentication data String to sign Base-64 encoded signature ^@Generate text that will be signed and subsequently added to the  request. _(Extract header data needed for signing. `Extract x-amz-* headers needed for signing. B find all headers with type HdrCustom that begin with amzHeader  lowercase key names $ sort lexigraphically by key name " combine headers with same name  unfold multi-line headers % trim whitespace around the header a=Give the string representation of a (key,value) header pair. ) Uses rules for authenticated headers. b8Replace CRLF followed by whitespace with a single space c strip leading/trailing whitespace dCombine same-named headers. e2Headers with same name should have values merged. f"Group headers with the same name. gSort by key name. hMake YZ* easier to work with, and lowercase keys. 2Determine if a header belongs in the StringToSign i*is the first list a prefix of the second? j'Prefix used by Amazon metadata headers k0Extract resource name, as required for signing. l Add a date string to a request. Request to modify  Date string, in RFC 2616 format Request with date header added m%Add an expiration date to a request. n$Attach an HTTP header to a request. o8Get hostname to connect to. Needed for european buckets p/Get current time in HTTP 1.1 format (RFC 2616) + Numeric time zones should be used, but I'd rather not subvert the E intent of ctTZName, so we stick with the name format. Otherwise,  we could send +0000 instead of GMT.  see:   #http://www.ietf.org/rfc/rfc2616.txt   #http://www.ietf.org/rfc/rfc1123.txt   "http://www.ietf.org/rfc/rfc822.txt q'Convenience for dealing with HMAC-SHA1 @Construct the request specified by an S3Action, send to Amazon, 6 and return the response. Todo: add MD5 signature. r#Construct a pre-signed URI, but don't act on it. This is useful E for when an expiration date has been set, and the URI needs to be  passed on to a client. Action with resource "Expiration time, in seconds since # 00:00:00 UTC on January 1, 1970 URI of resource s=Inspect a response for network errors, HTTP error codes, and  Amazon error messages. I We need the original action in case we get a 307 (temporary redirect) t=Find the errors embedded in an XML message body from Amazon. Find children of Error entity, use their Code and Message  entities to create an . uNDecode a mime string, we know about quoted printable and base64 encoded UTF-8 + S3 may convert quoted printable to base64 vw xy   !"#$4An object that can be stored and retrieved from S3. %&*Name of the bucket containing this object '"URI of the object. Subresources (?acl or  | ?torrent%) should be suffixed onto this name. (2A standard MIME type describing the format of the  contents. If not specified, binary/ octet-stream is  used. )1Object metadata in (key,value) pairs. Key names  should use the prefix  x-amz-meta- to be stored with : the object. The total HTTP request must be under 4KB,  including these headers. * Object data. +,Add required headers for the storage class.  Use this in combination with . for new objects. To 5 modify the storage class of existing objects, use  -/. Using reduced redundancy for object storage , trades off redundancy for storage costs. Storage class to request Object to modify 8Object with storage class headers set, ready to be sent ,0Retrieve the storage class of a local S3Object. , Does not work for objects retrieved with 1 , since the 1 required header values are not returned. Use  getObjectStorageClass or  listObjects from S3Bucket module to 0 determine storage class of existing objects. Object to inspect 0Requested storage class, Nothing if unspecified -MChange the storage class (and only the storage class) of an existing object. L This actually performs a copy to the same location, preserving metadata. W It is not clear to me whether ACLs are preserved when copying to the same location. O For best performance, we must not change other headers during storage class  changes. AWS connection information New storage class for object Object to modify Server response .Send data for an object. AWS connection information Object to add to a bucket Server response /ACreate a pre-signed request URI. Anyone can use this to request ' an object until the specified date. AWS connection information Object to be made available "Expiration time, in seconds since # 00:00:00 UTC on January 1, 1970 URI for the object 0ACreate a pre-signed request URI. Anyone can use this to request 2 an object for the number of seconds specified. AWS connection information Object to be made available How many seconds until this  request expires URI for the object 1Retrieve an object. AWS connection information Object to retrieve Server response 2=Get object info without retrieving content body from server. AWS connection information "Object to retrieve information on Server response z%Get an object with specified method.  Method to use for retrieval (GET/HEAD) AWS connection Object to request {3:Delete an object. Only bucket and object name need to be A specified in the S3Object. Deletion of a non-existent object  does not return an error. AWS connection information Object to delete Server response 4^Copy object from one bucket to another (or the same bucket), preserving the original headers.  Headers from destobj are sent, while only the  bucket and name of srcobj are used. For the best = performance, when changing headers during a copy, use the  5) function. For conditional copying, the @ following headers set on the destination object may be used:  x-amz-copy-source-if-match, x-amz-copy-source-if-none-match,  %x-amz-copy-source-if-unmodified-since, or  #x-amz-copy-source-if-modified-since. See   Xhttp://docs.amazonwebservices.com/AmazonS3/2006-03-01/API/index.html?RESTObjectCOPY.html  for more details. AWS connection information !Source object (bucket+name only) Destination object 5Server response, headers include version information 5PCopy object from one bucket to another (or the same bucket), replacing headers.  Any headers from srcobj are ignored, and only those  set in destobj are used. AWS connection information !Source object (bucket+name only) Destination object 5Server response, headers include version information !"#$%&'()*+,-./012345.451230/+,-$%&'()*!#"!#""#$%&'()*%&'()*+,-./012345)6$Is a result set response truncated? 7Result from listing objects. 89Name of object :Last modification date ;MD5 <Bytes of object data =Storage class of the object >List request parameters ?@ABCDEFGH>Create a new bucket on S3 with the given prefix, and a random ? suffix. This can be used to programatically create buckets  without of naming conflicts. AWS connection information Bucket name prefix  Location (US, EU,  us-west-1, ap-southeast-1) Server response, if  successful, the bucket  name is returned. I7see createBucketWithPrefixIn, but hardcoded for the US AWS connection information Bucket name prefix "Server response, with bucket name |J/Create a new bucket on S3 with the given name. AWS connection information Proposed bucket name  Location (US, EU,  us-west-1, ap-southeast-1) Server response K/Create a new bucket on S3 with the given name. AWS connection information Proposed bucket name Server response L!Physical location of the bucket. US or EU AWS connection information  Bucket name Server response (US, EU,  us-west-1, ap-southeast-1, etc.) }~M?Delete a bucket with the given name on S3. The bucket must be " empty for deletion to succeed. AWS connection information Bucket name to delete Server response N=Empty a bucket of all objects. Iterates through all objects A issuing delete commands, so time is proportional to number of B objects in the bucket. At this time, delete requests are free  from Amazon. AWS connection information Bucket name to empty Server response CDelete a list of objects, stop as soon as an error is encountered. O:Return a list of all bucket names and creation dates. S3 - allows a maximum of 100 buckets per user. AWS connection information Server response €P3List objects in a bucket, based on parameters from ?>. See E the Amazon S3 developer resources for in depth explanation of how  the fields in ?># can be used to query for objects.   Mhttp://docs.amazonwebservices.com/AmazonS3/2006-03-01/ListingKeysRequest.html AWS connection information Bucket name to search List parameters Server response QFRepeatedly query the server for all objects in a bucket, ignoring the max_keys field. AWS connection information Bucket name to search List parameters Server response R1Retrieve the storage class of an object from S3. $ For checking more than one object's storage class efficiently,  use listObjects. ‚ADetermine if ListBucketResult is truncated. It would make sense > to combine this with the query for list results, so we didn't  have to parse the XML twice. ƒ„…SLCheck Amazon guidelines on bucket naming. (missing test for IP-like names) †Remove quote characters from a ‡. 6789:;<=>?@ABCDEFGHIJKLMNOPQRSJKHIMLNOPQSRDEFG>?@ABC789:;<=66789:;<=89:;<=>?@ABC?@ABCDEFGEFGHIJKLMNOPQRSˆ       !"#$%&'())*+,-./0123456789:;;<=>?@AABCDEFFGHIJKLMNOPQRSTUVWXYZXY[\]X^_X^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹UŒŽ hS3-0.5.3Network.AWS.ArrowUtilsNetwork.AWS.AWSConnectionNetwork.AWS.AWSResultNetwork.AWS.AuthenticationNetwork.AWS.S3ObjectNetwork.AWS.S3BucketsplitunsplitatTagtext AWSConnectionawsHostawsPort awsAccessKey awsSecretKeydefaultAmazonS3HostdefaultAmazonS3PortamazonS3ConnectionamazonS3ConnectionFromEnvReqErrorAWSError NetworkError AWSResultprettyReqErrorS3Actions3conns3buckets3objects3query s3metadatas3body s3operation isAmzHeader runAction preSignedURI mimeDecode mimeEncodeQP StorageClassREDUCED_REDUNDANCYSTANDARDS3Object obj_bucketobj_name content_type obj_headersobj_datasetStorageClassgetStorageClassrewriteStorageClass sendObjectpublicUriUntilTimepublicUriForSeconds getObject getObjectInfo deleteObject copyObjectcopyObjectWithReplace IsTruncated ListResultkey last_modifiedetagsize storageClass ListRequestprefixmarker delimitermax_keysS3Bucket bucket_namebucket_creation_datecreateBucketWithPrefixIncreateBucketWithPrefixcreateBucketIn createBucketgetBucketLocation deleteBucket emptyBucket listBuckets listObjectslistAllObjectsgetObjectStorageClassisBucketNameValidbase Data.MaybeNothing HTTP-4000.0.9Network.HTTP.BasePUTGETrequestFromActionheadersFromActionNetwork.HTTP.HeadersHeaderaddContentLengthHeaderaddAuthenticationHeader makeSignature stringToSigncanonicalizeHeaderscanonicalizeAmzHeaders showHeaderfold_whitespaceremoveLeadingTrailingWhitespacecombineHeadersmergeSameHeaders groupHeaders sortHeadersheaderToLCKeyValueisPrefix amzHeadercanonicalizeResource addDateToReqaddExpirationToReqaddHeaderToReq s3HostnamehttpCurrentDate string2words runAction'createAWSResultparseRestErrorXML mimeDecodeQP mimeDecodeQP' mimeDecodeB64 mimeEncodeQP' reservedChargetObjectWithMethodheadersFromResponse randomNameparseBucketLocationXMLprocessLocation deleteObjectsparseBucketListXMLprocessBucketsisListTruncatedprocessTruncationgetListResultsprocessListResultsunquoteGHC.BaseString