{-# 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.EC2.Types.DnsEntry
-- 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.EC2.Types.DnsEntry where

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

-- | Describes a DNS entry.
--
-- /See:/ 'newDnsEntry' smart constructor.
data DnsEntry = DnsEntry'
  { -- | The DNS name.
    DnsEntry -> Maybe Text
dnsName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the private hosted zone.
    DnsEntry -> Maybe Text
hostedZoneId :: Prelude.Maybe Prelude.Text
  }
  deriving (DnsEntry -> DnsEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnsEntry -> DnsEntry -> Bool
$c/= :: DnsEntry -> DnsEntry -> Bool
== :: DnsEntry -> DnsEntry -> Bool
$c== :: DnsEntry -> DnsEntry -> Bool
Prelude.Eq, ReadPrec [DnsEntry]
ReadPrec DnsEntry
Int -> ReadS DnsEntry
ReadS [DnsEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnsEntry]
$creadListPrec :: ReadPrec [DnsEntry]
readPrec :: ReadPrec DnsEntry
$creadPrec :: ReadPrec DnsEntry
readList :: ReadS [DnsEntry]
$creadList :: ReadS [DnsEntry]
readsPrec :: Int -> ReadS DnsEntry
$creadsPrec :: Int -> ReadS DnsEntry
Prelude.Read, Int -> DnsEntry -> ShowS
[DnsEntry] -> ShowS
DnsEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnsEntry] -> ShowS
$cshowList :: [DnsEntry] -> ShowS
show :: DnsEntry -> String
$cshow :: DnsEntry -> String
showsPrec :: Int -> DnsEntry -> ShowS
$cshowsPrec :: Int -> DnsEntry -> ShowS
Prelude.Show, forall x. Rep DnsEntry x -> DnsEntry
forall x. DnsEntry -> Rep DnsEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DnsEntry x -> DnsEntry
$cfrom :: forall x. DnsEntry -> Rep DnsEntry x
Prelude.Generic)

-- |
-- Create a value of 'DnsEntry' 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:
--
-- 'dnsName', 'dnsEntry_dnsName' - The DNS name.
--
-- 'hostedZoneId', 'dnsEntry_hostedZoneId' - The ID of the private hosted zone.
newDnsEntry ::
  DnsEntry
newDnsEntry :: DnsEntry
newDnsEntry =
  DnsEntry'
    { $sel:dnsName:DnsEntry' :: Maybe Text
dnsName = forall a. Maybe a
Prelude.Nothing,
      $sel:hostedZoneId:DnsEntry' :: Maybe Text
hostedZoneId = forall a. Maybe a
Prelude.Nothing
    }

-- | The DNS name.
dnsEntry_dnsName :: Lens.Lens' DnsEntry (Prelude.Maybe Prelude.Text)
dnsEntry_dnsName :: Lens' DnsEntry (Maybe Text)
dnsEntry_dnsName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsEntry' {Maybe Text
dnsName :: Maybe Text
$sel:dnsName:DnsEntry' :: DnsEntry -> Maybe Text
dnsName} -> Maybe Text
dnsName) (\s :: DnsEntry
s@DnsEntry' {} Maybe Text
a -> DnsEntry
s {$sel:dnsName:DnsEntry' :: Maybe Text
dnsName = Maybe Text
a} :: DnsEntry)

-- | The ID of the private hosted zone.
dnsEntry_hostedZoneId :: Lens.Lens' DnsEntry (Prelude.Maybe Prelude.Text)
dnsEntry_hostedZoneId :: Lens' DnsEntry (Maybe Text)
dnsEntry_hostedZoneId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsEntry' {Maybe Text
hostedZoneId :: Maybe Text
$sel:hostedZoneId:DnsEntry' :: DnsEntry -> Maybe Text
hostedZoneId} -> Maybe Text
hostedZoneId) (\s :: DnsEntry
s@DnsEntry' {} Maybe Text
a -> DnsEntry
s {$sel:hostedZoneId:DnsEntry' :: Maybe Text
hostedZoneId = Maybe Text
a} :: DnsEntry)

instance Data.FromXML DnsEntry where
  parseXML :: [Node] -> Either String DnsEntry
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> DnsEntry
DnsEntry'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"dnsName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"hostedZoneId")

instance Prelude.Hashable DnsEntry where
  hashWithSalt :: Int -> DnsEntry -> Int
hashWithSalt Int
_salt DnsEntry' {Maybe Text
hostedZoneId :: Maybe Text
dnsName :: Maybe Text
$sel:hostedZoneId:DnsEntry' :: DnsEntry -> Maybe Text
$sel:dnsName:DnsEntry' :: DnsEntry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dnsName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostedZoneId

instance Prelude.NFData DnsEntry where
  rnf :: DnsEntry -> ()
rnf DnsEntry' {Maybe Text
hostedZoneId :: Maybe Text
dnsName :: Maybe Text
$sel:hostedZoneId:DnsEntry' :: DnsEntry -> Maybe Text
$sel:dnsName:DnsEntry' :: DnsEntry -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dnsName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostedZoneId