{-# 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.CodeDeploy.Types.LastDeploymentInfo
-- 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.CodeDeploy.Types.LastDeploymentInfo where

import Amazonka.CodeDeploy.Types.DeploymentStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the most recent attempted or successful deployment to
-- a deployment group.
--
-- /See:/ 'newLastDeploymentInfo' smart constructor.
data LastDeploymentInfo = LastDeploymentInfo'
  { -- | The status of the most recent deployment.
    LastDeploymentInfo -> Maybe DeploymentStatus
status :: Prelude.Maybe DeploymentStatus,
    -- | The unique ID of a deployment.
    LastDeploymentInfo -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | A timestamp that indicates when the most recent deployment to the
    -- deployment group was complete.
    LastDeploymentInfo -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | A timestamp that indicates when the most recent deployment to the
    -- deployment group started.
    LastDeploymentInfo -> Maybe POSIX
createTime :: Prelude.Maybe Core.POSIX
  }
  deriving (LastDeploymentInfo -> LastDeploymentInfo -> Bool
(LastDeploymentInfo -> LastDeploymentInfo -> Bool)
-> (LastDeploymentInfo -> LastDeploymentInfo -> Bool)
-> Eq LastDeploymentInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastDeploymentInfo -> LastDeploymentInfo -> Bool
$c/= :: LastDeploymentInfo -> LastDeploymentInfo -> Bool
== :: LastDeploymentInfo -> LastDeploymentInfo -> Bool
$c== :: LastDeploymentInfo -> LastDeploymentInfo -> Bool
Prelude.Eq, ReadPrec [LastDeploymentInfo]
ReadPrec LastDeploymentInfo
Int -> ReadS LastDeploymentInfo
ReadS [LastDeploymentInfo]
(Int -> ReadS LastDeploymentInfo)
-> ReadS [LastDeploymentInfo]
-> ReadPrec LastDeploymentInfo
-> ReadPrec [LastDeploymentInfo]
-> Read LastDeploymentInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastDeploymentInfo]
$creadListPrec :: ReadPrec [LastDeploymentInfo]
readPrec :: ReadPrec LastDeploymentInfo
$creadPrec :: ReadPrec LastDeploymentInfo
readList :: ReadS [LastDeploymentInfo]
$creadList :: ReadS [LastDeploymentInfo]
readsPrec :: Int -> ReadS LastDeploymentInfo
$creadsPrec :: Int -> ReadS LastDeploymentInfo
Prelude.Read, Int -> LastDeploymentInfo -> ShowS
[LastDeploymentInfo] -> ShowS
LastDeploymentInfo -> String
(Int -> LastDeploymentInfo -> ShowS)
-> (LastDeploymentInfo -> String)
-> ([LastDeploymentInfo] -> ShowS)
-> Show LastDeploymentInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastDeploymentInfo] -> ShowS
$cshowList :: [LastDeploymentInfo] -> ShowS
show :: LastDeploymentInfo -> String
$cshow :: LastDeploymentInfo -> String
showsPrec :: Int -> LastDeploymentInfo -> ShowS
$cshowsPrec :: Int -> LastDeploymentInfo -> ShowS
Prelude.Show, (forall x. LastDeploymentInfo -> Rep LastDeploymentInfo x)
-> (forall x. Rep LastDeploymentInfo x -> LastDeploymentInfo)
-> Generic LastDeploymentInfo
forall x. Rep LastDeploymentInfo x -> LastDeploymentInfo
forall x. LastDeploymentInfo -> Rep LastDeploymentInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LastDeploymentInfo x -> LastDeploymentInfo
$cfrom :: forall x. LastDeploymentInfo -> Rep LastDeploymentInfo x
Prelude.Generic)

-- |
-- Create a value of 'LastDeploymentInfo' 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:
--
-- 'status', 'lastDeploymentInfo_status' - The status of the most recent deployment.
--
-- 'deploymentId', 'lastDeploymentInfo_deploymentId' - The unique ID of a deployment.
--
-- 'endTime', 'lastDeploymentInfo_endTime' - A timestamp that indicates when the most recent deployment to the
-- deployment group was complete.
--
-- 'createTime', 'lastDeploymentInfo_createTime' - A timestamp that indicates when the most recent deployment to the
-- deployment group started.
newLastDeploymentInfo ::
  LastDeploymentInfo
newLastDeploymentInfo :: LastDeploymentInfo
newLastDeploymentInfo =
  LastDeploymentInfo' :: Maybe DeploymentStatus
