{-# 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.MachineLearning.Types.RealtimeEndpointInfo
-- 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.MachineLearning.Types.RealtimeEndpointInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types.RealtimeEndpointStatus
import qualified Amazonka.Prelude as Prelude

-- | Describes the real-time endpoint information for an @MLModel@.
--
-- /See:/ 'newRealtimeEndpointInfo' smart constructor.
data RealtimeEndpointInfo = RealtimeEndpointInfo'
  { -- | The time that the request to create the real-time endpoint for the
    -- @MLModel@ was received. The time is expressed in epoch time.
    RealtimeEndpointInfo -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The URI that specifies where to send real-time prediction requests for
    -- the @MLModel@.
    --
    -- __Note:__ The application must wait until the real-time endpoint is
    -- ready before using this URI.
    RealtimeEndpointInfo -> Maybe Text
endpointUrl :: Prelude.Maybe Prelude.Text,
    -- | The current status of the real-time endpoint for the @MLModel@. This
    -- element can have one of the following values:
    --
    -- -   @NONE@ - Endpoint does not exist or was previously deleted.
    --
    -- -   @READY@ - Endpoint is ready to be used for real-time predictions.
    --
    -- -   @UPDATING@ - Updating\/creating the endpoint.
    RealtimeEndpointInfo -> Maybe RealtimeEndpointStatus
endpointStatus :: Prelude.Maybe RealtimeEndpointStatus,
    -- | The maximum processing rate for the real-time endpoint for @MLModel@,
    -- measured in incoming requests per second.
    RealtimeEndpointInfo -> Maybe Int
peakRequestsPerSecond :: Prelude.Maybe Prelude.Int
  }
  deriving (RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool
(RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool)
-> (RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool)
-> Eq RealtimeEndpointInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool
$c/= :: RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool
== :: RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool
$c== :: RealtimeEndpointInfo -> RealtimeEndpointInfo -> Bool
Prelude.Eq, ReadPrec [RealtimeEndpointInfo]
ReadPrec RealtimeEndpointInfo
Int -> ReadS RealtimeEndpointInfo
ReadS [RealtimeEndpointInfo]
(Int -> ReadS RealtimeEndpointInfo)
-> ReadS [RealtimeEndpointInfo]
-> ReadPrec RealtimeEndpointInfo
-> ReadPrec [RealtimeEndpointInfo]
-> Read RealtimeEndpointInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RealtimeEndpointInfo]
$creadListPrec :: ReadPrec [RealtimeEndpointInfo]
readPrec :: ReadPrec RealtimeEndpointInfo
$creadPrec :: ReadPrec RealtimeEndpointInfo
readList :: ReadS [RealtimeEndpointInfo]
$creadList :: ReadS [RealtimeEndpointInfo]
readsPrec :: Int -> ReadS RealtimeEndpointInfo
$creadsPrec :: Int -> ReadS RealtimeEndpointInfo
Prelude.Read, Int -> RealtimeEndpointInfo -> ShowS
[RealtimeEndpointInfo] -> ShowS
RealtimeEndpointInfo -> String
(Int -> RealtimeEndpointInfo -> ShowS)
-> (RealtimeEndpointInfo -> String)
-> ([RealtimeEndpointInfo] -> ShowS)
-> Show RealtimeEndpointInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RealtimeEndpointInfo] -> ShowS
$cshowList :: [RealtimeEndpointInfo] -> ShowS
show :: RealtimeEndpointInfo -> String
$cshow :: RealtimeEndpointInfo -> String
showsPrec :: Int -> RealtimeEndpointInfo -> ShowS
$cshowsPrec :: Int -> RealtimeEndpointInfo -> ShowS
Prelude.Show, (forall x. RealtimeEndpointInfo -> Rep RealtimeEndpointInfo x)
-> (forall x. Rep RealtimeEndpointInfo x -> RealtimeEndpointInfo)
-> Generic RealtimeEndpointInfo
forall x. Rep RealtimeEndpointInfo x -> RealtimeEndpointInfo
forall x. RealtimeEndpointInfo -> Rep RealtimeEndpointInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RealtimeEndpointInfo x -> RealtimeEndpointInfo
$cfrom :: forall x. RealtimeEndpointInfo -> Rep RealtimeEndpointInfo x
Prelude.Generic)

