aws-0.10.2: Amazon Web Services (AWS) for Haskell

Safe HaskellNone
LanguageHaskell2010

Aws.Aws

Contents

Synopsis

Logging

data LogLevel Source

The severity of a log message, in rising order.

Constructors

Debug 
Info 
Warning 
Error 

type Logger = LogLevel -> Text -> IO () Source

The interface for any logging function. Takes log level and a log message, and can perform an arbitrary IO action.

defaultLog :: LogLevel -> Logger Source

The default logger defaultLog minLevel, which prints log messages above level minLevel to stderr.

Configuration

data Configuration Source

The configuration for an AWS request. You can use multiple configurations in parallel, even over the same HTTP connection manager.

Constructors

Configuration 

Fields

timeInfo :: TimeInfo

Whether to restrict the signature validity with a plain timestamp, or with explicit expiration (absolute or relative).

credentials :: Credentials

AWS access credentials.

logger :: Logger

The error / message logger.

baseConfiguration :: MonadIO io => io Configuration Source

The default configuration, with credentials loaded from environment variable or configuration file (see loadCredentialsDefault).

dbgConfiguration :: MonadIO io => io Configuration Source

Debug configuration, which logs much more verbosely.

Transaction runners

Safe runners

aws :: Transaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO (Response (ResponseMetadata a) a) Source

Run an AWS transaction, with HTTP manager and metadata wrapped in a Response.

All errors are caught and wrapped in the Response value.

Metadata is logged at level Info.

Usage (with existing Manager): resp <- aws cfg serviceCfg manager request

awsRef :: Transaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> IORef (ResponseMetadata a) -> r -> ResourceT IO a Source

Run an AWS transaction, with HTTP manager and metadata returned in an IORef.

Errors are not caught, and need to be handled with exception handlers.

Metadata is not logged.

Usage (with existing Manager): ref <- newIORef mempty; resp <- awsRef cfg serviceCfg manager request

pureAws :: Transaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO a Source

Run an AWS transaction, with HTTP manager and without metadata.

Metadata is logged at level Info.

Usage (with existing Manager): resp <- aws cfg serviceCfg manager request

simpleAws :: (Transaction r a, AsMemoryResponse a, MonadIO io) => Configuration -> ServiceConfiguration r NormalQuery -> r -> io (MemoryResponse a) Source

Run an AWS transaction, without HTTP manager and without metadata.

Metadata is logged at level Info.

Note that this is potentially less efficient than using aws, because HTTP connections cannot be re-used.

Usage: resp <- simpleAws cfg serviceCfg request

Unsafe runners

unsafeAws :: (ResponseConsumer r a, Monoid (ResponseMetadata a), Loggable (ResponseMetadata a), SignQuery r) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO (Response (ResponseMetadata a) a) Source

Run an AWS transaction, without enforcing that response and request type form a valid transaction pair.

This is especially useful for debugging and development, you should not have to use it in production.

All errors are caught and wrapped in the Response value.

Metadata is wrapped in the Response, and also logged at level Info.

unsafeAwsRef :: (ResponseConsumer r a, Monoid (ResponseMetadata a), SignQuery r) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> IORef (ResponseMetadata a) -> r -> ResourceT IO a Source

Run an AWS transaction, without enforcing that response and request type form a valid transaction pair.

This is especially useful for debugging and development, you should not have to use it in production.

Errors are not caught, and need to be handled with exception handlers.

Metadata is put in the IORef, but not logged.

URI runners

awsUri :: (SignQuery request, MonadIO io) => Configuration -> ServiceConfiguration request UriOnlyQuery -> request -> io ByteString Source

Run a URI-only AWS transaction. Returns a URI that can be sent anywhere. Does not work with all requests.

Usage: uri <- awsUri cfg request

Iterated runners