module Amazonka.Presign where
import Amazonka.Data
import Amazonka.Lens ((%~))
import Amazonka.Prelude
import Amazonka.Request (clientRequestURL)
import Amazonka.Types
import qualified Network.HTTP.Types as HTTP
presignURL ::
(MonadIO m, AWSRequest a) =>
Auth ->
Region ->
UTCTime ->
Seconds ->
a ->
m ByteString
presignURL :: Auth -> Region -> UTCTime -> Seconds -> a -> m ByteString
presignURL Auth
a Region
r UTCTime
e Seconds
ts =
(ClientRequest -> ByteString) -> m ClientRequest -> m ByteString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ClientRequest -> ByteString
clientRequestURL
(m ClientRequest -> m ByteString)
-> (a -> m ClientRequest) -> a -> m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
forall (m :: * -> *) a.
(MonadIO m, AWSRequest a) =>
Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
presign Auth
a Region
r UTCTime
e Seconds
ts
presign ::
(MonadIO m, AWSRequest a) =>
Auth ->
Region ->
UTCTime ->
Seconds ->
a ->
m ClientRequest
presign :: Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
presign =
(Service -> Service)
-> Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
forall (m :: * -> *) a.
(MonadIO m, AWSRequest a) =>
(Service -> Service)
-> Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
presignWith Service -> Service
forall a. a -> a
id
presignWith ::
(MonadIO m, AWSRequest a) =>
(Service -> Service) ->
Auth ->
Region ->
UTCTime ->
Seconds ->
a ->
m ClientRequest
presignWith :: (Service -> Service)
-> Auth -> Region -> UTCTime -> Seconds -> a -> m ClientRequest
presignWith = ([Header] -> [Header])
-> (Service -> Service)
-> Auth
-> Region
-> UTCTime
-> Seconds
-> a
-> m ClientRequest
forall (m :: * -> *) a.
(MonadIO m, AWSRequest a) =>
([Header] -> [Header])
-> (Service -> Service)
-> Auth
-> Region
-> UTCTime
-> Seconds
-> a
-> m ClientRequest
presignWithHeaders [Header] -> [Header]
defaultHeaders
defaultHeaders :: [HTTP.Header] -> [HTTP.Header]
= (Header -> Bool) -> [Header] -> [Header]
forall a. (a -> Bool) -> [a] -> [a]
filter ((HeaderName -> HeaderName -> Bool
forall a. Eq a => a -> a -> Bool
/= HeaderName
hExpect) (HeaderName -> Bool) -> (Header -> HeaderName) -> Header -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Header -> HeaderName
forall a b. (a, b) -> a
fst)
presignWithHeaders ::
(MonadIO m, AWSRequest a) =>
([Header] -> [Header]) ->
(Service -> Service) ->
Auth ->
Region ->
UTCTime ->
Seconds ->
a ->
m ClientRequest
[Header] -> [Header]
f Service -> Service
g Auth
a Region
r UTCTime
ts Seconds
ex a
x =
Auth -> (AuthEnv -> m ClientRequest) -> m ClientRequest
forall (m :: * -> *) a.
MonadIO m =>
Auth -> (AuthEnv -> m a) -> m a
withAuth Auth
a ((AuthEnv -> m ClientRequest) -> m ClientRequest)
-> (AuthEnv -> m ClientRequest) -> m ClientRequest
forall a b. (a -> b) -> a -> b
$ \AuthEnv
ae ->
ClientRequest -> m ClientRequest
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ClientRequest -> m ClientRequest)
-> ClientRequest -> m ClientRequest
forall a b. (a -> b) -> a -> b
$! Signed a -> ClientRequest
forall a. Signed a -> ClientRequest
signedRequest (Signed a -> ClientRequest) -> Signed a -> ClientRequest
forall a b. (a -> b) -> a -> b
$
Seconds -> Algorithm a
forall a. Seconds -> Algorithm a
requestPresign Seconds
ex (a -> Request a
forall a. AWSRequest a => a -> Request a
request a
x Request a -> (Request a -> Request a) -> Request a
forall a b. a -> (a -> b) -> b
& ([Header] -> Identity [Header])
-> Request a -> Identity (Request a)
forall a. Lens' (Request a) [Header]
requestHeaders (([Header] -> Identity [Header])
-> Request a -> Identity (Request a))
-> ([Header] -> [Header]) -> Request a -> Request a
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ [Header] -> [Header]
f Request a -> (Request a -> Request a) -> Request a
forall a b. a -> (a -> b) -> b
& (Service -> Identity Service) -> Request a -> Identity (Request a)
forall a. Lens' (Request a) Service
requestService ((Service -> Identity Service)
-> Request a -> Identity (Request a))
-> (Service -> Service) -> Request a -> Request a
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Service -> Service
g) AuthEnv
ae Region
r UTCTime
ts