{-# 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.MQ.Types.UserPendingChanges
-- 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.MQ.Types.UserPendingChanges where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types.ChangeType
import qualified Amazonka.Prelude as Prelude

-- | Returns information about the status of the changes pending for the
-- ActiveMQ user.
--
-- /See:/ 'newUserPendingChanges' smart constructor.
data UserPendingChanges = UserPendingChanges'
  { -- | The list of groups (20 maximum) to which the ActiveMQ user belongs. This
    -- value can contain only alphanumeric characters, dashes, periods,
    -- underscores, and tildes (- . _ ~). This value must be 2-100 characters
    -- long.
    UserPendingChanges -> Maybe [Text]
groups :: Prelude.Maybe [Prelude.Text],
    -- | Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
    UserPendingChanges -> Maybe Bool
consoleAccess :: Prelude.Maybe Prelude.Bool,
    -- | Required. The type of change pending for the ActiveMQ user.
    UserPendingChanges -> ChangeType
pendingChange :: ChangeType
  }
  deriving (UserPendingChanges -> UserPendingChanges -> Bool
(UserPendingChanges -> UserPendingChanges -> Bool)
-> (UserPendingChanges -> UserPendingChanges -> Bool)
-> Eq UserPendingChanges
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserPendingChanges -> UserPendingChanges -> Bool
$c/= :: UserPendingChanges -> UserPendingChanges -> Bool
== :: UserPendingChanges -> UserPendingChanges -> Bool
$c== :: UserPendingChanges -> UserPendingChanges -> Bool
Prelude.Eq, ReadPrec [UserPendingChanges]
ReadPrec UserPendingChanges
Int -> ReadS UserPendingChanges
ReadS [UserPendingChanges]
(Int -> ReadS UserPendingChanges)
-> ReadS [UserPendingChanges]
-> ReadPrec UserPendingChanges
-> ReadPrec [UserPendingChanges]
-> Read UserPendingChanges
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserPendingChanges]
$creadListPrec :: ReadPrec [UserPendingChanges]
readPrec :: ReadPrec UserPendingChanges
$creadPrec :: ReadPrec UserPendingChanges
readList :: ReadS [UserPendingChanges]
$creadList :: ReadS [UserPendingChanges]
readsPrec :: Int -> ReadS UserPendingChanges
$creadsPrec :: Int -> ReadS UserPendingChanges
Prelude.Read, Int -> UserPendingChanges -> ShowS
[UserPendingChanges] -> ShowS
UserPendingChanges -> String
(Int -> UserPendingChanges -> ShowS)
-> (UserPendingChanges -> String)
-> ([UserPendingChanges] -> ShowS)
-> Show UserPendingChanges
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserPendingChanges] -> ShowS
$cshowList :: [UserPendingChanges] -> ShowS
show :: UserPendingChanges -> String
$cshow :: UserPendingChanges -> String
showsPrec :: Int -> UserPendingChanges -> ShowS
$cshowsPrec :: Int -> UserPendingChanges -> ShowS
Prelude.Show, (forall x. UserPendingChanges -> Rep UserPendingChanges x)
-> (forall x. Rep UserPendingChanges x -> UserPendingChanges)
-> Generic UserPendingChanges
forall x. Rep UserPendingChanges x -> UserPendingChanges
forall x. UserPendingChanges -> Rep UserPendingChanges x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserPendingChanges x -> UserPendingChanges
$cfrom :: forall x. UserPendingChanges -> Rep UserPendingChanges x
Prelude.Generic)

-- |
-- Create a value of 'UserPendingChanges' 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:
--
-- 'groups', 'userPendingChanges_groups' - The list of groups (20 maximum) to which the ActiveMQ user belongs. This
-- value can contain only alphanumeric characters, dashes, periods,
-- underscores, and tildes (- . _ ~). This value must be 2-100 characters
-- long.
--
-- 'consoleAccess', 'userPendingChanges_consoleAccess' - Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
--
-- 'pendingChange', 'userPendingChanges_pendingChange' - Required. The type of change pending for the ActiveMQ user.
newUserPendingChanges ::
  -- | 'pendingChange'
  ChangeType ->
  UserPendingChanges
newUserPendingChanges :: ChangeType -> UserPendingChanges
newUserPendingChanges ChangeType
pPendingChange_ =
  UserPendingChanges' :: Maybe [Text] -> Maybe Bool -> ChangeType -> UserPendingChanges
UserPendingChanges'
    { $sel:groups:UserPendingChanges' :: Maybe [Text]
groups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:consoleAccess:UserPendingChanges' :: Maybe Bool
consoleAccess = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:pendingChange:UserPendingChanges' :: ChangeType
pendingChange = ChangeType
pPendingChange_
    }

