{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.ElastiCache.CreateUser
(
CreateUser (..),
newCreateUser,
createUser_passwords,
createUser_noPasswordRequired,
createUser_tags,
createUser_userId,
createUser_userName,
createUser_engine,
createUser_accessString,
User (..),
newUser,
user_status,
user_arn,
user_userGroupIds,
user_authentication,
user_engine,
user_userName,
user_accessString,
user_userId,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateUser = CreateUser'
{
CreateUser -> Maybe (NonEmpty Text)
passwords :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
CreateUser -> Maybe Bool
noPasswordRequired :: Prelude.Maybe Prelude.Bool,
CreateUser -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateUser -> Text
userId :: Prelude.Text,
CreateUser -> Text
userName :: Prelude.Text,
CreateUser -> Text
engine :: Prelude.Text,
CreateUser -> Text
accessString :: Prelude.Text
}
deriving (CreateUser -> CreateUser -> Bool
(CreateUser -> CreateUser -> Bool)
-> (CreateUser -> CreateUser -> Bool) -> Eq CreateUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUser -> CreateUser -> Bool
$c/= :: CreateUser -> CreateUser -> Bool
== :: CreateUser -> CreateUser -> Bool
$c== :: CreateUser -> CreateUser -> Bool
Prelude.Eq, ReadPrec [CreateUser]
ReadPrec CreateUser
Int -> ReadS CreateUser
ReadS [CreateUser]
(Int -> ReadS CreateUser)
-> ReadS [CreateUser]
-> ReadPrec CreateUser
-> ReadPrec [CreateUser]
-> Read CreateUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUser]
$creadListPrec :: ReadPrec [CreateUser]
readPrec :: ReadPrec CreateUser
$creadPrec :: ReadPrec CreateUser
readList :: ReadS [CreateUser]
$creadList :: ReadS [CreateUser]
readsPrec :: Int -> ReadS CreateUser
$creadsPrec :: Int -> ReadS CreateUser
Prelude.Read, Int -> CreateUser -> ShowS
[CreateUser] -> ShowS
CreateUser -> String
(Int -> CreateUser -> ShowS)
-> (CreateUser -> String)
-> ([CreateUser] -> ShowS)
-> Show CreateUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUser] -> ShowS
$cshowList :: [CreateUser] -> ShowS
show :: CreateUser -> String
$cshow :: CreateUser -> String
showsPrec :: Int -> CreateUser -> ShowS
$cshowsPrec :: Int -> CreateUser -> ShowS
Prelude.Show, (forall x. CreateUser -> Rep CreateUser x)
-> (forall x. Rep CreateUser x -> CreateUser) -> Generic CreateUser
forall x. Rep CreateUser x -> CreateUser
forall x. CreateUser -> Rep CreateUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUser x -> CreateUser
$cfrom :: forall x. CreateUser -> Rep CreateUser x
Prelude.Generic)
newCreateUser ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateUser
newCreateUser :: Text -> Text -> Text -> Text -> CreateUser
newCreateUser
Text
pUserId_
Text
pUserName_
Text
pEngine_
Text
pAccessString_ =
CreateUser' :: Maybe (NonEmpty Text)
-> Maybe Bool
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> CreateUser
CreateUser'
{ $sel:passwords:CreateUser' :: Maybe (NonEmpty Text)
passwords = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:noPasswordRequired:CreateUser' :: Maybe Bool
noPasswordRequired = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateUser' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:userId:CreateUser' :: Text
userId = Text
pUserId_,
$sel:userName:CreateUser' :: Text
userName = Text
pUserName_,
$sel:engine:CreateUser' :: Text
engine = Text
pEngine_,
$sel:accessString:CreateUser' :: Text
accessString = Text
pAccessString_
}
createUser_passwords :: Lens.Lens' CreateUser (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createUser_passwords :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateUser -> f CreateUser
createUser_passwords = (CreateUser -> Maybe (NonEmpty Text))
-> (CreateUser -> Maybe (NonEmpty Text) -> CreateUser)
-> Lens
CreateUser
CreateUser
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe (NonEmpty Text)
passwords :: Maybe (NonEmpty Text)
$sel:passwords:CreateUser' :: CreateUser -> Maybe (NonEmpty Text)
passwords} -> Maybe (NonEmpty Text)
passwords) (\s :: CreateUser
s@CreateUser' {} Maybe (NonEmpty Text)
a -> CreateUser
s {$sel:passwords:CreateUser' :: Maybe (NonEmpty Text)
passwords = Maybe (NonEmpty Text)
a} :: CreateUser) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateUser -> f CreateUser)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateUser
-> f CreateUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty 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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createUser_noPasswordRequired :: Lens.Lens' CreateUser (Prelude.Maybe Prelude.Bool)
createUser_noPasswordRequired :: (Maybe Bool -> f (Maybe Bool)) -> CreateUser -> f CreateUser
createUser_noPasswordRequired = (CreateUser -> Maybe Bool)
-> (CreateUser -> Maybe Bool -> CreateUser)
-> Lens CreateUser CreateUser (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe Bool
noPasswordRequired :: Maybe Bool
$sel:noPasswordRequired:CreateUser' :: CreateUser -> Maybe Bool
noPasswordRequired} -> Maybe Bool
noPasswordRequired) (\s :: CreateUser
s@CreateUser' {} Maybe Bool
a -> CreateUser
s {$sel:noPasswordRequired:CreateUser' :: Maybe Bool
noPasswordRequired = Maybe Bool
a} :: CreateUser)
createUser_tags :: Lens.Lens' CreateUser (Prelude.Maybe [Tag])
createUser_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateUser -> f CreateUser
createUser_tags = (CreateUser -> Maybe [Tag])
-> (CreateUser -> Maybe [Tag] -> CreateUser)
-> Lens CreateUser CreateUser (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateUser' :: CreateUser -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateUser
s@CreateUser' {} Maybe [Tag]
a -> CreateUser
s {$sel:tags:CreateUser' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateUser) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateUser -> f CreateUser)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUser
-> f CreateUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createUser_userId :: Lens.Lens' CreateUser Prelude.Text
createUser_userId :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_userId = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
userId :: Text
$sel:userId:CreateUser' :: CreateUser -> Text
userId} -> Text
userId) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:userId:CreateUser' :: Text
userId = Text
a} :: CreateUser)
createUser_userName :: Lens.Lens' CreateUser Prelude.Text
createUser_userName :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_userName = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
userName :: Text
$sel:userName:CreateUser' :: CreateUser -> Text
userName} -> Text
userName) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:userName:CreateUser' :: Text
userName = Text
a} :: CreateUser)
createUser_engine :: Lens.Lens' CreateUser Prelude.Text
createUser_engine :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_engine = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
engine :: Text
$sel:engine:CreateUser' :: CreateUser -> Text
engine} -> Text
engine) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:engine:CreateUser' :: Text
engine = Text
a} :: CreateUser)
createUser_accessString :: Lens.Lens' CreateUser Prelude.Text
createUser_accessString :: (Text -> f Text) -> CreateUser -> f CreateUser
createUser_accessString = (CreateUser -> Text)
-> (CreateUser -> Text -> CreateUser)
-> Lens CreateUser CreateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUser' {Text
accessString :: Text
$sel:accessString:CreateUser' :: CreateUser -> Text
accessString} -> Text
accessString) (\s :: CreateUser
s@CreateUser' {} Text
a -> CreateUser
s {$sel:accessString:CreateUser' :: Text
accessString = Text
a} :: CreateUser)
instance Core.AWSRequest CreateUser where
type AWSResponse CreateUser = User
request :: CreateUser -> Request CreateUser
request = Service -> CreateUser -> Request CreateUser
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUser)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateUser))
-> Logger
-> Service
-> Proxy CreateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUser)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"CreateUserResult"
(\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String User
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance Prelude.Hashable CreateUser
instance Prelude.NFData CreateUser
instance Core.ToHeaders CreateUser where
toHeaders :: CreateUser -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateUser where
toPath :: CreateUser -> ByteString
toPath = ByteString -> CreateUser -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateUser where
toQuery :: CreateUser -> QueryString
toQuery CreateUser' {Maybe Bool
Maybe [Tag]
Maybe (NonEmpty Text)
Text
accessString :: Text
engine :: Text
userName :: Text
userId :: Text
tags :: Maybe [Tag]
noPasswordRequired :: Maybe Bool
passwords :: Maybe (NonEmpty Text)
$sel:accessString:CreateUser' :: CreateUser -> Text
$sel:engine:CreateUser' :: CreateUser -> Text
$sel:userName:CreateUser' :: CreateUser -> Text
$sel:userId:CreateUser' :: CreateUser -> Text
$sel:tags:CreateUser' :: CreateUser -> Maybe [Tag]
$sel:noPasswordRequired:CreateUser' :: CreateUser -> Maybe Bool
$sel:passwords:CreateUser' :: CreateUser -> Maybe (NonEmpty Text)
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateUser" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"Passwords"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty Text -> QueryString)
-> Maybe (NonEmpty Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
passwords),
ByteString
"NoPasswordRequired" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
noPasswordRequired,
ByteString
"Tags"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
ByteString
"UserId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userId,
ByteString
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName,
ByteString
"Engine" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engine,
ByteString
"AccessString" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
accessString
]