{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.FraudDetector.GetEventPrediction
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Evaluates an event against a detector version. If a version ID is not
-- provided, the detector’s (@ACTIVE@) version is used.
module Amazonka.FraudDetector.GetEventPrediction
  ( -- * Creating a Request
    GetEventPrediction (..),
    newGetEventPrediction,

    -- * Request Lenses
    getEventPrediction_detectorVersionId,
    getEventPrediction_externalModelEndpointDataBlobs,
    getEventPrediction_detectorId,
    getEventPrediction_eventId,
    getEventPrediction_eventTypeName,
    getEventPrediction_entities,
    getEventPrediction_eventTimestamp,
    getEventPrediction_eventVariables,

    -- * Destructuring the Response
    GetEventPredictionResponse (..),
    newGetEventPredictionResponse,

    -- * Response Lenses
    getEventPredictionResponse_externalModelOutputs,
    getEventPredictionResponse_modelScores,
    getEventPredictionResponse_ruleResults,
    getEventPredictionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetEventPrediction' smart constructor.
data GetEventPrediction = GetEventPrediction'
  { -- | The detector version ID.
    GetEventPrediction -> Maybe Text
detectorVersionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon SageMaker model endpoint input data blobs.
    GetEventPrediction
-> Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text ModelEndpointDataBlob)),
    -- | The detector ID.
    GetEventPrediction -> Text
detectorId :: Prelude.Text,
    -- | The unique ID used to identify the event.
    GetEventPrediction -> Text
eventId :: Prelude.Text,
    -- | The event type associated with the detector specified for the
    -- prediction.
    GetEventPrediction -> Text
eventTypeName :: Prelude.Text,
    -- | The entity type (associated with the detector\'s event type) and
    -- specific entity ID representing who performed the event. If an entity id
    -- is not available, use \"UNKNOWN.\"
    GetEventPrediction -> [Sensitive Entity]
entities :: [Data.Sensitive Entity],
    -- | Timestamp that defines when the event under evaluation occurred. The
    -- timestamp must be specified using ISO 8601 standard in UTC.
    GetEventPrediction -> Text
eventTimestamp :: Prelude.Text,
    -- | Names of the event type\'s variables you defined in Amazon Fraud
    -- Detector to represent data elements and their corresponding values for
    -- the event you are sending for evaluation.
    --
    -- You must provide at least one eventVariable
    --
    -- To ensure most accurate fraud prediction and to simplify your data
    -- preparation, Amazon Fraud Detector will replace all missing variables or
    -- values as follows:
    --
    -- __For Amazon Fraud Detector trained models:__
    --
    -- If a null value is provided explicitly for a variable or if a variable
    -- is missing, model will replace the null value or the missing variable
    -- (no variable name in the eventVariables map) with calculated default
    -- mean\/medians for numeric variables and with special values for
    -- categorical variables.
    --
    -- __For imported SageMaker models:__
    --
    -- If a null value is provided explicitly for a variable, the model and
    -- rules will use “null” as the value. If a variable is not provided (no
    -- variable name in the eventVariables map), model and rules will use the
    -- default value that is provided for the variable.
    GetEventPrediction -> HashMap Text (Sensitive Text)
eventVariables :: Prelude.HashMap Prelude.Text (Data.Sensitive Prelude.Text)
  }
  deriving (GetEventPrediction -> GetEventPrediction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEventPrediction -> GetEventPrediction -> Bool
$c/= :: GetEventPrediction -> GetEventPrediction -> Bool
== :: GetEventPrediction -> GetEventPrediction -> Bool
$c== :: GetEventPrediction -> GetEventPrediction -> Bool
Prelude.Eq, Int -> GetEventPrediction -> ShowS
[GetEventPrediction] -> ShowS
GetEventPrediction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEventPrediction] -> ShowS
$cshowList :: [GetEventPrediction] -> ShowS
show :: GetEventPrediction -> String
$cshow :: GetEventPrediction -> String
showsPrec :: Int -> GetEventPrediction -> ShowS
$cshowsPrec :: Int -> GetEventPrediction -> ShowS
Prelude.Show, forall x. Rep GetEventPrediction x -> GetEventPrediction
forall x. GetEventPrediction -> Rep GetEventPrediction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetEventPrediction x -> GetEventPrediction
$cfrom :: forall x. GetEventPrediction -> Rep GetEventPrediction x
Prelude.Generic)

-- |
-- Create a value of 'GetEventPrediction' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'detectorVersionId', 'getEventPrediction_detectorVersionId' - The detector version ID.
--
-- 'externalModelEndpointDataBlobs', 'getEventPrediction_externalModelEndpointDataBlobs' - The Amazon SageMaker model endpoint input data blobs.
--
-- 'detectorId', 'getEventPrediction_detectorId' - The detector ID.
--
-- 'eventId', 'getEventPrediction_eventId' - The unique ID used to identify the event.
--
-- 'eventTypeName', 'getEventPrediction_eventTypeName' - The event type associated with the detector specified for the
-- prediction.
--
-- 'entities', 'getEventPrediction_entities' - The entity type (associated with the detector\'s event type) and
-- specific entity ID representing who performed the event. If an entity id
-- is not available, use \"UNKNOWN.\"
--
-- 'eventTimestamp', 'getEventPrediction_eventTimestamp' - Timestamp that defines when the event under evaluation occurred. The
-- timestamp must be specified using ISO 8601 standard in UTC.
--
-- 'eventVariables', 'getEventPrediction_eventVariables' - Names of the event type\'s variables you defined in Amazon Fraud
-- Detector to represent data elements and their corresponding values for
-- the event you are sending for evaluation.
--
-- You must provide at least one eventVariable
--
-- To ensure most accurate fraud prediction and to simplify your data
-- preparation, Amazon Fraud Detector will replace all missing variables or
-- values as follows:
--
-- __For Amazon Fraud Detector trained models:__
--
-- If a null value is provided explicitly for a variable or if a variable
-- is missing, model will replace the null value or the missing variable
-- (no variable name in the eventVariables map) with calculated default
-- mean\/medians for numeric variables and with special values for
-- categorical variables.
--
-- __For imported SageMaker models:__
--
-- If a null value is provided explicitly for a variable, the model and
-- rules will use “null” as the value. If a variable is not provided (no
-- variable name in the eventVariables map), model and rules will use the
-- default value that is provided for the variable.
newGetEventPrediction ::
  -- | 'detectorId'
  Prelude.Text ->
  -- | 'eventId'
  Prelude.Text ->
  -- | 'eventTypeName'
  Prelude.Text ->
  -- | 'eventTimestamp'
  Prelude.Text ->
  GetEventPrediction
newGetEventPrediction :: Text -> Text -> Text -> Text -> GetEventPrediction
newGetEventPrediction
  Text
pDetectorId_
  Text
pEventId_
  Text
pEventTypeName_
  Text
pEventTimestamp_ =
    GetEventPrediction'
      { $sel:detectorVersionId:GetEventPrediction' :: Maybe Text
detectorVersionId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:externalModelEndpointDataBlobs:GetEventPrediction' :: Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs = forall a. Maybe a
Prelude.Nothing,
        $sel:detectorId:GetEventPrediction' :: Text
detectorId = Text
pDetectorId_,
        $sel:eventId:GetEventPrediction' :: Text
eventId = Text
pEventId_,
        $sel:eventTypeName:GetEventPrediction' :: Text
eventTypeName = Text
pEventTypeName_,
        $sel:entities:GetEventPrediction' :: [Sensitive Entity]
entities = forall a. Monoid a => a
Prelude.mempty,
        $sel:eventTimestamp:GetEventPrediction' :: Text
eventTimestamp = Text
pEventTimestamp_,
        $sel:eventVariables:GetEventPrediction' :: HashMap Text (Sensitive Text)
eventVariables = forall a. Monoid a => a
Prelude.mempty
      }

-- | The detector version ID.
getEventPrediction_detectorVersionId :: Lens.Lens' GetEventPrediction (Prelude.Maybe Prelude.Text)
getEventPrediction_detectorVersionId :: Lens' GetEventPrediction (Maybe Text)
getEventPrediction_detectorVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {Maybe Text
detectorVersionId :: Maybe Text
$sel:detectorVersionId:GetEventPrediction' :: GetEventPrediction -> Maybe Text
detectorVersionId} -> Maybe Text
detectorVersionId) (\s :: GetEventPrediction
s@GetEventPrediction' {} Maybe Text
a -> GetEventPrediction
s {$sel:detectorVersionId:GetEventPrediction' :: Maybe Text
detectorVersionId = Maybe Text
a} :: GetEventPrediction)

