{-# 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.DeploymentOverview
-- 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.DeploymentOverview where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the deployment status of the instances in the
-- deployment.
--
-- /See:/ 'newDeploymentOverview' smart constructor.
data DeploymentOverview = DeploymentOverview'
  { -- | The number of instances in the deployment in a pending state.
    DeploymentOverview -> Maybe Integer
pending :: Prelude.Maybe Prelude.Integer,
    -- | The number of instances in the deployment in a skipped state.
    DeploymentOverview -> Maybe Integer
skipped :: Prelude.Maybe Prelude.Integer,
    -- | The number of instances in which the deployment is in progress.
    DeploymentOverview -> Maybe Integer
inProgress :: Prelude.Maybe Prelude.Integer,
    -- | The number of instances in the deployment to which revisions have been
    -- successfully deployed.
    DeploymentOverview -> Maybe Integer
succeeded :: Prelude.Maybe Prelude.Integer,
    -- | The number of instances in a replacement environment ready to receive
    -- traffic in a blue\/green deployment.
    DeploymentOverview -> Maybe Integer
ready :: Prelude.Maybe Prelude.Integer,
    -- | The number of instances in the deployment in a failed state.
    DeploymentOverview -> Maybe Integer
failed :: Prelude.Maybe Prelude.Integer
  }
  deriving (DeploymentOverview -> DeploymentOverview -> Bool
(DeploymentOverview -> DeploymentOverview -> Bool)
-> (DeploymentOverview -> DeploymentOverview -> Bool)
-> Eq DeploymentOverview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentOverview -> DeploymentOverview -> Bool
$c/= :: DeploymentOverview -> DeploymentOverview -> Bool
== :: DeploymentOverview -> DeploymentOverview -> Bool
$c== :: DeploymentOverview -> DeploymentOverview -> Bool
Prelude.Eq, ReadPrec [DeploymentOverview]
ReadPrec DeploymentOverview
Int -> ReadS DeploymentOverview
ReadS [DeploymentOverview]
(Int -> ReadS DeploymentOverview)
-> ReadS [DeploymentOverview]
-> ReadPrec DeploymentOverview
-> ReadPrec [DeploymentOverview]
-> Read DeploymentOverview
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentOverview]
$creadListPrec :: ReadPrec [DeploymentOverview]
readPrec :: ReadPrec DeploymentOverview
$creadPrec :: ReadPrec DeploymentOverview
readList :: ReadS [DeploymentOverview]
$creadList :: ReadS [DeploymentOverview]
readsPrec :: Int -> ReadS DeploymentOverview
$creadsPrec :: Int -> ReadS DeploymentOverview
Prelude.Read, Int -> DeploymentOverview -> ShowS
[DeploymentOverview] -> ShowS
DeploymentOverview -> String
(Int -> DeploymentOverview -> ShowS)
-> (DeploymentOverview -> String)
-> ([DeploymentOverview] -> ShowS)
-> Show DeploymentOverview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentOverview] -> ShowS
$cshowList :: [DeploymentOverview] -> ShowS
show :: DeploymentOverview -> String
$cshow :: DeploymentOverview -> String
showsPrec :: Int -> DeploymentOverview -> ShowS
$cshowsPrec :: Int -> DeploymentOverview -> ShowS
Prelude.Show, (forall x. DeploymentOverview -> Rep DeploymentOverview x)
-> (forall x. Rep DeploymentOverview x -> DeploymentOverview)
-> Generic DeploymentOverview
forall x. Rep DeploymentOverview x -> DeploymentOverview
forall x. DeploymentOverview -> Rep DeploymentOverview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentOverview x -> DeploymentOverview
$cfrom :: forall x. DeploymentOverview -> Rep DeploymentOverview x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentOverview' 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:
--
-- 'pending', 'deploymentOverview_pending' - The number of instances in the deployment in a pending state.
--
-- 'skipped', 'deploymentOverview_skipped' - The number of instances in the deployment in a skipped state.
--
-- 'inProgress', 'deploymentOverview_inProgress' - The number of instances in which the deployment is in progress.
--
-- 'succeeded', 'deploymentOverview_succeeded' - The number of instances in the deployment to which revisions have been
-- successfully deployed.
--
-- 'ready', 'deploymentOverview_ready' - The number of instances in a replacement environment ready to receive
-- traffic in a blue\/green deployment.
--
-- 'failed', 'deploymentOverview_failed' - The number of instances in the deployment in a failed state.
newDeploymentOverview ::
  DeploymentOverview
