{-# 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 #-}
module Amazonka.MQ.Types.User where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data User = User'
{
User -> Maybe [Text]
groups :: Prelude.Maybe [Prelude.Text],
User -> Maybe Bool
consoleAccess :: Prelude.Maybe Prelude.Bool,
User -> Text
username :: Prelude.Text,
User -> Text
password :: Prelude.Text
}
deriving (User -> User -> Bool
(User -> User -> Bool) -> (User -> User -> Bool) -> Eq User
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: User -> User -> Bool
$c/= :: User -> User -> Bool
== :: User -> User -> Bool
$c== :: User -> User -> Bool
Prelude.Eq, ReadPrec [User]
ReadPrec User
Int -> ReadS User
ReadS [User]
(Int -> ReadS User)
-> ReadS [User] -> ReadPrec User -> ReadPrec [User] -> Read User
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [User]
$creadListPrec :: ReadPrec [User]
readPrec :: ReadPrec User
$creadPrec :: ReadPrec User
readList :: ReadS [User]
$creadList :: ReadS [User]
readsPrec :: Int -> ReadS User
$creadsPrec :: Int -> ReadS User
Prelude.Read, Int -> User -> ShowS
[User] -> ShowS
User -> String
(Int -> User -> ShowS)
-> (User -> String) -> ([User] -> ShowS) -> Show User
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [User] -> ShowS
$cshowList :: [User] -> ShowS
show :: User -> String
$cshow :: User -> String
showsPrec :: Int -> User -> ShowS
$cshowsPrec :: Int -> User -> ShowS
Prelude.Show, (forall x. User -> Rep User x)
-> (forall x. Rep User x -> User) -> Generic User
forall x. Rep User x -> User
forall x. User -> Rep User x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep User x -> User
$cfrom :: forall x. User -> Rep User x
Prelude.Generic)
newUser ::
Prelude.Text ->
Prelude.Text ->
User
newUser :: Text -> Text -> User
newUser Text
pUsername_ Text
pPassword_ =
User' :: Maybe [Text] -> Maybe Bool -> Text -> Text -> User
User'
{ $sel:groups:User' :: Maybe [Text]
groups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:consoleAccess:User' :: Maybe Bool
consoleAccess = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:username:User' :: Text
username = Text
pUsername_,
$sel:password:User' :: Text
password = Text
pPassword_
}
user_groups :: Lens.Lens' User (Prelude.Maybe [Prelude.Text])
user_groups :: (Maybe [Text] -> f (Maybe [Text])) -> User -> f User
user_groups = (User -> Maybe [Text])
-> (User -> Maybe [Text] -> User)
-> Lens User User (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe [Text]
groups :: Maybe [Text]
$sel:groups:User' :: User -> Maybe [Text]
groups} -> Maybe [Text]
groups) (\s :: User
s@User' {} Maybe [Text]
a -> User
s {$sel:groups:User' :: Maybe [Text]
groups = Maybe [Text]
a} :: User) ((Maybe [Text] -> f (Maybe [Text])) -> User -> f User)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> User
-> f User
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
user_consoleAccess :: Lens.Lens' User (Prelude.Maybe Prelude.Bool)
user_consoleAccess :: (Maybe Bool -> f (Maybe Bool)) -> User -> f User
user_consoleAccess = (User -> Maybe Bool)
-> (User -> Maybe Bool -> User)
-> Lens User User (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Maybe Bool
consoleAccess :: Maybe Bool
$sel:consoleAccess:User' :: User -> Maybe Bool
consoleAccess} -> Maybe Bool
consoleAccess) (\s :: User
s@User' {} Maybe Bool
a -> User
s {$sel:consoleAccess:User' :: Maybe Bool
consoleAccess = Maybe Bool
a} :: User)
user_username :: Lens.Lens' User Prelude.Text
user_username :: (Text -> f Text) -> User -> f User
user_username = (User -> Text)
-> (User -> Text -> User) -> Lens User User Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Text
username :: Text
$sel:username:User' :: User -> Text
username} -> Text
username) (\s :: User
s@User' {} Text
a -> User
s {$sel:username:User' :: Text
username = Text
a} :: User)
user_password :: Lens.Lens' User Prelude.Text
user_password :: (Text -> f Text) -> User -> f User
user_password = (User -> Text)
-> (User -> Text -> User) -> Lens User User Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\User' {Text
password :: Text
$sel:password:User' :: User -> Text
password} -> Text
password) (\s :: User
s@User' {} Text
a -> User
s {$sel:password:User' :: Text
password = Text
a} :: User)
instance Prelude.Hashable User
instance Prelude.NFData User
instance Core.ToJSON User where
toJSON :: User -> Value
toJSON User' {Maybe Bool
Maybe [Text]
Text
password :: Text
username :: Text
consoleAccess :: Maybe Bool
groups :: Maybe [Text]
$sel:password:User' :: User -> Text
$sel:username:User' :: User -> Text
$sel:consoleAccess:User' :: User -> Maybe Bool
$sel:groups:User' :: User -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"groups" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
groups,
(Text
"consoleAccess" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
consoleAccess,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
username),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"password" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
password)
]
)