{-# 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.LambdaFunctionRecommendationFilter
-- 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.LambdaFunctionRecommendationFilter where

import Amazonka.ComputeOptimizer.Types.LambdaFunctionRecommendationFilterName
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 a filter that returns a more specific list of Lambda function
-- recommendations. Use this filter with the
-- GetLambdaFunctionRecommendations action.
--
-- You can use @EBSFilter@ with the GetEBSVolumeRecommendations action,
-- @JobFilter@ with the DescribeRecommendationExportJobs action, and
-- @Filter@ with the GetAutoScalingGroupRecommendations and
-- GetEC2InstanceRecommendations actions.
--
-- /See:/ 'newLambdaFunctionRecommendationFilter' smart constructor.
data LambdaFunctionRecommendationFilter = LambdaFunctionRecommendationFilter'
  { -- | The name of the filter.
    --
    -- Specify @Finding@ to return recommendations with a specific finding
    -- classification (for example, @NotOptimized@).
    --
    -- Specify @FindingReasonCode@ to return recommendations with a specific
    -- finding reason code (for example, @MemoryUnderprovisioned@).
    LambdaFunctionRecommendationFilter
-> Maybe LambdaFunctionRecommendationFilterName
name :: Prelude.Maybe LambdaFunctionRecommendationFilterName,
    -- | The value of the filter.
    --
    -- The valid values for this parameter are as follows, depending on what
    -- you specify for the @name@ parameter:
    --
    -- -   Specify @Optimized@, @NotOptimized@, or @Unavailable@ if you specify
    --     the @name@ parameter as @Finding@.
    --
    -- -   Specify @MemoryOverprovisioned@, @MemoryUnderprovisioned@,
    --     @InsufficientData@, or @Inconclusive@ if you specify the @name@
    --     parameter as @FindingReasonCode@.
    LambdaFunctionRecommendationFilter -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text]
  }
  deriving (LambdaFunctionRecommendationFilter
-> LambdaFunctionRecommendationFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LambdaFunctionRecommendationFilter
-> LambdaFunctionRecommendationFilter -> Bool
$c/= :: LambdaFunctionRecommendationFilter
-> LambdaFunctionRecommendationFilter -> Bool
== :: LambdaFunctionRecommendationFilter
-> LambdaFunctionRecommendationFilter -> Bool
$c== :: LambdaFunctionRecommendationFilter
-> LambdaFunctionRecommendationFilter -> Bool
Prelude.Eq, ReadPrec [LambdaFunctionRecommendationFilter]
ReadPrec LambdaFunctionRecommendationFilter
Int -> ReadS LambdaFunctionRecommendationFilter
ReadS [LambdaFunctionRecommendationFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LambdaFunctionRecommendationFilter]
$creadListPrec :: ReadPrec [LambdaFunctionRecommendationFilter]
readPrec :: ReadPrec LambdaFunctionRecommendationFilter
$creadPrec :: ReadPrec LambdaFunctionRecommendationFilter
readList :: ReadS [LambdaFunctionRecommendationFilter]
$creadList :: ReadS [LambdaFunctionRecommendationFilter]
readsPrec :: Int -> ReadS LambdaFunctionRecommendationFilter
$creadsPrec :: Int -> ReadS LambdaFunctionRecommendationFilter
Prelude.Read, Int -> LambdaFunctionRecommendationFilter -> ShowS
[LambdaFunctionRecommendationFilter] -> ShowS
LambdaFunctionRecommendationFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LambdaFunctionRecommendationFilter] -> ShowS
$cshowList :: [LambdaFunctionRecommendationFilter] -> ShowS
show :: LambdaFunctionRecommendationFilter -> String
$cshow :: LambdaFunctionRecommendationFilter -> String
showsPrec :: Int -> LambdaFunctionRecommendationFilter -> ShowS
$cshowsPrec :: Int -> LambdaFunctionRecommendationFilter -> ShowS
Prelude.Show, forall x.
Rep LambdaFunctionRecommendationFilter x
-> LambdaFunctionRecommendationFilter
forall x.
LambdaFunctionRecommendationFilter
-> Rep LambdaFunctionRecommendationFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LambdaFunctionRecommendationFilter x
-> LambdaFunctionRecommendationFilter
$cfrom :: forall x.
LambdaFunctionRecommendationFilter
-> Rep LambdaFunctionRecommendationFilter x
Prelude.Generic)

-- |
-- Create a value of 'LambdaFunctionRecommendationFilter' 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:
--
-- 'name', 'lambdaFunctionRecommendationFilter_name' - The name of the filter.
--
-- Specify @Finding@ to return recommendations with a specific finding
-- classification (for example, @NotOptimized@).
--
-- Specify @FindingReasonCode@ to return recommendations with a specific
-- finding reason code (for example, @MemoryUnderprovisioned@).
--
-- 'values', 'lambdaFunctionRecommendationFilter_values' - The value of the filter.
--
-- The valid values for this parameter are as follows, depending on what
-- you specify for the @name@ parameter:
--
-- -   Specify @Optimized@, @NotOptimized@, or @Unavailable@ if you specify
--     the @name@ parameter as @Finding@.
--
-- -   Specify @MemoryOverprovisioned@, @MemoryUnderprovisioned@,
--     @InsufficientData@, or @Inconclusive@ if you specify the @name@
--     parameter as @FindingReasonCode@.
newLambdaFunctionRecommendationFilter ::
  LambdaFunctionRecommendationFilter
newLambdaFunctionRecommendationFilter :: LambdaFunctionRecommendationFilter
newLambdaFunctionRecommendationFilter =
  LambdaFunctionRecommendationFilter'
    { $sel:name:LambdaFunctionRecommendationFilter' :: Maybe LambdaFunctionRecommendationFilterName
name =
        forall a. Maybe a
Prelude.Nothing,
      $sel:values:LambdaFunctionRecommendationFilter' :: Maybe [Text]
values = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the filter.
--
-- Specify @Finding@ to return recommendations with a specific finding
-- classification (for example, @NotOptimized@).
--
-- Specify @FindingReasonCode@ to return recommendations with a specific
-- finding reason code (for example, @MemoryUnderprovisioned@).
lambdaFunctionRecommendationFilter_name :: Lens.Lens' LambdaFunctionRecommendationFilter (Prelude.Maybe LambdaFunctionRecommendationFilterName)
lambdaFunctionRecommendationFilter_name :: Lens'
  LambdaFunctionRecommendationFilter
  (Maybe LambdaFunctionRecommendationFilterName)
lambdaFunctionRecommendationFilter_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendationFilter' {Maybe LambdaFunctionRecommendationFilterName
name :: Maybe LambdaFunctionRecommendationFilterName
$sel:name:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter
-> Maybe LambdaFunctionRecommendationFilterName
name} -> Maybe LambdaFunctionRecommendationFilterName
name) (\s :: LambdaFunctionRecommendationFilter
s@LambdaFunctionRecommendationFilter' {} Maybe LambdaFunctionRecommendationFilterName
a -> LambdaFunctionRecommendationFilter
s {$sel:name:LambdaFunctionRecommendationFilter' :: Maybe LambdaFunctionRecommendationFilterName
name = Maybe LambdaFunctionRecommendationFilterName
a} :: LambdaFunctionRecommendationFilter)

-- | The value of the filter.
--
-- The valid values for this parameter are as follows, depending on what
-- you specify for the @name@ parameter:
--
-- -   Specify @Optimized@, @NotOptimized@, or @Unavailable@ if you specify
--     the @name@ parameter as @Finding@.
--
-- -   Specify @MemoryOverprovisioned@, @MemoryUnderprovisioned@,
--     @InsufficientData@, or @Inconclusive@ if you specify the @name@
--     parameter as @FindingReasonCode@.
lambdaFunctionRecommendationFilter_values :: Lens.Lens' LambdaFunctionRecommendationFilter (Prelude.Maybe [Prelude.Text])
lambdaFunctionRecommendationFilter_values :: Lens' LambdaFunctionRecommendationFilter (Maybe [Text])
lambdaFunctionRecommendationFilter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LambdaFunctionRecommendationFilter' {Maybe [Text]
values :: Maybe [Text]
$sel:values:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: LambdaFunctionRecommendationFilter
s@LambdaFunctionRecommendationFilter' {} Maybe [Text]
a -> LambdaFunctionRecommendationFilter
s {$sel:values:LambdaFunctionRecommendationFilter' :: Maybe [Text]
values = Maybe [Text]
a} :: LambdaFunctionRecommendationFilter) 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
  Prelude.Hashable
    LambdaFunctionRecommendationFilter
  where
  hashWithSalt :: Int -> LambdaFunctionRecommendationFilter -> Int
hashWithSalt
    Int
_salt
    LambdaFunctionRecommendationFilter' {Maybe [Text]
Maybe LambdaFunctionRecommendationFilterName
values :: Maybe [Text]
name :: Maybe LambdaFunctionRecommendationFilterName
$sel:values:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter -> Maybe [Text]
$sel:name:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter
-> Maybe LambdaFunctionRecommendationFilterName
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LambdaFunctionRecommendationFilterName
name
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
values

instance
  Prelude.NFData
    LambdaFunctionRecommendationFilter
  where
  rnf :: LambdaFunctionRecommendationFilter -> ()
rnf LambdaFunctionRecommendationFilter' {Maybe [Text]
Maybe LambdaFunctionRecommendationFilterName
values :: Maybe [Text]
name :: Maybe LambdaFunctionRecommendationFilterName
$sel:values:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter -> Maybe [Text]
$sel:name:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter
-> Maybe LambdaFunctionRecommendationFilterName
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LambdaFunctionRecommendationFilterName
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
values

instance
  Data.ToJSON
    LambdaFunctionRecommendationFilter
  where
  toJSON :: LambdaFunctionRecommendationFilter -> Value
toJSON LambdaFunctionRecommendationFilter' {Maybe [Text]
Maybe LambdaFunctionRecommendationFilterName
values :: Maybe [Text]
name :: Maybe LambdaFunctionRecommendationFilterName
$sel:values:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter -> Maybe [Text]
$sel:name:LambdaFunctionRecommendationFilter' :: LambdaFunctionRecommendationFilter
-> Maybe LambdaFunctionRecommendationFilterName
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LambdaFunctionRecommendationFilterName
name,
            (Key
"values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
values
          ]
      )