-> Maybe Text -> Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo
LastDeploymentInfo'
    { $sel:status:LastDeploymentInfo' :: Maybe DeploymentStatus
status = Maybe DeploymentStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentId:LastDeploymentInfo' :: Maybe Text
deploymentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:LastDeploymentInfo' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:LastDeploymentInfo' :: Maybe POSIX
createTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the most recent deployment.
lastDeploymentInfo_status :: Lens.Lens' LastDeploymentInfo (Prelude.Maybe DeploymentStatus)
lastDeploymentInfo_status :: (Maybe DeploymentStatus -> f (Maybe DeploymentStatus))
-> LastDeploymentInfo -> f LastDeploymentInfo
lastDeploymentInfo_status = (LastDeploymentInfo -> Maybe DeploymentStatus)
-> (LastDeploymentInfo
    -> Maybe DeploymentStatus -> LastDeploymentInfo)
-> Lens
     LastDeploymentInfo
     LastDeploymentInfo
     (Maybe DeploymentStatus)
     (Maybe DeploymentStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastDeploymentInfo' {Maybe DeploymentStatus
status :: Maybe DeploymentStatus
$sel:status:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe DeploymentStatus
status} -> Maybe DeploymentStatus
status) (\s :: LastDeploymentInfo
s@LastDeploymentInfo' {} Maybe DeploymentStatus
a -> LastDeploymentInfo
s {$sel:status:LastDeploymentInfo' :: Maybe DeploymentStatus
status = Maybe DeploymentStatus
a} :: LastDeploymentInfo)

-- | The unique ID of a deployment.
lastDeploymentInfo_deploymentId :: Lens.Lens' LastDeploymentInfo (Prelude.Maybe Prelude.Text)
lastDeploymentInfo_deploymentId :: (Maybe Text -> f (Maybe Text))
-> LastDeploymentInfo -> f LastDeploymentInfo
lastDeploymentInfo_deploymentId = (LastDeploymentInfo -> Maybe Text)
-> (LastDeploymentInfo -> Maybe Text -> LastDeploymentInfo)
-> Lens
     LastDeploymentInfo LastDeploymentInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastDeploymentInfo' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: LastDeploymentInfo
s@LastDeploymentInfo' {} Maybe Text
a -> LastDeploymentInfo
s {$sel:deploymentId:LastDeploymentInfo' :: Maybe Text
deploymentId = Maybe Text
a} :: LastDeploymentInfo)

-- | A timestamp that indicates when the most recent deployment to the
-- deployment group was complete.
lastDeploymentInfo_endTime :: Lens.Lens' LastDeploymentInfo (Prelude.Maybe Prelude.UTCTime)
lastDeploymentInfo_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LastDeploymentInfo -> f LastDeploymentInfo
lastDeploymentInfo_endTime = (LastDeploymentInfo -> Maybe POSIX)
-> (LastDeploymentInfo -> Maybe POSIX -> LastDeploymentInfo)
-> Lens
     LastDeploymentInfo LastDeploymentInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastDeploymentInfo' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: LastDeploymentInfo
s@LastDeploymentInfo' {} Maybe POSIX
a -> LastDeploymentInfo
s {$sel:endTime:LastDeploymentInfo' :: Maybe POSIX
endTime = Maybe POSIX
a} :: LastDeploymentInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> LastDeploymentInfo -> f LastDeploymentInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LastDeploymentInfo
-> f LastDeploymentInfo
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

-- | A timestamp that indicates when the most recent deployment to the
-- deployment group started.
lastDeploymentInfo_createTime :: Lens.Lens' LastDeploymentInfo (Prelude.Maybe Prelude.UTCTime)
lastDeploymentInfo_createTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LastDeploymentInfo -> f LastDeploymentInfo
lastDeploymentInfo_createTime = (LastDeploymentInfo -> Maybe POSIX)
-> (LastDeploymentInfo -> Maybe POSIX -> LastDeploymentInfo)
-> Lens
     LastDeploymentInfo LastDeploymentInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastDeploymentInfo' {Maybe POSIX
createTime :: Maybe POSIX
$sel:createTime:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe POSIX
createTime} -> Maybe POSIX
createTime) (\s :: LastDeploymentInfo
s@LastDeploymentInfo' {} Maybe POSIX
a -> LastDeploymentInfo
s {$sel:createTime:LastDeploymentInfo' :: Maybe POSIX
createTime = Maybe POSIX
a} :: LastDeploymentInfo) ((Maybe POSIX -> f (Maybe POSIX))
 -> LastDeploymentInfo -> f LastDeploymentInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LastDeploymentInfo
-> f LastDeploymentInfo
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 LastDeploymentInfo where
  parseJSON :: Value -> Parser LastDeploymentInfo
parseJSON =
    String
-> (Object -> Parser LastDeploymentInfo)
-> Value
-> Parser LastDeploymentInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LastDeploymentInfo"
      ( \Object
x ->
          Maybe DeploymentStatus
-> Maybe Text -> Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo
LastDeploymentInfo'
            (Maybe DeploymentStatus
 -> Maybe Text -> Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo)
-> Parser (Maybe DeploymentStatus)
-> Parser
     (Maybe Text -> Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DeploymentStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text -> Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo)
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
"deploymentId")
            Parser (Maybe POSIX -> Maybe POSIX -> LastDeploymentInfo)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> LastDeploymentInfo)
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
"endTime")
            Parser (Maybe POSIX -> LastDeploymentInfo)
-> Parser (Maybe POSIX) -> Parser LastDeploymentInfo
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
"createTime")
      )

instance Prelude.Hashable LastDeploymentInfo

instance Prelude.NFData LastDeploymentInfo