{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTWireless.Types.SessionKeysAbpV1_0_x
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTWireless.Types.SessionKeysAbpV1_0_x where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Session keys for ABP v1.1
--
-- /See:/ 'newSessionKeysAbpV1_0_x' smart constructor.
data SessionKeysAbpV1_0_x = SessionKeysAbpV1_0_x'
  { -- | The NwkSKey value.
    SessionKeysAbpV1_0_x -> Maybe Text
nwkSKey :: Prelude.Maybe Prelude.Text,
    -- | The AppSKey value.
    SessionKeysAbpV1_0_x -> Maybe Text
appSKey :: Prelude.Maybe Prelude.Text
  }
  deriving (SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
(SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool)
-> (SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool)
-> Eq SessionKeysAbpV1_0_x
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
$c/= :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
== :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
$c== :: SessionKeysAbpV1_0_x -> SessionKeysAbpV1_0_x -> Bool
Prelude.Eq, ReadPrec [SessionKeysAbpV1_0_x]
ReadPrec SessionKeysAbpV1_0_x
Int -> ReadS SessionKeysAbpV1_0_x
ReadS [SessionKeysAbpV1_0_x]
(Int -> ReadS SessionKeysAbpV1_0_x)
-> ReadS [SessionKeysAbpV1_0_x]
-> ReadPrec SessionKeysAbpV1_0_x
-> ReadPrec [SessionKeysAbpV1_0_x]
-> Read SessionKeysAbpV1_0_x
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionKeysAbpV1_0_x]
$creadListPrec :: ReadPrec [SessionKeysAbpV1_0_x]
readPrec :: ReadPrec SessionKeysAbpV1_0_x
$creadPrec :: ReadPrec SessionKeysAbpV1_0_x
readList :: ReadS [SessionKeysAbpV1_0_x]
$creadList :: ReadS [SessionKeysAbpV1_0_x]
readsPrec :: Int -> ReadS SessionKeysAbpV1_0_x
$creadsPrec :: Int -> ReadS SessionKeysAbpV1_0_x
Prelude.Read, Int -> SessionKeysAbpV1_0_x -> ShowS
[SessionKeysAbpV1_0_x] -> ShowS
SessionKeysAbpV1_0_x -> String
(Int -> SessionKeysAbpV1_0_x -> ShowS)
-> (SessionKeysAbpV1_0_x -> String)
-> ([SessionKeysAbpV1_0_x] -> ShowS)
-> Show SessionKeysAbpV1_0_x
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionKeysAbpV1_0_x] -> ShowS
$cshowList :: [SessionKeysAbpV1_0_x] -> ShowS
show :: SessionKeysAbpV1_0_x -> String
$cshow :: SessionKeysAbpV1_0_x -> String
showsPrec :: Int -> SessionKeysAbpV1_0_x -> ShowS
$cshowsPrec :: Int -> SessionKeysAbpV1_0_x -> ShowS
Prelude.Show, (forall x. SessionKeysAbpV1_0_x -> Rep SessionKeysAbpV1_0_x x)
-> (forall x. Rep SessionKeysAbpV1_0_x x -> SessionKeysAbpV1_0_x)
-> Generic SessionKeysAbpV1_0_x
forall x. Rep SessionKeysAbpV1_0_x x -> SessionKeysAbpV1_0_x
forall x. SessionKeysAbpV1_0_x -> Rep SessionKeysAbpV1_0_x x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionKeysAbpV1_0_x x -> SessionKeysAbpV1_0_x
$cfrom :: forall x. SessionKeysAbpV1_0_x -> Rep SessionKeysAbpV1_0_x x
Prelude.Generic)

-- |
-- Create a value of 'SessionKeysAbpV1_0_x' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nwkSKey', 'sessionKeysAbpV1_0_x_nwkSKey' - The NwkSKey value.
--
-- 'appSKey', 'sessionKeysAbpV1_0_x_appSKey' - The AppSKey value.
newSessionKeysAbpV1_0_x ::
  SessionKeysAbpV1_0_x
newSessionKeysAbpV1_0_x :: SessionKeysAbpV1_0_x
newSessionKeysAbpV1_0_x =
  SessionKeysAbpV1_0_x' :: Maybe Text -> Maybe Text -> SessionKeysAbpV1_0_x
