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

import Amazonka.ComputeOptimizer.Types.CurrentPerformanceRisk
import Amazonka.ComputeOptimizer.Types.LambdaFunctionMemoryRecommendationOption
import Amazonka.ComputeOptimizer.Types.LambdaFunctionRecommendationFinding
import Amazonka.ComputeOptimizer.Types.LambdaFunctionRecommendationFindingReasonCode
import Amazonka.ComputeOptimizer.Types.LambdaFunctionUtilizationMetric
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

-- | Describes an Lambda function recommendation.
--
-- /See:/ 'newLambdaFunctionRecommendation' smart constructor.
data LambdaFunctionRecommendation = LambdaFunctionRecommendation'
  { -- | The Amazon Web Services account ID of the function.
    LambdaFunctionRecommendation -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The amount of memory, in MB, that\'s allocated to the current function.
    LambdaFunctionRecommendation -> Maybe Int
currentMemorySize :: Prelude.Maybe Prelude.Int,
    -- | The risk of the current Lambda function not meeting the performance
    -- needs of its workloads. The higher the risk, the more likely the current
    -- Lambda function requires more memory.
    LambdaFunctionRecommendation -> Maybe CurrentPerformanceRisk
currentPerformanceRisk :: Prelude.Maybe CurrentPerformanceRisk,
    -- | The finding classification of the function.
    --
    -- Findings for functions include:
    --
    -- -   __@Optimized@__ — The function is correctly provisioned to run your
    --     workload based on its current configuration and its utilization
    --     history. This finding classification does not include finding reason
    --     codes.
    --
    -- -   __@NotOptimized@__ — The function is performing at a higher level
    --     (over-provisioned) or at a lower level (under-provisioned) than
    --     required for your workload because its current configuration is not
    --     optimal. Over-provisioned resources might lead to unnecessary
    --     infrastructure cost, and under-provisioned resources might lead to
    --     poor application performance. This finding classification can
    --     include the @MemoryUnderprovisioned@ and @MemoryUnderprovisioned@
    --     finding reason codes.
    --
    -- -   __@Unavailable@__ — Compute Optimizer was unable to generate a
    --     recommendation for the function. This could be because the function
    --     has not accumulated sufficient metric data, or the function does not
    --     qualify for a recommendation. This finding classification can
    --     include the @InsufficientData@ and @Inconclusive@ finding reason
    --     codes.
    --
    --     Functions with a finding of unavailable are not returned unless you
    --     specify the @filter@ parameter with a value of @Unavailable@ in your
    --     @GetLambdaFunctionRecommendations@ request.
    LambdaFunctionRecommendation
-> Maybe LambdaFunctionRecommendationFinding
finding :: Prelude.Maybe LambdaFunctionRecommendationFinding,
    -- | The reason for the finding classification of the function.
    --
    -- Functions that have a finding classification of @Optimized@ don\'t have
    -- a finding reason code.
    --
    -- Finding reason codes for functions include:
    --
    -- -   __@MemoryOverprovisioned@__ — The function is over-provisioned when
    --     its memory configuration can be sized down while still meeting the
    --     performance requirements of your workload. An over-provisioned
    --     function might lead to unnecessary infrastructure cost. This finding
    --     reason code is part of the @NotOptimized@ finding classification.
    --
    -- -   __@MemoryUnderprovisioned@__ — The function is under-provisioned
    --     when its memory configuration doesn\'t meet the performance
    --     requirements of the workload. An under-provisioned function might
    --     lead to poor application performance. This finding reason code is
    --     part of the @NotOptimized@ finding classification.
    --
    -- -   __@InsufficientData@__ — The function does not have sufficient
    --     metric data for Compute Optimizer to generate a recommendation. For
    --     more information, see the
    --     <https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html Supported resources and requirements>
    --     in the /Compute Optimizer User Guide/. This finding reason code is
    --     part of the @Unavailable@ finding classification.
    --
    -- -   __@Inconclusive@__ — The function does not qualify for a
    --     recommendation because Compute Optimizer cannot generate a
    --     recommendation with a high degree of confidence. This finding reason
    --     code is part of the @Unavailable@ finding classification.
    LambdaFunctionRecommendation
-> Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes :: Prelude.Maybe [LambdaFunctionRecommendationFindingReasonCode],
    -- | The Amazon Resource Name (ARN) of the current function.
    LambdaFunctionRecommendation -> Maybe Text
functionArn :: Prelude.Maybe Prelude.Text,
    -- | The version number of the current function.
    LambdaFunctionRecommendation -> Maybe Text
functionVersion :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of when the function recommendation was last generated.
    LambdaFunctionRecommendation -> Maybe POSIX
lastRefreshTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The number of days for which utilization metrics were analyzed for the
    -- function.
    LambdaFunctionRecommendation -> Maybe Double
lookbackPeriodInDays :: Prelude.Maybe Prelude.Double,
    -- | An array of objects that describe the memory configuration
    -- recommendation options for the function.
    LambdaFunctionRecommendation
-> Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions :: Prelude.Maybe [LambdaFunctionMemoryRecommendationOption],
    -- | The number of times your function code was applied during the look-back
    -- period.
    LambdaFunctionRecommendation -> Maybe Integer
numberOfInvocations :: Prelude.Maybe Prelude.Integer,
    -- | An array of objects that describe the utilization metrics of the
    -- function.
    LambdaFunctionRecommendation
-> Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics :: Prelude.Maybe [LambdaFunctionUtilizationMetric]
  }
  deriving (LambdaFunctionRecommendation
-> LambdaFunctionRecommendation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionRecommendation
-> LambdaFunctionRecommendation -> Bool
$c/= :: LambdaFunctionRecommendation
-> LambdaFunctionRecommendation -> Bool
== :: LambdaFunctionRecommendation
-> LambdaFunctionRecommendation -> Bool
$c== :: LambdaFunctionRecommendation
-> LambdaFunctionRecommendation -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionRecommendation]
ReadPrec LambdaFunctionRecommendation
Int -> ReadS LambdaFunctionRecommendation
ReadS [LambdaFunctionRecommendation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionRecommendation]
$creadListPrec :: ReadPrec [LambdaFunctionRecommendation]
readPrec :: ReadPrec LambdaFunctionRecommendation
$creadPrec :: ReadPrec LambdaFunctionRecommendation
readList :: ReadS [LambdaFunctionRecommendation]
$creadList :: ReadS [LambdaFunctionRecommendation]
readsPrec :: Int -> ReadS LambdaFunctionRecommendation
$creadsPrec :: Int -> ReadS LambdaFunctionRecommendation
Prelude.Read, Int -> LambdaFunctionRecommendation -> ShowS
[LambdaFunctionRecommendation] -> ShowS
LambdaFunctionRecommendation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionRecommendation] -> ShowS
$cshowList :: [LambdaFunctionRecommendation] -> ShowS
show :: LambdaFunctionRecommendation -> String
$cshow :: LambdaFunctionRecommendation -> String
showsPrec :: Int -> LambdaFunctionRecommendation -> ShowS
$cshowsPrec :: Int -> LambdaFunctionRecommendation -> ShowS
Prelude.Show, forall x.
Rep LambdaFunctionRecommendation x -> LambdaFunctionRecommendation
forall x.
LambdaFunctionRecommendation -> Rep LambdaFunctionRecommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionRecommendation x -> LambdaFunctionRecommendation
$cfrom :: forall x.
LambdaFunctionRecommendation -> Rep LambdaFunctionRecommendation x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionRecommendation' 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:
--
-- 'accountId', 'lambdaFunctionRecommendation_accountId' - The Amazon Web Services account ID of the function.
--
-- 'currentMemorySize', 'lambdaFunctionRecommendation_currentMemorySize' - The amount of memory, in MB, that\'s allocated to the current function.
--
-- 'currentPerformanceRisk', 'lambdaFunctionRecommendation_currentPerformanceRisk' - The risk of the current Lambda function not meeting the performance
-- needs of its workloads. The higher the risk, the more likely the current
-- Lambda function requires more memory.
--
-- 'finding', 'lambdaFunctionRecommendation_finding' - The finding classification of the function.
--
-- Findings for functions include:
--
-- -   __@Optimized@__ — The function is correctly provisioned to run your
--     workload based on its current configuration and its utilization
--     history. This finding classification does not include finding reason
--     codes.
--
-- -   __@NotOptimized@__ — The function is performing at a higher level
--     (over-provisioned) or at a lower level (under-provisioned) than
--     required for your workload because its current configuration is not
--     optimal. Over-provisioned resources might lead to unnecessary
--     infrastructure cost, and under-provisioned resources might lead to
--     poor application performance. This finding classification can
--     include the @MemoryUnderprovisioned@ and @MemoryUnderprovisioned@
--     finding reason codes.
--
-- -   __@Unavailable@__ — Compute Optimizer was unable to generate a
--     recommendation for the function. This could be because the function
--     has not accumulated sufficient metric data, or the function does not
--     qualify for a recommendation. This finding classification can
--     include the @InsufficientData@ and @Inconclusive@ finding reason
--     codes.
--
--     Functions with a finding of unavailable are not returned unless you
--     specify the @filter@ parameter with a value of @Unavailable@ in your
--     @GetLambdaFunctionRecommendations@ request.
--
-- 'findingReasonCodes', 'lambdaFunctionRecommendation_findingReasonCodes' - The reason for the finding classification of the function.
--
-- Functions that have a finding classification of @Optimized@ don\'t have
-- a finding reason code.
--
-- Finding reason codes for functions include:
--
-- -   __@MemoryOverprovisioned@__ — The function is over-provisioned when
--     its memory configuration can be sized down while still meeting the
--     performance requirements of your workload. An over-provisioned
--     function might lead to unnecessary infrastructure cost. This finding
--     reason code is part of the @NotOptimized@ finding classification.
--
-- -   __@MemoryUnderprovisioned@__ — The function is under-provisioned
--     when its memory configuration doesn\'t meet the performance
--     requirements of the workload. An under-provisioned function might
--     lead to poor application performance. This finding reason code is
--     part of the @NotOptimized@ finding classification.
--
-- -   __@InsufficientData@__ — The function does not have sufficient
--     metric data for Compute Optimizer to generate a recommendation. For
--     more information, see the
--     <https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html Supported resources and requirements>
--     in the /Compute Optimizer User Guide/. This finding reason code is
--     part of the @Unavailable@ finding classification.
--
-- -   __@Inconclusive@__ — The function does not qualify for a
--     recommendation because Compute Optimizer cannot generate a
--     recommendation with a high degree of confidence. This finding reason
--     code is part of the @Unavailable@ finding classification.
--
-- 'functionArn', 'lambdaFunctionRecommendation_functionArn' - The Amazon Resource Name (ARN) of the current function.
--
-- 'functionVersion', 'lambdaFunctionRecommendation_functionVersion' - The version number of the current function.
--
-- 'lastRefreshTimestamp', 'lambdaFunctionRecommendation_lastRefreshTimestamp' - The timestamp of when the function recommendation was last generated.
--
-- 'lookbackPeriodInDays', 'lambdaFunctionRecommendation_lookbackPeriodInDays' - The number of days for which utilization metrics were analyzed for the
-- function.
--
-- 'memorySizeRecommendationOptions', 'lambdaFunctionRecommendation_memorySizeRecommendationOptions' - An array of objects that describe the memory configuration
-- recommendation options for the function.
--
-- 'numberOfInvocations', 'lambdaFunctionRecommendation_numberOfInvocations' - The number of times your function code was applied during the look-back
-- period.
--
-- 'utilizationMetrics', 'lambdaFunctionRecommendation_utilizationMetrics' - An array of objects that describe the utilization metrics of the
-- function.
newLambdaFunctionRecommendation ::
  LambdaFunctionRecommendation
