{-# 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.OpenSearch.Types.EBSOptions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.OpenSearch.Types.EBSOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearch.Types.VolumeType
import qualified Amazonka.Prelude as Prelude

-- | Container for the parameters required to enable EBS-based storage for an
-- OpenSearch Service domain.
--
-- /See:/ 'newEBSOptions' smart constructor.
data EBSOptions = EBSOptions'
  { -- | Indicates whether EBS volumes are attached to data nodes in an
    -- OpenSearch Service domain.
    EBSOptions -> Maybe Bool
eBSEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the baseline input\/output (I\/O) performance of EBS volumes
    -- attached to data nodes. Applicable only for the @gp3@ and provisioned
    -- IOPS EBS volume types.
    EBSOptions -> Maybe Int
iops :: Prelude.Maybe Prelude.Int,
    -- | Specifies the throughput (in MiB\/s) of the EBS volumes attached to data
    -- nodes. Applicable only for the @gp3@ volume type.
    EBSOptions -> Maybe Int
throughput :: Prelude.Maybe Prelude.Int,
    -- | Specifies the size (in GiB) of EBS volumes attached to data nodes.
    EBSOptions -> Maybe Int
volumeSize :: Prelude.Maybe Prelude.Int,
    -- | Specifies the type of EBS volumes attached to data nodes.
    EBSOptions -> Maybe VolumeType
volumeType :: Prelude.Maybe VolumeType
  }
  deriving (EBSOptions -> EBSOptions -> Bool
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]
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
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. 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)

-- |
-- Create a value of 'EBSOptions' 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:
--
-- 'eBSEnabled', 'eBSOptions_eBSEnabled' - Indicates whether EBS volumes are attached to data nodes in an
-- OpenSearch Service domain.
--
-- 'iops', 'eBSOptions_iops' - Specifies the baseline input\/output (I\/O) performance of EBS volumes
-- attached to data nodes. Applicable only for the @gp3@ and provisioned
-- IOPS EBS volume types.
--
-- 'throughput', 'eBSOptions_throughput' - Specifies the throughput (in MiB\/s) of the EBS volumes attached to data
-- nodes. Applicable only for the @gp3@ volume type.
--
-- 'volumeSize', 'eBSOptions_volumeSize' - Specifies the size (in GiB) of EBS volumes attached to data nodes.
--
-- 'volumeType', 'eBSOptions_volumeType' - Specifies the type of EBS volumes attached to data nodes.
newEBSOptions ::
  EBSOptions
newEBSOptions :: EBSOptions
newEBSOptions =
  EBSOptions'
    { $sel:eBSEnabled:EBSOptions' :: Maybe Bool
eBSEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:iops:EBSOptions' :: Maybe Int
iops = forall a. Maybe a
Prelude.Nothing,
      $sel:throughput:EBSOptions' :: Maybe Int
throughput = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeSize:EBSOptions' :: Maybe Int
volumeSize = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeType:EBSOptions' :: Maybe VolumeType
volumeType = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether EBS volumes are attached to data nodes in an
-- OpenSearch Service domain.
eBSOptions_eBSEnabled :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Bool)
eBSOptions_eBSEnabled :: Lens' EBSOptions (Maybe Bool)
eBSOptions_eBSEnabled = 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)

-- | Specifies the baseline input\/output (I\/O) performance of EBS volumes
-- attached to data nodes. Applicable only for the @gp3@ and provisioned
-- IOPS EBS volume types.
eBSOptions_iops :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Int)
eBSOptions_iops :: Lens' EBSOptions (Maybe Int)
eBSOptions_iops = 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)

-- | Specifies the throughput (in MiB\/s) of the EBS volumes attached to data
-- nodes. Applicable only for the @gp3@ volume type.
eBSOptions_throughput :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Int)
eBSOptions_throughput :: Lens' EBSOptions (Maybe Int)
eBSOptions_throughput = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSOptions' {Maybe Int
throughput :: Maybe Int
$sel:throughput:EBSOptions' :: EBSOptions -> Maybe Int
throughput} -> Maybe Int
throughput) (\s :: EBSOptions
s@EBSOptions' {} Maybe Int
a -> EBSOptions
s {$sel:throughput:EBSOptions' :: Maybe Int
throughput = Maybe Int
a} :: EBSOptions)

-- | Specifies the size (in GiB) of EBS volumes attached to data nodes.
eBSOptions_volumeSize :: Lens.Lens' EBSOptions (Prelude.Maybe Prelude.Int)
eBSOptions_volumeSize :: Lens' EBSOptions (Maybe Int)
eBSOptions_volumeSize = 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)

-- | Specifies the type of EBS volumes attached to data nodes.
eBSOptions_volumeType :: Lens.Lens' EBSOptions (Prelude.Maybe VolumeType)
eBSOptions_volumeType :: Lens' EBSOptions (Maybe VolumeType)
eBSOptions_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)

instance Data.FromJSON EBSOptions where
  parseJSON :: Value -> Parser EBSOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EBSOptions"
      ( \Object
x ->
          Maybe Bool
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe VolumeType
-> EBSOptions
EBSOptions'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EBSEnabled")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Iops")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Throughput")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VolumeSize")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"VolumeType")
      )

instance Prelude.Hashable EBSOptions where
  hashWithSalt :: Int -> EBSOptions -> Int
hashWithSalt Int
_salt EBSOptions' {Maybe Bool
Maybe Int
Maybe VolumeType
volumeType :: Maybe VolumeType
volumeSize :: Maybe Int
throughput :: Maybe Int
iops :: Maybe Int
eBSEnabled :: Maybe Bool
$sel:volumeType:EBSOptions' :: EBSOptions -> Maybe VolumeType
$sel:volumeSize:EBSOptions' :: EBSOptions -> Maybe Int
$sel:throughput:EBSOptions' :: EBSOptions -> Maybe Int
$sel:iops:EBSOptions' :: EBSOptions -> Maybe Int
$sel:eBSEnabled:EBSOptions' :: EBSOptions -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
eBSEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
iops
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
throughput
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
volumeSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VolumeType
volumeType

instance Prelude.NFData EBSOptions where
  rnf :: EBSOptions -> ()
rnf EBSOptions' {Maybe Bool
Maybe Int
Maybe VolumeType
volumeType :: Maybe VolumeType
volumeSize :: Maybe Int
throughput :: Maybe Int
iops :: Maybe Int
eBSEnabled :: Maybe Bool
$sel:volumeType:EBSOptions' :: EBSOptions -> Maybe VolumeType
$sel:volumeSize:EBSOptions' :: EBSOptions -> Maybe Int
$sel:throughput:EBSOptions' :: EBSOptions -> Maybe Int
$sel:iops:EBSOptions' :: EBSOptions -> Maybe Int
$sel:eBSEnabled:EBSOptions' :: EBSOptions -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
eBSEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
iops
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
throughput
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
volumeSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VolumeType
volumeType

instance Data.ToJSON EBSOptions where
  toJSON :: EBSOptions -> Value
toJSON EBSOptions' {Maybe Bool
Maybe Int
Maybe VolumeType
volumeType :: Maybe VolumeType
volumeSize :: Maybe Int
throughput :: Maybe Int
iops :: Maybe Int
eBSEnabled :: Maybe Bool
$sel:volumeType:EBSOptions' :: EBSOptions -> Maybe VolumeType
$sel:volumeSize:EBSOptions' :: EBSOptions -> Maybe Int
$sel:throughput:EBSOptions' :: EBSOptions -> Maybe Int
$sel:iops:EBSOptions' :: EBSOptions -> Maybe Int
$sel:eBSEnabled:EBSOptions' :: EBSOptions -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EBSEnabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
eBSEnabled,
            (Key
"Iops" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
iops,
            (Key
"Throughput" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
throughput,
            (Key
"VolumeSize" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
volumeSize,
            (Key
"VolumeType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VolumeType
volumeType
          ]
      )