{-# 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.ArtifactRevision
-- 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.ArtifactRevision 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 revision details of an artifact.
--
-- /See:/ 'newArtifactRevision' smart constructor.
data ArtifactRevision = ArtifactRevision'
  { -- | The date and time when the most recent revision of the artifact was
    -- created, in timestamp format.
    ArtifactRevision -> Maybe POSIX
created :: Prelude.Maybe Data.POSIX,
    -- | The name of an artifact. This name might be system-generated, such as
    -- \"MyApp\", or defined by the user when an action is created.
    ArtifactRevision -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | An additional identifier for a revision, such as a commit date or, for
    -- artifacts stored in Amazon S3 buckets, the ETag value.
    ArtifactRevision -> Maybe Text
revisionChangeIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The revision ID of the artifact.
    ArtifactRevision -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
    -- | Summary information about the most recent revision of the artifact. For
    -- GitHub and AWS CodeCommit repositories, the commit message. For Amazon
    -- S3 buckets or actions, the user-provided content of a
    -- @codepipeline-artifact-revision-summary@ key specified in the object
    -- metadata.
    ArtifactRevision -> Maybe Text
revisionSummary :: Prelude.Maybe Prelude.Text,
    -- | The commit ID for the artifact revision. For artifacts stored in GitHub
    -- or AWS CodeCommit repositories, the commit ID is linked to a commit
    -- details page.
    ArtifactRevision -> Maybe Text
revisionUrl :: Prelude.Maybe Prelude.Text
  }
  deriving (ArtifactRevision -> ArtifactRevision -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArtifactRevision -> ArtifactRevision -> Bool
$c/= :: ArtifactRevision -> ArtifactRevision -> Bool
== :: ArtifactRevision -> ArtifactRevision -> Bool
$c== :: ArtifactRevision -> ArtifactRevision -> Bool
Prelude.Eq, ReadPrec [ArtifactRevision]
ReadPrec ArtifactRevision
Int -> ReadS ArtifactRevision
ReadS [ArtifactRevision]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArtifactRevision]
$creadListPrec :: ReadPrec [ArtifactRevision]
readPrec :: ReadPrec ArtifactRevision
$creadPrec :: ReadPrec ArtifactRevision
readList :: ReadS [ArtifactRevision]
$creadList :: ReadS [ArtifactRevision]
readsPrec :: Int -> ReadS ArtifactRevision
$creadsPrec :: Int -> ReadS ArtifactRevision
Prelude.Read, Int -> ArtifactRevision -> ShowS
[ArtifactRevision] -> ShowS
ArtifactRevision -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArtifactRevision] -> ShowS
$cshowList :: [ArtifactRevision] -> ShowS
show :: ArtifactRevision -> String
$cshow :: ArtifactRevision -> String
showsPrec :: Int -> ArtifactRevision -> ShowS
$cshowsPrec :: Int -> ArtifactRevision -> ShowS
Prelude.Show, forall x. Rep ArtifactRevision x -> ArtifactRevision
forall x. ArtifactRevision -> Rep ArtifactRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArtifactRevision x -> ArtifactRevision
$cfrom :: forall x. ArtifactRevision -> Rep ArtifactRevision x
Prelude.Generic)

-- |
-- Create a value of 'ArtifactRevision' 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', 'artifactRevision_created' - The date and time when the most recent revision of the artifact was
-- created, in timestamp format.
--
-- 'name', 'artifactRevision_name' - The name of an artifact. This name might be system-generated, such as
-- \"MyApp\", or defined by the user when an action is created.
--
-- 'revisionChangeIdentifier', 'artifactRevision_revisionChangeIdentifier' - An additional identifier for a revision, such as a commit date or, for
-- artifacts stored in Amazon S3 buckets, the ETag value.
--
-- 'revisionId', 'artifactRevision_revisionId' - The revision ID of the artifact.
--
-- 'revisionSummary', 'artifactRevision_revisionSummary' - Summary information about the most recent revision of the artifact. For
-- GitHub and AWS CodeCommit repositories, the commit message. For Amazon
-- S3 buckets or actions, the user-provided content of a
-- @codepipeline-artifact-revision-summary@ key specified in the object
-- metadata.
--
-- 'revisionUrl', 'artifactRevision_revisionUrl' - The commit ID for the artifact revision. For artifacts stored in GitHub
-- or AWS CodeCommit repositories, the commit ID is linked to a commit
-- details page.
newArtifactRevision ::
  ArtifactRevision
newArtifactRevision :: ArtifactRevision
newArtifactRevision =
  ArtifactRevision'
    { $sel:created:ArtifactRevision' :: Maybe POSIX
created = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ArtifactRevision' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionChangeIdentifier:ArtifactRevision' :: Maybe Text
revisionChangeIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:ArtifactRevision' :: Maybe Text
revisionId = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionSummary:ArtifactRevision' :: Maybe Text
revisionSummary = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionUrl:ArtifactRevision' :: Maybe Text
revisionUrl = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time when the most recent revision of the artifact was
-- created, in timestamp format.
artifactRevision_created :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.UTCTime)
artifactRevision_created :: Lens' ArtifactRevision (Maybe UTCTime)
artifactRevision_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactRevision' {Maybe POSIX
created :: Maybe POSIX
$sel:created:ArtifactRevision' :: ArtifactRevision -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: ArtifactRevision
s@ArtifactRevision' {} Maybe POSIX
a -> ArtifactRevision
s {$sel:created:ArtifactRevision' :: Maybe POSIX
created = Maybe POSIX
a} :: ArtifactRevision) 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 name of an artifact. This name might be system-generated, such as
-- \"MyApp\", or defined by the user when an action is created.
artifactRevision_name :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.Text)
artifactRevision_name :: Lens' ArtifactRevision (Maybe Text)
artifactRevision_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactRevision' {Maybe Text
name :: Maybe Text
$sel:name:ArtifactRevision' :: ArtifactRevision -> Maybe Text
name} -> Maybe Text
name) (\s :: ArtifactRevision
s@ArtifactRevision' {} Maybe Text
a -> ArtifactRevision
s {$sel:name:ArtifactRevision' :: Maybe Text
name = Maybe Text
a} :: ArtifactRevision)

