{-# 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.IoT.Types.ServerCertificateSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.ServerCertificateSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.ServerCertificateStatus
import qualified Amazonka.Prelude as Prelude

-- | An object that contains information about a server certificate.
--
-- /See:/ 'newServerCertificateSummary' smart constructor.
data ServerCertificateSummary = ServerCertificateSummary'
  { -- | The ARN of the server certificate.
    ServerCertificateSummary -> Maybe Text
serverCertificateArn :: Prelude.Maybe Prelude.Text,
    -- | The status of the server certificate.
    ServerCertificateSummary -> Maybe ServerCertificateStatus
serverCertificateStatus :: Prelude.Maybe ServerCertificateStatus,
    -- | Details that explain the status of the server certificate.
    ServerCertificateSummary -> Maybe Text
serverCertificateStatusDetail :: Prelude.Maybe Prelude.Text
  }
  deriving (ServerCertificateSummary -> ServerCertificateSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServerCertificateSummary -> ServerCertificateSummary -> Bool
$c/= :: ServerCertificateSummary -> ServerCertificateSummary -> Bool
== :: ServerCertificateSummary -> ServerCertificateSummary -> Bool
$c== :: ServerCertificateSummary -> ServerCertificateSummary -> Bool
Prelude.Eq, ReadPrec [ServerCertificateSummary]
ReadPrec ServerCertificateSummary
Int -> ReadS ServerCertificateSummary
ReadS [ServerCertificateSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServerCertificateSummary]
$creadListPrec :: ReadPrec [ServerCertificateSummary]
readPrec :: ReadPrec ServerCertificateSummary
$creadPrec :: ReadPrec ServerCertificateSummary
readList :: ReadS [ServerCertificateSummary]
$creadList :: ReadS [ServerCertificateSummary]
readsPrec :: Int -> ReadS ServerCertificateSummary
$creadsPrec :: Int -> ReadS ServerCertificateSummary
Prelude.Read, Int -> ServerCertificateSummary -> ShowS
[ServerCertificateSummary] -> ShowS
ServerCertificateSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServerCertificateSummary] -> ShowS
$cshowList :: [ServerCertificateSummary] -> ShowS
show :: ServerCertificateSummary -> String
$cshow :: ServerCertificateSummary -> String
showsPrec :: Int -> ServerCertificateSummary -> ShowS
$cshowsPrec :: Int -> ServerCertificateSummary -> ShowS
Prelude.Show, forall x.
Rep ServerCertificateSummary x -> ServerCertificateSummary
forall x.
ServerCertificateSummary -> Rep ServerCertificateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServerCertificateSummary x -> ServerCertificateSummary
$cfrom :: forall x.
ServerCertificateSummary -> Rep ServerCertificateSummary x
Prelude.Generic)

-- |
-- Create a value of 'ServerCertificateSummary' 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:
--
-- 'serverCertificateArn', 'serverCertificateSummary_serverCertificateArn' - The ARN of the server certificate.
--
-- 'serverCertificateStatus', 'serverCertificateSummary_serverCertificateStatus' - The status of the server certificate.
--
-- 'serverCertificateStatusDetail', 'serverCertificateSummary_serverCertificateStatusDetail' - Details that explain the status of the server certificate.
newServerCertificateSummary ::
  ServerCertificateSummary
newServerCertificateSummary :: ServerCertificateSummary
newServerCertificateSummary =
  ServerCertificateSummary'
    { $sel:serverCertificateArn:ServerCertificateSummary' :: Maybe Text
serverCertificateArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:serverCertificateStatus:ServerCertificateSummary' :: Maybe ServerCertificateStatus
serverCertificateStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:serverCertificateStatusDetail:ServerCertificateSummary' :: Maybe Text
serverCertificateStatusDetail = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the server certificate.
serverCertificateSummary_serverCertificateArn :: Lens.Lens' ServerCertificateSummary (Prelude.Maybe Prelude.Text)
serverCertificateSummary_serverCertificateArn :: Lens' ServerCertificateSummary (Maybe Text)
serverCertificateSummary_serverCertificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateSummary' {Maybe Text
serverCertificateArn :: Maybe Text
$sel:serverCertificateArn:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe Text
serverCertificateArn} -> Maybe Text
serverCertificateArn) (\s :: ServerCertificateSummary
s@ServerCertificateSummary' {} Maybe Text
a -> ServerCertificateSummary
s {$sel:serverCertificateArn:ServerCertificateSummary' :: Maybe Text
serverCertificateArn = Maybe Text
a} :: ServerCertificateSummary)

-- | The status of the server certificate.
serverCertificateSummary_serverCertificateStatus :: Lens.Lens' ServerCertificateSummary (Prelude.Maybe ServerCertificateStatus)
serverCertificateSummary_serverCertificateStatus :: Lens' ServerCertificateSummary (Maybe ServerCertificateStatus)
serverCertificateSummary_serverCertificateStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateSummary' {Maybe ServerCertificateStatus
serverCertificateStatus :: Maybe ServerCertificateStatus
$sel:serverCertificateStatus:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe ServerCertificateStatus
serverCertificateStatus} -> Maybe ServerCertificateStatus
serverCertificateStatus) (\s :: ServerCertificateSummary
s@ServerCertificateSummary' {} Maybe ServerCertificateStatus
a -> ServerCertificateSummary
s {$sel:serverCertificateStatus:ServerCertificateSummary' :: Maybe ServerCertificateStatus
serverCertificateStatus = Maybe ServerCertificateStatus
a} :: ServerCertificateSummary)

-- | Details that explain the status of the server certificate.
serverCertificateSummary_serverCertificateStatusDetail :: Lens.Lens' ServerCertificateSummary (Prelude.Maybe Prelude.Text)
serverCertificateSummary_serverCertificateStatusDetail :: Lens' ServerCertificateSummary (Maybe Text)
serverCertificateSummary_serverCertificateStatusDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServerCertificateSummary' {Maybe Text
serverCertificateStatusDetail :: Maybe Text
$sel:serverCertificateStatusDetail:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe Text
serverCertificateStatusDetail} -> Maybe Text
serverCertificateStatusDetail) (\s :: ServerCertificateSummary
s@ServerCertificateSummary' {} Maybe Text
a -> ServerCertificateSummary
s {$sel:serverCertificateStatusDetail:ServerCertificateSummary' :: Maybe Text
serverCertificateStatusDetail = Maybe Text
a} :: ServerCertificateSummary)

instance Data.FromJSON ServerCertificateSummary where
  parseJSON :: Value -> Parser ServerCertificateSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServerCertificateSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe ServerCertificateStatus
-> Maybe Text
-> ServerCertificateSummary
ServerCertificateSummary'
            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
"serverCertificateArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"serverCertificateStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"serverCertificateStatusDetail")
      )

instance Prelude.Hashable ServerCertificateSummary where
  hashWithSalt :: Int -> ServerCertificateSummary -> Int
hashWithSalt Int
_salt ServerCertificateSummary' {Maybe Text
Maybe ServerCertificateStatus
serverCertificateStatusDetail :: Maybe Text
serverCertificateStatus :: Maybe ServerCertificateStatus
serverCertificateArn :: Maybe Text
$sel:serverCertificateStatusDetail:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe Text
$sel:serverCertificateStatus:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe ServerCertificateStatus
$sel:serverCertificateArn:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serverCertificateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ServerCertificateStatus
serverCertificateStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serverCertificateStatusDetail

instance Prelude.NFData ServerCertificateSummary where
  rnf :: ServerCertificateSummary -> ()
rnf ServerCertificateSummary' {Maybe Text
Maybe ServerCertificateStatus
serverCertificateStatusDetail :: Maybe Text
serverCertificateStatus :: Maybe ServerCertificateStatus
serverCertificateArn :: Maybe Text
$sel:serverCertificateStatusDetail:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe Text
$sel:serverCertificateStatus:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe ServerCertificateStatus
$sel:serverCertificateArn:ServerCertificateSummary' :: ServerCertificateSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serverCertificateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ServerCertificateStatus
serverCertificateStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serverCertificateStatusDetail