{-# 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.ElasticBeanstalk.Types.InstanceHealthSummary
-- 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.ElasticBeanstalk.Types.InstanceHealthSummary where

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

-- | Represents summary information about the health of an instance. For more
-- information, see
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced-status.html Health Colors and Statuses>.
--
-- /See:/ 'newInstanceHealthSummary' smart constructor.
data InstanceHealthSummary = InstanceHealthSummary'
  { -- | __Green.__ An instance is passing health checks and the health agent is
    -- not reporting any problems.
    InstanceHealthSummary -> Maybe Int
ok :: Prelude.Maybe Prelude.Int,
    -- | __Grey.__ An operation is in progress on an instance within the command
    -- timeout.
    InstanceHealthSummary -> Maybe Int
pending :: Prelude.Maybe Prelude.Int,
    -- | __Red.__ The health agent is reporting a very high number of request
    -- failures or other issues for an instance or environment.
    InstanceHealthSummary -> Maybe Int
severe :: Prelude.Maybe Prelude.Int,
    -- | __Grey.__ AWS Elastic Beanstalk and the health agent are reporting an
    -- insufficient amount of data on an instance.
    InstanceHealthSummary -> Maybe Int
unknown :: Prelude.Maybe Prelude.Int,
    -- | __Grey.__ AWS Elastic Beanstalk and the health agent are reporting no
    -- data on an instance.
    InstanceHealthSummary -> Maybe Int
noData :: Prelude.Maybe Prelude.Int,
    -- | __Yellow.__ The health agent is reporting a moderate number of request
    -- failures or other issues for an instance or environment.
    InstanceHealthSummary -> Maybe Int
warning :: Prelude.Maybe Prelude.Int,
    -- | __Red.__ The health agent is reporting a high number of request failures
    -- or other issues for an instance or environment.
    InstanceHealthSummary -> Maybe Int
degraded :: Prelude.Maybe Prelude.Int,
    -- | __Green.__ An operation is in progress on an instance.
    InstanceHealthSummary -> Maybe Int
info :: Prelude.Maybe Prelude.Int
  }
  deriving (InstanceHealthSummary -> InstanceHealthSummary -> Bool
(InstanceHealthSummary -> InstanceHealthSummary -> Bool)
-> (InstanceHealthSummary -> InstanceHealthSummary -> Bool)
-> Eq InstanceHealthSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceHealthSummary -> InstanceHealthSummary -> Bool
$c/= :: InstanceHealthSummary -> InstanceHealthSummary -> Bool
== :: InstanceHealthSummary -> InstanceHealthSummary -> Bool
$c== :: InstanceHealthSummary -> InstanceHealthSummary -> Bool
Prelude.Eq, ReadPrec [InstanceHealthSummary]
ReadPrec InstanceHealthSummary
Int -> ReadS InstanceHealthSummary
ReadS [InstanceHealthSummary]
(Int -> ReadS InstanceHealthSummary)
-> ReadS [InstanceHealthSummary]
-> ReadPrec InstanceHealthSummary
-> ReadPrec [InstanceHealthSummary]
-> Read InstanceHealthSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceHealthSummary]
$creadListPrec :: ReadPrec [InstanceHealthSummary]
readPrec :: ReadPrec InstanceHealthSummary
$creadPrec :: ReadPrec InstanceHealthSummary
readList :: ReadS [InstanceHealthSummary]
$creadList :: ReadS [InstanceHealthSummary]
readsPrec :: Int -> ReadS InstanceHealthSummary
$creadsPrec :: Int -> ReadS InstanceHealthSummary
Prelude.Read, Int -> InstanceHealthSummary -> ShowS
[InstanceHealthSummary] -> ShowS
InstanceHealthSummary -> String
(Int -> InstanceHealthSummary -> ShowS)
-> (InstanceHealthSummary -> String)
-> ([InstanceHealthSummary] -> ShowS)
-> Show InstanceHealthSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceHealthSummary] -> ShowS
$cshowList :: [InstanceHealthSummary] -> ShowS
show :: InstanceHealthSummary -> String
$cshow :: InstanceHealthSummary -> String
showsPrec :: Int -> InstanceHealthSummary -> ShowS
$cshowsPrec :: Int -> InstanceHealthSummary -> ShowS
Prelude.Show, (forall x. InstanceHealthSummary -> Rep InstanceHealthSummary x)
-> (forall x. Rep InstanceHealthSummary x -> InstanceHealthSummary)
-> Generic InstanceHealthSummary
forall x. Rep InstanceHealthSummary x -> InstanceHealthSummary
forall x. InstanceHealthSummary -> Rep InstanceHealthSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceHealthSummary x -> InstanceHealthSummary
$cfrom :: forall x. InstanceHealthSummary -> Rep InstanceHealthSummary x
Prelude.Generic)