-- | The Amazon SageMaker model endpoint input data blobs.
getEventPrediction_externalModelEndpointDataBlobs :: Lens.Lens' GetEventPrediction (Prelude.Maybe (Prelude.HashMap Prelude.Text ModelEndpointDataBlob))
getEventPrediction_externalModelEndpointDataBlobs :: Lens'
  GetEventPrediction (Maybe (HashMap Text ModelEndpointDataBlob))
getEventPrediction_externalModelEndpointDataBlobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs :: Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
$sel:externalModelEndpointDataBlobs:GetEventPrediction' :: GetEventPrediction
-> Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs} -> Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs) (\s :: GetEventPrediction
s@GetEventPrediction' {} Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
a -> GetEventPrediction
s {$sel:externalModelEndpointDataBlobs:GetEventPrediction' :: Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs = Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
a} :: GetEventPrediction) 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 a. Iso' (Sensitive a) a
Data._Sensitive 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)

-- | The detector ID.
getEventPrediction_detectorId :: Lens.Lens' GetEventPrediction Prelude.Text
getEventPrediction_detectorId :: Lens' GetEventPrediction Text
getEventPrediction_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {Text
detectorId :: Text
$sel:detectorId:GetEventPrediction' :: GetEventPrediction -> Text
detectorId} -> Text
detectorId) (\s :: GetEventPrediction
s@GetEventPrediction' {} Text
a -> GetEventPrediction
s {$sel:detectorId:GetEventPrediction' :: Text
detectorId = Text
a} :: GetEventPrediction)

-- | The unique ID used to identify the event.
getEventPrediction_eventId :: Lens.Lens' GetEventPrediction Prelude.Text
getEventPrediction_eventId :: Lens' GetEventPrediction Text
getEventPrediction_eventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {Text
eventId :: Text
$sel:eventId:GetEventPrediction' :: GetEventPrediction -> Text
eventId} -> Text
eventId) (\s :: GetEventPrediction
s@GetEventPrediction' {} Text
a -> GetEventPrediction
s {$sel:eventId:GetEventPrediction' :: Text
eventId = Text
a} :: GetEventPrediction)

-- | The event type associated with the detector specified for the
-- prediction.
getEventPrediction_eventTypeName :: Lens.Lens' GetEventPrediction Prelude.Text
getEventPrediction_eventTypeName :: Lens' GetEventPrediction Text
getEventPrediction_eventTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {Text
eventTypeName :: Text
$sel:eventTypeName:GetEventPrediction' :: GetEventPrediction -> Text
eventTypeName} -> Text
eventTypeName) (\s :: GetEventPrediction
s@GetEventPrediction' {} Text
a -> GetEventPrediction
s {$sel:eventTypeName:GetEventPrediction' :: Text
eventTypeName = Text
a} :: GetEventPrediction)

-- | The entity type (associated with the detector\'s event type) and
-- specific entity ID representing who performed the event. If an entity id
-- is not available, use \"UNKNOWN.\"
getEventPrediction_entities :: Lens.Lens' GetEventPrediction [Entity]
getEventPrediction_entities :: Lens' GetEventPrediction [Entity]
getEventPrediction_entities = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {[Sensitive Entity]
entities :: [Sensitive Entity]
$sel:entities:GetEventPrediction' :: GetEventPrediction -> [Sensitive Entity]
entities} -> [Sensitive Entity]
entities) (\s :: GetEventPrediction
s@GetEventPrediction' {} [Sensitive Entity]
a -> GetEventPrediction
s {$sel:entities:GetEventPrediction' :: [Sensitive Entity]
entities = [Sensitive Entity]
a} :: GetEventPrediction) 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

-- | Timestamp that defines when the event under evaluation occurred. The
-- timestamp must be specified using ISO 8601 standard in UTC.
getEventPrediction_eventTimestamp :: Lens.Lens' GetEventPrediction Prelude.Text
getEventPrediction_eventTimestamp :: Lens' GetEventPrediction Text
getEventPrediction_eventTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {Text
eventTimestamp :: Text
$sel:eventTimestamp:GetEventPrediction' :: GetEventPrediction -> Text
eventTimestamp} -> Text
eventTimestamp) (\s :: GetEventPrediction
s@GetEventPrediction' {} Text
a -> GetEventPrediction
s {$sel:eventTimestamp:GetEventPrediction' :: Text
eventTimestamp = Text
a} :: GetEventPrediction)

