{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.IoTSiteWise.Types.ForwardingConfig where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.ForwardingConfigState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ForwardingConfig = ForwardingConfig'
{
ForwardingConfig -> ForwardingConfigState
state :: ForwardingConfigState
}
deriving (ForwardingConfig -> ForwardingConfig -> Bool
(ForwardingConfig -> ForwardingConfig -> Bool)
-> (ForwardingConfig -> ForwardingConfig -> Bool)
-> Eq ForwardingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ForwardingConfig -> ForwardingConfig -> Bool
$c/= :: ForwardingConfig -> ForwardingConfig -> Bool
== :: ForwardingConfig -> ForwardingConfig -> Bool
$c== :: ForwardingConfig -> ForwardingConfig -> Bool
Prelude.Eq, ReadPrec [ForwardingConfig]
ReadPrec ForwardingConfig
Int -> ReadS ForwardingConfig
ReadS [ForwardingConfig]
(Int -> ReadS ForwardingConfig)
-> ReadS [ForwardingConfig]
-> ReadPrec ForwardingConfig
-> ReadPrec [ForwardingConfig]
-> Read ForwardingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ForwardingConfig]
$creadListPrec :: ReadPrec [ForwardingConfig]
readPrec :: ReadPrec ForwardingConfig
$creadPrec :: ReadPrec ForwardingConfig
readList :: ReadS [ForwardingConfig]
$creadList :: ReadS [ForwardingConfig]
readsPrec :: Int -> ReadS ForwardingConfig
$creadsPrec :: Int -> ReadS ForwardingConfig
Prelude.Read, Int -> ForwardingConfig -> ShowS
[ForwardingConfig] -> ShowS
ForwardingConfig -> String
(Int -> ForwardingConfig -> ShowS)
-> (ForwardingConfig -> String)
-> ([ForwardingConfig] -> ShowS)
-> Show ForwardingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ForwardingConfig] -> ShowS
$cshowList :: [ForwardingConfig] -> ShowS
show :: ForwardingConfig -> String
$cshow :: ForwardingConfig -> String
showsPrec :: Int -> ForwardingConfig -> ShowS
$cshowsPrec :: Int -> ForwardingConfig -> ShowS
Prelude.Show, (forall x. ForwardingConfig -> Rep ForwardingConfig x)
-> (forall x. Rep ForwardingConfig x -> ForwardingConfig)
-> Generic ForwardingConfig
forall x. Rep ForwardingConfig x -> ForwardingConfig
forall x. ForwardingConfig -> Rep ForwardingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ForwardingConfig x -> ForwardingConfig
$cfrom :: forall x. ForwardingConfig -> Rep ForwardingConfig x
Prelude.Generic)
newForwardingConfig ::
ForwardingConfigState ->
ForwardingConfig
newForwardingConfig :: ForwardingConfigState -> ForwardingConfig
newForwardingConfig ForwardingConfigState
pState_ =
ForwardingConfig' :: ForwardingConfigState -> ForwardingConfig
ForwardingConfig' {$sel:state:ForwardingConfig' :: ForwardingConfigState
state = ForwardingConfigState
pState_}
forwardingConfig_state :: Lens.Lens' ForwardingConfig ForwardingConfigState
forwardingConfig_state :: (ForwardingConfigState -> f ForwardingConfigState)
-> ForwardingConfig -> f ForwardingConfig
forwardingConfig_state = (ForwardingConfig -> ForwardingConfigState)
-> (ForwardingConfig -> ForwardingConfigState -> ForwardingConfig)
-> Lens
ForwardingConfig
ForwardingConfig
ForwardingConfigState
ForwardingConfigState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ForwardingConfig' {ForwardingConfigState
state :: ForwardingConfigState
$sel:state:ForwardingConfig' :: ForwardingConfig -> ForwardingConfigState
state} -> ForwardingConfigState
state) (\s :: ForwardingConfig
s@ForwardingConfig' {} ForwardingConfigState
a -> ForwardingConfig
s {$sel:state:ForwardingConfig' :: ForwardingConfigState
state = ForwardingConfigState
a} :: ForwardingConfig)
instance Core.FromJSON ForwardingConfig where
parseJSON :: Value -> Parser ForwardingConfig
parseJSON =
String
-> (Object -> Parser ForwardingConfig)
-> Value
-> Parser ForwardingConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ForwardingConfig"
( \Object
x ->
ForwardingConfigState -> ForwardingConfig
ForwardingConfig' (ForwardingConfigState -> ForwardingConfig)
-> Parser ForwardingConfigState -> Parser ForwardingConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser ForwardingConfigState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"state")
)
instance Prelude.Hashable ForwardingConfig
instance Prelude.NFData ForwardingConfig
instance Core.ToJSON ForwardingConfig where
toJSON :: ForwardingConfig -> Value
toJSON ForwardingConfig' {ForwardingConfigState
state :: ForwardingConfigState
$sel:state:ForwardingConfig' :: ForwardingConfig -> ForwardingConfigState
..} =
[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
"state" Text -> ForwardingConfigState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ForwardingConfigState
state)]
)