{-# 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.Route53.Types.HostedZoneConfig
-- 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.Route53.Types.HostedZoneConfig 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
import Amazonka.Route53.Internal

-- | A complex type that contains an optional comment about your hosted zone.
-- If you don\'t want to specify a comment, omit both the
-- @HostedZoneConfig@ and @Comment@ elements.
--
-- /See:/ 'newHostedZoneConfig' smart constructor.
data HostedZoneConfig = HostedZoneConfig'
  { -- | Any comments that you want to include about the hosted zone.
    HostedZoneConfig -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | A value that indicates whether this is a private hosted zone.
    HostedZoneConfig -> Maybe Bool
privateZone :: Prelude.Maybe Prelude.Bool
  }
  deriving (HostedZoneConfig -> HostedZoneConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HostedZoneConfig -> HostedZoneConfig -> Bool
$c/= :: HostedZoneConfig -> HostedZoneConfig -> Bool
== :: HostedZoneConfig -> HostedZoneConfig -> Bool
$c== :: HostedZoneConfig -> HostedZoneConfig -> Bool
Prelude.Eq, ReadPrec [HostedZoneConfig]
ReadPrec HostedZoneConfig
Int -> ReadS HostedZoneConfig
ReadS [HostedZoneConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HostedZoneConfig]
$creadListPrec :: ReadPrec [HostedZoneConfig]
readPrec :: ReadPrec HostedZoneConfig
$creadPrec :: ReadPrec HostedZoneConfig
readList :: ReadS [HostedZoneConfig]
$creadList :: ReadS [HostedZoneConfig]
readsPrec :: Int -> ReadS HostedZoneConfig
$creadsPrec :: Int -> ReadS HostedZoneConfig
Prelude.Read, Int -> HostedZoneConfig -> ShowS
[HostedZoneConfig] -> ShowS
HostedZoneConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HostedZoneConfig] -> ShowS
$cshowList :: [HostedZoneConfig] -> ShowS
show :: HostedZoneConfig -> String
$cshow :: HostedZoneConfig -> String
showsPrec :: Int -> HostedZoneConfig -> ShowS
$cshowsPrec :: Int -> HostedZoneConfig -> ShowS
Prelude.Show, forall x. Rep HostedZoneConfig x -> HostedZoneConfig
forall x. HostedZoneConfig -> Rep HostedZoneConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HostedZoneConfig x -> HostedZoneConfig
$cfrom :: forall x. HostedZoneConfig -> Rep HostedZoneConfig x
Prelude.Generic)

-- |
-- Create a value of 'HostedZoneConfig' 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:
--
-- 'comment', 'hostedZoneConfig_comment' - Any comments that you want to include about the hosted zone.
--
-- 'privateZone', 'hostedZoneConfig_privateZone' - A value that indicates whether this is a private hosted zone.
newHostedZoneConfig ::
  HostedZoneConfig
newHostedZoneConfig :: HostedZoneConfig
newHostedZoneConfig =
  HostedZoneConfig'
    { $sel:comment:HostedZoneConfig' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
      $sel:privateZone:HostedZoneConfig' :: Maybe Bool
privateZone = forall a. Maybe a
Prelude.Nothing
    }

-- | Any comments that you want to include about the hosted zone.
hostedZoneConfig_comment :: Lens.Lens' HostedZoneConfig (Prelude.Maybe Prelude.Text)
hostedZoneConfig_comment :: Lens' HostedZoneConfig (Maybe Text)
hostedZoneConfig_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneConfig' {Maybe Text
comment :: Maybe Text
$sel:comment:HostedZoneConfig' :: HostedZoneConfig -> Maybe Text
comment} -> Maybe Text
comment) (\s :: HostedZoneConfig
s@HostedZoneConfig' {} Maybe Text
a -> HostedZoneConfig
s {$sel:comment:HostedZoneConfig' :: Maybe Text
comment = Maybe Text
a} :: HostedZoneConfig)

-- | A value that indicates whether this is a private hosted zone.
hostedZoneConfig_privateZone :: Lens.Lens' HostedZoneConfig (Prelude.Maybe Prelude.Bool)
hostedZoneConfig_privateZone :: Lens' HostedZoneConfig (Maybe Bool)
hostedZoneConfig_privateZone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HostedZoneConfig' {Maybe Bool
privateZone :: Maybe Bool
$sel:privateZone:HostedZoneConfig' :: HostedZoneConfig -> Maybe Bool
privateZone} -> Maybe Bool
privateZone) (\s :: HostedZoneConfig
s@HostedZoneConfig' {} Maybe Bool
a -> HostedZoneConfig
s {$sel:privateZone:HostedZoneConfig' :: Maybe Bool
privateZone = Maybe Bool
a} :: HostedZoneConfig)

instance Data.FromXML HostedZoneConfig where
  parseXML :: [Node] -> Either String HostedZoneConfig
parseXML [Node]
x =
    Maybe Text -> Maybe Bool -> HostedZoneConfig
HostedZoneConfig'
      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
"Comment")
      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
"PrivateZone")

instance Prelude.Hashable HostedZoneConfig where
  hashWithSalt :: Int -> HostedZoneConfig -> Int
hashWithSalt Int
_salt HostedZoneConfig' {Maybe Bool
Maybe Text
privateZone :: Maybe Bool
comment :: Maybe Text
$sel:privateZone:HostedZoneConfig' :: HostedZoneConfig -> Maybe Bool
$sel:comment:HostedZoneConfig' :: HostedZoneConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
privateZone

instance Prelude.NFData HostedZoneConfig where
  rnf :: HostedZoneConfig -> ()
rnf HostedZoneConfig' {Maybe Bool
Maybe Text
privateZone :: Maybe Bool
comment :: Maybe Text
$sel:privateZone:HostedZoneConfig' :: HostedZoneConfig -> Maybe Bool
$sel:comment:HostedZoneConfig' :: HostedZoneConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
privateZone

instance Data.ToXML HostedZoneConfig where
  toXML :: HostedZoneConfig -> XML
toXML HostedZoneConfig' {Maybe Bool
Maybe Text
privateZone :: Maybe Bool
comment :: Maybe Text
$sel:privateZone:HostedZoneConfig' :: HostedZoneConfig -> Maybe Bool
$sel:comment:HostedZoneConfig' :: HostedZoneConfig -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"Comment" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
comment,
        Name
"PrivateZone" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Bool
privateZone
      ]