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

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types.StorageTypeLimit
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | StorageTypes represents the list of storage related types and their
-- attributes that are available for given InstanceType.
--
-- /See:/ 'newStorageType' smart constructor.
data StorageType = StorageType'
  { -- | List of limits that are applicable for given storage type.
    StorageType -> Maybe [StorageTypeLimit]
storageTypeLimits :: Prelude.Maybe [StorageTypeLimit],
    StorageType -> Maybe Text
storageSubTypeName :: Prelude.Maybe Prelude.Text,
    StorageType -> Maybe Text
storageTypeName :: Prelude.Maybe Prelude.Text
  }
  deriving (StorageType -> StorageType -> Bool
(StorageType -> StorageType -> Bool)
-> (StorageType -> StorageType -> Bool) -> Eq StorageType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StorageType -> StorageType -> Bool
$c/= :: StorageType -> StorageType -> Bool
== :: StorageType -> StorageType -> Bool
$c== :: StorageType -> StorageType -> Bool
Prelude.Eq, ReadPrec [StorageType]
ReadPrec StorageType
Int -> ReadS StorageType
ReadS [StorageType]
(Int -> ReadS StorageType)
-> ReadS [StorageType]
-> ReadPrec StorageType
-> ReadPrec [StorageType]
-> Read StorageType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StorageType]
$creadListPrec :: ReadPrec [StorageType]
readPrec :: ReadPrec StorageType
$creadPrec :: ReadPrec StorageType
readList :: ReadS [StorageType]
$creadList :: ReadS [StorageType]
readsPrec :: Int -> ReadS StorageType
$creadsPrec :: Int -> ReadS StorageType
Prelude.Read, Int -> StorageType -> ShowS
[StorageType] -> ShowS
StorageType -> String
(Int -> StorageType -> ShowS)
-> (StorageType -> String)
-> ([StorageType] -> ShowS)
-> Show StorageType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StorageType] -> ShowS
$cshowList :: [StorageType] -> ShowS
show :: StorageType -> String
$cshow :: StorageType -> String
showsPrec :: Int -> StorageType -> ShowS
$cshowsPrec :: Int -> StorageType -> ShowS
Prelude.Show, (forall x. StorageType -> Rep StorageType x)
-> (forall x. Rep StorageType x -> StorageType)
-> Generic StorageType
forall x. Rep StorageType x -> StorageType
forall x. StorageType -> Rep StorageType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StorageType x -> StorageType
$cfrom :: forall x. StorageType -> Rep StorageType x
Prelude.Generic)

-- |
-- Create a value of 'StorageType' 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:
--
-- 'storageTypeLimits', 'storageType_storageTypeLimits' - List of limits that are applicable for given storage type.
--
-- 'storageSubTypeName', 'storageType_storageSubTypeName' - Undocumented member.
--
-- 'storageTypeName', 'storageType_storageTypeName' - Undocumented member.
newStorageType ::
  StorageType
newStorageType :: StorageType
newStorageType =
  StorageType' :: Maybe [StorageTypeLimit] -> Maybe Text -> Maybe Text -> StorageType
StorageType'
    { $sel:storageTypeLimits:StorageType' :: Maybe [StorageTypeLimit]
storageTypeLimits = Maybe [StorageTypeLimit]
forall a. Maybe a
Prelude.Nothing,
      $sel:storageSubTypeName:StorageType' :: Maybe Text
storageSubTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:storageTypeName:StorageType' :: Maybe Text
storageTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | List of limits that are applicable for given storage type.
storageType_storageTypeLimits :: Lens.Lens' StorageType (Prelude.Maybe [StorageTypeLimit])
storageType_storageTypeLimits :: (Maybe [StorageTypeLimit] -> f (Maybe [StorageTypeLimit]))
-> StorageType -> f StorageType
storageType_storageTypeLimits = (StorageType -> Maybe [StorageTypeLimit])
-> (StorageType -> Maybe [StorageTypeLimit] -> StorageType)
-> Lens
     StorageType
     StorageType
     (Maybe [StorageTypeLimit])
     (Maybe [StorageTypeLimit])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageType' {Maybe [StorageTypeLimit]
storageTypeLimits :: Maybe [StorageTypeLimit]
$sel:storageTypeLimits:StorageType' :: StorageType -> Maybe [StorageTypeLimit]
storageTypeLimits} -> Maybe [StorageTypeLimit]
storageTypeLimits) (\s :: StorageType
s@StorageType' {} Maybe [StorageTypeLimit]
a -> StorageType
s {$sel:storageTypeLimits:StorageType' :: Maybe [StorageTypeLimit]
storageTypeLimits = Maybe [StorageTypeLimit]
a} :: StorageType) ((Maybe [StorageTypeLimit] -> f (Maybe [StorageTypeLimit]))
 -> StorageType -> f StorageType)
-> ((Maybe [StorageTypeLimit] -> f (Maybe [StorageTypeLimit]))
    -> Maybe [StorageTypeLimit] -> f (Maybe [StorageTypeLimit]))
-> (Maybe [StorageTypeLimit] -> f (Maybe [StorageTypeLimit]))
-> StorageType
-> f StorageType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [StorageTypeLimit]
  [StorageTypeLimit]
  [StorageTypeLimit]
  [StorageTypeLimit]
-> Iso
     (Maybe [StorageTypeLimit])
     (Maybe [StorageTypeLimit])
     (Maybe [StorageTypeLimit])
     (Maybe [StorageTypeLimit])
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
  [StorageTypeLimit]
  [StorageTypeLimit]
  [StorageTypeLimit]
  [StorageTypeLimit]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
storageType_storageSubTypeName :: Lens.Lens' StorageType (Prelude.Maybe Prelude.Text)
storageType_storageSubTypeName :: (Maybe Text -> f (Maybe Text)) -> StorageType -> f StorageType
storageType_storageSubTypeName = (StorageType -> Maybe Text)
-> (StorageType -> Maybe Text -> StorageType)
-> Lens StorageType StorageType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageType' {Maybe Text
storageSubTypeName :: Maybe Text
$sel:storageSubTypeName:StorageType' :: StorageType -> Maybe Text
storageSubTypeName} -> Maybe Text
storageSubTypeName) (\s :: StorageType
s@StorageType' {} Maybe Text
a -> StorageType
s {$sel:storageSubTypeName:StorageType' :: Maybe Text
storageSubTypeName = Maybe Text
a} :: StorageType)

-- | Undocumented member.
storageType_storageTypeName :: Lens.Lens' StorageType (Prelude.Maybe Prelude.Text)
storageType_storageTypeName :: (Maybe Text -> f (Maybe Text)) -> StorageType -> f StorageType
storageType_storageTypeName = (StorageType -> Maybe Text)
-> (StorageType -> Maybe Text -> StorageType)
-> Lens StorageType StorageType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageType' {Maybe Text
storageTypeName :: Maybe Text
$sel:storageTypeName:StorageType' :: StorageType -> Maybe Text
storageTypeName} -> Maybe Text
storageTypeName) (\s :: StorageType
s@StorageType' {} Maybe Text
a -> StorageType
s {$sel:storageTypeName:StorageType' :: Maybe Text
storageTypeName = Maybe Text
a} :: StorageType)

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

instance Prelude.Hashable StorageType

instance Prelude.NFData StorageType