{-# 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.ElasticSearch.Types.PackageVersionHistory
-- 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.ElasticSearch.Types.PackageVersionHistory where

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

-- | Details of a package version.
--
-- /See:/ 'newPackageVersionHistory' smart constructor.
data PackageVersionHistory = PackageVersionHistory'
  { -- | Timestamp which tells creation time of the package version.
    PackageVersionHistory -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | Version of the package.
    PackageVersionHistory -> Maybe Text
packageVersion :: Prelude.Maybe Prelude.Text,
    -- | A message associated with the version.
    PackageVersionHistory -> Maybe Text
commitMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (PackageVersionHistory -> PackageVersionHistory -> Bool
(PackageVersionHistory -> PackageVersionHistory -> Bool)
-> (PackageVersionHistory -> PackageVersionHistory -> Bool)
-> Eq PackageVersionHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageVersionHistory -> PackageVersionHistory -> Bool
$c/= :: PackageVersionHistory -> PackageVersionHistory -> Bool
== :: PackageVersionHistory -> PackageVersionHistory -> Bool
$c== :: PackageVersionHistory -> PackageVersionHistory -> Bool
Prelude.Eq, ReadPrec [PackageVersionHistory]
ReadPrec PackageVersionHistory
Int -> ReadS PackageVersionHistory
ReadS [PackageVersionHistory]
(Int -> ReadS PackageVersionHistory)
-> ReadS [PackageVersionHistory]
-> ReadPrec PackageVersionHistory
-> ReadPrec [PackageVersionHistory]
-> Read PackageVersionHistory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PackageVersionHistory]
$creadListPrec :: ReadPrec [PackageVersionHistory]
readPrec :: ReadPrec PackageVersionHistory
$creadPrec :: ReadPrec PackageVersionHistory
readList :: ReadS [PackageVersionHistory]
$creadList :: ReadS [PackageVersionHistory]
readsPrec :: Int -> ReadS PackageVersionHistory
$creadsPrec :: Int -> ReadS PackageVersionHistory
Prelude.Read, Int -> PackageVersionHistory -> ShowS
[PackageVersionHistory] -> ShowS
PackageVersionHistory -> String
(Int -> PackageVersionHistory -> ShowS)
-> (PackageVersionHistory -> String)
-> ([PackageVersionHistory] -> ShowS)
-> Show PackageVersionHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageVersionHistory] -> ShowS
$cshowList :: [PackageVersionHistory] -> ShowS
show :: PackageVersionHistory -> String
$cshow :: PackageVersionHistory -> String
showsPrec :: Int -> PackageVersionHistory -> ShowS
$cshowsPrec :: Int -> PackageVersionHistory -> ShowS
Prelude.Show, (forall x. PackageVersionHistory -> Rep PackageVersionHistory x)
-> (forall x. Rep PackageVersionHistory x -> PackageVersionHistory)
-> Generic PackageVersionHistory
forall x. Rep PackageVersionHistory x -> PackageVersionHistory
forall x. PackageVersionHistory -> Rep PackageVersionHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PackageVersionHistory x -> PackageVersionHistory
$cfrom :: forall x. PackageVersionHistory -> Rep PackageVersionHistory x
Prelude.Generic)

-- |
-- Create a value of 'PackageVersionHistory' 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:
--
-- 'createdAt', 'packageVersionHistory_createdAt' - Timestamp which tells creation time of the package version.
--
-- 'packageVersion', 'packageVersionHistory_packageVersion' - Version of the package.
--
-- 'commitMessage', 'packageVersionHistory_commitMessage' - A message associated with the version.
newPackageVersionHistory ::
  PackageVersionHistory
newPackageVersionHistory :: PackageVersionHistory
newPackageVersionHistory =
  PackageVersionHistory' :: Maybe POSIX -> Maybe Text -> Maybe Text -> PackageVersionHistory
PackageVersionHistory'
    { $sel:createdAt:PackageVersionHistory' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:packageVersion:PackageVersionHistory' :: Maybe Text
packageVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:commitMessage:PackageVersionHistory' :: Maybe Text
commitMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Timestamp which tells creation time of the package version.
packageVersionHistory_createdAt :: Lens.Lens' PackageVersionHistory (Prelude.Maybe Prelude.UTCTime)
packageVersionHistory_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PackageVersionHistory -> f PackageVersionHistory
packageVersionHistory_createdAt = (PackageVersionHistory -> Maybe POSIX)
-> (PackageVersionHistory -> Maybe POSIX -> PackageVersionHistory)
-> Lens
     PackageVersionHistory
     PackageVersionHistory
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageVersionHistory' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:PackageVersionHistory' :: PackageVersionHistory -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: PackageVersionHistory
s@PackageVersionHistory' {} Maybe POSIX
a -> PackageVersionHistory
s {$sel:createdAt:PackageVersionHistory' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: PackageVersionHistory) ((Maybe POSIX -> f (Maybe POSIX))
 -> PackageVersionHistory -> f PackageVersionHistory)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PackageVersionHistory
-> f PackageVersionHistory
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Version of the package.
packageVersionHistory_packageVersion :: Lens.Lens' PackageVersionHistory (Prelude.Maybe Prelude.Text)
packageVersionHistory_packageVersion :: (Maybe Text -> f (Maybe Text))
-> PackageVersionHistory -> f PackageVersionHistory
packageVersionHistory_packageVersion = (PackageVersionHistory -> Maybe Text)
-> (PackageVersionHistory -> Maybe Text -> PackageVersionHistory)
-> Lens
     PackageVersionHistory
     PackageVersionHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageVersionHistory' {Maybe Text
packageVersion :: Maybe Text
$sel:packageVersion:PackageVersionHistory' :: PackageVersionHistory -> Maybe Text
packageVersion} -> Maybe Text
packageVersion) (\s :: PackageVersionHistory
s@PackageVersionHistory' {} Maybe Text
a -> PackageVersionHistory
s {$sel:packageVersion:PackageVersionHistory' :: Maybe Text
packageVersion = Maybe Text
a} :: PackageVersionHistory)

-- | A message associated with the version.
packageVersionHistory_commitMessage :: Lens.Lens' PackageVersionHistory (Prelude.Maybe Prelude.Text)
packageVersionHistory_commitMessage :: (Maybe Text -> f (Maybe Text))
-> PackageVersionHistory -> f PackageVersionHistory
packageVersionHistory_commitMessage = (PackageVersionHistory -> Maybe Text)
-> (PackageVersionHistory -> Maybe Text -> PackageVersionHistory)
-> Lens
     PackageVersionHistory
     PackageVersionHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageVersionHistory' {Maybe Text
commitMessage :: Maybe Text
$sel:commitMessage:PackageVersionHistory' :: PackageVersionHistory -> Maybe Text
commitMessage} -> Maybe Text
commitMessage) (\s :: PackageVersionHistory
s@PackageVersionHistory' {} Maybe Text
a -> PackageVersionHistory
s {$sel:commitMessage:PackageVersionHistory' :: Maybe Text
commitMessage = Maybe Text
a} :: PackageVersionHistory)

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

instance Prelude.Hashable PackageVersionHistory

instance Prelude.NFData PackageVersionHistory