{-# 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.AppMesh.Types.MeshStatus
-- 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.AppMesh.Types.MeshStatus where

import Amazonka.AppMesh.Types.MeshStatusCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that represents the status of a service mesh.
--
-- /See:/ 'newMeshStatus' smart constructor.
data MeshStatus = MeshStatus'
  { -- | The current mesh status.
    MeshStatus -> Maybe MeshStatusCode
status :: Prelude.Maybe MeshStatusCode
  }
  deriving (MeshStatus -> MeshStatus -> Bool
(MeshStatus -> MeshStatus -> Bool)
-> (MeshStatus -> MeshStatus -> Bool) -> Eq MeshStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MeshStatus -> MeshStatus -> Bool
$c/= :: MeshStatus -> MeshStatus -> Bool
== :: MeshStatus -> MeshStatus -> Bool
$c== :: MeshStatus -> MeshStatus -> Bool
Prelude.Eq, ReadPrec [MeshStatus]
ReadPrec MeshStatus
Int -> ReadS MeshStatus
ReadS [MeshStatus]
(Int -> ReadS MeshStatus)
-> ReadS [MeshStatus]
-> ReadPrec MeshStatus
-> ReadPrec [MeshStatus]
-> Read MeshStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MeshStatus]
$creadListPrec :: ReadPrec [MeshStatus]
readPrec :: ReadPrec MeshStatus
$creadPrec :: ReadPrec MeshStatus
readList :: ReadS [MeshStatus]
$creadList :: ReadS [MeshStatus]
readsPrec :: Int -> ReadS MeshStatus
$creadsPrec :: Int -> ReadS MeshStatus
Prelude.Read, Int -> MeshStatus -> ShowS
[MeshStatus] -> ShowS
MeshStatus -> String
(Int -> MeshStatus -> ShowS)
-> (MeshStatus -> String)
-> ([MeshStatus] -> ShowS)
-> Show MeshStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MeshStatus] -> ShowS
$cshowList :: [MeshStatus] -> ShowS
show :: MeshStatus -> String
$cshow :: MeshStatus -> String
showsPrec :: Int -> MeshStatus -> ShowS
$cshowsPrec :: Int -> MeshStatus -> ShowS
Prelude.Show, (forall x. MeshStatus -> Rep MeshStatus x)
-> (forall x. Rep MeshStatus x -> MeshStatus) -> Generic MeshStatus
forall x. Rep MeshStatus x -> MeshStatus
forall x. MeshStatus -> Rep MeshStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MeshStatus x -> MeshStatus
$cfrom :: forall x. MeshStatus -> Rep MeshStatus x
Prelude.Generic)

-- |
-- Create a value of 'MeshStatus' 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:
--
-- 'status', 'meshStatus_status' - The current mesh status.
newMeshStatus ::
  MeshStatus
newMeshStatus :: MeshStatus
newMeshStatus = MeshStatus' :: Maybe MeshStatusCode -> MeshStatus
MeshStatus' {$sel:status:MeshStatus' :: Maybe MeshStatusCode
status = Maybe MeshStatusCode
forall a. Maybe a
Prelude.Nothing}

-- | The current mesh status.
meshStatus_status :: Lens.Lens' MeshStatus (Prelude.Maybe MeshStatusCode)
meshStatus_status :: (Maybe MeshStatusCode -> f (Maybe MeshStatusCode))
-> MeshStatus -> f MeshStatus
meshStatus_status = (MeshStatus -> Maybe MeshStatusCode)
-> (MeshStatus -> Maybe MeshStatusCode -> MeshStatus)
-> Lens
     MeshStatus MeshStatus (Maybe MeshStatusCode) (Maybe MeshStatusCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MeshStatus' {Maybe MeshStatusCode
status :: Maybe MeshStatusCode
$sel:status:MeshStatus' :: MeshStatus -> Maybe MeshStatusCode
status} -> Maybe MeshStatusCode
status) (\s :: MeshStatus
s@MeshStatus' {} Maybe MeshStatusCode
a -> MeshStatus
s {$sel:status:MeshStatus' :: Maybe MeshStatusCode
status = Maybe MeshStatusCode
a} :: MeshStatus)

instance Core.FromJSON MeshStatus where
  parseJSON :: Value -> Parser MeshStatus
parseJSON =
    String
-> (Object -> Parser MeshStatus) -> Value -> Parser MeshStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MeshStatus"
      ( \Object
x ->
          Maybe MeshStatusCode -> MeshStatus
MeshStatus' (Maybe MeshStatusCode -> MeshStatus)
-> Parser (Maybe MeshStatusCode) -> Parser MeshStatus
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MeshStatusCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
      )

instance Prelude.Hashable MeshStatus

instance Prelude.NFData MeshStatus