{-# 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.ResourceRecord
-- 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.ResourceRecord where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal

-- | Information specific to the resource record.
--
-- If you\'re creating an alias resource record set, omit @ResourceRecord@.
--
-- /See:/ 'newResourceRecord' smart constructor.
data ResourceRecord = ResourceRecord'
  { -- | The current or new DNS record value, not to exceed 4,000 characters. In
    -- the case of a @DELETE@ action, if the current value does not match the
    -- actual value, an error is returned. For descriptions about how to format
    -- @Value@ for different record types, see
    -- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html Supported DNS Resource Record Types>
    -- in the /Amazon Route 53 Developer Guide/.
    --
    -- You can specify more than one value for all record types except @CNAME@
    -- and @SOA@.
    --
    -- If you\'re creating an alias resource record set, omit @Value@.
    ResourceRecord -> Text
value :: Prelude.Text
  }
  deriving (ResourceRecord -> ResourceRecord -> Bool
(ResourceRecord -> ResourceRecord -> Bool)
-> (ResourceRecord -> ResourceRecord -> Bool) -> Eq ResourceRecord
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceRecord -> ResourceRecord -> Bool
$c/= :: ResourceRecord -> ResourceRecord -> Bool
== :: ResourceRecord -> ResourceRecord -> Bool
$c== :: ResourceRecord -> ResourceRecord -> Bool
Prelude.Eq, ReadPrec [ResourceRecord]
ReadPrec ResourceRecord
Int -> ReadS ResourceRecord
ReadS [ResourceRecord]
(Int -> ReadS ResourceRecord)
-> ReadS [ResourceRecord]
-> ReadPrec ResourceRecord
-> ReadPrec [ResourceRecord]
-> Read ResourceRecord
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceRecord]
$creadListPrec :: ReadPrec [ResourceRecord]
readPrec :: ReadPrec ResourceRecord
$creadPrec :: ReadPrec ResourceRecord
readList :: ReadS [ResourceRecord]
$creadList :: ReadS [ResourceRecord]
readsPrec :: Int -> ReadS ResourceRecord
$creadsPrec :: Int -> ReadS ResourceRecord
Prelude.Read, Int -> ResourceRecord -> ShowS
[ResourceRecord] -> ShowS
ResourceRecord -> String
(Int -> ResourceRecord -> ShowS)
-> (ResourceRecord -> String)
-> ([ResourceRecord] -> ShowS)
-> Show ResourceRecord
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceRecord] -> ShowS
$cshowList :: [ResourceRecord] -> ShowS
show :: ResourceRecord -> String
$cshow :: ResourceRecord -> String
showsPrec :: Int -> ResourceRecord -> ShowS
$cshowsPrec :: Int -> ResourceRecord -> ShowS
Prelude.Show, (forall x. ResourceRecord -> Rep ResourceRecord x)
-> (forall x. Rep ResourceRecord x -> ResourceRecord)
-> Generic ResourceRecord
forall x. Rep ResourceRecord x -> ResourceRecord
forall x. ResourceRecord -> Rep ResourceRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceRecord x -> ResourceRecord
$cfrom :: forall x. ResourceRecord -> Rep ResourceRecord x
Prelude.Generic)

-- |
-- Create a value of 'ResourceRecord' 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:
--
-- 'value', 'resourceRecord_value' - The current or new DNS record value, not to exceed 4,000 characters. In
-- the case of a @DELETE@ action, if the current value does not match the
-- actual value, an error is returned. For descriptions about how to format
-- @Value@ for different record types, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html Supported DNS Resource Record Types>
-- in the /Amazon Route 53 Developer Guide/.
--
-- You can specify more than one value for all record types except @CNAME@
-- and @SOA@.
--
-- If you\'re creating an alias resource record set, omit @Value@.
newResourceRecord ::
  -- | 'value'
  Prelude.Text ->
  ResourceRecord
newResourceRecord :: Text -> ResourceRecord
newResourceRecord Text
pValue_ =
  ResourceRecord' :: Text -> ResourceRecord
ResourceRecord' {$sel:value:ResourceRecord' :: Text
value = Text
pValue_}

-- | The current or new DNS record value, not to exceed 4,000 characters. In
-- the case of a @DELETE@ action, if the current value does not match the
-- actual value, an error is returned. For descriptions about how to format
-- @Value@ for different record types, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html Supported DNS Resource Record Types>
-- in the /Amazon Route 53 Developer Guide/.
--
-- You can specify more than one value for all record types except @CNAME@
-- and @SOA@.
--
-- If you\'re creating an alias resource record set, omit @Value@.
resourceRecord_value :: Lens.Lens' ResourceRecord Prelude.Text
resourceRecord_value :: (Text -> f Text) -> ResourceRecord -> f ResourceRecord
resourceRecord_value = (ResourceRecord -> Text)
-> (ResourceRecord -> Text -> ResourceRecord)
-> Lens ResourceRecord ResourceRecord Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceRecord' {Text
value :: Text
$sel:value:ResourceRecord' :: ResourceRecord -> Text
value} -> Text
value) (\s :: ResourceRecord
s@ResourceRecord' {} Text
a -> ResourceRecord
s {$sel:value:ResourceRecord' :: Text
value = Text
a} :: ResourceRecord)

instance Core.FromXML ResourceRecord where
  parseXML :: [Node] -> Either String ResourceRecord
parseXML [Node]
x =
    Text -> ResourceRecord
ResourceRecord' (Text -> ResourceRecord)
-> Either String Text -> Either String ResourceRecord
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Value")

instance Prelude.Hashable ResourceRecord

instance Prelude.NFData ResourceRecord

instance Core.ToXML ResourceRecord where
  toXML :: ResourceRecord -> XML
toXML ResourceRecord' {Text
value :: Text
$sel:value:ResourceRecord' :: ResourceRecord -> Text
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Value" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
value]