{-# 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.SidewalkAccountInfo
-- 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.SidewalkAccountInfo where

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

-- | Information about a Sidewalk account.
--
-- /See:/ 'newSidewalkAccountInfo' smart constructor.
data SidewalkAccountInfo = SidewalkAccountInfo'
  { -- | The Sidewalk Amazon ID.
    SidewalkAccountInfo -> Maybe Text
amazonId :: Prelude.Maybe Prelude.Text,
    -- | The Sidewalk application server private key.
    SidewalkAccountInfo -> Maybe (Sensitive Text)
appServerPrivateKey :: Prelude.Maybe (Core.Sensitive Prelude.Text)
  }
  deriving (SidewalkAccountInfo -> SidewalkAccountInfo -> Bool
(SidewalkAccountInfo -> SidewalkAccountInfo -> Bool)
-> (SidewalkAccountInfo -> SidewalkAccountInfo -> Bool)
-> Eq SidewalkAccountInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SidewalkAccountInfo -> SidewalkAccountInfo -> Bool
$c/= :: SidewalkAccountInfo -> SidewalkAccountInfo -> Bool
== :: SidewalkAccountInfo -> SidewalkAccountInfo -> Bool
$c== :: SidewalkAccountInfo -> SidewalkAccountInfo -> Bool
Prelude.Eq, Int -> SidewalkAccountInfo -> ShowS
[SidewalkAccountInfo] -> ShowS
SidewalkAccountInfo -> String
(Int -> SidewalkAccountInfo -> ShowS)
-> (SidewalkAccountInfo -> String)
-> ([SidewalkAccountInfo] -> ShowS)
-> Show SidewalkAccountInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SidewalkAccountInfo] -> ShowS
$cshowList :: [SidewalkAccountInfo] -> ShowS
show :: SidewalkAccountInfo -> String
$cshow :: SidewalkAccountInfo -> String
showsPrec :: Int -> SidewalkAccountInfo -> ShowS
$cshowsPrec :: Int -> SidewalkAccountInfo -> ShowS
Prelude.Show, (forall x. SidewalkAccountInfo -> Rep SidewalkAccountInfo x)
-> (forall x. Rep SidewalkAccountInfo x -> SidewalkAccountInfo)
-> Generic SidewalkAccountInfo
forall x. Rep SidewalkAccountInfo x -> SidewalkAccountInfo
forall x. SidewalkAccountInfo -> Rep SidewalkAccountInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SidewalkAccountInfo x -> SidewalkAccountInfo
$cfrom :: forall x. SidewalkAccountInfo -> Rep SidewalkAccountInfo x
Prelude.Generic)

-- |
-- Create a value of 'SidewalkAccountInfo' 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:
--
-- 'amazonId', 'sidewalkAccountInfo_amazonId' - The Sidewalk Amazon ID.
--
-- 'appServerPrivateKey', 'sidewalkAccountInfo_appServerPrivateKey' - The Sidewalk application server private key.
newSidewalkAccountInfo ::
  SidewalkAccountInfo
newSidewalkAccountInfo :: SidewalkAccountInfo
newSidewalkAccountInfo =
  SidewalkAccountInfo' :: Maybe Text -> Maybe (Sensitive Text) -> SidewalkAccountInfo
