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

Safe Haskell | None
Language | Haskell2010

Aws.Aws

Contents

- Logging
- Configuration
- Transaction runners
  - Safe runners
  - Unsafe runners
  - URI runners
- Iterated runners

Synopsis

- data LogLevel
  - = Debug
  - | Info
  - | Warning
  - | Error
- type Logger = LogLevel -> Text -> IO ()
- defaultLog :: LogLevel -> Logger
- data Configuration = Configuration {
  - timeInfo :: TimeInfo
  - credentials :: Credentials
  - logger :: Logger
  - proxy :: Maybe Proxy
  }
- baseConfiguration :: MonadIO io => io Configuration
- dbgConfiguration :: MonadIO io => io Configuration
- aws :: Transaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO (Response (ResponseMetadata a) a)
- awsRef :: Transaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> IORef (ResponseMetadata a) -> r -> ResourceT IO a
- pureAws :: Transaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO a
- memoryAws :: (Transaction r a, AsMemoryResponse a, MonadIO io) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> io (MemoryResponse a)
- simpleAws :: (Transaction r a, AsMemoryResponse a, MonadIO io) => Configuration -> ServiceConfiguration r NormalQuery -> r -> io (MemoryResponse a)
- unsafeAws :: (ResponseConsumer r a, Loggable (ResponseMetadata a), SignQuery r) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO (Response (ResponseMetadata a) a)
- unsafeAwsRef :: (ResponseConsumer r a, SignQuery r) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> IORef (ResponseMetadata a) -> r -> ResourceT IO a
- awsUri :: (SignQuery request, MonadIO io) => Configuration -> ServiceConfiguration request UriOnlyQuery -> request -> io ByteString
- awsIteratedSource :: IteratedTransaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> forall i. ConduitT i (Response (ResponseMetadata a) a) (ResourceT IO) ()
- awsIteratedSource' :: (Monad m, IteratedTransaction r a) => (r -> m (a, b)) -> r -> forall i. ConduitT i b m ()
- awsIteratedList :: (IteratedTransaction r a, ListResponse a i) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> forall j. ConduitT j i (ResourceT IO) ()
- awsIteratedList' :: (Monad m, IteratedTransaction r b, ListResponse b c) => (r -> m b) -> r -> forall i. ConduitT i c m ()

# Logging

data LogLevel #

The severity of a log message, in rising order.

Constructors

Debug |
Info |
Warning |
Error |

#### Instances

Instances details

Show LogLevel # |
Instance details Defined in Aws.Aws Methods showsPrec :: Int -> LogLevel -> ShowS # show :: LogLevel -> String # showList :: [LogLevel] -> ShowS #
Eq LogLevel # |
Instance details Defined in Aws.Aws Methods (==) :: LogLevel -> LogLevel -> Bool # (/=) :: LogLevel -> LogLevel -> Bool #
Ord LogLevel # |
Instance details Defined in Aws.Aws Methods compare :: LogLevel -> LogLevel -> Ordering # (<) :: LogLevel -> LogLevel -> Bool # (<=) :: LogLevel -> LogLevel -> Bool # (>) :: LogLevel -> LogLevel -> Bool # (>=) :: LogLevel -> LogLevel -> Bool # max :: LogLevel -> LogLevel -> LogLevel # min :: LogLevel -> LogLevel -> LogLevel #

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

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

defaultLog :: LogLevel -> Logger #

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

# Configuration

data Configuration #

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. proxy :: Maybe Proxy

baseConfiguration :: MonadIO io => io Configuration #

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

dbgConfiguration :: MonadIO io => io Configuration #

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) #

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 #

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 #

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`

memoryAws :: (Transaction r a, AsMemoryResponse a, MonadIO io) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> io (MemoryResponse a) #

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) #

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, Loggable (ResponseMetadata a), SignQuery r) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> ResourceT IO (Response (ResponseMetadata a) a) #

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, SignQuery r) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> IORef (ResponseMetadata a) -> r -> ResourceT IO a #

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 #

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

awsIteratedSource :: IteratedTransaction r a => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> forall i. ConduitT i (Response (ResponseMetadata a) a) (ResourceT IO) () #

awsIteratedSource' #

Arguments

:: (Monad m, IteratedTransaction r a) |
=> (r -> m (a, b)) | A runner function for executing transactions.
-> r | An initial request
-> forall i. ConduitT i b m () |

A more flexible version of `awsIteratedSource` that uses a user-supplied run function. Useful for embedding AWS functionality within application specific monadic contexts.

awsIteratedList :: (IteratedTransaction r a, ListResponse a i) => Configuration -> ServiceConfiguration r NormalQuery -> Manager -> r -> forall j. ConduitT j i (ResourceT IO) () #

awsIteratedList' #

Arguments

:: (Monad m, IteratedTransaction r b, ListResponse b c) |
=> (r -> m b) | A runner function for executing transactions.
-> r | An initial request
-> forall i. ConduitT i c m () |

A more flexible version of `awsIteratedList` that uses a user-supplied run function. Useful for embedding AWS functionality within application specific monadic contexts.