{-# 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.SetUserMFAPreference
(
SetUserMFAPreference (..),
newSetUserMFAPreference,
setUserMFAPreference_sMSMfaSettings,
setUserMFAPreference_softwareTokenMfaSettings,
setUserMFAPreference_accessToken,
SetUserMFAPreferenceResponse (..),
newSetUserMFAPreferenceResponse,
setUserMFAPreferenceResponse_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 SetUserMFAPreference = SetUserMFAPreference'
{
SetUserMFAPreference -> Maybe SMSMfaSettingsType
sMSMfaSettings :: Prelude.Maybe SMSMfaSettingsType,
SetUserMFAPreference -> Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings :: Prelude.Maybe SoftwareTokenMfaSettingsType,
SetUserMFAPreference -> Sensitive Text
accessToken :: Core.Sensitive Prelude.Text
}
deriving (SetUserMFAPreference -> SetUserMFAPreference -> Bool
(SetUserMFAPreference -> SetUserMFAPreference -> Bool)
-> (SetUserMFAPreference -> SetUserMFAPreference -> Bool)
-> Eq SetUserMFAPreference
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetUserMFAPreference -> SetUserMFAPreference -> Bool
$c/= :: SetUserMFAPreference -> SetUserMFAPreference -> Bool
== :: SetUserMFAPreference -> SetUserMFAPreference -> Bool
$c== :: SetUserMFAPreference -> SetUserMFAPreference -> Bool
Prelude.Eq, Int -> SetUserMFAPreference -> ShowS
[SetUserMFAPreference] -> ShowS
SetUserMFAPreference -> String
(Int -> SetUserMFAPreference -> ShowS)
-> (SetUserMFAPreference -> String)
-> ([SetUserMFAPreference] -> ShowS)
-> Show SetUserMFAPreference
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetUserMFAPreference] -> ShowS
$cshowList :: [SetUserMFAPreference] -> ShowS
show :: SetUserMFAPreference -> String
$cshow :: SetUserMFAPreference -> String
showsPrec :: Int -> SetUserMFAPreference -> ShowS
$cshowsPrec :: Int -> SetUserMFAPreference -> ShowS
Prelude.Show, (forall x. SetUserMFAPreference -> Rep SetUserMFAPreference x)
-> (forall x. Rep SetUserMFAPreference x -> SetUserMFAPreference)
-> Generic SetUserMFAPreference
forall x. Rep SetUserMFAPreference x -> SetUserMFAPreference
forall x. SetUserMFAPreference -> Rep SetUserMFAPreference x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetUserMFAPreference x -> SetUserMFAPreference
$cfrom :: forall x. SetUserMFAPreference -> Rep SetUserMFAPreference x
Prelude.Generic)
newSetUserMFAPreference ::
Prelude.Text ->
SetUserMFAPreference
newSetUserMFAPreference :: Text -> SetUserMFAPreference
newSetUserMFAPreference Text
pAccessToken_ =
SetUserMFAPreference' :: Maybe SMSMfaSettingsType
-> Maybe SoftwareTokenMfaSettingsType
-> Sensitive Text
-> SetUserMFAPreference
SetUserMFAPreference'
{ $sel:sMSMfaSettings:SetUserMFAPreference' :: Maybe SMSMfaSettingsType
sMSMfaSettings =
Maybe SMSMfaSettingsType
forall a. Maybe a
Prelude.Nothing,
$sel:softwareTokenMfaSettings:SetUserMFAPreference' :: Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings = Maybe SoftwareTokenMfaSettingsType
forall a. Maybe a
Prelude.Nothing,
$sel:accessToken:SetUserMFAPreference' :: Sensitive Text
accessToken = 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
pAccessToken_
}
setUserMFAPreference_sMSMfaSettings :: Lens.Lens' SetUserMFAPreference (Prelude.Maybe SMSMfaSettingsType)
setUserMFAPreference_sMSMfaSettings :: (Maybe SMSMfaSettingsType -> f (Maybe SMSMfaSettingsType))
-> SetUserMFAPreference -> f SetUserMFAPreference
setUserMFAPreference_sMSMfaSettings = (SetUserMFAPreference -> Maybe SMSMfaSettingsType)
-> (SetUserMFAPreference
-> Maybe SMSMfaSettingsType -> SetUserMFAPreference)
-> Lens
SetUserMFAPreference
SetUserMFAPreference
(Maybe SMSMfaSettingsType)
(Maybe SMSMfaSettingsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserMFAPreference' {Maybe SMSMfaSettingsType
sMSMfaSettings :: Maybe SMSMfaSettingsType
$sel:sMSMfaSettings:SetUserMFAPreference' :: SetUserMFAPreference -> Maybe SMSMfaSettingsType
sMSMfaSettings} -> Maybe SMSMfaSettingsType
sMSMfaSettings) (\s :: SetUserMFAPreference
s@SetUserMFAPreference' {} Maybe SMSMfaSettingsType
a -> SetUserMFAPreference
s {$sel:sMSMfaSettings:SetUserMFAPreference' :: Maybe SMSMfaSettingsType
sMSMfaSettings = Maybe SMSMfaSettingsType
a} :: SetUserMFAPreference)
setUserMFAPreference_softwareTokenMfaSettings :: Lens.Lens' SetUserMFAPreference (Prelude.Maybe SoftwareTokenMfaSettingsType)
setUserMFAPreference_softwareTokenMfaSettings :: (Maybe SoftwareTokenMfaSettingsType
-> f (Maybe SoftwareTokenMfaSettingsType))
-> SetUserMFAPreference -> f SetUserMFAPreference
setUserMFAPreference_softwareTokenMfaSettings = (SetUserMFAPreference -> Maybe SoftwareTokenMfaSettingsType)
-> (SetUserMFAPreference
-> Maybe SoftwareTokenMfaSettingsType -> SetUserMFAPreference)
-> Lens
SetUserMFAPreference
SetUserMFAPreference
(Maybe SoftwareTokenMfaSettingsType)
(Maybe SoftwareTokenMfaSettingsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserMFAPreference' {Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings :: Maybe SoftwareTokenMfaSettingsType
$sel:softwareTokenMfaSettings:SetUserMFAPreference' :: SetUserMFAPreference -> Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings} -> Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings) (\s :: SetUserMFAPreference
s@SetUserMFAPreference' {} Maybe SoftwareTokenMfaSettingsType
a -> SetUserMFAPreference
s {$sel:softwareTokenMfaSettings:SetUserMFAPreference' :: Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings = Maybe SoftwareTokenMfaSettingsType
a} :: SetUserMFAPreference)
setUserMFAPreference_accessToken :: Lens.Lens' SetUserMFAPreference Prelude.Text
setUserMFAPreference_accessToken :: (Text -> f Text) -> SetUserMFAPreference -> f SetUserMFAPreference
setUserMFAPreference_accessToken = (SetUserMFAPreference -> Sensitive Text)
-> (SetUserMFAPreference -> Sensitive Text -> SetUserMFAPreference)
-> Lens
SetUserMFAPreference
SetUserMFAPreference
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserMFAPreference' {Sensitive Text
accessToken :: Sensitive Text
$sel:accessToken:SetUserMFAPreference' :: SetUserMFAPreference -> Sensitive Text
accessToken} -> Sensitive Text
accessToken) (\s :: SetUserMFAPreference
s@SetUserMFAPreference' {} Sensitive Text
a -> SetUserMFAPreference
s {$sel:accessToken:SetUserMFAPreference' :: Sensitive Text
accessToken = Sensitive Text
a} :: SetUserMFAPreference) ((Sensitive Text -> f (Sensitive Text))
-> SetUserMFAPreference -> f SetUserMFAPreference)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> SetUserMFAPreference
-> f SetUserMFAPreference
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 SetUserMFAPreference where
type
AWSResponse SetUserMFAPreference =
SetUserMFAPreferenceResponse
request :: SetUserMFAPreference -> Request SetUserMFAPreference
request = Service -> SetUserMFAPreference -> Request SetUserMFAPreference
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetUserMFAPreference
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetUserMFAPreference)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse SetUserMFAPreference))
-> Logger
-> Service
-> Proxy SetUserMFAPreference
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SetUserMFAPreference)))
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 -> SetUserMFAPreferenceResponse
SetUserMFAPreferenceResponse'
(Int -> SetUserMFAPreferenceResponse)
-> Either String Int -> Either String SetUserMFAPreferenceResponse
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 SetUserMFAPreference
instance Prelude.NFData SetUserMFAPreference
instance Core.ToHeaders SetUserMFAPreference where
toHeaders :: SetUserMFAPreference -> ResponseHeaders
toHeaders =
ResponseHeaders -> SetUserMFAPreference -> 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.SetUserMFAPreference" ::
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 SetUserMFAPreference where
toJSON :: SetUserMFAPreference -> Value
toJSON SetUserMFAPreference' {Maybe SMSMfaSettingsType
Maybe SoftwareTokenMfaSettingsType
Sensitive Text
accessToken :: Sensitive Text
softwareTokenMfaSettings :: Maybe SoftwareTokenMfaSettingsType
sMSMfaSettings :: Maybe SMSMfaSettingsType
$sel:accessToken:SetUserMFAPreference' :: SetUserMFAPreference -> Sensitive Text
$sel:softwareTokenMfaSettings:SetUserMFAPreference' :: SetUserMFAPreference -> Maybe SoftwareTokenMfaSettingsType
$sel:sMSMfaSettings:SetUserMFAPreference' :: SetUserMFAPreference -> Maybe SMSMfaSettingsType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SMSMfaSettings" Text -> SMSMfaSettingsType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SMSMfaSettingsType -> Pair)
-> Maybe SMSMfaSettingsType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SMSMfaSettingsType
sMSMfaSettings,
(Text
"SoftwareTokenMfaSettings" Text -> SoftwareTokenMfaSettingsType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SoftwareTokenMfaSettingsType -> Pair)
-> Maybe SoftwareTokenMfaSettingsType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SoftwareTokenMfaSettingsType
softwareTokenMfaSettings,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AccessToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
accessToken)
]
)
instance Core.ToPath SetUserMFAPreference where
toPath :: SetUserMFAPreference -> ByteString
toPath = ByteString -> SetUserMFAPreference -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SetUserMFAPreference where
toQuery :: SetUserMFAPreference -> QueryString
toQuery = QueryString -> SetUserMFAPreference -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetUserMFAPreferenceResponse = SetUserMFAPreferenceResponse'
{
SetUserMFAPreferenceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool
(SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool)
-> (SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool)
-> Eq SetUserMFAPreferenceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool
$c/= :: SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool
== :: SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool
$c== :: SetUserMFAPreferenceResponse
-> SetUserMFAPreferenceResponse -> Bool
Prelude.Eq, ReadPrec [SetUserMFAPreferenceResponse]
ReadPrec SetUserMFAPreferenceResponse
Int -> ReadS SetUserMFAPreferenceResponse
ReadS [SetUserMFAPreferenceResponse]
(Int -> ReadS SetUserMFAPreferenceResponse)
-> ReadS [SetUserMFAPreferenceResponse]
-> ReadPrec SetUserMFAPreferenceResponse
-> ReadPrec [SetUserMFAPreferenceResponse]
-> Read SetUserMFAPreferenceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetUserMFAPreferenceResponse]
$creadListPrec :: ReadPrec [SetUserMFAPreferenceResponse]
readPrec :: ReadPrec SetUserMFAPreferenceResponse
$creadPrec :: ReadPrec SetUserMFAPreferenceResponse
readList :: ReadS [SetUserMFAPreferenceResponse]
$creadList :: ReadS [SetUserMFAPreferenceResponse]
readsPrec :: Int -> ReadS SetUserMFAPreferenceResponse
$creadsPrec :: Int -> ReadS SetUserMFAPreferenceResponse
Prelude.Read, Int -> SetUserMFAPreferenceResponse -> ShowS
[SetUserMFAPreferenceResponse] -> ShowS
SetUserMFAPreferenceResponse -> String
(Int -> SetUserMFAPreferenceResponse -> ShowS)
-> (SetUserMFAPreferenceResponse -> String)
-> ([SetUserMFAPreferenceResponse] -> ShowS)
-> Show SetUserMFAPreferenceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetUserMFAPreferenceResponse] -> ShowS
$cshowList :: [SetUserMFAPreferenceResponse] -> ShowS
show :: SetUserMFAPreferenceResponse -> String
$cshow :: SetUserMFAPreferenceResponse -> String
showsPrec :: Int -> SetUserMFAPreferenceResponse -> ShowS
$cshowsPrec :: Int -> SetUserMFAPreferenceResponse -> ShowS
Prelude.Show, (forall x.
SetUserMFAPreferenceResponse -> Rep SetUserMFAPreferenceResponse x)
-> (forall x.
Rep SetUserMFAPreferenceResponse x -> SetUserMFAPreferenceResponse)
-> Generic SetUserMFAPreferenceResponse
forall x.
Rep SetUserMFAPreferenceResponse x -> SetUserMFAPreferenceResponse
forall x.
SetUserMFAPreferenceResponse -> Rep SetUserMFAPreferenceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetUserMFAPreferenceResponse x -> SetUserMFAPreferenceResponse
$cfrom :: forall x.
SetUserMFAPreferenceResponse -> Rep SetUserMFAPreferenceResponse x
Prelude.Generic)
newSetUserMFAPreferenceResponse ::
Prelude.Int ->
SetUserMFAPreferenceResponse
newSetUserMFAPreferenceResponse :: Int -> SetUserMFAPreferenceResponse
newSetUserMFAPreferenceResponse Int
pHttpStatus_ =
SetUserMFAPreferenceResponse' :: Int -> SetUserMFAPreferenceResponse
SetUserMFAPreferenceResponse'
{ $sel:httpStatus:SetUserMFAPreferenceResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
setUserMFAPreferenceResponse_httpStatus :: Lens.Lens' SetUserMFAPreferenceResponse Prelude.Int
setUserMFAPreferenceResponse_httpStatus :: (Int -> f Int)
-> SetUserMFAPreferenceResponse -> f SetUserMFAPreferenceResponse
setUserMFAPreferenceResponse_httpStatus = (SetUserMFAPreferenceResponse -> Int)
-> (SetUserMFAPreferenceResponse
-> Int -> SetUserMFAPreferenceResponse)
-> Lens
SetUserMFAPreferenceResponse SetUserMFAPreferenceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserMFAPreferenceResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetUserMFAPreferenceResponse' :: SetUserMFAPreferenceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetUserMFAPreferenceResponse
s@SetUserMFAPreferenceResponse' {} Int
a -> SetUserMFAPreferenceResponse
s {$sel:httpStatus:SetUserMFAPreferenceResponse' :: Int
httpStatus = Int
a} :: SetUserMFAPreferenceResponse)
instance Prelude.NFData SetUserMFAPreferenceResponse