{-# 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-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.Route53.Types.HostedZoneConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | A value that indicates whether this is a private hosted zone.
    HostedZoneConfig -> Maybe Bool
privateZone :: Prelude.Maybe Prelude.Bool,
    -- | Any comments that you want to include about the hosted zone.
    HostedZoneConfig -> Maybe Text
comment :: Prelude.Maybe Prelude.Text
  }
  deriving (HostedZoneConfig -> HostedZoneConfig -> Bool
(HostedZoneConfig -> HostedZoneConfig -> Bool)
-> (HostedZoneConfig -> HostedZoneConfig -> Bool)
-> Eq HostedZoneConfig
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]
(Int -> ReadS HostedZoneConfig)
-> ReadS [HostedZoneConfig]
-> ReadPrec HostedZoneConfig
-> ReadPrec [HostedZoneConfig]
-> Read 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
(Int -> HostedZoneConfig -> ShowS)
-> (HostedZoneConfig -> String)
-> ([HostedZoneConfig] -> ShowS)
-> Show HostedZoneConfig
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. HostedZoneConfig -> Rep HostedZoneConfig x)
-> (forall x. Rep HostedZoneConfig x -> HostedZoneConfig)
-> Generic HostedZoneConfig
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:
--
-- 'privateZone', 'hostedZoneConfig_privateZone' - A value that indicates whether this is a private hosted zone.
--
-- 'comment', 'hostedZoneConfig_comment' - Any comments that you want to include about the hosted zone.
newHostedZoneConfig ::
  HostedZoneConfig
newHostedZoneConfig :: HostedZoneConfig
newHostedZoneConfig =
  HostedZoneConfig' :: Maybe Bool -> Maybe Text -> HostedZoneConfig
HostedZoneConfig'
    { $sel:privateZone:HostedZoneConfig' :: Maybe Bool
privateZone = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:comment:HostedZoneConfig' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A value that indicates whether this is a private hosted zone.
hostedZoneConfig_privateZone :: Lens.Lens' HostedZoneConfig (Prelude.Maybe Prelude.Bool)
hostedZoneConfig_privateZone :: (Maybe Bool -> f (Maybe Bool))
-> HostedZoneConfig -> f HostedZoneConfig
hostedZoneConfig_privateZone = (HostedZoneConfig -> Maybe Bool)
-> (HostedZoneConfig -> Maybe Bool -> HostedZoneConfig)
-> Lens HostedZoneConfig HostedZoneConfig (Maybe Bool) (Maybe Bool)
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)

-- | Any comments that you want to include about the hosted zone.
hostedZoneConfig_comment :: Lens.Lens' HostedZoneConfig (Prelude.Maybe Prelude.Text)
hostedZoneConfig_comment :: (Maybe Text -> f (Maybe Text))
-> HostedZoneConfig -> f HostedZoneConfig
hostedZoneConfig_comment = (HostedZoneConfig -> Maybe Text)
-> (HostedZoneConfig -> Maybe Text -> HostedZoneConfig)
-> Lens HostedZoneConfig HostedZoneConfig (Maybe Text) (Maybe Text)
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)

instance Core.FromXML HostedZoneConfig where
  parseXML :: [Node] -> Either String HostedZoneConfig
parseXML [Node]
x =
    Maybe Bool -> Maybe Text -> HostedZoneConfig
HostedZoneConfig'
      (Maybe Bool -> Maybe Text -> HostedZoneConfig)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> HostedZoneConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PrivateZone")
      Either String (Maybe Text -> HostedZoneConfig)
-> Either String (Maybe Text) -> Either String HostedZoneConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Comment")

instance Prelude.Hashable HostedZoneConfig

instance Prelude.NFData HostedZoneConfig

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