{-# 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.AdminSetUserPassword
(
AdminSetUserPassword (..),
newAdminSetUserPassword,
adminSetUserPassword_permanent,
adminSetUserPassword_userPoolId,
adminSetUserPassword_username,
adminSetUserPassword_password,
AdminSetUserPasswordResponse (..),
newAdminSetUserPasswordResponse,
adminSetUserPasswordResponse_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 AdminSetUserPassword = AdminSetUserPassword'
{
AdminSetUserPassword -> Maybe Bool
permanent :: Prelude.Maybe Prelude.Bool,
AdminSetUserPassword -> Text
userPoolId :: Prelude.Text,
AdminSetUserPassword -> Sensitive Text
username :: Data.Sensitive Prelude.Text,
AdminSetUserPassword -> Sensitive Text
password :: Data.Sensitive Prelude.Text
}
deriving (AdminSetUserPassword -> AdminSetUserPassword -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminSetUserPassword -> AdminSetUserPassword -> Bool
$c/= :: AdminSetUserPassword -> AdminSetUserPassword -> Bool
== :: AdminSetUserPassword -> AdminSetUserPassword -> Bool
$c== :: AdminSetUserPassword -> AdminSetUserPassword -> Bool
Prelude.Eq, Int -> AdminSetUserPassword -> ShowS
[AdminSetUserPassword] -> ShowS
AdminSetUserPassword -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminSetUserPassword] -> ShowS
$cshowList :: [AdminSetUserPassword] -> ShowS
show :: AdminSetUserPassword -> String
$cshow :: AdminSetUserPassword -> String
showsPrec :: Int -> AdminSetUserPassword -> ShowS
$cshowsPrec :: Int -> AdminSetUserPassword -> ShowS
Prelude.Show, forall x. Rep AdminSetUserPassword x -> AdminSetUserPassword
forall x. AdminSetUserPassword -> Rep AdminSetUserPassword x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminSetUserPassword x -> AdminSetUserPassword
$cfrom :: forall x. AdminSetUserPassword -> Rep AdminSetUserPassword x
Prelude.Generic)
newAdminSetUserPassword ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AdminSetUserPassword
newAdminSetUserPassword :: Text -> Text -> Text -> AdminSetUserPassword
newAdminSetUserPassword
Text
pUserPoolId_
Text
pUsername_
Text
pPassword_ =
AdminSetUserPassword'
{ $sel:permanent:AdminSetUserPassword' :: Maybe Bool
permanent = forall a. Maybe a
Prelude.Nothing,
$sel:userPoolId:AdminSetUserPassword' :: Text
userPoolId = Text
pUserPoolId_,
$sel:username:AdminSetUserPassword' :: Sensitive Text
username = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pUsername_,
$sel:password:AdminSetUserPassword' :: Sensitive Text
password = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_
}
adminSetUserPassword_permanent :: Lens.Lens' AdminSetUserPassword (Prelude.Maybe Prelude.Bool)
adminSetUserPassword_permanent :: Lens' AdminSetUserPassword (Maybe Bool)
adminSetUserPassword_permanent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserPassword' {Maybe Bool
permanent :: Maybe Bool
$sel:permanent:AdminSetUserPassword' :: AdminSetUserPassword -> Maybe Bool
permanent} -> Maybe Bool
permanent) (\s :: AdminSetUserPassword
s@AdminSetUserPassword' {} Maybe Bool
a -> AdminSetUserPassword
s {$sel:permanent:AdminSetUserPassword' :: Maybe Bool
permanent = Maybe Bool
a} :: AdminSetUserPassword)
adminSetUserPassword_userPoolId :: Lens.Lens' AdminSetUserPassword Prelude.Text
adminSetUserPassword_userPoolId :: Lens' AdminSetUserPassword Text
adminSetUserPassword_userPoolId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserPassword' {Text
userPoolId :: Text
$sel:userPoolId:AdminSetUserPassword' :: AdminSetUserPassword -> Text
userPoolId} -> Text
userPoolId) (\s :: AdminSetUserPassword
s@AdminSetUserPassword' {} Text
a -> AdminSetUserPassword
s {$sel:userPoolId:AdminSetUserPassword' :: Text
userPoolId = Text
a} :: AdminSetUserPassword)
adminSetUserPassword_username :: Lens.Lens' AdminSetUserPassword Prelude.Text
adminSetUserPassword_username :: Lens' AdminSetUserPassword Text
adminSetUserPassword_username = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserPassword' {Sensitive Text
username :: Sensitive Text
$sel:username:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
username} -> Sensitive Text
username) (\s :: AdminSetUserPassword
s@AdminSetUserPassword' {} Sensitive Text
a -> AdminSetUserPassword
s {$sel:username:AdminSetUserPassword' :: Sensitive Text
username = Sensitive Text
a} :: AdminSetUserPassword) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
adminSetUserPassword_password :: Lens.Lens' AdminSetUserPassword Prelude.Text
adminSetUserPassword_password :: Lens' AdminSetUserPassword Text
adminSetUserPassword_password = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserPassword' {Sensitive Text
password :: Sensitive Text
$sel:password:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
password} -> Sensitive Text
password) (\s :: AdminSetUserPassword
s@AdminSetUserPassword' {} Sensitive Text
a -> AdminSetUserPassword
s {$sel:password:AdminSetUserPassword' :: Sensitive Text
password = Sensitive Text
a} :: AdminSetUserPassword) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSRequest AdminSetUserPassword where
type
AWSResponse AdminSetUserPassword =
AdminSetUserPasswordResponse
request :: (Service -> Service)
-> AdminSetUserPassword -> Request AdminSetUserPassword
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 AdminSetUserPassword
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AdminSetUserPassword)))
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 -> AdminSetUserPasswordResponse
AdminSetUserPasswordResponse'
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 AdminSetUserPassword where
hashWithSalt :: Int -> AdminSetUserPassword -> Int
hashWithSalt Int
_salt AdminSetUserPassword' {Maybe Bool
Text
Sensitive Text
password :: Sensitive Text
username :: Sensitive Text
userPoolId :: Text
permanent :: Maybe Bool
$sel:password:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
$sel:username:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
$sel:userPoolId:AdminSetUserPassword' :: AdminSetUserPassword -> Text
$sel:permanent:AdminSetUserPassword' :: AdminSetUserPassword -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
permanent
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userPoolId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
username
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
password
instance Prelude.NFData AdminSetUserPassword where
rnf :: AdminSetUserPassword -> ()
rnf AdminSetUserPassword' {Maybe Bool
Text
Sensitive Text
password :: Sensitive Text
username :: Sensitive Text
userPoolId :: Text
permanent :: Maybe Bool
$sel:password:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
$sel:username:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
$sel:userPoolId:AdminSetUserPassword' :: AdminSetUserPassword -> Text
$sel:permanent:AdminSetUserPassword' :: AdminSetUserPassword -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
permanent
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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
password
instance Data.ToHeaders AdminSetUserPassword where
toHeaders :: AdminSetUserPassword -> 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.AdminSetUserPassword" ::
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 AdminSetUserPassword where
toJSON :: AdminSetUserPassword -> Value
toJSON AdminSetUserPassword' {Maybe Bool
Text
Sensitive Text
password :: Sensitive Text
username :: Sensitive Text
userPoolId :: Text
permanent :: Maybe Bool
$sel:password:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
$sel:username:AdminSetUserPassword' :: AdminSetUserPassword -> Sensitive Text
$sel:userPoolId:AdminSetUserPassword' :: AdminSetUserPassword -> Text
$sel:permanent:AdminSetUserPassword' :: AdminSetUserPassword -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Permanent" 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 Bool
permanent,
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),
forall a. a -> Maybe a
Prelude.Just (Key
"Password" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
password)
]
)
instance Data.ToPath AdminSetUserPassword where
toPath :: AdminSetUserPassword -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AdminSetUserPassword where
toQuery :: AdminSetUserPassword -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AdminSetUserPasswordResponse = AdminSetUserPasswordResponse'
{
AdminSetUserPasswordResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AdminSetUserPasswordResponse
-> AdminSetUserPasswordResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminSetUserPasswordResponse
-> AdminSetUserPasswordResponse -> Bool
$c/= :: AdminSetUserPasswordResponse
-> AdminSetUserPasswordResponse -> Bool
== :: AdminSetUserPasswordResponse
-> AdminSetUserPasswordResponse -> Bool
$c== :: AdminSetUserPasswordResponse
-> AdminSetUserPasswordResponse -> Bool
Prelude.Eq, ReadPrec [AdminSetUserPasswordResponse]
ReadPrec AdminSetUserPasswordResponse
Int -> ReadS AdminSetUserPasswordResponse
ReadS [AdminSetUserPasswordResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdminSetUserPasswordResponse]
$creadListPrec :: ReadPrec [AdminSetUserPasswordResponse]
readPrec :: ReadPrec AdminSetUserPasswordResponse
$creadPrec :: ReadPrec AdminSetUserPasswordResponse
readList :: ReadS [AdminSetUserPasswordResponse]
$creadList :: ReadS [AdminSetUserPasswordResponse]
readsPrec :: Int -> ReadS AdminSetUserPasswordResponse
$creadsPrec :: Int -> ReadS AdminSetUserPasswordResponse
Prelude.Read, Int -> AdminSetUserPasswordResponse -> ShowS
[AdminSetUserPasswordResponse] -> ShowS
AdminSetUserPasswordResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminSetUserPasswordResponse] -> ShowS
$cshowList :: [AdminSetUserPasswordResponse] -> ShowS
show :: AdminSetUserPasswordResponse -> String
$cshow :: AdminSetUserPasswordResponse -> String
showsPrec :: Int -> AdminSetUserPasswordResponse -> ShowS
$cshowsPrec :: Int -> AdminSetUserPasswordResponse -> ShowS
Prelude.Show, forall x.
Rep AdminSetUserPasswordResponse x -> AdminSetUserPasswordResponse
forall x.
AdminSetUserPasswordResponse -> Rep AdminSetUserPasswordResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdminSetUserPasswordResponse x -> AdminSetUserPasswordResponse
$cfrom :: forall x.
AdminSetUserPasswordResponse -> Rep AdminSetUserPasswordResponse x
Prelude.Generic)
newAdminSetUserPasswordResponse ::
Prelude.Int ->
AdminSetUserPasswordResponse
newAdminSetUserPasswordResponse :: Int -> AdminSetUserPasswordResponse
newAdminSetUserPasswordResponse Int
pHttpStatus_ =
AdminSetUserPasswordResponse'
{ $sel:httpStatus:AdminSetUserPasswordResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
adminSetUserPasswordResponse_httpStatus :: Lens.Lens' AdminSetUserPasswordResponse Prelude.Int
adminSetUserPasswordResponse_httpStatus :: Lens' AdminSetUserPasswordResponse Int
adminSetUserPasswordResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserPasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminSetUserPasswordResponse' :: AdminSetUserPasswordResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AdminSetUserPasswordResponse
s@AdminSetUserPasswordResponse' {} Int
a -> AdminSetUserPasswordResponse
s {$sel:httpStatus:AdminSetUserPasswordResponse' :: Int
httpStatus = Int
a} :: AdminSetUserPasswordResponse)
instance Prelude.NFData AdminSetUserPasswordResponse where
rnf :: AdminSetUserPasswordResponse -> ()
rnf AdminSetUserPasswordResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminSetUserPasswordResponse' :: AdminSetUserPasswordResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus