{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudWatch.PutInsightRule
(
PutInsightRule (..),
newPutInsightRule,
putInsightRule_tags,
putInsightRule_ruleState,
putInsightRule_ruleName,
putInsightRule_ruleDefinition,
PutInsightRuleResponse (..),
newPutInsightRuleResponse,
putInsightRuleResponse_httpStatus,
)
where
import Amazonka.CloudWatch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PutInsightRule = PutInsightRule'
{
PutInsightRule -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
PutInsightRule -> Maybe Text
ruleState :: Prelude.Maybe Prelude.Text,
PutInsightRule -> Text
ruleName :: Prelude.Text,
PutInsightRule -> Text
ruleDefinition :: Prelude.Text
}
deriving (PutInsightRule -> PutInsightRule -> Bool
(PutInsightRule -> PutInsightRule -> Bool)
-> (PutInsightRule -> PutInsightRule -> Bool) -> Eq PutInsightRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInsightRule -> PutInsightRule -> Bool
$c/= :: PutInsightRule -> PutInsightRule -> Bool
== :: PutInsightRule -> PutInsightRule -> Bool
$c== :: PutInsightRule -> PutInsightRule -> Bool
Prelude.Eq, ReadPrec [PutInsightRule]
ReadPrec PutInsightRule
Int -> ReadS PutInsightRule
ReadS [PutInsightRule]
(Int -> ReadS PutInsightRule)
-> ReadS [PutInsightRule]
-> ReadPrec PutInsightRule
-> ReadPrec [PutInsightRule]
-> Read PutInsightRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInsightRule]
$creadListPrec :: ReadPrec [PutInsightRule]
readPrec :: ReadPrec PutInsightRule
$creadPrec :: ReadPrec PutInsightRule
readList :: ReadS [PutInsightRule]
$creadList :: ReadS [PutInsightRule]
readsPrec :: Int -> ReadS PutInsightRule
$creadsPrec :: Int -> ReadS PutInsightRule
Prelude.Read, Int -> PutInsightRule -> ShowS
[PutInsightRule] -> ShowS
PutInsightRule -> String
(Int -> PutInsightRule -> ShowS)
-> (PutInsightRule -> String)
-> ([PutInsightRule] -> ShowS)
-> Show PutInsightRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInsightRule] -> ShowS
$cshowList :: [PutInsightRule] -> ShowS
show :: PutInsightRule -> String
$cshow :: PutInsightRule -> String
showsPrec :: Int -> PutInsightRule -> ShowS
$cshowsPrec :: Int -> PutInsightRule -> ShowS
Prelude.Show, (forall x. PutInsightRule -> Rep PutInsightRule x)
-> (forall x. Rep PutInsightRule x -> PutInsightRule)
-> Generic PutInsightRule
forall x. Rep PutInsightRule x -> PutInsightRule
forall x. PutInsightRule -> Rep PutInsightRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutInsightRule x -> PutInsightRule
$cfrom :: forall x. PutInsightRule -> Rep PutInsightRule x
Prelude.Generic)
newPutInsightRule ::
Prelude.Text ->
Prelude.Text ->
PutInsightRule
newPutInsightRule :: Text -> Text -> PutInsightRule
newPutInsightRule Text
pRuleName_ Text
pRuleDefinition_ =
PutInsightRule' :: Maybe [Tag] -> Maybe Text -> Text -> Text -> PutInsightRule
PutInsightRule'
{ $sel:tags:PutInsightRule' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:ruleState:PutInsightRule' :: Maybe Text
ruleState = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:ruleName:PutInsightRule' :: Text
ruleName = Text
pRuleName_,
$sel:ruleDefinition:PutInsightRule' :: Text
ruleDefinition = Text
pRuleDefinition_
}
putInsightRule_tags :: Lens.Lens' PutInsightRule (Prelude.Maybe [Tag])
putInsightRule_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> PutInsightRule -> f PutInsightRule
putInsightRule_tags = (PutInsightRule -> Maybe [Tag])
-> (PutInsightRule -> Maybe [Tag] -> PutInsightRule)
-> Lens PutInsightRule PutInsightRule (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightRule' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PutInsightRule' :: PutInsightRule -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PutInsightRule
s@PutInsightRule' {} Maybe [Tag]
a -> PutInsightRule
s {$sel:tags:PutInsightRule' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PutInsightRule) ((Maybe [Tag] -> f (Maybe [Tag]))
-> PutInsightRule -> f PutInsightRule)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PutInsightRule
-> f PutInsightRule
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putInsightRule_ruleState :: Lens.Lens' PutInsightRule (Prelude.Maybe Prelude.Text)
putInsightRule_ruleState :: (Maybe Text -> f (Maybe Text))
-> PutInsightRule -> f PutInsightRule
putInsightRule_ruleState = (PutInsightRule -> Maybe Text)
-> (PutInsightRule -> Maybe Text -> PutInsightRule)
-> Lens PutInsightRule PutInsightRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightRule' {Maybe Text
ruleState :: Maybe Text
$sel:ruleState:PutInsightRule' :: PutInsightRule -> Maybe Text
ruleState} -> Maybe Text
ruleState) (\s :: PutInsightRule
s@PutInsightRule' {} Maybe Text
a -> PutInsightRule
s {$sel:ruleState:PutInsightRule' :: Maybe Text
ruleState = Maybe Text
a} :: PutInsightRule)
putInsightRule_ruleName :: Lens.Lens' PutInsightRule Prelude.Text
putInsightRule_ruleName :: (Text -> f Text) -> PutInsightRule -> f PutInsightRule
putInsightRule_ruleName = (PutInsightRule -> Text)
-> (PutInsightRule -> Text -> PutInsightRule)
-> Lens PutInsightRule PutInsightRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightRule' {Text
ruleName :: Text
$sel:ruleName:PutInsightRule' :: PutInsightRule -> Text
ruleName} -> Text
ruleName) (\s :: PutInsightRule
s@PutInsightRule' {} Text
a -> PutInsightRule
s {$sel:ruleName:PutInsightRule' :: Text
ruleName = Text
a} :: PutInsightRule)
putInsightRule_ruleDefinition :: Lens.Lens' PutInsightRule Prelude.Text
putInsightRule_ruleDefinition :: (Text -> f Text) -> PutInsightRule -> f PutInsightRule
putInsightRule_ruleDefinition = (PutInsightRule -> Text)
-> (PutInsightRule -> Text -> PutInsightRule)
-> Lens PutInsightRule PutInsightRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightRule' {Text
ruleDefinition :: Text
$sel:ruleDefinition:PutInsightRule' :: PutInsightRule -> Text
ruleDefinition} -> Text
ruleDefinition) (\s :: PutInsightRule
s@PutInsightRule' {} Text
a -> PutInsightRule
s {$sel:ruleDefinition:PutInsightRule' :: Text
ruleDefinition = Text
a} :: PutInsightRule)
instance Core.AWSRequest PutInsightRule where
type
AWSResponse PutInsightRule =
PutInsightRuleResponse
request :: PutInsightRule -> Request PutInsightRule
request = Service -> PutInsightRule -> Request PutInsightRule
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy PutInsightRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutInsightRule)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse PutInsightRule))
-> Logger
-> Service
-> Proxy PutInsightRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutInsightRule)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"PutInsightRuleResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> PutInsightRuleResponse
PutInsightRuleResponse'
(Int -> PutInsightRuleResponse)
-> Either String Int -> Either String PutInsightRuleResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable PutInsightRule
instance Prelude.NFData PutInsightRule
instance Core.ToHeaders PutInsightRule where
toHeaders :: PutInsightRule -> ResponseHeaders
toHeaders = ResponseHeaders -> PutInsightRule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath PutInsightRule where
toPath :: PutInsightRule -> ByteString
toPath = ByteString -> PutInsightRule -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutInsightRule where
toQuery :: PutInsightRule -> QueryString
toQuery PutInsightRule' {Maybe [Tag]
Maybe Text
Text
ruleDefinition :: Text
ruleName :: Text
ruleState :: Maybe Text
tags :: Maybe [Tag]
$sel:ruleDefinition:PutInsightRule' :: PutInsightRule -> Text
$sel:ruleName:PutInsightRule' :: PutInsightRule -> Text
$sel:ruleState:PutInsightRule' :: PutInsightRule -> Maybe Text
$sel:tags:PutInsightRule' :: PutInsightRule -> Maybe [Tag]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"PutInsightRule" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"Tags"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
ByteString
"RuleState" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
ruleState,
ByteString
"RuleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
ruleName,
ByteString
"RuleDefinition" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
ruleDefinition
]
data PutInsightRuleResponse = PutInsightRuleResponse'
{
PutInsightRuleResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutInsightRuleResponse -> PutInsightRuleResponse -> Bool
(PutInsightRuleResponse -> PutInsightRuleResponse -> Bool)
-> (PutInsightRuleResponse -> PutInsightRuleResponse -> Bool)
-> Eq PutInsightRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutInsightRuleResponse -> PutInsightRuleResponse -> Bool
$c/= :: PutInsightRuleResponse -> PutInsightRuleResponse -> Bool
== :: PutInsightRuleResponse -> PutInsightRuleResponse -> Bool
$c== :: PutInsightRuleResponse -> PutInsightRuleResponse -> Bool
Prelude.Eq, ReadPrec [PutInsightRuleResponse]
ReadPrec PutInsightRuleResponse
Int -> ReadS PutInsightRuleResponse
ReadS [PutInsightRuleResponse]
(Int -> ReadS PutInsightRuleResponse)
-> ReadS [PutInsightRuleResponse]
-> ReadPrec PutInsightRuleResponse
-> ReadPrec [PutInsightRuleResponse]
-> Read PutInsightRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutInsightRuleResponse]
$creadListPrec :: ReadPrec [PutInsightRuleResponse]
readPrec :: ReadPrec PutInsightRuleResponse
$creadPrec :: ReadPrec PutInsightRuleResponse
readList :: ReadS [PutInsightRuleResponse]
$creadList :: ReadS [PutInsightRuleResponse]
readsPrec :: Int -> ReadS PutInsightRuleResponse
$creadsPrec :: Int -> ReadS PutInsightRuleResponse
Prelude.Read, Int -> PutInsightRuleResponse -> ShowS
[PutInsightRuleResponse] -> ShowS
PutInsightRuleResponse -> String
(Int -> PutInsightRuleResponse -> ShowS)
-> (PutInsightRuleResponse -> String)
-> ([PutInsightRuleResponse] -> ShowS)
-> Show PutInsightRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutInsightRuleResponse] -> ShowS
$cshowList :: [PutInsightRuleResponse] -> ShowS
show :: PutInsightRuleResponse -> String
$cshow :: PutInsightRuleResponse -> String
showsPrec :: Int -> PutInsightRuleResponse -> ShowS
$cshowsPrec :: Int -> PutInsightRuleResponse -> ShowS
Prelude.Show, (forall x. PutInsightRuleResponse -> Rep PutInsightRuleResponse x)
-> (forall x.
Rep PutInsightRuleResponse x -> PutInsightRuleResponse)
-> Generic PutInsightRuleResponse
forall x. Rep PutInsightRuleResponse x -> PutInsightRuleResponse
forall x. PutInsightRuleResponse -> Rep PutInsightRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutInsightRuleResponse x -> PutInsightRuleResponse
$cfrom :: forall x. PutInsightRuleResponse -> Rep PutInsightRuleResponse x
Prelude.Generic)
newPutInsightRuleResponse ::
Prelude.Int ->
PutInsightRuleResponse
newPutInsightRuleResponse :: Int -> PutInsightRuleResponse
newPutInsightRuleResponse Int
pHttpStatus_ =
PutInsightRuleResponse' :: Int -> PutInsightRuleResponse
PutInsightRuleResponse' {$sel:httpStatus:PutInsightRuleResponse' :: Int
httpStatus = Int
pHttpStatus_}
putInsightRuleResponse_httpStatus :: Lens.Lens' PutInsightRuleResponse Prelude.Int
putInsightRuleResponse_httpStatus :: (Int -> f Int)
-> PutInsightRuleResponse -> f PutInsightRuleResponse
putInsightRuleResponse_httpStatus = (PutInsightRuleResponse -> Int)
-> (PutInsightRuleResponse -> Int -> PutInsightRuleResponse)
-> Lens PutInsightRuleResponse PutInsightRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutInsightRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutInsightRuleResponse' :: PutInsightRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutInsightRuleResponse
s@PutInsightRuleResponse' {} Int
a -> PutInsightRuleResponse
s {$sel:httpStatus:PutInsightRuleResponse' :: Int
httpStatus = Int
a} :: PutInsightRuleResponse)
instance Prelude.NFData PutInsightRuleResponse