{-# 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.M2.Types.DeploymentSummary
-- 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.M2.Types.DeploymentSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.DeploymentLifecycle
import qualified Amazonka.Prelude as Prelude

-- | A subset of information about a specific deployment.
--
-- /See:/ 'newDeploymentSummary' smart constructor.
data DeploymentSummary = DeploymentSummary'
  { -- | The reason for the reported status.
    DeploymentSummary -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the application.
    DeploymentSummary -> Text
applicationId :: Prelude.Text,
    -- | The version of the application.
    DeploymentSummary -> Natural
applicationVersion :: Prelude.Natural,
    -- | The timestamp when the deployment was created.
    DeploymentSummary -> POSIX
creationTime :: Data.POSIX,
    -- | The unique identifier of the deployment.
    DeploymentSummary -> Text
deploymentId :: Prelude.Text,
    -- | The unique identifier of the runtime environment.
    DeploymentSummary -> Text
environmentId :: Prelude.Text,
    -- | The current status of the deployment.
    DeploymentSummary -> DeploymentLifecycle
status :: DeploymentLifecycle
  }
  deriving (DeploymentSummary -> DeploymentSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentSummary -> DeploymentSummary -> Bool
$c/= :: DeploymentSummary -> DeploymentSummary -> Bool
== :: DeploymentSummary -> DeploymentSummary -> Bool
$c== :: DeploymentSummary -> DeploymentSummary -> Bool
Prelude.Eq, ReadPrec [DeploymentSummary]
ReadPrec DeploymentSummary
Int -> ReadS DeploymentSummary
ReadS [DeploymentSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentSummary]
$creadListPrec :: ReadPrec [DeploymentSummary]
readPrec :: ReadPrec DeploymentSummary
$creadPrec :: ReadPrec DeploymentSummary
readList :: ReadS [DeploymentSummary]
$creadList :: ReadS [DeploymentSummary]
readsPrec :: Int -> ReadS DeploymentSummary
$creadsPrec :: Int -> ReadS DeploymentSummary
Prelude.Read, Int -> DeploymentSummary -> ShowS
[DeploymentSummary] -> ShowS
DeploymentSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentSummary] -> ShowS
$cshowList :: [DeploymentSummary] -> ShowS
show :: DeploymentSummary -> String
$cshow :: DeploymentSummary -> String
showsPrec :: Int -> DeploymentSummary -> ShowS
$cshowsPrec :: Int -> DeploymentSummary -> ShowS
Prelude.Show, forall x. Rep DeploymentSummary x -> DeploymentSummary
forall x. DeploymentSummary -> Rep DeploymentSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentSummary x -> DeploymentSummary
$cfrom :: forall x. DeploymentSummary -> Rep DeploymentSummary x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentSummary' 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:
--
-- 'statusReason', 'deploymentSummary_statusReason' - The reason for the reported status.
--
-- 'applicationId', 'deploymentSummary_applicationId' - The unique identifier of the application.
--
-- 'applicationVersion', 'deploymentSummary_applicationVersion' - The version of the application.
--
-- 'creationTime', 'deploymentSummary_creationTime' - The timestamp when the deployment was created.
--
-- 'deploymentId', 'deploymentSummary_deploymentId' - The unique identifier of the deployment.
--
-- 'environmentId', 'deploymentSummary_environmentId' - The unique identifier of the runtime environment.
--
-- 'status', 'deploymentSummary_status' - The current status of the deployment.
newDeploymentSummary ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'applicationVersion'
  Prelude.Natural ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'deploymentId'
  Prelude.Text ->
  -- | 'environmentId'
  Prelude.Text ->
  -- | 'status'
  DeploymentLifecycle ->
  DeploymentSummary
newDeploymentSummary :: Text
-> Natural
-> UTCTime
-> Text
-> Text
-> DeploymentLifecycle
-> DeploymentSummary
newDeploymentSummary
  Text
pApplicationId_
  Natural
pApplicationVersion_
  UTCTime
pCreationTime_
  Text
pDeploymentId_
  Text
pEnvironmentId_
  DeploymentLifecycle
pStatus_ =
    DeploymentSummary'
      { $sel:statusReason:DeploymentSummary' :: Maybe Text
statusReason = forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:DeploymentSummary' :: Text
applicationId = Text
pApplicationId_,
        $sel:applicationVersion:DeploymentSummary' :: Natural
applicationVersion = Natural
pApplicationVersion_,
        $sel:creationTime:DeploymentSummary' :: POSIX
creationTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:deploymentId:DeploymentSummary' :: Text
deploymentId = Text
pDeploymentId_,
        $sel:environmentId:DeploymentSummary' :: Text
environmentId = Text
pEnvironmentId_,
        $sel:status:DeploymentSummary' :: DeploymentLifecycle
status = DeploymentLifecycle
pStatus_
      }

-- | The reason for the reported status.
deploymentSummary_statusReason :: Lens.Lens' DeploymentSummary (Prelude.Maybe Prelude.Text)
deploymentSummary_statusReason :: Lens' DeploymentSummary (Maybe Text)
deploymentSummary_statusReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:DeploymentSummary' :: DeploymentSummary -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: DeploymentSummary
s@DeploymentSummary' {} Maybe Text
a -> DeploymentSummary
s {$sel:statusReason:DeploymentSummary' :: Maybe Text
statusReason = Maybe Text
a} :: DeploymentSummary)

