{-# 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.Neptune.Types.ValidStorageOptions
-- 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.Neptune.Types.ValidStorageOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Neptune.Types.DoubleRange
import Amazonka.Neptune.Types.Range
import qualified Amazonka.Prelude as Prelude

-- | Information about valid modifications that you can make to your DB
-- instance.
--
-- Contains the result of a successful call to the
-- DescribeValidDBInstanceModifications action.
--
-- /See:/ 'newValidStorageOptions' smart constructor.
data ValidStorageOptions = ValidStorageOptions'
  { -- | The valid range of storage in gibibytes. For example, 100 to 16384.
    ValidStorageOptions -> Maybe [Range]
storageSize :: Prelude.Maybe [Range],
    -- | The valid range of provisioned IOPS. For example, 1000-20000.
    ValidStorageOptions -> Maybe [Range]
provisionedIops :: Prelude.Maybe [Range],
    -- | The valid range of Provisioned IOPS to gibibytes of storage multiplier.
    -- For example, 3-10, which means that provisioned IOPS can be between 3
    -- and 10 times storage.
    ValidStorageOptions -> Maybe [DoubleRange]
iopsToStorageRatio :: Prelude.Maybe [DoubleRange],
    -- | The valid storage types for your DB instance. For example, gp2, io1.
    ValidStorageOptions -> Maybe Text
storageType :: Prelude.Maybe Prelude.Text
  }
  deriving (ValidStorageOptions -> ValidStorageOptions -> Bool
(ValidStorageOptions -> ValidStorageOptions -> Bool)
-> (ValidStorageOptions -> ValidStorageOptions -> Bool)
-> Eq ValidStorageOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValidStorageOptions -> ValidStorageOptions -> Bool
$c/= :: ValidStorageOptions -> ValidStorageOptions -> Bool
== :: ValidStorageOptions -> ValidStorageOptions -> Bool
$c== :: ValidStorageOptions -> ValidStorageOptions -> Bool
Prelude.Eq, ReadPrec [ValidStorageOptions]
ReadPrec ValidStorageOptions
Int -> ReadS ValidStorageOptions
ReadS [ValidStorageOptions]
(Int -> ReadS ValidStorageOptions)
-> ReadS [ValidStorageOptions]
-> ReadPrec ValidStorageOptions
-> ReadPrec [ValidStorageOptions]
-> Read ValidStorageOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ValidStorageOptions]
$creadListPrec :: ReadPrec [ValidStorageOptions]
readPrec :: ReadPrec ValidStorageOptions
$creadPrec :: ReadPrec ValidStorageOptions
readList :: ReadS [ValidStorageOptions]
$creadList :: ReadS [ValidStorageOptions]
readsPrec :: Int -> ReadS ValidStorageOptions
$creadsPrec :: Int -> ReadS ValidStorageOptions
Prelude.Read, Int -> ValidStorageOptions -> ShowS
[ValidStorageOptions] -> ShowS
ValidStorageOptions -> String
(Int -> ValidStorageOptions -> ShowS)
-> (ValidStorageOptions -> String)
-> ([ValidStorageOptions] -> ShowS)
-> Show ValidStorageOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValidStorageOptions] -> ShowS
$cshowList :: [ValidStorageOptions] -> ShowS
show :: ValidStorageOptions -> String
$cshow :: ValidStorageOptions -> String
showsPrec :: Int -> ValidStorageOptions -> ShowS
$cshowsPrec :: Int -> ValidStorageOptions -> ShowS
Prelude.Show, (forall x. ValidStorageOptions -> Rep ValidStorageOptions x)
-> (forall x. Rep ValidStorageOptions x -> ValidStorageOptions)
-> Generic ValidStorageOptions
forall x. Rep ValidStorageOptions x -> ValidStorageOptions
forall x. ValidStorageOptions -> Rep ValidStorageOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ValidStorageOptions x -> ValidStorageOptions
$cfrom :: forall x. ValidStorageOptions -> Rep ValidStorageOptions x
Prelude.Generic)

-- |
-- Create a value of 'ValidStorageOptions' 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:
--
-- 'storageSize', 'validStorageOptions_storageSize' - The valid range of storage in gibibytes. For example, 100 to 16384.
--
-- 'provisionedIops', 'validStorageOptions_provisionedIops' - The valid range of provisioned IOPS. For example, 1000-20000.
--
-- 'iopsToStorageRatio', 'validStorageOptions_iopsToStorageRatio' - The valid range of Provisioned IOPS to gibibytes of storage multiplier.
-- For example, 3-10, which means that provisioned IOPS can be between 3
-- and 10 times storage.
--
-- 'storageType', 'validStorageOptions_storageType' - The valid storage types for your DB instance. For example, gp2, io1.
newValidStorageOptions ::
  ValidStorageOptions
newValidStorageOptions :: ValidStorageOptions
newValidStorageOptions =
  ValidStorageOptions' :: Maybe [Range]
-> Maybe [Range]
-> Maybe [DoubleRange]
-> Maybe Text
-> ValidStorageOptions
ValidStorageOptions'
    { $sel:storageSize:ValidStorageOptions' :: Maybe [Range]
storageSize = Maybe [Range]
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedIops:ValidStorageOptions' :: Maybe [Range]
provisionedIops = Maybe [Range]
forall a. Maybe a
Prelude.Nothing,
      $sel:iopsToStorageRatio:ValidStorageOptions' :: Maybe [DoubleRange]
iopsToStorageRatio = Maybe [DoubleRange]
forall a. Maybe a
Prelude.Nothing,
      $sel:storageType:ValidStorageOptions' :: Maybe Text
storageType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The valid range of storage in gibibytes. For example, 100 to 16384.
validStorageOptions_storageSize :: Lens.Lens' ValidStorageOptions (Prelude.Maybe [Range])
validStorageOptions_storageSize :: (Maybe [Range] -> f (Maybe [Range]))
-> ValidStorageOptions -> f ValidStorageOptions
validStorageOptions_storageSize = (ValidStorageOptions -> Maybe [Range])
-> (ValidStorageOptions -> Maybe [Range] -> ValidStorageOptions)
-> Lens
     ValidStorageOptions
     ValidStorageOptions
     (Maybe [Range])
     (Maybe [Range])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidStorageOptions' {Maybe [Range]
storageSize :: Maybe [Range]
$sel:storageSize:ValidStorageOptions' :: ValidStorageOptions -> Maybe [Range]
storageSize} -> Maybe [Range]
storageSize) (\s :: ValidStorageOptions
s@ValidStorageOptions' {} Maybe [Range]
a -> ValidStorageOptions
s {$sel:storageSize:ValidStorageOptions' :: Maybe [Range]
storageSize = Maybe [Range]
a} :: ValidStorageOptions) ((Maybe [Range] -> f (Maybe [Range]))
 -> ValidStorageOptions -> f ValidStorageOptions)
-> ((Maybe [Range] -> f (Maybe [Range]))
    -> Maybe [Range] -> f (Maybe [Range]))
-> (Maybe [Range] -> f (Maybe [Range]))
-> ValidStorageOptions
-> f ValidStorageOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Range] [Range] [Range] [Range]
-> Iso
     (Maybe [Range]) (Maybe [Range]) (Maybe [Range]) (Maybe [Range])
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 AnIso [Range] [Range] [Range] [Range]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The valid range of provisioned IOPS. For example, 1000-20000.
validStorageOptions_provisionedIops :: Lens.Lens' ValidStorageOptions (Prelude.Maybe [Range])
validStorageOptions_provisionedIops :: (Maybe [Range] -> f (Maybe [Range]))
-> ValidStorageOptions -> f ValidStorageOptions
validStorageOptions_provisionedIops = (ValidStorageOptions -> Maybe [Range])
-> (ValidStorageOptions -> Maybe [Range] -> ValidStorageOptions)
-> Lens
     ValidStorageOptions
     ValidStorageOptions
     (Maybe [Range])
     (Maybe [Range])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidStorageOptions' {Maybe [Range]
provisionedIops :: Maybe [Range]
$sel:provisionedIops:ValidStorageOptions' :: ValidStorageOptions -> Maybe [Range]
provisionedIops} -> Maybe [Range]
provisionedIops) (\s :: ValidStorageOptions
s@ValidStorageOptions' {} Maybe [Range]
a -> ValidStorageOptions
s {$sel:provisionedIops:ValidStorageOptions' :: Maybe [Range]
provisionedIops = Maybe [Range]
a} :: ValidStorageOptions) ((Maybe [Range] -> f (Maybe [Range]))
 -> ValidStorageOptions -> f ValidStorageOptions)
-> ((Maybe [Range] -> f (Maybe [Range]))
    -> Maybe [Range] -> f (Maybe [Range]))
-> (Maybe [Range] -> f (Maybe [Range]))
-> ValidStorageOptions
-> f ValidStorageOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Range] [Range] [Range] [Range]
-> Iso
     (Maybe [Range]) (Maybe [Range]) (Maybe [Range]) (Maybe [Range])
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 AnIso [Range] [Range] [Range] [Range]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The valid range of Provisioned IOPS to gibibytes of storage multiplier.
-- For example, 3-10, which means that provisioned IOPS can be between 3
-- and 10 times storage.
validStorageOptions_iopsToStorageRatio :: Lens.Lens' ValidStorageOptions (Prelude.Maybe [DoubleRange])
validStorageOptions_iopsToStorageRatio :: (Maybe [DoubleRange] -> f (Maybe [DoubleRange]))
-> ValidStorageOptions -> f ValidStorageOptions
validStorageOptions_iopsToStorageRatio = (ValidStorageOptions -> Maybe [DoubleRange])
-> (ValidStorageOptions
    -> Maybe [DoubleRange] -> ValidStorageOptions)
-> Lens
     ValidStorageOptions
     ValidStorageOptions
     (Maybe [DoubleRange])
     (Maybe [DoubleRange])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidStorageOptions' {Maybe [DoubleRange]
iopsToStorageRatio :: Maybe [DoubleRange]
$sel:iopsToStorageRatio:ValidStorageOptions' :: ValidStorageOptions -> Maybe [DoubleRange]
iopsToStorageRatio} -> Maybe [DoubleRange]
iopsToStorageRatio) (\s :: ValidStorageOptions
s@ValidStorageOptions' {} Maybe [DoubleRange]
a -> ValidStorageOptions
s {$sel:iopsToStorageRatio:ValidStorageOptions' :: Maybe [DoubleRange]
iopsToStorageRatio = Maybe [DoubleRange]
a} :: ValidStorageOptions) ((Maybe [DoubleRange] -> f (Maybe [DoubleRange]))
 -> ValidStorageOptions -> f ValidStorageOptions)
-> ((Maybe [DoubleRange] -> f (Maybe [DoubleRange]))
    -> Maybe [DoubleRange] -> f (Maybe [DoubleRange]))
-> (Maybe [DoubleRange] -> f (Maybe [DoubleRange]))
-> ValidStorageOptions
-> f ValidStorageOptions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DoubleRange] [DoubleRange] [DoubleRange] [DoubleRange]
-> Iso
     (Maybe [DoubleRange])
     (Maybe [DoubleRange])
     (Maybe [DoubleRange])
     (Maybe [DoubleRange])
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 AnIso [DoubleRange] [DoubleRange] [DoubleRange] [DoubleRange]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The valid storage types for your DB instance. For example, gp2, io1.
validStorageOptions_storageType :: Lens.Lens' ValidStorageOptions (Prelude.Maybe Prelude.Text)
validStorageOptions_storageType :: (Maybe Text -> f (Maybe Text))
-> ValidStorageOptions -> f ValidStorageOptions
validStorageOptions_storageType = (ValidStorageOptions -> Maybe Text)
-> (ValidStorageOptions -> Maybe Text -> ValidStorageOptions)
-> Lens
     ValidStorageOptions ValidStorageOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ValidStorageOptions' {Maybe Text
storageType :: Maybe Text
$sel:storageType:ValidStorageOptions' :: ValidStorageOptions -> Maybe Text
storageType} -> Maybe Text
storageType) (\s :: ValidStorageOptions
s@ValidStorageOptions' {} Maybe Text
a -> ValidStorageOptions
s {$sel:storageType:ValidStorageOptions' :: Maybe Text
storageType = Maybe Text
a} :: ValidStorageOptions)

instance Core.FromXML ValidStorageOptions where
  parseXML :: [Node] -> Either String ValidStorageOptions
parseXML [Node]
x =
    Maybe [Range]
-> Maybe [Range]
-> Maybe [DoubleRange]
-> Maybe Text
-> ValidStorageOptions
ValidStorageOptions'
      (Maybe [Range]
 -> Maybe [Range]
 -> Maybe [DoubleRange]
 -> Maybe Text
 -> ValidStorageOptions)
-> Either String (Maybe [Range])
-> Either
     String
     (Maybe [Range]
      -> Maybe [DoubleRange] -> Maybe Text -> ValidStorageOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StorageSize" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Range]))
-> Either String (Maybe [Range])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Range])
-> [Node] -> Either String (Maybe [Range])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Range]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Range")
                  )
      Either
  String
  (Maybe [Range]
   -> Maybe [DoubleRange] -> Maybe Text -> ValidStorageOptions)
-> Either String (Maybe [Range])
-> Either
     String (Maybe [DoubleRange] -> Maybe Text -> ValidStorageOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ProvisionedIops" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Range]))
-> Either String (Maybe [Range])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Range])
-> [Node] -> Either String (Maybe [Range])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Range]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"Range")
                  )
      Either
  String (Maybe [DoubleRange] -> Maybe Text -> ValidStorageOptions)
-> Either String (Maybe [DoubleRange])
-> Either String (Maybe Text -> ValidStorageOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IopsToStorageRatio"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [DoubleRange]))
-> Either String (Maybe [DoubleRange])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DoubleRange])
-> [Node] -> Either String (Maybe [DoubleRange])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [DoubleRange]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"DoubleRange")
                  )
      Either String (Maybe Text -> ValidStorageOptions)
-> Either String (Maybe Text) -> Either String ValidStorageOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StorageType")

instance Prelude.Hashable ValidStorageOptions

instance Prelude.NFData ValidStorageOptions