{-# 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.DirectoryService.ResetUserPassword
(
ResetUserPassword (..),
newResetUserPassword,
resetUserPassword_directoryId,
resetUserPassword_userName,
resetUserPassword_newPassword,
ResetUserPasswordResponse (..),
newResetUserPasswordResponse,
resetUserPasswordResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.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 ResetUserPassword = ResetUserPassword'
{
ResetUserPassword -> Text
directoryId :: Prelude.Text,
ResetUserPassword -> Text
userName :: Prelude.Text,
ResetUserPassword -> Sensitive Text
newPassword' :: Core.Sensitive Prelude.Text
}
deriving (ResetUserPassword -> ResetUserPassword -> Bool
(ResetUserPassword -> ResetUserPassword -> Bool)
-> (ResetUserPassword -> ResetUserPassword -> Bool)
-> Eq ResetUserPassword
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetUserPassword -> ResetUserPassword -> Bool
$c/= :: ResetUserPassword -> ResetUserPassword -> Bool
== :: ResetUserPassword -> ResetUserPassword -> Bool
$c== :: ResetUserPassword -> ResetUserPassword -> Bool
Prelude.Eq, Int -> ResetUserPassword -> ShowS
[ResetUserPassword] -> ShowS
ResetUserPassword -> String
(Int -> ResetUserPassword -> ShowS)
-> (ResetUserPassword -> String)
-> ([ResetUserPassword] -> ShowS)
-> Show ResetUserPassword
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetUserPassword] -> ShowS
$cshowList :: [ResetUserPassword] -> ShowS
show :: ResetUserPassword -> String
$cshow :: ResetUserPassword -> String
showsPrec :: Int -> ResetUserPassword -> ShowS
$cshowsPrec :: Int -> ResetUserPassword -> ShowS
Prelude.Show, (forall x. ResetUserPassword -> Rep ResetUserPassword x)
-> (forall x. Rep ResetUserPassword x -> ResetUserPassword)
-> Generic ResetUserPassword
forall x. Rep ResetUserPassword x -> ResetUserPassword
forall x. ResetUserPassword -> Rep ResetUserPassword x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetUserPassword x -> ResetUserPassword
$cfrom :: forall x. ResetUserPassword -> Rep ResetUserPassword x
Prelude.Generic)
newResetUserPassword ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ResetUserPassword
newResetUserPassword :: Text -> Text -> Text -> ResetUserPassword
newResetUserPassword
Text
pDirectoryId_
Text
pUserName_
Text
pNewPassword_ =
ResetUserPassword' :: Text -> Text -> Sensitive Text -> ResetUserPassword
ResetUserPassword'
{ $sel:directoryId:ResetUserPassword' :: Text
directoryId = Text
pDirectoryId_,
$sel:userName:ResetUserPassword' :: Text
userName = Text
pUserName_,
$sel:newPassword':ResetUserPassword' :: Sensitive Text
newPassword' = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pNewPassword_
}
resetUserPassword_directoryId :: Lens.Lens' ResetUserPassword Prelude.Text
resetUserPassword_directoryId :: (Text -> f Text) -> ResetUserPassword -> f ResetUserPassword
resetUserPassword_directoryId = (ResetUserPassword -> Text)
-> (ResetUserPassword -> Text -> ResetUserPassword)
-> Lens ResetUserPassword ResetUserPassword Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetUserPassword' {Text
directoryId :: Text
$sel:directoryId:ResetUserPassword' :: ResetUserPassword -> Text
directoryId} -> Text
directoryId) (\s :: ResetUserPassword
s@ResetUserPassword' {} Text
a -> ResetUserPassword
s {$sel:directoryId:ResetUserPassword' :: Text
directoryId = Text
a} :: ResetUserPassword)
resetUserPassword_userName :: Lens.Lens' ResetUserPassword Prelude.Text
resetUserPassword_userName :: (Text -> f Text) -> ResetUserPassword -> f ResetUserPassword
resetUserPassword_userName = (ResetUserPassword -> Text)
-> (ResetUserPassword -> Text -> ResetUserPassword)
-> Lens ResetUserPassword ResetUserPassword Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetUserPassword' {Text
userName :: Text
$sel:userName:ResetUserPassword' :: ResetUserPassword -> Text
userName} -> Text
userName) (\s :: ResetUserPassword
s@ResetUserPassword' {} Text
a -> ResetUserPassword
s {$sel:userName:ResetUserPassword' :: Text
userName = Text
a} :: ResetUserPassword)
resetUserPassword_newPassword :: Lens.Lens' ResetUserPassword Prelude.Text
resetUserPassword_newPassword :: (Text -> f Text) -> ResetUserPassword -> f ResetUserPassword
resetUserPassword_newPassword = (ResetUserPassword -> Sensitive Text)
-> (ResetUserPassword -> Sensitive Text -> ResetUserPassword)
-> Lens
ResetUserPassword
ResetUserPassword
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetUserPassword' {Sensitive Text
newPassword' :: Sensitive Text
$sel:newPassword':ResetUserPassword' :: ResetUserPassword -> Sensitive Text
newPassword'} -> Sensitive Text
newPassword') (\s :: ResetUserPassword
s@ResetUserPassword' {} Sensitive Text
a -> ResetUserPassword
s {$sel:newPassword':ResetUserPassword' :: Sensitive Text
newPassword' = Sensitive Text
a} :: ResetUserPassword) ((Sensitive Text -> f (Sensitive Text))
-> ResetUserPassword -> f ResetUserPassword)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ResetUserPassword
-> f ResetUserPassword
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest ResetUserPassword where
type
AWSResponse ResetUserPassword =
ResetUserPasswordResponse
request :: ResetUserPassword -> Request ResetUserPassword
request = Service -> ResetUserPassword -> Request ResetUserPassword
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResetUserPassword
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ResetUserPassword)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse ResetUserPassword))
-> Logger
-> Service
-> Proxy ResetUserPassword
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ResetUserPassword)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> ResetUserPasswordResponse
ResetUserPasswordResponse'
(Int -> ResetUserPasswordResponse)
-> Either String Int -> Either String ResetUserPasswordResponse
forall (f :: * -> *) a b. Functor 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 ResetUserPassword
instance Prelude.NFData ResetUserPassword
instance Core.ToHeaders ResetUserPassword where
toHeaders :: ResetUserPassword -> ResponseHeaders
toHeaders =
ResponseHeaders -> ResetUserPassword -> 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
"DirectoryService_20150416.ResetUserPassword" ::
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 ResetUserPassword where
toJSON :: ResetUserPassword -> Value
toJSON ResetUserPassword' {Text
Sensitive Text
newPassword' :: Sensitive Text
userName :: Text
directoryId :: Text
$sel:newPassword':ResetUserPassword' :: ResetUserPassword -> Sensitive Text
$sel:userName:ResetUserPassword' :: ResetUserPassword -> Text
$sel:directoryId:ResetUserPassword' :: ResetUserPassword -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
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
"NewPassword" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
newPassword')
]
)
instance Core.ToPath ResetUserPassword where
toPath :: ResetUserPassword -> ByteString
toPath = ByteString -> ResetUserPassword -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ResetUserPassword where
toQuery :: ResetUserPassword -> QueryString
toQuery = QueryString -> ResetUserPassword -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResetUserPasswordResponse = ResetUserPasswordResponse'
{
ResetUserPasswordResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool
(ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool)
-> (ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool)
-> Eq ResetUserPasswordResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool
$c/= :: ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool
== :: ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool
$c== :: ResetUserPasswordResponse -> ResetUserPasswordResponse -> Bool
Prelude.Eq, ReadPrec [ResetUserPasswordResponse]
ReadPrec ResetUserPasswordResponse
Int -> ReadS ResetUserPasswordResponse
ReadS [ResetUserPasswordResponse]
(Int -> ReadS ResetUserPasswordResponse)
-> ReadS [ResetUserPasswordResponse]
-> ReadPrec ResetUserPasswordResponse
-> ReadPrec [ResetUserPasswordResponse]
-> Read ResetUserPasswordResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetUserPasswordResponse]
$creadListPrec :: ReadPrec [ResetUserPasswordResponse]
readPrec :: ReadPrec ResetUserPasswordResponse
$creadPrec :: ReadPrec ResetUserPasswordResponse
readList :: ReadS [ResetUserPasswordResponse]
$creadList :: ReadS [ResetUserPasswordResponse]
readsPrec :: Int -> ReadS ResetUserPasswordResponse
$creadsPrec :: Int -> ReadS ResetUserPasswordResponse
Prelude.Read, Int -> ResetUserPasswordResponse -> ShowS
[ResetUserPasswordResponse] -> ShowS
ResetUserPasswordResponse -> String
(Int -> ResetUserPasswordResponse -> ShowS)
-> (ResetUserPasswordResponse -> String)
-> ([ResetUserPasswordResponse] -> ShowS)
-> Show ResetUserPasswordResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetUserPasswordResponse] -> ShowS
$cshowList :: [ResetUserPasswordResponse] -> ShowS
show :: ResetUserPasswordResponse -> String
$cshow :: ResetUserPasswordResponse -> String
showsPrec :: Int -> ResetUserPasswordResponse -> ShowS
$cshowsPrec :: Int -> ResetUserPasswordResponse -> ShowS
Prelude.Show, (forall x.
ResetUserPasswordResponse -> Rep ResetUserPasswordResponse x)
-> (forall x.
Rep ResetUserPasswordResponse x -> ResetUserPasswordResponse)
-> Generic ResetUserPasswordResponse
forall x.
Rep ResetUserPasswordResponse x -> ResetUserPasswordResponse
forall x.
ResetUserPasswordResponse -> Rep ResetUserPasswordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResetUserPasswordResponse x -> ResetUserPasswordResponse
$cfrom :: forall x.
ResetUserPasswordResponse -> Rep ResetUserPasswordResponse x
Prelude.Generic)
newResetUserPasswordResponse ::
Prelude.Int ->
ResetUserPasswordResponse
newResetUserPasswordResponse :: Int -> ResetUserPasswordResponse
newResetUserPasswordResponse Int
pHttpStatus_ =
ResetUserPasswordResponse' :: Int -> ResetUserPasswordResponse
ResetUserPasswordResponse'
{ $sel:httpStatus:ResetUserPasswordResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
resetUserPasswordResponse_httpStatus :: Lens.Lens' ResetUserPasswordResponse Prelude.Int
resetUserPasswordResponse_httpStatus :: (Int -> f Int)
-> ResetUserPasswordResponse -> f ResetUserPasswordResponse
resetUserPasswordResponse_httpStatus = (ResetUserPasswordResponse -> Int)
-> (ResetUserPasswordResponse -> Int -> ResetUserPasswordResponse)
-> Lens ResetUserPasswordResponse ResetUserPasswordResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetUserPasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResetUserPasswordResponse' :: ResetUserPasswordResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResetUserPasswordResponse
s@ResetUserPasswordResponse' {} Int
a -> ResetUserPasswordResponse
s {$sel:httpStatus:ResetUserPasswordResponse' :: Int
httpStatus = Int
a} :: ResetUserPasswordResponse)
instance Prelude.NFData ResetUserPasswordResponse