{-# 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 #-}
module Amazonka.CloudWatch.Types.InsightRule 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
data InsightRule = InsightRule'
{
InsightRule -> Maybe Bool
managedRule :: Prelude.Maybe Prelude.Bool,
InsightRule -> Text
name :: Prelude.Text,
InsightRule -> Text
state :: Prelude.Text,
InsightRule -> Text
schema :: Prelude.Text,
InsightRule -> Text
definition :: Prelude.Text
}
deriving (InsightRule -> InsightRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InsightRule -> InsightRule -> Bool
$c/= :: InsightRule -> InsightRule -> Bool
== :: InsightRule -> InsightRule -> Bool
$c== :: InsightRule -> InsightRule -> Bool
Prelude.Eq, ReadPrec [InsightRule]
ReadPrec InsightRule
Int -> ReadS InsightRule
ReadS [InsightRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InsightRule]
$creadListPrec :: ReadPrec [InsightRule]
readPrec :: ReadPrec InsightRule
$creadPrec :: ReadPrec InsightRule
readList :: ReadS [InsightRule]
$creadList :: ReadS [InsightRule]
readsPrec :: Int -> ReadS InsightRule
$creadsPrec :: Int -> ReadS InsightRule
Prelude.Read, Int -> InsightRule -> ShowS
[InsightRule] -> ShowS
InsightRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InsightRule] -> ShowS
$cshowList :: [InsightRule] -> ShowS
show :: InsightRule -> String
$cshow :: InsightRule -> String
showsPrec :: Int -> InsightRule -> ShowS
$cshowsPrec :: Int -> InsightRule -> ShowS
Prelude.Show, forall x. Rep InsightRule x -> InsightRule
forall x. InsightRule -> Rep InsightRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InsightRule x -> InsightRule
$cfrom :: forall x. InsightRule -> Rep InsightRule x
Prelude.Generic)
newInsightRule ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
InsightRule
newInsightRule :: Text -> Text -> Text -> Text -> InsightRule
newInsightRule Text
pName_ Text
pState_ Text
pSchema_ Text
pDefinition_ =
InsightRule'
{ $sel:managedRule:InsightRule' :: Maybe Bool
managedRule = forall a. Maybe a
Prelude.Nothing,
$sel:name:InsightRule' :: Text
name = Text
pName_,
$sel:state:InsightRule' :: Text
state = Text
pState_,
$sel:schema:InsightRule' :: Text
schema = Text
pSchema_,
$sel:definition:InsightRule' :: Text
definition = Text
pDefinition_
}
insightRule_managedRule :: Lens.Lens' InsightRule (Prelude.Maybe Prelude.Bool)
insightRule_managedRule :: Lens' InsightRule (Maybe Bool)
insightRule_managedRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRule' {Maybe Bool
managedRule :: Maybe Bool
$sel:managedRule:InsightRule' :: InsightRule -> Maybe Bool
managedRule} -> Maybe Bool
managedRule) (\s :: InsightRule
s@InsightRule' {} Maybe Bool
a -> InsightRule
s {$sel:managedRule:InsightRule' :: Maybe Bool
managedRule = Maybe Bool
a} :: InsightRule)
insightRule_name :: Lens.Lens' InsightRule Prelude.Text
insightRule_name :: Lens' InsightRule Text
insightRule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRule' {Text
name :: Text
$sel:name:InsightRule' :: InsightRule -> Text
name} -> Text
name) (\s :: InsightRule
s@InsightRule' {} Text
a -> InsightRule
s {$sel:name:InsightRule' :: Text
name = Text
a} :: InsightRule)
insightRule_state :: Lens.Lens' InsightRule Prelude.Text
insightRule_state :: Lens' InsightRule Text
insightRule_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRule' {Text
state :: Text
$sel:state:InsightRule' :: InsightRule -> Text
state} -> Text
state) (\s :: InsightRule
s@InsightRule' {} Text
a -> InsightRule
s {$sel:state:InsightRule' :: Text
state = Text
a} :: InsightRule)
insightRule_schema :: Lens.Lens' InsightRule Prelude.Text
insightRule_schema :: Lens' InsightRule Text
insightRule_schema = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRule' {Text
schema :: Text
$sel:schema:InsightRule' :: InsightRule -> Text
schema} -> Text
schema) (\s :: InsightRule
s@InsightRule' {} Text
a -> InsightRule
s {$sel:schema:InsightRule' :: Text
schema = Text
a} :: InsightRule)
insightRule_definition :: Lens.Lens' InsightRule Prelude.Text
insightRule_definition :: Lens' InsightRule Text
insightRule_definition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InsightRule' {Text
definition :: Text
$sel:definition:InsightRule' :: InsightRule -> Text
definition} -> Text
definition) (\s :: InsightRule
s@InsightRule' {} Text
a -> InsightRule
s {$sel:definition:InsightRule' :: Text
definition = Text
a} :: InsightRule)
instance Data.FromXML InsightRule where
parseXML :: [Node] -> Either String InsightRule
parseXML [Node]
x =
Maybe Bool -> Text -> Text -> Text -> Text -> InsightRule
InsightRule'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ManagedRule")
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
"Name")
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")
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
"Schema")
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
"Definition")
instance Prelude.Hashable InsightRule where
hashWithSalt :: Int -> InsightRule -> Int
hashWithSalt Int
_salt InsightRule' {Maybe Bool
Text
definition :: Text
schema :: Text
state :: Text
name :: Text
managedRule :: Maybe Bool
$sel:definition:InsightRule' :: InsightRule -> Text
$sel:schema:InsightRule' :: InsightRule -> Text
$sel:state:InsightRule' :: InsightRule -> Text
$sel:name:InsightRule' :: InsightRule -> Text
$sel:managedRule:InsightRule' :: InsightRule -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
managedRule
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
state
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
schema
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
definition
instance Prelude.NFData InsightRule where
rnf :: InsightRule -> ()
rnf InsightRule' {Maybe Bool
Text
definition :: Text
schema :: Text
state :: Text
name :: Text
managedRule :: Maybe Bool
$sel:definition:InsightRule' :: InsightRule -> Text
$sel:schema:InsightRule' :: InsightRule -> Text
$sel:state:InsightRule' :: InsightRule -> Text
$sel:name:InsightRule' :: InsightRule -> Text
$sel:managedRule:InsightRule' :: InsightRule -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
managedRule
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
state
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
schema
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
definition