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

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

-- | Specifies the EBS volume upgrade information. The broker identifier must
-- be set to the keyword ALL. This means the changes apply to all the
-- brokers in the cluster.
--
-- /See:/ 'newBrokerEBSVolumeInfo' smart constructor.
data BrokerEBSVolumeInfo = BrokerEBSVolumeInfo'
  { -- | Size of the EBS volume to update.
    BrokerEBSVolumeInfo -> Int
volumeSizeGB :: Prelude.Int,
    -- | The ID of the broker to update.
    BrokerEBSVolumeInfo -> Text
kafkaBrokerNodeId :: Prelude.Text
  }
  deriving (BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool
(BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool)
-> (BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool)
-> Eq BrokerEBSVolumeInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool
$c/= :: BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool
== :: BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool
$c== :: BrokerEBSVolumeInfo -> BrokerEBSVolumeInfo -> Bool
Prelude.Eq, ReadPrec [BrokerEBSVolumeInfo]
ReadPrec BrokerEBSVolumeInfo
Int -> ReadS BrokerEBSVolumeInfo
ReadS [BrokerEBSVolumeInfo]
(Int -> ReadS BrokerEBSVolumeInfo)
-> ReadS [BrokerEBSVolumeInfo]
-> ReadPrec BrokerEBSVolumeInfo
-> ReadPrec [BrokerEBSVolumeInfo]
-> Read BrokerEBSVolumeInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BrokerEBSVolumeInfo]
$creadListPrec :: ReadPrec [BrokerEBSVolumeInfo]
readPrec :: ReadPrec BrokerEBSVolumeInfo
$creadPrec :: ReadPrec BrokerEBSVolumeInfo
readList :: ReadS [BrokerEBSVolumeInfo]
$creadList :: ReadS [BrokerEBSVolumeInfo]
readsPrec :: Int -> ReadS BrokerEBSVolumeInfo
$creadsPrec :: Int -> ReadS BrokerEBSVolumeInfo
Prelude.Read, Int -> BrokerEBSVolumeInfo -> ShowS
[BrokerEBSVolumeInfo] -> ShowS
BrokerEBSVolumeInfo -> String
(Int -> BrokerEBSVolumeInfo -> ShowS)
-> (BrokerEBSVolumeInfo -> String)
-> ([BrokerEBSVolumeInfo] -> ShowS)
-> Show BrokerEBSVolumeInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BrokerEBSVolumeInfo] -> ShowS
$cshowList :: [BrokerEBSVolumeInfo] -> ShowS
show :: BrokerEBSVolumeInfo -> String
$cshow :: BrokerEBSVolumeInfo -> String
showsPrec :: Int -> BrokerEBSVolumeInfo -> ShowS
$cshowsPrec :: Int -> BrokerEBSVolumeInfo -> ShowS
Prelude.Show, (forall x. BrokerEBSVolumeInfo -> Rep BrokerEBSVolumeInfo x)
-> (forall x. Rep BrokerEBSVolumeInfo x -> BrokerEBSVolumeInfo)
-> Generic BrokerEBSVolumeInfo
forall x. Rep BrokerEBSVolumeInfo x -> BrokerEBSVolumeInfo
forall x. BrokerEBSVolumeInfo -> Rep BrokerEBSVolumeInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BrokerEBSVolumeInfo x -> BrokerEBSVolumeInfo
$cfrom :: forall x. BrokerEBSVolumeInfo -> Rep BrokerEBSVolumeInfo x
Prelude.Generic)

-- |
-- Create a value of 'BrokerEBSVolumeInfo' 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:
--
-- 'volumeSizeGB', 'brokerEBSVolumeInfo_volumeSizeGB' - Size of the EBS volume to update.
--
-- 'kafkaBrokerNodeId', 'brokerEBSVolumeInfo_kafkaBrokerNodeId' - The ID of the broker to update.
newBrokerEBSVolumeInfo ::
  -- | 'volumeSizeGB'
  Prelude.Int ->
  -- | 'kafkaBrokerNodeId'
  Prelude.Text ->
  BrokerEBSVolumeInfo
newBrokerEBSVolumeInfo :: Int -> Text -> BrokerEBSVolumeInfo
newBrokerEBSVolumeInfo
  Int
pVolumeSizeGB_
  Text
pKafkaBrokerNodeId_ =
    BrokerEBSVolumeInfo' :: Int -> Text -> BrokerEBSVolumeInfo
