{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MachineLearning.Types.RealtimeEndpointInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Data.POSIX,
    -- | 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 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 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
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]
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
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. 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.
--
-- '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.
--
-- '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.
--
-- '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'
    { $sel:createdAt:RealtimeEndpointInfo' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointStatus:RealtimeEndpointInfo' :: Maybe RealtimeEndpointStatus
endpointStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointUrl:RealtimeEndpointInfo' :: Maybe Text
endpointUrl = forall a. Maybe a
Prelude.Nothing,
      $sel:peakRequestsPerSecond:RealtimeEndpointInfo' :: Maybe Int
peakRequestsPerSecond = 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 :: Lens' RealtimeEndpointInfo (Maybe UTCTime)
realtimeEndpointInfo_createdAt = 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) 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 :: Format). Iso' (Time a) UTCTime
Data._Time

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

instance Prelude.Hashable RealtimeEndpointInfo where
  hashWithSalt :: Int -> RealtimeEndpointInfo -> Int
hashWithSalt Int
_salt RealtimeEndpointInfo' {Maybe Int
Maybe Text
Maybe POSIX
Maybe RealtimeEndpointStatus
peakRequestsPerSecond :: Maybe Int
endpointUrl :: Maybe Text
endpointStatus :: Maybe RealtimeEndpointStatus
createdAt :: Maybe POSIX
$sel:peakRequestsPerSecond:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe Int
$sel:endpointUrl:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe Text
$sel:endpointStatus:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe RealtimeEndpointStatus
$sel:createdAt:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RealtimeEndpointStatus
endpointStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpointUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
peakRequestsPerSecond

instance Prelude.NFData RealtimeEndpointInfo where
  rnf :: RealtimeEndpointInfo -> ()
rnf RealtimeEndpointInfo' {Maybe Int
Maybe Text
Maybe POSIX
Maybe RealtimeEndpointStatus
peakRequestsPerSecond :: Maybe Int
endpointUrl :: Maybe Text
endpointStatus :: Maybe RealtimeEndpointStatus
createdAt :: Maybe POSIX
$sel:peakRequestsPerSecond:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe Int
$sel:endpointUrl:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe Text
$sel:endpointStatus:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe RealtimeEndpointStatus
$sel:createdAt:RealtimeEndpointInfo' :: RealtimeEndpointInfo -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RealtimeEndpointStatus
endpointStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpointUrl
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
peakRequestsPerSecond