{-# 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.RecommendationMetrics
-- 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.RecommendationMetrics 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

-- | The metrics of recommendations.
--
-- /See:/ 'newRecommendationMetrics' smart constructor.
data RecommendationMetrics = RecommendationMetrics'
  { -- | Defines the cost per hour for the instance.
    RecommendationMetrics -> Double
costPerHour :: Prelude.Double,
    -- | Defines the cost per inference for the instance .
    RecommendationMetrics -> Double
costPerInference :: Prelude.Double,
    -- | The expected maximum number of requests per minute for the instance.
    RecommendationMetrics -> Int
maxInvocations :: Prelude.Int,
    -- | The expected model latency at maximum invocation per minute for the
    -- instance.
    RecommendationMetrics -> Int
modelLatency :: Prelude.Int
  }
  deriving (RecommendationMetrics -> RecommendationMetrics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationMetrics -> RecommendationMetrics -> Bool
$c/= :: RecommendationMetrics -> RecommendationMetrics -> Bool
== :: RecommendationMetrics -> RecommendationMetrics -> Bool
$c== :: RecommendationMetrics -> RecommendationMetrics -> Bool
Prelude.Eq, ReadPrec [RecommendationMetrics]
ReadPrec RecommendationMetrics
Int -> ReadS RecommendationMetrics
ReadS [RecommendationMetrics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationMetrics]
$creadListPrec :: ReadPrec [RecommendationMetrics]
readPrec :: ReadPrec RecommendationMetrics
$creadPrec :: ReadPrec RecommendationMetrics
readList :: ReadS [RecommendationMetrics]
$creadList :: ReadS [RecommendationMetrics]
readsPrec :: Int -> ReadS RecommendationMetrics
$creadsPrec :: Int -> ReadS RecommendationMetrics
Prelude.Read, Int -> RecommendationMetrics -> ShowS
[RecommendationMetrics] -> ShowS
RecommendationMetrics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationMetrics] -> ShowS
$cshowList :: [RecommendationMetrics] -> ShowS
show :: RecommendationMetrics -> String
$cshow :: RecommendationMetrics -> String
showsPrec :: Int -> RecommendationMetrics -> ShowS
$cshowsPrec :: Int -> RecommendationMetrics -> ShowS
Prelude.Show, forall x. Rep RecommendationMetrics x -> RecommendationMetrics
forall x. RecommendationMetrics -> Rep RecommendationMetrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecommendationMetrics x -> RecommendationMetrics
$cfrom :: forall x. RecommendationMetrics -> Rep RecommendationMetrics x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationMetrics' 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:
--
-- 'costPerHour', 'recommendationMetrics_costPerHour' - Defines the cost per hour for the instance.
--
-- 'costPerInference', 'recommendationMetrics_costPerInference' - Defines the cost per inference for the instance .
--
-- 'maxInvocations', 'recommendationMetrics_maxInvocations' - The expected maximum number of requests per minute for the instance.
--
-- 'modelLatency', 'recommendationMetrics_modelLatency' - The expected model latency at maximum invocation per minute for the
-- instance.
newRecommendationMetrics ::
  -- | 'costPerHour'
  Prelude.Double ->
  -- | 'costPerInference'
  Prelude.Double ->
  -- | 'maxInvocations'
  Prelude.Int ->
  -- | 'modelLatency'
  Prelude.Int ->
  RecommendationMetrics
newRecommendationMetrics :: Double -> Double -> Int -> Int -> RecommendationMetrics
newRecommendationMetrics
  Double
pCostPerHour_
  Double
pCostPerInference_
  Int
pMaxInvocations_
  Int
pModelLatency_ =
    RecommendationMetrics'
      { $sel:costPerHour:RecommendationMetrics' :: Double
costPerHour = Double
pCostPerHour_,
        $sel:costPerInference:RecommendationMetrics' :: Double
costPerInference = Double
pCostPerInference_,
        $sel:maxInvocations:RecommendationMetrics' :: Int
maxInvocations = Int
pMaxInvocations_,
        $sel:modelLatency:RecommendationMetrics' :: Int
modelLatency = Int
pModelLatency_
      }

-- | Defines the cost per hour for the instance.
recommendationMetrics_costPerHour :: Lens.Lens' RecommendationMetrics Prelude.Double
recommendationMetrics_costPerHour :: Lens' RecommendationMetrics Double
recommendationMetrics_costPerHour = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationMetrics' {Double
costPerHour :: Double
$sel:costPerHour:RecommendationMetrics' :: RecommendationMetrics -> Double
costPerHour} -> Double
costPerHour) (\s :: RecommendationMetrics
s@RecommendationMetrics' {} Double
a -> RecommendationMetrics
s {$sel:costPerHour:RecommendationMetrics' :: Double
costPerHour = Double
a} :: RecommendationMetrics)