newLambdaFunctionRecommendation :: LambdaFunctionRecommendation
newLambdaFunctionRecommendation =
  LambdaFunctionRecommendation'
    { $sel:accountId:LambdaFunctionRecommendation' :: Maybe Text
accountId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:currentMemorySize:LambdaFunctionRecommendation' :: Maybe Int
currentMemorySize = forall a. Maybe a
Prelude.Nothing,
      $sel:currentPerformanceRisk:LambdaFunctionRecommendation' :: Maybe CurrentPerformanceRisk
currentPerformanceRisk = forall a. Maybe a
Prelude.Nothing,
      $sel:finding:LambdaFunctionRecommendation' :: Maybe LambdaFunctionRecommendationFinding
finding = forall a. Maybe a
Prelude.Nothing,
      $sel:findingReasonCodes:LambdaFunctionRecommendation' :: Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes = forall a. Maybe a
Prelude.Nothing,
      $sel:functionArn:LambdaFunctionRecommendation' :: Maybe Text
functionArn = forall a. Maybe a
Prelude.Nothing,
      $sel:functionVersion:LambdaFunctionRecommendation' :: Maybe Text
functionVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:lastRefreshTimestamp:LambdaFunctionRecommendation' :: Maybe POSIX
lastRefreshTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:lookbackPeriodInDays:LambdaFunctionRecommendation' :: Maybe Double
lookbackPeriodInDays = forall a. Maybe a
Prelude.Nothing,
      $sel:memorySizeRecommendationOptions:LambdaFunctionRecommendation' :: Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:numberOfInvocations:LambdaFunctionRecommendation' :: Maybe Integer
numberOfInvocations = forall a. Maybe a
Prelude.Nothing,
      $sel:utilizationMetrics:LambdaFunctionRecommendation' :: Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account ID of the function.
lambdaFunctionRecommendation_accountId :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.Text)
lambdaFunctionRecommendation_accountId :: Lens' LambdaFunctionRecommendation (Maybe Text)
lambdaFunctionRecommendation_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe Text
accountId :: Maybe Text
$sel:accountId:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe Text
a -> LambdaFunctionRecommendation
s {$sel:accountId:LambdaFunctionRecommendation' :: Maybe Text
accountId = Maybe Text
a} :: LambdaFunctionRecommendation)

-- | The amount of memory, in MB, that\'s allocated to the current function.
lambdaFunctionRecommendation_currentMemorySize :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.Int)
lambdaFunctionRecommendation_currentMemorySize :: Lens' LambdaFunctionRecommendation (Maybe Int)
lambdaFunctionRecommendation_currentMemorySize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe Int
currentMemorySize :: Maybe Int
$sel:currentMemorySize:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Int
currentMemorySize} -> Maybe Int
currentMemorySize) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe Int
a -> LambdaFunctionRecommendation
s {$sel:currentMemorySize:LambdaFunctionRecommendation' :: Maybe Int
currentMemorySize = Maybe Int
a} :: LambdaFunctionRecommendation)

-- | The risk of the current Lambda function not meeting the performance
-- needs of its workloads. The higher the risk, the more likely the current
-- Lambda function requires more memory.
lambdaFunctionRecommendation_currentPerformanceRisk :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe CurrentPerformanceRisk)
lambdaFunctionRecommendation_currentPerformanceRisk :: Lens' LambdaFunctionRecommendation (Maybe CurrentPerformanceRisk)
lambdaFunctionRecommendation_currentPerformanceRisk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe CurrentPerformanceRisk
currentPerformanceRisk :: Maybe CurrentPerformanceRisk
$sel:currentPerformanceRisk:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe CurrentPerformanceRisk
currentPerformanceRisk} -> Maybe CurrentPerformanceRisk
currentPerformanceRisk) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe CurrentPerformanceRisk
a -> LambdaFunctionRecommendation
s {$sel:currentPerformanceRisk:LambdaFunctionRecommendation' :: Maybe CurrentPerformanceRisk
currentPerformanceRisk = Maybe CurrentPerformanceRisk
a} :: LambdaFunctionRecommendation)

-- | The finding classification of the function.
--
-- Findings for functions include:
--
-- -   __@Optimized@__ — The function is correctly provisioned to run your
--     workload based on its current configuration and its utilization
--     history. This finding classification does not include finding reason
--     codes.
--
-- -   __@NotOptimized@__ — The function is performing at a higher level
--     (over-provisioned) or at a lower level (under-provisioned) than
--     required for your workload because its current configuration is not
--     optimal. Over-provisioned resources might lead to unnecessary
--     infrastructure cost, and under-provisioned resources might lead to
--     poor application performance. This finding classification can
--     include the @MemoryUnderprovisioned@ and @MemoryUnderprovisioned@
--     finding reason codes.
--
-- -   __@Unavailable@__ — Compute Optimizer was unable to generate a
--     recommendation for the function. This could be because the function
--     has not accumulated sufficient metric data, or the function does not
--     qualify for a recommendation. This finding classification can
--     include the @InsufficientData@ and @Inconclusive@ finding reason
--     codes.
--
--     Functions with a finding of unavailable are not returned unless you
--     specify the @filter@ parameter with a value of @Unavailable@ in your
--     @GetLambdaFunctionRecommendations@ request.
lambdaFunctionRecommendation_finding :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe LambdaFunctionRecommendationFinding)
lambdaFunctionRecommendation_finding :: Lens'
  LambdaFunctionRecommendation
  (Maybe LambdaFunctionRecommendationFinding)
lambdaFunctionRecommendation_finding = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe LambdaFunctionRecommendationFinding
finding :: Maybe LambdaFunctionRecommendationFinding
$sel:finding:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe LambdaFunctionRecommendationFinding
finding} -> Maybe LambdaFunctionRecommendationFinding
finding) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe LambdaFunctionRecommendationFinding
a -> LambdaFunctionRecommendation
s {$sel:finding:LambdaFunctionRecommendation' :: Maybe LambdaFunctionRecommendationFinding
finding = Maybe LambdaFunctionRecommendationFinding
a} :: LambdaFunctionRecommendation)

-- | The reason for the finding classification of the function.
--
-- Functions that have a finding classification of @Optimized@ don\'t have
-- a finding reason code.
--
-- Finding reason codes for functions include:
--
-- -   __@MemoryOverprovisioned@__ — The function is over-provisioned when
--     its memory configuration can be sized down while still meeting the
--     performance requirements of your workload. An over-provisioned
--     function might lead to unnecessary infrastructure cost. This finding
--     reason code is part of the @NotOptimized@ finding classification.
--
-- -   __@MemoryUnderprovisioned@__ — The function is under-provisioned
--     when its memory configuration doesn\'t meet the performance
--     requirements of the workload. An under-provisioned function might
--     lead to poor application performance. This finding reason code is
--     part of the @NotOptimized@ finding classification.
--
-- -   __@InsufficientData@__ — The function does not have sufficient
--     metric data for Compute Optimizer to generate a recommendation. For
--     more information, see the
--     <https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html Supported resources and requirements>
--     in the /Compute Optimizer User Guide/. This finding reason code is
--     part of the @Unavailable@ finding classification.
--
-- -   __@Inconclusive@__ — The function does not qualify for a
--     recommendation because Compute Optimizer cannot generate a
--     recommendation with a high degree of confidence. This finding reason
--     code is part of the @Unavailable@ finding classification.
lambdaFunctionRecommendation_findingReasonCodes :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe [LambdaFunctionRecommendationFindingReasonCode])
lambdaFunctionRecommendation_findingReasonCodes :: Lens'
  LambdaFunctionRecommendation
  (Maybe [LambdaFunctionRecommendationFindingReasonCode])
lambdaFunctionRecommendation_findingReasonCodes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes :: Maybe [LambdaFunctionRecommendationFindingReasonCode]
$sel:findingReasonCodes:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes} -> Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe [LambdaFunctionRecommendationFindingReasonCode]
a -> LambdaFunctionRecommendation
s {$sel:findingReasonCodes:LambdaFunctionRecommendation' :: Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes = Maybe [LambdaFunctionRecommendationFindingReasonCode]
a} :: LambdaFunctionRecommendation) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the current function.
lambdaFunctionRecommendation_functionArn :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.Text)
lambdaFunctionRecommendation_functionArn :: Lens' LambdaFunctionRecommendation (Maybe Text)
lambdaFunctionRecommendation_functionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe Text
functionArn :: Maybe Text
$sel:functionArn:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
functionArn} -> Maybe Text
functionArn) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe Text
a -> LambdaFunctionRecommendation
s {$sel:functionArn:LambdaFunctionRecommendation' :: Maybe Text
functionArn = Maybe Text
a} :: LambdaFunctionRecommendation)

-- | The version number of the current function.
lambdaFunctionRecommendation_functionVersion :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.Text)
lambdaFunctionRecommendation_functionVersion :: Lens' LambdaFunctionRecommendation (Maybe Text)
lambdaFunctionRecommendation_functionVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe Text
functionVersion :: Maybe Text
$sel:functionVersion:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
functionVersion} -> Maybe Text
functionVersion) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe Text
a -> LambdaFunctionRecommendation
s {$sel:functionVersion:LambdaFunctionRecommendation' :: Maybe Text
functionVersion = Maybe Text
a} :: LambdaFunctionRecommendation)

-- | The timestamp of when the function recommendation was last generated.
lambdaFunctionRecommendation_lastRefreshTimestamp :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.UTCTime)
lambdaFunctionRecommendation_lastRefreshTimestamp :: Lens' LambdaFunctionRecommendation (Maybe UTCTime)
lambdaFunctionRecommendation_lastRefreshTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe POSIX
lastRefreshTimestamp :: Maybe POSIX
$sel:lastRefreshTimestamp:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe POSIX
lastRefreshTimestamp} -> Maybe POSIX
lastRefreshTimestamp) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe POSIX
a -> LambdaFunctionRecommendation
s {$sel:lastRefreshTimestamp:LambdaFunctionRecommendation' :: Maybe POSIX
lastRefreshTimestamp = Maybe POSIX
a} :: LambdaFunctionRecommendation) 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 number of days for which utilization metrics were analyzed for the
-- function.
lambdaFunctionRecommendation_lookbackPeriodInDays :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.Double)
lambdaFunctionRecommendation_lookbackPeriodInDays :: Lens' LambdaFunctionRecommendation (Maybe Double)
lambdaFunctionRecommendation_lookbackPeriodInDays = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe Double
lookbackPeriodInDays :: Maybe Double
$sel:lookbackPeriodInDays:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Double
lookbackPeriodInDays} -> Maybe Double
lookbackPeriodInDays) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe Double
a -> LambdaFunctionRecommendation
s {$sel:lookbackPeriodInDays:LambdaFunctionRecommendation' :: Maybe Double
lookbackPeriodInDays = Maybe Double
a} :: LambdaFunctionRecommendation)

-- | An array of objects that describe the memory configuration
-- recommendation options for the function.
lambdaFunctionRecommendation_memorySizeRecommendationOptions :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe [LambdaFunctionMemoryRecommendationOption])
lambdaFunctionRecommendation_memorySizeRecommendationOptions :: Lens'
  LambdaFunctionRecommendation
  (Maybe [LambdaFunctionMemoryRecommendationOption])
lambdaFunctionRecommendation_memorySizeRecommendationOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions :: Maybe [LambdaFunctionMemoryRecommendationOption]
$sel:memorySizeRecommendationOptions:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions} -> Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe [LambdaFunctionMemoryRecommendationOption]
a -> LambdaFunctionRecommendation
s {$sel:memorySizeRecommendationOptions:LambdaFunctionRecommendation' :: Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions = Maybe [LambdaFunctionMemoryRecommendationOption]
a} :: LambdaFunctionRecommendation) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of times your function code was applied during the look-back
-- period.
lambdaFunctionRecommendation_numberOfInvocations :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe Prelude.Integer)
lambdaFunctionRecommendation_numberOfInvocations :: Lens' LambdaFunctionRecommendation (Maybe Integer)
lambdaFunctionRecommendation_numberOfInvocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe Integer
numberOfInvocations :: Maybe Integer
$sel:numberOfInvocations:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Integer
numberOfInvocations} -> Maybe Integer
numberOfInvocations) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe Integer
a -> LambdaFunctionRecommendation
s {$sel:numberOfInvocations:LambdaFunctionRecommendation' :: Maybe Integer
numberOfInvocations = Maybe Integer
a} :: LambdaFunctionRecommendation)

-- | An array of objects that describe the utilization metrics of the
-- function.
lambdaFunctionRecommendation_utilizationMetrics :: Lens.Lens' LambdaFunctionRecommendation (Prelude.Maybe [LambdaFunctionUtilizationMetric])
lambdaFunctionRecommendation_utilizationMetrics :: Lens'
  LambdaFunctionRecommendation
  (Maybe [LambdaFunctionUtilizationMetric])
lambdaFunctionRecommendation_utilizationMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendation' {Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics :: Maybe [LambdaFunctionUtilizationMetric]
$sel:utilizationMetrics:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics} -> Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics) (\s :: LambdaFunctionRecommendation
s@LambdaFunctionRecommendation' {} Maybe [LambdaFunctionUtilizationMetric]
a -> LambdaFunctionRecommendation
s {$sel:utilizationMetrics:LambdaFunctionRecommendation' :: Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics = Maybe [LambdaFunctionUtilizationMetric]
a} :: LambdaFunctionRecommendation) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON LambdaFunctionRecommendation where
  parseJSON :: Value -> Parser LambdaFunctionRecommendation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LambdaFunctionRecommendation"
      ( \Object
x ->
          Maybe Text
-> Maybe Int
-> Maybe CurrentPerformanceRisk
-> Maybe LambdaFunctionRecommendationFinding
-> Maybe [LambdaFunctionRecommendationFindingReasonCode]
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Double
-> Maybe [LambdaFunctionMemoryRecommendationOption]
-> Maybe Integer
-> Maybe [LambdaFunctionUtilizationMetric]
-> LambdaFunctionRecommendation
LambdaFunctionRecommendation'
            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
"accountId")
            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
"currentMemorySize")
            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
"currentPerformanceRisk")
            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
"finding")
            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
"findingReasonCodes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"functionArn")
            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
"functionVersion")
            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
"lastRefreshTimestamp")
            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
"lookbackPeriodInDays")
            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
"memorySizeRecommendationOptions"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"numberOfInvocations")
            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
"utilizationMetrics"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    LambdaFunctionRecommendation
  where
  hashWithSalt :: Int -> LambdaFunctionRecommendation -> Int
hashWithSalt Int
_salt LambdaFunctionRecommendation' {Maybe Double
Maybe Int
Maybe Integer
Maybe [LambdaFunctionRecommendationFindingReasonCode]
Maybe [LambdaFunctionUtilizationMetric]
Maybe [LambdaFunctionMemoryRecommendationOption]
Maybe Text
Maybe POSIX
Maybe CurrentPerformanceRisk
Maybe LambdaFunctionRecommendationFinding
utilizationMetrics :: Maybe [LambdaFunctionUtilizationMetric]
numberOfInvocations :: Maybe Integer
memorySizeRecommendationOptions :: Maybe [LambdaFunctionMemoryRecommendationOption]
lookbackPeriodInDays :: Maybe Double
lastRefreshTimestamp :: Maybe POSIX
functionVersion :: Maybe Text
functionArn :: Maybe Text
findingReasonCodes :: Maybe [LambdaFunctionRecommendationFindingReasonCode]
finding :: Maybe LambdaFunctionRecommendationFinding
currentPerformanceRisk :: Maybe CurrentPerformanceRisk
currentMemorySize :: Maybe Int
accountId :: Maybe Text
$sel:utilizationMetrics:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionUtilizationMetric]
$sel:numberOfInvocations:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Integer
$sel:memorySizeRecommendationOptions:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionMemoryRecommendationOption]
$sel:lookbackPeriodInDays:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Double
$sel:lastRefreshTimestamp:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe POSIX
$sel:functionVersion:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
$sel:functionArn:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
$sel:findingReasonCodes:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionRecommendationFindingReasonCode]
$sel:finding:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe LambdaFunctionRecommendationFinding
$sel:currentPerformanceRisk:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe CurrentPerformanceRisk
$sel:currentMemorySize:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Int
$sel:accountId:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
currentMemorySize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CurrentPerformanceRisk
currentPerformanceRisk
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaFunctionRecommendationFinding
finding
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
functionArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
functionVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastRefreshTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
lookbackPeriodInDays
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
numberOfInvocations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics

instance Prelude.NFData LambdaFunctionRecommendation where
  rnf :: LambdaFunctionRecommendation -> ()
rnf LambdaFunctionRecommendation' {Maybe Double
Maybe Int
Maybe Integer
Maybe [LambdaFunctionRecommendationFindingReasonCode]
Maybe [LambdaFunctionUtilizationMetric]
Maybe [LambdaFunctionMemoryRecommendationOption]
Maybe Text
Maybe POSIX
Maybe CurrentPerformanceRisk
Maybe LambdaFunctionRecommendationFinding
utilizationMetrics :: Maybe [LambdaFunctionUtilizationMetric]
numberOfInvocations :: Maybe Integer
memorySizeRecommendationOptions :: Maybe [LambdaFunctionMemoryRecommendationOption]
lookbackPeriodInDays :: Maybe Double
lastRefreshTimestamp :: Maybe POSIX
functionVersion :: Maybe Text
functionArn :: Maybe Text
findingReasonCodes :: Maybe [LambdaFunctionRecommendationFindingReasonCode]
finding :: Maybe LambdaFunctionRecommendationFinding
currentPerformanceRisk :: Maybe CurrentPerformanceRisk
currentMemorySize :: Maybe Int
accountId :: Maybe Text
$sel:utilizationMetrics:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionUtilizationMetric]
$sel:numberOfInvocations:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Integer
$sel:memorySizeRecommendationOptions:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionMemoryRecommendationOption]
$sel:lookbackPeriodInDays:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Double
$sel:lastRefreshTimestamp:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe POSIX
$sel:functionVersion:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
$sel:functionArn:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
$sel:findingReasonCodes:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe [LambdaFunctionRecommendationFindingReasonCode]
$sel:finding:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation
-> Maybe LambdaFunctionRecommendationFinding
$sel:currentPerformanceRisk:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe CurrentPerformanceRisk
$sel:currentMemorySize:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Int
$sel:accountId:LambdaFunctionRecommendation' :: LambdaFunctionRecommendation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
currentMemorySize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CurrentPerformanceRisk
currentPerformanceRisk
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaFunctionRecommendationFinding
finding
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LambdaFunctionRecommendationFindingReasonCode]
findingReasonCodes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
functionArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
functionVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastRefreshTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
lookbackPeriodInDays
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LambdaFunctionMemoryRecommendationOption]
memorySizeRecommendationOptions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
numberOfInvocations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LambdaFunctionUtilizationMetric]
utilizationMetrics