{-# 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.ElasticSearch.Types.StorageTypeLimit
-- 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.ElasticSearch.Types.StorageTypeLimit where

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

-- | Limits that are applicable for given storage type.
--
-- /See:/ 'newStorageTypeLimit' smart constructor.
data StorageTypeLimit = StorageTypeLimit'
  { -- | Name of storage limits that are applicable for given storage type. If
    -- @ StorageType @ is ebs, following storage options are applicable
    --
    -- 1.  MinimumVolumeSize
    -- 2.  MaximumVolumeSize
    -- 3.  MaximumIops
    -- 4.  MinimumIops
    StorageTypeLimit -> Maybe Text
limitName :: Prelude.Maybe Prelude.Text,
    -- | Values for the @ StorageTypeLimit$LimitName @ .
    StorageTypeLimit -> Maybe [Text]
limitValues :: Prelude.Maybe [Prelude.Text]
  }
  deriving (StorageTypeLimit -> StorageTypeLimit -> Bool
(StorageTypeLimit -> StorageTypeLimit -> Bool)
-> (StorageTypeLimit -> StorageTypeLimit -> Bool)
-> Eq StorageTypeLimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StorageTypeLimit -> StorageTypeLimit -> Bool
$c/= :: StorageTypeLimit -> StorageTypeLimit -> Bool
== :: StorageTypeLimit -> StorageTypeLimit -> Bool
$c== :: StorageTypeLimit -> StorageTypeLimit -> Bool
Prelude.Eq, ReadPrec [StorageTypeLimit]
ReadPrec StorageTypeLimit
Int -> ReadS StorageTypeLimit
ReadS [StorageTypeLimit]
(Int -> ReadS StorageTypeLimit)
-> ReadS [StorageTypeLimit]
-> ReadPrec StorageTypeLimit
-> ReadPrec [StorageTypeLimit]
-> Read StorageTypeLimit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StorageTypeLimit]
$creadListPrec :: ReadPrec [StorageTypeLimit]
readPrec :: ReadPrec StorageTypeLimit
$creadPrec :: ReadPrec StorageTypeLimit
readList :: ReadS [StorageTypeLimit]
$creadList :: ReadS [StorageTypeLimit]
readsPrec :: Int -> ReadS StorageTypeLimit
$creadsPrec :: Int -> ReadS StorageTypeLimit
Prelude.Read, Int -> StorageTypeLimit -> ShowS
[StorageTypeLimit] -> ShowS
StorageTypeLimit -> String
(Int -> StorageTypeLimit -> ShowS)
-> (StorageTypeLimit -> String)
-> ([StorageTypeLimit] -> ShowS)
-> Show StorageTypeLimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StorageTypeLimit] -> ShowS
$cshowList :: [StorageTypeLimit] -> ShowS
show :: StorageTypeLimit -> String
$cshow :: StorageTypeLimit -> String
showsPrec :: Int -> StorageTypeLimit -> ShowS
$cshowsPrec :: Int -> StorageTypeLimit -> ShowS
Prelude.Show, (forall x. StorageTypeLimit -> Rep StorageTypeLimit x)
-> (forall x. Rep StorageTypeLimit x -> StorageTypeLimit)
-> Generic StorageTypeLimit
forall x. Rep StorageTypeLimit x -> StorageTypeLimit
forall x. StorageTypeLimit -> Rep StorageTypeLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StorageTypeLimit x -> StorageTypeLimit
$cfrom :: forall x. StorageTypeLimit -> Rep StorageTypeLimit x
Prelude.Generic)

-- |
-- Create a value of 'StorageTypeLimit' 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:
--
-- 'limitName', 'storageTypeLimit_limitName' - Name of storage limits that are applicable for given storage type. If
-- @ StorageType @ is ebs, following storage options are applicable
--
-- 1.  MinimumVolumeSize
-- 2.  MaximumVolumeSize
-- 3.  MaximumIops
-- 4.  MinimumIops
--
-- 'limitValues', 'storageTypeLimit_limitValues' - Values for the @ StorageTypeLimit$LimitName @ .
newStorageTypeLimit ::
  StorageTypeLimit
newStorageTypeLimit :: StorageTypeLimit
newStorageTypeLimit =
  StorageTypeLimit' :: Maybe Text -> Maybe [Text] -> StorageTypeLimit
StorageTypeLimit'
    { $sel:limitName:StorageTypeLimit' :: Maybe Text
limitName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limitValues:StorageTypeLimit' :: Maybe [Text]
limitValues = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Name of storage limits that are applicable for given storage type. If
-- @ StorageType @ is ebs, following storage options are applicable
--
-- 1.  MinimumVolumeSize
-- 2.  MaximumVolumeSize
-- 3.  MaximumIops
-- 4.  MinimumIops
storageTypeLimit_limitName :: Lens.Lens' StorageTypeLimit (Prelude.Maybe Prelude.Text)
storageTypeLimit_limitName :: (Maybe Text -> f (Maybe Text))
-> StorageTypeLimit -> f StorageTypeLimit
storageTypeLimit_limitName = (StorageTypeLimit -> Maybe Text)
-> (StorageTypeLimit -> Maybe Text -> StorageTypeLimit)
-> Lens StorageTypeLimit StorageTypeLimit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageTypeLimit' {Maybe Text
limitName :: Maybe Text
$sel:limitName:StorageTypeLimit' :: StorageTypeLimit -> Maybe Text
limitName} -> Maybe Text
limitName) (\s :: StorageTypeLimit
s@StorageTypeLimit' {} Maybe Text
a -> StorageTypeLimit
s {$sel:limitName:StorageTypeLimit' :: Maybe Text
limitName = Maybe Text
a} :: StorageTypeLimit)

-- | Values for the @ StorageTypeLimit$LimitName @ .
storageTypeLimit_limitValues :: Lens.Lens' StorageTypeLimit (Prelude.Maybe [Prelude.Text])
storageTypeLimit_limitValues :: (Maybe [Text] -> f (Maybe [Text]))
-> StorageTypeLimit -> f StorageTypeLimit
storageTypeLimit_limitValues = (StorageTypeLimit -> Maybe [Text])
-> (StorageTypeLimit -> Maybe [Text] -> StorageTypeLimit)
-> Lens
     StorageTypeLimit StorageTypeLimit (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageTypeLimit' {Maybe [Text]
limitValues :: Maybe [Text]
$sel:limitValues:StorageTypeLimit' :: StorageTypeLimit -> Maybe [Text]
limitValues} -> Maybe [Text]
limitValues) (\s :: StorageTypeLimit
s@StorageTypeLimit' {} Maybe [Text]
a -> StorageTypeLimit
s {$sel:limitValues:StorageTypeLimit' :: Maybe [Text]
limitValues = Maybe [Text]
a} :: StorageTypeLimit) ((Maybe [Text] -> f (Maybe [Text]))
 -> StorageTypeLimit -> f StorageTypeLimit)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> StorageTypeLimit
-> f StorageTypeLimit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON StorageTypeLimit where
  parseJSON :: Value -> Parser StorageTypeLimit
parseJSON =
    String
-> (Object -> Parser StorageTypeLimit)
-> Value
-> Parser StorageTypeLimit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StorageTypeLimit"
      ( \Object
x ->
          Maybe Text -> Maybe [Text] -> StorageTypeLimit
StorageTypeLimit'
            (Maybe Text -> Maybe [Text] -> StorageTypeLimit)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> StorageTypeLimit)
forall (f :: * -> *) a b. Functor 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
"LimitName")
            Parser (Maybe [Text] -> StorageTypeLimit)
-> Parser (Maybe [Text]) -> Parser StorageTypeLimit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LimitValues" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable StorageTypeLimit

instance Prelude.NFData StorageTypeLimit