| Copyright | (c) 2013-2015 Brendan Hay |
|---|---|
| License | Mozilla Public License, v. 2.0. |
| Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
Network.AWS.Env
- newEnv :: (Applicative m, MonadIO m, MonadCatch m) => Region -> Credentials -> m Env
- newEnvWith :: (Applicative m, MonadIO m, MonadCatch m) => Region -> Credentials -> Maybe Bool -> Manager -> m Env
- data Env = Env {
- _envRegion :: !Region
- _envLogger :: !Logger
- _envRetryCheck :: !(Int -> HttpException -> IO Bool)
- _envRetryPolicy :: !(Maybe RetryPolicy)
- _envTimeout :: !(Maybe Seconds)
- _envManager :: !Manager
- _envEC2 :: !(IORef (Maybe Bool))
- _envAuth :: !Auth
- class HasEnv a where
- environment :: Lens' a Env
- envRegion :: Lens' a Region
- envLogger :: Lens' a Logger
- envRetryCheck :: Lens' a (Int -> HttpException -> IO Bool)
- envRetryPolicy :: Lens' a (Maybe RetryPolicy)
- envTimeout :: Lens' a (Maybe Seconds)
- envManager :: Lens' a Manager
- envAuth :: Lens' a Auth
- envEC2 :: Getter a (IORef (Maybe Bool))
- within :: (MonadReader r m, HasEnv r) => Region -> m a -> m a
- once :: (MonadReader r m, HasEnv r) => m a -> m a
- timeout :: (MonadReader r m, HasEnv r) => Seconds -> m a -> m a
Creating the Environment
Arguments
| :: (Applicative m, MonadIO m, MonadCatch m) | |
| => Region | Initial region to operate in. |
| -> Credentials | Credential discovery mechanism. |
| -> m Env |
Creates a new environment with a new Manager without debug logging
and uses getAuth to expand/discover the supplied Credentials.
Lenses from HasEnv can be used to further configure the resulting Env.
Throws AuthError when environment variables or IAM profiles cannot be read.
See: newEnvWith.
Arguments
| :: (Applicative m, MonadIO m, MonadCatch m) | |
| => Region | Initial region to operate in. |
| -> Credentials | Credential discovery mechanism. |
| -> Maybe Bool | Preload memoisation for the underlying EC2 instance check. |
| -> Manager | |
| -> m Env |
The environment containing the parameters required to make AWS requests.
Constructors
| Env | |
Fields
| |
Minimal complete definition
Methods
environment :: Lens' a Env Source
envRegion :: Lens' a Region Source
The current region.
envLogger :: Lens' a Logger Source
The function used to output log messages.
envRetryCheck :: Lens' a (Int -> HttpException -> IO Bool) Source
The function used to determine if an HttpException should be retried.
envRetryPolicy :: Lens' a (Maybe RetryPolicy) Source
The RetryPolicy used to determine backoff/on and retry delay/growth.
envTimeout :: Lens' a (Maybe Seconds) Source
A HTTP response timeout override to apply. This defaults to Nothing,
and the timeout selection is outlined below.
Timeouts are chosen by considering:
- This
envTimeout, if set. - The related
Servicetimeout for the sent request if set. (Usually 70s) - The
envManagertimeout if set. - The default
ClientRequesttimeout. (Approximately 30s)
envManager :: Lens' a Manager Source
The Manager used to create and manage open HTTP connections.
envAuth :: Lens' a Auth Source
The credentials used to sign requests for authentication with AWS.
envEC2 :: Getter a (IORef (Maybe Bool)) Source
A memoised predicate for whether the underlying host is an EC2 instance.
Scoped Actions
within :: (MonadReader r m, HasEnv r) => Region -> m a -> m a Source
Scope an action within the specific Region.
once :: (MonadReader r m, HasEnv r) => m a -> m a Source
Scope an action such that any retry logic for the Service is
ignored and any requests will at most be sent once.
timeout :: (MonadReader r m, HasEnv r) => Seconds -> m a -> m a Source
Scope an action such that any HTTP response will use this timeout value.