{-# 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.SageMaker.Types.EdgeModel
-- 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.SageMaker.Types.EdgeModel where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The model on the edge device.
--
-- /See:/ 'newEdgeModel' smart constructor.
data EdgeModel = EdgeModel'
  { -- | The timestamp of the last inference that was made.
    EdgeModel -> Maybe POSIX
latestInference :: Prelude.Maybe Core.POSIX,
    -- | The timestamp of the last data sample taken.
    EdgeModel -> Maybe POSIX
latestSampleTime :: Prelude.Maybe Core.POSIX,
    -- | The name of the model.
    EdgeModel -> Text
modelName :: Prelude.Text,
    -- | The model version.
    EdgeModel -> Text
modelVersion :: Prelude.Text
  }
  deriving (EdgeModel -> EdgeModel -> Bool
(EdgeModel -> EdgeModel -> Bool)
-> (EdgeModel -> EdgeModel -> Bool) -> Eq EdgeModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EdgeModel -> EdgeModel -> Bool
$c/= :: EdgeModel -> EdgeModel -> Bool
== :: EdgeModel -> EdgeModel -> Bool
$c== :: EdgeModel -> EdgeModel -> Bool
Prelude.Eq, ReadPrec [EdgeModel]
ReadPrec EdgeModel
Int -> ReadS EdgeModel
ReadS [EdgeModel]
(Int -> ReadS EdgeModel)
-> ReadS [EdgeModel]
-> ReadPrec EdgeModel
-> ReadPrec [EdgeModel]
-> Read EdgeModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EdgeModel]
$creadListPrec :: ReadPrec [EdgeModel]
readPrec :: ReadPrec EdgeModel
$creadPrec :: ReadPrec EdgeModel
readList :: ReadS [EdgeModel]
$creadList :: ReadS [EdgeModel]
readsPrec :: Int -> ReadS EdgeModel
$creadsPrec :: Int -> ReadS EdgeModel
Prelude.Read, Int -> EdgeModel -> ShowS
[EdgeModel] -> ShowS
EdgeModel -> String
(Int -> EdgeModel -> ShowS)
-> (EdgeModel -> String)
-> ([EdgeModel] -> ShowS)
-> Show EdgeModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EdgeModel] -> ShowS
$cshowList :: [EdgeModel] -> ShowS
show :: EdgeModel -> String
$cshow :: EdgeModel -> String
showsPrec :: Int -> EdgeModel -> ShowS
$cshowsPrec :: Int -> EdgeModel -> ShowS
Prelude.Show, (forall x. EdgeModel -> Rep EdgeModel x)
-> (forall x. Rep EdgeModel x -> EdgeModel) -> Generic EdgeModel
forall x. Rep EdgeModel x -> EdgeModel
forall x. EdgeModel -> Rep EdgeModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EdgeModel x -> EdgeModel
$cfrom :: forall x. EdgeModel -> Rep EdgeModel x
Prelude.Generic)

-- |
-- Create a value of 'EdgeModel' 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:
--
-- 'latestInference', 'edgeModel_latestInference' - The timestamp of the last inference that was made.
--
-- 'latestSampleTime', 'edgeModel_latestSampleTime' - The timestamp of the last data sample taken.
--
-- 'modelName', 'edgeModel_modelName' - The name of the model.
--
-- 'modelVersion', 'edgeModel_modelVersion' - The model version.
newEdgeModel ::
  -- | 'modelName'
  Prelude.Text ->
  -- | 'modelVersion'
  Prelude.Text ->
  EdgeModel
newEdgeModel :: Text -> Text -> EdgeModel
newEdgeModel Text
pModelName_ Text
pModelVersion_ =
  EdgeModel' :: Maybe POSIX -> Maybe POSIX -> Text -> Text -> EdgeModel
EdgeModel'
    { $sel:latestInference:EdgeModel' :: Maybe POSIX
latestInference = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:latestSampleTime:EdgeModel' :: Maybe POSIX
latestSampleTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:modelName:EdgeModel' :: Text
modelName = Text
pModelName_,
      $sel:modelVersion:EdgeModel' :: Text
modelVersion = Text
pModelVersion_
    }

