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

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

-- | Information about a pipeline.
--
-- /See:/ 'newPipelineMetadata' smart constructor.
data PipelineMetadata = PipelineMetadata'
  { -- | The date and time the pipeline was created, in timestamp format.
    PipelineMetadata -> Maybe POSIX
created :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the pipeline.
    PipelineMetadata -> Maybe Text
pipelineArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time the pipeline was last updated, in timestamp format.
    PipelineMetadata -> Maybe POSIX
updated :: Prelude.Maybe Core.POSIX
  }
  deriving (PipelineMetadata -> PipelineMetadata -> Bool
(PipelineMetadata -> PipelineMetadata -> Bool)
-> (PipelineMetadata -> PipelineMetadata -> Bool)
-> Eq PipelineMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineMetadata -> PipelineMetadata -> Bool
$c/= :: PipelineMetadata -> PipelineMetadata -> Bool
== :: PipelineMetadata -> PipelineMetadata -> Bool
$c== :: PipelineMetadata -> PipelineMetadata -> Bool
Prelude.Eq, ReadPrec [PipelineMetadata]
ReadPrec PipelineMetadata
Int -> ReadS PipelineMetadata
ReadS [PipelineMetadata]
(Int -> ReadS PipelineMetadata)
-> ReadS [PipelineMetadata]
-> ReadPrec PipelineMetadata
-> ReadPrec [PipelineMetadata]
-> Read PipelineMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineMetadata]
$creadListPrec :: ReadPrec [PipelineMetadata]
readPrec :: ReadPrec PipelineMetadata
$creadPrec :: ReadPrec PipelineMetadata
readList :: ReadS [PipelineMetadata]
$creadList :: ReadS [PipelineMetadata]
readsPrec :: Int -> ReadS PipelineMetadata
$creadsPrec :: Int -> ReadS PipelineMetadata
Prelude.Read, Int -> PipelineMetadata -> ShowS
[PipelineMetadata] -> ShowS
PipelineMetadata -> String
(Int -> PipelineMetadata -> ShowS)
-> (PipelineMetadata -> String)
-> ([PipelineMetadata] -> ShowS)
-> Show PipelineMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineMetadata] -> ShowS
$cshowList :: [PipelineMetadata] -> ShowS
show :: PipelineMetadata -> String
$cshow :: PipelineMetadata -> String
showsPrec :: Int -> PipelineMetadata -> ShowS
$cshowsPrec :: Int -> PipelineMetadata -> ShowS
Prelude.Show, (forall x. PipelineMetadata -> Rep PipelineMetadata x)
-> (forall x. Rep PipelineMetadata x -> PipelineMetadata)
-> Generic PipelineMetadata
forall x. Rep PipelineMetadata x -> PipelineMetadata
forall x. PipelineMetadata -> Rep PipelineMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineMetadata x -> PipelineMetadata
$cfrom :: forall x. PipelineMetadata -> Rep PipelineMetadata x
Prelude.Generic)

-- |
-- Create a value of 'PipelineMetadata' 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', 'pipelineMetadata_created' - The date and time the pipeline was created, in timestamp format.
--
-- 'pipelineArn', 'pipelineMetadata_pipelineArn' - The Amazon Resource Name (ARN) of the pipeline.
--
-- 'updated', 'pipelineMetadata_updated' - The date and time the pipeline was last updated, in timestamp format.
newPipelineMetadata ::
  PipelineMetadata
newPipelineMetadata :: PipelineMetadata
newPipelineMetadata =
  PipelineMetadata' :: Maybe POSIX -> Maybe Text -> Maybe POSIX -> PipelineMetadata
PipelineMetadata'
    { $sel:created:PipelineMetadata' :: Maybe POSIX
created = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineArn:PipelineMetadata' :: Maybe Text
pipelineArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updated:PipelineMetadata' :: Maybe POSIX
updated = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time the pipeline was created, in timestamp format.
pipelineMetadata_created :: Lens.Lens' PipelineMetadata (Prelude.Maybe Prelude.UTCTime)
pipelineMetadata_created :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineMetadata -> f PipelineMetadata
pipelineMetadata_created = (PipelineMetadata -> Maybe POSIX)
-> (PipelineMetadata -> Maybe POSIX -> PipelineMetadata)
-> Lens
     PipelineMetadata PipelineMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineMetadata' {Maybe POSIX
created :: Maybe POSIX
$sel:created:PipelineMetadata' :: PipelineMetadata -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: PipelineMetadata
s@PipelineMetadata' {} Maybe POSIX
a -> PipelineMetadata
s {$sel:created:PipelineMetadata' :: Maybe POSIX
created = Maybe POSIX
a} :: PipelineMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> PipelineMetadata -> f PipelineMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineMetadata
-> f PipelineMetadata
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 Amazon Resource Name (ARN) of the pipeline.
pipelineMetadata_pipelineArn :: Lens.Lens' PipelineMetadata (Prelude.Maybe Prelude.Text)
pipelineMetadata_pipelineArn :: (Maybe Text -> f (Maybe Text))
-> PipelineMetadata -> f PipelineMetadata
pipelineMetadata_pipelineArn = (PipelineMetadata -> Maybe Text)
-> (PipelineMetadata -> Maybe Text -> PipelineMetadata)
-> Lens PipelineMetadata PipelineMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineMetadata' {Maybe Text
pipelineArn :: Maybe Text
$sel:pipelineArn:PipelineMetadata' :: PipelineMetadata -> Maybe Text
pipelineArn} -> Maybe Text
pipelineArn) (\s :: PipelineMetadata
s@PipelineMetadata' {} Maybe Text
a -> PipelineMetadata
s {$sel:pipelineArn:PipelineMetadata' :: Maybe Text
pipelineArn = Maybe Text
a} :: PipelineMetadata)

-- | The date and time the pipeline was last updated, in timestamp format.
pipelineMetadata_updated :: Lens.Lens' PipelineMetadata (Prelude.Maybe Prelude.UTCTime)
pipelineMetadata_updated :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineMetadata -> f PipelineMetadata
pipelineMetadata_updated = (PipelineMetadata -> Maybe POSIX)
-> (PipelineMetadata -> Maybe POSIX -> PipelineMetadata)
-> Lens
     PipelineMetadata PipelineMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineMetadata' {Maybe POSIX
updated :: Maybe POSIX
$sel:updated:PipelineMetadata' :: PipelineMetadata -> Maybe POSIX
updated} -> Maybe POSIX
updated) (\s :: PipelineMetadata
s@PipelineMetadata' {} Maybe POSIX
a -> PipelineMetadata
s {$sel:updated:PipelineMetadata' :: Maybe POSIX
updated = Maybe POSIX
a} :: PipelineMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> PipelineMetadata -> f PipelineMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PipelineMetadata
-> f PipelineMetadata
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

instance Core.FromJSON PipelineMetadata where
  parseJSON :: Value -> Parser PipelineMetadata
parseJSON =
    String
-> (Object -> Parser PipelineMetadata)
-> Value
-> Parser PipelineMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PipelineMetadata"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> Maybe POSIX -> PipelineMetadata
PipelineMetadata'
            (Maybe POSIX -> Maybe Text -> Maybe POSIX -> PipelineMetadata)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> PipelineMetadata)
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
"created")
            Parser (Maybe Text -> Maybe POSIX -> PipelineMetadata)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> PipelineMetadata)
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
"pipelineArn")
            Parser (Maybe POSIX -> PipelineMetadata)
-> Parser (Maybe POSIX) -> Parser PipelineMetadata
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
"updated")
      )

instance Prelude.Hashable PipelineMetadata

instance Prelude.NFData PipelineMetadata