-- |
-- Create a value of 'InstanceHealthSummary' 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:
--
-- 'ok', 'instanceHealthSummary_ok' - __Green.__ An instance is passing health checks and the health agent is
-- not reporting any problems.
--
-- 'pending', 'instanceHealthSummary_pending' - __Grey.__ An operation is in progress on an instance within the command
-- timeout.
--
-- 'severe', 'instanceHealthSummary_severe' - __Red.__ The health agent is reporting a very high number of request
-- failures or other issues for an instance or environment.
--
-- 'unknown', 'instanceHealthSummary_unknown' - __Grey.__ AWS Elastic Beanstalk and the health agent are reporting an
-- insufficient amount of data on an instance.
--
-- 'noData', 'instanceHealthSummary_noData' - __Grey.__ AWS Elastic Beanstalk and the health agent are reporting no
-- data on an instance.
--
-- 'warning', 'instanceHealthSummary_warning' - __Yellow.__ The health agent is reporting a moderate number of request
-- failures or other issues for an instance or environment.
--
-- 'degraded', 'instanceHealthSummary_degraded' - __Red.__ The health agent is reporting a high number of request failures
-- or other issues for an instance or environment.
--
-- 'info', 'instanceHealthSummary_info' - __Green.__ An operation is in progress on an instance.
newInstanceHealthSummary ::
  InstanceHealthSummary
newInstanceHealthSummary :: InstanceHealthSummary
newInstanceHealthSummary =
  InstanceHealthSummary' :: Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> InstanceHealthSummary
InstanceHealthSummary'
    { $sel:ok:InstanceHealthSummary' :: Maybe Int
ok = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:pending:InstanceHealthSummary' :: Maybe Int
pending = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:severe:InstanceHealthSummary' :: Maybe Int
severe = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:unknown:InstanceHealthSummary' :: Maybe Int
unknown = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:noData:InstanceHealthSummary' :: Maybe Int
noData = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:warning:InstanceHealthSummary' :: Maybe Int
warning = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:degraded:InstanceHealthSummary' :: Maybe Int
degraded = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:info:InstanceHealthSummary' :: Maybe Int
info = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | __Green.__ An instance is passing health checks and the health agent is
-- not reporting any problems.
instanceHealthSummary_ok :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_ok :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_ok = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
ok :: Maybe Int
$sel:ok:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
ok} -> Maybe Int
ok) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:ok:InstanceHealthSummary' :: Maybe Int
ok = Maybe Int
a} :: InstanceHealthSummary)

-- | __Grey.__ An operation is in progress on an instance within the command
-- timeout.
instanceHealthSummary_pending :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_pending :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_pending = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
pending :: Maybe Int
$sel:pending:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
pending} -> Maybe Int
pending) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:pending:InstanceHealthSummary' :: Maybe Int
pending = Maybe Int
a} :: InstanceHealthSummary)

-- | __Red.__ The health agent is reporting a very high number of request
-- failures or other issues for an instance or environment.
instanceHealthSummary_severe :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_severe :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_severe = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
severe :: Maybe Int
$sel:severe:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
severe} -> Maybe Int
severe) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:severe:InstanceHealthSummary' :: Maybe Int
severe = Maybe Int
a} :: InstanceHealthSummary)

-- | __Grey.__ AWS Elastic Beanstalk and the health agent are reporting an
-- insufficient amount of data on an instance.
instanceHealthSummary_unknown :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_unknown :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_unknown = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
unknown :: Maybe Int
$sel:unknown:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
unknown} -> Maybe Int
unknown) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:unknown:InstanceHealthSummary' :: Maybe Int
unknown = Maybe Int
a} :: InstanceHealthSummary)

-- | __Grey.__ AWS Elastic Beanstalk and the health agent are reporting no
-- data on an instance.
instanceHealthSummary_noData :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_noData :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_noData = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
noData :: Maybe Int
$sel:noData:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
noData} -> Maybe Int
noData) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:noData:InstanceHealthSummary' :: Maybe Int
noData = Maybe Int
a} :: InstanceHealthSummary)

-- | __Yellow.__ The health agent is reporting a moderate number of request
-- failures or other issues for an instance or environment.
instanceHealthSummary_warning :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_warning :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_warning = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
warning :: Maybe Int
$sel:warning:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
warning} -> Maybe Int
warning) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:warning:InstanceHealthSummary' :: Maybe Int
warning = Maybe Int
a} :: InstanceHealthSummary)

-- | __Red.__ The health agent is reporting a high number of request failures
-- or other issues for an instance or environment.
instanceHealthSummary_degraded :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_degraded :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_degraded = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
degraded :: Maybe Int
$sel:degraded:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
degraded} -> Maybe Int
degraded) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:degraded:InstanceHealthSummary' :: Maybe Int
degraded = Maybe Int
a} :: InstanceHealthSummary)

-- | __Green.__ An operation is in progress on an instance.
instanceHealthSummary_info :: Lens.Lens' InstanceHealthSummary (Prelude.Maybe Prelude.Int)
instanceHealthSummary_info :: (Maybe Int -> f (Maybe Int))
-> InstanceHealthSummary -> f InstanceHealthSummary
instanceHealthSummary_info = (InstanceHealthSummary -> Maybe Int)
-> (InstanceHealthSummary -> Maybe Int -> InstanceHealthSummary)
-> Lens
     InstanceHealthSummary InstanceHealthSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceHealthSummary' {Maybe Int
info :: Maybe Int
$sel:info:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
info} -> Maybe Int
info) (\s :: InstanceHealthSummary
s@InstanceHealthSummary' {} Maybe Int
a -> InstanceHealthSummary
s {$sel:info:InstanceHealthSummary' :: Maybe Int
info = Maybe Int
a} :: InstanceHealthSummary)

instance Core.FromXML InstanceHealthSummary where
  parseXML :: [Node] -> Either String InstanceHealthSummary
parseXML [Node]
x =
    Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> InstanceHealthSummary
InstanceHealthSummary'
      (Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> InstanceHealthSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Ok")
      Either
  String
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> InstanceHealthSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Pending")
      Either
  String
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> InstanceHealthSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Severe")
      Either
  String
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int
      -> Maybe Int -> Maybe Int -> Maybe Int -> InstanceHealthSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Unknown")
      Either
  String
  (Maybe Int
   -> Maybe Int -> Maybe Int -> Maybe Int -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Int -> Maybe Int -> Maybe Int -> InstanceHealthSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NoData")
      Either
  String
  (Maybe Int -> Maybe Int -> Maybe Int -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either String (Maybe Int -> Maybe Int -> InstanceHealthSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Warning")
      Either String (Maybe Int -> Maybe Int -> InstanceHealthSummary)
-> Either String (Maybe Int)
-> Either String (Maybe Int -> InstanceHealthSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Degraded")
      Either String (Maybe Int -> InstanceHealthSummary)
-> Either String (Maybe Int) -> Either String InstanceHealthSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Info")

instance Prelude.Hashable InstanceHealthSummary

instance Prelude.NFData InstanceHealthSummary