{-# 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.AdminSetUserSettings
(
AdminSetUserSettings (..),
newAdminSetUserSettings,
adminSetUserSettings_userPoolId,
adminSetUserSettings_username,
adminSetUserSettings_mfaOptions,
AdminSetUserSettingsResponse (..),
newAdminSetUserSettingsResponse,
adminSetUserSettingsResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.Types
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
data AdminSetUserSettings = AdminSetUserSettings'
{
AdminSetUserSettings -> Text
userPoolId :: Prelude.Text,
AdminSetUserSettings -> Sensitive Text
username :: Core.Sensitive Prelude.Text,
AdminSetUserSettings -> [MFAOptionType]
mfaOptions :: [MFAOptionType]
}
deriving (AdminSetUserSettings -> AdminSetUserSettings -> Bool
(AdminSetUserSettings -> AdminSetUserSettings -> Bool)
-> (AdminSetUserSettings -> AdminSetUserSettings -> Bool)
-> Eq AdminSetUserSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminSetUserSettings -> AdminSetUserSettings -> Bool
$c/= :: AdminSetUserSettings -> AdminSetUserSettings -> Bool
== :: AdminSetUserSettings -> AdminSetUserSettings -> Bool
$c== :: AdminSetUserSettings -> AdminSetUserSettings -> Bool
Prelude.Eq, Int -> AdminSetUserSettings -> ShowS
[AdminSetUserSettings] -> ShowS
AdminSetUserSettings -> String
(Int -> AdminSetUserSettings -> ShowS)
-> (AdminSetUserSettings -> String)
-> ([AdminSetUserSettings] -> ShowS)
-> Show AdminSetUserSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminSetUserSettings] -> ShowS
$cshowList :: [AdminSetUserSettings] -> ShowS
show :: AdminSetUserSettings -> String
$cshow :: AdminSetUserSettings -> String
showsPrec :: Int -> AdminSetUserSettings -> ShowS
$cshowsPrec :: Int -> AdminSetUserSettings -> ShowS
Prelude.Show, (forall x. AdminSetUserSettings -> Rep AdminSetUserSettings x)
-> (forall x. Rep AdminSetUserSettings x -> AdminSetUserSettings)
-> Generic AdminSetUserSettings
forall x. Rep AdminSetUserSettings x -> AdminSetUserSettings
forall x. AdminSetUserSettings -> Rep AdminSetUserSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminSetUserSettings x -> AdminSetUserSettings
$cfrom :: forall x. AdminSetUserSettings -> Rep AdminSetUserSettings x
Prelude.Generic)
newAdminSetUserSettings ::
Prelude.Text ->
Prelude.Text ->
AdminSetUserSettings
newAdminSetUserSettings :: Text -> Text -> AdminSetUserSettings
newAdminSetUserSettings Text
pUserPoolId_ Text
pUsername_ =
AdminSetUserSettings' :: Text -> Sensitive Text -> [MFAOptionType] -> AdminSetUserSettings
AdminSetUserSettings'
{ $sel:userPoolId:AdminSetUserSettings' :: Text
userPoolId = Text
pUserPoolId_,
$sel:username:AdminSetUserSettings' :: Sensitive Text
username = 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
pUsername_,
$sel:mfaOptions:AdminSetUserSettings' :: [MFAOptionType]
mfaOptions = [MFAOptionType]
forall a. Monoid a => a
Prelude.mempty
}
adminSetUserSettings_userPoolId :: Lens.Lens' AdminSetUserSettings Prelude.Text
adminSetUserSettings_userPoolId :: (Text -> f Text) -> AdminSetUserSettings -> f AdminSetUserSettings
adminSetUserSettings_userPoolId = (AdminSetUserSettings -> Text)
-> (AdminSetUserSettings -> Text -> AdminSetUserSettings)
-> Lens AdminSetUserSettings AdminSetUserSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserSettings' {Text
userPoolId :: Text
$sel:userPoolId:AdminSetUserSettings' :: AdminSetUserSettings -> Text
userPoolId} -> Text
userPoolId) (\s :: AdminSetUserSettings
s@AdminSetUserSettings' {} Text
a -> AdminSetUserSettings
s {$sel:userPoolId:AdminSetUserSettings' :: Text
userPoolId = Text
a} :: AdminSetUserSettings)
adminSetUserSettings_username :: Lens.Lens' AdminSetUserSettings Prelude.Text
adminSetUserSettings_username :: (Text -> f Text) -> AdminSetUserSettings -> f AdminSetUserSettings
adminSetUserSettings_username = (AdminSetUserSettings -> Sensitive Text)
-> (AdminSetUserSettings -> Sensitive Text -> AdminSetUserSettings)
-> Lens
AdminSetUserSettings
AdminSetUserSettings
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserSettings' {Sensitive Text
username :: Sensitive Text
$sel:username:AdminSetUserSettings' :: AdminSetUserSettings -> Sensitive Text
username} -> Sensitive Text
username) (\s :: AdminSetUserSettings
s@AdminSetUserSettings' {} Sensitive Text
a -> AdminSetUserSettings
s {$sel:username:AdminSetUserSettings' :: Sensitive Text
username = Sensitive Text
a} :: AdminSetUserSettings) ((Sensitive Text -> f (Sensitive Text))
-> AdminSetUserSettings -> f AdminSetUserSettings)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> AdminSetUserSettings
-> f AdminSetUserSettings
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
adminSetUserSettings_mfaOptions :: Lens.Lens' AdminSetUserSettings [MFAOptionType]
adminSetUserSettings_mfaOptions :: ([MFAOptionType] -> f [MFAOptionType])
-> AdminSetUserSettings -> f AdminSetUserSettings
adminSetUserSettings_mfaOptions = (AdminSetUserSettings -> [MFAOptionType])
-> (AdminSetUserSettings
-> [MFAOptionType] -> AdminSetUserSettings)
-> Lens
AdminSetUserSettings
AdminSetUserSettings
[MFAOptionType]
[MFAOptionType]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserSettings' {[MFAOptionType]
mfaOptions :: [MFAOptionType]
$sel:mfaOptions:AdminSetUserSettings' :: AdminSetUserSettings -> [MFAOptionType]
mfaOptions} -> [MFAOptionType]
mfaOptions) (\s :: AdminSetUserSettings
s@AdminSetUserSettings' {} [MFAOptionType]
a -> AdminSetUserSettings
s {$sel:mfaOptions:AdminSetUserSettings' :: [MFAOptionType]
mfaOptions = [MFAOptionType]
a} :: AdminSetUserSettings) (([MFAOptionType] -> f [MFAOptionType])
-> AdminSetUserSettings -> f AdminSetUserSettings)
-> (([MFAOptionType] -> f [MFAOptionType])
-> [MFAOptionType] -> f [MFAOptionType])
-> ([MFAOptionType] -> f [MFAOptionType])
-> AdminSetUserSettings
-> f AdminSetUserSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MFAOptionType] -> f [MFAOptionType])
-> [MFAOptionType] -> f [MFAOptionType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AdminSetUserSettings where
type
AWSResponse AdminSetUserSettings =
AdminSetUserSettingsResponse
request :: AdminSetUserSettings -> Request AdminSetUserSettings
request = Service -> AdminSetUserSettings -> Request AdminSetUserSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AdminSetUserSettings
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AdminSetUserSettings)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AdminSetUserSettings))
-> Logger
-> Service
-> Proxy AdminSetUserSettings
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AdminSetUserSettings)))
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 -> AdminSetUserSettingsResponse
AdminSetUserSettingsResponse'
(Int -> AdminSetUserSettingsResponse)
-> Either String Int -> Either String AdminSetUserSettingsResponse
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 AdminSetUserSettings
instance Prelude.NFData AdminSetUserSettings
instance Core.ToHeaders AdminSetUserSettings where
toHeaders :: AdminSetUserSettings -> ResponseHeaders
toHeaders =
ResponseHeaders -> AdminSetUserSettings -> 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
"AWSCognitoIdentityProviderService.AdminSetUserSettings" ::
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 AdminSetUserSettings where
toJSON :: AdminSetUserSettings -> Value
toJSON AdminSetUserSettings' {[MFAOptionType]
Text
Sensitive Text
mfaOptions :: [MFAOptionType]
username :: Sensitive Text
userPoolId :: Text
$sel:mfaOptions:AdminSetUserSettings' :: AdminSetUserSettings -> [MFAOptionType]
$sel:username:AdminSetUserSettings' :: AdminSetUserSettings -> Sensitive Text
$sel:userPoolId:AdminSetUserSettings' :: AdminSetUserSettings -> 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
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
username),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MFAOptions" Text -> [MFAOptionType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [MFAOptionType]
mfaOptions)
]
)
instance Core.ToPath AdminSetUserSettings where
toPath :: AdminSetUserSettings -> ByteString
toPath = ByteString -> AdminSetUserSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AdminSetUserSettings where
toQuery :: AdminSetUserSettings -> QueryString
toQuery = QueryString -> AdminSetUserSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AdminSetUserSettingsResponse = AdminSetUserSettingsResponse'
{
AdminSetUserSettingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool
(AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool)
-> (AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool)
-> Eq AdminSetUserSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool
$c/= :: AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool
== :: AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool
$c== :: AdminSetUserSettingsResponse
-> AdminSetUserSettingsResponse -> Bool
Prelude.Eq, ReadPrec [AdminSetUserSettingsResponse]
ReadPrec AdminSetUserSettingsResponse
Int -> ReadS AdminSetUserSettingsResponse
ReadS [AdminSetUserSettingsResponse]
(Int -> ReadS AdminSetUserSettingsResponse)
-> ReadS [AdminSetUserSettingsResponse]
-> ReadPrec AdminSetUserSettingsResponse
-> ReadPrec [AdminSetUserSettingsResponse]
-> Read AdminSetUserSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdminSetUserSettingsResponse]
$creadListPrec :: ReadPrec [AdminSetUserSettingsResponse]
readPrec :: ReadPrec AdminSetUserSettingsResponse
$creadPrec :: ReadPrec AdminSetUserSettingsResponse
readList :: ReadS [AdminSetUserSettingsResponse]
$creadList :: ReadS [AdminSetUserSettingsResponse]
readsPrec :: Int -> ReadS AdminSetUserSettingsResponse
$creadsPrec :: Int -> ReadS AdminSetUserSettingsResponse
Prelude.Read, Int -> AdminSetUserSettingsResponse -> ShowS
[AdminSetUserSettingsResponse] -> ShowS
AdminSetUserSettingsResponse -> String
(Int -> AdminSetUserSettingsResponse -> ShowS)
-> (AdminSetUserSettingsResponse -> String)
-> ([AdminSetUserSettingsResponse] -> ShowS)
-> Show AdminSetUserSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminSetUserSettingsResponse] -> ShowS
$cshowList :: [AdminSetUserSettingsResponse] -> ShowS
show :: AdminSetUserSettingsResponse -> String
$cshow :: AdminSetUserSettingsResponse -> String
showsPrec :: Int -> AdminSetUserSettingsResponse -> ShowS
$cshowsPrec :: Int -> AdminSetUserSettingsResponse -> ShowS
Prelude.Show, (forall x.
AdminSetUserSettingsResponse -> Rep AdminSetUserSettingsResponse x)
-> (forall x.
Rep AdminSetUserSettingsResponse x -> AdminSetUserSettingsResponse)
-> Generic AdminSetUserSettingsResponse
forall x.
Rep AdminSetUserSettingsResponse x -> AdminSetUserSettingsResponse
forall x.
AdminSetUserSettingsResponse -> Rep AdminSetUserSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdminSetUserSettingsResponse x -> AdminSetUserSettingsResponse
$cfrom :: forall x.
AdminSetUserSettingsResponse -> Rep AdminSetUserSettingsResponse x
Prelude.Generic)
newAdminSetUserSettingsResponse ::
Prelude.Int ->
AdminSetUserSettingsResponse
newAdminSetUserSettingsResponse :: Int -> AdminSetUserSettingsResponse
newAdminSetUserSettingsResponse Int
pHttpStatus_ =
AdminSetUserSettingsResponse' :: Int -> AdminSetUserSettingsResponse
AdminSetUserSettingsResponse'
{ $sel:httpStatus:AdminSetUserSettingsResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
adminSetUserSettingsResponse_httpStatus :: Lens.Lens' AdminSetUserSettingsResponse Prelude.Int
adminSetUserSettingsResponse_httpStatus :: (Int -> f Int)
-> AdminSetUserSettingsResponse -> f AdminSetUserSettingsResponse
adminSetUserSettingsResponse_httpStatus = (AdminSetUserSettingsResponse -> Int)
-> (AdminSetUserSettingsResponse
-> Int -> AdminSetUserSettingsResponse)
-> Lens
AdminSetUserSettingsResponse AdminSetUserSettingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminSetUserSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminSetUserSettingsResponse' :: AdminSetUserSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AdminSetUserSettingsResponse
s@AdminSetUserSettingsResponse' {} Int
a -> AdminSetUserSettingsResponse
s {$sel:httpStatus:AdminSetUserSettingsResponse' :: Int
httpStatus = Int
a} :: AdminSetUserSettingsResponse)
instance Prelude.NFData AdminSetUserSettingsResponse