{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticBeanstalk.Types.InstanceHealthSummary where

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

-- | 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'
  { -- | __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,
    -- | __Grey.__ AWS Elastic Beanstalk and the health agent are reporting no
    -- data on an instance.
    InstanceHealthSummary -> Maybe Int
noData :: Prelude.Maybe Prelude.Int,
    -- | __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,
    -- | __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
  }
  deriving (InstanceHealthSummary -> InstanceHealthSummary -> Bool
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]
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
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. 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:
--
-- '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.
--
-- 'noData', 'instanceHealthSummary_noData' - __Grey.__ AWS Elastic Beanstalk and the health agent are reporting no
-- data on an instance.
--
-- '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.
--
-- 'warning', 'instanceHealthSummary_warning' - __Yellow.__ The health agent is reporting a moderate number of request
-- failures or other issues for an instance or environment.
newInstanceHealthSummary ::
  InstanceHealthSummary
newInstanceHealthSummary :: InstanceHealthSummary
newInstanceHealthSummary =
  InstanceHealthSummary'
    { $sel:degraded:InstanceHealthSummary' :: Maybe Int
degraded = forall a. Maybe a
Prelude.Nothing,
      $sel:info:InstanceHealthSummary' :: Maybe Int
info = forall a. Maybe a
Prelude.Nothing,
      $sel:noData:InstanceHealthSummary' :: Maybe Int
noData = forall a. Maybe a
Prelude.Nothing,
      $sel:ok:InstanceHealthSummary' :: Maybe Int
ok = forall a. Maybe a
Prelude.Nothing,
      $sel:pending:InstanceHealthSummary' :: Maybe Int
pending = forall a. Maybe a
Prelude.Nothing,
      $sel:severe:InstanceHealthSummary' :: Maybe Int
severe = forall a. Maybe a
Prelude.Nothing,
      $sel:unknown:InstanceHealthSummary' :: Maybe Int
unknown = forall a. Maybe a
Prelude.Nothing,
      $sel:warning:InstanceHealthSummary' :: Maybe Int
warning = forall a. Maybe a
Prelude.Nothing
    }

-- | __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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_degraded = 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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_info = 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)

-- | __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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_noData = 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)

-- | __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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_ok = 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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_pending = 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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_severe = 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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_unknown = 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)

-- | __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 :: Lens' InstanceHealthSummary (Maybe Int)
instanceHealthSummary_warning = 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)

instance Data.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'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Degraded")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Info")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NoData")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Ok")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Pending")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Severe")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Unknown")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Warning")

instance Prelude.Hashable InstanceHealthSummary where
  hashWithSalt :: Int -> InstanceHealthSummary -> Int
hashWithSalt Int
_salt InstanceHealthSummary' {Maybe Int
warning :: Maybe Int
unknown :: Maybe Int
severe :: Maybe Int
pending :: Maybe Int
ok :: Maybe Int
noData :: Maybe Int
info :: Maybe Int
degraded :: Maybe Int
$sel:warning:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:unknown:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:severe:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:pending:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:ok:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:noData:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:info:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:degraded:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
degraded
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
info
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
noData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
ok
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
pending
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
severe
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
unknown
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
warning

instance Prelude.NFData InstanceHealthSummary where
  rnf :: InstanceHealthSummary -> ()
rnf InstanceHealthSummary' {Maybe Int
warning :: Maybe Int
unknown :: Maybe Int
severe :: Maybe Int
pending :: Maybe Int
ok :: Maybe Int
noData :: Maybe Int
info :: Maybe Int
degraded :: Maybe Int
$sel:warning:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:unknown:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:severe:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:pending:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:ok:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:noData:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:info:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
$sel:degraded:InstanceHealthSummary' :: InstanceHealthSummary -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
degraded
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
info
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
noData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
ok
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
pending
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
severe
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
unknown
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
warning