-- | Names of the event type\'s variables you defined in Amazon Fraud
-- Detector to represent data elements and their corresponding values for
-- the event you are sending for evaluation.
--
-- You must provide at least one eventVariable
--
-- To ensure most accurate fraud prediction and to simplify your data
-- preparation, Amazon Fraud Detector will replace all missing variables or
-- values as follows:
--
-- __For Amazon Fraud Detector trained models:__
--
-- If a null value is provided explicitly for a variable or if a variable
-- is missing, model will replace the null value or the missing variable
-- (no variable name in the eventVariables map) with calculated default
-- mean\/medians for numeric variables and with special values for
-- categorical variables.
--
-- __For imported SageMaker models:__
--
-- If a null value is provided explicitly for a variable, the model and
-- rules will use “null” as the value. If a variable is not provided (no
-- variable name in the eventVariables map), model and rules will use the
-- default value that is provided for the variable.
getEventPrediction_eventVariables :: Lens.Lens' GetEventPrediction (Prelude.HashMap Prelude.Text Prelude.Text)
getEventPrediction_eventVariables :: Lens' GetEventPrediction (HashMap Text Text)
getEventPrediction_eventVariables = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPrediction' {HashMap Text (Sensitive Text)
eventVariables :: HashMap Text (Sensitive Text)
$sel:eventVariables:GetEventPrediction' :: GetEventPrediction -> HashMap Text (Sensitive Text)
eventVariables} -> HashMap Text (Sensitive Text)
eventVariables) (\s :: GetEventPrediction
s@GetEventPrediction' {} HashMap Text (Sensitive Text)
a -> GetEventPrediction
s {$sel:eventVariables:GetEventPrediction' :: HashMap Text (Sensitive Text)
eventVariables = HashMap Text (Sensitive Text)
a} :: GetEventPrediction) 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

instance Core.AWSRequest GetEventPrediction where
  type
    AWSResponse GetEventPrediction =
      GetEventPredictionResponse
  request :: (Service -> Service)
-> GetEventPrediction -> Request GetEventPrediction
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 GetEventPrediction
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetEventPrediction)))
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 [ExternalModelOutputs]
-> Maybe [ModelScores]
-> Maybe [RuleResult]
-> Int
-> GetEventPredictionResponse
GetEventPredictionResponse'
            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
"externalModelOutputs"
                            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"modelScores" 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ruleResults" 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 GetEventPrediction where
  hashWithSalt :: Int -> GetEventPrediction -> Int
hashWithSalt Int
_salt GetEventPrediction' {[Sensitive Entity]
Maybe Text
Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
Text
HashMap Text (Sensitive Text)
eventVariables :: HashMap Text (Sensitive Text)
eventTimestamp :: Text
entities :: [Sensitive Entity]
eventTypeName :: Text
eventId :: Text
detectorId :: Text
externalModelEndpointDataBlobs :: Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
detectorVersionId :: Maybe Text
$sel:eventVariables:GetEventPrediction' :: GetEventPrediction -> HashMap Text (Sensitive Text)
$sel:eventTimestamp:GetEventPrediction' :: GetEventPrediction -> Text
$sel:entities:GetEventPrediction' :: GetEventPrediction -> [Sensitive Entity]
$sel:eventTypeName:GetEventPrediction' :: GetEventPrediction -> Text
$sel:eventId:GetEventPrediction' :: GetEventPrediction -> Text
$sel:detectorId:GetEventPrediction' :: GetEventPrediction -> Text
$sel:externalModelEndpointDataBlobs:GetEventPrediction' :: GetEventPrediction
-> Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
$sel:detectorVersionId:GetEventPrediction' :: GetEventPrediction -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
detectorVersionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Sensitive Entity]
entities
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text (Sensitive Text)
eventVariables

instance Prelude.NFData GetEventPrediction where
  rnf :: GetEventPrediction -> ()
