{-# 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.Kafka.Types.EBSStorageInfo
-- 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.Kafka.Types.EBSStorageInfo where

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

-- | Contains information about the EBS storage volumes attached to Kafka
-- broker nodes.
--
-- /See:/ 'newEBSStorageInfo' smart constructor.
data EBSStorageInfo = EBSStorageInfo'
  { -- | The size in GiB of the EBS volume for the data drive on each broker
    -- node.
    EBSStorageInfo -> Maybe Natural
volumeSize :: Prelude.Maybe Prelude.Natural
  }
  deriving (EBSStorageInfo -> EBSStorageInfo -> Bool
(EBSStorageInfo -> EBSStorageInfo -> Bool)
-> (EBSStorageInfo -> EBSStorageInfo -> Bool) -> Eq EBSStorageInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EBSStorageInfo -> EBSStorageInfo -> Bool
$c/= :: EBSStorageInfo -> EBSStorageInfo -> Bool
== :: EBSStorageInfo -> EBSStorageInfo -> Bool
$c== :: EBSStorageInfo -> EBSStorageInfo -> Bool
Prelude.Eq, ReadPrec [EBSStorageInfo]
ReadPrec EBSStorageInfo
Int -> ReadS EBSStorageInfo
ReadS [EBSStorageInfo]
(Int -> ReadS EBSStorageInfo)
-> ReadS [EBSStorageInfo]
-> ReadPrec EBSStorageInfo
-> ReadPrec [EBSStorageInfo]
-> Read EBSStorageInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EBSStorageInfo]
$creadListPrec :: ReadPrec [EBSStorageInfo]
readPrec :: ReadPrec EBSStorageInfo
$creadPrec :: ReadPrec EBSStorageInfo
readList :: ReadS [EBSStorageInfo]
$creadList :: ReadS [EBSStorageInfo]
readsPrec :: Int -> ReadS EBSStorageInfo
$creadsPrec :: Int -> ReadS EBSStorageInfo
Prelude.Read, Int -> EBSStorageInfo -> ShowS
[EBSStorageInfo] -> ShowS
EBSStorageInfo -> String
(Int -> EBSStorageInfo -> ShowS)
-> (EBSStorageInfo -> String)
-> ([EBSStorageInfo] -> ShowS)
-> Show EBSStorageInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EBSStorageInfo] -> ShowS
$cshowList :: [EBSStorageInfo] -> ShowS
show :: EBSStorageInfo -> String
$cshow :: EBSStorageInfo -> String
showsPrec :: Int -> EBSStorageInfo -> ShowS
$cshowsPrec :: Int -> EBSStorageInfo -> ShowS
Prelude.Show, (forall x. EBSStorageInfo -> Rep EBSStorageInfo x)
-> (forall x. Rep EBSStorageInfo x -> EBSStorageInfo)
-> Generic EBSStorageInfo
forall x. Rep EBSStorageInfo x -> EBSStorageInfo
forall x. EBSStorageInfo -> Rep EBSStorageInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EBSStorageInfo x -> EBSStorageInfo
$cfrom :: forall x. EBSStorageInfo -> Rep EBSStorageInfo x
Prelude.Generic)

-- |
-- Create a value of 'EBSStorageInfo' 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:
--
-- 'volumeSize', 'eBSStorageInfo_volumeSize' - The size in GiB of the EBS volume for the data drive on each broker
-- node.
newEBSStorageInfo ::
  EBSStorageInfo
newEBSStorageInfo :: EBSStorageInfo
newEBSStorageInfo =
  EBSStorageInfo' :: Maybe Natural -> EBSStorageInfo
EBSStorageInfo' {$sel:volumeSize:EBSStorageInfo' :: Maybe Natural
volumeSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing}

-- | The size in GiB of the EBS volume for the data drive on each broker
-- node.
eBSStorageInfo_volumeSize :: Lens.Lens' EBSStorageInfo (Prelude.Maybe Prelude.Natural)
eBSStorageInfo_volumeSize :: (Maybe Natural -> f (Maybe Natural))
-> EBSStorageInfo -> f EBSStorageInfo
eBSStorageInfo_volumeSize = (EBSStorageInfo -> Maybe Natural)
-> (EBSStorageInfo -> Maybe Natural -> EBSStorageInfo)
-> Lens
     EBSStorageInfo EBSStorageInfo (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSStorageInfo' {Maybe Natural
volumeSize :: Maybe Natural
$sel:volumeSize:EBSStorageInfo' :: EBSStorageInfo -> Maybe Natural
volumeSize} -> Maybe Natural
volumeSize) (\s :: EBSStorageInfo
s@EBSStorageInfo' {} Maybe Natural
a -> EBSStorageInfo
s {$sel:volumeSize:EBSStorageInfo' :: Maybe Natural
volumeSize = Maybe Natural
a} :: EBSStorageInfo)

instance Core.FromJSON EBSStorageInfo where
  parseJSON :: Value -> Parser EBSStorageInfo
parseJSON =
    String
-> (Object -> Parser EBSStorageInfo)
-> Value
-> Parser EBSStorageInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EBSStorageInfo"
      ( \Object
x ->
          Maybe Natural -> EBSStorageInfo
EBSStorageInfo'
            (Maybe Natural -> EBSStorageInfo)
-> Parser (Maybe Natural) -> Parser EBSStorageInfo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"volumeSize")
      )

instance Prelude.Hashable EBSStorageInfo

instance Prelude.NFData EBSStorageInfo

instance Core.ToJSON EBSStorageInfo where
  toJSON :: EBSStorageInfo -> Value
toJSON EBSStorageInfo' {Maybe Natural
volumeSize :: Maybe Natural
$sel:volumeSize:EBSStorageInfo' :: EBSStorageInfo -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"volumeSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
volumeSize]
      )