newDeploymentOverview :: DeploymentOverview
newDeploymentOverview =
  DeploymentOverview' :: Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> DeploymentOverview
DeploymentOverview'
    { $sel:pending:DeploymentOverview' :: Maybe Integer
pending = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:skipped:DeploymentOverview' :: Maybe Integer
skipped = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:inProgress:DeploymentOverview' :: Maybe Integer
inProgress = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:succeeded:DeploymentOverview' :: Maybe Integer
succeeded = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:ready:DeploymentOverview' :: Maybe Integer
ready = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:failed:DeploymentOverview' :: Maybe Integer
failed = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of instances in the deployment in a pending state.
deploymentOverview_pending :: Lens.Lens' DeploymentOverview (Prelude.Maybe Prelude.Integer)
deploymentOverview_pending :: (Maybe Integer -> f (Maybe Integer))
-> DeploymentOverview -> f DeploymentOverview
deploymentOverview_pending = (DeploymentOverview -> Maybe Integer)
-> (DeploymentOverview -> Maybe Integer -> DeploymentOverview)
-> Lens
     DeploymentOverview
     DeploymentOverview
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentOverview' {Maybe Integer
pending :: Maybe Integer
$sel:pending:DeploymentOverview' :: DeploymentOverview -> Maybe Integer
pending} -> Maybe Integer
pending) (\s :: DeploymentOverview
s@DeploymentOverview' {} Maybe Integer
a -> DeploymentOverview
s {$sel:pending:DeploymentOverview' :: Maybe Integer
pending = Maybe Integer
a} :: DeploymentOverview)

-- | The number of instances in the deployment in a skipped state.
deploymentOverview_skipped :: Lens.Lens' DeploymentOverview (Prelude.Maybe Prelude.Integer)
deploymentOverview_skipped :: (Maybe Integer -> f (Maybe Integer))
-> DeploymentOverview -> f DeploymentOverview
deploymentOverview_skipped = (DeploymentOverview -> Maybe Integer)
-> (DeploymentOverview -> Maybe Integer -> DeploymentOverview)
-> Lens
     DeploymentOverview
     DeploymentOverview
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentOverview' {Maybe Integer
skipped :: Maybe Integer
$sel:skipped:DeploymentOverview' :: DeploymentOverview -> Maybe Integer
skipped} -> Maybe Integer
skipped) (\s :: DeploymentOverview
s@DeploymentOverview' {} Maybe Integer
a -> DeploymentOverview
s {$sel:skipped:DeploymentOverview' :: Maybe Integer
skipped = Maybe Integer
a} :: DeploymentOverview)

-- | The number of instances in which the deployment is in progress.
deploymentOverview_inProgress :: Lens.Lens' DeploymentOverview (Prelude.Maybe Prelude.Integer)
deploymentOverview_inProgress :: (Maybe Integer -> f (Maybe Integer))
-> DeploymentOverview -> f DeploymentOverview
deploymentOverview_inProgress = (DeploymentOverview -> Maybe Integer)
-> (DeploymentOverview -> Maybe Integer -> DeploymentOverview)
-> Lens
     DeploymentOverview
     DeploymentOverview
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentOverview' {Maybe Integer
inProgress :: Maybe Integer
$sel:inProgress:DeploymentOverview' :: DeploymentOverview -> Maybe Integer
inProgress} -> Maybe Integer
inProgress) (\s :: DeploymentOverview
s@DeploymentOverview' {} Maybe Integer
a -> DeploymentOverview
s {$sel:inProgress:DeploymentOverview' :: Maybe Integer
inProgress = Maybe Integer
a} :: DeploymentOverview)