rnf GetEventPrediction' {[Sensitive Entity]
Maybe Text
Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
Text
HashMap Text (Sensitive Text)
eventVariables :: HashMap Text (Sensitive Text)
eventTimestamp :: Text
entities :: [Sensitive Entity]
eventTypeName :: Text
eventId :: Text
detectorId :: Text
externalModelEndpointDataBlobs :: Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
detectorVersionId :: Maybe Text
$sel:eventVariables:GetEventPrediction' :: GetEventPrediction -> HashMap Text (Sensitive Text)
$sel:eventTimestamp:GetEventPrediction' :: GetEventPrediction -> Text
$sel:entities:GetEventPrediction' :: GetEventPrediction -> [Sensitive Entity]
$sel:eventTypeName:GetEventPrediction' :: GetEventPrediction -> Text
$sel:eventId:GetEventPrediction' :: GetEventPrediction -> Text
$sel:detectorId:GetEventPrediction' :: GetEventPrediction -> Text
$sel:externalModelEndpointDataBlobs:GetEventPrediction' :: GetEventPrediction
-> Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
$sel:detectorVersionId:GetEventPrediction' :: GetEventPrediction -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
detectorVersionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Sensitive Entity]
entities
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text (Sensitive Text)
eventVariables

instance Data.ToHeaders GetEventPrediction where
  toHeaders :: GetEventPrediction -> 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
"AWSHawksNestServiceFacade.GetEventPrediction" ::
                          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 GetEventPrediction where
  toJSON :: GetEventPrediction -> Value
toJSON GetEventPrediction' {[Sensitive Entity]
Maybe Text
Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
Text
HashMap Text (Sensitive Text)
eventVariables :: HashMap Text (Sensitive Text)
eventTimestamp :: Text
entities :: [Sensitive Entity]
eventTypeName :: Text
eventId :: Text
detectorId :: Text
externalModelEndpointDataBlobs :: Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
detectorVersionId :: Maybe Text
$sel:eventVariables:GetEventPrediction' :: GetEventPrediction -> HashMap Text (Sensitive Text)
$sel:eventTimestamp:GetEventPrediction' :: GetEventPrediction -> Text
$sel:entities:GetEventPrediction' :: GetEventPrediction -> [Sensitive Entity]
$sel:eventTypeName:GetEventPrediction' :: GetEventPrediction -> Text
$sel:eventId:GetEventPrediction' :: GetEventPrediction -> Text
$sel:detectorId:GetEventPrediction' :: GetEventPrediction -> Text
$sel:externalModelEndpointDataBlobs:GetEventPrediction' :: GetEventPrediction
-> Maybe (Sensitive (HashMap Text ModelEndpointDataBlob))
$sel:detectorVersionId:GetEventPrediction' :: GetEventPrediction -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"detectorVersionId" 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 Text
detectorVersionId,
            (Key
"externalModelEndpointDataBlobs" 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 (Sensitive (HashMap Text ModelEndpointDataBlob))
externalModelEndpointDataBlobs,
            forall a. a -> Maybe a
Prelude.Just (Key
"detectorId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
detectorId),
            forall a. a -> Maybe a
Prelude.Just (Key
"eventId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eventId),
            forall a. a -> Maybe a
Prelude.Just (Key
"eventTypeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eventTypeName),
            forall a. a -> Maybe a
Prelude.Just (Key
"entities" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Sensitive Entity]
entities),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"eventTimestamp" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eventTimestamp),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"eventVariables" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Text (Sensitive Text)
eventVariables)
          ]
      )

instance Data.ToPath GetEventPrediction where
  toPath :: GetEventPrediction -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery GetEventPrediction where
  toQuery :: GetEventPrediction -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetEventPredictionResponse' smart constructor.
