{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MQ.Types.UserPendingChanges where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
    UserPendingChanges -> Maybe Bool
consoleAccess :: Prelude.Maybe Prelude.Bool,
    -- | 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],
    -- | Required. The type of change pending for the ActiveMQ user.
    UserPendingChanges -> ChangeType
pendingChange :: ChangeType
  }
  deriving (UserPendingChanges -> UserPendingChanges -> Bool
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]
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
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. 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:
--
-- 'consoleAccess', 'userPendingChanges_consoleAccess' - Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
--
-- '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.
--
-- 'pendingChange', 'userPendingChanges_pendingChange' - Required. The type of change pending for the ActiveMQ user.
newUserPendingChanges ::
  -- | 'pendingChange'
  ChangeType ->
  UserPendingChanges
newUserPendingChanges :: ChangeType -> UserPendingChanges
newUserPendingChanges ChangeType
pPendingChange_ =
  UserPendingChanges'
    { $sel:consoleAccess:UserPendingChanges' :: Maybe Bool
consoleAccess =
        forall a. Maybe a
Prelude.Nothing,
      $sel:groups:UserPendingChanges' :: Maybe [Text]
groups = forall a. Maybe a
Prelude.Nothing,
      $sel:pendingChange:UserPendingChanges' :: ChangeType
pendingChange = ChangeType
pPendingChange_
    }

-- | Enables access to the the ActiveMQ Web Console for the ActiveMQ user.
userPendingChanges_consoleAccess :: Lens.Lens' UserPendingChanges (Prelude.Maybe Prelude.Bool)
userPendingChanges_consoleAccess :: Lens' UserPendingChanges (Maybe Bool)
userPendingChanges_consoleAccess = 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)

-- | 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 :: Lens' UserPendingChanges (Maybe [Text])
userPendingChanges_groups = 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) 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

-- | Required. The type of change pending for the ActiveMQ user.
userPendingChanges_pendingChange :: Lens.Lens' UserPendingChanges ChangeType
userPendingChanges_pendingChange :: Lens' UserPendingChanges ChangeType
userPendingChanges_pendingChange = 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 Data.FromJSON UserPendingChanges where
  parseJSON :: Value -> Parser UserPendingChanges
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UserPendingChanges"
      ( \Object
x ->
          Maybe Bool -> Maybe [Text] -> ChangeType -> UserPendingChanges
UserPendingChanges'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"consoleAccess")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"groups" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"pendingChange")
      )

instance Prelude.Hashable UserPendingChanges where
  hashWithSalt :: Int -> UserPendingChanges -> Int
hashWithSalt Int
_salt UserPendingChanges' {Maybe Bool
Maybe [Text]
ChangeType
pendingChange :: ChangeType
groups :: Maybe [Text]
consoleAccess :: Maybe Bool
$sel:pendingChange:UserPendingChanges' :: UserPendingChanges -> ChangeType
$sel:groups:UserPendingChanges' :: UserPendingChanges -> Maybe [Text]
$sel:consoleAccess:UserPendingChanges' :: UserPendingChanges -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
consoleAccess
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
groups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ChangeType
pendingChange

instance Prelude.NFData UserPendingChanges where
  rnf :: UserPendingChanges -> ()
rnf UserPendingChanges' {Maybe Bool
Maybe [Text]
ChangeType
pendingChange :: ChangeType
groups :: Maybe [Text]
consoleAccess :: Maybe Bool
$sel:pendingChange:UserPendingChanges' :: UserPendingChanges -> ChangeType
$sel:groups:UserPendingChanges' :: UserPendingChanges -> Maybe [Text]
$sel:consoleAccess:UserPendingChanges' :: UserPendingChanges -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
consoleAccess
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
groups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ChangeType
pendingChange