{-# 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.PipelineSummary
-- 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.PipelineSummary 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

-- | Returns a summary of a pipeline.
--
-- /See:/ 'newPipelineSummary' smart constructor.
data PipelineSummary = PipelineSummary'
  { -- | The date and time the pipeline was created, in timestamp format.
    PipelineSummary -> Maybe POSIX
created :: Prelude.Maybe Data.POSIX,
    -- | The name of the pipeline.
    PipelineSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time of the last update to the pipeline, in timestamp
    -- format.
    PipelineSummary -> Maybe POSIX
updated :: Prelude.Maybe Data.POSIX,
    -- | The version number of the pipeline.
    PipelineSummary -> Maybe Natural
version :: Prelude.Maybe Prelude.Natural
  }
  deriving (PipelineSummary -> PipelineSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineSummary -> PipelineSummary -> Bool
$c/= :: PipelineSummary -> PipelineSummary -> Bool
== :: PipelineSummary -> PipelineSummary -> Bool
$c== :: PipelineSummary -> PipelineSummary -> Bool
Prelude.Eq, ReadPrec [PipelineSummary]
ReadPrec PipelineSummary
Int -> ReadS PipelineSummary
ReadS [PipelineSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineSummary]
$creadListPrec :: ReadPrec [PipelineSummary]
readPrec :: ReadPrec PipelineSummary
$creadPrec :: ReadPrec PipelineSummary
readList :: ReadS [PipelineSummary]
$creadList :: ReadS [PipelineSummary]
readsPrec :: Int -> ReadS PipelineSummary
$creadsPrec :: Int -> ReadS PipelineSummary
Prelude.Read, Int -> PipelineSummary -> ShowS
[PipelineSummary] -> ShowS
PipelineSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineSummary] -> ShowS
$cshowList :: [PipelineSummary] -> ShowS
show :: PipelineSummary -> String
$cshow :: PipelineSummary -> String
showsPrec :: Int -> PipelineSummary -> ShowS
$cshowsPrec :: Int -> PipelineSummary -> ShowS
Prelude.Show, forall x. Rep PipelineSummary x -> PipelineSummary
forall x. PipelineSummary -> Rep PipelineSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineSummary x -> PipelineSummary
$cfrom :: forall x. PipelineSummary -> Rep PipelineSummary x
Prelude.Generic)

-- |
-- Create a value of 'PipelineSummary' 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', 'pipelineSummary_created' - The date and time the pipeline was created, in timestamp format.
--
-- 'name', 'pipelineSummary_name' - The name of the pipeline.
--
-- 'updated', 'pipelineSummary_updated' - The date and time of the last update to the pipeline, in timestamp
-- format.
--
-- 'version', 'pipelineSummary_version' - The version number of the pipeline.
newPipelineSummary ::
  PipelineSummary
newPipelineSummary :: PipelineSummary
newPipelineSummary =
  PipelineSummary'
    { $sel:created:PipelineSummary' :: Maybe POSIX
created = forall a. Maybe a
Prelude.Nothing,
      $sel:name:PipelineSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:updated:PipelineSummary' :: Maybe POSIX
updated = forall a. Maybe a
Prelude.Nothing,
      $sel:version:PipelineSummary' :: Maybe Natural
version = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time the pipeline was created, in timestamp format.
pipelineSummary_created :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.UTCTime)
pipelineSummary_created :: Lens' PipelineSummary (Maybe UTCTime)
pipelineSummary_created = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe POSIX
created :: Maybe POSIX
$sel:created:PipelineSummary' :: PipelineSummary -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe POSIX
a -> PipelineSummary
s {$sel:created:PipelineSummary' :: Maybe POSIX
created = Maybe POSIX
a} :: PipelineSummary) 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 the pipeline.
pipelineSummary_name :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.Text)
pipelineSummary_name :: Lens' PipelineSummary (Maybe Text)
pipelineSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe Text
name :: Maybe Text
$sel:name:PipelineSummary' :: PipelineSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe Text
a -> PipelineSummary
s {$sel:name:PipelineSummary' :: Maybe Text
name = Maybe Text
a} :: PipelineSummary)

-- | The date and time of the last update to the pipeline, in timestamp
-- format.
pipelineSummary_updated :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.UTCTime)
pipelineSummary_updated :: Lens' PipelineSummary (Maybe UTCTime)
pipelineSummary_updated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe POSIX
updated :: Maybe POSIX
$sel:updated:PipelineSummary' :: PipelineSummary -> Maybe POSIX
updated} -> Maybe POSIX
updated) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe POSIX
a -> PipelineSummary
s {$sel:updated:PipelineSummary' :: Maybe POSIX
updated = Maybe POSIX
a} :: PipelineSummary) 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 version number of the pipeline.
pipelineSummary_version :: Lens.Lens' PipelineSummary (Prelude.Maybe Prelude.Natural)
pipelineSummary_version :: Lens' PipelineSummary (Maybe Natural)
pipelineSummary_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineSummary' {Maybe Natural
version :: Maybe Natural
$sel:version:PipelineSummary' :: PipelineSummary -> Maybe Natural
version} -> Maybe Natural
version) (\s :: PipelineSummary
s@PipelineSummary' {} Maybe Natural
a -> PipelineSummary
s {$sel:version:PipelineSummary' :: Maybe Natural
version = Maybe Natural
a} :: PipelineSummary)

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

instance Prelude.Hashable PipelineSummary where
  hashWithSalt :: Int -> PipelineSummary -> Int
hashWithSalt Int
_salt PipelineSummary' {Maybe Natural
Maybe Text
Maybe POSIX
version :: Maybe Natural
updated :: Maybe POSIX
name :: Maybe Text
created :: Maybe POSIX
$sel:version:PipelineSummary' :: PipelineSummary -> Maybe Natural
$sel:updated:PipelineSummary' :: PipelineSummary -> Maybe POSIX
$sel:name:PipelineSummary' :: PipelineSummary -> Maybe Text
$sel:created:PipelineSummary' :: PipelineSummary -> 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 POSIX
updated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
version

instance Prelude.NFData PipelineSummary where
  rnf :: PipelineSummary -> ()
rnf PipelineSummary' {Maybe Natural
Maybe Text
Maybe POSIX
version :: Maybe Natural
updated :: Maybe POSIX
name :: Maybe Text
created :: Maybe POSIX
$sel:version:PipelineSummary' :: PipelineSummary -> Maybe Natural
$sel:updated:PipelineSummary' :: PipelineSummary -> Maybe POSIX
$sel:name:PipelineSummary' :: PipelineSummary -> Maybe Text
$sel:created:PipelineSummary' :: PipelineSummary -> 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 POSIX
updated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
version