{-# 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.ComputeOptimizer.Types.LambdaFunctionMemoryRecommendationOption
-- 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.ComputeOptimizer.Types.LambdaFunctionMemoryRecommendationOption where

import Amazonka.ComputeOptimizer.Types.LambdaFunctionMemoryProjectedMetric
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a recommendation option for an Lambda function.
--
-- /See:/ 'newLambdaFunctionMemoryRecommendationOption' smart constructor.
data LambdaFunctionMemoryRecommendationOption = LambdaFunctionMemoryRecommendationOption'
  { -- | The memory size, in MB, of the function recommendation option.
    LambdaFunctionMemoryRecommendationOption -> Maybe Int
memorySize :: Prelude.Maybe Prelude.Int,
    -- | An array of objects that describe the projected utilization metrics of
    -- the function recommendation option.
    LambdaFunctionMemoryRecommendationOption
-> Maybe [LambdaFunctionMemoryProjectedMetric]
projectedUtilizationMetrics :: Prelude.Maybe [LambdaFunctionMemoryProjectedMetric],
    -- | The rank of the function recommendation option.
    --
    -- The top recommendation option is ranked as @1@.
    LambdaFunctionMemoryRecommendationOption -> Maybe Int
rank :: Prelude.Maybe Prelude.Int
  }
  deriving (LambdaFunctionMemoryRecommendationOption
-> LambdaFunctionMemoryRecommendationOption -> Bool
(LambdaFunctionMemoryRecommendationOption
 -> LambdaFunctionMemoryRecommendationOption -> Bool)
-> (LambdaFunctionMemoryRecommendationOption
    -> LambdaFunctionMemoryRecommendationOption -> Bool)
-> Eq LambdaFunctionMemoryRecommendationOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionMemoryRecommendationOption
-> LambdaFunctionMemoryRecommendationOption -> Bool
$c/= :: LambdaFunctionMemoryRecommendationOption
-> LambdaFunctionMemoryRecommendationOption -> Bool
== :: LambdaFunctionMemoryRecommendationOption
-> LambdaFunctionMemoryRecommendationOption -> Bool
$c== :: LambdaFunctionMemoryRecommendationOption
-> LambdaFunctionMemoryRecommendationOption -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionMemoryRecommendationOption]
ReadPrec LambdaFunctionMemoryRecommendationOption
Int -> ReadS LambdaFunctionMemoryRecommendationOption
ReadS [LambdaFunctionMemoryRecommendationOption]
(Int -> ReadS LambdaFunctionMemoryRecommendationOption)
-> ReadS [LambdaFunctionMemoryRecommendationOption]
-> ReadPrec LambdaFunctionMemoryRecommendationOption
-> ReadPrec [LambdaFunctionMemoryRecommendationOption]
-> Read LambdaFunctionMemoryRecommendationOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionMemoryRecommendationOption]
$creadListPrec :: ReadPrec [LambdaFunctionMemoryRecommendationOption]
readPrec :: ReadPrec LambdaFunctionMemoryRecommendationOption
$creadPrec :: ReadPrec LambdaFunctionMemoryRecommendationOption
readList :: ReadS [LambdaFunctionMemoryRecommendationOption]
$creadList :: ReadS [LambdaFunctionMemoryRecommendationOption]
readsPrec :: Int -> ReadS LambdaFunctionMemoryRecommendationOption
$creadsPrec :: Int -> ReadS LambdaFunctionMemoryRecommendationOption
Prelude.Read, Int -> LambdaFunctionMemoryRecommendationOption -> ShowS
[LambdaFunctionMemoryRecommendationOption] -> ShowS
LambdaFunctionMemoryRecommendationOption -> String
(Int -> LambdaFunctionMemoryRecommendationOption -> ShowS)
-> (LambdaFunctionMemoryRecommendationOption -> String)
-> ([LambdaFunctionMemoryRecommendationOption] -> ShowS)
-> Show LambdaFunctionMemoryRecommendationOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionMemoryRecommendationOption] -> ShowS
$cshowList :: [LambdaFunctionMemoryRecommendationOption] -> ShowS
show :: LambdaFunctionMemoryRecommendationOption -> String
$cshow :: LambdaFunctionMemoryRecommendationOption -> String
showsPrec :: Int -> LambdaFunctionMemoryRecommendationOption -> ShowS
$cshowsPrec :: Int -> LambdaFunctionMemoryRecommendationOption -> ShowS
Prelude.Show, (forall x.
 LambdaFunctionMemoryRecommendationOption
 -> Rep LambdaFunctionMemoryRecommendationOption x)
