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

import Amazonka.AppMesh.Types.VirtualServiceStatusCode
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 virtual service.
--
-- /See:/ 'newVirtualServiceStatus' smart constructor.
data VirtualServiceStatus = VirtualServiceStatus'
  { -- | The current status of the virtual service.
    VirtualServiceStatus -> VirtualServiceStatusCode
status :: VirtualServiceStatusCode
  }
  deriving (VirtualServiceStatus -> VirtualServiceStatus -> Bool
(VirtualServiceStatus -> VirtualServiceStatus -> Bool)
-> (VirtualServiceStatus -> VirtualServiceStatus -> Bool)
-> Eq VirtualServiceStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualServiceStatus -> VirtualServiceStatus -> Bool
$c/= :: VirtualServiceStatus -> VirtualServiceStatus -> Bool
== :: VirtualServiceStatus -> VirtualServiceStatus -> Bool
$c== :: VirtualServiceStatus -> VirtualServiceStatus -> Bool
Prelude.Eq, ReadPrec [VirtualServiceStatus]
ReadPrec VirtualServiceStatus
Int -> ReadS VirtualServiceStatus
ReadS [VirtualServiceStatus]
(Int -> ReadS VirtualServiceStatus)
-> ReadS [VirtualServiceStatus]
-> ReadPrec VirtualServiceStatus
-> ReadPrec [VirtualServiceStatus]
-> Read VirtualServiceStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualServiceStatus]
$creadListPrec :: ReadPrec [VirtualServiceStatus]
readPrec :: ReadPrec VirtualServiceStatus
$creadPrec :: ReadPrec VirtualServiceStatus
readList :: ReadS [VirtualServiceStatus]
$creadList :: ReadS [VirtualServiceStatus]
readsPrec :: Int -> ReadS VirtualServiceStatus
$creadsPrec :: Int -> ReadS VirtualServiceStatus
Prelude.Read, Int -> VirtualServiceStatus -> ShowS
[VirtualServiceStatus] -> ShowS
VirtualServiceStatus -> String
(Int -> VirtualServiceStatus -> ShowS)
-> (VirtualServiceStatus -> String)
-> ([VirtualServiceStatus] -> ShowS)
-> Show VirtualServiceStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualServiceStatus] -> ShowS
$cshowList :: [VirtualServiceStatus] -> ShowS
show :: VirtualServiceStatus -> String
$cshow :: VirtualServiceStatus -> String
showsPrec :: Int -> VirtualServiceStatus -> ShowS
$cshowsPrec :: Int -> VirtualServiceStatus -> ShowS
Prelude.Show, (forall x. VirtualServiceStatus -> Rep VirtualServiceStatus x)
-> (forall x. Rep VirtualServiceStatus x -> VirtualServiceStatus)
-> Generic VirtualServiceStatus
forall x. Rep VirtualServiceStatus x -> VirtualServiceStatus
forall x. VirtualServiceStatus -> Rep VirtualServiceStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VirtualServiceStatus x -> VirtualServiceStatus
$cfrom :: forall x. VirtualServiceStatus -> Rep VirtualServiceStatus x
Prelude.Generic)

-- |
-- Create a value of 'VirtualServiceStatus' 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', 'virtualServiceStatus_status' - The current status of the virtual service.
newVirtualServiceStatus ::
  -- | 'status'
  VirtualServiceStatusCode ->
  VirtualServiceStatus
newVirtualServiceStatus :: VirtualServiceStatusCode -> VirtualServiceStatus
newVirtualServiceStatus VirtualServiceStatusCode
pStatus_ =
  VirtualServiceStatus' :: VirtualServiceStatusCode -> VirtualServiceStatus
VirtualServiceStatus' {$sel:status:VirtualServiceStatus' :: VirtualServiceStatusCode
status = VirtualServiceStatusCode
pStatus_}

-- | The current status of the virtual service.
virtualServiceStatus_status :: Lens.Lens' VirtualServiceStatus VirtualServiceStatusCode
virtualServiceStatus_status :: (VirtualServiceStatusCode -> f VirtualServiceStatusCode)
-> VirtualServiceStatus -> f VirtualServiceStatus
virtualServiceStatus_status = (VirtualServiceStatus -> VirtualServiceStatusCode)
-> (VirtualServiceStatus
    -> VirtualServiceStatusCode -> VirtualServiceStatus)
-> Lens
     VirtualServiceStatus
     VirtualServiceStatus
     VirtualServiceStatusCode
     VirtualServiceStatusCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualServiceStatus' {VirtualServiceStatusCode
status :: VirtualServiceStatusCode
$sel:status:VirtualServiceStatus' :: VirtualServiceStatus -> VirtualServiceStatusCode
status} -> VirtualServiceStatusCode
status) (\s :: VirtualServiceStatus
s@VirtualServiceStatus' {} VirtualServiceStatusCode
a -> VirtualServiceStatus
s {$sel:status:VirtualServiceStatus' :: VirtualServiceStatusCode
status = VirtualServiceStatusCode
a} :: VirtualServiceStatus)

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

instance Prelude.Hashable VirtualServiceStatus

instance Prelude.NFData VirtualServiceStatus