{-# 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.AppRunner.Types.CertificateValidationRecord
-- 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.AppRunner.Types.CertificateValidationRecord where

import Amazonka.AppRunner.Types.CertificateValidationRecordStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a certificate CNAME record to add to your DNS. For more
-- information, see
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_AssociateCustomDomain.html AssociateCustomDomain>.
--
-- /See:/ 'newCertificateValidationRecord' smart constructor.
data CertificateValidationRecord = CertificateValidationRecord'
  { -- | The current state of the certificate CNAME record validation. It should
    -- change to @SUCCESS@ after App Runner completes validation with your DNS.
    CertificateValidationRecord
-> Maybe CertificateValidationRecordStatus
status :: Prelude.Maybe CertificateValidationRecordStatus,
    -- | The certificate CNAME record value.
    CertificateValidationRecord -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The certificate CNAME record name.
    CertificateValidationRecord -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The record type, always @CNAME@.
    CertificateValidationRecord -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (CertificateValidationRecord -> CertificateValidationRecord -> Bool
(CertificateValidationRecord
 -> CertificateValidationRecord -> Bool)
-> (CertificateValidationRecord
    -> CertificateValidationRecord -> Bool)
-> Eq CertificateValidationRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CertificateValidationRecord -> CertificateValidationRecord -> Bool
$c/= :: CertificateValidationRecord -> CertificateValidationRecord -> Bool
== :: CertificateValidationRecord -> CertificateValidationRecord -> Bool
$c== :: CertificateValidationRecord -> CertificateValidationRecord -> Bool
Prelude.Eq, ReadPrec [CertificateValidationRecord]
ReadPrec CertificateValidationRecord
Int -> ReadS CertificateValidationRecord
ReadS [CertificateValidationRecord]
(Int -> ReadS CertificateValidationRecord)
-> ReadS [CertificateValidationRecord]
-> ReadPrec CertificateValidationRecord
-> ReadPrec [CertificateValidationRecord]
-> Read CertificateValidationRecord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CertificateValidationRecord]
$creadListPrec :: ReadPrec [CertificateValidationRecord]
readPrec :: ReadPrec CertificateValidationRecord
$creadPrec :: ReadPrec CertificateValidationRecord
readList :: ReadS [CertificateValidationRecord]
$creadList :: ReadS [CertificateValidationRecord]
readsPrec :: Int -> ReadS CertificateValidationRecord
$creadsPrec :: Int -> ReadS CertificateValidationRecord
Prelude.Read, Int -> CertificateValidationRecord -> ShowS
[CertificateValidationRecord] -> ShowS
CertificateValidationRecord -> String
(Int -> CertificateValidationRecord -> ShowS)
-> (CertificateValidationRecord -> String)
-> ([CertificateValidationRecord] -> ShowS)
-> Show CertificateValidationRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CertificateValidationRecord] -> ShowS
$cshowList :: [CertificateValidationRecord] -> ShowS
show :: CertificateValidationRecord -> String
$cshow :: CertificateValidationRecord -> String
showsPrec :: Int -> CertificateValidationRecord -> ShowS
$cshowsPrec :: Int -> CertificateValidationRecord -> ShowS
Prelude.Show, (forall x.
 CertificateValidationRecord -> Rep CertificateValidationRecord x)
-> (forall x.
    Rep CertificateValidationRecord x -> CertificateValidationRecord)
-> Generic CertificateValidationRecord
forall x.
Rep CertificateValidationRecord x -> CertificateValidationRecord
forall x.
CertificateValidationRecord -> Rep CertificateValidationRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CertificateValidationRecord x -> CertificateValidationRecord
$cfrom :: forall x.
CertificateValidationRecord -> Rep CertificateValidationRecord x
Prelude.Generic)

-- |
-- Create a value of 'CertificateValidationRecord' 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:
--
-- 'status', 'certificateValidationRecord_status' - The current state of the certificate CNAME record validation. It should
-- change to @SUCCESS@ after App Runner completes validation with your DNS.
--
-- 'value', 'certificateValidationRecord_value' - The certificate CNAME record value.
--
-- 'name', 'certificateValidationRecord_name' - The certificate CNAME record name.
--
-- 'type'', 'certificateValidationRecord_type' - The record type, always @CNAME@.
newCertificateValidationRecord ::
  CertificateValidationRecord
newCertificateValidationRecord :: CertificateValidationRecord
newCertificateValidationRecord =
  CertificateValidationRecord' :: Maybe CertificateValidationRecordStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CertificateValidationRecord
CertificateValidationRecord'
    { $sel:status:CertificateValidationRecord' :: Maybe CertificateValidationRecordStatus
status =
        Maybe CertificateValidationRecordStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:value:CertificateValidationRecord' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CertificateValidationRecord' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':CertificateValidationRecord' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of the certificate CNAME record validation. It should
-- change to @SUCCESS@ after App Runner completes validation with your DNS.
certificateValidationRecord_status :: Lens.Lens' CertificateValidationRecord (Prelude.Maybe CertificateValidationRecordStatus)
certificateValidationRecord_status :: (Maybe CertificateValidationRecordStatus
 -> f (Maybe CertificateValidationRecordStatus))
-> CertificateValidationRecord -> f CertificateValidationRecord
certificateValidationRecord_status = (CertificateValidationRecord
 -> Maybe CertificateValidationRecordStatus)
-> (CertificateValidationRecord
    -> Maybe CertificateValidationRecordStatus
    -> CertificateValidationRecord)
-> Lens
     CertificateValidationRecord
     CertificateValidationRecord
     (Maybe CertificateValidationRecordStatus)
     (Maybe CertificateValidationRecordStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateValidationRecord' {Maybe CertificateValidationRecordStatus
status :: Maybe CertificateValidationRecordStatus
$sel:status:CertificateValidationRecord' :: CertificateValidationRecord
-> Maybe CertificateValidationRecordStatus
status} -> Maybe CertificateValidationRecordStatus
status) (\s :: CertificateValidationRecord
s@CertificateValidationRecord' {} Maybe CertificateValidationRecordStatus
a -> CertificateValidationRecord
s {$sel:status:CertificateValidationRecord' :: Maybe CertificateValidationRecordStatus
status = Maybe CertificateValidationRecordStatus
a} :: CertificateValidationRecord)

-- | The certificate CNAME record value.
certificateValidationRecord_value :: Lens.Lens' CertificateValidationRecord (Prelude.Maybe Prelude.Text)
certificateValidationRecord_value :: (Maybe Text -> f (Maybe Text))
-> CertificateValidationRecord -> f CertificateValidationRecord
certificateValidationRecord_value = (CertificateValidationRecord -> Maybe Text)
-> (CertificateValidationRecord
    -> Maybe Text -> CertificateValidationRecord)
-> Lens
     CertificateValidationRecord
     CertificateValidationRecord
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateValidationRecord' {Maybe Text
value :: Maybe Text
$sel:value:CertificateValidationRecord' :: CertificateValidationRecord -> Maybe Text
value} -> Maybe Text
value) (\s :: CertificateValidationRecord
s@CertificateValidationRecord' {} Maybe Text
a -> CertificateValidationRecord
s {$sel:value:CertificateValidationRecord' :: Maybe Text
value = Maybe Text
a} :: CertificateValidationRecord)

-- | The certificate CNAME record name.
certificateValidationRecord_name :: Lens.Lens' CertificateValidationRecord (Prelude.Maybe Prelude.Text)
certificateValidationRecord_name :: (Maybe Text -> f (Maybe Text))
-> CertificateValidationRecord -> f CertificateValidationRecord
certificateValidationRecord_name = (CertificateValidationRecord -> Maybe Text)
-> (CertificateValidationRecord
    -> Maybe Text -> CertificateValidationRecord)
-> Lens
     CertificateValidationRecord
     CertificateValidationRecord
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateValidationRecord' {Maybe Text
name :: Maybe Text
$sel:name:CertificateValidationRecord' :: CertificateValidationRecord -> Maybe Text
name} -> Maybe Text
name) (\s :: CertificateValidationRecord
s@CertificateValidationRecord' {} Maybe Text
a -> CertificateValidationRecord
s {$sel:name:CertificateValidationRecord' :: Maybe Text
name = Maybe Text
a} :: CertificateValidationRecord)

-- | The record type, always @CNAME@.
certificateValidationRecord_type :: Lens.Lens' CertificateValidationRecord (Prelude.Maybe Prelude.Text)
certificateValidationRecord_type :: (Maybe Text -> f (Maybe Text))
-> CertificateValidationRecord -> f CertificateValidationRecord
certificateValidationRecord_type = (CertificateValidationRecord -> Maybe Text)
-> (CertificateValidationRecord
    -> Maybe Text -> CertificateValidationRecord)
-> Lens
     CertificateValidationRecord
     CertificateValidationRecord
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CertificateValidationRecord' {Maybe Text
type' :: Maybe Text
$sel:type':CertificateValidationRecord' :: CertificateValidationRecord -> Maybe Text
type'} -> Maybe Text
type') (\s :: CertificateValidationRecord
s@CertificateValidationRecord' {} Maybe Text
a -> CertificateValidationRecord
s {$sel:type':CertificateValidationRecord' :: Maybe Text
type' = Maybe Text
a} :: CertificateValidationRecord)

instance Core.FromJSON CertificateValidationRecord where
  parseJSON :: Value -> Parser CertificateValidationRecord
parseJSON =
    String
-> (Object -> Parser CertificateValidationRecord)
-> Value
-> Parser CertificateValidationRecord
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CertificateValidationRecord"
      ( \Object
x ->
          Maybe CertificateValidationRecordStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> CertificateValidationRecord
CertificateValidationRecord'
            (Maybe CertificateValidationRecordStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> CertificateValidationRecord)
-> Parser (Maybe CertificateValidationRecordStatus)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> CertificateValidationRecord)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CertificateValidationRecordStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> CertificateValidationRecord)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> CertificateValidationRecord)
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
"Value")
            Parser (Maybe Text -> Maybe Text -> CertificateValidationRecord)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> CertificateValidationRecord)
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
"Name")
            Parser (Maybe Text -> CertificateValidationRecord)
-> Parser (Maybe Text) -> Parser CertificateValidationRecord
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
"Type")
      )

instance Prelude.Hashable CertificateValidationRecord

instance Prelude.NFData CertificateValidationRecord