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

import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.SigningAlg
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | List of sidewalk certificates.
--
-- /See:/ 'newCertificateList' smart constructor.
data CertificateList = CertificateList'
  { -- | The certificate chain algorithm provided by sidewalk.
    CertificateList -> SigningAlg
signingAlg :: SigningAlg,
    -- | The value of the chosen sidewalk certificate.
    CertificateList -> Text
value :: Prelude.Text
  }
  deriving (CertificateList -> CertificateList -> Bool
(CertificateList -> CertificateList -> Bool)
-> (CertificateList -> CertificateList -> Bool)
-> Eq CertificateList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CertificateList -> CertificateList -> Bool
$c/= :: CertificateList -> CertificateList -> Bool
== :: CertificateList -> CertificateList -> Bool
$c== :: CertificateList -> CertificateList -> Bool
Prelude.Eq, ReadPrec [CertificateList]
ReadPrec CertificateList
Int -> ReadS CertificateList
ReadS [CertificateList]
(Int -> ReadS CertificateList)
-> ReadS [CertificateList]
-> ReadPrec CertificateList
-> ReadPrec [CertificateList]
-> Read CertificateList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CertificateList]
$creadListPrec :: ReadPrec [CertificateList]
readPrec :: ReadPrec CertificateList
$creadPrec :: ReadPrec CertificateList
readList :: ReadS [CertificateList]
$creadList :: ReadS [CertificateList]
readsPrec :: Int -> ReadS CertificateList
$creadsPrec :: Int -> ReadS CertificateList
Prelude.Read, Int -> CertificateList -> ShowS
[CertificateList] -> ShowS
CertificateList -> String
(Int -> CertificateList -> ShowS)
-> (CertificateList -> String)
-> ([CertificateList] -> ShowS)
-> Show CertificateList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CertificateList] -> ShowS
$cshowList :: [CertificateList] -> ShowS
show :: CertificateList -> String
$cshow :: CertificateList -> String
showsPrec :: Int -> CertificateList -> ShowS
$cshowsPrec :: Int -> CertificateList -> ShowS
Prelude.Show, (forall x. CertificateList -> Rep CertificateList x)
-> (forall x. Rep CertificateList x -> CertificateList)
-> Generic CertificateList
forall x. Rep CertificateList x -> CertificateList
forall x. CertificateList -> Rep CertificateList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CertificateList x -> CertificateList
$cfrom :: forall x. CertificateList -> Rep CertificateList x
Prelude.Generic)

-- |
-- Create a value of 'CertificateList' 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:
--
-- 'signingAlg', 'certificateList_signingAlg' - The certificate chain algorithm provided by sidewalk.
--
-- 'value', 'certificateList_value' - The value of the chosen sidewalk certificate.
newCertificateList ::
  -- | 'signingAlg'
  SigningAlg ->
  -- | 'value'
  Prelude.Text ->
  CertificateList
newCertificateList :: SigningAlg -> Text -> CertificateList
newCertificateList SigningAlg
pSigningAlg_ Text
pValue_ =
  CertificateList' :: SigningAlg -> Text -> CertificateList
CertificateList'
    { $sel:signingAlg:CertificateList' :: SigningAlg
signingAlg = SigningAlg
pSigningAlg_,
      $sel:value:CertificateList' :: Text
value = Text
pValue_
    }

-- | The certificate chain algorithm provided by sidewalk.
certificateList_signingAlg :: Lens.Lens' CertificateList SigningAlg
certificateList_signingAlg :: (SigningAlg -> f SigningAlg)
-> CertificateList -> f CertificateList
certificateList_signingAlg = (CertificateList -> SigningAlg)
-> (CertificateList -> SigningAlg -> CertificateList)
-> Lens CertificateList CertificateList SigningAlg SigningAlg
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateList' {SigningAlg
signingAlg :: SigningAlg
$sel:signingAlg:CertificateList' :: CertificateList -> SigningAlg
signingAlg} -> SigningAlg
signingAlg) (\s :: CertificateList
s@CertificateList' {} SigningAlg
a -> CertificateList
s {$sel:signingAlg:CertificateList' :: SigningAlg
signingAlg = SigningAlg
a} :: CertificateList)

-- | The value of the chosen sidewalk certificate.
certificateList_value :: Lens.Lens' CertificateList Prelude.Text
certificateList_value :: (Text -> f Text) -> CertificateList -> f CertificateList
certificateList_value = (CertificateList -> Text)
-> (CertificateList -> Text -> CertificateList)
-> Lens CertificateList CertificateList Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateList' {Text
value :: Text
$sel:value:CertificateList' :: CertificateList -> Text
value} -> Text
value) (\s :: CertificateList
s@CertificateList' {} Text
a -> CertificateList
s {$sel:value:CertificateList' :: Text
value = Text
a} :: CertificateList)

instance Core.FromJSON CertificateList where
  parseJSON :: Value -> Parser CertificateList
parseJSON =
    String
-> (Object -> Parser CertificateList)
-> Value
-> Parser CertificateList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CertificateList"
      ( \Object
x ->
          SigningAlg -> Text -> CertificateList
CertificateList'
            (SigningAlg -> Text -> CertificateList)
-> Parser SigningAlg -> Parser (Text -> CertificateList)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser SigningAlg
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SigningAlg")
            Parser (Text -> CertificateList)
-> Parser Text -> Parser CertificateList
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
      )

instance Prelude.Hashable CertificateList

instance Prelude.NFData CertificateList