{-# 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.FraudDetector.SendEvent
(
SendEvent (..),
newSendEvent,
sendEvent_labelTimestamp,
sendEvent_assignedLabel,
sendEvent_eventId,
sendEvent_eventTypeName,
sendEvent_eventTimestamp,
sendEvent_eventVariables,
sendEvent_entities,
SendEventResponse (..),
newSendEventResponse,
sendEventResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types
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 SendEvent = SendEvent'
{
SendEvent -> Maybe Text
labelTimestamp :: Prelude.Maybe Prelude.Text,
SendEvent -> Maybe Text
assignedLabel :: Prelude.Maybe Prelude.Text,
SendEvent -> Text
eventId :: Prelude.Text,
SendEvent -> Text
eventTypeName :: Prelude.Text,
SendEvent -> Text
eventTimestamp :: Prelude.Text,
SendEvent -> HashMap Text (Sensitive Text)
eventVariables :: Prelude.HashMap Prelude.Text (Core.Sensitive Prelude.Text),
SendEvent -> [Sensitive Entity]
entities :: [Core.Sensitive Entity]
}
deriving (SendEvent -> SendEvent -> Bool
(SendEvent -> SendEvent -> Bool)
-> (SendEvent -> SendEvent -> Bool) -> Eq SendEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendEvent -> SendEvent -> Bool
$c/= :: SendEvent -> SendEvent -> Bool
== :: SendEvent -> SendEvent -> Bool
$c== :: SendEvent -> SendEvent -> Bool
Prelude.Eq, Int -> SendEvent -> ShowS
[SendEvent] -> ShowS
SendEvent -> String
(Int -> SendEvent -> ShowS)
-> (SendEvent -> String)
-> ([SendEvent] -> ShowS)
-> Show SendEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendEvent] -> ShowS
$cshowList :: [SendEvent] -> ShowS
show :: SendEvent -> String
$cshow :: SendEvent -> String
showsPrec :: Int -> SendEvent -> ShowS
$cshowsPrec :: Int -> SendEvent -> ShowS
Prelude.Show, (forall x. SendEvent -> Rep SendEvent x)
-> (forall x. Rep SendEvent x -> SendEvent) -> Generic SendEvent
forall x. Rep SendEvent x -> SendEvent
forall x. SendEvent -> Rep SendEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendEvent x -> SendEvent
$cfrom :: forall x. SendEvent -> Rep SendEvent x
Prelude.Generic)
newSendEvent ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
SendEvent
newSendEvent :: Text -> Text -> Text -> SendEvent
newSendEvent
Text
pEventId_
Text
pEventTypeName_
Text
pEventTimestamp_ =
SendEvent' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> HashMap Text (Sensitive Text)
-> [Sensitive Entity]
-> SendEvent
SendEvent'
{ $sel:labelTimestamp:SendEvent' :: Maybe Text
labelTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assignedLabel:SendEvent' :: Maybe Text
assignedLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventId:SendEvent' :: Text
eventId = Text
pEventId_,
$sel:eventTypeName:SendEvent' :: Text
eventTypeName = Text
pEventTypeName_,
$sel:eventTimestamp:SendEvent' :: Text
eventTimestamp = Text
pEventTimestamp_,
$sel:eventVariables:SendEvent' :: HashMap Text (Sensitive Text)
eventVariables = HashMap Text (Sensitive Text)
forall a. Monoid a => a
Prelude.mempty,
$sel:entities:SendEvent' :: [Sensitive Entity]
entities = [Sensitive Entity]
forall a. Monoid a => a
Prelude.mempty
}
sendEvent_labelTimestamp :: Lens.Lens' SendEvent (Prelude.Maybe Prelude.Text)
sendEvent_labelTimestamp :: (Maybe Text -> f (Maybe Text)) -> SendEvent -> f SendEvent
sendEvent_labelTimestamp = (SendEvent -> Maybe Text)
-> (SendEvent -> Maybe Text -> SendEvent)
-> Lens SendEvent SendEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {Maybe Text
labelTimestamp :: Maybe Text
$sel:labelTimestamp:SendEvent' :: SendEvent -> Maybe Text
labelTimestamp} -> Maybe Text
labelTimestamp) (\s :: SendEvent
s@SendEvent' {} Maybe Text
a -> SendEvent
s {$sel:labelTimestamp:SendEvent' :: Maybe Text
labelTimestamp = Maybe Text
a} :: SendEvent)
sendEvent_assignedLabel :: Lens.Lens' SendEvent (Prelude.Maybe Prelude.Text)
sendEvent_assignedLabel :: (Maybe Text -> f (Maybe Text)) -> SendEvent -> f SendEvent
sendEvent_assignedLabel = (SendEvent -> Maybe Text)
-> (SendEvent -> Maybe Text -> SendEvent)
-> Lens SendEvent SendEvent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {Maybe Text
assignedLabel :: Maybe Text
$sel:assignedLabel:SendEvent' :: SendEvent -> Maybe Text
assignedLabel} -> Maybe Text
assignedLabel) (\s :: SendEvent
s@SendEvent' {} Maybe Text
a -> SendEvent
s {$sel:assignedLabel:SendEvent' :: Maybe Text
assignedLabel = Maybe Text
a} :: SendEvent)
sendEvent_eventId :: Lens.Lens' SendEvent Prelude.Text
sendEvent_eventId :: (Text -> f Text) -> SendEvent -> f SendEvent
sendEvent_eventId = (SendEvent -> Text)
-> (SendEvent -> Text -> SendEvent)
-> Lens SendEvent SendEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {Text
eventId :: Text
$sel:eventId:SendEvent' :: SendEvent -> Text
eventId} -> Text
eventId) (\s :: SendEvent
s@SendEvent' {} Text
a -> SendEvent
s {$sel:eventId:SendEvent' :: Text
eventId = Text
a} :: SendEvent)
sendEvent_eventTypeName :: Lens.Lens' SendEvent Prelude.Text
sendEvent_eventTypeName :: (Text -> f Text) -> SendEvent -> f SendEvent
sendEvent_eventTypeName = (SendEvent -> Text)
-> (SendEvent -> Text -> SendEvent)
-> Lens SendEvent SendEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {Text
eventTypeName :: Text
$sel:eventTypeName:SendEvent' :: SendEvent -> Text
eventTypeName} -> Text
eventTypeName) (\s :: SendEvent
s@SendEvent' {} Text
a -> SendEvent
s {$sel:eventTypeName:SendEvent' :: Text
eventTypeName = Text
a} :: SendEvent)
sendEvent_eventTimestamp :: Lens.Lens' SendEvent Prelude.Text
sendEvent_eventTimestamp :: (Text -> f Text) -> SendEvent -> f SendEvent
sendEvent_eventTimestamp = (SendEvent -> Text)
-> (SendEvent -> Text -> SendEvent)
-> Lens SendEvent SendEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {Text
eventTimestamp :: Text
$sel:eventTimestamp:SendEvent' :: SendEvent -> Text
eventTimestamp} -> Text
eventTimestamp) (\s :: SendEvent
s@SendEvent' {} Text
a -> SendEvent
s {$sel:eventTimestamp:SendEvent' :: Text
eventTimestamp = Text
a} :: SendEvent)
sendEvent_eventVariables :: Lens.Lens' SendEvent (Prelude.HashMap Prelude.Text Prelude.Text)
sendEvent_eventVariables :: (HashMap Text Text -> f (HashMap Text Text))
-> SendEvent -> f SendEvent
sendEvent_eventVariables = (SendEvent -> HashMap Text (Sensitive Text))
-> (SendEvent -> HashMap Text (Sensitive Text) -> SendEvent)
-> Lens
SendEvent
SendEvent
(HashMap Text (Sensitive Text))
(HashMap Text (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {HashMap Text (Sensitive Text)
eventVariables :: HashMap Text (Sensitive Text)
$sel:eventVariables:SendEvent' :: SendEvent -> HashMap Text (Sensitive Text)
eventVariables} -> HashMap Text (Sensitive Text)
eventVariables) (\s :: SendEvent
s@SendEvent' {} HashMap Text (Sensitive Text)
a -> SendEvent
s {$sel:eventVariables:SendEvent' :: HashMap Text (Sensitive Text)
eventVariables = HashMap Text (Sensitive Text)
a} :: SendEvent) ((HashMap Text (Sensitive Text)
-> f (HashMap Text (Sensitive Text)))
-> SendEvent -> f SendEvent)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text (Sensitive Text)
-> f (HashMap Text (Sensitive Text)))
-> (HashMap Text Text -> f (HashMap Text Text))
-> SendEvent
-> f SendEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text (Sensitive Text)
-> f (HashMap Text (Sensitive Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
sendEvent_entities :: Lens.Lens' SendEvent [Entity]
sendEvent_entities :: ([Entity] -> f [Entity]) -> SendEvent -> f SendEvent
sendEvent_entities = (SendEvent -> [Sensitive Entity])
-> (SendEvent -> [Sensitive Entity] -> SendEvent)
-> Lens SendEvent SendEvent [Sensitive Entity] [Sensitive Entity]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEvent' {[Sensitive Entity]
entities :: [Sensitive Entity]
$sel:entities:SendEvent' :: SendEvent -> [Sensitive Entity]
entities} -> [Sensitive Entity]
entities) (\s :: SendEvent
s@SendEvent' {} [Sensitive Entity]
a -> SendEvent
s {$sel:entities:SendEvent' :: [Sensitive Entity]
entities = [Sensitive Entity]
a} :: SendEvent) (([Sensitive Entity] -> f [Sensitive Entity])
-> SendEvent -> f SendEvent)
-> (([Entity] -> f [Entity])
-> [Sensitive Entity] -> f [Sensitive Entity])
-> ([Entity] -> f [Entity])
-> SendEvent
-> f SendEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Entity] -> f [Entity])
-> [Sensitive Entity] -> f [Sensitive Entity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest SendEvent where
type AWSResponse SendEvent = SendEventResponse
request :: SendEvent -> Request SendEvent
request = Service -> SendEvent -> Request SendEvent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SendEvent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendEvent)))
response =
(Int
-> ResponseHeaders -> () -> Either String (AWSResponse SendEvent))
-> Logger
-> Service
-> Proxy SendEvent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SendEvent)))
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 -> SendEventResponse
SendEventResponse'
(Int -> SendEventResponse)
-> Either String Int -> Either String SendEventResponse
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 SendEvent
instance Prelude.NFData SendEvent
instance Core.ToHeaders SendEvent where
toHeaders :: SendEvent -> ResponseHeaders
toHeaders =
ResponseHeaders -> SendEvent -> 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
"AWSHawksNestServiceFacade.SendEvent" ::
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 SendEvent where
toJSON :: SendEvent -> Value
toJSON SendEvent' {[Sensitive Entity]
Maybe Text
Text
HashMap Text (Sensitive Text)
entities :: [Sensitive Entity]
eventVariables :: HashMap Text (Sensitive Text)
eventTimestamp :: Text
eventTypeName :: Text
eventId :: Text
assignedLabel :: Maybe Text
labelTimestamp :: Maybe Text
$sel:entities:SendEvent' :: SendEvent -> [Sensitive Entity]
$sel:eventVariables:SendEvent' :: SendEvent -> HashMap Text (Sensitive Text)
$sel:eventTimestamp:SendEvent' :: SendEvent -> Text
$sel:eventTypeName:SendEvent' :: SendEvent -> Text
$sel:eventId:SendEvent' :: SendEvent -> Text
$sel:assignedLabel:SendEvent' :: SendEvent -> Maybe Text
$sel:labelTimestamp:SendEvent' :: SendEvent -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"labelTimestamp" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
labelTimestamp,
(Text
"assignedLabel" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
assignedLabel,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"eventId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"eventTypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventTypeName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"eventTimestamp" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventTimestamp),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"eventVariables" Text -> HashMap Text (Sensitive Text) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text (Sensitive Text)
eventVariables),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"entities" Text -> [Sensitive Entity] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Sensitive Entity]
entities)
]
)
instance Core.ToPath SendEvent where
toPath :: SendEvent -> ByteString
toPath = ByteString -> SendEvent -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery SendEvent where
toQuery :: SendEvent -> QueryString
toQuery = QueryString -> SendEvent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SendEventResponse = SendEventResponse'
{
SendEventResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SendEventResponse -> SendEventResponse -> Bool
(SendEventResponse -> SendEventResponse -> Bool)
-> (SendEventResponse -> SendEventResponse -> Bool)
-> Eq SendEventResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SendEventResponse -> SendEventResponse -> Bool
$c/= :: SendEventResponse -> SendEventResponse -> Bool
== :: SendEventResponse -> SendEventResponse -> Bool
$c== :: SendEventResponse -> SendEventResponse -> Bool
Prelude.Eq, ReadPrec [SendEventResponse]
ReadPrec SendEventResponse
Int -> ReadS SendEventResponse
ReadS [SendEventResponse]
(Int -> ReadS SendEventResponse)
-> ReadS [SendEventResponse]
-> ReadPrec SendEventResponse
-> ReadPrec [SendEventResponse]
-> Read SendEventResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SendEventResponse]
$creadListPrec :: ReadPrec [SendEventResponse]
readPrec :: ReadPrec SendEventResponse
$creadPrec :: ReadPrec SendEventResponse
readList :: ReadS [SendEventResponse]
$creadList :: ReadS [SendEventResponse]
readsPrec :: Int -> ReadS SendEventResponse
$creadsPrec :: Int -> ReadS SendEventResponse
Prelude.Read, Int -> SendEventResponse -> ShowS
[SendEventResponse] -> ShowS
SendEventResponse -> String
(Int -> SendEventResponse -> ShowS)
-> (SendEventResponse -> String)
-> ([SendEventResponse] -> ShowS)
-> Show SendEventResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SendEventResponse] -> ShowS
$cshowList :: [SendEventResponse] -> ShowS
show :: SendEventResponse -> String
$cshow :: SendEventResponse -> String
showsPrec :: Int -> SendEventResponse -> ShowS
$cshowsPrec :: Int -> SendEventResponse -> ShowS
Prelude.Show, (forall x. SendEventResponse -> Rep SendEventResponse x)
-> (forall x. Rep SendEventResponse x -> SendEventResponse)
-> Generic SendEventResponse
forall x. Rep SendEventResponse x -> SendEventResponse
forall x. SendEventResponse -> Rep SendEventResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SendEventResponse x -> SendEventResponse
$cfrom :: forall x. SendEventResponse -> Rep SendEventResponse x
Prelude.Generic)
newSendEventResponse ::
Prelude.Int ->
SendEventResponse
newSendEventResponse :: Int -> SendEventResponse
newSendEventResponse Int
pHttpStatus_ =
SendEventResponse' :: Int -> SendEventResponse
SendEventResponse' {$sel:httpStatus:SendEventResponse' :: Int
httpStatus = Int
pHttpStatus_}
sendEventResponse_httpStatus :: Lens.Lens' SendEventResponse Prelude.Int
sendEventResponse_httpStatus :: (Int -> f Int) -> SendEventResponse -> f SendEventResponse
sendEventResponse_httpStatus = (SendEventResponse -> Int)
-> (SendEventResponse -> Int -> SendEventResponse)
-> Lens SendEventResponse SendEventResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SendEventResponse' {Int
httpStatus :: Int
$sel:httpStatus:SendEventResponse' :: SendEventResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SendEventResponse
s@SendEventResponse' {} Int
a -> SendEventResponse
s {$sel:httpStatus:SendEventResponse' :: Int
httpStatus = Int
a} :: SendEventResponse)
instance Prelude.NFData SendEventResponse