{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data InsightRule = InsightRule'
{
InsightRule -> Text
name :: Prelude.Text,
InsightRule -> Text
state :: Prelude.Text,
InsightRule -> Text
schema :: Prelude.Text,
InsightRule -> Text
definition :: Prelude.Text
}
deriving (InsightRule -> InsightRule -> Bool
(InsightRule -> InsightRule -> Bool)
-> (InsightRule -> InsightRule -> Bool) -> Eq InsightRule
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]
(Int -> ReadS InsightRule)
-> ReadS [InsightRule]
-> ReadPrec InsightRule
-> ReadPrec [InsightRule]
-> Read 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
(Int -> InsightRule -> ShowS)
-> (InsightRule -> String)
-> ([InsightRule] -> ShowS)
-> Show InsightRule
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. InsightRule -> Rep InsightRule x)
-> (forall x. Rep InsightRule x -> InsightRule)
-> Generic InsightRule
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' :: Text -> Text -> Text -> Text -> InsightRule
InsightRule'
{ $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_name :: Lens.Lens' InsightRule Prelude.Text
insightRule_name :: (Text -> f Text) -> InsightRule -> f InsightRule
insightRule_name = (InsightRule -> Text)
-> (InsightRule -> Text -> InsightRule)
-> Lens InsightRule InsightRule Text Text
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 :: (Text -> f Text) -> InsightRule -> f InsightRule
insightRule_state = (InsightRule -> Text)
-> (InsightRule -> Text -> InsightRule)
-> Lens InsightRule InsightRule Text Text
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 :: (Text -> f Text) -> InsightRule -> f InsightRule
insightRule_schema = (InsightRule -> Text)
-> (InsightRule -> Text -> InsightRule)
-> Lens InsightRule InsightRule Text Text
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 :: (Text -> f Text) -> InsightRule -> f InsightRule
insightRule_definition = (InsightRule -> Text)
-> (InsightRule -> Text -> InsightRule)
-> Lens InsightRule InsightRule Text Text
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 Core.FromXML InsightRule where
parseXML :: [Node] -> Either String InsightRule
parseXML [Node]
x =
Text -> Text -> Text -> Text -> InsightRule
InsightRule'
(Text -> Text -> Text -> Text -> InsightRule)
-> Either String Text
-> Either String (Text -> Text -> Text -> InsightRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Name")
Either String (Text -> Text -> Text -> InsightRule)
-> Either String Text
-> Either String (Text -> Text -> InsightRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"State")
Either String (Text -> Text -> InsightRule)
-> Either String Text -> Either String (Text -> InsightRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Schema")
Either String (Text -> InsightRule)
-> Either String Text -> Either String InsightRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Definition")
instance Prelude.Hashable InsightRule
instance Prelude.NFData InsightRule