BrokerEBSVolumeInfo'
      { $sel:volumeSizeGB:BrokerEBSVolumeInfo' :: Int
volumeSizeGB = Int
pVolumeSizeGB_,
        $sel:kafkaBrokerNodeId:BrokerEBSVolumeInfo' :: Text
kafkaBrokerNodeId = Text
pKafkaBrokerNodeId_
      }

-- | Size of the EBS volume to update.
brokerEBSVolumeInfo_volumeSizeGB :: Lens.Lens' BrokerEBSVolumeInfo Prelude.Int
brokerEBSVolumeInfo_volumeSizeGB :: (Int -> f Int) -> BrokerEBSVolumeInfo -> f BrokerEBSVolumeInfo
brokerEBSVolumeInfo_volumeSizeGB = (BrokerEBSVolumeInfo -> Int)
-> (BrokerEBSVolumeInfo -> Int -> BrokerEBSVolumeInfo)
-> Lens BrokerEBSVolumeInfo BrokerEBSVolumeInfo Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerEBSVolumeInfo' {Int
volumeSizeGB :: Int
$sel:volumeSizeGB:BrokerEBSVolumeInfo' :: BrokerEBSVolumeInfo -> Int
volumeSizeGB} -> Int
volumeSizeGB) (\s :: BrokerEBSVolumeInfo
s@BrokerEBSVolumeInfo' {} Int
a -> BrokerEBSVolumeInfo
s {$sel:volumeSizeGB:BrokerEBSVolumeInfo' :: Int
volumeSizeGB = Int
a} :: BrokerEBSVolumeInfo)

-- | The ID of the broker to update.
brokerEBSVolumeInfo_kafkaBrokerNodeId :: Lens.Lens' BrokerEBSVolumeInfo Prelude.Text
brokerEBSVolumeInfo_kafkaBrokerNodeId :: (Text -> f Text) -> BrokerEBSVolumeInfo -> f BrokerEBSVolumeInfo
brokerEBSVolumeInfo_kafkaBrokerNodeId = (BrokerEBSVolumeInfo -> Text)
-> (BrokerEBSVolumeInfo -> Text -> BrokerEBSVolumeInfo)
-> Lens BrokerEBSVolumeInfo BrokerEBSVolumeInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrokerEBSVolumeInfo' {Text
kafkaBrokerNodeId :: Text
$sel:kafkaBrokerNodeId:BrokerEBSVolumeInfo' :: BrokerEBSVolumeInfo -> Text
kafkaBrokerNodeId} -> Text
kafkaBrokerNodeId) (\s :: BrokerEBSVolumeInfo
s@BrokerEBSVolumeInfo' {} Text
a -> BrokerEBSVolumeInfo
s {$sel:kafkaBrokerNodeId:BrokerEBSVolumeInfo' :: Text
kafkaBrokerNodeId = Text
a} :: BrokerEBSVolumeInfo)

instance Core.FromJSON BrokerEBSVolumeInfo where
  parseJSON :: Value -> Parser BrokerEBSVolumeInfo
parseJSON =
    String
-> (Object -> Parser BrokerEBSVolumeInfo)
-> Value
-> Parser BrokerEBSVolumeInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BrokerEBSVolumeInfo"
      ( \Object
x ->
          Int -> Text -> BrokerEBSVolumeInfo
BrokerEBSVolumeInfo'
            (Int -> Text -> BrokerEBSVolumeInfo)
-> Parser Int -> Parser (Text -> BrokerEBSVolumeInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"volumeSizeGB")
            Parser (Text -> BrokerEBSVolumeInfo)
-> Parser Text -> Parser BrokerEBSVolumeInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"kafkaBrokerNodeId")
      )

instance Prelude.Hashable BrokerEBSVolumeInfo

instance Prelude.NFData BrokerEBSVolumeInfo

instance Core.ToJSON BrokerEBSVolumeInfo where
  toJSON :: BrokerEBSVolumeInfo -> Value
toJSON BrokerEBSVolumeInfo' {Int
Text
kafkaBrokerNodeId :: Text
volumeSizeGB :: Int
$sel:kafkaBrokerNodeId:BrokerEBSVolumeInfo' :: BrokerEBSVolumeInfo -> Text
$sel:volumeSizeGB:BrokerEBSVolumeInfo' :: BrokerEBSVolumeInfo -> Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"volumeSizeGB" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
volumeSizeGB),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"kafkaBrokerNodeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
kafkaBrokerNodeId)
          ]
      )