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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the configuration of an Amazon Elastic Block Store (Amazon
-- EBS) volume.
--
-- /See:/ 'newVolumeConfiguration' smart constructor.
data VolumeConfiguration = VolumeConfiguration'
  { -- | The size of the volume, in GiB.
    VolumeConfiguration -> Maybe Int
volumeSize :: Prelude.Maybe Prelude.Int,
    -- | The baseline IOPS of the volume.
    VolumeConfiguration -> Maybe Int
volumeBaselineIOPS :: Prelude.Maybe Prelude.Int,
    -- | The burst IOPS of the volume.
    VolumeConfiguration -> Maybe Int
volumeBurstIOPS :: Prelude.Maybe Prelude.Int,
    -- | The volume type.
    --
    -- This can be @gp2@ for General Purpose SSD, @io1@ or @io2@ for
    -- Provisioned IOPS SSD, @st1@ for Throughput Optimized HDD, @sc1@ for Cold
    -- HDD, or @standard@ for Magnetic volumes.
    VolumeConfiguration -> Maybe Text
volumeType :: Prelude.Maybe Prelude.Text,
    -- | The burst throughput of the volume.
    VolumeConfiguration -> Maybe Int
volumeBurstThroughput :: Prelude.Maybe Prelude.Int,
    -- | The baseline throughput of the volume.
    VolumeConfiguration -> Maybe Int
volumeBaselineThroughput :: Prelude.Maybe Prelude.Int
  }
  deriving (VolumeConfiguration -> VolumeConfiguration -> Bool
(VolumeConfiguration -> VolumeConfiguration -> Bool)
-> (VolumeConfiguration -> VolumeConfiguration -> Bool)
-> Eq VolumeConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VolumeConfiguration -> VolumeConfiguration -> Bool
$c/= :: VolumeConfiguration -> VolumeConfiguration -> Bool
== :: VolumeConfiguration -> VolumeConfiguration -> Bool
$c== :: VolumeConfiguration -> VolumeConfiguration -> Bool
Prelude.Eq, ReadPrec [VolumeConfiguration]
ReadPrec VolumeConfiguration
Int -> ReadS VolumeConfiguration
ReadS [VolumeConfiguration]
(Int -> ReadS VolumeConfiguration)
-> ReadS [VolumeConfiguration]
-> ReadPrec VolumeConfiguration
-> ReadPrec [VolumeConfiguration]
-> Read VolumeConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VolumeConfiguration]
$creadListPrec :: ReadPrec [VolumeConfiguration]
readPrec :: ReadPrec VolumeConfiguration
$creadPrec :: ReadPrec VolumeConfiguration
readList :: ReadS [VolumeConfiguration]
$creadList :: ReadS [VolumeConfiguration]
readsPrec :: Int -> ReadS VolumeConfiguration
$creadsPrec :: Int -> ReadS VolumeConfiguration
Prelude.Read, Int -> VolumeConfiguration -> ShowS
[VolumeConfiguration] -> ShowS
VolumeConfiguration -> String
(Int -> VolumeConfiguration -> ShowS)
-> (VolumeConfiguration -> String)
-> ([VolumeConfiguration] -> ShowS)
-> Show VolumeConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VolumeConfiguration] -> ShowS
$cshowList :: [VolumeConfiguration] -> ShowS
show :: VolumeConfiguration -> String
$cshow :: VolumeConfiguration -> String
showsPrec :: Int -> VolumeConfiguration -> ShowS
$cshowsPrec :: Int -> VolumeConfiguration -> ShowS
Prelude.Show, (forall x. VolumeConfiguration -> Rep VolumeConfiguration x)
-> (forall x. Rep VolumeConfiguration x -> VolumeConfiguration)
-> Generic VolumeConfiguration
forall x. Rep VolumeConfiguration x -> VolumeConfiguration
forall x. VolumeConfiguration -> Rep VolumeConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VolumeConfiguration x -> VolumeConfiguration
$cfrom :: forall x. VolumeConfiguration -> Rep VolumeConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'VolumeConfiguration' 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:
--
-- 'volumeSize', 'volumeConfiguration_volumeSize' - The size of the volume, in GiB.
--
-- 'volumeBaselineIOPS', 'volumeConfiguration_volumeBaselineIOPS' - The baseline IOPS of the volume.
--
-- 'volumeBurstIOPS', 'volumeConfiguration_volumeBurstIOPS' - The burst IOPS of the volume.
--
-- 'volumeType', 'volumeConfiguration_volumeType' - The volume type.
--
-- This can be @gp2@ for General Purpose SSD, @io1@ or @io2@ for
-- Provisioned IOPS SSD, @st1@ for Throughput Optimized HDD, @sc1@ for Cold
-- HDD, or @standard@ for Magnetic volumes.
--
-- 'volumeBurstThroughput', 'volumeConfiguration_volumeBurstThroughput' - The burst throughput of the volume.
--
-- 'volumeBaselineThroughput', 'volumeConfiguration_volumeBaselineThroughput' - The baseline throughput of the volume.
newVolumeConfiguration ::
  VolumeConfiguration
newVolumeConfiguration :: VolumeConfiguration
newVolumeConfiguration =
  VolumeConfiguration' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> VolumeConfiguration
VolumeConfiguration'
    { $sel:volumeSize:VolumeConfiguration' :: Maybe Int
volumeSize = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeBaselineIOPS:VolumeConfiguration' :: Maybe Int
volumeBaselineIOPS = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeBurstIOPS:VolumeConfiguration' :: Maybe Int
volumeBurstIOPS = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeType:VolumeConfiguration' :: Maybe Text
volumeType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeBurstThroughput:VolumeConfiguration' :: Maybe Int
volumeBurstThroughput = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeBaselineThroughput:VolumeConfiguration' :: Maybe Int
volumeBaselineThroughput = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The size of the volume, in GiB.
volumeConfiguration_volumeSize :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Int)
volumeConfiguration_volumeSize :: (Maybe Int -> f (Maybe Int))
-> VolumeConfiguration -> f VolumeConfiguration
volumeConfiguration_volumeSize = (VolumeConfiguration -> Maybe Int)
-> (VolumeConfiguration -> Maybe Int -> VolumeConfiguration)
-> Lens
     VolumeConfiguration VolumeConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Int
volumeSize :: Maybe Int
$sel:volumeSize:VolumeConfiguration' :: VolumeConfiguration -> Maybe Int
volumeSize} -> Maybe Int
volumeSize) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Int
a -> VolumeConfiguration
s {$sel:volumeSize:VolumeConfiguration' :: Maybe Int
volumeSize = Maybe Int
a} :: VolumeConfiguration)

-- | The baseline IOPS of the volume.
volumeConfiguration_volumeBaselineIOPS :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Int)
volumeConfiguration_volumeBaselineIOPS :: (Maybe Int -> f (Maybe Int))
-> VolumeConfiguration -> f VolumeConfiguration
volumeConfiguration_volumeBaselineIOPS = (VolumeConfiguration -> Maybe Int)
-> (VolumeConfiguration -> Maybe Int -> VolumeConfiguration)
-> Lens
     VolumeConfiguration VolumeConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Int
volumeBaselineIOPS :: Maybe Int
$sel:volumeBaselineIOPS:VolumeConfiguration' :: VolumeConfiguration -> Maybe Int
volumeBaselineIOPS} -> Maybe Int
volumeBaselineIOPS) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Int
a -> VolumeConfiguration
s {$sel:volumeBaselineIOPS:VolumeConfiguration' :: Maybe Int
volumeBaselineIOPS = Maybe Int
a} :: VolumeConfiguration)

-- | The burst IOPS of the volume.
volumeConfiguration_volumeBurstIOPS :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Int)
volumeConfiguration_volumeBurstIOPS :: (Maybe Int -> f (Maybe Int))
-> VolumeConfiguration -> f VolumeConfiguration
volumeConfiguration_volumeBurstIOPS = (VolumeConfiguration -> Maybe Int)
-> (VolumeConfiguration -> Maybe Int -> VolumeConfiguration)
-> Lens
     VolumeConfiguration VolumeConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Int
volumeBurstIOPS :: Maybe Int
$sel:volumeBurstIOPS:VolumeConfiguration' :: VolumeConfiguration -> Maybe Int
volumeBurstIOPS} -> Maybe Int
volumeBurstIOPS) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Int
a -> VolumeConfiguration
s {$sel:volumeBurstIOPS:VolumeConfiguration' :: Maybe Int
volumeBurstIOPS = Maybe Int
a} :: VolumeConfiguration)

