{-# 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.UpdateUserAttributes
(
UpdateUserAttributes (..),
newUpdateUserAttributes,
updateUserAttributes_clientMetadata,
updateUserAttributes_userAttributes,
updateUserAttributes_accessToken,
UpdateUserAttributesResponse (..),
newUpdateUserAttributesResponse,
updateUserAttributesResponse_codeDeliveryDetailsList,
updateUserAttributesResponse_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 UpdateUserAttributes = UpdateUserAttributes'
{
UpdateUserAttributes -> Maybe (HashMap Text Text)
clientMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
UpdateUserAttributes -> [AttributeType]
userAttributes :: [AttributeType],
UpdateUserAttributes -> Sensitive Text
accessToken :: Data.Sensitive Prelude.Text
}
deriving (UpdateUserAttributes -> UpdateUserAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserAttributes -> UpdateUserAttributes -> Bool
$c/= :: UpdateUserAttributes -> UpdateUserAttributes -> Bool
== :: UpdateUserAttributes -> UpdateUserAttributes -> Bool
$c== :: UpdateUserAttributes -> UpdateUserAttributes -> Bool
Prelude.Eq, Int -> UpdateUserAttributes -> ShowS
[UpdateUserAttributes] -> ShowS
UpdateUserAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserAttributes] -> ShowS
$cshowList :: [UpdateUserAttributes] -> ShowS
show :: UpdateUserAttributes -> String
$cshow :: UpdateUserAttributes -> String
showsPrec :: Int -> UpdateUserAttributes -> ShowS
$cshowsPrec :: Int -> UpdateUserAttributes -> ShowS
Prelude.Show, forall x. Rep UpdateUserAttributes x -> UpdateUserAttributes
forall x. UpdateUserAttributes -> Rep UpdateUserAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUserAttributes x -> UpdateUserAttributes
$cfrom :: forall x. UpdateUserAttributes -> Rep UpdateUserAttributes x
Prelude.Generic)
newUpdateUserAttributes ::
Prelude.Text ->
UpdateUserAttributes
newUpdateUserAttributes :: Text -> UpdateUserAttributes
newUpdateUserAttributes Text
pAccessToken_ =
UpdateUserAttributes'
{ $sel:clientMetadata:UpdateUserAttributes' :: Maybe (HashMap Text Text)
clientMetadata =
forall a. Maybe a
Prelude.Nothing,
$sel:userAttributes:UpdateUserAttributes' :: [AttributeType]
userAttributes = forall a. Monoid a => a
Prelude.mempty,
$sel:accessToken:UpdateUserAttributes' :: Sensitive Text
accessToken = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pAccessToken_
}
updateUserAttributes_clientMetadata :: Lens.Lens' UpdateUserAttributes (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
updateUserAttributes_clientMetadata :: Lens' UpdateUserAttributes (Maybe (HashMap Text Text))
updateUserAttributes_clientMetadata = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserAttributes' {Maybe (HashMap Text Text)
clientMetadata :: Maybe (HashMap Text Text)
$sel:clientMetadata:UpdateUserAttributes' :: UpdateUserAttributes -> Maybe (HashMap Text Text)
clientMetadata} -> Maybe (HashMap Text Text)
clientMetadata) (\s :: UpdateUserAttributes
s@UpdateUserAttributes' {} Maybe (HashMap Text Text)
a -> UpdateUserAttributes
s {$sel:clientMetadata:UpdateUserAttributes' :: Maybe (HashMap Text Text)
clientMetadata = Maybe (HashMap Text Text)
a} :: UpdateUserAttributes) 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
updateUserAttributes_userAttributes :: Lens.Lens' UpdateUserAttributes [AttributeType]
updateUserAttributes_userAttributes :: Lens' UpdateUserAttributes [AttributeType]
updateUserAttributes_userAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserAttributes' {[AttributeType]
userAttributes :: [AttributeType]
$sel:userAttributes:UpdateUserAttributes' :: UpdateUserAttributes -> [AttributeType]
userAttributes} -> [AttributeType]
userAttributes) (\s :: UpdateUserAttributes
s@UpdateUserAttributes' {} [AttributeType]
a -> UpdateUserAttributes
s {$sel:userAttributes:UpdateUserAttributes' :: [AttributeType]
userAttributes = [AttributeType]
a} :: UpdateUserAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateUserAttributes_accessToken :: Lens.Lens' UpdateUserAttributes Prelude.Text
updateUserAttributes_accessToken :: Lens' UpdateUserAttributes Text
updateUserAttributes_accessToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserAttributes' {Sensitive Text
accessToken :: Sensitive Text
$sel:accessToken:UpdateUserAttributes' :: UpdateUserAttributes -> Sensitive Text
accessToken} -> Sensitive Text
accessToken) (\s :: UpdateUserAttributes
s@UpdateUserAttributes' {} Sensitive Text
a -> UpdateUserAttributes
s {$sel:accessToken:UpdateUserAttributes' :: Sensitive Text
accessToken = Sensitive Text
a} :: UpdateUserAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSRequest UpdateUserAttributes where
type
AWSResponse UpdateUserAttributes =
UpdateUserAttributesResponse
request :: (Service -> Service)
-> UpdateUserAttributes -> Request UpdateUserAttributes
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 UpdateUserAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateUserAttributes)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [CodeDeliveryDetailsType]
-> Int -> UpdateUserAttributesResponse
UpdateUserAttributesResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CodeDeliveryDetailsList"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => 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 UpdateUserAttributes where
hashWithSalt :: Int -> UpdateUserAttributes -> Int
hashWithSalt Int
_salt UpdateUserAttributes' {[AttributeType]
Maybe (HashMap Text Text)
Sensitive Text
accessToken :: Sensitive Text
userAttributes :: [AttributeType]
clientMetadata :: Maybe (HashMap Text Text)
$sel:accessToken:UpdateUserAttributes' :: UpdateUserAttributes -> Sensitive Text
$sel:userAttributes:UpdateUserAttributes' :: UpdateUserAttributes -> [AttributeType]
$sel:clientMetadata:UpdateUserAttributes' :: UpdateUserAttributes -> 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` [AttributeType]
userAttributes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
accessToken
instance Prelude.NFData UpdateUserAttributes where
rnf :: UpdateUserAttributes -> ()
rnf UpdateUserAttributes' {[AttributeType]
Maybe (HashMap Text Text)
Sensitive Text
accessToken :: Sensitive Text
userAttributes :: [AttributeType]
clientMetadata :: Maybe (HashMap Text Text)
$sel:accessToken:UpdateUserAttributes' :: UpdateUserAttributes -> Sensitive Text
$sel:userAttributes:UpdateUserAttributes' :: UpdateUserAttributes -> [AttributeType]
$sel:clientMetadata:UpdateUserAttributes' :: UpdateUserAttributes -> 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 [AttributeType]
userAttributes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
accessToken
instance Data.ToHeaders UpdateUserAttributes where
toHeaders :: UpdateUserAttributes -> 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.UpdateUserAttributes" ::
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 UpdateUserAttributes where
toJSON :: UpdateUserAttributes -> Value
toJSON UpdateUserAttributes' {[AttributeType]
Maybe (HashMap Text Text)
Sensitive Text
accessToken :: Sensitive Text
userAttributes :: [AttributeType]
clientMetadata :: Maybe (HashMap Text Text)
$sel:accessToken:UpdateUserAttributes' :: UpdateUserAttributes -> Sensitive Text
$sel:userAttributes:UpdateUserAttributes' :: UpdateUserAttributes -> [AttributeType]
$sel:clientMetadata:UpdateUserAttributes' :: UpdateUserAttributes -> 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
"UserAttributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [AttributeType]
userAttributes),
forall a. a -> Maybe a
Prelude.Just (Key
"AccessToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
accessToken)
]
)
instance Data.ToPath UpdateUserAttributes where
toPath :: UpdateUserAttributes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateUserAttributes where
toQuery :: UpdateUserAttributes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateUserAttributesResponse = UpdateUserAttributesResponse'
{
UpdateUserAttributesResponse -> Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList :: Prelude.Maybe [CodeDeliveryDetailsType],
UpdateUserAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateUserAttributesResponse
-> UpdateUserAttributesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserAttributesResponse
-> UpdateUserAttributesResponse -> Bool
$c/= :: UpdateUserAttributesResponse
-> UpdateUserAttributesResponse -> Bool
== :: UpdateUserAttributesResponse
-> UpdateUserAttributesResponse -> Bool
$c== :: UpdateUserAttributesResponse
-> UpdateUserAttributesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateUserAttributesResponse]
ReadPrec UpdateUserAttributesResponse
Int -> ReadS UpdateUserAttributesResponse
ReadS [UpdateUserAttributesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserAttributesResponse]
$creadListPrec :: ReadPrec [UpdateUserAttributesResponse]
readPrec :: ReadPrec UpdateUserAttributesResponse
$creadPrec :: ReadPrec UpdateUserAttributesResponse
readList :: ReadS [UpdateUserAttributesResponse]
$creadList :: ReadS [UpdateUserAttributesResponse]
readsPrec :: Int -> ReadS UpdateUserAttributesResponse
$creadsPrec :: Int -> ReadS UpdateUserAttributesResponse
Prelude.Read, Int -> UpdateUserAttributesResponse -> ShowS
[UpdateUserAttributesResponse] -> ShowS
UpdateUserAttributesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserAttributesResponse] -> ShowS
$cshowList :: [UpdateUserAttributesResponse] -> ShowS
show :: UpdateUserAttributesResponse -> String
$cshow :: UpdateUserAttributesResponse -> String
showsPrec :: Int -> UpdateUserAttributesResponse -> ShowS
$cshowsPrec :: Int -> UpdateUserAttributesResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateUserAttributesResponse x -> UpdateUserAttributesResponse
forall x.
UpdateUserAttributesResponse -> Rep UpdateUserAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateUserAttributesResponse x -> UpdateUserAttributesResponse
$cfrom :: forall x.
UpdateUserAttributesResponse -> Rep UpdateUserAttributesResponse x
Prelude.Generic)
newUpdateUserAttributesResponse ::
Prelude.Int ->
UpdateUserAttributesResponse
newUpdateUserAttributesResponse :: Int -> UpdateUserAttributesResponse
newUpdateUserAttributesResponse Int
pHttpStatus_ =
UpdateUserAttributesResponse'
{ $sel:codeDeliveryDetailsList:UpdateUserAttributesResponse' :: Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateUserAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateUserAttributesResponse_codeDeliveryDetailsList :: Lens.Lens' UpdateUserAttributesResponse (Prelude.Maybe [CodeDeliveryDetailsType])
updateUserAttributesResponse_codeDeliveryDetailsList :: Lens'
UpdateUserAttributesResponse (Maybe [CodeDeliveryDetailsType])
updateUserAttributesResponse_codeDeliveryDetailsList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserAttributesResponse' {Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList :: Maybe [CodeDeliveryDetailsType]
$sel:codeDeliveryDetailsList:UpdateUserAttributesResponse' :: UpdateUserAttributesResponse -> Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList} -> Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList) (\s :: UpdateUserAttributesResponse
s@UpdateUserAttributesResponse' {} Maybe [CodeDeliveryDetailsType]
a -> UpdateUserAttributesResponse
s {$sel:codeDeliveryDetailsList:UpdateUserAttributesResponse' :: Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList = Maybe [CodeDeliveryDetailsType]
a} :: UpdateUserAttributesResponse) 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
updateUserAttributesResponse_httpStatus :: Lens.Lens' UpdateUserAttributesResponse Prelude.Int
updateUserAttributesResponse_httpStatus :: Lens' UpdateUserAttributesResponse Int
updateUserAttributesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateUserAttributesResponse' :: UpdateUserAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateUserAttributesResponse
s@UpdateUserAttributesResponse' {} Int
a -> UpdateUserAttributesResponse
s {$sel:httpStatus:UpdateUserAttributesResponse' :: Int
httpStatus = Int
a} :: UpdateUserAttributesResponse)
instance Prelude.NFData UpdateUserAttributesResponse where
rnf :: UpdateUserAttributesResponse -> ()
rnf UpdateUserAttributesResponse' {Int
Maybe [CodeDeliveryDetailsType]
httpStatus :: Int
codeDeliveryDetailsList :: Maybe [CodeDeliveryDetailsType]
$sel:httpStatus:UpdateUserAttributesResponse' :: UpdateUserAttributesResponse -> Int
$sel:codeDeliveryDetailsList:UpdateUserAttributesResponse' :: UpdateUserAttributesResponse -> Maybe [CodeDeliveryDetailsType]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CodeDeliveryDetailsType]
codeDeliveryDetailsList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus