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

import Amazonka.ComputeOptimizer.Types.VolumeConfiguration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | An array of objects that describe a volume configuration.
    VolumeRecommendationOption -> Maybe VolumeConfiguration
configuration :: Prelude.Maybe VolumeConfiguration,
    -- | The rank of the volume recommendation option.
    --
    -- The top recommendation option is ranked as @1@.
    VolumeRecommendationOption -> Maybe Int
rank :: Prelude.Maybe Prelude.Int
  }
  deriving (VolumeRecommendationOption -> VolumeRecommendationOption -> Bool
(VolumeRecommendationOption -> VolumeRecommendationOption -> Bool)
-> (VolumeRecommendationOption
    -> VolumeRecommendationOption -> Bool)
-> Eq VolumeRecommendationOption
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]
(Int -> ReadS VolumeRecommendationOption)
-> ReadS [VolumeRecommendationOption]
-> ReadPrec VolumeRecommendationOption
-> ReadPrec [VolumeRecommendationOption]
-> Read 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
(Int -> VolumeRecommendationOption -> ShowS)
-> (VolumeRecommendationOption -> String)
-> ([VolumeRecommendationOption] -> ShowS)
-> Show VolumeRecommendationOption
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.
 VolumeRecommendationOption -> Rep VolumeRecommendationOption x)
-> (forall x.
    Rep VolumeRecommendationOption x -> VolumeRecommendationOption)
-> Generic VolumeRecommendationOption
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:
--
-- '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.
--
-- 'configuration', 'volumeRecommendationOption_configuration' - An array of objects that describe a volume configuration.
--
-- 'rank', 'volumeRecommendationOption_rank' - The rank of the volume recommendation option.
--
-- The top recommendation option is ranked as @1@.
newVolumeRecommendationOption ::
  VolumeRecommendationOption
newVolumeRecommendationOption :: VolumeRecommendationOption
newVolumeRecommendationOption =
  VolumeRecommendationOption' :: Maybe Double
-> Maybe VolumeConfiguration
-> Maybe Int
-> VolumeRecommendationOption
VolumeRecommendationOption'
    { $sel:performanceRisk:VolumeRecommendationOption' :: Maybe Double
performanceRisk =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:configuration:VolumeRecommendationOption' :: Maybe VolumeConfiguration
configuration = Maybe VolumeConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:rank:VolumeRecommendationOption' :: Maybe Int
rank = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Double -> f (Maybe Double))
-> VolumeRecommendationOption -> f VolumeRecommendationOption
volumeRecommendationOption_performanceRisk = (VolumeRecommendationOption -> Maybe Double)
-> (VolumeRecommendationOption
    -> Maybe Double -> VolumeRecommendationOption)
-> Lens
     VolumeRecommendationOption
     VolumeRecommendationOption
     (Maybe Double)
     (Maybe Double)
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)

-- | An array of objects that describe a volume configuration.
volumeRecommendationOption_configuration :: Lens.Lens' VolumeRecommendationOption (Prelude.Maybe VolumeConfiguration)
volumeRecommendationOption_configuration :: (Maybe VolumeConfiguration -> f (Maybe VolumeConfiguration))
-> VolumeRecommendationOption -> f VolumeRecommendationOption
volumeRecommendationOption_configuration = (VolumeRecommendationOption -> Maybe VolumeConfiguration)
-> (VolumeRecommendationOption
    -> Maybe VolumeConfiguration -> VolumeRecommendationOption)
-> Lens
     VolumeRecommendationOption
     VolumeRecommendationOption
     (Maybe VolumeConfiguration)
     (Maybe VolumeConfiguration)
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 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 :: (Maybe Int -> f (Maybe Int))
-> VolumeRecommendationOption -> f VolumeRecommendationOption
volumeRecommendationOption_rank = (VolumeRecommendationOption -> Maybe Int)
-> (VolumeRecommendationOption
    -> Maybe Int -> VolumeRecommendationOption)
-> Lens
     VolumeRecommendationOption
     VolumeRecommendationOption
     (Maybe Int)
     (Maybe Int)
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)

instance Core.FromJSON VolumeRecommendationOption where
  parseJSON :: Value -> Parser VolumeRecommendationOption
parseJSON =
    String
-> (Object -> Parser VolumeRecommendationOption)
-> Value
-> Parser VolumeRecommendationOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VolumeRecommendationOption"
      ( \Object
x ->
          Maybe Double
-> Maybe VolumeConfiguration
-> Maybe Int
-> VolumeRecommendationOption
VolumeRecommendationOption'
            (Maybe Double
 -> Maybe VolumeConfiguration
 -> Maybe Int
 -> VolumeRecommendationOption)
-> Parser (Maybe Double)
-> Parser
     (Maybe VolumeConfiguration
      -> Maybe Int -> VolumeRecommendationOption)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"performanceRisk")
            Parser
  (Maybe VolumeConfiguration
   -> Maybe Int -> VolumeRecommendationOption)
-> Parser (Maybe VolumeConfiguration)
-> Parser (Maybe Int -> VolumeRecommendationOption)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VolumeConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configuration")
            Parser (Maybe Int -> VolumeRecommendationOption)
-> Parser (Maybe Int) -> Parser VolumeRecommendationOption
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 VolumeRecommendationOption

instance Prelude.NFData VolumeRecommendationOption