{-# 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.DnsConfigChange
-- 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.DnsConfigChange 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.Route53AutoNaming.Types.DnsRecord

-- | A complex type that contains information about changes to the Route 53
-- DNS records that Cloud Map creates when you register an instance.
--
-- /See:/ 'newDnsConfigChange' smart constructor.
data DnsConfigChange = DnsConfigChange'
  { -- | An array that contains one @DnsRecord@ object for each Route 53 record
    -- that you want Cloud Map to create when you register an instance.
    DnsConfigChange -> [DnsRecord]
dnsRecords :: [DnsRecord]
  }
  deriving (DnsConfigChange -> DnsConfigChange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnsConfigChange -> DnsConfigChange -> Bool
$c/= :: DnsConfigChange -> DnsConfigChange -> Bool
== :: DnsConfigChange -> DnsConfigChange -> Bool
$c== :: DnsConfigChange -> DnsConfigChange -> Bool
Prelude.Eq, ReadPrec [DnsConfigChange]
ReadPrec DnsConfigChange
Int -> ReadS DnsConfigChange
ReadS [DnsConfigChange]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnsConfigChange]
$creadListPrec :: ReadPrec [DnsConfigChange]
readPrec :: ReadPrec DnsConfigChange
$creadPrec :: ReadPrec DnsConfigChange
readList :: ReadS [DnsConfigChange]
$creadList :: ReadS [DnsConfigChange]
readsPrec :: Int -> ReadS DnsConfigChange
$creadsPrec :: Int -> ReadS DnsConfigChange
Prelude.Read, Int -> DnsConfigChange -> ShowS
[DnsConfigChange] -> ShowS
DnsConfigChange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnsConfigChange] -> ShowS
$cshowList :: [DnsConfigChange] -> ShowS
show :: DnsConfigChange -> String
$cshow :: DnsConfigChange -> String
showsPrec :: Int -> DnsConfigChange -> ShowS
$cshowsPrec :: Int -> DnsConfigChange -> ShowS
Prelude.Show, forall x. Rep DnsConfigChange x -> DnsConfigChange
forall x. DnsConfigChange -> Rep DnsConfigChange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DnsConfigChange x -> DnsConfigChange
$cfrom :: forall x. DnsConfigChange -> Rep DnsConfigChange x
Prelude.Generic)

-- |
-- Create a value of 'DnsConfigChange' 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:
--
-- 'dnsRecords', 'dnsConfigChange_dnsRecords' - An array that contains one @DnsRecord@ object for each Route 53 record
-- that you want Cloud Map to create when you register an instance.
newDnsConfigChange ::
  DnsConfigChange
newDnsConfigChange :: DnsConfigChange
newDnsConfigChange =
  DnsConfigChange' {$sel:dnsRecords:DnsConfigChange' :: [DnsRecord]
dnsRecords = forall a. Monoid a => a
Prelude.mempty}

-- | An array that contains one @DnsRecord@ object for each Route 53 record
-- that you want Cloud Map to create when you register an instance.
dnsConfigChange_dnsRecords :: Lens.Lens' DnsConfigChange [DnsRecord]
dnsConfigChange_dnsRecords :: Lens' DnsConfigChange [DnsRecord]
dnsConfigChange_dnsRecords = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsConfigChange' {[DnsRecord]
dnsRecords :: [DnsRecord]
$sel:dnsRecords:DnsConfigChange' :: DnsConfigChange -> [DnsRecord]
dnsRecords} -> [DnsRecord]
dnsRecords) (\s :: DnsConfigChange
s@DnsConfigChange' {} [DnsRecord]
a -> DnsConfigChange
s {$sel:dnsRecords:DnsConfigChange' :: [DnsRecord]
dnsRecords = [DnsRecord]
a} :: DnsConfigChange) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable DnsConfigChange where
  hashWithSalt :: Int -> DnsConfigChange -> Int
hashWithSalt Int
_salt DnsConfigChange' {[DnsRecord]
dnsRecords :: [DnsRecord]
$sel:dnsRecords:DnsConfigChange' :: DnsConfigChange -> [DnsRecord]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [DnsRecord]
dnsRecords

instance Prelude.NFData DnsConfigChange where
  rnf :: DnsConfigChange -> ()
rnf DnsConfigChange' {[DnsRecord]
dnsRecords :: [DnsRecord]
$sel:dnsRecords:DnsConfigChange' :: DnsConfigChange -> [DnsRecord]
..} = forall a. NFData a => a -> ()
Prelude.rnf [DnsRecord]
dnsRecords

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