amazonka-mtl: MTL-style type-class and deriving-via newtypes for Amazonka

[ library, mit, utils ] [ Propose Tags ]

This package allows incorporation of AWS actions into any MTL-style function,

import Amazonka.Data.Text (ToText(..))
import Amazonka.S3.ListObjects
import Amazonka.S3.Types.Object
import Blammo.Logging
import Conduit
import Control.Lens hiding ((.=))
import Control.Monad.AWS as AWS

someAction
  :: ( MonadIO m
     , MonadLogger m
     , MonadAWS m
     , MonadReader env m
     , HasSettings env
     )
  => m ()
someAction = do
  Settings {..} <- view settingsL

  keys <-
    runConduit
      $ paginate (newListObjects settingsBucketName)
      .| concatMapC (^. listObjectsResponse_contents)
      .| concatC
      .| mapC (^. object_key . to toText)
      .| iterMC (\k -> logDebug $ k :# [])
      .| sinkList

  logInfo $ "Bucket contents" :# ["keys" .= keys]

This package also provides a number of options for execution:

This package also provides mechanisms for mocking AWS in tests:

Please see individual module documentation for all the details.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0
Change log CHANGELOG.md
Dependencies amazonka (>=2.0), amazonka-core (>=2.0), base (>=4.14.3.0 && <5), conduit (>=1.3.4.2), lens (>=4.19.2), mtl (>=2.2.2), resourcet (>=1.2.4.3), unliftio-core (>=0.2.0.1) [details]
License MIT
Author
Maintainer Freckle Education
Revised Revision 1 made by PatrickBrisbin at 2023-10-09T16:02:37Z
Category Utils
Home page https://github.com/freckle/amazonka-mtl#readme
Bug tracker https://github.com/freckle/amazonka-mtl/issues
Source repo head: git clone https://github.com/freckle/amazonka-mtl
Uploaded by PatrickBrisbin at 2023-09-21T18:23:33Z
Distributions NixOS:0.1.1.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 48 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-09-21 [all 1 reports]

Readme for amazonka-mtl-0.1.1.0

[back to package description]

amazonka-mtl

Hackage Stackage Nightly Stackage LTS CI

MTL-style type-class and deriving-via newtypes for Amazonka.

Example

This package allows incorporation of AWS actions into any MTL-style function,

import Amazonka.Data.Text (ToText(..))
import Amazonka.S3.ListObjects
import Amazonka.S3.Types.Object
import Blammo.Logging
import Conduit
import Control.Lens hiding ((.=))
import Control.Monad.AWS as AWS
someAction
  :: ( MonadIO m
     , MonadLogger m
     , MonadAWS m
     , MonadReader env m
     , HasSettings env
     )
  => m ()
someAction = do
  Settings {..} <- view settingsL

  keys <-
    runConduit
      $ paginate (newListObjects settingsBucketName)
      .| concatMapC (^. listObjectsResponse_contents)
      .| concatC
      .| mapC (^. object_key . to toText)
      .| iterMC (\k -> logDebug $ k :# [])
      .| sinkList

  logInfo $ "Bucket contents" :# ["keys" .= keys]

This package also provides a number of options for execution:

  • Through a concrete transformer: Control.Monad.AWS.EnvT
  • Through your own reader env and deriving-via: Control.Monad.AWS.ViaReader

This package also provides mechanisms for mocking AWS in tests:

  • Through a concrete transformer: Control.Monad.AWS.MockT
  • Through your own reader env and deriving-via: Control.Monad.AWS.ViaMock

Please see the documentation on hackage for all the details.

Development & Tests

stack build --fast --pedantic --test --file-watch

CHANGELOG | LICENSE