{-# 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.KinesisAnalytics.AddApplicationInput
(
AddApplicationInput (..),
newAddApplicationInput,
addApplicationInput_applicationName,
addApplicationInput_currentApplicationVersionId,
addApplicationInput_input,
AddApplicationInputResponse (..),
newAddApplicationInputResponse,
addApplicationInputResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.KinesisAnalytics.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 AddApplicationInput = AddApplicationInput'
{
AddApplicationInput -> Text
applicationName :: Prelude.Text,
AddApplicationInput -> Natural
currentApplicationVersionId :: Prelude.Natural,
AddApplicationInput -> Input
input :: Input
}
deriving (AddApplicationInput -> AddApplicationInput -> Bool
(AddApplicationInput -> AddApplicationInput -> Bool)
-> (AddApplicationInput -> AddApplicationInput -> Bool)
-> Eq AddApplicationInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddApplicationInput -> AddApplicationInput -> Bool
$c/= :: AddApplicationInput -> AddApplicationInput -> Bool
== :: AddApplicationInput -> AddApplicationInput -> Bool
$c== :: AddApplicationInput -> AddApplicationInput -> Bool
Prelude.Eq, ReadPrec [AddApplicationInput]
ReadPrec AddApplicationInput
Int -> ReadS AddApplicationInput
ReadS [AddApplicationInput]
(Int -> ReadS AddApplicationInput)
-> ReadS [AddApplicationInput]
-> ReadPrec AddApplicationInput
-> ReadPrec [AddApplicationInput]
-> Read AddApplicationInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddApplicationInput]
$creadListPrec :: ReadPrec [AddApplicationInput]
readPrec :: ReadPrec AddApplicationInput
$creadPrec :: ReadPrec AddApplicationInput
readList :: ReadS [AddApplicationInput]
$creadList :: ReadS [AddApplicationInput]
readsPrec :: Int -> ReadS AddApplicationInput
$creadsPrec :: Int -> ReadS AddApplicationInput
Prelude.Read, Int -> AddApplicationInput -> ShowS
[AddApplicationInput] -> ShowS
AddApplicationInput -> String
(Int -> AddApplicationInput -> ShowS)
-> (AddApplicationInput -> String)
-> ([AddApplicationInput] -> ShowS)
-> Show AddApplicationInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddApplicationInput] -> ShowS
$cshowList :: [AddApplicationInput] -> ShowS
show :: AddApplicationInput -> String
$cshow :: AddApplicationInput -> String
showsPrec :: Int -> AddApplicationInput -> ShowS
$cshowsPrec :: Int -> AddApplicationInput -> ShowS
Prelude.Show, (forall x. AddApplicationInput -> Rep AddApplicationInput x)
-> (forall x. Rep AddApplicationInput x -> AddApplicationInput)
-> Generic AddApplicationInput
forall x. Rep AddApplicationInput x -> AddApplicationInput
forall x. AddApplicationInput -> Rep AddApplicationInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddApplicationInput x -> AddApplicationInput
$cfrom :: forall x. AddApplicationInput -> Rep AddApplicationInput x
Prelude.Generic)
newAddApplicationInput ::
Prelude.Text ->
Prelude.Natural ->
Input ->
AddApplicationInput
newAddApplicationInput :: Text -> Natural -> Input -> AddApplicationInput
newAddApplicationInput
Text
pApplicationName_
Natural
pCurrentApplicationVersionId_
Input
pInput_ =
AddApplicationInput' :: Text -> Natural -> Input -> AddApplicationInput
AddApplicationInput'
{ $sel:applicationName:AddApplicationInput' :: Text
applicationName =
Text
pApplicationName_,
$sel:currentApplicationVersionId:AddApplicationInput' :: Natural
currentApplicationVersionId =
Natural
pCurrentApplicationVersionId_,
$sel:input:AddApplicationInput' :: Input
input = Input
pInput_
}
addApplicationInput_applicationName :: Lens.Lens' AddApplicationInput Prelude.Text
addApplicationInput_applicationName :: (Text -> f Text) -> AddApplicationInput -> f AddApplicationInput
addApplicationInput_applicationName = (AddApplicationInput -> Text)
-> (AddApplicationInput -> Text -> AddApplicationInput)
-> Lens AddApplicationInput AddApplicationInput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationInput' {Text
applicationName :: Text
$sel:applicationName:AddApplicationInput' :: AddApplicationInput -> Text
applicationName} -> Text
applicationName) (\s :: AddApplicationInput
s@AddApplicationInput' {} Text
a -> AddApplicationInput
s {$sel:applicationName:AddApplicationInput' :: Text
applicationName = Text
a} :: AddApplicationInput)
addApplicationInput_currentApplicationVersionId :: Lens.Lens' AddApplicationInput Prelude.Natural
addApplicationInput_currentApplicationVersionId :: (Natural -> f Natural)
-> AddApplicationInput -> f AddApplicationInput
addApplicationInput_currentApplicationVersionId = (AddApplicationInput -> Natural)
-> (AddApplicationInput -> Natural -> AddApplicationInput)
-> Lens AddApplicationInput AddApplicationInput Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationInput' {Natural
currentApplicationVersionId :: Natural
$sel:currentApplicationVersionId:AddApplicationInput' :: AddApplicationInput -> Natural
currentApplicationVersionId} -> Natural
currentApplicationVersionId) (\s :: AddApplicationInput
s@AddApplicationInput' {} Natural
a -> AddApplicationInput
s {$sel:currentApplicationVersionId:AddApplicationInput' :: Natural
currentApplicationVersionId = Natural
a} :: AddApplicationInput)
addApplicationInput_input :: Lens.Lens' AddApplicationInput Input
addApplicationInput_input :: (Input -> f Input) -> AddApplicationInput -> f AddApplicationInput
addApplicationInput_input = (AddApplicationInput -> Input)
-> (AddApplicationInput -> Input -> AddApplicationInput)
-> Lens AddApplicationInput AddApplicationInput Input Input
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationInput' {Input
input :: Input
$sel:input:AddApplicationInput' :: AddApplicationInput -> Input
input} -> Input
input) (\s :: AddApplicationInput
s@AddApplicationInput' {} Input
a -> AddApplicationInput
s {$sel:input:AddApplicationInput' :: Input
input = Input
a} :: AddApplicationInput)
instance Core.AWSRequest AddApplicationInput where
type
AWSResponse AddApplicationInput =
AddApplicationInputResponse
request :: AddApplicationInput -> Request AddApplicationInput
request = Service -> AddApplicationInput -> Request AddApplicationInput
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddApplicationInput
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddApplicationInput)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AddApplicationInput))
-> Logger
-> Service
-> Proxy AddApplicationInput
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddApplicationInput)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AddApplicationInputResponse
AddApplicationInputResponse'
(Int -> AddApplicationInputResponse)
-> Either String Int -> Either String AddApplicationInputResponse
forall (f :: * -> *) a b. Functor 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 AddApplicationInput
instance Prelude.NFData AddApplicationInput
instance Core.ToHeaders AddApplicationInput where
toHeaders :: AddApplicationInput -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddApplicationInput -> 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_20150814.AddApplicationInput" ::
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 AddApplicationInput where
toJSON :: AddApplicationInput -> Value
toJSON AddApplicationInput' {Natural
Text
Input
input :: Input
currentApplicationVersionId :: Natural
applicationName :: Text
$sel:input:AddApplicationInput' :: AddApplicationInput -> Input
$sel:currentApplicationVersionId:AddApplicationInput' :: AddApplicationInput -> Natural
$sel:applicationName:AddApplicationInput' :: AddApplicationInput -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ 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
"CurrentApplicationVersionId"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
currentApplicationVersionId
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Input" Text -> Input -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Input
input)
]
)
instance Core.ToPath AddApplicationInput where
toPath :: AddApplicationInput -> ByteString
toPath = ByteString -> AddApplicationInput -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddApplicationInput where
toQuery :: AddApplicationInput -> QueryString
toQuery = QueryString -> AddApplicationInput -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddApplicationInputResponse = AddApplicationInputResponse'
{
AddApplicationInputResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddApplicationInputResponse -> AddApplicationInputResponse -> Bool
(AddApplicationInputResponse
-> AddApplicationInputResponse -> Bool)
-> (AddApplicationInputResponse
-> AddApplicationInputResponse -> Bool)
-> Eq AddApplicationInputResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddApplicationInputResponse -> AddApplicationInputResponse -> Bool
$c/= :: AddApplicationInputResponse -> AddApplicationInputResponse -> Bool
== :: AddApplicationInputResponse -> AddApplicationInputResponse -> Bool
$c== :: AddApplicationInputResponse -> AddApplicationInputResponse -> Bool
Prelude.Eq, ReadPrec [AddApplicationInputResponse]
ReadPrec AddApplicationInputResponse
Int -> ReadS AddApplicationInputResponse
ReadS [AddApplicationInputResponse]
(Int -> ReadS AddApplicationInputResponse)
-> ReadS [AddApplicationInputResponse]
-> ReadPrec AddApplicationInputResponse
-> ReadPrec [AddApplicationInputResponse]
-> Read AddApplicationInputResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddApplicationInputResponse]
$creadListPrec :: ReadPrec [AddApplicationInputResponse]
readPrec :: ReadPrec AddApplicationInputResponse
$creadPrec :: ReadPrec AddApplicationInputResponse
readList :: ReadS [AddApplicationInputResponse]
$creadList :: ReadS [AddApplicationInputResponse]
readsPrec :: Int -> ReadS AddApplicationInputResponse
$creadsPrec :: Int -> ReadS AddApplicationInputResponse
Prelude.Read, Int -> AddApplicationInputResponse -> ShowS
[AddApplicationInputResponse] -> ShowS
AddApplicationInputResponse -> String
(Int -> AddApplicationInputResponse -> ShowS)
-> (AddApplicationInputResponse -> String)
-> ([AddApplicationInputResponse] -> ShowS)
-> Show AddApplicationInputResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddApplicationInputResponse] -> ShowS
$cshowList :: [AddApplicationInputResponse] -> ShowS
show :: AddApplicationInputResponse -> String
$cshow :: AddApplicationInputResponse -> String
showsPrec :: Int -> AddApplicationInputResponse -> ShowS
$cshowsPrec :: Int -> AddApplicationInputResponse -> ShowS
Prelude.Show, (forall x.
AddApplicationInputResponse -> Rep AddApplicationInputResponse x)
-> (forall x.
Rep AddApplicationInputResponse x -> AddApplicationInputResponse)
-> Generic AddApplicationInputResponse
forall x.
Rep AddApplicationInputResponse x -> AddApplicationInputResponse
forall x.
AddApplicationInputResponse -> Rep AddApplicationInputResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddApplicationInputResponse x -> AddApplicationInputResponse
$cfrom :: forall x.
AddApplicationInputResponse -> Rep AddApplicationInputResponse x
Prelude.Generic)
newAddApplicationInputResponse ::
Prelude.Int ->
AddApplicationInputResponse
newAddApplicationInputResponse :: Int -> AddApplicationInputResponse
newAddApplicationInputResponse Int
pHttpStatus_ =
AddApplicationInputResponse' :: Int -> AddApplicationInputResponse
AddApplicationInputResponse'
{ $sel:httpStatus:AddApplicationInputResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
addApplicationInputResponse_httpStatus :: Lens.Lens' AddApplicationInputResponse Prelude.Int
addApplicationInputResponse_httpStatus :: (Int -> f Int)
-> AddApplicationInputResponse -> f AddApplicationInputResponse
addApplicationInputResponse_httpStatus = (AddApplicationInputResponse -> Int)
-> (AddApplicationInputResponse
-> Int -> AddApplicationInputResponse)
-> Lens
AddApplicationInputResponse AddApplicationInputResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddApplicationInputResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddApplicationInputResponse' :: AddApplicationInputResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddApplicationInputResponse
s@AddApplicationInputResponse' {} Int
a -> AddApplicationInputResponse
s {$sel:httpStatus:AddApplicationInputResponse' :: Int
httpStatus = Int
a} :: AddApplicationInputResponse)
instance Prelude.NFData AddApplicationInputResponse