-- | The volume type.
--
-- This can be @gp2@ for General Purpose SSD, @io1@ or @io2@ for
-- Provisioned IOPS SSD, @st1@ for Throughput Optimized HDD, @sc1@ for Cold
-- HDD, or @standard@ for Magnetic volumes.
volumeConfiguration_volumeType :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Text)
volumeConfiguration_volumeType :: (Maybe Text -> f (Maybe Text))
-> VolumeConfiguration -> f VolumeConfiguration
volumeConfiguration_volumeType = (VolumeConfiguration -> Maybe Text)
-> (VolumeConfiguration -> Maybe Text -> VolumeConfiguration)
-> Lens
     VolumeConfiguration VolumeConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Text
volumeType :: Maybe Text
$sel:volumeType:VolumeConfiguration' :: VolumeConfiguration -> Maybe Text
volumeType} -> Maybe Text
volumeType) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Text
a -> VolumeConfiguration
s {$sel:volumeType:VolumeConfiguration' :: Maybe Text
volumeType = Maybe Text
a} :: VolumeConfiguration)

-- | The burst throughput of the volume.
volumeConfiguration_volumeBurstThroughput :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Int)
volumeConfiguration_volumeBurstThroughput :: (Maybe Int -> f (Maybe Int))
-> VolumeConfiguration -> f VolumeConfiguration
volumeConfiguration_volumeBurstThroughput = (VolumeConfiguration -> Maybe Int)
-> (VolumeConfiguration -> Maybe Int -> VolumeConfiguration)
-> Lens
     VolumeConfiguration VolumeConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Int
volumeBurstThroughput :: Maybe Int
$sel:volumeBurstThroughput:VolumeConfiguration' :: VolumeConfiguration -> Maybe Int
volumeBurstThroughput} -> Maybe Int
volumeBurstThroughput) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Int
a -> VolumeConfiguration
s {$sel:volumeBurstThroughput:VolumeConfiguration' :: Maybe Int
volumeBurstThroughput = Maybe Int
a} :: VolumeConfiguration)

-- | The baseline throughput of the volume.
volumeConfiguration_volumeBaselineThroughput :: Lens.Lens' VolumeConfiguration (Prelude.Maybe Prelude.Int)
volumeConfiguration_volumeBaselineThroughput :: (Maybe Int -> f (Maybe Int))
-> VolumeConfiguration -> f VolumeConfiguration
volumeConfiguration_volumeBaselineThroughput = (VolumeConfiguration -> Maybe Int)
-> (VolumeConfiguration -> Maybe Int -> VolumeConfiguration)
-> Lens
     VolumeConfiguration VolumeConfiguration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VolumeConfiguration' {Maybe Int
volumeBaselineThroughput :: Maybe Int
$sel:volumeBaselineThroughput:VolumeConfiguration' :: VolumeConfiguration -> Maybe Int
volumeBaselineThroughput} -> Maybe Int
volumeBaselineThroughput) (\s :: VolumeConfiguration
s@VolumeConfiguration' {} Maybe Int
a -> VolumeConfiguration
s {$sel:volumeBaselineThroughput:VolumeConfiguration' :: Maybe Int
volumeBaselineThroughput = Maybe Int
a} :: VolumeConfiguration)

instance Core.FromJSON VolumeConfiguration where
  parseJSON :: Value -> Parser VolumeConfiguration
parseJSON =
    String
-> (Object -> Parser VolumeConfiguration)
-> Value
-> Parser VolumeConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VolumeConfiguration"
      ( \Object
x ->
          Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Int
-> VolumeConfiguration
VolumeConfiguration'
            (Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> Maybe Int
 -> Maybe Int
 -> VolumeConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Int
      -> VolumeConfiguration)
forall (f :: * -> *) a b. Functor 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
"volumeSize")
            Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Int
   -> VolumeConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Text -> Maybe Int -> Maybe Int -> VolumeConfiguration)
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
"volumeBaselineIOPS")
            Parser
  (Maybe Int
   -> Maybe Text -> Maybe Int -> Maybe Int -> VolumeConfiguration)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text -> Maybe Int -> Maybe Int -> VolumeConfiguration)
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
"volumeBurstIOPS")
            Parser
  (Maybe Text -> Maybe Int -> Maybe Int -> VolumeConfiguration)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Int -> VolumeConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"volumeType")
            Parser (Maybe Int -> Maybe Int -> VolumeConfiguration)
-> Parser (Maybe Int) -> Parser (Maybe Int -> VolumeConfiguration)
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
"volumeBurstThroughput")
            Parser (Maybe Int -> VolumeConfiguration)
-> Parser (Maybe Int) -> Parser VolumeConfiguration
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
"volumeBaselineThroughput")
      )

instance Prelude.Hashable VolumeConfiguration

instance Prelude.NFData VolumeConfiguration