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

import Amazonka.ComputeOptimizer.Types.SavingsOpportunity
import Amazonka.ComputeOptimizer.Types.VolumeConfiguration
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 recommendation option for an Amazon Elastic Block Store
-- (Amazon EBS) instance.
--
-- /See:/ 'newVolumeRecommendationOption' smart constructor.
data VolumeRecommendationOption = VolumeRecommendationOption'
  { -- | An array of objects that describe a volume configuration.
    VolumeRecommendationOption -> Maybe VolumeConfiguration
configuration :: Prelude.Maybe VolumeConfiguration,
    -- | The performance risk of the volume recommendation option.
    --
    -- Performance risk is the likelihood of the recommended volume type
    -- meeting the performance requirement of your workload.
    --
    -- The value ranges from @0@ - @4@, with @0@ meaning that the recommended
    -- resource is predicted to always provide enough hardware capability. The
    -- higher the performance risk is, the more likely you should validate
    -- whether the recommendation will meet the performance requirements of
    -- your workload before migrating your resource.
    VolumeRecommendationOption -> Maybe Double
performanceRisk :: Prelude.Maybe Prelude.Double,
    -- | The rank of the volume recommendation option.
    --
    -- The top recommendation option is ranked as @1@.
    VolumeRecommendationOption -> Maybe Int
rank :: Prelude.Maybe Prelude.Int,
    -- | An object that describes the savings opportunity for the EBS volume
    -- recommendation option. Savings opportunity includes the estimated
    -- monthly savings amount and percentage.
    VolumeRecommendationOption -> Maybe SavingsOpportunity
savingsOpportunity :: Prelude.Maybe SavingsOpportunity
  }
  deriving (VolumeRecommendationOption -> VolumeRecommendationOption -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VolumeRecommendationOption -> VolumeRecommendationOption -> Bool
$c/= :: VolumeRecommendationOption -> VolumeRecommendationOption -> Bool
== :: VolumeRecommendationOption -> VolumeRecommendationOption -> Bool
$c== :: VolumeRecommendationOption -> VolumeRecommendationOption -> Bool
Prelude.Eq, ReadPrec [VolumeRecommendationOption]
ReadPrec VolumeRecommendationOption
Int -> ReadS VolumeRecommendationOption
ReadS [VolumeRecommendationOption]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VolumeRecommendationOption]
$creadListPrec :: ReadPrec [VolumeRecommendationOption]
readPrec :: ReadPrec VolumeRecommendationOption
$creadPrec :: ReadPrec VolumeRecommendationOption
readList :: ReadS [VolumeRecommendationOption]
$creadList :: ReadS [VolumeRecommendationOption]
readsPrec :: Int -> ReadS VolumeRecommendationOption
$creadsPrec :: Int -> ReadS VolumeRecommendationOption
Prelude.Read, Int -> VolumeRecommendationOption -> ShowS
[VolumeRecommendationOption] -> ShowS
VolumeRecommendationOption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VolumeRecommendationOption] -> ShowS
$cshowList :: [VolumeRecommendationOption] -> ShowS
show :: VolumeRecommendationOption -> String
$cshow :: VolumeRecommendationOption -> String
showsPrec :: Int -> VolumeRecommendationOption -> ShowS
$cshowsPrec :: Int -> VolumeRecommendationOption -> ShowS
Prelude.Show, forall x.
Rep VolumeRecommendationOption x -> VolumeRecommendationOption
forall x.
VolumeRecommendationOption -> Rep VolumeRecommendationOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VolumeRecommendationOption x -> VolumeRecommendationOption
$cfrom :: forall x.
VolumeRecommendationOption -> Rep VolumeRecommendationOption x
Prelude.Generic)

-- |
-- Create a value of 'VolumeRecommendationOption' 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:
--
-- 'configuration', 'volumeRecommendationOption_configuration' - An array of objects that describe a volume configuration.
--
-- 'performanceRisk', 'volumeRecommendationOption_performanceRisk' - The performance risk of the volume recommendation option.
--
-- Performance risk is the likelihood of the recommended volume type
-- meeting the performance requirement of your workload.
--
-- The value ranges from @0@ - @4@, with @0@ meaning that the recommended
-- resource is predicted to always provide enough hardware capability. The
-- higher the performance risk is, the more likely you should validate
-- whether the recommendation will meet the performance requirements of
-- your workload before migrating your resource.
--
-- 'rank', 'volumeRecommendationOption_rank' - The rank of the volume recommendation option.
--
-- The top recommendation option is ranked as @1@.
--
-- 'savingsOpportunity', 'volumeRecommendationOption_savingsOpportunity' - An object that describes the savings opportunity for the EBS volume
-- recommendation option. Savings opportunity includes the estimated
-- monthly savings amount and percentage.
newVolumeRecommendationOption ::
  VolumeRecommendationOption
newVolumeRecommendationOption :: VolumeRecommendationOption
newVolumeRecommendationOption =
  VolumeRecommendationOption'
    { $sel:configuration:VolumeRecommendationOption' :: Maybe VolumeConfiguration
configuration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:performanceRisk:VolumeRecommendationOption' :: Maybe Double
performanceRisk = forall a. Maybe a
Prelude.Nothing,
      $sel:rank:VolumeRecommendationOption' :: Maybe Int
rank = forall a. Maybe a
Prelude.Nothing,
      $sel:savingsOpportunity:VolumeRecommendationOption' :: Maybe SavingsOpportunity
savingsOpportunity = forall a. Maybe a
Prelude.Nothing
    }

-- | An array of objects that describe a volume configuration.
volumeRecommendationOption_configuration :: Lens.Lens' VolumeRecommendationOption (Prelude.Maybe VolumeConfiguration)
volumeRecommendationOption_configuration :: Lens' VolumeRecommendationOption (Maybe VolumeConfiguration)
volumeRecommendationOption_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeRecommendationOption' {Maybe VolumeConfiguration
configuration :: Maybe VolumeConfiguration
$sel:configuration:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe VolumeConfiguration
configuration} -> Maybe VolumeConfiguration
configuration) (\s :: VolumeRecommendationOption
s@VolumeRecommendationOption' {} Maybe VolumeConfiguration
a -> VolumeRecommendationOption
s {$sel:configuration:VolumeRecommendationOption' :: Maybe VolumeConfiguration
configuration = Maybe VolumeConfiguration
a} :: VolumeRecommendationOption)

-- | The performance risk of the volume recommendation option.
--
-- Performance risk is the likelihood of the recommended volume type
-- meeting the performance requirement of your workload.
--
-- The value ranges from @0@ - @4@, with @0@ meaning that the recommended
-- resource is predicted to always provide enough hardware capability. The
-- higher the performance risk is, the more likely you should validate
-- whether the recommendation will meet the performance requirements of
-- your workload before migrating your resource.
volumeRecommendationOption_performanceRisk :: Lens.Lens' VolumeRecommendationOption (Prelude.Maybe Prelude.Double)
volumeRecommendationOption_performanceRisk :: Lens' VolumeRecommendationOption (Maybe Double)
volumeRecommendationOption_performanceRisk = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeRecommendationOption' {Maybe Double
performanceRisk :: Maybe Double
$sel:performanceRisk:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe Double
performanceRisk} -> Maybe Double
performanceRisk) (\s :: VolumeRecommendationOption
s@VolumeRecommendationOption' {} Maybe Double
a -> VolumeRecommendationOption
s {$sel:performanceRisk:VolumeRecommendationOption' :: Maybe Double
performanceRisk = Maybe Double
a} :: VolumeRecommendationOption)

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

-- | An object that describes the savings opportunity for the EBS volume
-- recommendation option. Savings opportunity includes the estimated
-- monthly savings amount and percentage.
volumeRecommendationOption_savingsOpportunity :: Lens.Lens' VolumeRecommendationOption (Prelude.Maybe SavingsOpportunity)
volumeRecommendationOption_savingsOpportunity :: Lens' VolumeRecommendationOption (Maybe SavingsOpportunity)
volumeRecommendationOption_savingsOpportunity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeRecommendationOption' {Maybe SavingsOpportunity
savingsOpportunity :: Maybe SavingsOpportunity
$sel:savingsOpportunity:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe SavingsOpportunity
savingsOpportunity} -> Maybe SavingsOpportunity
savingsOpportunity) (\s :: VolumeRecommendationOption
s@VolumeRecommendationOption' {} Maybe SavingsOpportunity
a -> VolumeRecommendationOption
s {$sel:savingsOpportunity:VolumeRecommendationOption' :: Maybe SavingsOpportunity
savingsOpportunity = Maybe SavingsOpportunity
a} :: VolumeRecommendationOption)

instance Data.FromJSON VolumeRecommendationOption where
  parseJSON :: Value -> Parser VolumeRecommendationOption
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VolumeRecommendationOption"
      ( \Object
x ->
          Maybe VolumeConfiguration
-> Maybe Double
-> Maybe Int
-> Maybe SavingsOpportunity
-> VolumeRecommendationOption
VolumeRecommendationOption'
            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
"configuration")
            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
"performanceRisk")
            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
"rank")
            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
"savingsOpportunity")
      )

instance Prelude.Hashable VolumeRecommendationOption where
  hashWithSalt :: Int -> VolumeRecommendationOption -> Int
hashWithSalt Int
_salt VolumeRecommendationOption' {Maybe Double
Maybe Int
Maybe SavingsOpportunity
Maybe VolumeConfiguration
savingsOpportunity :: Maybe SavingsOpportunity
rank :: Maybe Int
performanceRisk :: Maybe Double
configuration :: Maybe VolumeConfiguration
$sel:savingsOpportunity:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe SavingsOpportunity
$sel:rank:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe Int
$sel:performanceRisk:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe Double
$sel:configuration:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe VolumeConfiguration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VolumeConfiguration
configuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
performanceRisk
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
rank
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SavingsOpportunity
savingsOpportunity

instance Prelude.NFData VolumeRecommendationOption where
  rnf :: VolumeRecommendationOption -> ()
rnf VolumeRecommendationOption' {Maybe Double
Maybe Int
Maybe SavingsOpportunity
Maybe VolumeConfiguration
savingsOpportunity :: Maybe SavingsOpportunity
rank :: Maybe Int
performanceRisk :: Maybe Double
configuration :: Maybe VolumeConfiguration
$sel:savingsOpportunity:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe SavingsOpportunity
$sel:rank:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe Int
$sel:performanceRisk:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe Double
$sel:configuration:VolumeRecommendationOption' :: VolumeRecommendationOption -> Maybe VolumeConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VolumeConfiguration
configuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
performanceRisk
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
rank
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SavingsOpportunity
savingsOpportunity