-- | The unique identifier of the application.
deploymentSummary_applicationId :: Lens.Lens' DeploymentSummary Prelude.Text
deploymentSummary_applicationId :: Lens' DeploymentSummary Text
deploymentSummary_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {Text
applicationId :: Text
$sel:applicationId:DeploymentSummary' :: DeploymentSummary -> Text
applicationId} -> Text
applicationId) (\s :: DeploymentSummary
s@DeploymentSummary' {} Text
a -> DeploymentSummary
s {$sel:applicationId:DeploymentSummary' :: Text
applicationId = Text
a} :: DeploymentSummary)

-- | The version of the application.
deploymentSummary_applicationVersion :: Lens.Lens' DeploymentSummary Prelude.Natural
deploymentSummary_applicationVersion :: Lens' DeploymentSummary Natural
deploymentSummary_applicationVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {Natural
applicationVersion :: Natural
$sel:applicationVersion:DeploymentSummary' :: DeploymentSummary -> Natural
applicationVersion} -> Natural
applicationVersion) (\s :: DeploymentSummary
s@DeploymentSummary' {} Natural
a -> DeploymentSummary
s {$sel:applicationVersion:DeploymentSummary' :: Natural
applicationVersion = Natural
a} :: DeploymentSummary)

-- | The timestamp when the deployment was created.
deploymentSummary_creationTime :: Lens.Lens' DeploymentSummary Prelude.UTCTime
deploymentSummary_creationTime :: Lens' DeploymentSummary UTCTime
deploymentSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {POSIX
creationTime :: POSIX
$sel:creationTime:DeploymentSummary' :: DeploymentSummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: DeploymentSummary
s@DeploymentSummary' {} POSIX
a -> DeploymentSummary
s {$sel:creationTime:DeploymentSummary' :: POSIX
creationTime = POSIX
a} :: DeploymentSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The unique identifier of the deployment.
deploymentSummary_deploymentId :: Lens.Lens' DeploymentSummary Prelude.Text
deploymentSummary_deploymentId :: Lens' DeploymentSummary Text
deploymentSummary_deploymentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {Text
deploymentId :: Text
$sel:deploymentId:DeploymentSummary' :: DeploymentSummary -> Text
deploymentId} -> Text
deploymentId) (\s :: DeploymentSummary
s@DeploymentSummary' {} Text
a -> DeploymentSummary
s {$sel:deploymentId:DeploymentSummary' :: Text
deploymentId = Text
a} :: DeploymentSummary)

