{-# 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.CloudWatch.Types.ManagedRuleState
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudWatch.Types.ManagedRuleState where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The status of a managed Contributor Insights rule.
--
-- /See:/ 'newManagedRuleState' smart constructor.
data ManagedRuleState = ManagedRuleState'
  { -- | The name of the Contributor Insights rule that contains data for the
    -- specified Amazon Web Services resource.
    ManagedRuleState -> Text
ruleName :: Prelude.Text,
    -- | Indicates whether the rule is enabled or disabled.
    ManagedRuleState -> Text
state :: Prelude.Text
  }
  deriving (ManagedRuleState -> ManagedRuleState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedRuleState -> ManagedRuleState -> Bool
$c/= :: ManagedRuleState -> ManagedRuleState -> Bool
== :: ManagedRuleState -> ManagedRuleState -> Bool
$c== :: ManagedRuleState -> ManagedRuleState -> Bool
Prelude.Eq, ReadPrec [ManagedRuleState]
ReadPrec ManagedRuleState
Int -> ReadS ManagedRuleState
ReadS [ManagedRuleState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedRuleState]
$creadListPrec :: ReadPrec [ManagedRuleState]
readPrec :: ReadPrec ManagedRuleState
$creadPrec :: ReadPrec ManagedRuleState
readList :: ReadS [ManagedRuleState]
$creadList :: ReadS [ManagedRuleState]
readsPrec :: Int -> ReadS ManagedRuleState
$creadsPrec :: Int -> ReadS ManagedRuleState
Prelude.Read, Int -> ManagedRuleState -> ShowS
[ManagedRuleState] -> ShowS
ManagedRuleState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedRuleState] -> ShowS
$cshowList :: [ManagedRuleState] -> ShowS
show :: ManagedRuleState -> String
$cshow :: ManagedRuleState -> String
showsPrec :: Int -> ManagedRuleState -> ShowS
$cshowsPrec :: Int -> ManagedRuleState -> ShowS
Prelude.Show, forall x. Rep ManagedRuleState x -> ManagedRuleState
forall x. ManagedRuleState -> Rep ManagedRuleState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedRuleState x -> ManagedRuleState
$cfrom :: forall x. ManagedRuleState -> Rep ManagedRuleState x
Prelude.Generic)

-- |
-- Create a value of 'ManagedRuleState' 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:
--
-- 'ruleName', 'managedRuleState_ruleName' - The name of the Contributor Insights rule that contains data for the
-- specified Amazon Web Services resource.
--
-- 'state', 'managedRuleState_state' - Indicates whether the rule is enabled or disabled.
newManagedRuleState ::
  -- | 'ruleName'
  Prelude.Text ->
  -- | 'state'
  Prelude.Text ->
  ManagedRuleState
newManagedRuleState :: Text -> Text -> ManagedRuleState
newManagedRuleState Text
pRuleName_ Text
pState_ =
  ManagedRuleState'
    { $sel:ruleName:ManagedRuleState' :: Text
ruleName = Text
pRuleName_,
      $sel:state:ManagedRuleState' :: Text
state = Text
pState_
    }

-- | The name of the Contributor Insights rule that contains data for the
-- specified Amazon Web Services resource.
managedRuleState_ruleName :: Lens.Lens' ManagedRuleState Prelude.Text
managedRuleState_ruleName :: Lens' ManagedRuleState Text
managedRuleState_ruleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleState' {Text
ruleName :: Text
$sel:ruleName:ManagedRuleState' :: ManagedRuleState -> Text
ruleName} -> Text
ruleName) (\s :: ManagedRuleState
s@ManagedRuleState' {} Text
a -> ManagedRuleState
s {$sel:ruleName:ManagedRuleState' :: Text
ruleName = Text
a} :: ManagedRuleState)

-- | Indicates whether the rule is enabled or disabled.
managedRuleState_state :: Lens.Lens' ManagedRuleState Prelude.Text
managedRuleState_state :: Lens' ManagedRuleState Text
managedRuleState_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedRuleState' {Text
state :: Text
$sel:state:ManagedRuleState' :: ManagedRuleState -> Text
state} -> Text
state) (\s :: ManagedRuleState
s@ManagedRuleState' {} Text
a -> ManagedRuleState
s {$sel:state:ManagedRuleState' :: Text
state = Text
a} :: ManagedRuleState)

instance Data.FromXML ManagedRuleState where
  parseXML :: [Node] -> Either String ManagedRuleState
parseXML [Node]
x =
    Text -> Text -> ManagedRuleState
ManagedRuleState'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"RuleName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"State")

instance Prelude.Hashable ManagedRuleState where
  hashWithSalt :: Int -> ManagedRuleState -> Int
hashWithSalt Int
_salt ManagedRuleState' {Text
state :: Text
ruleName :: Text
$sel:state:ManagedRuleState' :: ManagedRuleState -> Text
$sel:ruleName:ManagedRuleState' :: ManagedRuleState -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
state

instance Prelude.NFData ManagedRuleState where
  rnf :: ManagedRuleState -> ()
rnf ManagedRuleState' {Text
state :: Text
ruleName :: Text
$sel:state:ManagedRuleState' :: ManagedRuleState -> Text
$sel:ruleName:ManagedRuleState' :: ManagedRuleState -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
ruleName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
state