-- | The list of groups (20 maximum) to which the ActiveMQ user belongs. This
-- value can contain only alphanumeric characters, dashes, periods,
-- underscores, and tildes (- . _ ~). This value must be 2-100 characters
-- long.
userPendingChanges_groups :: Lens.Lens' UserPendingChanges (Prelude.Maybe [Prelude.Text])
userPendingChanges_groups :: (Maybe [Text] -> f (Maybe [Text]))
-> UserPendingChanges -> f UserPendingChanges
userPendingChanges_groups = (UserPendingChanges -> Maybe [Text])
-> (UserPendingChanges -> Maybe [Text] -> UserPendingChanges)
-> Lens
     UserPendingChanges UserPendingChanges (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPendingChanges' {Maybe [Text]
groups :: Maybe [Text]
$sel:groups:UserPendingChanges' :: UserPendingChanges -> Maybe [Text]
groups} -> Maybe [Text]
groups) (\s :: UserPendingChanges
s@UserPendingChanges' {} Maybe [Text]
a -> UserPendingChanges
s {$sel:groups:UserPendingChanges' :: Maybe [Text]
groups = Maybe [Text]
a} :: UserPendingChanges) ((Maybe [Text] -> f (Maybe [Text]))
 -> UserPendingChanges -> f UserPendingChanges)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UserPendingChanges
-> f UserPendingChanges
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

-- | Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
userPendingChanges_consoleAccess :: Lens.Lens' UserPendingChanges (Prelude.Maybe Prelude.Bool)
userPendingChanges_consoleAccess :: (Maybe Bool -> f (Maybe Bool))
-> UserPendingChanges -> f UserPendingChanges
userPendingChanges_consoleAccess = (UserPendingChanges -> Maybe Bool)
-> (UserPendingChanges -> Maybe Bool -> UserPendingChanges)
-> Lens
     UserPendingChanges UserPendingChanges (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPendingChanges' {Maybe Bool
consoleAccess :: Maybe Bool
$sel:consoleAccess:UserPendingChanges' :: UserPendingChanges -> Maybe Bool
consoleAccess} -> Maybe Bool
consoleAccess) (\s :: UserPendingChanges
s@UserPendingChanges' {} Maybe Bool
a -> UserPendingChanges
s {$sel:consoleAccess:UserPendingChanges' :: Maybe Bool
consoleAccess = Maybe Bool
a} :: UserPendingChanges)

-- | Required. The type of change pending for the ActiveMQ user.
userPendingChanges_pendingChange :: Lens.Lens' UserPendingChanges ChangeType
userPendingChanges_pendingChange :: (ChangeType -> f ChangeType)
-> UserPendingChanges -> f UserPendingChanges
userPendingChanges_pendingChange = (UserPendingChanges -> ChangeType)
-> (UserPendingChanges -> ChangeType -> UserPendingChanges)
-> Lens UserPendingChanges UserPendingChanges ChangeType ChangeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPendingChanges' {ChangeType
pendingChange :: ChangeType
$sel:pendingChange:UserPendingChanges' :: UserPendingChanges -> ChangeType
pendingChange} -> ChangeType
pendingChange) (\s :: UserPendingChanges
s@UserPendingChanges' {} ChangeType
a -> UserPendingChanges
s {$sel:pendingChange:UserPendingChanges' :: ChangeType
pendingChange = ChangeType
a} :: UserPendingChanges)

instance Core.FromJSON UserPendingChanges where
  parseJSON :: Value -> Parser UserPendingChanges
parseJSON =
    String
-> (Object -> Parser UserPendingChanges)
-> Value
-> Parser UserPendingChanges
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserPendingChanges"
      ( \Object
x ->
          Maybe [Text] -> Maybe Bool -> ChangeType -> UserPendingChanges
UserPendingChanges'
            (Maybe [Text] -> Maybe Bool -> ChangeType -> UserPendingChanges)
-> Parser (Maybe [Text])
-> Parser (Maybe Bool -> ChangeType -> UserPendingChanges)
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
"groups" 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 Bool -> ChangeType -> UserPendingChanges)
-> Parser (Maybe Bool) -> Parser (ChangeType -> UserPendingChanges)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"consoleAccess")
            Parser (ChangeType -> UserPendingChanges)
-> Parser ChangeType -> Parser UserPendingChanges
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ChangeType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"pendingChange")
      )

instance Prelude.Hashable UserPendingChanges

instance Prelude.NFData UserPendingChanges