-- | Defines the cost per inference for the instance .
recommendationMetrics_costPerInference :: Lens.Lens' RecommendationMetrics Prelude.Double
recommendationMetrics_costPerInference :: Lens' RecommendationMetrics Double
recommendationMetrics_costPerInference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationMetrics' {Double
costPerInference :: Double
$sel:costPerInference:RecommendationMetrics' :: RecommendationMetrics -> Double
costPerInference} -> Double
costPerInference) (\s :: RecommendationMetrics
s@RecommendationMetrics' {} Double
a -> RecommendationMetrics
s {$sel:costPerInference:RecommendationMetrics' :: Double
costPerInference = Double
a} :: RecommendationMetrics)

-- | The expected maximum number of requests per minute for the instance.
recommendationMetrics_maxInvocations :: Lens.Lens' RecommendationMetrics Prelude.Int
recommendationMetrics_maxInvocations :: Lens' RecommendationMetrics Int
recommendationMetrics_maxInvocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationMetrics' {Int
maxInvocations :: Int
$sel:maxInvocations:RecommendationMetrics' :: RecommendationMetrics -> Int
maxInvocations} -> Int
maxInvocations) (\s :: RecommendationMetrics
s@RecommendationMetrics' {} Int
a -> RecommendationMetrics
s {$sel:maxInvocations:RecommendationMetrics' :: Int
maxInvocations = Int
a} :: RecommendationMetrics)

-- | The expected model latency at maximum invocation per minute for the
-- instance.
recommendationMetrics_modelLatency :: Lens.Lens' RecommendationMetrics Prelude.Int
recommendationMetrics_modelLatency :: Lens' RecommendationMetrics Int
recommendationMetrics_modelLatency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationMetrics' {Int
modelLatency :: Int
$sel:modelLatency:RecommendationMetrics' :: RecommendationMetrics -> Int
modelLatency} -> Int
modelLatency) (\s :: RecommendationMetrics
s@RecommendationMetrics' {} Int
a -> RecommendationMetrics
s {$sel:modelLatency:RecommendationMetrics' :: Int
modelLatency = Int
a} :: RecommendationMetrics)

instance Data.FromJSON RecommendationMetrics where
  parseJSON :: Value -> Parser RecommendationMetrics
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecommendationMetrics"
      ( \Object
x ->
          Double -> Double -> Int -> Int -> RecommendationMetrics
RecommendationMetrics'
            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
"CostPerHour")
            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
"CostPerInference")
            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
"MaxInvocations")
            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
"ModelLatency")
      )

instance Prelude.Hashable RecommendationMetrics where
  hashWithSalt :: Int -> RecommendationMetrics -> Int
hashWithSalt Int
_salt RecommendationMetrics' {Double
Int
modelLatency :: Int
maxInvocations :: Int
costPerInference :: Double
costPerHour :: Double
$sel:modelLatency:RecommendationMetrics' :: RecommendationMetrics -> Int
$sel:maxInvocations:RecommendationMetrics' :: RecommendationMetrics -> Int
$sel:costPerInference:RecommendationMetrics' :: RecommendationMetrics -> Double
$sel:costPerHour:RecommendationMetrics' :: RecommendationMetrics -> Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
costPerHour
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
costPerInference
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
maxInvocations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
modelLatency

instance Prelude.NFData RecommendationMetrics where
  rnf :: RecommendationMetrics -> ()
rnf RecommendationMetrics' {Double
Int
modelLatency :: Int
maxInvocations :: Int
costPerInference :: Double
costPerHour :: Double
$sel:modelLatency:RecommendationMetrics' :: RecommendationMetrics -> Int
$sel:maxInvocations:RecommendationMetrics' :: RecommendationMetrics -> Int
$sel:costPerInference:RecommendationMetrics' :: RecommendationMetrics -> Double
$sel:costPerHour:RecommendationMetrics' :: RecommendationMetrics -> Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Double
costPerHour
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
costPerInference
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
maxInvocations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
modelLatency