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

-- | Contains a summary of a deployed application.
--
-- /See:/ 'newDeployedVersionSummary' smart constructor.
data DeployedVersionSummary = DeployedVersionSummary'
  { -- | The reason for the reported status.
    DeployedVersionSummary -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | The version of the deployed application.
    DeployedVersionSummary -> Natural
applicationVersion :: Prelude.Natural,
    -- | The status of the deployment.
    DeployedVersionSummary -> DeploymentLifecycle
status :: DeploymentLifecycle
  }
  deriving (DeployedVersionSummary -> DeployedVersionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeployedVersionSummary -> DeployedVersionSummary -> Bool
$c/= :: DeployedVersionSummary -> DeployedVersionSummary -> Bool
== :: DeployedVersionSummary -> DeployedVersionSummary -> Bool
$c== :: DeployedVersionSummary -> DeployedVersionSummary -> Bool
Prelude.Eq, ReadPrec [DeployedVersionSummary]
ReadPrec DeployedVersionSummary
Int -> ReadS DeployedVersionSummary
ReadS [DeployedVersionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeployedVersionSummary]
$creadListPrec :: ReadPrec [DeployedVersionSummary]
readPrec :: ReadPrec DeployedVersionSummary
$creadPrec :: ReadPrec DeployedVersionSummary
readList :: ReadS [DeployedVersionSummary]
$creadList :: ReadS [DeployedVersionSummary]
readsPrec :: Int -> ReadS DeployedVersionSummary
$creadsPrec :: Int -> ReadS DeployedVersionSummary
Prelude.Read, Int -> DeployedVersionSummary -> ShowS
[DeployedVersionSummary] -> ShowS
DeployedVersionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeployedVersionSummary] -> ShowS
$cshowList :: [DeployedVersionSummary] -> ShowS
show :: DeployedVersionSummary -> String
$cshow :: DeployedVersionSummary -> String
showsPrec :: Int -> DeployedVersionSummary -> ShowS
$cshowsPrec :: Int -> DeployedVersionSummary -> ShowS
Prelude.Show, forall x. Rep DeployedVersionSummary x -> DeployedVersionSummary
forall x. DeployedVersionSummary -> Rep DeployedVersionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeployedVersionSummary x -> DeployedVersionSummary
$cfrom :: forall x. DeployedVersionSummary -> Rep DeployedVersionSummary x
Prelude.Generic)

-- |
-- Create a value of 'DeployedVersionSummary' 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', 'deployedVersionSummary_statusReason' - The reason for the reported status.
--
-- 'applicationVersion', 'deployedVersionSummary_applicationVersion' - The version of the deployed application.
--
-- 'status', 'deployedVersionSummary_status' - The status of the deployment.
newDeployedVersionSummary ::
  -- | 'applicationVersion'
  Prelude.Natural ->
  -- | 'status'
  DeploymentLifecycle ->
  DeployedVersionSummary
newDeployedVersionSummary :: Natural -> DeploymentLifecycle -> DeployedVersionSummary
newDeployedVersionSummary
  Natural
pApplicationVersion_
  DeploymentLifecycle
pStatus_ =
    DeployedVersionSummary'
      { $sel:statusReason:DeployedVersionSummary' :: Maybe Text
statusReason =
          forall a. Maybe a
Prelude.Nothing,
        $sel:applicationVersion:DeployedVersionSummary' :: Natural
applicationVersion = Natural
pApplicationVersion_,
        $sel:status:DeployedVersionSummary' :: DeploymentLifecycle
status = DeploymentLifecycle
pStatus_
      }

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

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

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

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

instance Prelude.Hashable DeployedVersionSummary where
  hashWithSalt :: Int -> DeployedVersionSummary -> Int
hashWithSalt Int
_salt DeployedVersionSummary' {Natural
Maybe Text
DeploymentLifecycle
status :: DeploymentLifecycle
applicationVersion :: Natural
statusReason :: Maybe Text
$sel:status:DeployedVersionSummary' :: DeployedVersionSummary -> DeploymentLifecycle
$sel:applicationVersion:DeployedVersionSummary' :: DeployedVersionSummary -> Natural
$sel:statusReason:DeployedVersionSummary' :: DeployedVersionSummary -> 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` Natural
applicationVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DeploymentLifecycle
status

instance Prelude.NFData DeployedVersionSummary where
  rnf :: DeployedVersionSummary -> ()
rnf DeployedVersionSummary' {Natural
Maybe Text
DeploymentLifecycle
status :: DeploymentLifecycle
applicationVersion :: Natural
statusReason :: Maybe Text
$sel:status:DeployedVersionSummary' :: DeployedVersionSummary -> DeploymentLifecycle
$sel:applicationVersion:DeployedVersionSummary' :: DeployedVersionSummary -> Natural
$sel:statusReason:DeployedVersionSummary' :: DeployedVersionSummary -> 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 Natural
applicationVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DeploymentLifecycle
status