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

import Amazonka.ComputeOptimizer.Types.EBSFilterName
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 Amazon Elastic
-- Block Store (Amazon EBS) volume recommendations. Use this filter with
-- the GetEBSVolumeRecommendations action.
--
-- You can use @LambdaFunctionRecommendationFilter@ with the
-- GetLambdaFunctionRecommendations action, @JobFilter@ with the
-- DescribeRecommendationExportJobs action, and @Filter@ with the
-- GetAutoScalingGroupRecommendations and GetEC2InstanceRecommendations
-- actions.
--
-- /See:/ 'newEBSFilter' smart constructor.
data EBSFilter = EBSFilter'
  { -- | The name of the filter.
    --
    -- Specify @Finding@ to return recommendations with a specific finding
    -- classification (for example, @NotOptimized@).
    EBSFilter -> Maybe EBSFilterName
name :: Prelude.Maybe EBSFilterName,
    -- | The value of the filter.
    --
    -- The valid values are @Optimized@, or @NotOptimized@.
    EBSFilter -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text]
  }
  deriving (EBSFilter -> EBSFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EBSFilter -> EBSFilter -> Bool
$c/= :: EBSFilter -> EBSFilter -> Bool
== :: EBSFilter -> EBSFilter -> Bool
$c== :: EBSFilter -> EBSFilter -> Bool
Prelude.Eq, ReadPrec [EBSFilter]
ReadPrec EBSFilter
Int -> ReadS EBSFilter
ReadS [EBSFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EBSFilter]
$creadListPrec :: ReadPrec [EBSFilter]
readPrec :: ReadPrec EBSFilter
$creadPrec :: ReadPrec EBSFilter
readList :: ReadS [EBSFilter]
$creadList :: ReadS [EBSFilter]
readsPrec :: Int -> ReadS EBSFilter
$creadsPrec :: Int -> ReadS EBSFilter
Prelude.Read, Int -> EBSFilter -> ShowS
[EBSFilter] -> ShowS
EBSFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EBSFilter] -> ShowS
$cshowList :: [EBSFilter] -> ShowS
show :: EBSFilter -> String
$cshow :: EBSFilter -> String
showsPrec :: Int -> EBSFilter -> ShowS
$cshowsPrec :: Int -> EBSFilter -> ShowS
Prelude.Show, forall x. Rep EBSFilter x -> EBSFilter
forall x. EBSFilter -> Rep EBSFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EBSFilter x -> EBSFilter
$cfrom :: forall x. EBSFilter -> Rep EBSFilter x
Prelude.Generic)

-- |
-- Create a value of 'EBSFilter' 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', 'eBSFilter_name' - The name of the filter.
--
-- Specify @Finding@ to return recommendations with a specific finding
-- classification (for example, @NotOptimized@).
--
-- 'values', 'eBSFilter_values' - The value of the filter.
--
-- The valid values are @Optimized@, or @NotOptimized@.
newEBSFilter ::
  EBSFilter
newEBSFilter :: EBSFilter
newEBSFilter =
  EBSFilter'
    { $sel:name:EBSFilter' :: Maybe EBSFilterName
name = forall a. Maybe a
Prelude.Nothing,
      $sel:values:EBSFilter' :: 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@).
eBSFilter_name :: Lens.Lens' EBSFilter (Prelude.Maybe EBSFilterName)
eBSFilter_name :: Lens' EBSFilter (Maybe EBSFilterName)
eBSFilter_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSFilter' {Maybe EBSFilterName
name :: Maybe EBSFilterName
$sel:name:EBSFilter' :: EBSFilter -> Maybe EBSFilterName
name} -> Maybe EBSFilterName
name) (\s :: EBSFilter
s@EBSFilter' {} Maybe EBSFilterName
a -> EBSFilter
s {$sel:name:EBSFilter' :: Maybe EBSFilterName
name = Maybe EBSFilterName
a} :: EBSFilter)

-- | The value of the filter.
--
-- The valid values are @Optimized@, or @NotOptimized@.
eBSFilter_values :: Lens.Lens' EBSFilter (Prelude.Maybe [Prelude.Text])
eBSFilter_values :: Lens' EBSFilter (Maybe [Text])
eBSFilter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSFilter' {Maybe [Text]
values :: Maybe [Text]
$sel:values:EBSFilter' :: EBSFilter -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: EBSFilter
s@EBSFilter' {} Maybe [Text]
a -> EBSFilter
s {$sel:values:EBSFilter' :: Maybe [Text]
values = Maybe [Text]
a} :: EBSFilter) 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 EBSFilter where
  hashWithSalt :: Int -> EBSFilter -> Int
hashWithSalt Int
_salt EBSFilter' {Maybe [Text]
Maybe EBSFilterName
values :: Maybe [Text]
name :: Maybe EBSFilterName
$sel:values:EBSFilter' :: EBSFilter -> Maybe [Text]
$sel:name:EBSFilter' :: EBSFilter -> Maybe EBSFilterName
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EBSFilterName
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
values

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

instance Data.ToJSON EBSFilter where
  toJSON :: EBSFilter -> Value
toJSON EBSFilter' {Maybe [Text]
Maybe EBSFilterName
values :: Maybe [Text]
name :: Maybe EBSFilterName
$sel:values:EBSFilter' :: EBSFilter -> Maybe [Text]
$sel:name:EBSFilter' :: EBSFilter -> Maybe EBSFilterName
..} =
    [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 EBSFilterName
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
          ]
      )