bgamari / pipes-s3 Goto Github PK
View Code? Open in Web Editor NEWA simple library for interfacing with Amazon's S3 storage service via the Haskell Pipes library
License: BSD 3-Clause "New" or "Revised" License
A simple library for interfacing with Amazon's S3 storage service via the Haskell Pipes library
License: BSD 3-Clause "New" or "Revised" License
ghci
reproduction of error below - the request work fine with vanilla s3
where I use conduit to build streaming body (no multi-part upload - it is vanilla streaming request where length is known). The object size here is 2MB btw, while chunk size is 8MB.
I used the latest git version of pipes-s3 for testing.
*Main> Just creds <- Aws.loadCredentialsFromEnv
*Main> let cfg = Aws.Configuration Aws.Timestamp creds (Aws.defaultLog Aws.Error)
*Main> httpmgr <- newManager tlsManagerSettings
*Main> let file ="out"
*Main> inhandle <- openFile file ReadMode
*Main> lenb <- System.IO.withFile file ReadMode hFileSize
*Main> let inbytes = P.fromHandle inhandle :: Producer' P.ByteString IO ()
*Main> PS3.toS3WithManager httpmgr cfg (1024*1024*8) "indalytics-dev" "testbucket/pre/test" inbytes
*** Exception: S3Error {s3StatusCode = Status {statusCode = 400, statusMessage = "Bad Request"}, s3ErrorCode = "MalformedXML", s3ErrorMessage = "The XML you provided was not well-formed or did not validate against our published schema", s3ErrorResource = Nothing, s3ErrorHostId = Just "vmngyN2a1LYkY7a/1+Ha/DLdK5iaN8F5CTed36o3/MSImUoWUbvKoAjzOqSnEH0ivKPQtmEXs8g=", s3ErrorAccessKeyId = Nothing, s3ErrorStringToSign = Nothing, s3ErrorBucket = Nothing, s3ErrorEndpointRaw = Nothing, s3ErrorEndpoint = Nothing}
Right now the only way we can pass in the credentials is by setting the appropriate environment variables. It would be better this was not hardcoded.
s3cfg values can differ from app to app. So, it should be mandatory argument to HTTP manager. This is one example of how it is set it in aws
package - AWS.pureAws
on last line is the API of interest here for one way of how S3
configuration is passed:
Just creds <- Aws.loadCredentialsFromEnv
let cfg = Aws.Configuration Aws.Timestamp creds (Aws.defaultLog Aws.Error)
let s3cfg = S3.s3 Aws.HTTP S3.s3EndpointUsClassic False
{- Set up a ResourceT region with an available HTTP manager. -}
httpmgr <- newManager tlsManagerSettings
req <- async $ runResourceT $ do
Aws.pureAws cfg s3cfg httpmgr $ {...request body here}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.