-- |
-- Create a value of 'RealtimeEndpointInfo' 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:
--
-- 'createdAt', 'realtimeEndpointInfo_createdAt' - The time that the request to create the real-time endpoint for the
-- @MLModel@ was received. The time is expressed in epoch time.
--
-- 'endpointUrl', 'realtimeEndpointInfo_endpointUrl' - The URI that specifies where to send real-time prediction requests for
-- the @MLModel@.
--
-- __Note:__ The application must wait until the real-time endpoint is
-- ready before using this URI.
--
-- 'endpointStatus', 'realtimeEndpointInfo_endpointStatus' - The current status of the real-time endpoint for the @MLModel@. This
-- element can have one of the following values:
--
-- -   @NONE@ - Endpoint does not exist or was previously deleted.
--
-- -   @READY@ - Endpoint is ready to be used for real-time predictions.
--
-- -   @UPDATING@ - Updating\/creating the endpoint.
--
-- 'peakRequestsPerSecond', 'realtimeEndpointInfo_peakRequestsPerSecond' - The maximum processing rate for the real-time endpoint for @MLModel@,
-- measured in incoming requests per second.
newRealtimeEndpointInfo ::
  RealtimeEndpointInfo
newRealtimeEndpointInfo :: RealtimeEndpointInfo
newRealtimeEndpointInfo =
  RealtimeEndpointInfo' :: Maybe POSIX
-> Maybe Text
-> Maybe RealtimeEndpointStatus
-> Maybe Int
-> RealtimeEndpointInfo
RealtimeEndpointInfo'
    { $sel:createdAt:RealtimeEndpointInfo' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointUrl:RealtimeEndpointInfo' :: Maybe Text
endpointUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointStatus:RealtimeEndpointInfo' :: Maybe RealtimeEndpointStatus
endpointStatus = Maybe RealtimeEndpointStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:peakRequestsPerSecond:RealtimeEndpointInfo' :: Maybe Int
peakRequestsPerSecond = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The time that the request to create the real-time endpoint for the
-- @MLModel@ was received. The time is expressed in epoch time.
realtimeEndpointInfo_createdAt :: Lens.Lens' RealtimeEndpointInfo (Prelude.Maybe Prelude.UTCTime)
realtimeEndpointInfo_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RealtimeEndpointInfo -> f RealtimeEndpointInfo
realtimeEndpointInfo_createdAt = (RealtimeEndpointInfo -> Maybe POSIX)
-> (RealtimeEndpointInfo -> Maybe POSIX -> RealtimeEndpointInfo)
-> Lens
     RealtimeEndpointInfo
     RealtimeEndpointInfo
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeEndpointInfo' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: RealtimeEndpointInfo
s@RealtimeEndpointInfo' {} Maybe POSIX
a -> RealtimeEndpointInfo
s {$sel:createdAt:RealtimeEndpointInfo' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: RealtimeEndpointInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> RealtimeEndpointInfo -> f RealtimeEndpointInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RealtimeEndpointInfo
-> f RealtimeEndpointInfo
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 URI that specifies where to send real-time prediction requests for
-- the @MLModel@.
--
-- __Note:__ The application must wait until the real-time endpoint is
-- ready before using this URI.
realtimeEndpointInfo_endpointUrl :: Lens.Lens' RealtimeEndpointInfo (Prelude.Maybe Prelude.Text)
realtimeEndpointInfo_endpointUrl :: (Maybe Text -> f (Maybe Text))
-> RealtimeEndpointInfo -> f RealtimeEndpointInfo
realtimeEndpointInfo_endpointUrl = (RealtimeEndpointInfo -> Maybe Text)
-> (RealtimeEndpointInfo -> Maybe Text -> RealtimeEndpointInfo)
-> Lens
     RealtimeEndpointInfo RealtimeEndpointInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeEndpointInfo' {Maybe Text
endpointUrl :: Maybe Text
$sel:endpointUrl:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe Text
endpointUrl} -> Maybe Text
endpointUrl) (\s :: RealtimeEndpointInfo
s@RealtimeEndpointInfo' {} Maybe Text
a -> RealtimeEndpointInfo
s {$sel:endpointUrl:RealtimeEndpointInfo' :: Maybe Text
endpointUrl = Maybe Text
a} :: RealtimeEndpointInfo)

