{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53AutoNaming.Types.SOAChange 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

-- | 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
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]
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
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. 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' {$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 :: Lens' SOAChange Natural
sOAChange_ttl = 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 where
  hashWithSalt :: Int -> SOAChange -> Int
hashWithSalt Int
_salt SOAChange' {Natural
ttl :: Natural
$sel:ttl:SOAChange' :: SOAChange -> Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
ttl

instance Prelude.NFData SOAChange where
  rnf :: SOAChange -> ()
rnf SOAChange' {Natural
ttl :: Natural
$sel:ttl:SOAChange' :: SOAChange -> Natural
..} = forall a. NFData a => a -> ()
Prelude.rnf Natural
ttl

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