{-# 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.CognitoIdentityProvider.AdminResetUserPassword
(
AdminResetUserPassword (..),
newAdminResetUserPassword,
adminResetUserPassword_clientMetadata,
adminResetUserPassword_userPoolId,
adminResetUserPassword_username,
AdminResetUserPasswordResponse (..),
newAdminResetUserPasswordResponse,
adminResetUserPasswordResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AdminResetUserPassword = AdminResetUserPassword'
{
AdminResetUserPassword -> Maybe (HashMap Text Text)
clientMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
AdminResetUserPassword -> Text
userPoolId :: Prelude.Text,
AdminResetUserPassword -> Sensitive Text
username :: Data.Sensitive Prelude.Text
}
deriving (AdminResetUserPassword -> AdminResetUserPassword -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminResetUserPassword -> AdminResetUserPassword -> Bool
$c/= :: AdminResetUserPassword -> AdminResetUserPassword -> Bool
== :: AdminResetUserPassword -> AdminResetUserPassword -> Bool
$c== :: AdminResetUserPassword -> AdminResetUserPassword -> Bool
Prelude.Eq, Int -> AdminResetUserPassword -> ShowS
[AdminResetUserPassword] -> ShowS
AdminResetUserPassword -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminResetUserPassword] -> ShowS
$cshowList :: [AdminResetUserPassword] -> ShowS
show :: AdminResetUserPassword -> String
$cshow :: AdminResetUserPassword -> String
showsPrec :: Int -> AdminResetUserPassword -> ShowS
$cshowsPrec :: Int -> AdminResetUserPassword -> ShowS
Prelude.Show, forall x. Rep AdminResetUserPassword x -> AdminResetUserPassword
forall x. AdminResetUserPassword -> Rep AdminResetUserPassword x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminResetUserPassword x -> AdminResetUserPassword
$cfrom :: forall x. AdminResetUserPassword -> Rep AdminResetUserPassword x
Prelude.Generic)
newAdminResetUserPassword ::
Prelude.Text ->
Prelude.Text ->
AdminResetUserPassword
newAdminResetUserPassword :: Text -> Text -> AdminResetUserPassword
newAdminResetUserPassword Text
pUserPoolId_ Text
pUsername_ =
AdminResetUserPassword'
{ $sel:clientMetadata:AdminResetUserPassword' :: Maybe (HashMap Text Text)
clientMetadata =
forall a. Maybe a
Prelude.Nothing,
$sel:userPoolId:AdminResetUserPassword' :: Text
userPoolId = Text
pUserPoolId_,
$sel:username:AdminResetUserPassword' :: Sensitive Text
username = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pUsername_
}
adminResetUserPassword_clientMetadata :: Lens.Lens' AdminResetUserPassword (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
adminResetUserPassword_clientMetadata :: Lens' AdminResetUserPassword (Maybe (HashMap Text Text))
adminResetUserPassword_clientMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminResetUserPassword' {Maybe (HashMap Text Text)
clientMetadata :: Maybe (HashMap Text Text)
$sel:clientMetadata:AdminResetUserPassword' :: AdminResetUserPassword -> Maybe (HashMap Text Text)
clientMetadata} -> Maybe (HashMap Text Text)
clientMetadata) (\s :: AdminResetUserPassword
s@AdminResetUserPassword' {} Maybe (HashMap Text Text)
a -> AdminResetUserPassword
s {$sel:clientMetadata:AdminResetUserPassword' :: Maybe (HashMap Text Text)
clientMetadata = Maybe (HashMap Text Text)
a} :: AdminResetUserPassword) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
adminResetUserPassword_userPoolId :: Lens.Lens' AdminResetUserPassword Prelude.Text
adminResetUserPassword_userPoolId :: Lens' AdminResetUserPassword Text
adminResetUserPassword_userPoolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminResetUserPassword' {Text
userPoolId :: Text
$sel:userPoolId:AdminResetUserPassword' :: AdminResetUserPassword -> Text
userPoolId} -> Text
userPoolId) (\s :: AdminResetUserPassword
s@AdminResetUserPassword' {} Text
a -> AdminResetUserPassword
s {$sel:userPoolId:AdminResetUserPassword' :: Text
userPoolId = Text
a} :: AdminResetUserPassword)
adminResetUserPassword_username :: Lens.Lens' AdminResetUserPassword Prelude.Text
adminResetUserPassword_username :: Lens' AdminResetUserPassword Text
adminResetUserPassword_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminResetUserPassword' {Sensitive Text
username :: Sensitive Text
$sel:username:AdminResetUserPassword' :: AdminResetUserPassword -> Sensitive Text
username} -> Sensitive Text
username) (\s :: AdminResetUserPassword
s@AdminResetUserPassword' {} Sensitive Text
a -> AdminResetUserPassword
s {$sel:username:AdminResetUserPassword' :: Sensitive Text
username = Sensitive Text
a} :: AdminResetUserPassword) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSRequest AdminResetUserPassword where
type
AWSResponse AdminResetUserPassword =
AdminResetUserPasswordResponse
request :: (Service -> Service)
-> AdminResetUserPassword -> Request AdminResetUserPassword
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy AdminResetUserPassword
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AdminResetUserPassword)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AdminResetUserPasswordResponse
AdminResetUserPasswordResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AdminResetUserPassword where
hashWithSalt :: Int -> AdminResetUserPassword -> Int
hashWithSalt Int
_salt AdminResetUserPassword' {Maybe (HashMap Text Text)
Text
Sensitive Text
username :: Sensitive Text
userPoolId :: Text
clientMetadata :: Maybe (HashMap Text Text)
$sel:username:AdminResetUserPassword' :: AdminResetUserPassword -> Sensitive Text
$sel:userPoolId:AdminResetUserPassword' :: AdminResetUserPassword -> Text
$sel:clientMetadata:AdminResetUserPassword' :: AdminResetUserPassword -> Maybe (HashMap Text Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
clientMetadata
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userPoolId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
username
instance Prelude.NFData AdminResetUserPassword where
rnf :: AdminResetUserPassword -> ()
rnf AdminResetUserPassword' {Maybe (HashMap Text Text)
Text
Sensitive Text
username :: Sensitive Text
userPoolId :: Text
clientMetadata :: Maybe (HashMap Text Text)
$sel:username:AdminResetUserPassword' :: AdminResetUserPassword -> Sensitive Text
$sel:userPoolId:AdminResetUserPassword' :: AdminResetUserPassword -> Text
$sel:clientMetadata:AdminResetUserPassword' :: AdminResetUserPassword -> Maybe (HashMap Text Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
clientMetadata
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userPoolId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
username
instance Data.ToHeaders AdminResetUserPassword where
toHeaders :: AdminResetUserPassword -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSCognitoIdentityProviderService.AdminResetUserPassword" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON AdminResetUserPassword where
toJSON :: AdminResetUserPassword -> Value
toJSON AdminResetUserPassword' {Maybe (HashMap Text Text)
Text
Sensitive Text
username :: Sensitive Text
userPoolId :: Text
clientMetadata :: Maybe (HashMap Text Text)
$sel:username:AdminResetUserPassword' :: AdminResetUserPassword -> Sensitive Text
$sel:userPoolId:AdminResetUserPassword' :: AdminResetUserPassword -> Text
$sel:clientMetadata:AdminResetUserPassword' :: AdminResetUserPassword -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClientMetadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
clientMetadata,
forall a. a -> Maybe a
Prelude.Just (Key
"UserPoolId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
userPoolId),
forall a. a -> Maybe a
Prelude.Just (Key
"Username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
username)
]
)
instance Data.ToPath AdminResetUserPassword where
toPath :: AdminResetUserPassword -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AdminResetUserPassword where
toQuery :: AdminResetUserPassword -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AdminResetUserPasswordResponse = AdminResetUserPasswordResponse'
{
AdminResetUserPasswordResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AdminResetUserPasswordResponse
-> AdminResetUserPasswordResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminResetUserPasswordResponse
-> AdminResetUserPasswordResponse -> Bool
$c/= :: AdminResetUserPasswordResponse
-> AdminResetUserPasswordResponse -> Bool
== :: AdminResetUserPasswordResponse
-> AdminResetUserPasswordResponse -> Bool
$c== :: AdminResetUserPasswordResponse
-> AdminResetUserPasswordResponse -> Bool
Prelude.Eq, ReadPrec [AdminResetUserPasswordResponse]
ReadPrec AdminResetUserPasswordResponse
Int -> ReadS AdminResetUserPasswordResponse
ReadS [AdminResetUserPasswordResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdminResetUserPasswordResponse]
$creadListPrec :: ReadPrec [AdminResetUserPasswordResponse]
readPrec :: ReadPrec AdminResetUserPasswordResponse
$creadPrec :: ReadPrec AdminResetUserPasswordResponse
readList :: ReadS [AdminResetUserPasswordResponse]
$creadList :: ReadS [AdminResetUserPasswordResponse]
readsPrec :: Int -> ReadS AdminResetUserPasswordResponse
$creadsPrec :: Int -> ReadS AdminResetUserPasswordResponse
Prelude.Read, Int -> AdminResetUserPasswordResponse -> ShowS
[AdminResetUserPasswordResponse] -> ShowS
AdminResetUserPasswordResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminResetUserPasswordResponse] -> ShowS
$cshowList :: [AdminResetUserPasswordResponse] -> ShowS
show :: AdminResetUserPasswordResponse -> String
$cshow :: AdminResetUserPasswordResponse -> String
showsPrec :: Int -> AdminResetUserPasswordResponse -> ShowS
$cshowsPrec :: Int -> AdminResetUserPasswordResponse -> ShowS
Prelude.Show, forall x.
Rep AdminResetUserPasswordResponse x
-> AdminResetUserPasswordResponse
forall x.
AdminResetUserPasswordResponse
-> Rep AdminResetUserPasswordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdminResetUserPasswordResponse x
-> AdminResetUserPasswordResponse
$cfrom :: forall x.
AdminResetUserPasswordResponse
-> Rep AdminResetUserPasswordResponse x
Prelude.Generic)
newAdminResetUserPasswordResponse ::
Prelude.Int ->
AdminResetUserPasswordResponse
newAdminResetUserPasswordResponse :: Int -> AdminResetUserPasswordResponse
newAdminResetUserPasswordResponse Int
pHttpStatus_ =
AdminResetUserPasswordResponse'
{ $sel:httpStatus:AdminResetUserPasswordResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
adminResetUserPasswordResponse_httpStatus :: Lens.Lens' AdminResetUserPasswordResponse Prelude.Int
adminResetUserPasswordResponse_httpStatus :: Lens' AdminResetUserPasswordResponse Int
adminResetUserPasswordResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminResetUserPasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminResetUserPasswordResponse' :: AdminResetUserPasswordResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AdminResetUserPasswordResponse
s@AdminResetUserPasswordResponse' {} Int
a -> AdminResetUserPasswordResponse
s {$sel:httpStatus:AdminResetUserPasswordResponse' :: Int
httpStatus = Int
a} :: AdminResetUserPasswordResponse)
instance
Prelude.NFData
AdminResetUserPasswordResponse
where
rnf :: AdminResetUserPasswordResponse -> ()
rnf AdminResetUserPasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminResetUserPasswordResponse' :: AdminResetUserPasswordResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus