{-# 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.EKS.Types.NodegroupHealth
-- 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.EKS.Types.NodegroupHealth where

import qualified Amazonka.Core as Core
import Amazonka.EKS.Types.Issue
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing the health status of the node group.
--
-- /See:/ 'newNodegroupHealth' smart constructor.
data NodegroupHealth = NodegroupHealth'
  { -- | Any issues that are associated with the node group.
    NodegroupHealth -> Maybe [Issue]
issues :: Prelude.Maybe [Issue]
  }
  deriving (NodegroupHealth -> NodegroupHealth -> Bool
(NodegroupHealth -> NodegroupHealth -> Bool)
-> (NodegroupHealth -> NodegroupHealth -> Bool)
-> Eq NodegroupHealth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodegroupHealth -> NodegroupHealth -> Bool
$c/= :: NodegroupHealth -> NodegroupHealth -> Bool
== :: NodegroupHealth -> NodegroupHealth -> Bool
$c== :: NodegroupHealth -> NodegroupHealth -> Bool
Prelude.Eq, ReadPrec [NodegroupHealth]
ReadPrec NodegroupHealth
Int -> ReadS NodegroupHealth
ReadS [NodegroupHealth]
(Int -> ReadS NodegroupHealth)
-> ReadS [NodegroupHealth]
-> ReadPrec NodegroupHealth
-> ReadPrec [NodegroupHealth]
-> Read NodegroupHealth
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodegroupHealth]
$creadListPrec :: ReadPrec [NodegroupHealth]
readPrec :: ReadPrec NodegroupHealth
$creadPrec :: ReadPrec NodegroupHealth
readList :: ReadS [NodegroupHealth]
$creadList :: ReadS [NodegroupHealth]
readsPrec :: Int -> ReadS NodegroupHealth
$creadsPrec :: Int -> ReadS NodegroupHealth
Prelude.Read, Int -> NodegroupHealth -> ShowS
[NodegroupHealth] -> ShowS
NodegroupHealth -> String
(Int -> NodegroupHealth -> ShowS)
-> (NodegroupHealth -> String)
-> ([NodegroupHealth] -> ShowS)
-> Show NodegroupHealth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodegroupHealth] -> ShowS
$cshowList :: [NodegroupHealth] -> ShowS
show :: NodegroupHealth -> String
$cshow :: NodegroupHealth -> String
showsPrec :: Int -> NodegroupHealth -> ShowS
$cshowsPrec :: Int -> NodegroupHealth -> ShowS
Prelude.Show, (forall x. NodegroupHealth -> Rep NodegroupHealth x)
-> (forall x. Rep NodegroupHealth x -> NodegroupHealth)
-> Generic NodegroupHealth
forall x. Rep NodegroupHealth x -> NodegroupHealth
forall x. NodegroupHealth -> Rep NodegroupHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodegroupHealth x -> NodegroupHealth
$cfrom :: forall x. NodegroupHealth -> Rep NodegroupHealth x
Prelude.Generic)

-- |
-- Create a value of 'NodegroupHealth' 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:
--
-- 'issues', 'nodegroupHealth_issues' - Any issues that are associated with the node group.
newNodegroupHealth ::
  NodegroupHealth
newNodegroupHealth :: NodegroupHealth
newNodegroupHealth =
  NodegroupHealth' :: Maybe [Issue] -> NodegroupHealth
NodegroupHealth' {$sel:issues:NodegroupHealth' :: Maybe [Issue]
issues = Maybe [Issue]
forall a. Maybe a
Prelude.Nothing}

-- | Any issues that are associated with the node group.
nodegroupHealth_issues :: Lens.Lens' NodegroupHealth (Prelude.Maybe [Issue])
nodegroupHealth_issues :: (Maybe [Issue] -> f (Maybe [Issue]))
-> NodegroupHealth -> f NodegroupHealth
nodegroupHealth_issues = (NodegroupHealth -> Maybe [Issue])
-> (NodegroupHealth -> Maybe [Issue] -> NodegroupHealth)
-> Lens
     NodegroupHealth NodegroupHealth (Maybe [Issue]) (Maybe [Issue])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodegroupHealth' {Maybe [Issue]
issues :: Maybe [Issue]
$sel:issues:NodegroupHealth' :: NodegroupHealth -> Maybe [Issue]
issues} -> Maybe [Issue]
issues) (\s :: NodegroupHealth
s@NodegroupHealth' {} Maybe [Issue]
a -> NodegroupHealth
s {$sel:issues:NodegroupHealth' :: Maybe [Issue]
issues = Maybe [Issue]
a} :: NodegroupHealth) ((Maybe [Issue] -> f (Maybe [Issue]))
 -> NodegroupHealth -> f NodegroupHealth)
-> ((Maybe [Issue] -> f (Maybe [Issue]))
    -> Maybe [Issue] -> f (Maybe [Issue]))
-> (Maybe [Issue] -> f (Maybe [Issue]))
-> NodegroupHealth
-> f NodegroupHealth
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Issue] [Issue] [Issue] [Issue]
-> Iso
     (Maybe [Issue]) (Maybe [Issue]) (Maybe [Issue]) (Maybe [Issue])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Issue] [Issue] [Issue] [Issue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON NodegroupHealth where
  parseJSON :: Value -> Parser NodegroupHealth
parseJSON =
    String
-> (Object -> Parser NodegroupHealth)
-> Value
-> Parser NodegroupHealth
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodegroupHealth"
      ( \Object
x ->
          Maybe [Issue] -> NodegroupHealth
NodegroupHealth'
            (Maybe [Issue] -> NodegroupHealth)
-> Parser (Maybe [Issue]) -> Parser NodegroupHealth
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Issue]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"issues" Parser (Maybe (Maybe [Issue]))
-> Maybe [Issue] -> Parser (Maybe [Issue])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Issue]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable NodegroupHealth

instance Prelude.NFData NodegroupHealth