SessionKeysAbpV1_0_x'
    { $sel:nwkSKey:SessionKeysAbpV1_0_x' :: Maybe Text
nwkSKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appSKey:SessionKeysAbpV1_0_x' :: Maybe Text
appSKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The NwkSKey value.
sessionKeysAbpV1_0_x_nwkSKey :: Lens.Lens' SessionKeysAbpV1_0_x (Prelude.Maybe Prelude.Text)
sessionKeysAbpV1_0_x_nwkSKey :: (Maybe Text -> f (Maybe Text))
-> SessionKeysAbpV1_0_x -> f SessionKeysAbpV1_0_x
sessionKeysAbpV1_0_x_nwkSKey = (SessionKeysAbpV1_0_x -> Maybe Text)
-> (SessionKeysAbpV1_0_x -> Maybe Text -> SessionKeysAbpV1_0_x)
-> Lens
     SessionKeysAbpV1_0_x SessionKeysAbpV1_0_x (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionKeysAbpV1_0_x' {Maybe Text
nwkSKey :: Maybe Text
$sel:nwkSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
nwkSKey} -> Maybe Text
nwkSKey) (\s :: SessionKeysAbpV1_0_x
s@SessionKeysAbpV1_0_x' {} Maybe Text
a -> SessionKeysAbpV1_0_x
s {$sel:nwkSKey:SessionKeysAbpV1_0_x' :: Maybe Text
nwkSKey = Maybe Text
a} :: SessionKeysAbpV1_0_x)

-- | The AppSKey value.
sessionKeysAbpV1_0_x_appSKey :: Lens.Lens' SessionKeysAbpV1_0_x (Prelude.Maybe Prelude.Text)
sessionKeysAbpV1_0_x_appSKey :: (Maybe Text -> f (Maybe Text))
-> SessionKeysAbpV1_0_x -> f SessionKeysAbpV1_0_x
sessionKeysAbpV1_0_x_appSKey = (SessionKeysAbpV1_0_x -> Maybe Text)
-> (SessionKeysAbpV1_0_x -> Maybe Text -> SessionKeysAbpV1_0_x)
-> Lens
     SessionKeysAbpV1_0_x SessionKeysAbpV1_0_x (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionKeysAbpV1_0_x' {Maybe Text
appSKey :: Maybe Text
$sel:appSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
appSKey} -> Maybe Text
appSKey) (\s :: SessionKeysAbpV1_0_x
s@SessionKeysAbpV1_0_x' {} Maybe Text
a -> SessionKeysAbpV1_0_x
s {$sel:appSKey:SessionKeysAbpV1_0_x' :: Maybe Text
appSKey = Maybe Text
a} :: SessionKeysAbpV1_0_x)

instance Core.FromJSON SessionKeysAbpV1_0_x where
  parseJSON :: Value -> Parser SessionKeysAbpV1_0_x
parseJSON =
    String
-> (Object -> Parser SessionKeysAbpV1_0_x)
-> Value
-> Parser SessionKeysAbpV1_0_x
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SessionKeysAbpV1_0_x"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> SessionKeysAbpV1_0_x
SessionKeysAbpV1_0_x'
            (Maybe Text -> Maybe Text -> SessionKeysAbpV1_0_x)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SessionKeysAbpV1_0_x)
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
"NwkSKey")
            Parser (Maybe Text -> SessionKeysAbpV1_0_x)
-> Parser (Maybe Text) -> Parser SessionKeysAbpV1_0_x
forall (f :: * -> *) a b. Applicative f => 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
"AppSKey")
      )

instance Prelude.Hashable SessionKeysAbpV1_0_x

instance Prelude.NFData SessionKeysAbpV1_0_x

instance Core.ToJSON SessionKeysAbpV1_0_x where
  toJSON :: SessionKeysAbpV1_0_x -> Value
toJSON SessionKeysAbpV1_0_x' {Maybe Text
appSKey :: Maybe Text
nwkSKey :: Maybe Text
$sel:appSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
$sel:nwkSKey:SessionKeysAbpV1_0_x' :: SessionKeysAbpV1_0_x -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NwkSKey" 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
nwkSKey,
            (Text
"AppSKey" 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
appSKey
          ]
      )