-> (forall x.
    Rep LambdaFunctionMemoryRecommendationOption x
    -> LambdaFunctionMemoryRecommendationOption)
-> Generic LambdaFunctionMemoryRecommendationOption
forall x.
Rep LambdaFunctionMemoryRecommendationOption x
-> LambdaFunctionMemoryRecommendationOption
forall x.
LambdaFunctionMemoryRecommendationOption
-> Rep LambdaFunctionMemoryRecommendationOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionMemoryRecommendationOption x
-> LambdaFunctionMemoryRecommendationOption
$cfrom :: forall x.
LambdaFunctionMemoryRecommendationOption
-> Rep LambdaFunctionMemoryRecommendationOption x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionMemoryRecommendationOption' 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:
--
-- 'memorySize', 'lambdaFunctionMemoryRecommendationOption_memorySize' - The memory size, in MB, of the function recommendation option.
--
-- 'projectedUtilizationMetrics', 'lambdaFunctionMemoryRecommendationOption_projectedUtilizationMetrics' - An array of objects that describe the projected utilization metrics of
-- the function recommendation option.
--
-- 'rank', 'lambdaFunctionMemoryRecommendationOption_rank' - The rank of the function recommendation option.
--
-- The top recommendation option is ranked as @1@.
newLambdaFunctionMemoryRecommendationOption ::
  LambdaFunctionMemoryRecommendationOption
newLambdaFunctionMemoryRecommendationOption :: LambdaFunctionMemoryRecommendationOption
newLambdaFunctionMemoryRecommendationOption =
  LambdaFunctionMemoryRecommendationOption' :: Maybe Int
-> Maybe [LambdaFunctionMemoryProjectedMetric]
-> Maybe Int
-> LambdaFunctionMemoryRecommendationOption
LambdaFunctionMemoryRecommendationOption'
    { $sel:memorySize:LambdaFunctionMemoryRecommendationOption' :: Maybe Int
memorySize =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:projectedUtilizationMetrics:LambdaFunctionMemoryRecommendationOption' :: Maybe [LambdaFunctionMemoryProjectedMetric]
projectedUtilizationMetrics =
        Maybe [LambdaFunctionMemoryProjectedMetric]
forall a. Maybe a
Prelude.Nothing,
      $sel:rank:LambdaFunctionMemoryRecommendationOption' :: Maybe Int
rank = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The memory size, in MB, of the function recommendation option.
lambdaFunctionMemoryRecommendationOption_memorySize :: Lens.Lens' LambdaFunctionMemoryRecommendationOption (Prelude.Maybe Prelude.Int)
lambdaFunctionMemoryRecommendationOption_memorySize :: (Maybe Int -> f (Maybe Int))
-> LambdaFunctionMemoryRecommendationOption
-> f LambdaFunctionMemoryRecommendationOption
lambdaFunctionMemoryRecommendationOption_memorySize = (LambdaFunctionMemoryRecommendationOption -> Maybe Int)
-> (LambdaFunctionMemoryRecommendationOption
    -> Maybe Int -> LambdaFunctionMemoryRecommendationOption)
-> Lens
     LambdaFunctionMemoryRecommendationOption
     LambdaFunctionMemoryRecommendationOption
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionMemoryRecommendationOption' {Maybe Int
memorySize :: Maybe Int
$sel:memorySize:LambdaFunctionMemoryRecommendationOption' :: LambdaFunctionMemoryRecommendationOption -> Maybe Int
memorySize} -> Maybe Int
memorySize) (\s :: LambdaFunctionMemoryRecommendationOption
s@LambdaFunctionMemoryRecommendationOption' {} Maybe Int
a -> LambdaFunctionMemoryRecommendationOption
s {$sel:memorySize:LambdaFunctionMemoryRecommendationOption' :: Maybe Int
memorySize = Maybe Int
a} :: LambdaFunctionMemoryRecommendationOption)