-- | The unique identifier of the runtime environment.
deploymentSummary_environmentId :: Lens.Lens' DeploymentSummary Prelude.Text
deploymentSummary_environmentId :: Lens' DeploymentSummary Text
deploymentSummary_environmentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {Text
environmentId :: Text
$sel:environmentId:DeploymentSummary' :: DeploymentSummary -> Text
environmentId} -> Text
environmentId) (\s :: DeploymentSummary
s@DeploymentSummary' {} Text
a -> DeploymentSummary
s {$sel:environmentId:DeploymentSummary' :: Text
environmentId = Text
a} :: DeploymentSummary)

-- | The current status of the deployment.
deploymentSummary_status :: Lens.Lens' DeploymentSummary DeploymentLifecycle
deploymentSummary_status :: Lens' DeploymentSummary DeploymentLifecycle
deploymentSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentSummary' {DeploymentLifecycle
status :: DeploymentLifecycle
$sel:status:DeploymentSummary' :: DeploymentSummary -> DeploymentLifecycle
status} -> DeploymentLifecycle
status) (\s :: DeploymentSummary
s@DeploymentSummary' {} DeploymentLifecycle
a -> DeploymentSummary
s {$sel:status:DeploymentSummary' :: DeploymentLifecycle
status = DeploymentLifecycle
a} :: DeploymentSummary)

instance Data.FromJSON DeploymentSummary where
  parseJSON :: Value -> Parser DeploymentSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeploymentSummary"
      ( \Object
x ->
          Maybe Text
-> Text
-> Natural
-> POSIX
-> Text
-> Text
-> DeploymentLifecycle
-> DeploymentSummary
DeploymentSummary'
            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
"statusReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"applicationId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"applicationVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"creationTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser 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 a
Data..: Key
"environmentId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
      )

instance Prelude.Hashable DeploymentSummary where
  hashWithSalt :: Int -> DeploymentSummary -> Int
hashWithSalt Int
_salt DeploymentSummary' {Natural
Maybe Text
Text
POSIX
DeploymentLifecycle
status :: DeploymentLifecycle
environmentId :: Text
deploymentId :: Text
creationTime :: POSIX
applicationVersion :: Natural
applicationId :: Text
statusReason :: Maybe Text
$sel:status:DeploymentSummary' :: DeploymentSummary -> DeploymentLifecycle
$sel:environmentId:DeploymentSummary' :: DeploymentSummary -> Text
$sel:deploymentId:DeploymentSummary' :: DeploymentSummary -> Text
$sel:creationTime:DeploymentSummary' :: DeploymentSummary -> POSIX
$sel:applicationVersion:DeploymentSummary' :: DeploymentSummary -> Natural
$sel:applicationId:DeploymentSummary' :: DeploymentSummary -> Text
$sel:statusReason:DeploymentSummary' :: DeploymentSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
applicationVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deploymentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DeploymentLifecycle
status

instance Prelude.NFData DeploymentSummary where
  rnf :: DeploymentSummary -> ()
rnf DeploymentSummary' {Natural
Maybe Text
Text
POSIX
DeploymentLifecycle
status :: DeploymentLifecycle
environmentId :: Text
deploymentId :: Text
creationTime :: POSIX
applicationVersion :: Natural
applicationId :: Text
statusReason :: Maybe Text
$sel:status:DeploymentSummary' :: DeploymentSummary -> DeploymentLifecycle
$sel:environmentId:DeploymentSummary' :: DeploymentSummary -> Text
$sel:deploymentId:DeploymentSummary' :: DeploymentSummary -> Text
$sel:creationTime:DeploymentSummary' :: DeploymentSummary -> POSIX
$sel:applicationVersion:DeploymentSummary' :: DeploymentSummary -> Natural
$sel:applicationId:DeploymentSummary' :: DeploymentSummary -> Text
$sel:statusReason:DeploymentSummary' :: DeploymentSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
applicationVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
environmentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DeploymentLifecycle
status