{-# 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.WorkSpacesWeb.Types.CertificateSummary
-- 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.WorkSpacesWeb.Types.CertificateSummary where

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

-- | The summary of the certificate.
--
-- /See:/ 'newCertificateSummary' smart constructor.
data CertificateSummary = CertificateSummary'
  { -- | The entity that issued the certificate.
    CertificateSummary -> Maybe Text
issuer :: Prelude.Maybe Prelude.Text,
    -- | The certificate is not valid after this date.
    CertificateSummary -> Maybe POSIX
notValidAfter :: Prelude.Maybe Data.POSIX,
    -- | The certificate is not valid before this date.
    CertificateSummary -> Maybe POSIX
notValidBefore :: Prelude.Maybe Data.POSIX,
    -- | The entity the certificate belongs to.
    CertificateSummary -> Maybe Text
subject :: Prelude.Maybe Prelude.Text,
    -- | A hexadecimal identifier for the certificate.
    CertificateSummary -> Maybe Text
thumbprint :: Prelude.Maybe Prelude.Text
  }
  deriving (CertificateSummary -> CertificateSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CertificateSummary -> CertificateSummary -> Bool
$c/= :: CertificateSummary -> CertificateSummary -> Bool
== :: CertificateSummary -> CertificateSummary -> Bool
$c== :: CertificateSummary -> CertificateSummary -> Bool
Prelude.Eq, ReadPrec [CertificateSummary]
ReadPrec CertificateSummary
Int -> ReadS CertificateSummary
ReadS [CertificateSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CertificateSummary]
$creadListPrec :: ReadPrec [CertificateSummary]
readPrec :: ReadPrec CertificateSummary
$creadPrec :: ReadPrec CertificateSummary
readList :: ReadS [CertificateSummary]
$creadList :: ReadS [CertificateSummary]
readsPrec :: Int -> ReadS CertificateSummary
$creadsPrec :: Int -> ReadS CertificateSummary
Prelude.Read, Int -> CertificateSummary -> ShowS
[CertificateSummary] -> ShowS
CertificateSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CertificateSummary] -> ShowS
$cshowList :: [CertificateSummary] -> ShowS
show :: CertificateSummary -> String
$cshow :: CertificateSummary -> String
showsPrec :: Int -> CertificateSummary -> ShowS
$cshowsPrec :: Int -> CertificateSummary -> ShowS
Prelude.Show, forall x. Rep CertificateSummary x -> CertificateSummary
forall x. CertificateSummary -> Rep CertificateSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CertificateSummary x -> CertificateSummary
$cfrom :: forall x. CertificateSummary -> Rep CertificateSummary x
Prelude.Generic)

-- |
-- Create a value of 'CertificateSummary' 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:
--
-- 'issuer', 'certificateSummary_issuer' - The entity that issued the certificate.
--
-- 'notValidAfter', 'certificateSummary_notValidAfter' - The certificate is not valid after this date.
--
-- 'notValidBefore', 'certificateSummary_notValidBefore' - The certificate is not valid before this date.
--
-- 'subject', 'certificateSummary_subject' - The entity the certificate belongs to.
--
-- 'thumbprint', 'certificateSummary_thumbprint' - A hexadecimal identifier for the certificate.
newCertificateSummary ::
  CertificateSummary
newCertificateSummary :: CertificateSummary
newCertificateSummary =
  CertificateSummary'
    { $sel:issuer:CertificateSummary' :: Maybe Text
issuer = forall a. Maybe a
Prelude.Nothing,
      $sel:notValidAfter:CertificateSummary' :: Maybe POSIX
notValidAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:notValidBefore:CertificateSummary' :: Maybe POSIX
notValidBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:subject:CertificateSummary' :: Maybe Text
subject = forall a. Maybe a
Prelude.Nothing,
      $sel:thumbprint:CertificateSummary' :: Maybe Text
thumbprint = forall a. Maybe a
Prelude.Nothing
    }

-- | The entity that issued the certificate.
certificateSummary_issuer :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.Text)
certificateSummary_issuer :: Lens' CertificateSummary (Maybe Text)
certificateSummary_issuer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Text
issuer :: Maybe Text
$sel:issuer:CertificateSummary' :: CertificateSummary -> Maybe Text
issuer} -> Maybe Text
issuer) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Text
a -> CertificateSummary
s {$sel:issuer:CertificateSummary' :: Maybe Text
issuer = Maybe Text
a} :: CertificateSummary)

