{-# 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.PersonalizeEvents.PutUsers
(
PutUsers (..),
newPutUsers,
putUsers_datasetArn,
putUsers_users,
PutUsersResponse (..),
newPutUsersResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.PersonalizeEvents.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutUsers = PutUsers'
{
PutUsers -> Text
datasetArn :: Prelude.Text,
PutUsers -> NonEmpty User
users :: Prelude.NonEmpty User
}
deriving (PutUsers -> PutUsers -> Bool
(PutUsers -> PutUsers -> Bool)
-> (PutUsers -> PutUsers -> Bool) -> Eq PutUsers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutUsers -> PutUsers -> Bool
$c/= :: PutUsers -> PutUsers -> Bool
== :: PutUsers -> PutUsers -> Bool
$c== :: PutUsers -> PutUsers -> Bool
Prelude.Eq, ReadPrec [PutUsers]
ReadPrec PutUsers
Int -> ReadS PutUsers
ReadS [PutUsers]
(Int -> ReadS PutUsers)
-> ReadS [PutUsers]
-> ReadPrec PutUsers
-> ReadPrec [PutUsers]
-> Read PutUsers
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutUsers]
$creadListPrec :: ReadPrec [PutUsers]
readPrec :: ReadPrec PutUsers
$creadPrec :: ReadPrec PutUsers
readList :: ReadS [PutUsers]
$creadList :: ReadS [PutUsers]
readsPrec :: Int -> ReadS PutUsers
$creadsPrec :: Int -> ReadS PutUsers
Prelude.Read, Int -> PutUsers -> ShowS
[PutUsers] -> ShowS
PutUsers -> String
(Int -> PutUsers -> ShowS)
-> (PutUsers -> String) -> ([PutUsers] -> ShowS) -> Show PutUsers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutUsers] -> ShowS
$cshowList :: [PutUsers] -> ShowS
show :: PutUsers -> String
$cshow :: PutUsers -> String
showsPrec :: Int -> PutUsers -> ShowS
$cshowsPrec :: Int -> PutUsers -> ShowS
Prelude.Show, (forall x. PutUsers -> Rep PutUsers x)
-> (forall x. Rep PutUsers x -> PutUsers) -> Generic PutUsers
forall x. Rep PutUsers x -> PutUsers
forall x. PutUsers -> Rep PutUsers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutUsers x -> PutUsers
$cfrom :: forall x. PutUsers -> Rep PutUsers x
Prelude.Generic)
newPutUsers ::
Prelude.Text ->
Prelude.NonEmpty User ->
PutUsers
newPutUsers :: Text -> NonEmpty User -> PutUsers
newPutUsers Text
pDatasetArn_ NonEmpty User
pUsers_ =
PutUsers' :: Text -> NonEmpty User -> PutUsers
PutUsers'
{ $sel:datasetArn:PutUsers' :: Text
datasetArn = Text
pDatasetArn_,
$sel:users:PutUsers' :: NonEmpty User
users = Tagged (NonEmpty User) (Identity (NonEmpty User))
-> Tagged (NonEmpty User) (Identity (NonEmpty User))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty User) (Identity (NonEmpty User))
-> Tagged (NonEmpty User) (Identity (NonEmpty User)))
-> NonEmpty User -> NonEmpty User
forall t b. AReview t b -> b -> t
Lens.# NonEmpty User
pUsers_
}
putUsers_datasetArn :: Lens.Lens' PutUsers Prelude.Text
putUsers_datasetArn :: (Text -> f Text) -> PutUsers -> f PutUsers
putUsers_datasetArn = (PutUsers -> Text)
-> (PutUsers -> Text -> PutUsers)
-> Lens PutUsers PutUsers Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutUsers' {Text
datasetArn :: Text
$sel:datasetArn:PutUsers' :: PutUsers -> Text
datasetArn} -> Text
datasetArn) (\s :: PutUsers
s@PutUsers' {} Text
a -> PutUsers
s {$sel:datasetArn:PutUsers' :: Text
datasetArn = Text
a} :: PutUsers)
putUsers_users :: Lens.Lens' PutUsers (Prelude.NonEmpty User)
putUsers_users :: (NonEmpty User -> f (NonEmpty User)) -> PutUsers -> f PutUsers
putUsers_users = (PutUsers -> NonEmpty User)
-> (PutUsers -> NonEmpty User -> PutUsers)
-> Lens PutUsers PutUsers (NonEmpty User) (NonEmpty User)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutUsers' {NonEmpty User
users :: NonEmpty User
$sel:users:PutUsers' :: PutUsers -> NonEmpty User
users} -> NonEmpty User
users) (\s :: PutUsers
s@PutUsers' {} NonEmpty User
a -> PutUsers
s {$sel:users:PutUsers' :: NonEmpty User
users = NonEmpty User
a} :: PutUsers) ((NonEmpty User -> f (NonEmpty User)) -> PutUsers -> f PutUsers)
-> ((NonEmpty User -> f (NonEmpty User))
-> NonEmpty User -> f (NonEmpty User))
-> (NonEmpty User -> f (NonEmpty User))
-> PutUsers
-> f PutUsers
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty User -> f (NonEmpty User))
-> NonEmpty User -> f (NonEmpty User)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutUsers where
type AWSResponse PutUsers = PutUsersResponse
request :: PutUsers -> Request PutUsers
request = Service -> PutUsers -> Request PutUsers
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutUsers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutUsers)))
response = AWSResponse PutUsers
-> Logger
-> Service
-> Proxy PutUsers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutUsers)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse PutUsers
PutUsersResponse
PutUsersResponse'
instance Prelude.Hashable PutUsers
instance Prelude.NFData PutUsers
instance Core.ToHeaders PutUsers where
toHeaders :: PutUsers -> [Header]
toHeaders =
[Header] -> PutUsers -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON PutUsers where
toJSON :: PutUsers -> Value
toJSON PutUsers' {NonEmpty User
Text
users :: NonEmpty User
datasetArn :: Text
$sel:users:PutUsers' :: PutUsers -> NonEmpty User
$sel:datasetArn:PutUsers' :: PutUsers -> 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
"datasetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"users" Text -> NonEmpty User -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty User
users)
]
)
instance Core.ToPath PutUsers where
toPath :: PutUsers -> ByteString
toPath = ByteString -> PutUsers -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/users"
instance Core.ToQuery PutUsers where
toQuery :: PutUsers -> QueryString
toQuery = QueryString -> PutUsers -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutUsersResponse = PutUsersResponse'
{
}
deriving (PutUsersResponse -> PutUsersResponse -> Bool
(PutUsersResponse -> PutUsersResponse -> Bool)
-> (PutUsersResponse -> PutUsersResponse -> Bool)
-> Eq PutUsersResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutUsersResponse -> PutUsersResponse -> Bool
$c/= :: PutUsersResponse -> PutUsersResponse -> Bool
== :: PutUsersResponse -> PutUsersResponse -> Bool
$c== :: PutUsersResponse -> PutUsersResponse -> Bool
Prelude.Eq, ReadPrec [PutUsersResponse]
ReadPrec PutUsersResponse
Int -> ReadS PutUsersResponse
ReadS [PutUsersResponse]
(Int -> ReadS PutUsersResponse)
-> ReadS [PutUsersResponse]
-> ReadPrec PutUsersResponse
-> ReadPrec [PutUsersResponse]
-> Read PutUsersResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutUsersResponse]
$creadListPrec :: ReadPrec [PutUsersResponse]
readPrec :: ReadPrec PutUsersResponse
$creadPrec :: ReadPrec PutUsersResponse
readList :: ReadS [PutUsersResponse]
$creadList :: ReadS [PutUsersResponse]
readsPrec :: Int -> ReadS PutUsersResponse
$creadsPrec :: Int -> ReadS PutUsersResponse
Prelude.Read, Int -> PutUsersResponse -> ShowS
[PutUsersResponse] -> ShowS
PutUsersResponse -> String
(Int -> PutUsersResponse -> ShowS)
-> (PutUsersResponse -> String)
-> ([PutUsersResponse] -> ShowS)
-> Show PutUsersResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutUsersResponse] -> ShowS
$cshowList :: [PutUsersResponse] -> ShowS
show :: PutUsersResponse -> String
$cshow :: PutUsersResponse -> String
showsPrec :: Int -> PutUsersResponse -> ShowS
$cshowsPrec :: Int -> PutUsersResponse -> ShowS
Prelude.Show, (forall x. PutUsersResponse -> Rep PutUsersResponse x)
-> (forall x. Rep PutUsersResponse x -> PutUsersResponse)
-> Generic PutUsersResponse
forall x. Rep PutUsersResponse x -> PutUsersResponse
forall x. PutUsersResponse -> Rep PutUsersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutUsersResponse x -> PutUsersResponse
$cfrom :: forall x. PutUsersResponse -> Rep PutUsersResponse x
Prelude.Generic)
newPutUsersResponse ::
PutUsersResponse
newPutUsersResponse :: PutUsersResponse
newPutUsersResponse = PutUsersResponse
PutUsersResponse'
instance Prelude.NFData PutUsersResponse