{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.KinesisAnalyticsV2.CreateApplicationPresignedUrl
(
CreateApplicationPresignedUrl (..),
newCreateApplicationPresignedUrl,
createApplicationPresignedUrl_sessionExpirationDurationInSeconds,
createApplicationPresignedUrl_applicationName,
createApplicationPresignedUrl_urlType,
CreateApplicationPresignedUrlResponse (..),
newCreateApplicationPresignedUrlResponse,
createApplicationPresignedUrlResponse_authorizedUrl,
createApplicationPresignedUrlResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalyticsV2.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateApplicationPresignedUrl = CreateApplicationPresignedUrl'
{
CreateApplicationPresignedUrl -> Maybe Natural
sessionExpirationDurationInSeconds :: Prelude.Maybe Prelude.Natural,
CreateApplicationPresignedUrl -> Text
applicationName :: Prelude.Text,
CreateApplicationPresignedUrl -> UrlType
urlType :: UrlType
}
deriving (CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool
(CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool)
-> (CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool)
-> Eq CreateApplicationPresignedUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool
$c/= :: CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool
== :: CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool
$c== :: CreateApplicationPresignedUrl
-> CreateApplicationPresignedUrl -> Bool
Prelude.Eq, ReadPrec [CreateApplicationPresignedUrl]
ReadPrec CreateApplicationPresignedUrl
Int -> ReadS CreateApplicationPresignedUrl
ReadS [CreateApplicationPresignedUrl]
(Int -> ReadS CreateApplicationPresignedUrl)
-> ReadS [CreateApplicationPresignedUrl]
-> ReadPrec CreateApplicationPresignedUrl
-> ReadPrec [CreateApplicationPresignedUrl]
-> Read CreateApplicationPresignedUrl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApplicationPresignedUrl]
$creadListPrec :: ReadPrec [CreateApplicationPresignedUrl]
readPrec :: ReadPrec CreateApplicationPresignedUrl
$creadPrec :: ReadPrec CreateApplicationPresignedUrl
readList :: ReadS [CreateApplicationPresignedUrl]
$creadList :: ReadS [CreateApplicationPresignedUrl]
readsPrec :: Int -> ReadS CreateApplicationPresignedUrl
$creadsPrec :: Int -> ReadS CreateApplicationPresignedUrl
Prelude.Read, Int -> CreateApplicationPresignedUrl -> ShowS
[CreateApplicationPresignedUrl] -> ShowS
CreateApplicationPresignedUrl -> String
(Int -> CreateApplicationPresignedUrl -> ShowS)
-> (CreateApplicationPresignedUrl -> String)
-> ([CreateApplicationPresignedUrl] -> ShowS)
-> Show CreateApplicationPresignedUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApplicationPresignedUrl] -> ShowS
$cshowList :: [CreateApplicationPresignedUrl] -> ShowS
show :: CreateApplicationPresignedUrl -> String
$cshow :: CreateApplicationPresignedUrl -> String
showsPrec :: Int -> CreateApplicationPresignedUrl -> ShowS
$cshowsPrec :: Int -> CreateApplicationPresignedUrl -> ShowS
Prelude.Show, (forall x.
CreateApplicationPresignedUrl
-> Rep CreateApplicationPresignedUrl x)
-> (forall x.
Rep CreateApplicationPresignedUrl x
-> CreateApplicationPresignedUrl)
-> Generic CreateApplicationPresignedUrl
forall x.
Rep CreateApplicationPresignedUrl x
-> CreateApplicationPresignedUrl
forall x.
CreateApplicationPresignedUrl
-> Rep CreateApplicationPresignedUrl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApplicationPresignedUrl x
-> CreateApplicationPresignedUrl
$cfrom :: forall x.
CreateApplicationPresignedUrl
-> Rep CreateApplicationPresignedUrl x
Prelude.Generic)
newCreateApplicationPresignedUrl ::
Prelude.Text ->
UrlType ->
CreateApplicationPresignedUrl
newCreateApplicationPresignedUrl :: Text -> UrlType -> CreateApplicationPresignedUrl
newCreateApplicationPresignedUrl
Text
pApplicationName_
UrlType
pUrlType_ =
CreateApplicationPresignedUrl' :: Maybe Natural -> Text -> UrlType -> CreateApplicationPresignedUrl
CreateApplicationPresignedUrl'
{ $sel:sessionExpirationDurationInSeconds:CreateApplicationPresignedUrl' :: Maybe Natural
sessionExpirationDurationInSeconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:applicationName:CreateApplicationPresignedUrl' :: Text
applicationName = Text
pApplicationName_,
$sel:urlType:CreateApplicationPresignedUrl' :: UrlType
urlType = UrlType
pUrlType_
}
createApplicationPresignedUrl_sessionExpirationDurationInSeconds :: Lens.Lens' CreateApplicationPresignedUrl (Prelude.Maybe Prelude.Natural)
createApplicationPresignedUrl_sessionExpirationDurationInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> CreateApplicationPresignedUrl -> f CreateApplicationPresignedUrl
createApplicationPresignedUrl_sessionExpirationDurationInSeconds = (CreateApplicationPresignedUrl -> Maybe Natural)
-> (CreateApplicationPresignedUrl
-> Maybe Natural -> CreateApplicationPresignedUrl)
-> Lens
CreateApplicationPresignedUrl
CreateApplicationPresignedUrl
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationPresignedUrl' {Maybe Natural
sessionExpirationDurationInSeconds :: Maybe Natural
$sel:sessionExpirationDurationInSeconds:CreateApplicationPresignedUrl' :: CreateApplicationPresignedUrl -> Maybe Natural
sessionExpirationDurationInSeconds} -> Maybe Natural
sessionExpirationDurationInSeconds) (\s :: CreateApplicationPresignedUrl
s@CreateApplicationPresignedUrl' {} Maybe Natural
a -> CreateApplicationPresignedUrl
s {$sel:sessionExpirationDurationInSeconds:CreateApplicationPresignedUrl' :: Maybe Natural
sessionExpirationDurationInSeconds = Maybe Natural
a} :: CreateApplicationPresignedUrl)
createApplicationPresignedUrl_applicationName :: Lens.Lens' CreateApplicationPresignedUrl Prelude.Text
createApplicationPresignedUrl_applicationName :: (Text -> f Text)
-> CreateApplicationPresignedUrl -> f CreateApplicationPresignedUrl
createApplicationPresignedUrl_applicationName = (CreateApplicationPresignedUrl -> Text)
-> (CreateApplicationPresignedUrl
-> Text -> CreateApplicationPresignedUrl)
-> Lens
CreateApplicationPresignedUrl
CreateApplicationPresignedUrl
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationPresignedUrl' {Text
applicationName :: Text
$sel:applicationName:CreateApplicationPresignedUrl' :: CreateApplicationPresignedUrl -> Text
applicationName} -> Text
applicationName) (\s :: CreateApplicationPresignedUrl
s@CreateApplicationPresignedUrl' {} Text
a -> CreateApplicationPresignedUrl
s {$sel:applicationName:CreateApplicationPresignedUrl' :: Text
applicationName = Text
a} :: CreateApplicationPresignedUrl)
createApplicationPresignedUrl_urlType :: Lens.Lens' CreateApplicationPresignedUrl UrlType
createApplicationPresignedUrl_urlType :: (UrlType -> f UrlType)
-> CreateApplicationPresignedUrl -> f CreateApplicationPresignedUrl
createApplicationPresignedUrl_urlType = (CreateApplicationPresignedUrl -> UrlType)
-> (CreateApplicationPresignedUrl
-> UrlType -> CreateApplicationPresignedUrl)
-> Lens
CreateApplicationPresignedUrl
CreateApplicationPresignedUrl
UrlType
UrlType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationPresignedUrl' {UrlType
urlType :: UrlType
$sel:urlType:CreateApplicationPresignedUrl' :: CreateApplicationPresignedUrl -> UrlType
urlType} -> UrlType
urlType) (\s :: CreateApplicationPresignedUrl
s@CreateApplicationPresignedUrl' {} UrlType
a -> CreateApplicationPresignedUrl
s {$sel:urlType:CreateApplicationPresignedUrl' :: UrlType
urlType = UrlType
a} :: CreateApplicationPresignedUrl)
instance
Core.AWSRequest
CreateApplicationPresignedUrl
where
type
AWSResponse CreateApplicationPresignedUrl =
CreateApplicationPresignedUrlResponse
request :: CreateApplicationPresignedUrl
-> Request CreateApplicationPresignedUrl
request = Service
-> CreateApplicationPresignedUrl
-> Request CreateApplicationPresignedUrl
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateApplicationPresignedUrl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateApplicationPresignedUrl)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateApplicationPresignedUrl))
-> Logger
-> Service
-> Proxy CreateApplicationPresignedUrl
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateApplicationPresignedUrl)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateApplicationPresignedUrlResponse
CreateApplicationPresignedUrlResponse'
(Maybe Text -> Int -> CreateApplicationPresignedUrlResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateApplicationPresignedUrlResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AuthorizedUrl")
Either String (Int -> CreateApplicationPresignedUrlResponse)
-> Either String Int
-> Either String CreateApplicationPresignedUrlResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
CreateApplicationPresignedUrl
instance Prelude.NFData CreateApplicationPresignedUrl
instance Core.ToHeaders CreateApplicationPresignedUrl where
toHeaders :: CreateApplicationPresignedUrl -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateApplicationPresignedUrl -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"KinesisAnalytics_20180523.CreateApplicationPresignedUrl" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateApplicationPresignedUrl where
toJSON :: CreateApplicationPresignedUrl -> Value
toJSON CreateApplicationPresignedUrl' {Maybe Natural
Text
UrlType
urlType :: UrlType
applicationName :: Text
sessionExpirationDurationInSeconds :: Maybe Natural
$sel:urlType:CreateApplicationPresignedUrl' :: CreateApplicationPresignedUrl -> UrlType
$sel:applicationName:CreateApplicationPresignedUrl' :: CreateApplicationPresignedUrl -> Text
$sel:sessionExpirationDurationInSeconds:CreateApplicationPresignedUrl' :: CreateApplicationPresignedUrl -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SessionExpirationDurationInSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
sessionExpirationDurationInSeconds,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ApplicationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UrlType" Text -> UrlType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= UrlType
urlType)
]
)
instance Core.ToPath CreateApplicationPresignedUrl where
toPath :: CreateApplicationPresignedUrl -> ByteString
toPath = ByteString -> CreateApplicationPresignedUrl -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateApplicationPresignedUrl where
toQuery :: CreateApplicationPresignedUrl -> QueryString
toQuery = QueryString -> CreateApplicationPresignedUrl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateApplicationPresignedUrlResponse = CreateApplicationPresignedUrlResponse'
{
CreateApplicationPresignedUrlResponse -> Maybe Text
authorizedUrl :: Prelude.Maybe Prelude.Text,
CreateApplicationPresignedUrlResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool
(CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool)
-> (CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool)
-> Eq CreateApplicationPresignedUrlResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool
$c/= :: CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool
== :: CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool
$c== :: CreateApplicationPresignedUrlResponse
-> CreateApplicationPresignedUrlResponse -> Bool
Prelude.Eq, ReadPrec [CreateApplicationPresignedUrlResponse]
ReadPrec CreateApplicationPresignedUrlResponse
Int -> ReadS CreateApplicationPresignedUrlResponse
ReadS [CreateApplicationPresignedUrlResponse]
(Int -> ReadS CreateApplicationPresignedUrlResponse)
-> ReadS [CreateApplicationPresignedUrlResponse]
-> ReadPrec CreateApplicationPresignedUrlResponse
-> ReadPrec [CreateApplicationPresignedUrlResponse]
-> Read CreateApplicationPresignedUrlResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApplicationPresignedUrlResponse]
$creadListPrec :: ReadPrec [CreateApplicationPresignedUrlResponse]
readPrec :: ReadPrec CreateApplicationPresignedUrlResponse
$creadPrec :: ReadPrec CreateApplicationPresignedUrlResponse
readList :: ReadS [CreateApplicationPresignedUrlResponse]
$creadList :: ReadS [CreateApplicationPresignedUrlResponse]
readsPrec :: Int -> ReadS CreateApplicationPresignedUrlResponse
$creadsPrec :: Int -> ReadS CreateApplicationPresignedUrlResponse
Prelude.Read, Int -> CreateApplicationPresignedUrlResponse -> ShowS
[CreateApplicationPresignedUrlResponse] -> ShowS
CreateApplicationPresignedUrlResponse -> String
(Int -> CreateApplicationPresignedUrlResponse -> ShowS)
-> (CreateApplicationPresignedUrlResponse -> String)
-> ([CreateApplicationPresignedUrlResponse] -> ShowS)
-> Show CreateApplicationPresignedUrlResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApplicationPresignedUrlResponse] -> ShowS
$cshowList :: [CreateApplicationPresignedUrlResponse] -> ShowS
show :: CreateApplicationPresignedUrlResponse -> String
$cshow :: CreateApplicationPresignedUrlResponse -> String
showsPrec :: Int -> CreateApplicationPresignedUrlResponse -> ShowS
$cshowsPrec :: Int -> CreateApplicationPresignedUrlResponse -> ShowS
Prelude.Show, (forall x.
CreateApplicationPresignedUrlResponse
-> Rep CreateApplicationPresignedUrlResponse x)
-> (forall x.
Rep CreateApplicationPresignedUrlResponse x
-> CreateApplicationPresignedUrlResponse)
-> Generic CreateApplicationPresignedUrlResponse
forall x.
Rep CreateApplicationPresignedUrlResponse x
-> CreateApplicationPresignedUrlResponse
forall x.
CreateApplicationPresignedUrlResponse
-> Rep CreateApplicationPresignedUrlResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApplicationPresignedUrlResponse x
-> CreateApplicationPresignedUrlResponse
$cfrom :: forall x.
CreateApplicationPresignedUrlResponse
-> Rep CreateApplicationPresignedUrlResponse x
Prelude.Generic)
newCreateApplicationPresignedUrlResponse ::
Prelude.Int ->
CreateApplicationPresignedUrlResponse
newCreateApplicationPresignedUrlResponse :: Int -> CreateApplicationPresignedUrlResponse
newCreateApplicationPresignedUrlResponse Int
pHttpStatus_ =
CreateApplicationPresignedUrlResponse' :: Maybe Text -> Int -> CreateApplicationPresignedUrlResponse
CreateApplicationPresignedUrlResponse'
{ $sel:authorizedUrl:CreateApplicationPresignedUrlResponse' :: Maybe Text
authorizedUrl =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateApplicationPresignedUrlResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createApplicationPresignedUrlResponse_authorizedUrl :: Lens.Lens' CreateApplicationPresignedUrlResponse (Prelude.Maybe Prelude.Text)
createApplicationPresignedUrlResponse_authorizedUrl :: (Maybe Text -> f (Maybe Text))
-> CreateApplicationPresignedUrlResponse
-> f CreateApplicationPresignedUrlResponse
createApplicationPresignedUrlResponse_authorizedUrl = (CreateApplicationPresignedUrlResponse -> Maybe Text)
-> (CreateApplicationPresignedUrlResponse
-> Maybe Text -> CreateApplicationPresignedUrlResponse)
-> Lens
CreateApplicationPresignedUrlResponse
CreateApplicationPresignedUrlResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationPresignedUrlResponse' {Maybe Text
authorizedUrl :: Maybe Text
$sel:authorizedUrl:CreateApplicationPresignedUrlResponse' :: CreateApplicationPresignedUrlResponse -> Maybe Text
authorizedUrl} -> Maybe Text
authorizedUrl) (\s :: CreateApplicationPresignedUrlResponse
s@CreateApplicationPresignedUrlResponse' {} Maybe Text
a -> CreateApplicationPresignedUrlResponse
s {$sel:authorizedUrl:CreateApplicationPresignedUrlResponse' :: Maybe Text
authorizedUrl = Maybe Text
a} :: CreateApplicationPresignedUrlResponse)
createApplicationPresignedUrlResponse_httpStatus :: Lens.Lens' CreateApplicationPresignedUrlResponse Prelude.Int
createApplicationPresignedUrlResponse_httpStatus :: (Int -> f Int)
-> CreateApplicationPresignedUrlResponse
-> f CreateApplicationPresignedUrlResponse
createApplicationPresignedUrlResponse_httpStatus = (CreateApplicationPresignedUrlResponse -> Int)
-> (CreateApplicationPresignedUrlResponse
-> Int -> CreateApplicationPresignedUrlResponse)
-> Lens
CreateApplicationPresignedUrlResponse
CreateApplicationPresignedUrlResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationPresignedUrlResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateApplicationPresignedUrlResponse' :: CreateApplicationPresignedUrlResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateApplicationPresignedUrlResponse
s@CreateApplicationPresignedUrlResponse' {} Int
a -> CreateApplicationPresignedUrlResponse
s {$sel:httpStatus:CreateApplicationPresignedUrlResponse' :: Int
httpStatus = Int
a} :: CreateApplicationPresignedUrlResponse)
instance
Prelude.NFData
CreateApplicationPresignedUrlResponse