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

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

-- | Describes a configuration revision.
--
-- /See:/ 'newConfigurationRevision' smart constructor.
data ConfigurationRevision = ConfigurationRevision'
  { -- | The description of the configuration revision.
    ConfigurationRevision -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The revision number.
    ConfigurationRevision -> Integer
revision :: Prelude.Integer,
    -- | The time when the configuration revision was created.
    ConfigurationRevision -> POSIX
creationTime :: Core.POSIX
  }
  deriving (ConfigurationRevision -> ConfigurationRevision -> Bool
(ConfigurationRevision -> ConfigurationRevision -> Bool)
-> (ConfigurationRevision -> ConfigurationRevision -> Bool)
-> Eq ConfigurationRevision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationRevision -> ConfigurationRevision -> Bool
$c/= :: ConfigurationRevision -> ConfigurationRevision -> Bool
== :: ConfigurationRevision -> ConfigurationRevision -> Bool
$c== :: ConfigurationRevision -> ConfigurationRevision -> Bool
Prelude.Eq, ReadPrec [ConfigurationRevision]
ReadPrec ConfigurationRevision
Int -> ReadS ConfigurationRevision
ReadS [ConfigurationRevision]
(Int -> ReadS ConfigurationRevision)
-> ReadS [ConfigurationRevision]
-> ReadPrec ConfigurationRevision
-> ReadPrec [ConfigurationRevision]
-> Read ConfigurationRevision
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationRevision]
$creadListPrec :: ReadPrec [ConfigurationRevision]
readPrec :: ReadPrec ConfigurationRevision
$creadPrec :: ReadPrec ConfigurationRevision
readList :: ReadS [ConfigurationRevision]
$creadList :: ReadS [ConfigurationRevision]
readsPrec :: Int -> ReadS ConfigurationRevision
$creadsPrec :: Int -> ReadS ConfigurationRevision
Prelude.Read, Int -> ConfigurationRevision -> ShowS
[ConfigurationRevision] -> ShowS
ConfigurationRevision -> String
(Int -> ConfigurationRevision -> ShowS)
-> (ConfigurationRevision -> String)
-> ([ConfigurationRevision] -> ShowS)
-> Show ConfigurationRevision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationRevision] -> ShowS
$cshowList :: [ConfigurationRevision] -> ShowS
show :: ConfigurationRevision -> String
$cshow :: ConfigurationRevision -> String
showsPrec :: Int -> ConfigurationRevision -> ShowS
$cshowsPrec :: Int -> ConfigurationRevision -> ShowS
Prelude.Show, (forall x. ConfigurationRevision -> Rep ConfigurationRevision x)
-> (forall x. Rep ConfigurationRevision x -> ConfigurationRevision)
-> Generic ConfigurationRevision
forall x. Rep ConfigurationRevision x -> ConfigurationRevision
forall x. ConfigurationRevision -> Rep ConfigurationRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationRevision x -> ConfigurationRevision
$cfrom :: forall x. ConfigurationRevision -> Rep ConfigurationRevision x
Prelude.Generic)

-- |
-- Create a value of 'ConfigurationRevision' 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:
--
-- 'description', 'configurationRevision_description' - The description of the configuration revision.
--
-- 'revision', 'configurationRevision_revision' - The revision number.
--
-- 'creationTime', 'configurationRevision_creationTime' - The time when the configuration revision was created.
newConfigurationRevision ::
  -- | 'revision'
  Prelude.Integer ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  ConfigurationRevision
newConfigurationRevision :: Integer -> UTCTime -> ConfigurationRevision
newConfigurationRevision Integer
pRevision_ UTCTime
pCreationTime_ =
  ConfigurationRevision' :: Maybe Text -> Integer -> POSIX -> ConfigurationRevision
ConfigurationRevision'
    { $sel:description:ConfigurationRevision' :: Maybe Text
description =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revision:ConfigurationRevision' :: Integer
revision = Integer
pRevision_,
      $sel:creationTime:ConfigurationRevision' :: POSIX
creationTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_
    }

-- | The description of the configuration revision.
configurationRevision_description :: Lens.Lens' ConfigurationRevision (Prelude.Maybe Prelude.Text)
configurationRevision_description :: (Maybe Text -> f (Maybe Text))
-> ConfigurationRevision -> f ConfigurationRevision
configurationRevision_description = (ConfigurationRevision -> Maybe Text)
-> (ConfigurationRevision -> Maybe Text -> ConfigurationRevision)
-> Lens
     ConfigurationRevision
     ConfigurationRevision
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationRevision' {Maybe Text
description :: Maybe Text
$sel:description:ConfigurationRevision' :: ConfigurationRevision -> Maybe Text
description} -> Maybe Text
description) (\s :: ConfigurationRevision
s@ConfigurationRevision' {} Maybe Text
a -> ConfigurationRevision
s {$sel:description:ConfigurationRevision' :: Maybe Text
description = Maybe Text
a} :: ConfigurationRevision)

-- | The revision number.
configurationRevision_revision :: Lens.Lens' ConfigurationRevision Prelude.Integer
configurationRevision_revision :: (Integer -> f Integer)
-> ConfigurationRevision -> f ConfigurationRevision
configurationRevision_revision = (ConfigurationRevision -> Integer)
-> (ConfigurationRevision -> Integer -> ConfigurationRevision)
-> Lens ConfigurationRevision ConfigurationRevision Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationRevision' {Integer
revision :: Integer
$sel:revision:ConfigurationRevision' :: ConfigurationRevision -> Integer
revision} -> Integer
revision) (\s :: ConfigurationRevision
s@ConfigurationRevision' {} Integer
a -> ConfigurationRevision
s {$sel:revision:ConfigurationRevision' :: Integer
revision = Integer
a} :: ConfigurationRevision)

-- | The time when the configuration revision was created.
configurationRevision_creationTime :: Lens.Lens' ConfigurationRevision Prelude.UTCTime
configurationRevision_creationTime :: (UTCTime -> f UTCTime)
-> ConfigurationRevision -> f ConfigurationRevision
configurationRevision_creationTime = (ConfigurationRevision -> POSIX)
-> (ConfigurationRevision -> POSIX -> ConfigurationRevision)
-> Lens ConfigurationRevision ConfigurationRevision POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationRevision' {POSIX
creationTime :: POSIX
$sel:creationTime:ConfigurationRevision' :: ConfigurationRevision -> POSIX
creationTime} -> POSIX
creationTime) (\s :: ConfigurationRevision
s@ConfigurationRevision' {} POSIX
a -> ConfigurationRevision
s {$sel:creationTime:ConfigurationRevision' :: POSIX
creationTime = POSIX
a} :: ConfigurationRevision) ((POSIX -> f POSIX)
 -> ConfigurationRevision -> f ConfigurationRevision)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ConfigurationRevision
-> f ConfigurationRevision
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON ConfigurationRevision where
  parseJSON :: Value -> Parser ConfigurationRevision
parseJSON =
    String
-> (Object -> Parser ConfigurationRevision)
-> Value
-> Parser ConfigurationRevision
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConfigurationRevision"
      ( \Object
x ->
          Maybe Text -> Integer -> POSIX -> ConfigurationRevision
ConfigurationRevision'
            (Maybe Text -> Integer -> POSIX -> ConfigurationRevision)
-> Parser (Maybe Text)
-> Parser (Integer -> POSIX -> ConfigurationRevision)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser (Integer -> POSIX -> ConfigurationRevision)
-> Parser Integer -> Parser (POSIX -> ConfigurationRevision)
forall (f :: * -> *) a b. Applicative f => 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 (POSIX -> ConfigurationRevision)
-> Parser POSIX -> Parser ConfigurationRevision
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"creationTime")
      )

instance Prelude.Hashable ConfigurationRevision

instance Prelude.NFData ConfigurationRevision