{-# 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.WorkMail.ResetPassword
(
ResetPassword (..),
newResetPassword,
resetPassword_organizationId,
resetPassword_userId,
resetPassword_password,
ResetPasswordResponse (..),
newResetPasswordResponse,
resetPasswordResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkMail.Types
data ResetPassword = ResetPassword'
{
ResetPassword -> Text
organizationId :: Prelude.Text,
ResetPassword -> Text
userId :: Prelude.Text,
ResetPassword -> Sensitive Text
password :: Core.Sensitive Prelude.Text
}
deriving (ResetPassword -> ResetPassword -> Bool
(ResetPassword -> ResetPassword -> Bool)
-> (ResetPassword -> ResetPassword -> Bool) -> Eq ResetPassword
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetPassword -> ResetPassword -> Bool
$c/= :: ResetPassword -> ResetPassword -> Bool
== :: ResetPassword -> ResetPassword -> Bool
$c== :: ResetPassword -> ResetPassword -> Bool
Prelude.Eq, Int -> ResetPassword -> ShowS
[ResetPassword] -> ShowS
ResetPassword -> String
(Int -> ResetPassword -> ShowS)
-> (ResetPassword -> String)
-> ([ResetPassword] -> ShowS)
-> Show ResetPassword
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetPassword] -> ShowS
$cshowList :: [ResetPassword] -> ShowS
show :: ResetPassword -> String
$cshow :: ResetPassword -> String
showsPrec :: Int -> ResetPassword -> ShowS
$cshowsPrec :: Int -> ResetPassword -> ShowS
Prelude.Show, (forall x. ResetPassword -> Rep ResetPassword x)
-> (forall x. Rep ResetPassword x -> ResetPassword)
-> Generic ResetPassword
forall x. Rep ResetPassword x -> ResetPassword
forall x. ResetPassword -> Rep ResetPassword x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetPassword x -> ResetPassword
$cfrom :: forall x. ResetPassword -> Rep ResetPassword x
Prelude.Generic)
newResetPassword ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
ResetPassword
newResetPassword :: Text -> Text -> Text -> ResetPassword
newResetPassword Text
pOrganizationId_ Text
pUserId_ Text
pPassword_ =
ResetPassword' :: Text -> Text -> Sensitive Text -> ResetPassword
ResetPassword'
{ $sel:organizationId:ResetPassword' :: Text
organizationId = Text
pOrganizationId_,
$sel:userId:ResetPassword' :: Text
userId = Text
pUserId_,
$sel:password:ResetPassword' :: Sensitive Text
password = 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
pPassword_
}
resetPassword_organizationId :: Lens.Lens' ResetPassword Prelude.Text
resetPassword_organizationId :: (Text -> f Text) -> ResetPassword -> f ResetPassword
resetPassword_organizationId = (ResetPassword -> Text)
-> (ResetPassword -> Text -> ResetPassword)
-> Lens ResetPassword ResetPassword Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPassword' {Text
organizationId :: Text
$sel:organizationId:ResetPassword' :: ResetPassword -> Text
organizationId} -> Text
organizationId) (\s :: ResetPassword
s@ResetPassword' {} Text
a -> ResetPassword
s {$sel:organizationId:ResetPassword' :: Text
organizationId = Text
a} :: ResetPassword)
resetPassword_userId :: Lens.Lens' ResetPassword Prelude.Text
resetPassword_userId :: (Text -> f Text) -> ResetPassword -> f ResetPassword
resetPassword_userId = (ResetPassword -> Text)
-> (ResetPassword -> Text -> ResetPassword)
-> Lens ResetPassword ResetPassword Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPassword' {Text
userId :: Text
$sel:userId:ResetPassword' :: ResetPassword -> Text
userId} -> Text
userId) (\s :: ResetPassword
s@ResetPassword' {} Text
a -> ResetPassword
s {$sel:userId:ResetPassword' :: Text
userId = Text
a} :: ResetPassword)
resetPassword_password :: Lens.Lens' ResetPassword Prelude.Text
resetPassword_password :: (Text -> f Text) -> ResetPassword -> f ResetPassword
resetPassword_password = (ResetPassword -> Sensitive Text)
-> (ResetPassword -> Sensitive Text -> ResetPassword)
-> Lens
ResetPassword ResetPassword (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPassword' {Sensitive Text
password :: Sensitive Text
$sel:password:ResetPassword' :: ResetPassword -> Sensitive Text
password} -> Sensitive Text
password) (\s :: ResetPassword
s@ResetPassword' {} Sensitive Text
a -> ResetPassword
s {$sel:password:ResetPassword' :: Sensitive Text
password = Sensitive Text
a} :: ResetPassword) ((Sensitive Text -> f (Sensitive Text))
-> ResetPassword -> f ResetPassword)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ResetPassword
-> f ResetPassword
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 ResetPassword where
type
AWSResponse ResetPassword =
ResetPasswordResponse
request :: ResetPassword -> Request ResetPassword
request = Service -> ResetPassword -> Request ResetPassword
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ResetPassword
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetPassword)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse ResetPassword))
-> Logger
-> Service
-> Proxy ResetPassword
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ResetPassword)))
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 -> ResetPasswordResponse
ResetPasswordResponse'
(Int -> ResetPasswordResponse)
-> Either String Int -> Either String ResetPasswordResponse
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 ResetPassword
instance Prelude.NFData ResetPassword
instance Core.ToHeaders ResetPassword where
toHeaders :: ResetPassword -> ResponseHeaders
toHeaders =
ResponseHeaders -> ResetPassword -> 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
"WorkMailService.ResetPassword" ::
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 ResetPassword where
toJSON :: ResetPassword -> Value
toJSON ResetPassword' {Text
Sensitive Text
password :: Sensitive Text
userId :: Text
organizationId :: Text
$sel:password:ResetPassword' :: ResetPassword -> Sensitive Text
$sel:userId:ResetPassword' :: ResetPassword -> Text
$sel:organizationId:ResetPassword' :: ResetPassword -> 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
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password)
]
)
instance Core.ToPath ResetPassword where
toPath :: ResetPassword -> ByteString
toPath = ByteString -> ResetPassword -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ResetPassword where
toQuery :: ResetPassword -> QueryString
toQuery = QueryString -> ResetPassword -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ResetPasswordResponse = ResetPasswordResponse'
{
ResetPasswordResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ResetPasswordResponse -> ResetPasswordResponse -> Bool
(ResetPasswordResponse -> ResetPasswordResponse -> Bool)
-> (ResetPasswordResponse -> ResetPasswordResponse -> Bool)
-> Eq ResetPasswordResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResetPasswordResponse -> ResetPasswordResponse -> Bool
$c/= :: ResetPasswordResponse -> ResetPasswordResponse -> Bool
== :: ResetPasswordResponse -> ResetPasswordResponse -> Bool
$c== :: ResetPasswordResponse -> ResetPasswordResponse -> Bool
Prelude.Eq, ReadPrec [ResetPasswordResponse]
ReadPrec ResetPasswordResponse
Int -> ReadS ResetPasswordResponse
ReadS [ResetPasswordResponse]
(Int -> ReadS ResetPasswordResponse)
-> ReadS [ResetPasswordResponse]
-> ReadPrec ResetPasswordResponse
-> ReadPrec [ResetPasswordResponse]
-> Read ResetPasswordResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResetPasswordResponse]
$creadListPrec :: ReadPrec [ResetPasswordResponse]
readPrec :: ReadPrec ResetPasswordResponse
$creadPrec :: ReadPrec ResetPasswordResponse
readList :: ReadS [ResetPasswordResponse]
$creadList :: ReadS [ResetPasswordResponse]
readsPrec :: Int -> ReadS ResetPasswordResponse
$creadsPrec :: Int -> ReadS ResetPasswordResponse
Prelude.Read, Int -> ResetPasswordResponse -> ShowS
[ResetPasswordResponse] -> ShowS
ResetPasswordResponse -> String
(Int -> ResetPasswordResponse -> ShowS)
-> (ResetPasswordResponse -> String)
-> ([ResetPasswordResponse] -> ShowS)
-> Show ResetPasswordResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResetPasswordResponse] -> ShowS
$cshowList :: [ResetPasswordResponse] -> ShowS
show :: ResetPasswordResponse -> String
$cshow :: ResetPasswordResponse -> String
showsPrec :: Int -> ResetPasswordResponse -> ShowS
$cshowsPrec :: Int -> ResetPasswordResponse -> ShowS
Prelude.Show, (forall x. ResetPasswordResponse -> Rep ResetPasswordResponse x)
-> (forall x. Rep ResetPasswordResponse x -> ResetPasswordResponse)
-> Generic ResetPasswordResponse
forall x. Rep ResetPasswordResponse x -> ResetPasswordResponse
forall x. ResetPasswordResponse -> Rep ResetPasswordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResetPasswordResponse x -> ResetPasswordResponse
$cfrom :: forall x. ResetPasswordResponse -> Rep ResetPasswordResponse x
Prelude.Generic)
newResetPasswordResponse ::
Prelude.Int ->
ResetPasswordResponse
newResetPasswordResponse :: Int -> ResetPasswordResponse
newResetPasswordResponse Int
pHttpStatus_ =
ResetPasswordResponse' :: Int -> ResetPasswordResponse
ResetPasswordResponse' {$sel:httpStatus:ResetPasswordResponse' :: Int
httpStatus = Int
pHttpStatus_}
resetPasswordResponse_httpStatus :: Lens.Lens' ResetPasswordResponse Prelude.Int
resetPasswordResponse_httpStatus :: (Int -> f Int) -> ResetPasswordResponse -> f ResetPasswordResponse
resetPasswordResponse_httpStatus = (ResetPasswordResponse -> Int)
-> (ResetPasswordResponse -> Int -> ResetPasswordResponse)
-> Lens ResetPasswordResponse ResetPasswordResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResetPasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:ResetPasswordResponse' :: ResetPasswordResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ResetPasswordResponse
s@ResetPasswordResponse' {} Int
a -> ResetPasswordResponse
s {$sel:httpStatus:ResetPasswordResponse' :: Int
httpStatus = Int
a} :: ResetPasswordResponse)
instance Prelude.NFData ResetPasswordResponse