{-# 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.ElastiCache.Types.UserGroupsUpdateStatus
-- 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.ElastiCache.Types.UserGroupsUpdateStatus 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

-- | The status of the user group update.
--
-- /See:/ 'newUserGroupsUpdateStatus' smart constructor.
data UserGroupsUpdateStatus = UserGroupsUpdateStatus'
  { -- | The ID of the user group to add.
    UserGroupsUpdateStatus -> Maybe [Text]
userGroupIdsToAdd :: Prelude.Maybe [Prelude.Text],
    -- | The ID of the user group to remove.
    UserGroupsUpdateStatus -> Maybe [Text]
userGroupIdsToRemove :: Prelude.Maybe [Prelude.Text]
  }
  deriving (UserGroupsUpdateStatus -> UserGroupsUpdateStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserGroupsUpdateStatus -> UserGroupsUpdateStatus -> Bool
$c/= :: UserGroupsUpdateStatus -> UserGroupsUpdateStatus -> Bool
== :: UserGroupsUpdateStatus -> UserGroupsUpdateStatus -> Bool
$c== :: UserGroupsUpdateStatus -> UserGroupsUpdateStatus -> Bool
Prelude.Eq, ReadPrec [UserGroupsUpdateStatus]
ReadPrec UserGroupsUpdateStatus
Int -> ReadS UserGroupsUpdateStatus
ReadS [UserGroupsUpdateStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserGroupsUpdateStatus]
$creadListPrec :: ReadPrec [UserGroupsUpdateStatus]
readPrec :: ReadPrec UserGroupsUpdateStatus
$creadPrec :: ReadPrec UserGroupsUpdateStatus
readList :: ReadS [UserGroupsUpdateStatus]
$creadList :: ReadS [UserGroupsUpdateStatus]
readsPrec :: Int -> ReadS UserGroupsUpdateStatus
$creadsPrec :: Int -> ReadS UserGroupsUpdateStatus
Prelude.Read, Int -> UserGroupsUpdateStatus -> ShowS
[UserGroupsUpdateStatus] -> ShowS
UserGroupsUpdateStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserGroupsUpdateStatus] -> ShowS
$cshowList :: [UserGroupsUpdateStatus] -> ShowS
show :: UserGroupsUpdateStatus -> String
$cshow :: UserGroupsUpdateStatus -> String
showsPrec :: Int -> UserGroupsUpdateStatus -> ShowS
$cshowsPrec :: Int -> UserGroupsUpdateStatus -> ShowS
Prelude.Show, forall x. Rep UserGroupsUpdateStatus x -> UserGroupsUpdateStatus
forall x. UserGroupsUpdateStatus -> Rep UserGroupsUpdateStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserGroupsUpdateStatus x -> UserGroupsUpdateStatus
$cfrom :: forall x. UserGroupsUpdateStatus -> Rep UserGroupsUpdateStatus x
Prelude.Generic)

-- |
-- Create a value of 'UserGroupsUpdateStatus' 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:
--
-- 'userGroupIdsToAdd', 'userGroupsUpdateStatus_userGroupIdsToAdd' - The ID of the user group to add.
--
-- 'userGroupIdsToRemove', 'userGroupsUpdateStatus_userGroupIdsToRemove' - The ID of the user group to remove.
newUserGroupsUpdateStatus ::
  UserGroupsUpdateStatus
newUserGroupsUpdateStatus :: UserGroupsUpdateStatus
newUserGroupsUpdateStatus =
  UserGroupsUpdateStatus'
    { $sel:userGroupIdsToAdd:UserGroupsUpdateStatus' :: Maybe [Text]
userGroupIdsToAdd =
        forall a. Maybe a
Prelude.Nothing,
      $sel:userGroupIdsToRemove:UserGroupsUpdateStatus' :: Maybe [Text]
userGroupIdsToRemove = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the user group to add.
userGroupsUpdateStatus_userGroupIdsToAdd :: Lens.Lens' UserGroupsUpdateStatus (Prelude.Maybe [Prelude.Text])
userGroupsUpdateStatus_userGroupIdsToAdd :: Lens' UserGroupsUpdateStatus (Maybe [Text])
userGroupsUpdateStatus_userGroupIdsToAdd = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserGroupsUpdateStatus' {Maybe [Text]
userGroupIdsToAdd :: Maybe [Text]
$sel:userGroupIdsToAdd:UserGroupsUpdateStatus' :: UserGroupsUpdateStatus -> Maybe [Text]
userGroupIdsToAdd} -> Maybe [Text]
userGroupIdsToAdd) (\s :: UserGroupsUpdateStatus
s@UserGroupsUpdateStatus' {} Maybe [Text]
a -> UserGroupsUpdateStatus
s {$sel:userGroupIdsToAdd:UserGroupsUpdateStatus' :: Maybe [Text]
userGroupIdsToAdd = Maybe [Text]
a} :: UserGroupsUpdateStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the user group to remove.
userGroupsUpdateStatus_userGroupIdsToRemove :: Lens.Lens' UserGroupsUpdateStatus (Prelude.Maybe [Prelude.Text])
userGroupsUpdateStatus_userGroupIdsToRemove :: Lens' UserGroupsUpdateStatus (Maybe [Text])
userGroupsUpdateStatus_userGroupIdsToRemove = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserGroupsUpdateStatus' {Maybe [Text]
userGroupIdsToRemove :: Maybe [Text]
$sel:userGroupIdsToRemove:UserGroupsUpdateStatus' :: UserGroupsUpdateStatus -> Maybe [Text]
userGroupIdsToRemove} -> Maybe [Text]
userGroupIdsToRemove) (\s :: UserGroupsUpdateStatus
s@UserGroupsUpdateStatus' {} Maybe [Text]
a -> UserGroupsUpdateStatus
s {$sel:userGroupIdsToRemove:UserGroupsUpdateStatus' :: Maybe [Text]
userGroupIdsToRemove = Maybe [Text]
a} :: UserGroupsUpdateStatus) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromXML UserGroupsUpdateStatus where
  parseXML :: [Node] -> Either String UserGroupsUpdateStatus
parseXML [Node]
x =
    Maybe [Text] -> Maybe [Text] -> UserGroupsUpdateStatus
UserGroupsUpdateStatus'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"UserGroupIdsToAdd"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"UserGroupIdsToRemove"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )

instance Prelude.Hashable UserGroupsUpdateStatus where
  hashWithSalt :: Int -> UserGroupsUpdateStatus -> Int
hashWithSalt Int
_salt UserGroupsUpdateStatus' {Maybe [Text]
userGroupIdsToRemove :: Maybe [Text]
userGroupIdsToAdd :: Maybe [Text]
$sel:userGroupIdsToRemove:UserGroupsUpdateStatus' :: UserGroupsUpdateStatus -> Maybe [Text]
$sel:userGroupIdsToAdd:UserGroupsUpdateStatus' :: UserGroupsUpdateStatus -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
userGroupIdsToAdd
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
userGroupIdsToRemove

instance Prelude.NFData UserGroupsUpdateStatus where
  rnf :: UserGroupsUpdateStatus -> ()
rnf UserGroupsUpdateStatus' {Maybe [Text]
userGroupIdsToRemove :: Maybe [Text]
userGroupIdsToAdd :: Maybe [Text]
$sel:userGroupIdsToRemove:UserGroupsUpdateStatus' :: UserGroupsUpdateStatus -> Maybe [Text]
$sel:userGroupIdsToAdd:UserGroupsUpdateStatus' :: UserGroupsUpdateStatus -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
userGroupIdsToAdd
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
userGroupIdsToRemove