-- | The number of instances in the deployment to which revisions have been
-- successfully deployed.
deploymentOverview_succeeded :: Lens.Lens' DeploymentOverview (Prelude.Maybe Prelude.Integer)
deploymentOverview_succeeded :: (Maybe Integer -> f (Maybe Integer))
-> DeploymentOverview -> f DeploymentOverview
deploymentOverview_succeeded = (DeploymentOverview -> Maybe Integer)
-> (DeploymentOverview -> Maybe Integer -> DeploymentOverview)
-> Lens
     DeploymentOverview
     DeploymentOverview
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentOverview' {Maybe Integer
succeeded :: Maybe Integer
$sel:succeeded:DeploymentOverview' :: DeploymentOverview -> Maybe Integer
succeeded} -> Maybe Integer
succeeded) (\s :: DeploymentOverview
s@DeploymentOverview' {} Maybe Integer
a -> DeploymentOverview
s {$sel:succeeded:DeploymentOverview' :: Maybe Integer
succeeded = Maybe Integer
a} :: DeploymentOverview)

-- | The number of instances in a replacement environment ready to receive
-- traffic in a blue\/green deployment.
deploymentOverview_ready :: Lens.Lens' DeploymentOverview (Prelude.Maybe Prelude.Integer)
deploymentOverview_ready :: (Maybe Integer -> f (Maybe Integer))
-> DeploymentOverview -> f DeploymentOverview
deploymentOverview_ready = (DeploymentOverview -> Maybe Integer)
-> (DeploymentOverview -> Maybe Integer -> DeploymentOverview)
-> Lens
     DeploymentOverview
     DeploymentOverview
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentOverview' {Maybe Integer
ready :: Maybe Integer
$sel:ready:DeploymentOverview' :: DeploymentOverview -> Maybe Integer
ready} -> Maybe Integer
ready) (\s :: DeploymentOverview
s@DeploymentOverview' {} Maybe Integer
a -> DeploymentOverview
s {$sel:ready:DeploymentOverview' :: Maybe Integer
ready = Maybe Integer
a} :: DeploymentOverview)

-- | The number of instances in the deployment in a failed state.
deploymentOverview_failed :: Lens.Lens' DeploymentOverview (Prelude.Maybe Prelude.Integer)
deploymentOverview_failed :: (Maybe Integer -> f (Maybe Integer))
-> DeploymentOverview -> f DeploymentOverview
deploymentOverview_failed = (DeploymentOverview -> Maybe Integer)
-> (DeploymentOverview -> Maybe Integer -> DeploymentOverview)
-> Lens
     DeploymentOverview
     DeploymentOverview
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentOverview' {Maybe Integer
failed :: Maybe Integer
$sel:failed:DeploymentOverview' :: DeploymentOverview -> Maybe Integer
failed} -> Maybe Integer
failed) (\s :: DeploymentOverview
s@DeploymentOverview' {} Maybe Integer
a -> DeploymentOverview
s {$sel:failed:DeploymentOverview' :: Maybe Integer
failed = Maybe Integer
a} :: DeploymentOverview)

instance Core.FromJSON DeploymentOverview where
  parseJSON :: Value -> Parser DeploymentOverview
parseJSON =
    String
-> (Object -> Parser DeploymentOverview)
-> Value
-> Parser DeploymentOverview
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeploymentOverview"
      ( \Object
x ->
          Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> Maybe Integer
-> DeploymentOverview
DeploymentOverview'
            (Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> Maybe Integer
 -> DeploymentOverview)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> DeploymentOverview)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Pending")
            Parser
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> DeploymentOverview)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> Maybe Integer
      -> DeploymentOverview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Skipped")
            Parser
  (Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> Maybe Integer
   -> DeploymentOverview)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Integer
      -> Maybe Integer -> Maybe Integer -> DeploymentOverview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InProgress")
            Parser
  (Maybe Integer
   -> Maybe Integer -> Maybe Integer -> DeploymentOverview)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> Maybe Integer -> DeploymentOverview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Succeeded")
            Parser (Maybe Integer -> Maybe Integer -> DeploymentOverview)
-> Parser (Maybe Integer)
-> Parser (Maybe Integer -> DeploymentOverview)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Ready")
            Parser (Maybe Integer -> DeploymentOverview)
-> Parser (Maybe Integer) -> Parser DeploymentOverview
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Failed")
      )

instance Prelude.Hashable DeploymentOverview

instance Prelude.NFData DeploymentOverview