{-# 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.SetUserSettings
(
SetUserSettings (..),
newSetUserSettings,
setUserSettings_accessToken,
setUserSettings_mfaOptions,
SetUserSettingsResponse (..),
newSetUserSettingsResponse,
setUserSettingsResponse_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 SetUserSettings = SetUserSettings'
{
SetUserSettings -> Sensitive Text
accessToken :: Core.Sensitive Prelude.Text,
SetUserSettings -> [MFAOptionType]
mfaOptions :: [MFAOptionType]
}
deriving (SetUserSettings -> SetUserSettings -> Bool
(SetUserSettings -> SetUserSettings -> Bool)
-> (SetUserSettings -> SetUserSettings -> Bool)
-> Eq SetUserSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetUserSettings -> SetUserSettings -> Bool
$c/= :: SetUserSettings -> SetUserSettings -> Bool
== :: SetUserSettings -> SetUserSettings -> Bool
$c== :: SetUserSettings -> SetUserSettings -> Bool
Prelude.Eq, Int -> SetUserSettings -> ShowS
[SetUserSettings] -> ShowS
SetUserSettings -> String
(Int -> SetUserSettings -> ShowS)
-> (SetUserSettings -> String)
-> ([SetUserSettings] -> ShowS)
-> Show SetUserSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetUserSettings] -> ShowS
$cshowList :: [SetUserSettings] -> ShowS
show :: SetUserSettings -> String
$cshow :: SetUserSettings -> String
showsPrec :: Int -> SetUserSettings -> ShowS
$cshowsPrec :: Int -> SetUserSettings -> ShowS
Prelude.Show, (forall x. SetUserSettings -> Rep SetUserSettings x)
-> (forall x. Rep SetUserSettings x -> SetUserSettings)
-> Generic SetUserSettings
forall x. Rep SetUserSettings x -> SetUserSettings
forall x. SetUserSettings -> Rep SetUserSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetUserSettings x -> SetUserSettings
$cfrom :: forall x. SetUserSettings -> Rep SetUserSettings x
Prelude.Generic)
newSetUserSettings ::
Prelude.Text ->
SetUserSettings
newSetUserSettings :: Text -> SetUserSettings
newSetUserSettings Text
pAccessToken_ =
SetUserSettings' :: Sensitive Text -> [MFAOptionType] -> SetUserSettings
SetUserSettings'
{ $sel:accessToken:SetUserSettings' :: 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_,
$sel:mfaOptions:SetUserSettings' :: [MFAOptionType]
mfaOptions = [MFAOptionType]
forall a. Monoid a => a
Prelude.mempty
}
setUserSettings_accessToken :: Lens.Lens' SetUserSettings Prelude.Text
setUserSettings_accessToken :: (Text -> f Text) -> SetUserSettings -> f SetUserSettings
setUserSettings_accessToken = (SetUserSettings -> Sensitive Text)
-> (SetUserSettings -> Sensitive Text -> SetUserSettings)
-> Lens
SetUserSettings SetUserSettings (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserSettings' {Sensitive Text
accessToken :: Sensitive Text
$sel:accessToken:SetUserSettings' :: SetUserSettings -> Sensitive Text
accessToken} -> Sensitive Text
accessToken) (\s :: SetUserSettings
s@SetUserSettings' {} Sensitive Text
a -> SetUserSettings
s {$sel:accessToken:SetUserSettings' :: Sensitive Text
accessToken = Sensitive Text
a} :: SetUserSettings) ((Sensitive Text -> f (Sensitive Text))
-> SetUserSettings -> f SetUserSettings)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> SetUserSettings
-> f SetUserSettings
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
setUserSettings_mfaOptions :: Lens.Lens' SetUserSettings [MFAOptionType]
setUserSettings_mfaOptions :: ([MFAOptionType] -> f [MFAOptionType])
-> SetUserSettings -> f SetUserSettings
setUserSettings_mfaOptions = (SetUserSettings -> [MFAOptionType])
-> (SetUserSettings -> [MFAOptionType] -> SetUserSettings)
-> Lens
SetUserSettings SetUserSettings [MFAOptionType] [MFAOptionType]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserSettings' {[MFAOptionType]
mfaOptions :: [MFAOptionType]
$sel:mfaOptions:SetUserSettings' :: SetUserSettings -> [MFAOptionType]
mfaOptions} -> [MFAOptionType]
mfaOptions) (\s :: SetUserSettings
s@SetUserSettings' {} [MFAOptionType]
a -> SetUserSettings
s {$sel:mfaOptions:SetUserSettings' :: [MFAOptionType]
mfaOptions = [MFAOptionType]
a} :: SetUserSettings) (([MFAOptionType] -> f [MFAOptionType])
-> SetUserSettings -> f SetUserSettings)
-> (([MFAOptionType] -> f [MFAOptionType])
-> [MFAOptionType] -> f [MFAOptionType])
-> ([MFAOptionType] -> f [MFAOptionType])
-> SetUserSettings
-> f SetUserSettings
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 SetUserSettings where
type
AWSResponse SetUserSettings =
SetUserSettingsResponse
request :: SetUserSettings -> Request SetUserSettings
request = Service -> SetUserSettings -> Request SetUserSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SetUserSettings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SetUserSettings)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse SetUserSettings))
-> Logger
-> Service
-> Proxy SetUserSettings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SetUserSettings)))
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 -> SetUserSettingsResponse
SetUserSettingsResponse'
(Int -> SetUserSettingsResponse)
-> Either String Int -> Either String SetUserSettingsResponse
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 SetUserSettings
instance Prelude.NFData SetUserSettings
instance Core.ToHeaders SetUserSettings where
toHeaders :: SetUserSettings -> ResponseHeaders
toHeaders =
ResponseHeaders -> SetUserSettings -> 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.SetUserSettings" ::
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 SetUserSettings where
toJSON :: SetUserSettings -> Value
toJSON SetUserSettings' {[MFAOptionType]
Sensitive Text
mfaOptions :: [MFAOptionType]
accessToken :: Sensitive Text
$sel:mfaOptions:SetUserSettings' :: SetUserSettings -> [MFAOptionType]
$sel:accessToken:SetUserSettings' :: SetUserSettings -> Sensitive 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
"AccessToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
accessToken),
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 SetUserSettings where
toPath :: SetUserSettings -> ByteString
toPath = ByteString -> SetUserSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SetUserSettings where
toQuery :: SetUserSettings -> QueryString
toQuery = QueryString -> SetUserSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SetUserSettingsResponse = SetUserSettingsResponse'
{
SetUserSettingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SetUserSettingsResponse -> SetUserSettingsResponse -> Bool
(SetUserSettingsResponse -> SetUserSettingsResponse -> Bool)
-> (SetUserSettingsResponse -> SetUserSettingsResponse -> Bool)
-> Eq SetUserSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetUserSettingsResponse -> SetUserSettingsResponse -> Bool
$c/= :: SetUserSettingsResponse -> SetUserSettingsResponse -> Bool
== :: SetUserSettingsResponse -> SetUserSettingsResponse -> Bool
$c== :: SetUserSettingsResponse -> SetUserSettingsResponse -> Bool
Prelude.Eq, ReadPrec [SetUserSettingsResponse]
ReadPrec SetUserSettingsResponse
Int -> ReadS SetUserSettingsResponse
ReadS [SetUserSettingsResponse]
(Int -> ReadS SetUserSettingsResponse)
-> ReadS [SetUserSettingsResponse]
-> ReadPrec SetUserSettingsResponse
-> ReadPrec [SetUserSettingsResponse]
-> Read SetUserSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetUserSettingsResponse]
$creadListPrec :: ReadPrec [SetUserSettingsResponse]
readPrec :: ReadPrec SetUserSettingsResponse
$creadPrec :: ReadPrec SetUserSettingsResponse
readList :: ReadS [SetUserSettingsResponse]
$creadList :: ReadS [SetUserSettingsResponse]
readsPrec :: Int -> ReadS SetUserSettingsResponse
$creadsPrec :: Int -> ReadS SetUserSettingsResponse
Prelude.Read, Int -> SetUserSettingsResponse -> ShowS
[SetUserSettingsResponse] -> ShowS
SetUserSettingsResponse -> String
(Int -> SetUserSettingsResponse -> ShowS)
-> (SetUserSettingsResponse -> String)
-> ([SetUserSettingsResponse] -> ShowS)
-> Show SetUserSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetUserSettingsResponse] -> ShowS
$cshowList :: [SetUserSettingsResponse] -> ShowS
show :: SetUserSettingsResponse -> String
$cshow :: SetUserSettingsResponse -> String
showsPrec :: Int -> SetUserSettingsResponse -> ShowS
$cshowsPrec :: Int -> SetUserSettingsResponse -> ShowS
Prelude.Show, (forall x.
SetUserSettingsResponse -> Rep SetUserSettingsResponse x)
-> (forall x.
Rep SetUserSettingsResponse x -> SetUserSettingsResponse)
-> Generic SetUserSettingsResponse
forall x. Rep SetUserSettingsResponse x -> SetUserSettingsResponse
forall x. SetUserSettingsResponse -> Rep SetUserSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetUserSettingsResponse x -> SetUserSettingsResponse
$cfrom :: forall x. SetUserSettingsResponse -> Rep SetUserSettingsResponse x
Prelude.Generic)
newSetUserSettingsResponse ::
Prelude.Int ->
SetUserSettingsResponse
newSetUserSettingsResponse :: Int -> SetUserSettingsResponse
newSetUserSettingsResponse Int
pHttpStatus_ =
SetUserSettingsResponse' :: Int -> SetUserSettingsResponse
SetUserSettingsResponse' {$sel:httpStatus:SetUserSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_}
setUserSettingsResponse_httpStatus :: Lens.Lens' SetUserSettingsResponse Prelude.Int
setUserSettingsResponse_httpStatus :: (Int -> f Int)
-> SetUserSettingsResponse -> f SetUserSettingsResponse
setUserSettingsResponse_httpStatus = (SetUserSettingsResponse -> Int)
-> (SetUserSettingsResponse -> Int -> SetUserSettingsResponse)
-> Lens SetUserSettingsResponse SetUserSettingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetUserSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetUserSettingsResponse' :: SetUserSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetUserSettingsResponse
s@SetUserSettingsResponse' {} Int
a -> SetUserSettingsResponse
s {$sel:httpStatus:SetUserSettingsResponse' :: Int
httpStatus = Int
a} :: SetUserSettingsResponse)
instance Prelude.NFData SetUserSettingsResponse