{-# 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.CodePipeline.Types.CurrentRevision
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CodePipeline.Types.CurrentRevision where

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

-- | Represents information about a current revision.
--
-- /See:/ 'newCurrentRevision' smart constructor.
data CurrentRevision = CurrentRevision'
  { -- | The date and time when the most recent revision of the artifact was
    -- created, in timestamp format.
    CurrentRevision -> Maybe POSIX
created :: Prelude.Maybe Data.POSIX,
    -- | The summary of the most recent revision of the artifact.
    CurrentRevision -> Maybe Text
revisionSummary :: Prelude.Maybe Prelude.Text,
    -- | The revision ID of the current version of an artifact.
    CurrentRevision -> Text
revision :: Prelude.Text,
    -- | The change identifier for the current revision.
    CurrentRevision -> Text
changeIdentifier :: Prelude.Text
  }
  deriving (CurrentRevision -> CurrentRevision -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CurrentRevision -> CurrentRevision -> Bool
$c/= :: CurrentRevision -> CurrentRevision -> Bool
== :: CurrentRevision -> CurrentRevision -> Bool
$c== :: CurrentRevision -> CurrentRevision -> Bool
Prelude.Eq, ReadPrec [CurrentRevision]
ReadPrec CurrentRevision
Int -> ReadS CurrentRevision
ReadS [CurrentRevision]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CurrentRevision]
$creadListPrec :: ReadPrec [CurrentRevision]
readPrec :: ReadPrec CurrentRevision
$creadPrec :: ReadPrec CurrentRevision
readList :: ReadS [CurrentRevision]
$creadList :: ReadS [CurrentRevision]
readsPrec :: Int -> ReadS CurrentRevision
$creadsPrec :: Int -> ReadS CurrentRevision
Prelude.Read, Int -> CurrentRevision -> ShowS
[CurrentRevision] -> ShowS
CurrentRevision -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CurrentRevision] -> ShowS
$cshowList :: [CurrentRevision] -> ShowS
show :: CurrentRevision -> String
$cshow :: CurrentRevision -> String
showsPrec :: Int -> CurrentRevision -> ShowS
$cshowsPrec :: Int -> CurrentRevision -> ShowS
Prelude.Show, forall x. Rep CurrentRevision x -> CurrentRevision
forall x. CurrentRevision -> Rep CurrentRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CurrentRevision x -> CurrentRevision
$cfrom :: forall x. CurrentRevision -> Rep CurrentRevision x
Prelude.Generic)

-- |
-- Create a value of 'CurrentRevision' 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:
--
-- 'created', 'currentRevision_created' - The date and time when the most recent revision of the artifact was
-- created, in timestamp format.
--
-- 'revisionSummary', 'currentRevision_revisionSummary' - The summary of the most recent revision of the artifact.
--
-- 'revision', 'currentRevision_revision' - The revision ID of the current version of an artifact.
--
-- 'changeIdentifier', 'currentRevision_changeIdentifier' - The change identifier for the current revision.
newCurrentRevision ::
  -- | 'revision'
  Prelude.Text ->
  -- | 'changeIdentifier'
  Prelude.Text ->
  CurrentRevision
newCurrentRevision :: Text -> Text -> CurrentRevision
newCurrentRevision Text
pRevision_ Text
pChangeIdentifier_ =
  CurrentRevision'
    { $sel:created:CurrentRevision' :: Maybe POSIX
created = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionSummary:CurrentRevision' :: Maybe Text
revisionSummary = forall a. Maybe a
Prelude.Nothing,
      $sel:revision:CurrentRevision' :: Text
revision = Text
pRevision_,
      $sel:changeIdentifier:CurrentRevision' :: Text
changeIdentifier = Text
pChangeIdentifier_
    }