-- | The certificate is not valid after this date.
certificateSummary_notValidAfter :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.UTCTime)
certificateSummary_notValidAfter :: Lens' CertificateSummary (Maybe UTCTime)
certificateSummary_notValidAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe POSIX
notValidAfter :: Maybe POSIX
$sel:notValidAfter:CertificateSummary' :: CertificateSummary -> Maybe POSIX
notValidAfter} -> Maybe POSIX
notValidAfter) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe POSIX
a -> CertificateSummary
s {$sel:notValidAfter:CertificateSummary' :: Maybe POSIX
notValidAfter = Maybe POSIX
a} :: CertificateSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The certificate is not valid before this date.
certificateSummary_notValidBefore :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.UTCTime)
certificateSummary_notValidBefore :: Lens' CertificateSummary (Maybe UTCTime)
certificateSummary_notValidBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe POSIX
notValidBefore :: Maybe POSIX
$sel:notValidBefore:CertificateSummary' :: CertificateSummary -> Maybe POSIX
notValidBefore} -> Maybe POSIX
notValidBefore) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe POSIX
a -> CertificateSummary
s {$sel:notValidBefore:CertificateSummary' :: Maybe POSIX
notValidBefore = Maybe POSIX
a} :: CertificateSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The entity the certificate belongs to.
certificateSummary_subject :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.Text)
certificateSummary_subject :: Lens' CertificateSummary (Maybe Text)
certificateSummary_subject = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Text
subject :: Maybe Text
$sel:subject:CertificateSummary' :: CertificateSummary -> Maybe Text
subject} -> Maybe Text
subject) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Text
a -> CertificateSummary
s {$sel:subject:CertificateSummary' :: Maybe Text
subject = Maybe Text
a} :: CertificateSummary)

-- | A hexadecimal identifier for the certificate.
certificateSummary_thumbprint :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.Text)
certificateSummary_thumbprint :: Lens' CertificateSummary (Maybe Text)
certificateSummary_thumbprint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Text
thumbprint :: Maybe Text
$sel:thumbprint:CertificateSummary' :: CertificateSummary -> Maybe Text
thumbprint} -> Maybe Text
thumbprint) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Text
a -> CertificateSummary
s {$sel:thumbprint:CertificateSummary' :: Maybe Text
thumbprint = Maybe Text
a} :: CertificateSummary)

instance Data.FromJSON CertificateSummary where
  parseJSON :: Value -> Parser CertificateSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CertificateSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> CertificateSummary
CertificateSummary'
            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
"issuer")
            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
"notValidAfter")
            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
"notValidBefore")
            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
"subject")
            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
"thumbprint")
      )

instance Prelude.Hashable CertificateSummary where
  hashWithSalt :: Int -> CertificateSummary -> Int
hashWithSalt Int
_salt CertificateSummary' {Maybe Text
Maybe POSIX
thumbprint :: Maybe Text
subject :: Maybe Text
notValidBefore :: Maybe POSIX
notValidAfter :: Maybe POSIX
issuer :: Maybe Text
$sel:thumbprint:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:subject:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:notValidBefore:CertificateSummary' :: CertificateSummary -> Maybe POSIX
$sel:notValidAfter:CertificateSummary' :: CertificateSummary -> Maybe POSIX
$sel:issuer:CertificateSummary' :: CertificateSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
issuer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
notValidAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
notValidBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subject
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thumbprint

instance Prelude.NFData CertificateSummary where
  rnf :: CertificateSummary -> ()
rnf CertificateSummary' {Maybe Text
Maybe POSIX
thumbprint :: Maybe Text
subject :: Maybe Text
notValidBefore :: Maybe POSIX
notValidAfter :: Maybe POSIX
issuer :: Maybe Text
$sel:thumbprint:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:subject:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:notValidBefore:CertificateSummary' :: CertificateSummary -> Maybe POSIX
$sel:notValidAfter:CertificateSummary' :: CertificateSummary -> Maybe POSIX
$sel:issuer:CertificateSummary' :: CertificateSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
issuer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
notValidAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
notValidBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subject
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thumbprint