{-# 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.ChangeBatch
-- 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.Route53.Types.ChangeBatch 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.Route53.Internal
import Amazonka.Route53.Types.Change

-- | The information for a change request.
--
-- /See:/ 'newChangeBatch' smart constructor.
data ChangeBatch = ChangeBatch'
  { -- | /Optional:/ Any comments you want to include about a change batch
    -- request.
    ChangeBatch -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | Information about the changes to make to the record sets.
    ChangeBatch -> NonEmpty Change
changes :: Prelude.NonEmpty Change
  }
  deriving (ChangeBatch -> ChangeBatch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeBatch -> ChangeBatch -> Bool
$c/= :: ChangeBatch -> ChangeBatch -> Bool
== :: ChangeBatch -> ChangeBatch -> Bool
$c== :: ChangeBatch -> ChangeBatch -> Bool
Prelude.Eq, ReadPrec [ChangeBatch]
ReadPrec ChangeBatch
Int -> ReadS ChangeBatch
ReadS [ChangeBatch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChangeBatch]
$creadListPrec :: ReadPrec [ChangeBatch]
readPrec :: ReadPrec ChangeBatch
$creadPrec :: ReadPrec ChangeBatch
readList :: ReadS [ChangeBatch]
$creadList :: ReadS [ChangeBatch]
readsPrec :: Int -> ReadS ChangeBatch
$creadsPrec :: Int -> ReadS ChangeBatch
Prelude.Read, Int -> ChangeBatch -> ShowS
[ChangeBatch] -> ShowS
ChangeBatch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeBatch] -> ShowS
$cshowList :: [ChangeBatch] -> ShowS
show :: ChangeBatch -> String
$cshow :: ChangeBatch -> String
showsPrec :: Int -> ChangeBatch -> ShowS
$cshowsPrec :: Int -> ChangeBatch -> ShowS
Prelude.Show, forall x. Rep ChangeBatch x -> ChangeBatch
forall x. ChangeBatch -> Rep ChangeBatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChangeBatch x -> ChangeBatch
$cfrom :: forall x. ChangeBatch -> Rep ChangeBatch x
Prelude.Generic)

-- |
-- Create a value of 'ChangeBatch' 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:
--
-- 'comment', 'changeBatch_comment' - /Optional:/ Any comments you want to include about a change batch
-- request.
--
-- 'changes', 'changeBatch_changes' - Information about the changes to make to the record sets.
newChangeBatch ::
  -- | 'changes'
  Prelude.NonEmpty Change ->
  ChangeBatch
newChangeBatch :: NonEmpty Change -> ChangeBatch
newChangeBatch NonEmpty Change
pChanges_ =
  ChangeBatch'
    { $sel:comment:ChangeBatch' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
      $sel:changes:ChangeBatch' :: NonEmpty Change
changes = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Change
pChanges_
    }

-- | /Optional:/ Any comments you want to include about a change batch
-- request.
changeBatch_comment :: Lens.Lens' ChangeBatch (Prelude.Maybe Prelude.Text)
changeBatch_comment :: Lens' ChangeBatch (Maybe Text)
changeBatch_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeBatch' {Maybe Text
comment :: Maybe Text
$sel:comment:ChangeBatch' :: ChangeBatch -> Maybe Text
comment} -> Maybe Text
comment) (\s :: ChangeBatch
s@ChangeBatch' {} Maybe Text
a -> ChangeBatch
s {$sel:comment:ChangeBatch' :: Maybe Text
comment = Maybe Text
a} :: ChangeBatch)

-- | Information about the changes to make to the record sets.
changeBatch_changes :: Lens.Lens' ChangeBatch (Prelude.NonEmpty Change)
changeBatch_changes :: Lens' ChangeBatch (NonEmpty Change)
changeBatch_changes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeBatch' {NonEmpty Change
changes :: NonEmpty Change
$sel:changes:ChangeBatch' :: ChangeBatch -> NonEmpty Change
changes} -> NonEmpty Change
changes) (\s :: ChangeBatch
s@ChangeBatch' {} NonEmpty Change
a -> ChangeBatch
s {$sel:changes:ChangeBatch' :: NonEmpty Change
changes = NonEmpty Change
a} :: ChangeBatch) 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 ChangeBatch where
  hashWithSalt :: Int -> ChangeBatch -> Int
hashWithSalt Int
_salt ChangeBatch' {Maybe Text
NonEmpty Change
changes :: NonEmpty Change
comment :: Maybe Text
$sel:changes:ChangeBatch' :: ChangeBatch -> NonEmpty Change
$sel:comment:ChangeBatch' :: ChangeBatch -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Change
changes

instance Prelude.NFData ChangeBatch where
  rnf :: ChangeBatch -> ()
rnf ChangeBatch' {Maybe Text
NonEmpty Change
changes :: NonEmpty Change
comment :: Maybe Text
$sel:changes:ChangeBatch' :: ChangeBatch -> NonEmpty Change
$sel:comment:ChangeBatch' :: ChangeBatch -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Change
changes

instance Data.ToXML ChangeBatch where
  toXML :: ChangeBatch -> XML
toXML ChangeBatch' {Maybe Text
NonEmpty Change
changes :: NonEmpty Change
comment :: Maybe Text
$sel:changes:ChangeBatch' :: ChangeBatch -> NonEmpty Change
$sel:comment:ChangeBatch' :: ChangeBatch -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"Comment" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
comment,
        Name
"Changes" forall a. ToXML a => Name -> a -> XML
Data.@= forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Data.toXMLList Name
"Change" NonEmpty Change
changes
      ]