data GetEventPredictionResponse = GetEventPredictionResponse'
  { -- | The model scores for Amazon SageMaker models.
    GetEventPredictionResponse -> Maybe [ExternalModelOutputs]
externalModelOutputs :: Prelude.Maybe [ExternalModelOutputs],
    -- | The model scores. Amazon Fraud Detector generates model scores between 0
    -- and 1000, where 0 is low fraud risk and 1000 is high fraud risk. Model
    -- scores are directly related to the false positive rate (FPR). For
    -- example, a score of 600 corresponds to an estimated 10% false positive
    -- rate whereas a score of 900 corresponds to an estimated 2% false
    -- positive rate.
    GetEventPredictionResponse -> Maybe [ModelScores]
modelScores :: Prelude.Maybe [ModelScores],
    -- | The results from the rules.
    GetEventPredictionResponse -> Maybe [RuleResult]
ruleResults :: Prelude.Maybe [RuleResult],
    -- | The response's http status code.
    GetEventPredictionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetEventPredictionResponse -> GetEventPredictionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetEventPredictionResponse -> GetEventPredictionResponse -> Bool
$c/= :: GetEventPredictionResponse -> GetEventPredictionResponse -> Bool
== :: GetEventPredictionResponse -> GetEventPredictionResponse -> Bool
$c== :: GetEventPredictionResponse -> GetEventPredictionResponse -> Bool
Prelude.Eq, ReadPrec [GetEventPredictionResponse]
ReadPrec GetEventPredictionResponse
Int -> ReadS GetEventPredictionResponse
ReadS [GetEventPredictionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetEventPredictionResponse]
$creadListPrec :: ReadPrec [GetEventPredictionResponse]
readPrec :: ReadPrec GetEventPredictionResponse
$creadPrec :: ReadPrec GetEventPredictionResponse
readList :: ReadS [GetEventPredictionResponse]
$creadList :: ReadS [GetEventPredictionResponse]
readsPrec :: Int -> ReadS GetEventPredictionResponse
$creadsPrec :: Int -> ReadS GetEventPredictionResponse
Prelude.Read, Int -> GetEventPredictionResponse -> ShowS
[GetEventPredictionResponse] -> ShowS
GetEventPredictionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetEventPredictionResponse] -> ShowS
$cshowList :: [GetEventPredictionResponse] -> ShowS
show :: GetEventPredictionResponse -> String
$cshow :: GetEventPredictionResponse -> String
showsPrec :: Int -> GetEventPredictionResponse -> ShowS
$cshowsPrec :: Int -> GetEventPredictionResponse -> ShowS
Prelude.Show, forall x.
Rep GetEventPredictionResponse x -> GetEventPredictionResponse
forall x.
GetEventPredictionResponse -> Rep GetEventPredictionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetEventPredictionResponse x -> GetEventPredictionResponse
$cfrom :: forall x.
GetEventPredictionResponse -> Rep GetEventPredictionResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetEventPredictionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'externalModelOutputs', 'getEventPredictionResponse_externalModelOutputs' - The model scores for Amazon SageMaker models.
--
-- 'modelScores', 'getEventPredictionResponse_modelScores' - The model scores. Amazon Fraud Detector generates model scores between 0
-- and 1000, where 0 is low fraud risk and 1000 is high fraud risk. Model
-- scores are directly related to the false positive rate (FPR). For
-- example, a score of 600 corresponds to an estimated 10% false positive
-- rate whereas a score of 900 corresponds to an estimated 2% false
-- positive rate.
--
-- 'ruleResults', 'getEventPredictionResponse_ruleResults' - The results from the rules.
--
-- 'httpStatus', 'getEventPredictionResponse_httpStatus' - The response's http status code.
newGetEventPredictionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetEventPredictionResponse
newGetEventPredictionResponse :: Int -> GetEventPredictionResponse
newGetEventPredictionResponse Int
pHttpStatus_ =
  GetEventPredictionResponse'
    { $sel:externalModelOutputs:GetEventPredictionResponse' :: Maybe [ExternalModelOutputs]
externalModelOutputs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:modelScores:GetEventPredictionResponse' :: Maybe [ModelScores]
modelScores = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleResults:GetEventPredictionResponse' :: Maybe [RuleResult]
ruleResults = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetEventPredictionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The model scores for Amazon SageMaker models.
getEventPredictionResponse_externalModelOutputs :: Lens.Lens' GetEventPredictionResponse (Prelude.Maybe [ExternalModelOutputs])
getEventPredictionResponse_externalModelOutputs :: Lens' GetEventPredictionResponse (Maybe [ExternalModelOutputs])
getEventPredictionResponse_externalModelOutputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPredictionResponse' {Maybe [ExternalModelOutputs]
externalModelOutputs :: Maybe [ExternalModelOutputs]
$sel:externalModelOutputs:GetEventPredictionResponse' :: GetEventPredictionResponse -> Maybe [ExternalModelOutputs]
externalModelOutputs} -> Maybe [ExternalModelOutputs]
externalModelOutputs) (\s :: GetEventPredictionResponse
s@GetEventPredictionResponse' {} Maybe [ExternalModelOutputs]
a -> GetEventPredictionResponse
s {$sel:externalModelOutputs:GetEventPredictionResponse' :: Maybe [ExternalModelOutputs]
externalModelOutputs = Maybe [ExternalModelOutputs]
a} :: GetEventPredictionResponse) 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

