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

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

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

-- |
-- Create a value of 'RuleGroupsNamespaceStatus' 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', 'ruleGroupsNamespaceStatus_statusReason' - The reason for failure if any.
--
-- 'statusCode', 'ruleGroupsNamespaceStatus_statusCode' - Status code of this namespace.
newRuleGroupsNamespaceStatus ::
  -- | 'statusCode'
  RuleGroupsNamespaceStatusCode ->
  RuleGroupsNamespaceStatus
newRuleGroupsNamespaceStatus :: RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus
newRuleGroupsNamespaceStatus RuleGroupsNamespaceStatusCode
pStatusCode_ =
  RuleGroupsNamespaceStatus' :: Maybe Text
-> RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus
RuleGroupsNamespaceStatus'
    { $sel:statusReason:RuleGroupsNamespaceStatus' :: Maybe Text
statusReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusCode:RuleGroupsNamespaceStatus' :: RuleGroupsNamespaceStatusCode
statusCode = RuleGroupsNamespaceStatusCode
pStatusCode_
    }

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

-- | Status code of this namespace.
ruleGroupsNamespaceStatus_statusCode :: Lens.Lens' RuleGroupsNamespaceStatus RuleGroupsNamespaceStatusCode
ruleGroupsNamespaceStatus_statusCode :: (RuleGroupsNamespaceStatusCode -> f RuleGroupsNamespaceStatusCode)
-> RuleGroupsNamespaceStatus -> f RuleGroupsNamespaceStatus
ruleGroupsNamespaceStatus_statusCode = (RuleGroupsNamespaceStatus -> RuleGroupsNamespaceStatusCode)
-> (RuleGroupsNamespaceStatus
    -> RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus)
-> Lens
     RuleGroupsNamespaceStatus
     RuleGroupsNamespaceStatus
     RuleGroupsNamespaceStatusCode
     RuleGroupsNamespaceStatusCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupsNamespaceStatus' {RuleGroupsNamespaceStatusCode
statusCode :: RuleGroupsNamespaceStatusCode
$sel:statusCode:RuleGroupsNamespaceStatus' :: RuleGroupsNamespaceStatus -> RuleGroupsNamespaceStatusCode
statusCode} -> RuleGroupsNamespaceStatusCode
statusCode) (\s :: RuleGroupsNamespaceStatus
s@RuleGroupsNamespaceStatus' {} RuleGroupsNamespaceStatusCode
a -> RuleGroupsNamespaceStatus
s {$sel:statusCode:RuleGroupsNamespaceStatus' :: RuleGroupsNamespaceStatusCode
statusCode = RuleGroupsNamespaceStatusCode
a} :: RuleGroupsNamespaceStatus)

instance Core.FromJSON RuleGroupsNamespaceStatus where
  parseJSON :: Value -> Parser RuleGroupsNamespaceStatus
parseJSON =
    String
-> (Object -> Parser RuleGroupsNamespaceStatus)
-> Value
-> Parser RuleGroupsNamespaceStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RuleGroupsNamespaceStatus"
      ( \Object
x ->
          Maybe Text
-> RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus
RuleGroupsNamespaceStatus'
            (Maybe Text
 -> RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus)
-> Parser (Maybe Text)
-> Parser
     (RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus)
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 (RuleGroupsNamespaceStatusCode -> RuleGroupsNamespaceStatus)
-> Parser RuleGroupsNamespaceStatusCode
-> Parser RuleGroupsNamespaceStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser RuleGroupsNamespaceStatusCode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"statusCode")
      )

instance Prelude.Hashable RuleGroupsNamespaceStatus

instance Prelude.NFData RuleGroupsNamespaceStatus