{-# 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.SSMIncidents.Types.UpdateReplicationSetAction
-- 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.SSMIncidents.Types.UpdateReplicationSetAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.Types.AddRegionAction
import Amazonka.SSMIncidents.Types.DeleteRegionAction

-- | Details used when updating the replication set.
--
-- /See:/ 'newUpdateReplicationSetAction' smart constructor.
data UpdateReplicationSetAction = UpdateReplicationSetAction'
  { -- | Details about the Region that you\'re adding to the replication set.
    UpdateReplicationSetAction -> Maybe AddRegionAction
addRegionAction :: Prelude.Maybe AddRegionAction,
    -- | Details about the Region that you\'re deleting to the replication set.
    UpdateReplicationSetAction -> Maybe DeleteRegionAction
deleteRegionAction :: Prelude.Maybe DeleteRegionAction
  }
  deriving (UpdateReplicationSetAction -> UpdateReplicationSetAction -> Bool
(UpdateReplicationSetAction -> UpdateReplicationSetAction -> Bool)
-> (UpdateReplicationSetAction
    -> UpdateReplicationSetAction -> Bool)
-> Eq UpdateReplicationSetAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateReplicationSetAction -> UpdateReplicationSetAction -> Bool
$c/= :: UpdateReplicationSetAction -> UpdateReplicationSetAction -> Bool
== :: UpdateReplicationSetAction -> UpdateReplicationSetAction -> Bool
$c== :: UpdateReplicationSetAction -> UpdateReplicationSetAction -> Bool
Prelude.Eq, ReadPrec [UpdateReplicationSetAction]
ReadPrec UpdateReplicationSetAction
Int -> ReadS UpdateReplicationSetAction
ReadS [UpdateReplicationSetAction]
(Int -> ReadS UpdateReplicationSetAction)
-> ReadS [UpdateReplicationSetAction]
-> ReadPrec UpdateReplicationSetAction
-> ReadPrec [UpdateReplicationSetAction]
-> Read UpdateReplicationSetAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateReplicationSetAction]
$creadListPrec :: ReadPrec [UpdateReplicationSetAction]
readPrec :: ReadPrec UpdateReplicationSetAction
$creadPrec :: ReadPrec UpdateReplicationSetAction
readList :: ReadS [UpdateReplicationSetAction]
$creadList :: ReadS [UpdateReplicationSetAction]
readsPrec :: Int -> ReadS UpdateReplicationSetAction
$creadsPrec :: Int -> ReadS UpdateReplicationSetAction
Prelude.Read, Int -> UpdateReplicationSetAction -> ShowS
[UpdateReplicationSetAction] -> ShowS
UpdateReplicationSetAction -> String
(Int -> UpdateReplicationSetAction -> ShowS)
-> (UpdateReplicationSetAction -> String)
-> ([UpdateReplicationSetAction] -> ShowS)
-> Show UpdateReplicationSetAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateReplicationSetAction] -> ShowS
$cshowList :: [UpdateReplicationSetAction] -> ShowS
show :: UpdateReplicationSetAction -> String
$cshow :: UpdateReplicationSetAction -> String
showsPrec :: Int -> UpdateReplicationSetAction -> ShowS
$cshowsPrec :: Int -> UpdateReplicationSetAction -> ShowS
Prelude.Show, (forall x.
 UpdateReplicationSetAction -> Rep UpdateReplicationSetAction x)
-> (forall x.
    Rep UpdateReplicationSetAction x -> UpdateReplicationSetAction)
-> Generic UpdateReplicationSetAction
forall x.
Rep UpdateReplicationSetAction x -> UpdateReplicationSetAction
forall x.
UpdateReplicationSetAction -> Rep UpdateReplicationSetAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateReplicationSetAction x -> UpdateReplicationSetAction
$cfrom :: forall x.
UpdateReplicationSetAction -> Rep UpdateReplicationSetAction x
Prelude.Generic)

-- |
-- Create a value of 'UpdateReplicationSetAction' 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:
--
-- 'addRegionAction', 'updateReplicationSetAction_addRegionAction' - Details about the Region that you\'re adding to the replication set.
--
-- 'deleteRegionAction', 'updateReplicationSetAction_deleteRegionAction' - Details about the Region that you\'re deleting to the replication set.
newUpdateReplicationSetAction ::
  UpdateReplicationSetAction
newUpdateReplicationSetAction :: UpdateReplicationSetAction
newUpdateReplicationSetAction =
  UpdateReplicationSetAction' :: Maybe AddRegionAction
-> Maybe DeleteRegionAction -> UpdateReplicationSetAction
UpdateReplicationSetAction'
    { $sel:addRegionAction:UpdateReplicationSetAction' :: Maybe AddRegionAction
addRegionAction =
        Maybe AddRegionAction
forall a. Maybe a
Prelude.Nothing,
      $sel:deleteRegionAction:UpdateReplicationSetAction' :: Maybe DeleteRegionAction
deleteRegionAction = Maybe DeleteRegionAction
forall a. Maybe a
Prelude.Nothing
    }

-- | Details about the Region that you\'re adding to the replication set.
updateReplicationSetAction_addRegionAction :: Lens.Lens' UpdateReplicationSetAction (Prelude.Maybe AddRegionAction)
updateReplicationSetAction_addRegionAction :: (Maybe AddRegionAction -> f (Maybe AddRegionAction))
-> UpdateReplicationSetAction -> f UpdateReplicationSetAction
updateReplicationSetAction_addRegionAction = (UpdateReplicationSetAction -> Maybe AddRegionAction)
-> (UpdateReplicationSetAction
    -> Maybe AddRegionAction -> UpdateReplicationSetAction)
-> Lens
     UpdateReplicationSetAction
     UpdateReplicationSetAction
     (Maybe AddRegionAction)
     (Maybe AddRegionAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateReplicationSetAction' {Maybe AddRegionAction
addRegionAction :: Maybe AddRegionAction
$sel:addRegionAction:UpdateReplicationSetAction' :: UpdateReplicationSetAction -> Maybe AddRegionAction
addRegionAction} -> Maybe AddRegionAction
addRegionAction) (\s :: UpdateReplicationSetAction
s@UpdateReplicationSetAction' {} Maybe AddRegionAction
a -> UpdateReplicationSetAction
s {$sel:addRegionAction:UpdateReplicationSetAction' :: Maybe AddRegionAction
addRegionAction = Maybe AddRegionAction
a} :: UpdateReplicationSetAction)

-- | Details about the Region that you\'re deleting to the replication set.
updateReplicationSetAction_deleteRegionAction :: Lens.Lens' UpdateReplicationSetAction (Prelude.Maybe DeleteRegionAction)
updateReplicationSetAction_deleteRegionAction :: (Maybe DeleteRegionAction -> f (Maybe DeleteRegionAction))
-> UpdateReplicationSetAction -> f UpdateReplicationSetAction
updateReplicationSetAction_deleteRegionAction = (UpdateReplicationSetAction -> Maybe DeleteRegionAction)
-> (UpdateReplicationSetAction
    -> Maybe DeleteRegionAction -> UpdateReplicationSetAction)
-> Lens
     UpdateReplicationSetAction
     UpdateReplicationSetAction
     (Maybe DeleteRegionAction)
     (Maybe DeleteRegionAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateReplicationSetAction' {Maybe DeleteRegionAction
deleteRegionAction :: Maybe DeleteRegionAction
$sel:deleteRegionAction:UpdateReplicationSetAction' :: UpdateReplicationSetAction -> Maybe DeleteRegionAction
deleteRegionAction} -> Maybe DeleteRegionAction
deleteRegionAction) (\s :: UpdateReplicationSetAction
s@UpdateReplicationSetAction' {} Maybe DeleteRegionAction
a -> UpdateReplicationSetAction
s {$sel:deleteRegionAction:UpdateReplicationSetAction' :: Maybe DeleteRegionAction
deleteRegionAction = Maybe DeleteRegionAction
a} :: UpdateReplicationSetAction)

instance Prelude.Hashable UpdateReplicationSetAction

instance Prelude.NFData UpdateReplicationSetAction

instance Core.ToJSON UpdateReplicationSetAction where
  toJSON :: UpdateReplicationSetAction -> Value
toJSON UpdateReplicationSetAction' {Maybe AddRegionAction
Maybe DeleteRegionAction
deleteRegionAction :: Maybe DeleteRegionAction
addRegionAction :: Maybe AddRegionAction
$sel:deleteRegionAction:UpdateReplicationSetAction' :: UpdateReplicationSetAction -> Maybe DeleteRegionAction
$sel:addRegionAction:UpdateReplicationSetAction' :: UpdateReplicationSetAction -> Maybe AddRegionAction
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"addRegionAction" Text -> AddRegionAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AddRegionAction -> Pair) -> Maybe AddRegionAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AddRegionAction
addRegionAction,
            (Text
"deleteRegionAction" Text -> DeleteRegionAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DeleteRegionAction -> Pair)
-> Maybe DeleteRegionAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeleteRegionAction
deleteRegionAction
          ]
      )