{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | A timestamp that indicates when the most recent deployment to the
    -- deployment group started.
    LastDeploymentInfo -> Maybe POSIX
createTime :: Prelude.Maybe Data.POSIX,
    -- | 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 Data.POSIX,
    -- | The status of the most recent deployment.
    LastDeploymentInfo -> Maybe DeploymentStatus
status :: Prelude.Maybe DeploymentStatus
  }
  deriving (LastDeploymentInfo -> LastDeploymentInfo -> Bool
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]
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
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. 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:
--
-- 'createTime', 'lastDeploymentInfo_createTime' - A timestamp that indicates when the most recent deployment to the
-- deployment group started.
--
-- '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.
--
-- 'status', 'lastDeploymentInfo_status' - The status of the most recent deployment.
newLastDeploymentInfo ::
  LastDeploymentInfo
newLastDeploymentInfo :: LastDeploymentInfo
newLastDeploymentInfo =
  LastDeploymentInfo'
    { $sel:createTime:LastDeploymentInfo' :: Maybe POSIX
createTime = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentId:LastDeploymentInfo' :: Maybe Text
deploymentId = forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:LastDeploymentInfo' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:LastDeploymentInfo' :: Maybe DeploymentStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' LastDeploymentInfo (Maybe UTCTime)
lastDeploymentInfo_createTime = 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) 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 unique ID of a deployment.
lastDeploymentInfo_deploymentId :: Lens.Lens' LastDeploymentInfo (Prelude.Maybe Prelude.Text)
lastDeploymentInfo_deploymentId :: Lens' LastDeploymentInfo (Maybe Text)
lastDeploymentInfo_deploymentId = 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 :: Lens' LastDeploymentInfo (Maybe UTCTime)
lastDeploymentInfo_endTime = 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) 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 status of the most recent deployment.
lastDeploymentInfo_status :: Lens.Lens' LastDeploymentInfo (Prelude.Maybe DeploymentStatus)
lastDeploymentInfo_status :: Lens' LastDeploymentInfo (Maybe DeploymentStatus)
lastDeploymentInfo_status = 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)

instance Data.FromJSON LastDeploymentInfo where
  parseJSON :: Value -> Parser LastDeploymentInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LastDeploymentInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe DeploymentStatus
-> LastDeploymentInfo
LastDeploymentInfo'
            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
"createTime")
            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
"deploymentId")
            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
"endTime")
            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
"status")
      )

instance Prelude.Hashable LastDeploymentInfo where
  hashWithSalt :: Int -> LastDeploymentInfo -> Int
hashWithSalt Int
_salt LastDeploymentInfo' {Maybe Text
Maybe POSIX
Maybe DeploymentStatus
status :: Maybe DeploymentStatus
endTime :: Maybe POSIX
deploymentId :: Maybe Text
createTime :: Maybe POSIX
$sel:status:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe DeploymentStatus
$sel:endTime:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe POSIX
$sel:deploymentId:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe Text
$sel:createTime:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeploymentStatus
status

instance Prelude.NFData LastDeploymentInfo where
  rnf :: LastDeploymentInfo -> ()
rnf LastDeploymentInfo' {Maybe Text
Maybe POSIX
Maybe DeploymentStatus
status :: Maybe DeploymentStatus
endTime :: Maybe POSIX
deploymentId :: Maybe Text
createTime :: Maybe POSIX
$sel:status:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe DeploymentStatus
$sel:endTime:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe POSIX
$sel:deploymentId:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe Text
$sel:createTime:LastDeploymentInfo' :: LastDeploymentInfo -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeploymentStatus
status