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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.Certificate
import Amazonka.Lightsail.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes an Amazon Lightsail SSL\/TLS certificate.
--
-- /See:/ 'newCertificateSummary' smart constructor.
data CertificateSummary = CertificateSummary'
  { -- | The Amazon Resource Name (ARN) of the certificate.
    CertificateSummary -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
    -- | An object that describes a certificate in detail.
    CertificateSummary -> Maybe Certificate
certificateDetail :: Prelude.Maybe Certificate,
    -- | The name of the certificate.
    CertificateSummary -> Maybe Text
certificateName :: Prelude.Maybe Prelude.Text,
    -- | The domain name of the certificate.
    CertificateSummary -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | The tag keys and optional values for the resource. For more information
    -- about tags in Lightsail, see the
    -- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
    CertificateSummary -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  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:
--
-- 'certificateArn', 'certificateSummary_certificateArn' - The Amazon Resource Name (ARN) of the certificate.
--
-- 'certificateDetail', 'certificateSummary_certificateDetail' - An object that describes a certificate in detail.
--
-- 'certificateName', 'certificateSummary_certificateName' - The name of the certificate.
--
-- 'domainName', 'certificateSummary_domainName' - The domain name of the certificate.
--
-- 'tags', 'certificateSummary_tags' - The tag keys and optional values for the resource. For more information
-- about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
newCertificateSummary ::
  CertificateSummary
newCertificateSummary :: CertificateSummary
newCertificateSummary =
  CertificateSummary'
    { $sel:certificateArn:CertificateSummary' :: Maybe Text
certificateArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:certificateDetail:CertificateSummary' :: Maybe Certificate
certificateDetail = forall a. Maybe a
Prelude.Nothing,
      $sel:certificateName:CertificateSummary' :: Maybe Text
certificateName = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:CertificateSummary' :: Maybe Text
domainName = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CertificateSummary' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the certificate.
certificateSummary_certificateArn :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.Text)
certificateSummary_certificateArn :: Lens' CertificateSummary (Maybe Text)
certificateSummary_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:CertificateSummary' :: CertificateSummary -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Text
a -> CertificateSummary
s {$sel:certificateArn:CertificateSummary' :: Maybe Text
certificateArn = Maybe Text
a} :: CertificateSummary)

-- | An object that describes a certificate in detail.
certificateSummary_certificateDetail :: Lens.Lens' CertificateSummary (Prelude.Maybe Certificate)
certificateSummary_certificateDetail :: Lens' CertificateSummary (Maybe Certificate)
certificateSummary_certificateDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Certificate
certificateDetail :: Maybe Certificate
$sel:certificateDetail:CertificateSummary' :: CertificateSummary -> Maybe Certificate
certificateDetail} -> Maybe Certificate
certificateDetail) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Certificate
a -> CertificateSummary
s {$sel:certificateDetail:CertificateSummary' :: Maybe Certificate
certificateDetail = Maybe Certificate
a} :: CertificateSummary)

-- | The name of the certificate.
certificateSummary_certificateName :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.Text)
certificateSummary_certificateName :: Lens' CertificateSummary (Maybe Text)
certificateSummary_certificateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Text
certificateName :: Maybe Text
$sel:certificateName:CertificateSummary' :: CertificateSummary -> Maybe Text
certificateName} -> Maybe Text
certificateName) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Text
a -> CertificateSummary
s {$sel:certificateName:CertificateSummary' :: Maybe Text
certificateName = Maybe Text
a} :: CertificateSummary)

-- | The domain name of the certificate.
certificateSummary_domainName :: Lens.Lens' CertificateSummary (Prelude.Maybe Prelude.Text)
certificateSummary_domainName :: Lens' CertificateSummary (Maybe Text)
certificateSummary_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe Text
domainName :: Maybe Text
$sel:domainName:CertificateSummary' :: CertificateSummary -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe Text
a -> CertificateSummary
s {$sel:domainName:CertificateSummary' :: Maybe Text
domainName = Maybe Text
a} :: CertificateSummary)

-- | The tag keys and optional values for the resource. For more information
-- about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
certificateSummary_tags :: Lens.Lens' CertificateSummary (Prelude.Maybe [Tag])
certificateSummary_tags :: Lens' CertificateSummary (Maybe [Tag])
certificateSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateSummary' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CertificateSummary' :: CertificateSummary -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CertificateSummary
s@CertificateSummary' {} Maybe [Tag]
a -> CertificateSummary
s {$sel:tags:CertificateSummary' :: Maybe [Tag]
tags = Maybe [Tag]
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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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 Certificate
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> 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
"certificateArn")
            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
"certificateDetail")
            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
"certificateName")
            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
"domainName")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable CertificateSummary where
  hashWithSalt :: Int -> CertificateSummary -> Int
hashWithSalt Int
_salt CertificateSummary' {Maybe [Tag]
Maybe Text
Maybe Certificate
tags :: Maybe [Tag]
domainName :: Maybe Text
certificateName :: Maybe Text
certificateDetail :: Maybe Certificate
certificateArn :: Maybe Text
$sel:tags:CertificateSummary' :: CertificateSummary -> Maybe [Tag]
$sel:domainName:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:certificateName:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:certificateDetail:CertificateSummary' :: CertificateSummary -> Maybe Certificate
$sel:certificateArn:CertificateSummary' :: CertificateSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Certificate
certificateDetail
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData CertificateSummary where
  rnf :: CertificateSummary -> ()
rnf CertificateSummary' {Maybe [Tag]
Maybe Text
Maybe Certificate
tags :: Maybe [Tag]
domainName :: Maybe Text
certificateName :: Maybe Text
certificateDetail :: Maybe Certificate
certificateArn :: Maybe Text
$sel:tags:CertificateSummary' :: CertificateSummary -> Maybe [Tag]
$sel:domainName:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:certificateName:CertificateSummary' :: CertificateSummary -> Maybe Text
$sel:certificateDetail:CertificateSummary' :: CertificateSummary -> Maybe Certificate
$sel:certificateArn:CertificateSummary' :: CertificateSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Certificate
certificateDetail
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags