amazonka-1.5.0: Comprehensive Amazon Web Services SDK.

Copyright(c) 2013-2017 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.Env

Contents

Description

Environment and AWS specific configuration for the AWS and AWST monads.

Synopsis

Creating the Environment

newEnv Source #

Arguments

:: (Applicative m, MonadIO m, MonadCatch m) 
=> 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.

Since: 1.5.0 - The region is now retrieved from the AWS_REGION environment variable (identical to official SDKs), or defaults to us-east-1. You can override the Env region by using envRegion, or the current operation's region by using within.

Since: 1.3.6 - The default logic for retrying HttpExceptions now uses retryConnectionFailure to retry specific connection failure conditions up to 3 times. Previously only service specific errors were automatically retried. This can be reverted to the old behaviour by resetting the Env using envRetryCheck lens to (\_ _ -> False).

Throws AuthError when environment variables or IAM profiles cannot be read.

See: newEnvWith.

newEnvWith Source #

Arguments

:: (Applicative m, MonadIO m, MonadCatch m) 
=> Credentials

Credential discovery mechanism.

-> Maybe Bool

Preload the EC2 instance check.

-> Manager 
-> m Env 

See: newEnv

The Maybe Bool parameter is used by the EC2 instance check. By passing a value of Nothing, the check will be performed. Just True would cause the check to be skipped and the host treated as an EC2 instance.

Throws AuthError when environment variables or IAM profiles cannot be read.

class HasEnv a where Source #

Minimal complete definition

environment

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

The function used to determine if an HttpException should be retried.

envOverride :: Lens' a (Dual (Endo Service)) Source #

The currently applied overrides to all Service configuration.

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.

Overriding Default Configuration

override :: HasEnv a => (Service -> Service) -> a -> a Source #

Provide a function which will be added to the existing stack of overrides applied to all service configuration.

To override a specific service, it's suggested you use either configure or reconfigure with a modified version of the default service, such as Network.AWS.DynamoDB.dynamoDB.

configure :: HasEnv a => Service -> a -> a Source #

Configure a specific service. All requests belonging to the supplied service will use this configuration instead of the default.

It's suggested you use a modified version of the default service, such as Network.AWS.DynamoDB.dynamoDB.

See: reconfigure.

Scoped Actions

reconfigure :: (MonadReader r m, HasEnv r) => Service -> m a -> m a Source #

Scope an action such that all requests belonging to the supplied service will use this configuration instead of the default.

It's suggested you use a modified version of the default service, such as Network.AWS.DynamoDB.dynamoDB.

See: configure.

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.

Default timeouts are chosen by considering:

Retry HTTP Exceptions

retryConnectionFailure :: Int -> Int -> HttpException -> Bool Source #

Retry the subset of transport specific errors encompassing connection failure up to the specific number of times.