-- | An additional identifier for a revision, such as a commit date or, for
-- artifacts stored in Amazon S3 buckets, the ETag value.
artifactRevision_revisionChangeIdentifier :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.Text)
artifactRevision_revisionChangeIdentifier :: Lens' ArtifactRevision (Maybe Text)
artifactRevision_revisionChangeIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactRevision' {Maybe Text
revisionChangeIdentifier :: Maybe Text
$sel:revisionChangeIdentifier:ArtifactRevision' :: ArtifactRevision -> Maybe Text
revisionChangeIdentifier} -> Maybe Text
revisionChangeIdentifier) (\s :: ArtifactRevision
s@ArtifactRevision' {} Maybe Text
a -> ArtifactRevision
s {$sel:revisionChangeIdentifier:ArtifactRevision' :: Maybe Text
revisionChangeIdentifier = Maybe Text
a} :: ArtifactRevision)

-- | The revision ID of the artifact.
artifactRevision_revisionId :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.Text)
artifactRevision_revisionId :: Lens' ArtifactRevision (Maybe Text)
artifactRevision_revisionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactRevision' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:ArtifactRevision' :: ArtifactRevision -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: ArtifactRevision
s@ArtifactRevision' {} Maybe Text
a -> ArtifactRevision
s {$sel:revisionId:ArtifactRevision' :: Maybe Text
revisionId = Maybe Text
a} :: ArtifactRevision)

-- | Summary information about the most recent revision of the artifact. For
-- GitHub and AWS CodeCommit repositories, the commit message. For Amazon
-- S3 buckets or actions, the user-provided content of a
-- @codepipeline-artifact-revision-summary@ key specified in the object
-- metadata.
artifactRevision_revisionSummary :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.Text)
artifactRevision_revisionSummary :: Lens' ArtifactRevision (Maybe Text)
artifactRevision_revisionSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactRevision' {Maybe Text
revisionSummary :: Maybe Text
$sel:revisionSummary:ArtifactRevision' :: ArtifactRevision -> Maybe Text
revisionSummary} -> Maybe Text
revisionSummary) (\s :: ArtifactRevision
s@ArtifactRevision' {} Maybe Text
a -> ArtifactRevision
s {$sel:revisionSummary:ArtifactRevision' :: Maybe Text
revisionSummary = Maybe Text
a} :: ArtifactRevision)

-- | The commit ID for the artifact revision. For artifacts stored in GitHub
-- or AWS CodeCommit repositories, the commit ID is linked to a commit
-- details page.
artifactRevision_revisionUrl :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.Text)
artifactRevision_revisionUrl :: Lens' ArtifactRevision (Maybe Text)
artifactRevision_revisionUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactRevision' {Maybe Text
revisionUrl :: Maybe Text
$sel:revisionUrl:ArtifactRevision' :: ArtifactRevision -> Maybe Text
revisionUrl} -> Maybe Text
revisionUrl) (\s :: ArtifactRevision
s@ArtifactRevision' {} Maybe Text
a -> ArtifactRevision
s {$sel:revisionUrl:ArtifactRevision' :: Maybe Text
revisionUrl = Maybe Text
a} :: ArtifactRevision)

instance Data.FromJSON ArtifactRevision where
  parseJSON :: Value -> Parser ArtifactRevision
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ArtifactRevision"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ArtifactRevision
ArtifactRevision'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"created")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revisionChangeIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revisionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revisionSummary")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"revisionUrl")
      )

instance Prelude.Hashable ArtifactRevision where
  hashWithSalt :: Int -> ArtifactRevision -> Int
hashWithSalt Int
_salt ArtifactRevision' {Maybe Text
Maybe POSIX
revisionUrl :: Maybe Text
revisionSummary :: Maybe Text
revisionId :: Maybe Text
revisionChangeIdentifier :: Maybe Text
name :: Maybe Text
created :: Maybe POSIX
$sel:revisionUrl:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:revisionSummary:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:revisionId:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:revisionChangeIdentifier:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:name:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:created:ArtifactRevision' :: ArtifactRevision -> 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
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionChangeIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionUrl

instance Prelude.NFData ArtifactRevision where
  rnf :: ArtifactRevision -> ()
rnf ArtifactRevision' {Maybe Text
Maybe POSIX
revisionUrl :: Maybe Text
revisionSummary :: Maybe Text
revisionId :: Maybe Text
revisionChangeIdentifier :: Maybe Text
name :: Maybe Text
created :: Maybe POSIX
$sel:revisionUrl:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:revisionSummary:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:revisionId:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:revisionChangeIdentifier:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:name:ArtifactRevision' :: ArtifactRevision -> Maybe Text
$sel:created:ArtifactRevision' :: ArtifactRevision -> 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
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionChangeIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionId
      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 Maybe Text
revisionUrl