Copyright | (C) Richard Cook 2018 |
---|---|
License | MIT |
Maintainer | rcook@rcook.org |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides re-exports of most commonly used Amazonka functions as well as lens and error-handling functions.
- (^.) :: s -> Getting a s a -> a
- (&) :: a -> (a -> b) -> b
- (.~) :: ASetter s t a b -> b -> s -> t
- _ServiceError :: AsError a => Prism' a ServiceError
- class AsError a where
- data Credentials :: *
- data Region :: *
- data ServiceError :: *
- await :: (MonadAWS m, AWSRequest a) => Wait a -> a -> m Accept
- hasCode :: (Applicative f, Choice p) => ErrorCode -> Optic' * * p f ServiceError ServiceError
- hasStatus :: (Applicative f, Choice p) => Int -> Optic' * * p f ServiceError ServiceError
- send :: (MonadAWS m, AWSRequest a) => a -> m (Rs a)
- sinkBody :: MonadResource m => RsBody -> Sink ByteString m a -> m a
- toText :: ToText a => a -> Text
Documentation
(^.) :: s -> Getting a s a -> a infixl 8 #
View the value pointed to by a Getter
or Lens
or the
result of folding over all the results of a Fold
or
Traversal
that points at a monoidal values.
This is the same operation as view
with the arguments flipped.
The fixity and semantics are such that subsequent field accesses can be
performed with (.
).
>>>
(a,b)^._2
b
>>>
("hello","world")^._2
"world"
>>>
import Data.Complex
>>>
((0, 1 :+ 2), 3)^._1._2.to magnitude
2.23606797749979
(^.
) :: s ->Getter
s a -> a (^.
) ::Monoid
m => s ->Fold
s m -> m (^.
) :: s ->Iso'
s a -> a (^.
) :: s ->Lens'
s a -> a (^.
) ::Monoid
m => s ->Traversal'
s m -> m
(.~) :: ASetter s t a b -> b -> s -> t infixr 4 #
Replace the target of a Lens
or all of the targets of a Setter
or Traversal
with a constant value.
This is an infix version of set
, provided for consistency with (.=
).
f<$
a ≡mapped
.~
f$
a
>>>
(a,b,c,d) & _4 .~ e
(a,b,c,e)
>>>
(42,"world") & _1 .~ "hello"
("hello","world")
>>>
(a,b) & both .~ c
(c,c)
(.~
) ::Setter
s t a b -> b -> s -> t (.~
) ::Iso
s t a b -> b -> s -> t (.~
) ::Lens
s t a b -> b -> s -> t (.~
) ::Traversal
s t a b -> b -> s -> t
_ServiceError :: AsError a => Prism' a ServiceError #
A service specific error returned by the remote service.
_ServiceError :: Prism' a ServiceError #
A service specific error returned by the remote service.
data Credentials :: * #
Determines how AuthN/AuthZ information is retrieved.
FromKeys AccessKey SecretKey | Explicit access and secret keys. See |
FromSession AccessKey SecretKey SessionToken | Explicit access key, secret key and a session token. See |
FromEnv Text Text (Maybe Text) (Maybe Text) | Lookup specific environment variables for access key, secret key, an optional session token, and an optional region, respectively. |
FromProfile Text | An IAM Profile name to lookup from the local EC2 instance-data. Environment variables to lookup for the access key, secret key and optional session token. |
FromFile Text FilePath | A credentials profile name (the INI section) and the path to the AWS credentials file. |
FromContainer | Obtain credentials by attempting to contact the ECS container agent
at http://169.254.170.2 using the path in |
Discover | Attempt credentials discovery via the following steps:
An attempt is made to resolve http://instance-data rather than directly retrieving http://169.254.169.254 for IAM profile information. This assists in ensuring the DNS lookup terminates promptly if not running on EC2. |
The available AWS regions.
NorthVirginia | US East ('us-east-1'). |
Ohio | US East ('us-east-2'). |
NorthCalifornia | US West ('us-west-1'). |
Oregon | US West ('us-west-2'). |
Montreal | Canada ('ca-central-1'). |
Tokyo | Asia Pacific ('ap-northeast-1'). |
Seoul | Asia Pacific ('ap-northeast-2'). |
Mumbai | Asia Pacific ('ap-south-1'). |
Singapore | Asia Pacific ('ap-southeast-1'). |
Sydney | Asia Pacific ('ap-southeast-2'). |
SaoPaulo | South America ('sa-east-1'). |
Ireland | EU ('eu-west-1'). |
London | EU ('eu-west-2'). |
Frankfurt | EU ('eu-central-1'). |
GovCloud | US GovCloud ('us-gov-west-1'). |
GovCloudFIPS | US GovCloud FIPS (S3 Only, 'fips-us-gov-west-1'). |
Beijing | China ('cn-north-1'). |
data ServiceError :: * #
await :: (MonadAWS m, AWSRequest a) => Wait a -> a -> m Accept #
Poll the API with the supplied request until a specific Wait
condition
is fulfilled.
hasCode :: (Applicative f, Choice p) => ErrorCode -> Optic' * * p f ServiceError ServiceError #
hasStatus :: (Applicative f, Choice p) => Int -> Optic' * * p f ServiceError ServiceError #
send :: (MonadAWS m, AWSRequest a) => a -> m (Rs a) #
Send a request, returning the associated response if successful.
sinkBody :: MonadResource m => RsBody -> Sink ByteString m a -> m a #
Connect a Sink
to a response stream.