-- | The model scores. Amazon Fraud Detector generates model scores between 0
-- and 1000, where 0 is low fraud risk and 1000 is high fraud risk. Model
-- scores are directly related to the false positive rate (FPR). For
-- example, a score of 600 corresponds to an estimated 10% false positive
-- rate whereas a score of 900 corresponds to an estimated 2% false
-- positive rate.
getEventPredictionResponse_modelScores :: Lens.Lens' GetEventPredictionResponse (Prelude.Maybe [ModelScores])
getEventPredictionResponse_modelScores :: Lens' GetEventPredictionResponse (Maybe [ModelScores])
getEventPredictionResponse_modelScores = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPredictionResponse' {Maybe [ModelScores]
modelScores :: Maybe [ModelScores]
$sel:modelScores:GetEventPredictionResponse' :: GetEventPredictionResponse -> Maybe [ModelScores]
modelScores} -> Maybe [ModelScores]
modelScores) (\s :: GetEventPredictionResponse
s@GetEventPredictionResponse' {} Maybe [ModelScores]
a -> GetEventPredictionResponse
s {$sel:modelScores:GetEventPredictionResponse' :: Maybe [ModelScores]
modelScores = Maybe [ModelScores]
a} :: GetEventPredictionResponse) 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

-- | The results from the rules.
getEventPredictionResponse_ruleResults :: Lens.Lens' GetEventPredictionResponse (Prelude.Maybe [RuleResult])
getEventPredictionResponse_ruleResults :: Lens' GetEventPredictionResponse (Maybe [RuleResult])
getEventPredictionResponse_ruleResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPredictionResponse' {Maybe [RuleResult]
ruleResults :: Maybe [RuleResult]
$sel:ruleResults:GetEventPredictionResponse' :: GetEventPredictionResponse -> Maybe [RuleResult]
ruleResults} -> Maybe [RuleResult]
ruleResults) (\s :: GetEventPredictionResponse
s@GetEventPredictionResponse' {} Maybe [RuleResult]
a -> GetEventPredictionResponse
s {$sel:ruleResults:GetEventPredictionResponse' :: Maybe [RuleResult]
ruleResults = Maybe [RuleResult]
a} :: GetEventPredictionResponse) 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

-- | The response's http status code.
getEventPredictionResponse_httpStatus :: Lens.Lens' GetEventPredictionResponse Prelude.Int
getEventPredictionResponse_httpStatus :: Lens' GetEventPredictionResponse Int
getEventPredictionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetEventPredictionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetEventPredictionResponse' :: GetEventPredictionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetEventPredictionResponse
s@GetEventPredictionResponse' {} Int
a -> GetEventPredictionResponse
s {$sel:httpStatus:GetEventPredictionResponse' :: Int
httpStatus = Int
a} :: GetEventPredictionResponse)

instance Prelude.NFData GetEventPredictionResponse where
  rnf :: GetEventPredictionResponse -> ()
rnf GetEventPredictionResponse' {Int
Maybe [ExternalModelOutputs]
Maybe [ModelScores]
Maybe [RuleResult]
httpStatus :: Int
ruleResults :: Maybe [RuleResult]
modelScores :: Maybe [ModelScores]
externalModelOutputs :: Maybe [ExternalModelOutputs]
$sel:httpStatus:GetEventPredictionResponse' :: GetEventPredictionResponse -> Int
$sel:ruleResults:GetEventPredictionResponse' :: GetEventPredictionResponse -> Maybe [RuleResult]
$sel:modelScores:GetEventPredictionResponse' :: GetEventPredictionResponse -> Maybe [ModelScores]
$sel:externalModelOutputs:GetEventPredictionResponse' :: GetEventPredictionResponse -> Maybe [ExternalModelOutputs]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ExternalModelOutputs]
externalModelOutputs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ModelScores]
modelScores
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RuleResult]
ruleResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus