{-# 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-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.IoT.Types.ServerCertificateSummary where

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

-- | An object that contains information about a server certificate.
--
-- /See:/ 'newServerCertificateSummary' smart constructor.
data ServerCertificateSummary = ServerCertificateSummary'
  { -- | Details that explain the status of the server certificate.
    ServerCertificateSummary -> Maybe Text
serverCertificateStatusDetail :: Prelude.Maybe Prelude.Text,
    -- | The status of the server certificate.
    ServerCertificateSummary -> Maybe ServerCertificateStatus
serverCertificateStatus :: Prelude.Maybe ServerCertificateStatus,
    -- | The ARN of the server certificate.
    ServerCertificateSummary -> Maybe Text
serverCertificateArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ServerCertificateSummary -> ServerCertificateSummary -> Bool
(ServerCertificateSummary -> ServerCertificateSummary -> Bool)
-> (ServerCertificateSummary -> ServerCertificateSummary -> Bool)
-> Eq ServerCertificateSummary
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]
(Int -> ReadS ServerCertificateSummary)
-> ReadS [ServerCertificateSummary]
-> ReadPrec ServerCertificateSummary
-> ReadPrec [ServerCertificateSummary]
-> Read 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
(Int -> ServerCertificateSummary -> ShowS)
-> (ServerCertificateSummary -> String)
-> ([ServerCertificateSummary] -> ShowS)
-> Show ServerCertificateSummary
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.
 ServerCertificateSummary -> Rep ServerCertificateSummary x)
-> (forall x.
    Rep ServerCertificateSummary x -> ServerCertificateSummary)
-> Generic ServerCertificateSummary
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:
--
-- 'serverCertificateStatusDetail', 'serverCertificateSummary_serverCertificateStatusDetail' - Details that explain the status of the server certificate.
--
-- 'serverCertificateStatus', 'serverCertificateSummary_serverCertificateStatus' - The status of the server certificate.
--
-- 'serverCertificateArn', 'serverCertificateSummary_serverCertificateArn' - The ARN of the server certificate.
newServerCertificateSummary ::
  ServerCertificateSummary
newServerCertificateSummary :: ServerCertificateSummary
newServerCertificateSummary =
  ServerCertificateSummary' :: Maybe Text
-> Maybe ServerCertificateStatus
-> Maybe Text
-> ServerCertificateSummary
ServerCertificateSummary'
    { $sel:serverCertificateStatusDetail:ServerCertificateSummary' :: Maybe Text
serverCertificateStatusDetail =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serverCertificateStatus:ServerCertificateSummary' :: Maybe ServerCertificateStatus
serverCertificateStatus = Maybe ServerCertificateStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:serverCertificateArn:ServerCertificateSummary' :: Maybe Text
serverCertificateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Details that explain the status of the server certificate.
serverCertificateSummary_serverCertificateStatusDetail :: Lens.Lens' ServerCertificateSummary (Prelude.Maybe Prelude.Text)
serverCertificateSummary_serverCertificateStatusDetail :: (Maybe Text -> f (Maybe Text))
-> ServerCertificateSummary -> f ServerCertificateSummary
serverCertificateSummary_serverCertificateStatusDetail = (ServerCertificateSummary -> Maybe Text)
-> (ServerCertificateSummary
    -> Maybe Text -> ServerCertificateSummary)
-> Lens
     ServerCertificateSummary
     ServerCertificateSummary
     (Maybe Text)
     (Maybe Text)
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)

-- | The status of the server certificate.
serverCertificateSummary_serverCertificateStatus :: Lens.Lens' ServerCertificateSummary (Prelude.Maybe ServerCertificateStatus)
serverCertificateSummary_serverCertificateStatus :: (Maybe ServerCertificateStatus
 -> f (Maybe ServerCertificateStatus))
-> ServerCertificateSummary -> f ServerCertificateSummary
serverCertificateSummary_serverCertificateStatus = (ServerCertificateSummary -> Maybe ServerCertificateStatus)
-> (ServerCertificateSummary
    -> Maybe ServerCertificateStatus -> ServerCertificateSummary)
-> Lens
     ServerCertificateSummary
     ServerCertificateSummary
     (Maybe ServerCertificateStatus)
     (Maybe 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)

-- | The ARN of the server certificate.
serverCertificateSummary_serverCertificateArn :: Lens.Lens' ServerCertificateSummary (Prelude.Maybe Prelude.Text)
serverCertificateSummary_serverCertificateArn :: (Maybe Text -> f (Maybe Text))
-> ServerCertificateSummary -> f ServerCertificateSummary
serverCertificateSummary_serverCertificateArn = (ServerCertificateSummary -> Maybe Text)
-> (ServerCertificateSummary
    -> Maybe Text -> ServerCertificateSummary)
-> Lens
     ServerCertificateSummary
     ServerCertificateSummary
     (Maybe Text)
     (Maybe Text)
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)

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

instance Prelude.Hashable ServerCertificateSummary

instance Prelude.NFData ServerCertificateSummary