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