{-# 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.IoTWireless.Types.WirelessDeviceLogOption where
import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.LogLevel
import Amazonka.IoTWireless.Types.WirelessDeviceEventLogOption
import Amazonka.IoTWireless.Types.WirelessDeviceType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data WirelessDeviceLogOption = WirelessDeviceLogOption'
{ WirelessDeviceLogOption -> Maybe [WirelessDeviceEventLogOption]
events :: Prelude.Maybe [WirelessDeviceEventLogOption],
WirelessDeviceLogOption -> WirelessDeviceType
type' :: WirelessDeviceType,
WirelessDeviceLogOption -> LogLevel
logLevel :: LogLevel
}
deriving (WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool
(WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool)
-> (WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool)
-> Eq WirelessDeviceLogOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool
$c/= :: WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool
== :: WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool
$c== :: WirelessDeviceLogOption -> WirelessDeviceLogOption -> Bool
Prelude.Eq, ReadPrec [WirelessDeviceLogOption]
ReadPrec WirelessDeviceLogOption
Int -> ReadS WirelessDeviceLogOption
ReadS [WirelessDeviceLogOption]
(Int -> ReadS WirelessDeviceLogOption)
-> ReadS [WirelessDeviceLogOption]
-> ReadPrec WirelessDeviceLogOption
-> ReadPrec [WirelessDeviceLogOption]
-> Read WirelessDeviceLogOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WirelessDeviceLogOption]
$creadListPrec :: ReadPrec [WirelessDeviceLogOption]
readPrec :: ReadPrec WirelessDeviceLogOption
$creadPrec :: ReadPrec WirelessDeviceLogOption
readList :: ReadS [WirelessDeviceLogOption]
$creadList :: ReadS [WirelessDeviceLogOption]
readsPrec :: Int -> ReadS WirelessDeviceLogOption
$creadsPrec :: Int -> ReadS WirelessDeviceLogOption
Prelude.Read, Int -> WirelessDeviceLogOption -> ShowS
[WirelessDeviceLogOption] -> ShowS
WirelessDeviceLogOption -> String
(Int -> WirelessDeviceLogOption -> ShowS)
-> (WirelessDeviceLogOption -> String)
-> ([WirelessDeviceLogOption] -> ShowS)
-> Show WirelessDeviceLogOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WirelessDeviceLogOption] -> ShowS
$cshowList :: [WirelessDeviceLogOption] -> ShowS
show :: WirelessDeviceLogOption -> String
$cshow :: WirelessDeviceLogOption -> String
showsPrec :: Int -> WirelessDeviceLogOption -> ShowS
$cshowsPrec :: Int -> WirelessDeviceLogOption -> ShowS
Prelude.Show, (forall x.
WirelessDeviceLogOption -> Rep WirelessDeviceLogOption x)
-> (forall x.
Rep WirelessDeviceLogOption x -> WirelessDeviceLogOption)
-> Generic WirelessDeviceLogOption
forall x. Rep WirelessDeviceLogOption x -> WirelessDeviceLogOption
forall x. WirelessDeviceLogOption -> Rep WirelessDeviceLogOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WirelessDeviceLogOption x -> WirelessDeviceLogOption
$cfrom :: forall x. WirelessDeviceLogOption -> Rep WirelessDeviceLogOption x
Prelude.Generic)
newWirelessDeviceLogOption ::
WirelessDeviceType ->
LogLevel ->
WirelessDeviceLogOption
newWirelessDeviceLogOption :: WirelessDeviceType -> LogLevel -> WirelessDeviceLogOption
newWirelessDeviceLogOption WirelessDeviceType
pType_ LogLevel
pLogLevel_ =
WirelessDeviceLogOption' :: Maybe [WirelessDeviceEventLogOption]
-> WirelessDeviceType -> LogLevel -> WirelessDeviceLogOption
WirelessDeviceLogOption'
{ $sel:events:WirelessDeviceLogOption' :: Maybe [WirelessDeviceEventLogOption]
events = Maybe [WirelessDeviceEventLogOption]
forall a. Maybe a
Prelude.Nothing,
$sel:type':WirelessDeviceLogOption' :: WirelessDeviceType
type' = WirelessDeviceType
pType_,
$sel:logLevel:WirelessDeviceLogOption' :: LogLevel
logLevel = LogLevel
pLogLevel_
}
wirelessDeviceLogOption_events :: Lens.Lens' WirelessDeviceLogOption (Prelude.Maybe [WirelessDeviceEventLogOption])
wirelessDeviceLogOption_events :: (Maybe [WirelessDeviceEventLogOption]
-> f (Maybe [WirelessDeviceEventLogOption]))
-> WirelessDeviceLogOption -> f WirelessDeviceLogOption
wirelessDeviceLogOption_events = (WirelessDeviceLogOption -> Maybe [WirelessDeviceEventLogOption])
-> (WirelessDeviceLogOption
-> Maybe [WirelessDeviceEventLogOption] -> WirelessDeviceLogOption)
-> Lens
WirelessDeviceLogOption
WirelessDeviceLogOption
(Maybe [WirelessDeviceEventLogOption])
(Maybe [WirelessDeviceEventLogOption])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WirelessDeviceLogOption' {Maybe [WirelessDeviceEventLogOption]
events :: Maybe [WirelessDeviceEventLogOption]
$sel:events:WirelessDeviceLogOption' :: WirelessDeviceLogOption -> Maybe [WirelessDeviceEventLogOption]
events} -> Maybe [WirelessDeviceEventLogOption]
events) (\s :: WirelessDeviceLogOption
s@WirelessDeviceLogOption' {} Maybe [WirelessDeviceEventLogOption]
a -> WirelessDeviceLogOption
s {$sel:events:WirelessDeviceLogOption' :: Maybe [WirelessDeviceEventLogOption]
events = Maybe [WirelessDeviceEventLogOption]
a} :: WirelessDeviceLogOption) ((Maybe [WirelessDeviceEventLogOption]
-> f (Maybe [WirelessDeviceEventLogOption]))
-> WirelessDeviceLogOption -> f WirelessDeviceLogOption)
-> ((Maybe [WirelessDeviceEventLogOption]
-> f (Maybe [WirelessDeviceEventLogOption]))
-> Maybe [WirelessDeviceEventLogOption]
-> f (Maybe [WirelessDeviceEventLogOption]))
-> (Maybe [WirelessDeviceEventLogOption]
-> f (Maybe [WirelessDeviceEventLogOption]))
-> WirelessDeviceLogOption
-> f WirelessDeviceLogOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[WirelessDeviceEventLogOption]
[WirelessDeviceEventLogOption]
[WirelessDeviceEventLogOption]
[WirelessDeviceEventLogOption]
-> Iso
(Maybe [WirelessDeviceEventLogOption])
(Maybe [WirelessDeviceEventLogOption])
(Maybe [WirelessDeviceEventLogOption])
(Maybe [WirelessDeviceEventLogOption])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[WirelessDeviceEventLogOption]
[WirelessDeviceEventLogOption]
[WirelessDeviceEventLogOption]
[WirelessDeviceEventLogOption]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
wirelessDeviceLogOption_type :: Lens.Lens' WirelessDeviceLogOption WirelessDeviceType
wirelessDeviceLogOption_type :: (WirelessDeviceType -> f WirelessDeviceType)
-> WirelessDeviceLogOption -> f WirelessDeviceLogOption
wirelessDeviceLogOption_type = (WirelessDeviceLogOption -> WirelessDeviceType)
-> (WirelessDeviceLogOption
-> WirelessDeviceType -> WirelessDeviceLogOption)
-> Lens
WirelessDeviceLogOption
WirelessDeviceLogOption
WirelessDeviceType
WirelessDeviceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WirelessDeviceLogOption' {WirelessDeviceType
type' :: WirelessDeviceType
$sel:type':WirelessDeviceLogOption' :: WirelessDeviceLogOption -> WirelessDeviceType
type'} -> WirelessDeviceType
type') (\s :: WirelessDeviceLogOption
s@WirelessDeviceLogOption' {} WirelessDeviceType
a -> WirelessDeviceLogOption
s {$sel:type':WirelessDeviceLogOption' :: WirelessDeviceType
type' = WirelessDeviceType
a} :: WirelessDeviceLogOption)
wirelessDeviceLogOption_logLevel :: Lens.Lens' WirelessDeviceLogOption LogLevel
wirelessDeviceLogOption_logLevel :: (LogLevel -> f LogLevel)
-> WirelessDeviceLogOption -> f WirelessDeviceLogOption
wirelessDeviceLogOption_logLevel = (WirelessDeviceLogOption -> LogLevel)
-> (WirelessDeviceLogOption -> LogLevel -> WirelessDeviceLogOption)
-> Lens
WirelessDeviceLogOption WirelessDeviceLogOption LogLevel LogLevel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WirelessDeviceLogOption' {LogLevel
logLevel :: LogLevel
$sel:logLevel:WirelessDeviceLogOption' :: WirelessDeviceLogOption -> LogLevel
logLevel} -> LogLevel
logLevel) (\s :: WirelessDeviceLogOption
s@WirelessDeviceLogOption' {} LogLevel
a -> WirelessDeviceLogOption
s {$sel:logLevel:WirelessDeviceLogOption' :: LogLevel
logLevel = LogLevel
a} :: WirelessDeviceLogOption)
instance Core.FromJSON WirelessDeviceLogOption where
parseJSON :: Value -> Parser WirelessDeviceLogOption
parseJSON =
String
-> (Object -> Parser WirelessDeviceLogOption)
-> Value
-> Parser WirelessDeviceLogOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"WirelessDeviceLogOption"
( \Object
x ->
Maybe [WirelessDeviceEventLogOption]
-> WirelessDeviceType -> LogLevel -> WirelessDeviceLogOption
WirelessDeviceLogOption'
(Maybe [WirelessDeviceEventLogOption]
-> WirelessDeviceType -> LogLevel -> WirelessDeviceLogOption)
-> Parser (Maybe [WirelessDeviceEventLogOption])
-> Parser
(WirelessDeviceType -> LogLevel -> WirelessDeviceLogOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [WirelessDeviceEventLogOption]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Events" Parser (Maybe (Maybe [WirelessDeviceEventLogOption]))
-> Maybe [WirelessDeviceEventLogOption]
-> Parser (Maybe [WirelessDeviceEventLogOption])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [WirelessDeviceEventLogOption]
forall a. Monoid a => a
Prelude.mempty)
Parser (WirelessDeviceType -> LogLevel -> WirelessDeviceLogOption)
-> Parser WirelessDeviceType
-> Parser (LogLevel -> WirelessDeviceLogOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser WirelessDeviceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
Parser (LogLevel -> WirelessDeviceLogOption)
-> Parser LogLevel -> Parser WirelessDeviceLogOption
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser LogLevel
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LogLevel")
)
instance Prelude.Hashable WirelessDeviceLogOption
instance Prelude.NFData WirelessDeviceLogOption
instance Core.ToJSON WirelessDeviceLogOption where
toJSON :: WirelessDeviceLogOption -> Value
toJSON WirelessDeviceLogOption' {Maybe [WirelessDeviceEventLogOption]
LogLevel
WirelessDeviceType
logLevel :: LogLevel
type' :: WirelessDeviceType
events :: Maybe [WirelessDeviceEventLogOption]
$sel:logLevel:WirelessDeviceLogOption' :: WirelessDeviceLogOption -> LogLevel
$sel:type':WirelessDeviceLogOption' :: WirelessDeviceLogOption -> WirelessDeviceType
$sel:events:WirelessDeviceLogOption' :: WirelessDeviceLogOption -> Maybe [WirelessDeviceEventLogOption]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Events" Text -> [WirelessDeviceEventLogOption] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([WirelessDeviceEventLogOption] -> Pair)
-> Maybe [WirelessDeviceEventLogOption] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [WirelessDeviceEventLogOption]
events,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> WirelessDeviceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WirelessDeviceType
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LogLevel" Text -> LogLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LogLevel
logLevel)
]
)