SidewalkAccountInfo'
    { $sel:amazonId:SidewalkAccountInfo' :: Maybe Text
amazonId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:appServerPrivateKey:SidewalkAccountInfo' :: Maybe (Sensitive Text)
appServerPrivateKey = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The Sidewalk Amazon ID.
sidewalkAccountInfo_amazonId :: Lens.Lens' SidewalkAccountInfo (Prelude.Maybe Prelude.Text)
sidewalkAccountInfo_amazonId :: (Maybe Text -> f (Maybe Text))
-> SidewalkAccountInfo -> f SidewalkAccountInfo
sidewalkAccountInfo_amazonId = (SidewalkAccountInfo -> Maybe Text)
-> (SidewalkAccountInfo -> Maybe Text -> SidewalkAccountInfo)
-> Lens
     SidewalkAccountInfo SidewalkAccountInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkAccountInfo' {Maybe Text
amazonId :: Maybe Text
$sel:amazonId:SidewalkAccountInfo' :: SidewalkAccountInfo -> Maybe Text
amazonId} -> Maybe Text
amazonId) (\s :: SidewalkAccountInfo
s@SidewalkAccountInfo' {} Maybe Text
a -> SidewalkAccountInfo
s {$sel:amazonId:SidewalkAccountInfo' :: Maybe Text
amazonId = Maybe Text
a} :: SidewalkAccountInfo)

-- | The Sidewalk application server private key.
sidewalkAccountInfo_appServerPrivateKey :: Lens.Lens' SidewalkAccountInfo (Prelude.Maybe Prelude.Text)
sidewalkAccountInfo_appServerPrivateKey :: (Maybe Text -> f (Maybe Text))
-> SidewalkAccountInfo -> f SidewalkAccountInfo
sidewalkAccountInfo_appServerPrivateKey = (SidewalkAccountInfo -> Maybe (Sensitive Text))
-> (SidewalkAccountInfo
    -> Maybe (Sensitive Text) -> SidewalkAccountInfo)
-> Lens
     SidewalkAccountInfo
     SidewalkAccountInfo
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SidewalkAccountInfo' {Maybe (Sensitive Text)
appServerPrivateKey :: Maybe (Sensitive Text)
$sel:appServerPrivateKey:SidewalkAccountInfo' :: SidewalkAccountInfo -> Maybe (Sensitive Text)
appServerPrivateKey} -> Maybe (Sensitive Text)
appServerPrivateKey) (\s :: SidewalkAccountInfo
s@SidewalkAccountInfo' {} Maybe (Sensitive Text)
a -> SidewalkAccountInfo
s {$sel:appServerPrivateKey:SidewalkAccountInfo' :: Maybe (Sensitive Text)
appServerPrivateKey = Maybe (Sensitive Text)
a} :: SidewalkAccountInfo) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> SidewalkAccountInfo -> f SidewalkAccountInfo)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> SidewalkAccountInfo
-> f SidewalkAccountInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.FromJSON SidewalkAccountInfo where
  parseJSON :: Value -> Parser SidewalkAccountInfo
parseJSON =
    String
-> (Object -> Parser SidewalkAccountInfo)
-> Value
-> Parser SidewalkAccountInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SidewalkAccountInfo"
      ( \Object
x ->
          Maybe Text -> Maybe (Sensitive Text) -> SidewalkAccountInfo
SidewalkAccountInfo'
            (Maybe Text -> Maybe (Sensitive Text) -> SidewalkAccountInfo)
-> Parser (Maybe Text)
-> Parser (Maybe (Sensitive Text) -> SidewalkAccountInfo)
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
"AmazonId")
            Parser (Maybe (Sensitive Text) -> SidewalkAccountInfo)
-> Parser (Maybe (Sensitive Text)) -> Parser SidewalkAccountInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AppServerPrivateKey")
      )

instance Prelude.Hashable SidewalkAccountInfo

instance Prelude.NFData SidewalkAccountInfo

instance Core.ToJSON SidewalkAccountInfo where
  toJSON :: SidewalkAccountInfo -> Value
toJSON SidewalkAccountInfo' {Maybe Text
Maybe (Sensitive Text)
appServerPrivateKey :: Maybe (Sensitive Text)
amazonId :: Maybe Text
$sel:appServerPrivateKey:SidewalkAccountInfo' :: SidewalkAccountInfo -> Maybe (Sensitive Text)
$sel:amazonId:SidewalkAccountInfo' :: SidewalkAccountInfo -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AmazonId" 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
amazonId,
            (Text
"AppServerPrivateKey" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
appServerPrivateKey
          ]
      )