{-# 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 #-}
module Amazonka.OpenSearch.Types.EBSOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.VolumeType
import qualified Amazonka.Prelude as Prelude
data EBSOptions = EBSOptions'
{
EBSOptions -> Maybe Int
volumeSize :: Prelude.Maybe Prelude.Int,
EBSOptions -> Maybe Int
iops :: Prelude.Maybe Prelude.Int,
EBSOptions -> Maybe VolumeType
volumeType :: Prelude.Maybe VolumeType,
EBSOptions -> Maybe Bool
eBSEnabled :: Prelude.Maybe Prelude.Bool
}
deriving (EBSOptions -> EBSOptions -> Bool
(EBSOptions -> EBSOptions -> Bool)
-> (EBSOptions -> EBSOptions -> Bool) -> Eq EBSOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EBSOptions -> EBSOptions -> Bool
$c/= :: EBSOptions -> EBSOptions -> Bool
== :: EBSOptions -> EBSOptions -> Bool
$c== :: EBSOptions -> EBSOptions -> Bool
Prelude.Eq, ReadPrec [EBSOptions]
ReadPrec EBSOptions
Int -> ReadS EBSOptions
ReadS [EBSOptions]
(Int -> ReadS EBSOptions)
-> ReadS [EBSOptions]
-> ReadPrec EBSOptions
-> ReadPrec [EBSOptions]
-> Read EBSOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EBSOptions]
$creadListPrec :: ReadPrec [EBSOptions]
readPrec :: ReadPrec EBSOptions
$creadPrec :: ReadPrec EBSOptions
readList :: ReadS [EBSOptions]
$creadList :: ReadS [EBSOptions]
readsPrec :: Int -> ReadS EBSOptions
$creadsPrec :: Int -> ReadS EBSOptions
Prelude.Read, Int -> EBSOptions -> ShowS
[EBSOptions] -> ShowS
EBSOptions -> String
(Int -> EBSOptions -> ShowS)
-> (EBSOptions -> String)
-> ([EBSOptions] -> ShowS)
-> Show EBSOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EBSOptions] -> ShowS
$cshowList :: [EBSOptions] -> ShowS
show :: EBSOptions -> String
$cshow :: EBSOptions -> String
showsPrec :: Int -> EBSOptions -> ShowS
$cshowsPrec :: Int -> EBSOptions -> ShowS
Prelude.Show, (forall x. EBSOptions -> Rep EBSOptions x)
-> (forall x. Rep EBSOptions x -> EBSOptions) -> Generic EBSOptions
forall x. Rep EBSOptions x -> EBSOptions
forall x. EBSOptions -> Rep EBSOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EBSOptions x -> EBSOptions
$cfrom :: forall x. EBSOptions -> Rep EBSOptions x
Prelude.Generic)
newEBSOptions ::
EBSOptions
newEBSOptions :: EBSOptions
newEBSOptions =
EBSOptions' :: Maybe Int
-> Maybe Int -> Maybe VolumeType -> Maybe Bool -> EBSOptions
EBSOptions'
{ $sel:volumeSize:EBSOptions' :: Maybe Int
volumeSize = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:iops:EBSOptions' :: Maybe Int
iops = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:volumeType:EBSOptions' :: Maybe VolumeType
volumeType = Maybe VolumeType
forall a. Maybe a
Prelude.Nothing,
$sel:eBSEnabled:EBSOptions' :: Maybe Bool
eBSEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
eBSOptions_volumeSize :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Int)
eBSOptions_volumeSize :: (Maybe Int -> f (Maybe Int)) -> EBSOptions -> f EBSOptions
eBSOptions_volumeSize = (EBSOptions -> Maybe Int)
-> (EBSOptions -> Maybe Int -> EBSOptions)
-> Lens EBSOptions EBSOptions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSOptions' {Maybe Int
volumeSize :: Maybe Int
$sel:volumeSize:EBSOptions' :: EBSOptions -> Maybe Int
volumeSize} -> Maybe Int
volumeSize) (\s :: EBSOptions
s@EBSOptions' {} Maybe Int
a -> EBSOptions
s {$sel:volumeSize:EBSOptions' :: Maybe Int
volumeSize = Maybe Int
a} :: EBSOptions)
eBSOptions_iops :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Int)
eBSOptions_iops :: (Maybe Int -> f (Maybe Int)) -> EBSOptions -> f EBSOptions
eBSOptions_iops = (EBSOptions -> Maybe Int)
-> (EBSOptions -> Maybe Int -> EBSOptions)
-> Lens EBSOptions EBSOptions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSOptions' {Maybe Int
iops :: Maybe Int
$sel:iops:EBSOptions' :: EBSOptions -> Maybe Int
iops} -> Maybe Int
iops) (\s :: EBSOptions
s@EBSOptions' {} Maybe Int
a -> EBSOptions
s {$sel:iops:EBSOptions' :: Maybe Int
iops = Maybe Int
a} :: EBSOptions)
eBSOptions_volumeType :: Lens.Lens' EBSOptions (Prelude.Maybe VolumeType)
eBSOptions_volumeType :: (Maybe VolumeType -> f (Maybe VolumeType))
-> EBSOptions -> f EBSOptions
eBSOptions_volumeType = (EBSOptions -> Maybe VolumeType)
-> (EBSOptions -> Maybe VolumeType -> EBSOptions)
-> Lens EBSOptions EBSOptions (Maybe VolumeType) (Maybe VolumeType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSOptions' {Maybe VolumeType
volumeType :: Maybe VolumeType
$sel:volumeType:EBSOptions' :: EBSOptions -> Maybe VolumeType
volumeType} -> Maybe VolumeType
volumeType) (\s :: EBSOptions
s@EBSOptions' {} Maybe VolumeType
a -> EBSOptions
s {$sel:volumeType:EBSOptions' :: Maybe VolumeType
volumeType = Maybe VolumeType
a} :: EBSOptions)
eBSOptions_eBSEnabled :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Bool)
eBSOptions_eBSEnabled :: (Maybe Bool -> f (Maybe Bool)) -> EBSOptions -> f EBSOptions
eBSOptions_eBSEnabled = (EBSOptions -> Maybe Bool)
-> (EBSOptions -> Maybe Bool -> EBSOptions)
-> Lens EBSOptions EBSOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSOptions' {Maybe Bool
eBSEnabled :: Maybe Bool
$sel:eBSEnabled:EBSOptions' :: EBSOptions -> Maybe Bool
eBSEnabled} -> Maybe Bool
eBSEnabled) (\s :: EBSOptions
s@EBSOptions' {} Maybe Bool
a -> EBSOptions
s {$sel:eBSEnabled:EBSOptions' :: Maybe Bool
eBSEnabled = Maybe Bool
a} :: EBSOptions)
instance Core.FromJSON EBSOptions where
parseJSON :: Value -> Parser EBSOptions
parseJSON =
String
-> (Object -> Parser EBSOptions) -> Value -> Parser EBSOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EBSOptions"
( \Object
x ->
Maybe Int
-> Maybe Int -> Maybe VolumeType -> Maybe Bool -> EBSOptions
EBSOptions'
(Maybe Int
-> Maybe Int -> Maybe VolumeType -> Maybe Bool -> EBSOptions)
-> Parser (Maybe Int)
-> Parser
(Maybe Int -> Maybe VolumeType -> Maybe Bool -> EBSOptions)
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 VolumeType -> Maybe Bool -> EBSOptions)
-> Parser (Maybe Int)
-> Parser (Maybe VolumeType -> Maybe Bool -> EBSOptions)
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
"Iops")
Parser (Maybe VolumeType -> Maybe Bool -> EBSOptions)
-> Parser (Maybe VolumeType) -> Parser (Maybe Bool -> EBSOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VolumeType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VolumeType")
Parser (Maybe Bool -> EBSOptions)
-> Parser (Maybe Bool) -> Parser EBSOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EBSEnabled")
)
instance Prelude.Hashable EBSOptions
instance Prelude.NFData EBSOptions
instance Core.ToJSON EBSOptions where
toJSON :: EBSOptions -> Value
toJSON EBSOptions' {Maybe Bool
Maybe Int
Maybe VolumeType
eBSEnabled :: Maybe Bool
volumeType :: Maybe VolumeType
iops :: Maybe Int
volumeSize :: Maybe Int
$sel:eBSEnabled:EBSOptions' :: EBSOptions -> Maybe Bool
$sel:volumeType:EBSOptions' :: EBSOptions -> Maybe VolumeType
$sel:iops:EBSOptions' :: EBSOptions -> Maybe Int
$sel:volumeSize:EBSOptions' :: EBSOptions -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"VolumeSize" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
volumeSize,
(Text
"Iops" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
iops,
(Text
"VolumeType" Text -> VolumeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VolumeType -> Pair) -> Maybe VolumeType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VolumeType
volumeType,
(Text
"EBSEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
eBSEnabled
]
)