{-# 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.AMP.Types.AlertManagerDefinitionStatus
-- 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.AMP.Types.AlertManagerDefinitionStatus where

import Amazonka.AMP.Types.AlertManagerDefinitionStatusCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the status of a definition.
--
-- /See:/ 'newAlertManagerDefinitionStatus' smart constructor.
data AlertManagerDefinitionStatus = AlertManagerDefinitionStatus'
  { -- | The reason for failure if any.
    AlertManagerDefinitionStatus -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text,
    -- | Status code of this definition.
    AlertManagerDefinitionStatus -> AlertManagerDefinitionStatusCode
statusCode :: AlertManagerDefinitionStatusCode
  }
  deriving (AlertManagerDefinitionStatus
-> AlertManagerDefinitionStatus -> Bool
(AlertManagerDefinitionStatus
 -> AlertManagerDefinitionStatus -> Bool)
-> (AlertManagerDefinitionStatus
    -> AlertManagerDefinitionStatus -> Bool)
-> Eq AlertManagerDefinitionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlertManagerDefinitionStatus
-> AlertManagerDefinitionStatus -> Bool
$c/= :: AlertManagerDefinitionStatus
-> AlertManagerDefinitionStatus -> Bool
== :: AlertManagerDefinitionStatus
-> AlertManagerDefinitionStatus -> Bool
$c== :: AlertManagerDefinitionStatus
-> AlertManagerDefinitionStatus -> Bool
Prelude.Eq, ReadPrec [AlertManagerDefinitionStatus]
ReadPrec AlertManagerDefinitionStatus
Int -> ReadS AlertManagerDefinitionStatus
ReadS [AlertManagerDefinitionStatus]
(Int -> ReadS AlertManagerDefinitionStatus)
-> ReadS [AlertManagerDefinitionStatus]
-> ReadPrec AlertManagerDefinitionStatus
-> ReadPrec [AlertManagerDefinitionStatus]
-> Read AlertManagerDefinitionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlertManagerDefinitionStatus]
$creadListPrec :: ReadPrec [AlertManagerDefinitionStatus]
readPrec :: ReadPrec AlertManagerDefinitionStatus
$creadPrec :: ReadPrec AlertManagerDefinitionStatus
readList :: ReadS [AlertManagerDefinitionStatus]
$creadList :: ReadS [AlertManagerDefinitionStatus]
readsPrec :: Int -> ReadS AlertManagerDefinitionStatus
$creadsPrec :: Int -> ReadS AlertManagerDefinitionStatus
Prelude.Read, Int -> AlertManagerDefinitionStatus -> ShowS
[AlertManagerDefinitionStatus] -> ShowS
AlertManagerDefinitionStatus -> String
(Int -> AlertManagerDefinitionStatus -> ShowS)
-> (AlertManagerDefinitionStatus -> String)
-> ([AlertManagerDefinitionStatus] -> ShowS)
-> Show AlertManagerDefinitionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlertManagerDefinitionStatus] -> ShowS
$cshowList :: [AlertManagerDefinitionStatus] -> ShowS
show :: AlertManagerDefinitionStatus -> String
$cshow :: AlertManagerDefinitionStatus -> String
showsPrec :: Int -> AlertManagerDefinitionStatus -> ShowS
$cshowsPrec :: Int -> AlertManagerDefinitionStatus -> ShowS
Prelude.Show, (forall x.
 AlertManagerDefinitionStatus -> Rep AlertManagerDefinitionStatus x)
-> (forall x.
    Rep AlertManagerDefinitionStatus x -> AlertManagerDefinitionStatus)
-> Generic AlertManagerDefinitionStatus
forall x.
Rep AlertManagerDefinitionStatus x -> AlertManagerDefinitionStatus
forall x.
AlertManagerDefinitionStatus -> Rep AlertManagerDefinitionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AlertManagerDefinitionStatus x -> AlertManagerDefinitionStatus
$cfrom :: forall x.
AlertManagerDefinitionStatus -> Rep AlertManagerDefinitionStatus x
Prelude.Generic)

-- |
-- Create a value of 'AlertManagerDefinitionStatus' 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:
--
-- 'statusReason', 'alertManagerDefinitionStatus_statusReason' - The reason for failure if any.
--
-- 'statusCode', 'alertManagerDefinitionStatus_statusCode' - Status code of this definition.
newAlertManagerDefinitionStatus ::
  -- | 'statusCode'
  AlertManagerDefinitionStatusCode ->
  AlertManagerDefinitionStatus
newAlertManagerDefinitionStatus :: AlertManagerDefinitionStatusCode -> AlertManagerDefinitionStatus
newAlertManagerDefinitionStatus AlertManagerDefinitionStatusCode
pStatusCode_ =
  AlertManagerDefinitionStatus' :: Maybe Text
-> AlertManagerDefinitionStatusCode -> AlertManagerDefinitionStatus
AlertManagerDefinitionStatus'
    { $sel:statusReason:AlertManagerDefinitionStatus' :: Maybe Text
statusReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:AlertManagerDefinitionStatus' :: AlertManagerDefinitionStatusCode
statusCode = AlertManagerDefinitionStatusCode
pStatusCode_
    }

-- | The reason for failure if any.
alertManagerDefinitionStatus_statusReason :: Lens.Lens' AlertManagerDefinitionStatus (Prelude.Maybe Prelude.Text)
alertManagerDefinitionStatus_statusReason :: (Maybe Text -> f (Maybe Text))
-> AlertManagerDefinitionStatus -> f AlertManagerDefinitionStatus
alertManagerDefinitionStatus_statusReason = (AlertManagerDefinitionStatus -> Maybe Text)
-> (AlertManagerDefinitionStatus
    -> Maybe Text -> AlertManagerDefinitionStatus)
-> Lens
     AlertManagerDefinitionStatus
     AlertManagerDefinitionStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertManagerDefinitionStatus' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:AlertManagerDefinitionStatus' :: AlertManagerDefinitionStatus -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: AlertManagerDefinitionStatus
s@AlertManagerDefinitionStatus' {} Maybe Text
a -> AlertManagerDefinitionStatus
s {$sel:statusReason:AlertManagerDefinitionStatus' :: Maybe Text
statusReason = Maybe Text
a} :: AlertManagerDefinitionStatus)

-- | Status code of this definition.
alertManagerDefinitionStatus_statusCode :: Lens.Lens' AlertManagerDefinitionStatus AlertManagerDefinitionStatusCode
alertManagerDefinitionStatus_statusCode :: (AlertManagerDefinitionStatusCode
 -> f AlertManagerDefinitionStatusCode)
-> AlertManagerDefinitionStatus -> f AlertManagerDefinitionStatus
alertManagerDefinitionStatus_statusCode = (AlertManagerDefinitionStatus -> AlertManagerDefinitionStatusCode)
-> (AlertManagerDefinitionStatus
    -> AlertManagerDefinitionStatusCode
    -> AlertManagerDefinitionStatus)
-> Lens
     AlertManagerDefinitionStatus
     AlertManagerDefinitionStatus
     AlertManagerDefinitionStatusCode
     AlertManagerDefinitionStatusCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlertManagerDefinitionStatus' {AlertManagerDefinitionStatusCode
statusCode :: AlertManagerDefinitionStatusCode
$sel:statusCode:AlertManagerDefinitionStatus' :: AlertManagerDefinitionStatus -> AlertManagerDefinitionStatusCode
statusCode} -> AlertManagerDefinitionStatusCode
statusCode) (\s :: AlertManagerDefinitionStatus
s@AlertManagerDefinitionStatus' {} AlertManagerDefinitionStatusCode
a -> AlertManagerDefinitionStatus
s {$sel:statusCode:AlertManagerDefinitionStatus' :: AlertManagerDefinitionStatusCode
statusCode = AlertManagerDefinitionStatusCode
a} :: AlertManagerDefinitionStatus)

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

instance
  Prelude.Hashable
    AlertManagerDefinitionStatus

instance Prelude.NFData AlertManagerDefinitionStatus