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

import qualified Amazonka.Core as Core
import Amazonka.Kafka.Types.EBSStorageInfo
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about storage volumes attached to MSK broker nodes.
--
-- /See:/ 'newStorageInfo' smart constructor.
data StorageInfo = StorageInfo'
  { -- | EBS volume information.
    StorageInfo -> Maybe EBSStorageInfo
ebsStorageInfo :: Prelude.Maybe EBSStorageInfo
  }
  deriving (StorageInfo -> StorageInfo -> Bool
(StorageInfo -> StorageInfo -> Bool)
-> (StorageInfo -> StorageInfo -> Bool) -> Eq StorageInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StorageInfo -> StorageInfo -> Bool
$c/= :: StorageInfo -> StorageInfo -> Bool
== :: StorageInfo -> StorageInfo -> Bool
$c== :: StorageInfo -> StorageInfo -> Bool
Prelude.Eq, ReadPrec [StorageInfo]
ReadPrec StorageInfo
Int -> ReadS StorageInfo
ReadS [StorageInfo]
(Int -> ReadS StorageInfo)
-> ReadS [StorageInfo]
-> ReadPrec StorageInfo
-> ReadPrec [StorageInfo]
-> Read StorageInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StorageInfo]
$creadListPrec :: ReadPrec [StorageInfo]
readPrec :: ReadPrec StorageInfo
$creadPrec :: ReadPrec StorageInfo
readList :: ReadS [StorageInfo]
$creadList :: ReadS [StorageInfo]
readsPrec :: Int -> ReadS StorageInfo
$creadsPrec :: Int -> ReadS StorageInfo
Prelude.Read, Int -> StorageInfo -> ShowS
[StorageInfo] -> ShowS
StorageInfo -> String
(Int -> StorageInfo -> ShowS)
-> (StorageInfo -> String)
-> ([StorageInfo] -> ShowS)
-> Show StorageInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StorageInfo] -> ShowS
$cshowList :: [StorageInfo] -> ShowS
show :: StorageInfo -> String
$cshow :: StorageInfo -> String
showsPrec :: Int -> StorageInfo -> ShowS
$cshowsPrec :: Int -> StorageInfo -> ShowS
Prelude.Show, (forall x. StorageInfo -> Rep StorageInfo x)
-> (forall x. Rep StorageInfo x -> StorageInfo)
-> Generic StorageInfo
forall x. Rep StorageInfo x -> StorageInfo
forall x. StorageInfo -> Rep StorageInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StorageInfo x -> StorageInfo
$cfrom :: forall x. StorageInfo -> Rep StorageInfo x
Prelude.Generic)

-- |
-- Create a value of 'StorageInfo' 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:
--
-- 'ebsStorageInfo', 'storageInfo_ebsStorageInfo' - EBS volume information.
newStorageInfo ::
  StorageInfo
newStorageInfo :: StorageInfo
newStorageInfo =
  StorageInfo' :: Maybe EBSStorageInfo -> StorageInfo
StorageInfo' {$sel:ebsStorageInfo:StorageInfo' :: Maybe EBSStorageInfo
ebsStorageInfo = Maybe EBSStorageInfo
forall a. Maybe a
Prelude.Nothing}

-- | EBS volume information.
storageInfo_ebsStorageInfo :: Lens.Lens' StorageInfo (Prelude.Maybe EBSStorageInfo)
storageInfo_ebsStorageInfo :: (Maybe EBSStorageInfo -> f (Maybe EBSStorageInfo))
-> StorageInfo -> f StorageInfo
storageInfo_ebsStorageInfo = (StorageInfo -> Maybe EBSStorageInfo)
-> (StorageInfo -> Maybe EBSStorageInfo -> StorageInfo)
-> Lens
     StorageInfo
     StorageInfo
     (Maybe EBSStorageInfo)
     (Maybe EBSStorageInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageInfo' {Maybe EBSStorageInfo
ebsStorageInfo :: Maybe EBSStorageInfo
$sel:ebsStorageInfo:StorageInfo' :: StorageInfo -> Maybe EBSStorageInfo
ebsStorageInfo} -> Maybe EBSStorageInfo
ebsStorageInfo) (\s :: StorageInfo
s@StorageInfo' {} Maybe EBSStorageInfo
a -> StorageInfo
s {$sel:ebsStorageInfo:StorageInfo' :: Maybe EBSStorageInfo
ebsStorageInfo = Maybe EBSStorageInfo
a} :: StorageInfo)

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

instance Prelude.Hashable StorageInfo

instance Prelude.NFData StorageInfo

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