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

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

-- | Specifies the configuration to use for the brokers.
--
-- /See:/ 'newConfigurationInfo' smart constructor.
data ConfigurationInfo = ConfigurationInfo'
  { -- | The revision of the configuration to use.
    ConfigurationInfo -> Integer
revision :: Prelude.Integer,
    -- | ARN of the configuration to use.
    ConfigurationInfo -> Text
arn :: Prelude.Text
  }
  deriving (ConfigurationInfo -> ConfigurationInfo -> Bool
(ConfigurationInfo -> ConfigurationInfo -> Bool)
-> (ConfigurationInfo -> ConfigurationInfo -> Bool)
-> Eq ConfigurationInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationInfo -> ConfigurationInfo -> Bool
$c/= :: ConfigurationInfo -> ConfigurationInfo -> Bool
== :: ConfigurationInfo -> ConfigurationInfo -> Bool
$c== :: ConfigurationInfo -> ConfigurationInfo -> Bool
Prelude.Eq, ReadPrec [ConfigurationInfo]
ReadPrec ConfigurationInfo
Int -> ReadS ConfigurationInfo
ReadS [ConfigurationInfo]
(Int -> ReadS ConfigurationInfo)
-> ReadS [ConfigurationInfo]
-> ReadPrec ConfigurationInfo
-> ReadPrec [ConfigurationInfo]
-> Read ConfigurationInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationInfo]
$creadListPrec :: ReadPrec [ConfigurationInfo]
readPrec :: ReadPrec ConfigurationInfo
$creadPrec :: ReadPrec ConfigurationInfo
readList :: ReadS [ConfigurationInfo]
$creadList :: ReadS [ConfigurationInfo]
readsPrec :: Int -> ReadS ConfigurationInfo
$creadsPrec :: Int -> ReadS ConfigurationInfo
Prelude.Read, Int -> ConfigurationInfo -> ShowS
[ConfigurationInfo] -> ShowS
ConfigurationInfo -> String
(Int -> ConfigurationInfo -> ShowS)
-> (ConfigurationInfo -> String)
-> ([ConfigurationInfo] -> ShowS)
-> Show ConfigurationInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationInfo] -> ShowS
$cshowList :: [ConfigurationInfo] -> ShowS
show :: ConfigurationInfo -> String
$cshow :: ConfigurationInfo -> String
showsPrec :: Int -> ConfigurationInfo -> ShowS
$cshowsPrec :: Int -> ConfigurationInfo -> ShowS
Prelude.Show, (forall x. ConfigurationInfo -> Rep ConfigurationInfo x)
-> (forall x. Rep ConfigurationInfo x -> ConfigurationInfo)
-> Generic ConfigurationInfo
forall x. Rep ConfigurationInfo x -> ConfigurationInfo
forall x. ConfigurationInfo -> Rep ConfigurationInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationInfo x -> ConfigurationInfo
$cfrom :: forall x. ConfigurationInfo -> Rep ConfigurationInfo x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationInfo' 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:
--
-- 'revision', 'configurationInfo_revision' - The revision of the configuration to use.
--
-- 'arn', 'configurationInfo_arn' - ARN of the configuration to use.
newConfigurationInfo ::
  -- | 'revision'
  Prelude.Integer ->
  -- | 'arn'
  Prelude.Text ->
  ConfigurationInfo
newConfigurationInfo :: Integer -> Text -> ConfigurationInfo
newConfigurationInfo Integer
pRevision_ Text
pArn_ =
  ConfigurationInfo' :: Integer -> Text -> ConfigurationInfo
ConfigurationInfo'
    { $sel:revision:ConfigurationInfo' :: Integer
revision = Integer
pRevision_,
      $sel:arn:ConfigurationInfo' :: Text
arn = Text
pArn_
    }

-- | The revision of the configuration to use.
configurationInfo_revision :: Lens.Lens' ConfigurationInfo Prelude.Integer
configurationInfo_revision :: (Integer -> f Integer) -> ConfigurationInfo -> f ConfigurationInfo
configurationInfo_revision = (ConfigurationInfo -> Integer)
-> (ConfigurationInfo -> Integer -> ConfigurationInfo)
-> Lens ConfigurationInfo ConfigurationInfo Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationInfo' {Integer
revision :: Integer
$sel:revision:ConfigurationInfo' :: ConfigurationInfo -> Integer
revision} -> Integer
revision) (\s :: ConfigurationInfo
s@ConfigurationInfo' {} Integer
a -> ConfigurationInfo
s {$sel:revision:ConfigurationInfo' :: Integer
revision = Integer
a} :: ConfigurationInfo)

-- | ARN of the configuration to use.
configurationInfo_arn :: Lens.Lens' ConfigurationInfo Prelude.Text
configurationInfo_arn :: (Text -> f Text) -> ConfigurationInfo -> f ConfigurationInfo
configurationInfo_arn = (ConfigurationInfo -> Text)
-> (ConfigurationInfo -> Text -> ConfigurationInfo)
-> Lens ConfigurationInfo ConfigurationInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationInfo' {Text
arn :: Text
$sel:arn:ConfigurationInfo' :: ConfigurationInfo -> Text
arn} -> Text
arn) (\s :: ConfigurationInfo
s@ConfigurationInfo' {} Text
a -> ConfigurationInfo
s {$sel:arn:ConfigurationInfo' :: Text
arn = Text
a} :: ConfigurationInfo)

instance Core.FromJSON ConfigurationInfo where
  parseJSON :: Value -> Parser ConfigurationInfo
parseJSON =
    String
-> (Object -> Parser ConfigurationInfo)
-> Value
-> Parser ConfigurationInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConfigurationInfo"
      ( \Object
x ->
          Integer -> Text -> ConfigurationInfo
ConfigurationInfo'
            (Integer -> Text -> ConfigurationInfo)
-> Parser Integer -> Parser (Text -> ConfigurationInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Integer
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"revision") Parser (Text -> ConfigurationInfo)
-> Parser Text -> Parser ConfigurationInfo
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
"arn")
      )

instance Prelude.Hashable ConfigurationInfo

instance Prelude.NFData ConfigurationInfo

instance Core.ToJSON ConfigurationInfo where
  toJSON :: ConfigurationInfo -> Value
toJSON ConfigurationInfo' {Integer
Text
arn :: Text
revision :: Integer
$sel:arn:ConfigurationInfo' :: ConfigurationInfo -> Text
$sel:revision:ConfigurationInfo' :: ConfigurationInfo -> Integer
..} =
    [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
"revision" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
revision),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)
          ]
      )