{-# 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.AddCustomAttributes
(
AddCustomAttributes (..),
newAddCustomAttributes,
addCustomAttributes_userPoolId,
addCustomAttributes_customAttributes,
AddCustomAttributesResponse (..),
newAddCustomAttributesResponse,
addCustomAttributesResponse_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 AddCustomAttributes = AddCustomAttributes'
{
AddCustomAttributes -> Text
userPoolId :: Prelude.Text,
AddCustomAttributes -> NonEmpty SchemaAttributeType
customAttributes :: Prelude.NonEmpty SchemaAttributeType
}
deriving (AddCustomAttributes -> AddCustomAttributes -> Bool
(AddCustomAttributes -> AddCustomAttributes -> Bool)
-> (AddCustomAttributes -> AddCustomAttributes -> Bool)
-> Eq AddCustomAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddCustomAttributes -> AddCustomAttributes -> Bool
$c/= :: AddCustomAttributes -> AddCustomAttributes -> Bool
== :: AddCustomAttributes -> AddCustomAttributes -> Bool
$c== :: AddCustomAttributes -> AddCustomAttributes -> Bool
Prelude.Eq, ReadPrec [AddCustomAttributes]
ReadPrec AddCustomAttributes
Int -> ReadS AddCustomAttributes
ReadS [AddCustomAttributes]
(Int -> ReadS AddCustomAttributes)
-> ReadS [AddCustomAttributes]
-> ReadPrec AddCustomAttributes
-> ReadPrec [AddCustomAttributes]
-> Read AddCustomAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddCustomAttributes]
$creadListPrec :: ReadPrec [AddCustomAttributes]
readPrec :: ReadPrec AddCustomAttributes
$creadPrec :: ReadPrec AddCustomAttributes
readList :: ReadS [AddCustomAttributes]
$creadList :: ReadS [AddCustomAttributes]
readsPrec :: Int -> ReadS AddCustomAttributes
$creadsPrec :: Int -> ReadS AddCustomAttributes
Prelude.Read, Int -> AddCustomAttributes -> ShowS
[AddCustomAttributes] -> ShowS
AddCustomAttributes -> String
(Int -> AddCustomAttributes -> ShowS)
-> (AddCustomAttributes -> String)
-> ([AddCustomAttributes] -> ShowS)
-> Show AddCustomAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddCustomAttributes] -> ShowS
$cshowList :: [AddCustomAttributes] -> ShowS
show :: AddCustomAttributes -> String
$cshow :: AddCustomAttributes -> String
showsPrec :: Int -> AddCustomAttributes -> ShowS
$cshowsPrec :: Int -> AddCustomAttributes -> ShowS
Prelude.Show, (forall x. AddCustomAttributes -> Rep AddCustomAttributes x)
-> (forall x. Rep AddCustomAttributes x -> AddCustomAttributes)
-> Generic AddCustomAttributes
forall x. Rep AddCustomAttributes x -> AddCustomAttributes
forall x. AddCustomAttributes -> Rep AddCustomAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddCustomAttributes x -> AddCustomAttributes
$cfrom :: forall x. AddCustomAttributes -> Rep AddCustomAttributes x
Prelude.Generic)
newAddCustomAttributes ::
Prelude.Text ->
Prelude.NonEmpty SchemaAttributeType ->
AddCustomAttributes
newAddCustomAttributes :: Text -> NonEmpty SchemaAttributeType -> AddCustomAttributes
newAddCustomAttributes
Text
pUserPoolId_
NonEmpty SchemaAttributeType
pCustomAttributes_ =
AddCustomAttributes' :: Text -> NonEmpty SchemaAttributeType -> AddCustomAttributes
AddCustomAttributes'
{ $sel:userPoolId:AddCustomAttributes' :: Text
userPoolId = Text
pUserPoolId_,
$sel:customAttributes:AddCustomAttributes' :: NonEmpty SchemaAttributeType
customAttributes =
Tagged
(NonEmpty SchemaAttributeType)
(Identity (NonEmpty SchemaAttributeType))
-> Tagged
(NonEmpty SchemaAttributeType)
(Identity (NonEmpty SchemaAttributeType))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty SchemaAttributeType)
(Identity (NonEmpty SchemaAttributeType))
-> Tagged
(NonEmpty SchemaAttributeType)
(Identity (NonEmpty SchemaAttributeType)))
-> NonEmpty SchemaAttributeType -> NonEmpty SchemaAttributeType
forall t b. AReview t b -> b -> t
Lens.# NonEmpty SchemaAttributeType
pCustomAttributes_
}
addCustomAttributes_userPoolId :: Lens.Lens' AddCustomAttributes Prelude.Text
addCustomAttributes_userPoolId :: (Text -> f Text) -> AddCustomAttributes -> f AddCustomAttributes
addCustomAttributes_userPoolId = (AddCustomAttributes -> Text)
-> (AddCustomAttributes -> Text -> AddCustomAttributes)
-> Lens AddCustomAttributes AddCustomAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddCustomAttributes' {Text
userPoolId :: Text
$sel:userPoolId:AddCustomAttributes' :: AddCustomAttributes -> Text
userPoolId} -> Text
userPoolId) (\s :: AddCustomAttributes
s@AddCustomAttributes' {} Text
a -> AddCustomAttributes
s {$sel:userPoolId:AddCustomAttributes' :: Text
userPoolId = Text
a} :: AddCustomAttributes)
addCustomAttributes_customAttributes :: Lens.Lens' AddCustomAttributes (Prelude.NonEmpty SchemaAttributeType)
addCustomAttributes_customAttributes :: (NonEmpty SchemaAttributeType -> f (NonEmpty SchemaAttributeType))
-> AddCustomAttributes -> f AddCustomAttributes
addCustomAttributes_customAttributes = (AddCustomAttributes -> NonEmpty SchemaAttributeType)
-> (AddCustomAttributes
-> NonEmpty SchemaAttributeType -> AddCustomAttributes)
-> Lens
AddCustomAttributes
AddCustomAttributes
(NonEmpty SchemaAttributeType)
(NonEmpty SchemaAttributeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddCustomAttributes' {NonEmpty SchemaAttributeType
customAttributes :: NonEmpty SchemaAttributeType
$sel:customAttributes:AddCustomAttributes' :: AddCustomAttributes -> NonEmpty SchemaAttributeType
customAttributes} -> NonEmpty SchemaAttributeType
customAttributes) (\s :: AddCustomAttributes
s@AddCustomAttributes' {} NonEmpty SchemaAttributeType
a -> AddCustomAttributes
s {$sel:customAttributes:AddCustomAttributes' :: NonEmpty SchemaAttributeType
customAttributes = NonEmpty SchemaAttributeType
a} :: AddCustomAttributes) ((NonEmpty SchemaAttributeType -> f (NonEmpty SchemaAttributeType))
-> AddCustomAttributes -> f AddCustomAttributes)
-> ((NonEmpty SchemaAttributeType
-> f (NonEmpty SchemaAttributeType))
-> NonEmpty SchemaAttributeType
-> f (NonEmpty SchemaAttributeType))
-> (NonEmpty SchemaAttributeType
-> f (NonEmpty SchemaAttributeType))
-> AddCustomAttributes
-> f AddCustomAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty SchemaAttributeType -> f (NonEmpty SchemaAttributeType))
-> NonEmpty SchemaAttributeType -> f (NonEmpty SchemaAttributeType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AddCustomAttributes where
type
AWSResponse AddCustomAttributes =
AddCustomAttributesResponse
request :: AddCustomAttributes -> Request AddCustomAttributes
request = Service -> AddCustomAttributes -> Request AddCustomAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddCustomAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddCustomAttributes)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AddCustomAttributes))
-> Logger
-> Service
-> Proxy AddCustomAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddCustomAttributes)))
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 -> AddCustomAttributesResponse
AddCustomAttributesResponse'
(Int -> AddCustomAttributesResponse)
-> Either String Int -> Either String AddCustomAttributesResponse
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 AddCustomAttributes
instance Prelude.NFData AddCustomAttributes
instance Core.ToHeaders AddCustomAttributes where
toHeaders :: AddCustomAttributes -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddCustomAttributes -> 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.AddCustomAttributes" ::
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 AddCustomAttributes where
toJSON :: AddCustomAttributes -> Value
toJSON AddCustomAttributes' {NonEmpty SchemaAttributeType
Text
customAttributes :: NonEmpty SchemaAttributeType
userPoolId :: Text
$sel:customAttributes:AddCustomAttributes' :: AddCustomAttributes -> NonEmpty SchemaAttributeType
$sel:userPoolId:AddCustomAttributes' :: AddCustomAttributes -> 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
"CustomAttributes" Text -> NonEmpty SchemaAttributeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty SchemaAttributeType
customAttributes)
]
)
instance Core.ToPath AddCustomAttributes where
toPath :: AddCustomAttributes -> ByteString
toPath = ByteString -> AddCustomAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddCustomAttributes where
toQuery :: AddCustomAttributes -> QueryString
toQuery = QueryString -> AddCustomAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddCustomAttributesResponse = AddCustomAttributesResponse'
{
AddCustomAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddCustomAttributesResponse -> AddCustomAttributesResponse -> Bool
(AddCustomAttributesResponse
-> AddCustomAttributesResponse -> Bool)
-> (AddCustomAttributesResponse
-> AddCustomAttributesResponse -> Bool)
-> Eq AddCustomAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddCustomAttributesResponse -> AddCustomAttributesResponse -> Bool
$c/= :: AddCustomAttributesResponse -> AddCustomAttributesResponse -> Bool
== :: AddCustomAttributesResponse -> AddCustomAttributesResponse -> Bool
$c== :: AddCustomAttributesResponse -> AddCustomAttributesResponse -> Bool
Prelude.Eq, ReadPrec [AddCustomAttributesResponse]
ReadPrec AddCustomAttributesResponse
Int -> ReadS AddCustomAttributesResponse
ReadS [AddCustomAttributesResponse]
(Int -> ReadS AddCustomAttributesResponse)
-> ReadS [AddCustomAttributesResponse]
-> ReadPrec AddCustomAttributesResponse
-> ReadPrec [AddCustomAttributesResponse]
-> Read AddCustomAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddCustomAttributesResponse]
$creadListPrec :: ReadPrec [AddCustomAttributesResponse]
readPrec :: ReadPrec AddCustomAttributesResponse
$creadPrec :: ReadPrec AddCustomAttributesResponse
readList :: ReadS [AddCustomAttributesResponse]
$creadList :: ReadS [AddCustomAttributesResponse]
readsPrec :: Int -> ReadS AddCustomAttributesResponse
$creadsPrec :: Int -> ReadS AddCustomAttributesResponse
Prelude.Read, Int -> AddCustomAttributesResponse -> ShowS
[AddCustomAttributesResponse] -> ShowS
AddCustomAttributesResponse -> String
(Int -> AddCustomAttributesResponse -> ShowS)
-> (AddCustomAttributesResponse -> String)
-> ([AddCustomAttributesResponse] -> ShowS)
-> Show AddCustomAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddCustomAttributesResponse] -> ShowS
$cshowList :: [AddCustomAttributesResponse] -> ShowS
show :: AddCustomAttributesResponse -> String
$cshow :: AddCustomAttributesResponse -> String
showsPrec :: Int -> AddCustomAttributesResponse -> ShowS
$cshowsPrec :: Int -> AddCustomAttributesResponse -> ShowS
Prelude.Show, (forall x.
AddCustomAttributesResponse -> Rep AddCustomAttributesResponse x)
-> (forall x.
Rep AddCustomAttributesResponse x -> AddCustomAttributesResponse)
-> Generic AddCustomAttributesResponse
forall x.
Rep AddCustomAttributesResponse x -> AddCustomAttributesResponse
forall x.
AddCustomAttributesResponse -> Rep AddCustomAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddCustomAttributesResponse x -> AddCustomAttributesResponse
$cfrom :: forall x.
AddCustomAttributesResponse -> Rep AddCustomAttributesResponse x
Prelude.Generic)
newAddCustomAttributesResponse ::
Prelude.Int ->
AddCustomAttributesResponse
newAddCustomAttributesResponse :: Int -> AddCustomAttributesResponse
newAddCustomAttributesResponse Int
pHttpStatus_ =
AddCustomAttributesResponse' :: Int -> AddCustomAttributesResponse
AddCustomAttributesResponse'
{ $sel:httpStatus:AddCustomAttributesResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
addCustomAttributesResponse_httpStatus :: Lens.Lens' AddCustomAttributesResponse Prelude.Int
addCustomAttributesResponse_httpStatus :: (Int -> f Int)
-> AddCustomAttributesResponse -> f AddCustomAttributesResponse
addCustomAttributesResponse_httpStatus = (AddCustomAttributesResponse -> Int)
-> (AddCustomAttributesResponse
-> Int -> AddCustomAttributesResponse)
-> Lens
AddCustomAttributesResponse AddCustomAttributesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddCustomAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddCustomAttributesResponse' :: AddCustomAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddCustomAttributesResponse
s@AddCustomAttributesResponse' {} Int
a -> AddCustomAttributesResponse
s {$sel:httpStatus:AddCustomAttributesResponse' :: Int
httpStatus = Int
a} :: AddCustomAttributesResponse)
instance Prelude.NFData AddCustomAttributesResponse