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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.EndpointInfo
import Amazonka.SageMaker.Types.InferenceMetrics

-- | The performance results from running an Inference Recommender job on an
-- existing endpoint.
--
-- /See:/ 'newEndpointPerformance' smart constructor.
data EndpointPerformance = EndpointPerformance'
  { -- | The metrics for an existing endpoint.
    EndpointPerformance -> InferenceMetrics
metrics :: InferenceMetrics,
    EndpointPerformance -> EndpointInfo
endpointInfo :: EndpointInfo
  }
  deriving (EndpointPerformance -> EndpointPerformance -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointPerformance -> EndpointPerformance -> Bool
$c/= :: EndpointPerformance -> EndpointPerformance -> Bool
== :: EndpointPerformance -> EndpointPerformance -> Bool
$c== :: EndpointPerformance -> EndpointPerformance -> Bool
Prelude.Eq, ReadPrec [EndpointPerformance]
ReadPrec EndpointPerformance
Int -> ReadS EndpointPerformance
ReadS [EndpointPerformance]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointPerformance]
$creadListPrec :: ReadPrec [EndpointPerformance]
readPrec :: ReadPrec EndpointPerformance
$creadPrec :: ReadPrec EndpointPerformance
readList :: ReadS [EndpointPerformance]
$creadList :: ReadS [EndpointPerformance]
readsPrec :: Int -> ReadS EndpointPerformance
$creadsPrec :: Int -> ReadS EndpointPerformance
Prelude.Read, Int -> EndpointPerformance -> ShowS
[EndpointPerformance] -> ShowS
EndpointPerformance -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointPerformance] -> ShowS
$cshowList :: [EndpointPerformance] -> ShowS
show :: EndpointPerformance -> String
$cshow :: EndpointPerformance -> String
showsPrec :: Int -> EndpointPerformance -> ShowS
$cshowsPrec :: Int -> EndpointPerformance -> ShowS
Prelude.Show, forall x. Rep EndpointPerformance x -> EndpointPerformance
forall x. EndpointPerformance -> Rep EndpointPerformance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointPerformance x -> EndpointPerformance
$cfrom :: forall x. EndpointPerformance -> Rep EndpointPerformance x
Prelude.Generic)

-- |
-- Create a value of 'EndpointPerformance' 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:
--
-- 'metrics', 'endpointPerformance_metrics' - The metrics for an existing endpoint.
--
-- 'endpointInfo', 'endpointPerformance_endpointInfo' - Undocumented member.
newEndpointPerformance ::
  -- | 'metrics'
  InferenceMetrics ->
  -- | 'endpointInfo'
  EndpointInfo ->
  EndpointPerformance
newEndpointPerformance :: InferenceMetrics -> EndpointInfo -> EndpointPerformance
newEndpointPerformance InferenceMetrics
pMetrics_ EndpointInfo
pEndpointInfo_ =
  EndpointPerformance'
    { $sel:metrics:EndpointPerformance' :: InferenceMetrics
metrics = InferenceMetrics
pMetrics_,
      $sel:endpointInfo:EndpointPerformance' :: EndpointInfo
endpointInfo = EndpointInfo
pEndpointInfo_
    }

-- | The metrics for an existing endpoint.
endpointPerformance_metrics :: Lens.Lens' EndpointPerformance InferenceMetrics
endpointPerformance_metrics :: Lens' EndpointPerformance InferenceMetrics
endpointPerformance_metrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointPerformance' {InferenceMetrics
metrics :: InferenceMetrics
$sel:metrics:EndpointPerformance' :: EndpointPerformance -> InferenceMetrics
metrics} -> InferenceMetrics
metrics) (\s :: EndpointPerformance
s@EndpointPerformance' {} InferenceMetrics
a -> EndpointPerformance
s {$sel:metrics:EndpointPerformance' :: InferenceMetrics
metrics = InferenceMetrics
a} :: EndpointPerformance)

-- | Undocumented member.
endpointPerformance_endpointInfo :: Lens.Lens' EndpointPerformance EndpointInfo
endpointPerformance_endpointInfo :: Lens' EndpointPerformance EndpointInfo
endpointPerformance_endpointInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointPerformance' {EndpointInfo
endpointInfo :: EndpointInfo
$sel:endpointInfo:EndpointPerformance' :: EndpointPerformance -> EndpointInfo
endpointInfo} -> EndpointInfo
endpointInfo) (\s :: EndpointPerformance
s@EndpointPerformance' {} EndpointInfo
a -> EndpointPerformance
s {$sel:endpointInfo:EndpointPerformance' :: EndpointInfo
endpointInfo = EndpointInfo
a} :: EndpointPerformance)

instance Data.FromJSON EndpointPerformance where
  parseJSON :: Value -> Parser EndpointPerformance
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EndpointPerformance"
      ( \Object
x ->
          InferenceMetrics -> EndpointInfo -> EndpointPerformance
EndpointPerformance'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Metrics")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"EndpointInfo")
      )

instance Prelude.Hashable EndpointPerformance where
  hashWithSalt :: Int -> EndpointPerformance -> Int
hashWithSalt Int
_salt EndpointPerformance' {EndpointInfo
InferenceMetrics
endpointInfo :: EndpointInfo
metrics :: InferenceMetrics
$sel:endpointInfo:EndpointPerformance' :: EndpointPerformance -> EndpointInfo
$sel:metrics:EndpointPerformance' :: EndpointPerformance -> InferenceMetrics
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InferenceMetrics
metrics
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` EndpointInfo
endpointInfo

instance Prelude.NFData EndpointPerformance where
  rnf :: EndpointPerformance -> ()
rnf EndpointPerformance' {EndpointInfo
InferenceMetrics
endpointInfo :: EndpointInfo
metrics :: InferenceMetrics
$sel:endpointInfo:EndpointPerformance' :: EndpointPerformance -> EndpointInfo
$sel:metrics:EndpointPerformance' :: EndpointPerformance -> InferenceMetrics
..} =
    forall a. NFData a => a -> ()
Prelude.rnf InferenceMetrics
metrics
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf EndpointInfo
endpointInfo