{-# 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.MemoryDb.Types.ACLPendingChanges
-- 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.MemoryDb.Types.ACLPendingChanges where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns the updates being applied to the ACL.
--
-- /See:/ 'newACLPendingChanges' smart constructor.
data ACLPendingChanges = ACLPendingChanges'
  { -- | A list of users being added to the ACL
    ACLPendingChanges -> Maybe [Text]
userNamesToAdd :: Prelude.Maybe [Prelude.Text],
    -- | A list of user names being removed from the ACL
    ACLPendingChanges -> Maybe [Text]
userNamesToRemove :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ACLPendingChanges -> ACLPendingChanges -> Bool
(ACLPendingChanges -> ACLPendingChanges -> Bool)
-> (ACLPendingChanges -> ACLPendingChanges -> Bool)
-> Eq ACLPendingChanges
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ACLPendingChanges -> ACLPendingChanges -> Bool
$c/= :: ACLPendingChanges -> ACLPendingChanges -> Bool
== :: ACLPendingChanges -> ACLPendingChanges -> Bool
$c== :: ACLPendingChanges -> ACLPendingChanges -> Bool
Prelude.Eq, ReadPrec [ACLPendingChanges]
ReadPrec ACLPendingChanges
Int -> ReadS ACLPendingChanges
ReadS [ACLPendingChanges]
(Int -> ReadS ACLPendingChanges)
-> ReadS [ACLPendingChanges]
-> ReadPrec ACLPendingChanges
-> ReadPrec [ACLPendingChanges]
-> Read ACLPendingChanges
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ACLPendingChanges]
$creadListPrec :: ReadPrec [ACLPendingChanges]
readPrec :: ReadPrec ACLPendingChanges
$creadPrec :: ReadPrec ACLPendingChanges
readList :: ReadS [ACLPendingChanges]
$creadList :: ReadS [ACLPendingChanges]
readsPrec :: Int -> ReadS ACLPendingChanges
$creadsPrec :: Int -> ReadS ACLPendingChanges
Prelude.Read, Int -> ACLPendingChanges -> ShowS
[ACLPendingChanges] -> ShowS
ACLPendingChanges -> String
(Int -> ACLPendingChanges -> ShowS)
-> (ACLPendingChanges -> String)
-> ([ACLPendingChanges] -> ShowS)
-> Show ACLPendingChanges
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ACLPendingChanges] -> ShowS
$cshowList :: [ACLPendingChanges] -> ShowS
show :: ACLPendingChanges -> String
$cshow :: ACLPendingChanges -> String
showsPrec :: Int -> ACLPendingChanges -> ShowS
$cshowsPrec :: Int -> ACLPendingChanges -> ShowS
Prelude.Show, (forall x. ACLPendingChanges -> Rep ACLPendingChanges x)
-> (forall x. Rep ACLPendingChanges x -> ACLPendingChanges)
-> Generic ACLPendingChanges
forall x. Rep ACLPendingChanges x -> ACLPendingChanges
forall x. ACLPendingChanges -> Rep ACLPendingChanges x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ACLPendingChanges x -> ACLPendingChanges
$cfrom :: forall x. ACLPendingChanges -> Rep ACLPendingChanges x
Prelude.Generic)

-- |
-- Create a value of 'ACLPendingChanges' 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:
--
-- 'userNamesToAdd', 'aCLPendingChanges_userNamesToAdd' - A list of users being added to the ACL
--
-- 'userNamesToRemove', 'aCLPendingChanges_userNamesToRemove' - A list of user names being removed from the ACL
newACLPendingChanges ::
  ACLPendingChanges
newACLPendingChanges :: ACLPendingChanges
newACLPendingChanges =
  ACLPendingChanges' :: Maybe [Text] -> Maybe [Text] -> ACLPendingChanges
ACLPendingChanges'
    { $sel:userNamesToAdd:ACLPendingChanges' :: Maybe [Text]
userNamesToAdd =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:userNamesToRemove:ACLPendingChanges' :: Maybe [Text]
userNamesToRemove = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of users being added to the ACL
aCLPendingChanges_userNamesToAdd :: Lens.Lens' ACLPendingChanges (Prelude.Maybe [Prelude.Text])
aCLPendingChanges_userNamesToAdd :: (Maybe [Text] -> f (Maybe [Text]))
-> ACLPendingChanges -> f ACLPendingChanges
aCLPendingChanges_userNamesToAdd = (ACLPendingChanges -> Maybe [Text])
-> (ACLPendingChanges -> Maybe [Text] -> ACLPendingChanges)
-> Lens
     ACLPendingChanges ACLPendingChanges (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACLPendingChanges' {Maybe [Text]
userNamesToAdd :: Maybe [Text]
$sel:userNamesToAdd:ACLPendingChanges' :: ACLPendingChanges -> Maybe [Text]
userNamesToAdd} -> Maybe [Text]
userNamesToAdd) (\s :: ACLPendingChanges
s@ACLPendingChanges' {} Maybe [Text]
a -> ACLPendingChanges
s {$sel:userNamesToAdd:ACLPendingChanges' :: Maybe [Text]
userNamesToAdd = Maybe [Text]
a} :: ACLPendingChanges) ((Maybe [Text] -> f (Maybe [Text]))
 -> ACLPendingChanges -> f ACLPendingChanges)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ACLPendingChanges
-> f ACLPendingChanges
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of user names being removed from the ACL
aCLPendingChanges_userNamesToRemove :: Lens.Lens' ACLPendingChanges (Prelude.Maybe [Prelude.Text])
aCLPendingChanges_userNamesToRemove :: (Maybe [Text] -> f (Maybe [Text]))
-> ACLPendingChanges -> f ACLPendingChanges
aCLPendingChanges_userNamesToRemove = (ACLPendingChanges -> Maybe [Text])
-> (ACLPendingChanges -> Maybe [Text] -> ACLPendingChanges)
-> Lens
     ACLPendingChanges ACLPendingChanges (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACLPendingChanges' {Maybe [Text]
userNamesToRemove :: Maybe [Text]
$sel:userNamesToRemove:ACLPendingChanges' :: ACLPendingChanges -> Maybe [Text]
userNamesToRemove} -> Maybe [Text]
userNamesToRemove) (\s :: ACLPendingChanges
s@ACLPendingChanges' {} Maybe [Text]
a -> ACLPendingChanges
s {$sel:userNamesToRemove:ACLPendingChanges' :: Maybe [Text]
userNamesToRemove = Maybe [Text]
a} :: ACLPendingChanges) ((Maybe [Text] -> f (Maybe [Text]))
 -> ACLPendingChanges -> f ACLPendingChanges)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ACLPendingChanges
-> f ACLPendingChanges
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ACLPendingChanges where
  parseJSON :: Value -> Parser ACLPendingChanges
parseJSON =
    String
-> (Object -> Parser ACLPendingChanges)
-> Value
-> Parser ACLPendingChanges
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ACLPendingChanges"
      ( \Object
x ->
          Maybe [Text] -> Maybe [Text] -> ACLPendingChanges
ACLPendingChanges'
            (Maybe [Text] -> Maybe [Text] -> ACLPendingChanges)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> ACLPendingChanges)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserNamesToAdd" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Text] -> ACLPendingChanges)
-> Parser (Maybe [Text]) -> Parser ACLPendingChanges
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserNamesToRemove"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ACLPendingChanges

instance Prelude.NFData ACLPendingChanges