{-# 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.MemoryDb.UpdateUser
(
UpdateUser (..),
newUpdateUser,
updateUser_authenticationMode,
updateUser_accessString,
updateUser_userName,
UpdateUserResponse (..),
newUpdateUserResponse,
updateUserResponse_user,
updateUserResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MemoryDb.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateUser = UpdateUser'
{
UpdateUser -> Maybe AuthenticationMode
authenticationMode :: Prelude.Maybe AuthenticationMode,
UpdateUser -> Maybe Text
accessString :: Prelude.Maybe Prelude.Text,
UpdateUser -> Text
userName :: Prelude.Text
}
deriving (UpdateUser -> UpdateUser -> Bool
(UpdateUser -> UpdateUser -> Bool)
-> (UpdateUser -> UpdateUser -> Bool) -> Eq UpdateUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUser -> UpdateUser -> Bool
$c/= :: UpdateUser -> UpdateUser -> Bool
== :: UpdateUser -> UpdateUser -> Bool
$c== :: UpdateUser -> UpdateUser -> Bool
Prelude.Eq, ReadPrec [UpdateUser]
ReadPrec UpdateUser
Int -> ReadS UpdateUser
ReadS [UpdateUser]
(Int -> ReadS UpdateUser)
-> ReadS [UpdateUser]
-> ReadPrec UpdateUser
-> ReadPrec [UpdateUser]
-> Read UpdateUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUser]
$creadListPrec :: ReadPrec [UpdateUser]
readPrec :: ReadPrec UpdateUser
$creadPrec :: ReadPrec UpdateUser
readList :: ReadS [UpdateUser]
$creadList :: ReadS [UpdateUser]
readsPrec :: Int -> ReadS UpdateUser
$creadsPrec :: Int -> ReadS UpdateUser
Prelude.Read, Int -> UpdateUser -> ShowS
[UpdateUser] -> ShowS
UpdateUser -> String
(Int -> UpdateUser -> ShowS)
-> (UpdateUser -> String)
-> ([UpdateUser] -> ShowS)
-> Show UpdateUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUser] -> ShowS
$cshowList :: [UpdateUser] -> ShowS
show :: UpdateUser -> String
$cshow :: UpdateUser -> String
showsPrec :: Int -> UpdateUser -> ShowS
$cshowsPrec :: Int -> UpdateUser -> ShowS
Prelude.Show, (forall x. UpdateUser -> Rep UpdateUser x)
-> (forall x. Rep UpdateUser x -> UpdateUser) -> Generic UpdateUser
forall x. Rep UpdateUser x -> UpdateUser
forall x. UpdateUser -> Rep UpdateUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUser x -> UpdateUser
$cfrom :: forall x. UpdateUser -> Rep UpdateUser x
Prelude.Generic)
newUpdateUser ::
Prelude.Text ->
UpdateUser
newUpdateUser :: Text -> UpdateUser
newUpdateUser Text
pUserName_ =
UpdateUser' :: Maybe AuthenticationMode -> Maybe Text -> Text -> UpdateUser
UpdateUser'
{ $sel:authenticationMode:UpdateUser' :: Maybe AuthenticationMode
authenticationMode = Maybe AuthenticationMode
forall a. Maybe a
Prelude.Nothing,
$sel:accessString:UpdateUser' :: Maybe Text
accessString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:userName:UpdateUser' :: Text
userName = Text
pUserName_
}
updateUser_authenticationMode :: Lens.Lens' UpdateUser (Prelude.Maybe AuthenticationMode)
updateUser_authenticationMode :: (Maybe AuthenticationMode -> f (Maybe AuthenticationMode))
-> UpdateUser -> f UpdateUser
updateUser_authenticationMode = (UpdateUser -> Maybe AuthenticationMode)
-> (UpdateUser -> Maybe AuthenticationMode -> UpdateUser)
-> Lens
UpdateUser
UpdateUser
(Maybe AuthenticationMode)
(Maybe AuthenticationMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe AuthenticationMode
authenticationMode :: Maybe AuthenticationMode
$sel:authenticationMode:UpdateUser' :: UpdateUser -> Maybe AuthenticationMode
authenticationMode} -> Maybe AuthenticationMode
authenticationMode) (\s :: UpdateUser
s@UpdateUser' {} Maybe AuthenticationMode
a -> UpdateUser
s {$sel:authenticationMode:UpdateUser' :: Maybe AuthenticationMode
authenticationMode = Maybe AuthenticationMode
a} :: UpdateUser)
updateUser_accessString :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_accessString :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_accessString = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
accessString :: Maybe Text
$sel:accessString:UpdateUser' :: UpdateUser -> Maybe Text
accessString} -> Maybe Text
accessString) (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:accessString:UpdateUser' :: Maybe Text
accessString = Maybe Text
a} :: UpdateUser)
updateUser_userName :: Lens.Lens' UpdateUser Prelude.Text
updateUser_userName :: (Text -> f Text) -> UpdateUser -> f UpdateUser
updateUser_userName = (UpdateUser -> Text)
-> (UpdateUser -> Text -> UpdateUser)
-> Lens UpdateUser UpdateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Text
userName :: Text
$sel:userName:UpdateUser' :: UpdateUser -> Text
userName} -> Text
userName) (\s :: UpdateUser
s@UpdateUser' {} Text
a -> UpdateUser
s {$sel:userName:UpdateUser' :: Text
userName = Text
a} :: UpdateUser)
instance Core.AWSRequest UpdateUser where
type AWSResponse UpdateUser = UpdateUserResponse
request :: UpdateUser -> Request UpdateUser
request = Service -> UpdateUser -> Request UpdateUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateUser))
-> Logger
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe User -> Int -> UpdateUserResponse
UpdateUserResponse'
(Maybe User -> Int -> UpdateUserResponse)
-> Either String (Maybe User)
-> Either String (Int -> UpdateUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe User)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"User")
Either String (Int -> UpdateUserResponse)
-> Either String Int -> Either String UpdateUserResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateUser
instance Prelude.NFData UpdateUser
instance Core.ToHeaders UpdateUser where
toHeaders :: UpdateUser -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AmazonMemoryDB.UpdateUser" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateUser where
toJSON :: UpdateUser -> Value
toJSON UpdateUser' {Maybe Text
Maybe AuthenticationMode
Text
userName :: Text
accessString :: Maybe Text
authenticationMode :: Maybe AuthenticationMode
$sel:userName:UpdateUser' :: UpdateUser -> Text
$sel:accessString:UpdateUser' :: UpdateUser -> Maybe Text
$sel:authenticationMode:UpdateUser' :: UpdateUser -> Maybe AuthenticationMode
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AuthenticationMode" Text -> AuthenticationMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(AuthenticationMode -> Pair)
-> Maybe AuthenticationMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthenticationMode
authenticationMode,
(Text
"AccessString" 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
accessString,
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)
]
)
instance Core.ToPath UpdateUser where
toPath :: UpdateUser -> ByteString
toPath = ByteString -> UpdateUser -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateUser where
toQuery :: UpdateUser -> QueryString
toQuery = QueryString -> UpdateUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateUserResponse = UpdateUserResponse'
{
UpdateUserResponse -> Maybe User
user :: Prelude.Maybe User,
UpdateUserResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateUserResponse -> UpdateUserResponse -> Bool
(UpdateUserResponse -> UpdateUserResponse -> Bool)
-> (UpdateUserResponse -> UpdateUserResponse -> Bool)
-> Eq UpdateUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserResponse -> UpdateUserResponse -> Bool
$c/= :: UpdateUserResponse -> UpdateUserResponse -> Bool
== :: UpdateUserResponse -> UpdateUserResponse -> Bool
$c== :: UpdateUserResponse -> UpdateUserResponse -> Bool
Prelude.Eq, ReadPrec [UpdateUserResponse]
ReadPrec UpdateUserResponse
Int -> ReadS UpdateUserResponse
ReadS [UpdateUserResponse]
(Int -> ReadS UpdateUserResponse)
-> ReadS [UpdateUserResponse]
-> ReadPrec UpdateUserResponse
-> ReadPrec [UpdateUserResponse]
-> Read UpdateUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserResponse]
$creadListPrec :: ReadPrec [UpdateUserResponse]
readPrec :: ReadPrec UpdateUserResponse
$creadPrec :: ReadPrec UpdateUserResponse
readList :: ReadS [UpdateUserResponse]
$creadList :: ReadS [UpdateUserResponse]
readsPrec :: Int -> ReadS UpdateUserResponse
$creadsPrec :: Int -> ReadS UpdateUserResponse
Prelude.Read, Int -> UpdateUserResponse -> ShowS
[UpdateUserResponse] -> ShowS
UpdateUserResponse -> String
(Int -> UpdateUserResponse -> ShowS)
-> (UpdateUserResponse -> String)
-> ([UpdateUserResponse] -> ShowS)
-> Show UpdateUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserResponse] -> ShowS
$cshowList :: [UpdateUserResponse] -> ShowS
show :: UpdateUserResponse -> String
$cshow :: UpdateUserResponse -> String
showsPrec :: Int -> UpdateUserResponse -> ShowS
$cshowsPrec :: Int -> UpdateUserResponse -> ShowS
Prelude.Show, (forall x. UpdateUserResponse -> Rep UpdateUserResponse x)
-> (forall x. Rep UpdateUserResponse x -> UpdateUserResponse)
-> Generic UpdateUserResponse
forall x. Rep UpdateUserResponse x -> UpdateUserResponse
forall x. UpdateUserResponse -> Rep UpdateUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUserResponse x -> UpdateUserResponse
$cfrom :: forall x. UpdateUserResponse -> Rep UpdateUserResponse x
Prelude.Generic)
newUpdateUserResponse ::
Prelude.Int ->
UpdateUserResponse
newUpdateUserResponse :: Int -> UpdateUserResponse
newUpdateUserResponse Int
pHttpStatus_ =
UpdateUserResponse' :: Maybe User -> Int -> UpdateUserResponse
UpdateUserResponse'
{ $sel:user:UpdateUserResponse' :: Maybe User
user = Maybe User
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateUserResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateUserResponse_user :: Lens.Lens' UpdateUserResponse (Prelude.Maybe User)
updateUserResponse_user :: (Maybe User -> f (Maybe User))
-> UpdateUserResponse -> f UpdateUserResponse
updateUserResponse_user = (UpdateUserResponse -> Maybe User)
-> (UpdateUserResponse -> Maybe User -> UpdateUserResponse)
-> Lens
UpdateUserResponse UpdateUserResponse (Maybe User) (Maybe User)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserResponse' {Maybe User
user :: Maybe User
$sel:user:UpdateUserResponse' :: UpdateUserResponse -> Maybe User
user} -> Maybe User
user) (\s :: UpdateUserResponse
s@UpdateUserResponse' {} Maybe User
a -> UpdateUserResponse
s {$sel:user:UpdateUserResponse' :: Maybe User
user = Maybe User
a} :: UpdateUserResponse)
updateUserResponse_httpStatus :: Lens.Lens' UpdateUserResponse Prelude.Int
updateUserResponse_httpStatus :: (Int -> f Int) -> UpdateUserResponse -> f UpdateUserResponse
updateUserResponse_httpStatus = (UpdateUserResponse -> Int)
-> (UpdateUserResponse -> Int -> UpdateUserResponse)
-> Lens UpdateUserResponse UpdateUserResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateUserResponse' :: UpdateUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateUserResponse
s@UpdateUserResponse' {} Int
a -> UpdateUserResponse
s {$sel:httpStatus:UpdateUserResponse' :: Int
httpStatus = Int
a} :: UpdateUserResponse)
instance Prelude.NFData UpdateUserResponse