-- | An array of objects that describe the projected utilization metrics of
-- the function recommendation option.
lambdaFunctionMemoryRecommendationOption_projectedUtilizationMetrics :: Lens.Lens' LambdaFunctionMemoryRecommendationOption (Prelude.Maybe [LambdaFunctionMemoryProjectedMetric])
lambdaFunctionMemoryRecommendationOption_projectedUtilizationMetrics :: (Maybe [LambdaFunctionMemoryProjectedMetric]
 -> f (Maybe [LambdaFunctionMemoryProjectedMetric]))
-> LambdaFunctionMemoryRecommendationOption
-> f LambdaFunctionMemoryRecommendationOption
lambdaFunctionMemoryRecommendationOption_projectedUtilizationMetrics = (LambdaFunctionMemoryRecommendationOption
 -> Maybe [LambdaFunctionMemoryProjectedMetric])
-> (LambdaFunctionMemoryRecommendationOption
    -> Maybe [LambdaFunctionMemoryProjectedMetric]
    -> LambdaFunctionMemoryRecommendationOption)
-> Lens
     LambdaFunctionMemoryRecommendationOption
     LambdaFunctionMemoryRecommendationOption
     (Maybe [LambdaFunctionMemoryProjectedMetric])
     (Maybe [LambdaFunctionMemoryProjectedMetric])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionMemoryRecommendationOption' {Maybe [LambdaFunctionMemoryProjectedMetric]
projectedUtilizationMetrics :: Maybe [LambdaFunctionMemoryProjectedMetric]
$sel:projectedUtilizationMetrics:LambdaFunctionMemoryRecommendationOption' :: LambdaFunctionMemoryRecommendationOption
-> Maybe [LambdaFunctionMemoryProjectedMetric]
projectedUtilizationMetrics} -> Maybe [LambdaFunctionMemoryProjectedMetric]
projectedUtilizationMetrics) (\s :: LambdaFunctionMemoryRecommendationOption
s@LambdaFunctionMemoryRecommendationOption' {} Maybe [LambdaFunctionMemoryProjectedMetric]
a -> LambdaFunctionMemoryRecommendationOption
s {$sel:projectedUtilizationMetrics:LambdaFunctionMemoryRecommendationOption' :: Maybe [LambdaFunctionMemoryProjectedMetric]
projectedUtilizationMetrics = Maybe [LambdaFunctionMemoryProjectedMetric]
a} :: LambdaFunctionMemoryRecommendationOption) ((Maybe [LambdaFunctionMemoryProjectedMetric]
  -> f (Maybe [LambdaFunctionMemoryProjectedMetric]))
 -> LambdaFunctionMemoryRecommendationOption
 -> f LambdaFunctionMemoryRecommendationOption)
-> ((Maybe [LambdaFunctionMemoryProjectedMetric]
     -> f (Maybe [LambdaFunctionMemoryProjectedMetric]))
    -> Maybe [LambdaFunctionMemoryProjectedMetric]
    -> f (Maybe [LambdaFunctionMemoryProjectedMetric]))
-> (Maybe [LambdaFunctionMemoryProjectedMetric]
    -> f (Maybe [LambdaFunctionMemoryProjectedMetric]))
-> LambdaFunctionMemoryRecommendationOption
-> f LambdaFunctionMemoryRecommendationOption
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LambdaFunctionMemoryProjectedMetric]
  [LambdaFunctionMemoryProjectedMetric]
  [LambdaFunctionMemoryProjectedMetric]
  [LambdaFunctionMemoryProjectedMetric]
-> Iso
     (Maybe [LambdaFunctionMemoryProjectedMetric])
     (Maybe [LambdaFunctionMemoryProjectedMetric])
     (Maybe [LambdaFunctionMemoryProjectedMetric])
     (Maybe [LambdaFunctionMemoryProjectedMetric])
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
  [LambdaFunctionMemoryProjectedMetric]
  [LambdaFunctionMemoryProjectedMetric]
  [LambdaFunctionMemoryProjectedMetric]
  [LambdaFunctionMemoryProjectedMetric]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The rank of the function recommendation option.
--
-- The top recommendation option is ranked as @1@.
lambdaFunctionMemoryRecommendationOption_rank :: Lens.Lens' LambdaFunctionMemoryRecommendationOption (Prelude.Maybe Prelude.Int)
lambdaFunctionMemoryRecommendationOption_rank :: (Maybe Int -> f (Maybe Int))
-> LambdaFunctionMemoryRecommendationOption
-> f LambdaFunctionMemoryRecommendationOption
lambdaFunctionMemoryRecommendationOption_rank = (LambdaFunctionMemoryRecommendationOption -> Maybe Int)
-> (LambdaFunctionMemoryRecommendationOption
    -> Maybe Int -> LambdaFunctionMemoryRecommendationOption)
-> Lens
     LambdaFunctionMemoryRecommendationOption
     LambdaFunctionMemoryRecommendationOption
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionMemoryRecommendationOption' {Maybe Int
rank :: Maybe Int
$sel:rank:LambdaFunctionMemoryRecommendationOption' :: LambdaFunctionMemoryRecommendationOption -> Maybe Int
rank} -> Maybe Int
rank) (\s :: LambdaFunctionMemoryRecommendationOption
s@LambdaFunctionMemoryRecommendationOption' {} Maybe Int
a -> LambdaFunctionMemoryRecommendationOption
s {$sel:rank:LambdaFunctionMemoryRecommendationOption' :: Maybe Int
rank = Maybe Int
a} :: LambdaFunctionMemoryRecommendationOption)

instance
  Core.FromJSON
    LambdaFunctionMemoryRecommendationOption
  where
  parseJSON :: Value -> Parser LambdaFunctionMemoryRecommendationOption
parseJSON =
    String
-> (Object -> Parser LambdaFunctionMemoryRecommendationOption)
-> Value
-> Parser LambdaFunctionMemoryRecommendationOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LambdaFunctionMemoryRecommendationOption"
      ( \Object
x ->
          Maybe Int
-> Maybe [LambdaFunctionMemoryProjectedMetric]
-> Maybe Int
-> LambdaFunctionMemoryRecommendationOption
LambdaFunctionMemoryRecommendationOption'
            (Maybe Int
 -> Maybe [LambdaFunctionMemoryProjectedMetric]
 -> Maybe Int
 -> LambdaFunctionMemoryRecommendationOption)
-> Parser (Maybe Int)
-> Parser
     (Maybe [LambdaFunctionMemoryProjectedMetric]
      -> Maybe Int -> LambdaFunctionMemoryRecommendationOption)
forall (f :: * -> *) a b. Functor 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
"memorySize")
            Parser
  (Maybe [LambdaFunctionMemoryProjectedMetric]
   -> Maybe Int -> LambdaFunctionMemoryRecommendationOption)
-> Parser (Maybe [LambdaFunctionMemoryProjectedMetric])
-> Parser (Maybe Int -> LambdaFunctionMemoryRecommendationOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe [LambdaFunctionMemoryProjectedMetric]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"projectedUtilizationMetrics"
                            Parser (Maybe (Maybe [LambdaFunctionMemoryProjectedMetric]))
-> Maybe [LambdaFunctionMemoryProjectedMetric]
-> Parser (Maybe [LambdaFunctionMemoryProjectedMetric])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [LambdaFunctionMemoryProjectedMetric]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Int -> LambdaFunctionMemoryRecommendationOption)
-> Parser (Maybe Int)
-> Parser LambdaFunctionMemoryRecommendationOption
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
"rank")
      )

instance
  Prelude.Hashable
    LambdaFunctionMemoryRecommendationOption

instance
  Prelude.NFData
    LambdaFunctionMemoryRecommendationOption