-- | The timestamp of the last inference that was made.
edgeModel_latestInference :: Lens.Lens' EdgeModel (Prelude.Maybe Prelude.UTCTime)
edgeModel_latestInference :: (Maybe UTCTime -> f (Maybe UTCTime)) -> EdgeModel -> f EdgeModel
edgeModel_latestInference = (EdgeModel -> Maybe POSIX)
-> (EdgeModel -> Maybe POSIX -> EdgeModel)
-> Lens EdgeModel EdgeModel (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeModel' {Maybe POSIX
latestInference :: Maybe POSIX
$sel:latestInference:EdgeModel' :: EdgeModel -> Maybe POSIX
latestInference} -> Maybe POSIX
latestInference) (\s :: EdgeModel
s@EdgeModel' {} Maybe POSIX
a -> EdgeModel
s {$sel:latestInference:EdgeModel' :: Maybe POSIX
latestInference = Maybe POSIX
a} :: EdgeModel) ((Maybe POSIX -> f (Maybe POSIX)) -> EdgeModel -> f EdgeModel)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EdgeModel
-> f EdgeModel
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 timestamp of the last data sample taken.
edgeModel_latestSampleTime :: Lens.Lens' EdgeModel (Prelude.Maybe Prelude.UTCTime)
edgeModel_latestSampleTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> EdgeModel -> f EdgeModel
edgeModel_latestSampleTime = (EdgeModel -> Maybe POSIX)
-> (EdgeModel -> Maybe POSIX -> EdgeModel)
-> Lens EdgeModel EdgeModel (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeModel' {Maybe POSIX
latestSampleTime :: Maybe POSIX
$sel:latestSampleTime:EdgeModel' :: EdgeModel -> Maybe POSIX
latestSampleTime} -> Maybe POSIX
latestSampleTime) (\s :: EdgeModel
s@EdgeModel' {} Maybe POSIX
a -> EdgeModel
s {$sel:latestSampleTime:EdgeModel' :: Maybe POSIX
latestSampleTime = Maybe POSIX
a} :: EdgeModel) ((Maybe POSIX -> f (Maybe POSIX)) -> EdgeModel -> f EdgeModel)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EdgeModel
-> f EdgeModel
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 model.
edgeModel_modelName :: Lens.Lens' EdgeModel Prelude.Text
edgeModel_modelName :: (Text -> f Text) -> EdgeModel -> f EdgeModel
edgeModel_modelName = (EdgeModel -> Text)
-> (EdgeModel -> Text -> EdgeModel)
-> Lens EdgeModel EdgeModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeModel' {Text
modelName :: Text
$sel:modelName:EdgeModel' :: EdgeModel -> Text
modelName} -> Text
modelName) (\s :: EdgeModel
s@EdgeModel' {} Text
a -> EdgeModel
s {$sel:modelName:EdgeModel' :: Text
modelName = Text
a} :: EdgeModel)

-- | The model version.
edgeModel_modelVersion :: Lens.Lens' EdgeModel Prelude.Text
edgeModel_modelVersion :: (Text -> f Text) -> EdgeModel -> f EdgeModel
edgeModel_modelVersion = (EdgeModel -> Text)
-> (EdgeModel -> Text -> EdgeModel)
-> Lens EdgeModel EdgeModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EdgeModel' {Text
modelVersion :: Text
$sel:modelVersion:EdgeModel' :: EdgeModel -> Text
modelVersion} -> Text
modelVersion) (\s :: EdgeModel
s@EdgeModel' {} Text
a -> EdgeModel
s {$sel:modelVersion:EdgeModel' :: Text
modelVersion = Text
a} :: EdgeModel)

instance Core.FromJSON EdgeModel where
  parseJSON :: Value -> Parser EdgeModel
parseJSON =
    String -> (Object -> Parser EdgeModel) -> Value -> Parser EdgeModel
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EdgeModel"
      ( \Object
x ->
          Maybe POSIX -> Maybe POSIX -> Text -> Text -> EdgeModel
EdgeModel'
            (Maybe POSIX -> Maybe POSIX -> Text -> Text -> EdgeModel)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> Text -> Text -> EdgeModel)
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
"LatestInference")
            Parser (Maybe POSIX -> Text -> Text -> EdgeModel)
-> Parser (Maybe POSIX) -> Parser (Text -> Text -> EdgeModel)
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
"LatestSampleTime")
            Parser (Text -> Text -> EdgeModel)
-> Parser Text -> Parser (Text -> EdgeModel)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ModelName")
            Parser (Text -> EdgeModel) -> Parser Text -> Parser EdgeModel
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ModelVersion")
      )

instance Prelude.Hashable EdgeModel

instance Prelude.NFData EdgeModel