{-# 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.AbpV1_1 where
import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.SessionKeysAbpV1_1
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AbpV1_1 = AbpV1_1'
{
AbpV1_1 -> Maybe Text
devAddr :: Prelude.Maybe Prelude.Text,
AbpV1_1 -> Maybe SessionKeysAbpV1_1
sessionKeys :: Prelude.Maybe SessionKeysAbpV1_1
}
deriving (AbpV1_1 -> AbpV1_1 -> Bool
(AbpV1_1 -> AbpV1_1 -> Bool)
-> (AbpV1_1 -> AbpV1_1 -> Bool) -> Eq AbpV1_1
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AbpV1_1 -> AbpV1_1 -> Bool
$c/= :: AbpV1_1 -> AbpV1_1 -> Bool
== :: AbpV1_1 -> AbpV1_1 -> Bool
$c== :: AbpV1_1 -> AbpV1_1 -> Bool
Prelude.Eq, ReadPrec [AbpV1_1]
ReadPrec AbpV1_1
Int -> ReadS AbpV1_1
ReadS [AbpV1_1]
(Int -> ReadS AbpV1_1)
-> ReadS [AbpV1_1]
-> ReadPrec AbpV1_1
-> ReadPrec [AbpV1_1]
-> Read AbpV1_1
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AbpV1_1]
$creadListPrec :: ReadPrec [AbpV1_1]
readPrec :: ReadPrec AbpV1_1
$creadPrec :: ReadPrec AbpV1_1
readList :: ReadS [AbpV1_1]
$creadList :: ReadS [AbpV1_1]
readsPrec :: Int -> ReadS AbpV1_1
$creadsPrec :: Int -> ReadS AbpV1_1
Prelude.Read, Int -> AbpV1_1 -> ShowS
[AbpV1_1] -> ShowS
AbpV1_1 -> String
(Int -> AbpV1_1 -> ShowS)
-> (AbpV1_1 -> String) -> ([AbpV1_1] -> ShowS) -> Show AbpV1_1
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AbpV1_1] -> ShowS
$cshowList :: [AbpV1_1] -> ShowS
show :: AbpV1_1 -> String
$cshow :: AbpV1_1 -> String
showsPrec :: Int -> AbpV1_1 -> ShowS
$cshowsPrec :: Int -> AbpV1_1 -> ShowS
Prelude.Show, (forall x. AbpV1_1 -> Rep AbpV1_1 x)
-> (forall x. Rep AbpV1_1 x -> AbpV1_1) -> Generic AbpV1_1
forall x. Rep AbpV1_1 x -> AbpV1_1
forall x. AbpV1_1 -> Rep AbpV1_1 x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AbpV1_1 x -> AbpV1_1
$cfrom :: forall x. AbpV1_1 -> Rep AbpV1_1 x
Prelude.Generic)
newAbpV1_1 ::
AbpV1_1
newAbpV1_1 :: AbpV1_1
newAbpV1_1 =
AbpV1_1' :: Maybe Text -> Maybe SessionKeysAbpV1_1 -> AbpV1_1
AbpV1_1'
{ $sel:devAddr:AbpV1_1' :: Maybe Text
devAddr = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sessionKeys:AbpV1_1' :: Maybe SessionKeysAbpV1_1
sessionKeys = Maybe SessionKeysAbpV1_1
forall a. Maybe a
Prelude.Nothing
}
abpV1_1_devAddr :: Lens.Lens' AbpV1_1 (Prelude.Maybe Prelude.Text)
abpV1_1_devAddr :: (Maybe Text -> f (Maybe Text)) -> AbpV1_1 -> f AbpV1_1
abpV1_1_devAddr = (AbpV1_1 -> Maybe Text)
-> (AbpV1_1 -> Maybe Text -> AbpV1_1)
-> Lens AbpV1_1 AbpV1_1 (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbpV1_1' {Maybe Text
devAddr :: Maybe Text
$sel:devAddr:AbpV1_1' :: AbpV1_1 -> Maybe Text
devAddr} -> Maybe Text
devAddr) (\s :: AbpV1_1
s@AbpV1_1' {} Maybe Text
a -> AbpV1_1
s {$sel:devAddr:AbpV1_1' :: Maybe Text
devAddr = Maybe Text
a} :: AbpV1_1)
abpV1_1_sessionKeys :: Lens.Lens' AbpV1_1 (Prelude.Maybe SessionKeysAbpV1_1)
abpV1_1_sessionKeys :: (Maybe SessionKeysAbpV1_1 -> f (Maybe SessionKeysAbpV1_1))
-> AbpV1_1 -> f AbpV1_1
abpV1_1_sessionKeys = (AbpV1_1 -> Maybe SessionKeysAbpV1_1)
-> (AbpV1_1 -> Maybe SessionKeysAbpV1_1 -> AbpV1_1)
-> Lens
AbpV1_1
AbpV1_1
(Maybe SessionKeysAbpV1_1)
(Maybe SessionKeysAbpV1_1)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AbpV1_1' {Maybe SessionKeysAbpV1_1
sessionKeys :: Maybe SessionKeysAbpV1_1
$sel:sessionKeys:AbpV1_1' :: AbpV1_1 -> Maybe SessionKeysAbpV1_1
sessionKeys} -> Maybe SessionKeysAbpV1_1
sessionKeys) (\s :: AbpV1_1
s@AbpV1_1' {} Maybe SessionKeysAbpV1_1
a -> AbpV1_1
s {$sel:sessionKeys:AbpV1_1' :: Maybe SessionKeysAbpV1_1
sessionKeys = Maybe SessionKeysAbpV1_1
a} :: AbpV1_1)
instance Core.FromJSON AbpV1_1 where
parseJSON :: Value -> Parser AbpV1_1
parseJSON =
String -> (Object -> Parser AbpV1_1) -> Value -> Parser AbpV1_1
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AbpV1_1"
( \Object
x ->
Maybe Text -> Maybe SessionKeysAbpV1_1 -> AbpV1_1
AbpV1_1'
(Maybe Text -> Maybe SessionKeysAbpV1_1 -> AbpV1_1)
-> Parser (Maybe Text)
-> Parser (Maybe SessionKeysAbpV1_1 -> AbpV1_1)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DevAddr")
Parser (Maybe SessionKeysAbpV1_1 -> AbpV1_1)
-> Parser (Maybe SessionKeysAbpV1_1) -> Parser AbpV1_1
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SessionKeysAbpV1_1)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SessionKeys")
)
instance Prelude.Hashable AbpV1_1
instance Prelude.NFData AbpV1_1
instance Core.ToJSON AbpV1_1 where
toJSON :: AbpV1_1 -> Value
toJSON AbpV1_1' {Maybe Text
Maybe SessionKeysAbpV1_1
sessionKeys :: Maybe SessionKeysAbpV1_1
devAddr :: Maybe Text
$sel:sessionKeys:AbpV1_1' :: AbpV1_1 -> Maybe SessionKeysAbpV1_1
$sel:devAddr:AbpV1_1' :: AbpV1_1 -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DevAddr" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
devAddr,
(Text
"SessionKeys" Text -> SessionKeysAbpV1_1 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SessionKeysAbpV1_1 -> Pair)
-> Maybe SessionKeysAbpV1_1 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SessionKeysAbpV1_1
sessionKeys
]
)