{-# 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.IoTEvents.UpdateInput
(
UpdateInput (..),
newUpdateInput,
updateInput_inputDescription,
updateInput_inputName,
updateInput_inputDefinition,
UpdateInputResponse (..),
newUpdateInputResponse,
updateInputResponse_inputConfiguration,
updateInputResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTEvents.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateInput = UpdateInput'
{
UpdateInput -> Maybe Text
inputDescription :: Prelude.Maybe Prelude.Text,
UpdateInput -> Text
inputName :: Prelude.Text,
UpdateInput -> InputDefinition
inputDefinition :: InputDefinition
}
deriving (UpdateInput -> UpdateInput -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInput -> UpdateInput -> Bool
$c/= :: UpdateInput -> UpdateInput -> Bool
== :: UpdateInput -> UpdateInput -> Bool
$c== :: UpdateInput -> UpdateInput -> Bool
Prelude.Eq, ReadPrec [UpdateInput]
ReadPrec UpdateInput
Int -> ReadS UpdateInput
ReadS [UpdateInput]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInput]
$creadListPrec :: ReadPrec [UpdateInput]
readPrec :: ReadPrec UpdateInput
$creadPrec :: ReadPrec UpdateInput
readList :: ReadS [UpdateInput]
$creadList :: ReadS [UpdateInput]
readsPrec :: Int -> ReadS UpdateInput
$creadsPrec :: Int -> ReadS UpdateInput
Prelude.Read, Int -> UpdateInput -> ShowS
[UpdateInput] -> ShowS
UpdateInput -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInput] -> ShowS
$cshowList :: [UpdateInput] -> ShowS
show :: UpdateInput -> String
$cshow :: UpdateInput -> String
showsPrec :: Int -> UpdateInput -> ShowS
$cshowsPrec :: Int -> UpdateInput -> ShowS
Prelude.Show, forall x. Rep UpdateInput x -> UpdateInput
forall x. UpdateInput -> Rep UpdateInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateInput x -> UpdateInput
$cfrom :: forall x. UpdateInput -> Rep UpdateInput x
Prelude.Generic)
newUpdateInput ::
Prelude.Text ->
InputDefinition ->
UpdateInput
newUpdateInput :: Text -> InputDefinition -> UpdateInput
newUpdateInput Text
pInputName_ InputDefinition
pInputDefinition_ =
UpdateInput'
{ $sel:inputDescription:UpdateInput' :: Maybe Text
inputDescription = forall a. Maybe a
Prelude.Nothing,
$sel:inputName:UpdateInput' :: Text
inputName = Text
pInputName_,
$sel:inputDefinition:UpdateInput' :: InputDefinition
inputDefinition = InputDefinition
pInputDefinition_
}
updateInput_inputDescription :: Lens.Lens' UpdateInput (Prelude.Maybe Prelude.Text)
updateInput_inputDescription :: Lens' UpdateInput (Maybe Text)
updateInput_inputDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInput' {Maybe Text
inputDescription :: Maybe Text
$sel:inputDescription:UpdateInput' :: UpdateInput -> Maybe Text
inputDescription} -> Maybe Text
inputDescription) (\s :: UpdateInput
s@UpdateInput' {} Maybe Text
a -> UpdateInput
s {$sel:inputDescription:UpdateInput' :: Maybe Text
inputDescription = Maybe Text
a} :: UpdateInput)
updateInput_inputName :: Lens.Lens' UpdateInput Prelude.Text
updateInput_inputName :: Lens' UpdateInput Text
updateInput_inputName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInput' {Text
inputName :: Text
$sel:inputName:UpdateInput' :: UpdateInput -> Text
inputName} -> Text
inputName) (\s :: UpdateInput
s@UpdateInput' {} Text
a -> UpdateInput
s {$sel:inputName:UpdateInput' :: Text
inputName = Text
a} :: UpdateInput)
updateInput_inputDefinition :: Lens.Lens' UpdateInput InputDefinition
updateInput_inputDefinition :: Lens' UpdateInput InputDefinition
updateInput_inputDefinition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInput' {InputDefinition
inputDefinition :: InputDefinition
$sel:inputDefinition:UpdateInput' :: UpdateInput -> InputDefinition
inputDefinition} -> InputDefinition
inputDefinition) (\s :: UpdateInput
s@UpdateInput' {} InputDefinition
a -> UpdateInput
s {$sel:inputDefinition:UpdateInput' :: InputDefinition
inputDefinition = InputDefinition
a} :: UpdateInput)
instance Core.AWSRequest UpdateInput where
type AWSResponse UpdateInput = UpdateInputResponse
request :: (Service -> Service) -> UpdateInput -> Request UpdateInput
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateInput
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateInput)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe InputConfiguration -> Int -> UpdateInputResponse
UpdateInputResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"inputConfiguration")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateInput where
hashWithSalt :: Int -> UpdateInput -> Int
hashWithSalt Int
_salt UpdateInput' {Maybe Text
Text
InputDefinition
inputDefinition :: InputDefinition
inputName :: Text
inputDescription :: Maybe Text
$sel:inputDefinition:UpdateInput' :: UpdateInput -> InputDefinition
$sel:inputName:UpdateInput' :: UpdateInput -> Text
$sel:inputDescription:UpdateInput' :: UpdateInput -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputDescription
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
inputName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InputDefinition
inputDefinition
instance Prelude.NFData UpdateInput where
rnf :: UpdateInput -> ()
rnf UpdateInput' {Maybe Text
Text
InputDefinition
inputDefinition :: InputDefinition
inputName :: Text
inputDescription :: Maybe Text
$sel:inputDefinition:UpdateInput' :: UpdateInput -> InputDefinition
$sel:inputName:UpdateInput' :: UpdateInput -> Text
$sel:inputDescription:UpdateInput' :: UpdateInput -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputDescription
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
inputName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf InputDefinition
inputDefinition
instance Data.ToHeaders UpdateInput where
toHeaders :: UpdateInput -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON UpdateInput where
toJSON :: UpdateInput -> Value
toJSON UpdateInput' {Maybe Text
Text
InputDefinition
inputDefinition :: InputDefinition
inputName :: Text
inputDescription :: Maybe Text
$sel:inputDefinition:UpdateInput' :: UpdateInput -> InputDefinition
$sel:inputName:UpdateInput' :: UpdateInput -> Text
$sel:inputDescription:UpdateInput' :: UpdateInput -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"inputDescription" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
inputDescription,
forall a. a -> Maybe a
Prelude.Just
(Key
"inputDefinition" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= InputDefinition
inputDefinition)
]
)
instance Data.ToPath UpdateInput where
toPath :: UpdateInput -> ByteString
toPath UpdateInput' {Maybe Text
Text
InputDefinition
inputDefinition :: InputDefinition
inputName :: Text
inputDescription :: Maybe Text
$sel:inputDefinition:UpdateInput' :: UpdateInput -> InputDefinition
$sel:inputName:UpdateInput' :: UpdateInput -> Text
$sel:inputDescription:UpdateInput' :: UpdateInput -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/inputs/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
inputName]
instance Data.ToQuery UpdateInput where
toQuery :: UpdateInput -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateInputResponse = UpdateInputResponse'
{
UpdateInputResponse -> Maybe InputConfiguration
inputConfiguration :: Prelude.Maybe InputConfiguration,
UpdateInputResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateInputResponse -> UpdateInputResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInputResponse -> UpdateInputResponse -> Bool
$c/= :: UpdateInputResponse -> UpdateInputResponse -> Bool
== :: UpdateInputResponse -> UpdateInputResponse -> Bool
$c== :: UpdateInputResponse -> UpdateInputResponse -> Bool
Prelude.Eq, ReadPrec [UpdateInputResponse]
ReadPrec UpdateInputResponse
Int -> ReadS UpdateInputResponse
ReadS [UpdateInputResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInputResponse]
$creadListPrec :: ReadPrec [UpdateInputResponse]
readPrec :: ReadPrec UpdateInputResponse
$creadPrec :: ReadPrec UpdateInputResponse
readList :: ReadS [UpdateInputResponse]
$creadList :: ReadS [UpdateInputResponse]
readsPrec :: Int -> ReadS UpdateInputResponse
$creadsPrec :: Int -> ReadS UpdateInputResponse
Prelude.Read, Int -> UpdateInputResponse -> ShowS
[UpdateInputResponse] -> ShowS
UpdateInputResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInputResponse] -> ShowS
$cshowList :: [UpdateInputResponse] -> ShowS
show :: UpdateInputResponse -> String
$cshow :: UpdateInputResponse -> String
showsPrec :: Int -> UpdateInputResponse -> ShowS
$cshowsPrec :: Int -> UpdateInputResponse -> ShowS
Prelude.Show, forall x. Rep UpdateInputResponse x -> UpdateInputResponse
forall x. UpdateInputResponse -> Rep UpdateInputResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateInputResponse x -> UpdateInputResponse
$cfrom :: forall x. UpdateInputResponse -> Rep UpdateInputResponse x
Prelude.Generic)
newUpdateInputResponse ::
Prelude.Int ->
UpdateInputResponse
newUpdateInputResponse :: Int -> UpdateInputResponse
newUpdateInputResponse Int
pHttpStatus_ =
UpdateInputResponse'
{ $sel:inputConfiguration:UpdateInputResponse' :: Maybe InputConfiguration
inputConfiguration =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateInputResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateInputResponse_inputConfiguration :: Lens.Lens' UpdateInputResponse (Prelude.Maybe InputConfiguration)
updateInputResponse_inputConfiguration :: Lens' UpdateInputResponse (Maybe InputConfiguration)
updateInputResponse_inputConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInputResponse' {Maybe InputConfiguration
inputConfiguration :: Maybe InputConfiguration
$sel:inputConfiguration:UpdateInputResponse' :: UpdateInputResponse -> Maybe InputConfiguration
inputConfiguration} -> Maybe InputConfiguration
inputConfiguration) (\s :: UpdateInputResponse
s@UpdateInputResponse' {} Maybe InputConfiguration
a -> UpdateInputResponse
s {$sel:inputConfiguration:UpdateInputResponse' :: Maybe InputConfiguration
inputConfiguration = Maybe InputConfiguration
a} :: UpdateInputResponse)
updateInputResponse_httpStatus :: Lens.Lens' UpdateInputResponse Prelude.Int
updateInputResponse_httpStatus :: Lens' UpdateInputResponse Int
updateInputResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInputResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateInputResponse' :: UpdateInputResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateInputResponse
s@UpdateInputResponse' {} Int
a -> UpdateInputResponse
s {$sel:httpStatus:UpdateInputResponse' :: Int
httpStatus = Int
a} :: UpdateInputResponse)
instance Prelude.NFData UpdateInputResponse where
rnf :: UpdateInputResponse -> ()
rnf UpdateInputResponse' {Int
Maybe InputConfiguration
httpStatus :: Int
inputConfiguration :: Maybe InputConfiguration
$sel:httpStatus:UpdateInputResponse' :: UpdateInputResponse -> Int
$sel:inputConfiguration:UpdateInputResponse' :: UpdateInputResponse -> Maybe InputConfiguration
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe InputConfiguration
inputConfiguration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus