{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.IoT.Types.BehaviorModelTrainingSummary
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.BehaviorModelTrainingSummary where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.ModelStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The summary of an ML Detect behavior model.
--
-- /See:/ 'newBehaviorModelTrainingSummary' smart constructor.
data BehaviorModelTrainingSummary = BehaviorModelTrainingSummary'
  { -- | The date the model was last refreshed.
    BehaviorModelTrainingSummary -> Maybe POSIX
lastModelRefreshDate :: Prelude.Maybe Core.POSIX,
    -- | The name of the behavior.
    BehaviorModelTrainingSummary -> Maybe Text
behaviorName :: Prelude.Maybe Prelude.Text,
    -- | The percentage of datapoints collected.
    BehaviorModelTrainingSummary -> Maybe Double
datapointsCollectionPercentage :: Prelude.Maybe Prelude.Double,
    -- | The name of the security profile.
    BehaviorModelTrainingSummary -> Maybe Text
securityProfileName :: Prelude.Maybe Prelude.Text,
    -- | The date a training model started collecting data.
    BehaviorModelTrainingSummary -> Maybe POSIX
trainingDataCollectionStartDate :: Prelude.Maybe Core.POSIX,
    -- | The status of the behavior model.
    BehaviorModelTrainingSummary -> Maybe ModelStatus
modelStatus :: Prelude.Maybe ModelStatus
  }
  deriving (BehaviorModelTrainingSummary
-> BehaviorModelTrainingSummary -> Bool
(BehaviorModelTrainingSummary
 -> BehaviorModelTrainingSummary -> Bool)
-> (BehaviorModelTrainingSummary
    -> BehaviorModelTrainingSummary -> Bool)
-> Eq BehaviorModelTrainingSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BehaviorModelTrainingSummary
-> BehaviorModelTrainingSummary -> Bool
$c/= :: BehaviorModelTrainingSummary
-> BehaviorModelTrainingSummary -> Bool
== :: BehaviorModelTrainingSummary
-> BehaviorModelTrainingSummary -> Bool
$c== :: BehaviorModelTrainingSummary
-> BehaviorModelTrainingSummary -> Bool
Prelude.Eq, ReadPrec [BehaviorModelTrainingSummary]
ReadPrec BehaviorModelTrainingSummary
Int -> ReadS BehaviorModelTrainingSummary
ReadS [BehaviorModelTrainingSummary]
(Int -> ReadS BehaviorModelTrainingSummary)
-> ReadS [BehaviorModelTrainingSummary]
-> ReadPrec BehaviorModelTrainingSummary
-> ReadPrec [BehaviorModelTrainingSummary]
-> Read BehaviorModelTrainingSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BehaviorModelTrainingSummary]
$creadListPrec :: ReadPrec [BehaviorModelTrainingSummary]
readPrec :: ReadPrec BehaviorModelTrainingSummary
$creadPrec :: ReadPrec BehaviorModelTrainingSummary
readList :: ReadS [BehaviorModelTrainingSummary]
$creadList :: ReadS [BehaviorModelTrainingSummary]
readsPrec :: Int -> ReadS BehaviorModelTrainingSummary
$creadsPrec :: Int -> ReadS BehaviorModelTrainingSummary
Prelude.Read, Int -> BehaviorModelTrainingSummary -> ShowS
[BehaviorModelTrainingSummary] -> ShowS
BehaviorModelTrainingSummary -> String
(Int -> BehaviorModelTrainingSummary -> ShowS)
-> (BehaviorModelTrainingSummary -> String)
-> ([BehaviorModelTrainingSummary] -> ShowS)
-> Show BehaviorModelTrainingSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BehaviorModelTrainingSummary] -> ShowS
$cshowList :: [BehaviorModelTrainingSummary] -> ShowS
show :: BehaviorModelTrainingSummary -> String
$cshow :: BehaviorModelTrainingSummary -> String
showsPrec :: Int -> BehaviorModelTrainingSummary -> ShowS
$cshowsPrec :: Int -> BehaviorModelTrainingSummary -> ShowS
Prelude.Show, (forall x.
 BehaviorModelTrainingSummary -> Rep BehaviorModelTrainingSummary x)
-> (forall x.
    Rep BehaviorModelTrainingSummary x -> BehaviorModelTrainingSummary)
-> Generic BehaviorModelTrainingSummary
forall x.
Rep BehaviorModelTrainingSummary x -> BehaviorModelTrainingSummary
forall x.
BehaviorModelTrainingSummary -> Rep BehaviorModelTrainingSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BehaviorModelTrainingSummary x -> BehaviorModelTrainingSummary
$cfrom :: forall x.
BehaviorModelTrainingSummary -> Rep BehaviorModelTrainingSummary x
Prelude.Generic)

-- |
-- Create a value of 'BehaviorModelTrainingSummary' 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:
--
-- 'lastModelRefreshDate', 'behaviorModelTrainingSummary_lastModelRefreshDate' - The date the model was last refreshed.
--
-- 'behaviorName', 'behaviorModelTrainingSummary_behaviorName' - The name of the behavior.
--
-- 'datapointsCollectionPercentage', 'behaviorModelTrainingSummary_datapointsCollectionPercentage' - The percentage of datapoints collected.
--
-- 'securityProfileName', 'behaviorModelTrainingSummary_securityProfileName' - The name of the security profile.
--
-- 'trainingDataCollectionStartDate', 'behaviorModelTrainingSummary_trainingDataCollectionStartDate' - The date a training model started collecting data.
--
-- 'modelStatus', 'behaviorModelTrainingSummary_modelStatus' - The status of the behavior model.
newBehaviorModelTrainingSummary ::
  BehaviorModelTrainingSummary
newBehaviorModelTrainingSummary :: BehaviorModelTrainingSummary
newBehaviorModelTrainingSummary =
  BehaviorModelTrainingSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe POSIX
-> Maybe ModelStatus
-> BehaviorModelTrainingSummary
BehaviorModelTrainingSummary'
    { $sel:lastModelRefreshDate:BehaviorModelTrainingSummary' :: Maybe POSIX
lastModelRefreshDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:behaviorName:BehaviorModelTrainingSummary' :: Maybe Text
behaviorName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datapointsCollectionPercentage:BehaviorModelTrainingSummary' :: Maybe Double
datapointsCollectionPercentage =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:securityProfileName:BehaviorModelTrainingSummary' :: Maybe Text
securityProfileName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:trainingDataCollectionStartDate:BehaviorModelTrainingSummary' :: Maybe POSIX
trainingDataCollectionStartDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:modelStatus:BehaviorModelTrainingSummary' :: Maybe ModelStatus
modelStatus = Maybe ModelStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The date the model was last refreshed.
behaviorModelTrainingSummary_lastModelRefreshDate :: Lens.Lens' BehaviorModelTrainingSummary (Prelude.Maybe Prelude.UTCTime)
behaviorModelTrainingSummary_lastModelRefreshDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary
behaviorModelTrainingSummary_lastModelRefreshDate = (BehaviorModelTrainingSummary -> Maybe POSIX)
-> (BehaviorModelTrainingSummary
    -> Maybe POSIX -> BehaviorModelTrainingSummary)
-> Lens
     BehaviorModelTrainingSummary
     BehaviorModelTrainingSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BehaviorModelTrainingSummary' {Maybe POSIX
lastModelRefreshDate :: Maybe POSIX
$sel:lastModelRefreshDate:BehaviorModelTrainingSummary' :: BehaviorModelTrainingSummary -> Maybe POSIX
lastModelRefreshDate} -> Maybe POSIX
lastModelRefreshDate) (\s :: BehaviorModelTrainingSummary
s@BehaviorModelTrainingSummary' {} Maybe POSIX
a -> BehaviorModelTrainingSummary
s {$sel:lastModelRefreshDate:BehaviorModelTrainingSummary' :: Maybe POSIX
lastModelRefreshDate = Maybe POSIX
a} :: BehaviorModelTrainingSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> BehaviorModelTrainingSummary
-> f BehaviorModelTrainingSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name of the behavior.
behaviorModelTrainingSummary_behaviorName :: Lens.Lens' BehaviorModelTrainingSummary (Prelude.Maybe Prelude.Text)
behaviorModelTrainingSummary_behaviorName :: (Maybe Text -> f (Maybe Text))
-> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary
behaviorModelTrainingSummary_behaviorName = (BehaviorModelTrainingSummary -> Maybe Text)
-> (BehaviorModelTrainingSummary
    -> Maybe Text -> BehaviorModelTrainingSummary)
-> Lens
     BehaviorModelTrainingSummary
     BehaviorModelTrainingSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BehaviorModelTrainingSummary' {Maybe Text
behaviorName :: Maybe Text
$sel:behaviorName:BehaviorModelTrainingSummary' :: BehaviorModelTrainingSummary -> Maybe Text
behaviorName} -> Maybe Text
behaviorName) (\s :: BehaviorModelTrainingSummary
s@BehaviorModelTrainingSummary' {} Maybe Text
a -> BehaviorModelTrainingSummary
s {$sel:behaviorName:BehaviorModelTrainingSummary' :: Maybe Text
behaviorName = Maybe Text
a} :: BehaviorModelTrainingSummary)

-- | The percentage of datapoints collected.
behaviorModelTrainingSummary_datapointsCollectionPercentage :: Lens.Lens' BehaviorModelTrainingSummary (Prelude.Maybe Prelude.Double)
behaviorModelTrainingSummary_datapointsCollectionPercentage :: (Maybe Double -> f (Maybe Double))
-> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary
behaviorModelTrainingSummary_datapointsCollectionPercentage = (BehaviorModelTrainingSummary -> Maybe Double)
-> (BehaviorModelTrainingSummary
    -> Maybe Double -> BehaviorModelTrainingSummary)
-> Lens
     BehaviorModelTrainingSummary
     BehaviorModelTrainingSummary
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BehaviorModelTrainingSummary' {Maybe Double
datapointsCollectionPercentage :: Maybe Double
$sel:datapointsCollectionPercentage:BehaviorModelTrainingSummary' :: BehaviorModelTrainingSummary -> Maybe Double
datapointsCollectionPercentage} -> Maybe Double
datapointsCollectionPercentage) (\s :: BehaviorModelTrainingSummary
s@BehaviorModelTrainingSummary' {} Maybe Double
a -> BehaviorModelTrainingSummary
s {$sel:datapointsCollectionPercentage:BehaviorModelTrainingSummary' :: Maybe Double
datapointsCollectionPercentage = Maybe Double
a} :: BehaviorModelTrainingSummary)

-- | The name of the security profile.
behaviorModelTrainingSummary_securityProfileName :: Lens.Lens' BehaviorModelTrainingSummary (Prelude.Maybe Prelude.Text)
behaviorModelTrainingSummary_securityProfileName :: (Maybe Text -> f (Maybe Text))
-> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary
behaviorModelTrainingSummary_securityProfileName = (BehaviorModelTrainingSummary -> Maybe Text)
-> (BehaviorModelTrainingSummary
    -> Maybe Text -> BehaviorModelTrainingSummary)
-> Lens
     BehaviorModelTrainingSummary
     BehaviorModelTrainingSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BehaviorModelTrainingSummary' {Maybe Text
securityProfileName :: Maybe Text
$sel:securityProfileName:BehaviorModelTrainingSummary' :: BehaviorModelTrainingSummary -> Maybe Text
securityProfileName} -> Maybe Text
securityProfileName) (\s :: BehaviorModelTrainingSummary
s@BehaviorModelTrainingSummary' {} Maybe Text
a -> BehaviorModelTrainingSummary
s {$sel:securityProfileName:BehaviorModelTrainingSummary' :: Maybe Text
securityProfileName = Maybe Text
a} :: BehaviorModelTrainingSummary)

-- | The date a training model started collecting data.
behaviorModelTrainingSummary_trainingDataCollectionStartDate :: Lens.Lens' BehaviorModelTrainingSummary (Prelude.Maybe Prelude.UTCTime)
behaviorModelTrainingSummary_trainingDataCollectionStartDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary
behaviorModelTrainingSummary_trainingDataCollectionStartDate = (BehaviorModelTrainingSummary -> Maybe POSIX)
-> (BehaviorModelTrainingSummary
    -> Maybe POSIX -> BehaviorModelTrainingSummary)
-> Lens
     BehaviorModelTrainingSummary
     BehaviorModelTrainingSummary
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BehaviorModelTrainingSummary' {Maybe POSIX
trainingDataCollectionStartDate :: Maybe POSIX
$sel:trainingDataCollectionStartDate:BehaviorModelTrainingSummary' :: BehaviorModelTrainingSummary -> Maybe POSIX
trainingDataCollectionStartDate} -> Maybe POSIX
trainingDataCollectionStartDate) (\s :: BehaviorModelTrainingSummary
s@BehaviorModelTrainingSummary' {} Maybe POSIX
a -> BehaviorModelTrainingSummary
s {$sel:trainingDataCollectionStartDate:BehaviorModelTrainingSummary' :: Maybe POSIX
trainingDataCollectionStartDate = Maybe POSIX
a} :: BehaviorModelTrainingSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> BehaviorModelTrainingSummary
-> f BehaviorModelTrainingSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of the behavior model.
behaviorModelTrainingSummary_modelStatus :: Lens.Lens' BehaviorModelTrainingSummary (Prelude.Maybe ModelStatus)
behaviorModelTrainingSummary_modelStatus :: (Maybe ModelStatus -> f (Maybe ModelStatus))
-> BehaviorModelTrainingSummary -> f BehaviorModelTrainingSummary
behaviorModelTrainingSummary_modelStatus = (BehaviorModelTrainingSummary -> Maybe ModelStatus)
-> (BehaviorModelTrainingSummary
    -> Maybe ModelStatus -> BehaviorModelTrainingSummary)
-> Lens
     BehaviorModelTrainingSummary
     BehaviorModelTrainingSummary
     (Maybe ModelStatus)
     (Maybe ModelStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BehaviorModelTrainingSummary' {Maybe ModelStatus
modelStatus :: Maybe ModelStatus
$sel:modelStatus:BehaviorModelTrainingSummary' :: BehaviorModelTrainingSummary -> Maybe ModelStatus
modelStatus} -> Maybe ModelStatus
modelStatus) (\s :: BehaviorModelTrainingSummary
s@BehaviorModelTrainingSummary' {} Maybe ModelStatus
a -> BehaviorModelTrainingSummary
s {$sel:modelStatus:BehaviorModelTrainingSummary' :: Maybe ModelStatus
modelStatus = Maybe ModelStatus
a} :: BehaviorModelTrainingSummary)

instance Core.FromJSON BehaviorModelTrainingSummary where
  parseJSON :: Value -> Parser BehaviorModelTrainingSummary
parseJSON =
    String
-> (Object -> Parser BehaviorModelTrainingSummary)
-> Value
-> Parser BehaviorModelTrainingSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BehaviorModelTrainingSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Double
-> Maybe Text
-> Maybe POSIX
-> Maybe ModelStatus
-> BehaviorModelTrainingSummary
BehaviorModelTrainingSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Double
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe ModelStatus
 -> BehaviorModelTrainingSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ModelStatus
      -> BehaviorModelTrainingSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastModelRefreshDate")
            Parser
  (Maybe Text
   -> Maybe Double
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ModelStatus
   -> BehaviorModelTrainingSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe ModelStatus
      -> BehaviorModelTrainingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"behaviorName")
            Parser
  (Maybe Double
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe ModelStatus
   -> BehaviorModelTrainingSummary)
-> Parser (Maybe Double)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe ModelStatus
      -> BehaviorModelTrainingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"datapointsCollectionPercentage")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe ModelStatus
   -> BehaviorModelTrainingSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe ModelStatus -> BehaviorModelTrainingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityProfileName")
            Parser
  (Maybe POSIX -> Maybe ModelStatus -> BehaviorModelTrainingSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe ModelStatus -> BehaviorModelTrainingSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"trainingDataCollectionStartDate")
            Parser (Maybe ModelStatus -> BehaviorModelTrainingSummary)
-> Parser (Maybe ModelStatus)
-> Parser BehaviorModelTrainingSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ModelStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"modelStatus")
      )

instance
  Prelude.Hashable
    BehaviorModelTrainingSummary

instance Prelude.NFData BehaviorModelTrainingSummary