-- | The date and time when the most recent revision of the artifact was
-- created, in timestamp format.
currentRevision_created :: Lens.Lens' CurrentRevision (Prelude.Maybe Prelude.UTCTime)
currentRevision_created :: Lens' CurrentRevision (Maybe UTCTime)
currentRevision_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CurrentRevision' {Maybe POSIX
created :: Maybe POSIX
$sel:created:CurrentRevision' :: CurrentRevision -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: CurrentRevision
s@CurrentRevision' {} Maybe POSIX
a -> CurrentRevision
s {$sel:created:CurrentRevision' :: Maybe POSIX
created = Maybe POSIX
a} :: CurrentRevision) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The summary of the most recent revision of the artifact.
currentRevision_revisionSummary :: Lens.Lens' CurrentRevision (Prelude.Maybe Prelude.Text)
currentRevision_revisionSummary :: Lens' CurrentRevision (Maybe Text)
currentRevision_revisionSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CurrentRevision' {Maybe Text
revisionSummary :: Maybe Text
$sel:revisionSummary:CurrentRevision' :: CurrentRevision -> Maybe Text
revisionSummary} -> Maybe Text
revisionSummary) (\s :: CurrentRevision
s@CurrentRevision' {} Maybe Text
a -> CurrentRevision
s {$sel:revisionSummary:CurrentRevision' :: Maybe Text
revisionSummary = Maybe Text
a} :: CurrentRevision)

-- | The revision ID of the current version of an artifact.
currentRevision_revision :: Lens.Lens' CurrentRevision Prelude.Text
currentRevision_revision :: Lens' CurrentRevision Text
currentRevision_revision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CurrentRevision' {Text
revision :: Text
$sel:revision:CurrentRevision' :: CurrentRevision -> Text
revision} -> Text
revision) (\s :: CurrentRevision
s@CurrentRevision' {} Text
a -> CurrentRevision
s {$sel:revision:CurrentRevision' :: Text
revision = Text
a} :: CurrentRevision)

-- | The change identifier for the current revision.
currentRevision_changeIdentifier :: Lens.Lens' CurrentRevision Prelude.Text
currentRevision_changeIdentifier :: Lens' CurrentRevision Text
currentRevision_changeIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CurrentRevision' {Text
changeIdentifier :: Text
$sel:changeIdentifier:CurrentRevision' :: CurrentRevision -> Text
changeIdentifier} -> Text
changeIdentifier) (\s :: CurrentRevision
s@CurrentRevision' {} Text
a -> CurrentRevision
s {$sel:changeIdentifier:CurrentRevision' :: Text
changeIdentifier = Text
a} :: CurrentRevision)

instance Prelude.Hashable CurrentRevision where
  hashWithSalt :: Int -> CurrentRevision -> Int
hashWithSalt Int
_salt CurrentRevision' {Maybe Text
Maybe POSIX
Text
changeIdentifier :: Text
revision :: Text
revisionSummary :: Maybe Text
created :: Maybe POSIX
$sel:changeIdentifier:CurrentRevision' :: CurrentRevision -> Text
$sel:revision:CurrentRevision' :: CurrentRevision -> Text
$sel:revisionSummary:CurrentRevision' :: CurrentRevision -> Maybe Text
$sel:created:CurrentRevision' :: CurrentRevision -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
created
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
revision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
changeIdentifier

instance Prelude.NFData CurrentRevision where
  rnf :: CurrentRevision -> ()
rnf CurrentRevision' {Maybe Text
Maybe POSIX
Text
changeIdentifier :: Text
revision :: Text
revisionSummary :: Maybe Text
created :: Maybe POSIX
$sel:changeIdentifier:CurrentRevision' :: CurrentRevision -> Text
$sel:revision:CurrentRevision' :: CurrentRevision -> Text
$sel:revisionSummary:CurrentRevision' :: CurrentRevision -> Maybe Text
$sel:created:CurrentRevision' :: CurrentRevision -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
created
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
revision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
changeIdentifier

instance Data.ToJSON CurrentRevision where
  toJSON :: CurrentRevision -> Value
toJSON CurrentRevision' {Maybe Text
Maybe POSIX
Text
changeIdentifier :: Text
revision :: Text
revisionSummary :: Maybe Text
created :: Maybe POSIX
$sel:changeIdentifier:CurrentRevision' :: CurrentRevision -> Text
$sel:revision:CurrentRevision' :: CurrentRevision -> Text
$sel:revisionSummary:CurrentRevision' :: CurrentRevision -> Maybe Text
$sel:created:CurrentRevision' :: CurrentRevision -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"created" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
created,
            (Key
"revisionSummary" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
revisionSummary,
            forall a. a -> Maybe a
Prelude.Just (Key
"revision" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
revision),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"changeIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
changeIdentifier)
          ]
      )