-- | The current status of the real-time endpoint for the @MLModel@. This
-- element can have one of the following values:
--
-- -   @NONE@ - Endpoint does not exist or was previously deleted.
--
-- -   @READY@ - Endpoint is ready to be used for real-time predictions.
--
-- -   @UPDATING@ - Updating\/creating the endpoint.
realtimeEndpointInfo_endpointStatus :: Lens.Lens' RealtimeEndpointInfo (Prelude.Maybe RealtimeEndpointStatus)
realtimeEndpointInfo_endpointStatus :: (Maybe RealtimeEndpointStatus -> f (Maybe RealtimeEndpointStatus))
-> RealtimeEndpointInfo -> f RealtimeEndpointInfo
realtimeEndpointInfo_endpointStatus = (RealtimeEndpointInfo -> Maybe RealtimeEndpointStatus)
-> (RealtimeEndpointInfo
    -> Maybe RealtimeEndpointStatus -> RealtimeEndpointInfo)
-> Lens
     RealtimeEndpointInfo
     RealtimeEndpointInfo
     (Maybe RealtimeEndpointStatus)
     (Maybe RealtimeEndpointStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeEndpointInfo' {Maybe RealtimeEndpointStatus
endpointStatus :: Maybe RealtimeEndpointStatus
$sel:endpointStatus:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe RealtimeEndpointStatus
endpointStatus} -> Maybe RealtimeEndpointStatus
endpointStatus) (\s :: RealtimeEndpointInfo
s@RealtimeEndpointInfo' {} Maybe RealtimeEndpointStatus
a -> RealtimeEndpointInfo
s {$sel:endpointStatus:RealtimeEndpointInfo' :: Maybe RealtimeEndpointStatus
endpointStatus = Maybe RealtimeEndpointStatus
a} :: RealtimeEndpointInfo)

-- | The maximum processing rate for the real-time endpoint for @MLModel@,
-- measured in incoming requests per second.
realtimeEndpointInfo_peakRequestsPerSecond :: Lens.Lens' RealtimeEndpointInfo (Prelude.Maybe Prelude.Int)
realtimeEndpointInfo_peakRequestsPerSecond :: (Maybe Int -> f (Maybe Int))
-> RealtimeEndpointInfo -> f RealtimeEndpointInfo
realtimeEndpointInfo_peakRequestsPerSecond = (RealtimeEndpointInfo -> Maybe Int)
-> (RealtimeEndpointInfo -> Maybe Int -> RealtimeEndpointInfo)
-> Lens
     RealtimeEndpointInfo RealtimeEndpointInfo (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeEndpointInfo' {Maybe Int
peakRequestsPerSecond :: Maybe Int
$sel:peakRequestsPerSecond:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe Int
peakRequestsPerSecond} -> Maybe Int
peakRequestsPerSecond) (\s :: RealtimeEndpointInfo
s@RealtimeEndpointInfo' {} Maybe Int
a -> RealtimeEndpointInfo
s {$sel:peakRequestsPerSecond:RealtimeEndpointInfo' :: Maybe Int
peakRequestsPerSecond = Maybe Int
a} :: RealtimeEndpointInfo)

instance Core.FromJSON RealtimeEndpointInfo where
  parseJSON :: Value -> Parser RealtimeEndpointInfo
parseJSON =
    String
-> (Object -> Parser RealtimeEndpointInfo)
-> Value
-> Parser RealtimeEndpointInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RealtimeEndpointInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe RealtimeEndpointStatus
-> Maybe Int
-> RealtimeEndpointInfo
RealtimeEndpointInfo'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe RealtimeEndpointStatus
 -> Maybe Int
 -> RealtimeEndpointInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe RealtimeEndpointStatus
      -> Maybe Int
      -> RealtimeEndpointInfo)
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
"CreatedAt")
            Parser
  (Maybe Text
   -> Maybe RealtimeEndpointStatus
   -> Maybe Int
   -> RealtimeEndpointInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe RealtimeEndpointStatus -> Maybe Int -> RealtimeEndpointInfo)
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
"EndpointUrl")
            Parser
  (Maybe RealtimeEndpointStatus -> Maybe Int -> RealtimeEndpointInfo)
-> Parser (Maybe RealtimeEndpointStatus)
-> Parser (Maybe Int -> RealtimeEndpointInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RealtimeEndpointStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndpointStatus")
            Parser (Maybe Int -> RealtimeEndpointInfo)
-> Parser (Maybe Int) -> Parser RealtimeEndpointInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PeakRequestsPerSecond")
      )

instance Prelude.Hashable RealtimeEndpointInfo

instance Prelude.NFData RealtimeEndpointInfo