{-# 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.Route53AutoNaming.Types.SOAChange
-- 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.Route53AutoNaming.Types.SOAChange where

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

-- | Updated Start of Authority (SOA) properties for a public or private DNS
-- namespace.
--
-- /See:/ 'newSOAChange' smart constructor.
data SOAChange = SOAChange'
  { -- | The updated time to live (TTL) for purposes of negative caching.
    SOAChange -> Natural
ttl :: Prelude.Natural
  }
  deriving (SOAChange -> SOAChange -> Bool
(SOAChange -> SOAChange -> Bool)
-> (SOAChange -> SOAChange -> Bool) -> Eq SOAChange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SOAChange -> SOAChange -> Bool
$c/= :: SOAChange -> SOAChange -> Bool
== :: SOAChange -> SOAChange -> Bool
$c== :: SOAChange -> SOAChange -> Bool
Prelude.Eq, ReadPrec [SOAChange]
ReadPrec SOAChange
Int -> ReadS SOAChange
ReadS [SOAChange]
(Int -> ReadS SOAChange)
-> ReadS [SOAChange]
-> ReadPrec SOAChange
-> ReadPrec [SOAChange]
-> Read SOAChange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SOAChange]
$creadListPrec :: ReadPrec [SOAChange]
readPrec :: ReadPrec SOAChange
$creadPrec :: ReadPrec SOAChange
readList :: ReadS [SOAChange]
$creadList :: ReadS [SOAChange]
readsPrec :: Int -> ReadS SOAChange
$creadsPrec :: Int -> ReadS SOAChange
Prelude.Read, Int -> SOAChange -> ShowS
[SOAChange] -> ShowS
SOAChange -> String
(Int -> SOAChange -> ShowS)
-> (SOAChange -> String)
-> ([SOAChange] -> ShowS)
-> Show SOAChange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SOAChange] -> ShowS
$cshowList :: [SOAChange] -> ShowS
show :: SOAChange -> String
$cshow :: SOAChange -> String
showsPrec :: Int -> SOAChange -> ShowS
$cshowsPrec :: Int -> SOAChange -> ShowS
Prelude.Show, (forall x. SOAChange -> Rep SOAChange x)
-> (forall x. Rep SOAChange x -> SOAChange) -> Generic SOAChange
forall x. Rep SOAChange x -> SOAChange
forall x. SOAChange -> Rep SOAChange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SOAChange x -> SOAChange
$cfrom :: forall x. SOAChange -> Rep SOAChange x
Prelude.Generic)

-- |
-- Create a value of 'SOAChange' 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:
--
-- 'ttl', 'sOAChange_ttl' - The updated time to live (TTL) for purposes of negative caching.
newSOAChange ::
  -- | 'ttl'
  Prelude.Natural ->
  SOAChange
newSOAChange :: Natural -> SOAChange
newSOAChange Natural
pTTL_ = SOAChange' :: Natural -> SOAChange
SOAChange' {$sel:ttl:SOAChange' :: Natural
ttl = Natural
pTTL_}

-- | The updated time to live (TTL) for purposes of negative caching.
sOAChange_ttl :: Lens.Lens' SOAChange Prelude.Natural
sOAChange_ttl :: (Natural -> f Natural) -> SOAChange -> f SOAChange
sOAChange_ttl = (SOAChange -> Natural)
-> (SOAChange -> Natural -> SOAChange)
-> Lens SOAChange SOAChange Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SOAChange' {Natural
ttl :: Natural
$sel:ttl:SOAChange' :: SOAChange -> Natural
ttl} -> Natural
ttl) (\s :: SOAChange
s@SOAChange' {} Natural
a -> SOAChange
s {$sel:ttl:SOAChange' :: Natural
ttl = Natural
a} :: SOAChange)

instance Prelude.Hashable SOAChange

instance Prelude.NFData SOAChange

instance Core.ToJSON SOAChange where
  toJSON :: SOAChange -> Value
toJSON SOAChange' {Natural
ttl :: Natural
$sel:ttl:SOAChange' :: SOAChange -> Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TTL" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
ttl)]
      )