{-# 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-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.CodePipeline.Types.ArtifactRevision where

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

-- | Represents revision details of an artifact.
--
-- /See:/ 'newArtifactRevision' smart constructor.
data ArtifactRevision = 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 -> 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,
    -- | The date and time when the most recent revision of the artifact was
    -- created, in timestamp format.
    ArtifactRevision -> Maybe POSIX
created :: Prelude.Maybe Core.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,
    -- | The revision ID of the artifact.
    ArtifactRevision -> Maybe Text
revisionId :: 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
  }
  deriving (ArtifactRevision -> ArtifactRevision -> Bool
(ArtifactRevision -> ArtifactRevision -> Bool)
-> (ArtifactRevision -> ArtifactRevision -> Bool)
-> Eq ArtifactRevision
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]
(Int -> ReadS ArtifactRevision)
-> ReadS [ArtifactRevision]
-> ReadPrec ArtifactRevision
-> ReadPrec [ArtifactRevision]
-> Read 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
(Int -> ArtifactRevision -> ShowS)
-> (ArtifactRevision -> String)
-> ([ArtifactRevision] -> ShowS)
-> Show ArtifactRevision
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. ArtifactRevision -> Rep ArtifactRevision x)
-> (forall x. Rep ArtifactRevision x -> ArtifactRevision)
-> Generic ArtifactRevision
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:
--
-- '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.
--
-- '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.
--
-- 'revisionId', 'artifactRevision_revisionId' - The revision ID of the artifact.
--
-- '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.
newArtifactRevision ::
  ArtifactRevision
newArtifactRevision :: ArtifactRevision
newArtifactRevision =
  ArtifactRevision' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ArtifactRevision
ArtifactRevision'
    { $sel:revisionSummary:ArtifactRevision' :: Maybe Text
revisionSummary =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionUrl:ArtifactRevision' :: Maybe Text
revisionUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:created:ArtifactRevision' :: Maybe POSIX
created = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ArtifactRevision' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:ArtifactRevision' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionChangeIdentifier:ArtifactRevision' :: Maybe Text
revisionChangeIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ArtifactRevision -> f ArtifactRevision
artifactRevision_revisionSummary = (ArtifactRevision -> Maybe Text)
-> (ArtifactRevision -> Maybe Text -> ArtifactRevision)
-> Lens ArtifactRevision ArtifactRevision (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> ArtifactRevision -> f ArtifactRevision
artifactRevision_revisionUrl = (ArtifactRevision -> Maybe Text)
-> (ArtifactRevision -> Maybe Text -> ArtifactRevision)
-> Lens ArtifactRevision ArtifactRevision (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ArtifactRevision -> f ArtifactRevision
artifactRevision_created = (ArtifactRevision -> Maybe POSIX)
-> (ArtifactRevision -> Maybe POSIX -> ArtifactRevision)
-> Lens
     ArtifactRevision ArtifactRevision (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> ArtifactRevision -> f ArtifactRevision)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ArtifactRevision
-> f ArtifactRevision
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

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ArtifactRevision -> f ArtifactRevision
artifactRevision_name = (ArtifactRevision -> Maybe Text)
-> (ArtifactRevision -> Maybe Text -> ArtifactRevision)
-> Lens ArtifactRevision ArtifactRevision (Maybe Text) (Maybe Text)
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)

-- | The revision ID of the artifact.
artifactRevision_revisionId :: Lens.Lens' ArtifactRevision (Prelude.Maybe Prelude.Text)
artifactRevision_revisionId :: (Maybe Text -> f (Maybe Text))
-> ArtifactRevision -> f ArtifactRevision
artifactRevision_revisionId = (ArtifactRevision -> Maybe Text)
-> (ArtifactRevision -> Maybe Text -> ArtifactRevision)
-> Lens ArtifactRevision ArtifactRevision (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> ArtifactRevision -> f ArtifactRevision
artifactRevision_revisionChangeIdentifier = (ArtifactRevision -> Maybe Text)
-> (ArtifactRevision -> Maybe Text -> ArtifactRevision)
-> Lens ArtifactRevision ArtifactRevision (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON ArtifactRevision where
  parseJSON :: Value -> Parser ArtifactRevision
parseJSON =
    String
-> (Object -> Parser ArtifactRevision)
-> Value
-> Parser ArtifactRevision
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ArtifactRevision"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ArtifactRevision
ArtifactRevision'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ArtifactRevision)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ArtifactRevision)
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
"revisionSummary")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ArtifactRevision)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> ArtifactRevision)
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
"revisionUrl")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> ArtifactRevision)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ArtifactRevision)
forall (f :: * -> *) a b. Applicative f => 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
"created")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ArtifactRevision)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ArtifactRevision)
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
"name")
            Parser (Maybe Text -> Maybe Text -> ArtifactRevision)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ArtifactRevision)
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
"revisionId")
            Parser (Maybe Text -> ArtifactRevision)
-> Parser (Maybe Text) -> Parser ArtifactRevision
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
"revisionChangeIdentifier")
      )

instance Prelude.Hashable ArtifactRevision

instance Prelude.NFData ArtifactRevision