{-# 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.PutAnomalyDetector
(
PutAnomalyDetector (..),
newPutAnomalyDetector,
putAnomalyDetector_configuration,
putAnomalyDetector_dimensions,
putAnomalyDetector_namespace,
putAnomalyDetector_metricName,
putAnomalyDetector_stat,
PutAnomalyDetectorResponse (..),
newPutAnomalyDetectorResponse,
putAnomalyDetectorResponse_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 PutAnomalyDetector = PutAnomalyDetector'
{
PutAnomalyDetector -> Maybe AnomalyDetectorConfiguration
configuration :: Prelude.Maybe AnomalyDetectorConfiguration,
PutAnomalyDetector -> Maybe [Dimension]
dimensions :: Prelude.Maybe [Dimension],
PutAnomalyDetector -> Text
namespace :: Prelude.Text,
PutAnomalyDetector -> Text
metricName :: Prelude.Text,
PutAnomalyDetector -> Text
stat :: Prelude.Text
}
deriving (PutAnomalyDetector -> PutAnomalyDetector -> Bool
(PutAnomalyDetector -> PutAnomalyDetector -> Bool)
-> (PutAnomalyDetector -> PutAnomalyDetector -> Bool)
-> Eq PutAnomalyDetector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAnomalyDetector -> PutAnomalyDetector -> Bool
$c/= :: PutAnomalyDetector -> PutAnomalyDetector -> Bool
== :: PutAnomalyDetector -> PutAnomalyDetector -> Bool
$c== :: PutAnomalyDetector -> PutAnomalyDetector -> Bool
Prelude.Eq, ReadPrec [PutAnomalyDetector]
ReadPrec PutAnomalyDetector
Int -> ReadS PutAnomalyDetector
ReadS [PutAnomalyDetector]
(Int -> ReadS PutAnomalyDetector)
-> ReadS [PutAnomalyDetector]
-> ReadPrec PutAnomalyDetector
-> ReadPrec [PutAnomalyDetector]
-> Read PutAnomalyDetector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAnomalyDetector]
$creadListPrec :: ReadPrec [PutAnomalyDetector]
readPrec :: ReadPrec PutAnomalyDetector
$creadPrec :: ReadPrec PutAnomalyDetector
readList :: ReadS [PutAnomalyDetector]
$creadList :: ReadS [PutAnomalyDetector]
readsPrec :: Int -> ReadS PutAnomalyDetector
$creadsPrec :: Int -> ReadS PutAnomalyDetector
Prelude.Read, Int -> PutAnomalyDetector -> ShowS
[PutAnomalyDetector] -> ShowS
PutAnomalyDetector -> String
(Int -> PutAnomalyDetector -> ShowS)
-> (PutAnomalyDetector -> String)
-> ([PutAnomalyDetector] -> ShowS)
-> Show PutAnomalyDetector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAnomalyDetector] -> ShowS
$cshowList :: [PutAnomalyDetector] -> ShowS
show :: PutAnomalyDetector -> String
$cshow :: PutAnomalyDetector -> String
showsPrec :: Int -> PutAnomalyDetector -> ShowS
$cshowsPrec :: Int -> PutAnomalyDetector -> ShowS
Prelude.Show, (forall x. PutAnomalyDetector -> Rep PutAnomalyDetector x)
-> (forall x. Rep PutAnomalyDetector x -> PutAnomalyDetector)
-> Generic PutAnomalyDetector
forall x. Rep PutAnomalyDetector x -> PutAnomalyDetector
forall x. PutAnomalyDetector -> Rep PutAnomalyDetector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutAnomalyDetector x -> PutAnomalyDetector
$cfrom :: forall x. PutAnomalyDetector -> Rep PutAnomalyDetector x
Prelude.Generic)
newPutAnomalyDetector ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
PutAnomalyDetector
newPutAnomalyDetector :: Text -> Text -> Text -> PutAnomalyDetector
newPutAnomalyDetector Text
pNamespace_ Text
pMetricName_ Text
pStat_ =
PutAnomalyDetector' :: Maybe AnomalyDetectorConfiguration
-> Maybe [Dimension] -> Text -> Text -> Text -> PutAnomalyDetector
PutAnomalyDetector'
{ $sel:configuration:PutAnomalyDetector' :: Maybe AnomalyDetectorConfiguration
configuration =
Maybe AnomalyDetectorConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:dimensions:PutAnomalyDetector' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
forall a. Maybe a
Prelude.Nothing,
$sel:namespace:PutAnomalyDetector' :: Text
namespace = Text
pNamespace_,
$sel:metricName:PutAnomalyDetector' :: Text
metricName = Text
pMetricName_,
$sel:stat:PutAnomalyDetector' :: Text
stat = Text
pStat_
}
putAnomalyDetector_configuration :: Lens.Lens' PutAnomalyDetector (Prelude.Maybe AnomalyDetectorConfiguration)
putAnomalyDetector_configuration :: (Maybe AnomalyDetectorConfiguration
-> f (Maybe AnomalyDetectorConfiguration))
-> PutAnomalyDetector -> f PutAnomalyDetector
putAnomalyDetector_configuration = (PutAnomalyDetector -> Maybe AnomalyDetectorConfiguration)
-> (PutAnomalyDetector
-> Maybe AnomalyDetectorConfiguration -> PutAnomalyDetector)
-> Lens
PutAnomalyDetector
PutAnomalyDetector
(Maybe AnomalyDetectorConfiguration)
(Maybe AnomalyDetectorConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAnomalyDetector' {Maybe AnomalyDetectorConfiguration
configuration :: Maybe AnomalyDetectorConfiguration
$sel:configuration:PutAnomalyDetector' :: PutAnomalyDetector -> Maybe AnomalyDetectorConfiguration
configuration} -> Maybe AnomalyDetectorConfiguration
configuration) (\s :: PutAnomalyDetector
s@PutAnomalyDetector' {} Maybe AnomalyDetectorConfiguration
a -> PutAnomalyDetector
s {$sel:configuration:PutAnomalyDetector' :: Maybe AnomalyDetectorConfiguration
configuration = Maybe AnomalyDetectorConfiguration
a} :: PutAnomalyDetector)
putAnomalyDetector_dimensions :: Lens.Lens' PutAnomalyDetector (Prelude.Maybe [Dimension])
putAnomalyDetector_dimensions :: (Maybe [Dimension] -> f (Maybe [Dimension]))
-> PutAnomalyDetector -> f PutAnomalyDetector
putAnomalyDetector_dimensions = (PutAnomalyDetector -> Maybe [Dimension])
-> (PutAnomalyDetector -> Maybe [Dimension] -> PutAnomalyDetector)
-> Lens
PutAnomalyDetector
PutAnomalyDetector
(Maybe [Dimension])
(Maybe [Dimension])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAnomalyDetector' {Maybe [Dimension]
dimensions :: Maybe [Dimension]
$sel:dimensions:PutAnomalyDetector' :: PutAnomalyDetector -> Maybe [Dimension]
dimensions} -> Maybe [Dimension]
dimensions) (\s :: PutAnomalyDetector
s@PutAnomalyDetector' {} Maybe [Dimension]
a -> PutAnomalyDetector
s {$sel:dimensions:PutAnomalyDetector' :: Maybe [Dimension]
dimensions = Maybe [Dimension]
a} :: PutAnomalyDetector) ((Maybe [Dimension] -> f (Maybe [Dimension]))
-> PutAnomalyDetector -> f PutAnomalyDetector)
-> ((Maybe [Dimension] -> f (Maybe [Dimension]))
-> Maybe [Dimension] -> f (Maybe [Dimension]))
-> (Maybe [Dimension] -> f (Maybe [Dimension]))
-> PutAnomalyDetector
-> f PutAnomalyDetector
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Dimension] [Dimension] [Dimension] [Dimension]
-> Iso
(Maybe [Dimension])
(Maybe [Dimension])
(Maybe [Dimension])
(Maybe [Dimension])
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 [Dimension] [Dimension] [Dimension] [Dimension]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putAnomalyDetector_namespace :: Lens.Lens' PutAnomalyDetector Prelude.Text
putAnomalyDetector_namespace :: (Text -> f Text) -> PutAnomalyDetector -> f PutAnomalyDetector
putAnomalyDetector_namespace = (PutAnomalyDetector -> Text)
-> (PutAnomalyDetector -> Text -> PutAnomalyDetector)
-> Lens PutAnomalyDetector PutAnomalyDetector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAnomalyDetector' {Text
namespace :: Text
$sel:namespace:PutAnomalyDetector' :: PutAnomalyDetector -> Text
namespace} -> Text
namespace) (\s :: PutAnomalyDetector
s@PutAnomalyDetector' {} Text
a -> PutAnomalyDetector
s {$sel:namespace:PutAnomalyDetector' :: Text
namespace = Text
a} :: PutAnomalyDetector)
putAnomalyDetector_metricName :: Lens.Lens' PutAnomalyDetector Prelude.Text
putAnomalyDetector_metricName :: (Text -> f Text) -> PutAnomalyDetector -> f PutAnomalyDetector
putAnomalyDetector_metricName = (PutAnomalyDetector -> Text)
-> (PutAnomalyDetector -> Text -> PutAnomalyDetector)
-> Lens PutAnomalyDetector PutAnomalyDetector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAnomalyDetector' {Text
metricName :: Text
$sel:metricName:PutAnomalyDetector' :: PutAnomalyDetector -> Text
metricName} -> Text
metricName) (\s :: PutAnomalyDetector
s@PutAnomalyDetector' {} Text
a -> PutAnomalyDetector
s {$sel:metricName:PutAnomalyDetector' :: Text
metricName = Text
a} :: PutAnomalyDetector)
putAnomalyDetector_stat :: Lens.Lens' PutAnomalyDetector Prelude.Text
putAnomalyDetector_stat :: (Text -> f Text) -> PutAnomalyDetector -> f PutAnomalyDetector
putAnomalyDetector_stat = (PutAnomalyDetector -> Text)
-> (PutAnomalyDetector -> Text -> PutAnomalyDetector)
-> Lens PutAnomalyDetector PutAnomalyDetector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAnomalyDetector' {Text
stat :: Text
$sel:stat:PutAnomalyDetector' :: PutAnomalyDetector -> Text
stat} -> Text
stat) (\s :: PutAnomalyDetector
s@PutAnomalyDetector' {} Text
a -> PutAnomalyDetector
s {$sel:stat:PutAnomalyDetector' :: Text
stat = Text
a} :: PutAnomalyDetector)
instance Core.AWSRequest PutAnomalyDetector where
type
AWSResponse PutAnomalyDetector =
PutAnomalyDetectorResponse
request :: PutAnomalyDetector -> Request PutAnomalyDetector
request = Service -> PutAnomalyDetector -> Request PutAnomalyDetector
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy PutAnomalyDetector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAnomalyDetector)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse PutAnomalyDetector))
-> Logger
-> Service
-> Proxy PutAnomalyDetector
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutAnomalyDetector)))
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
"PutAnomalyDetectorResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Int -> PutAnomalyDetectorResponse
PutAnomalyDetectorResponse'
(Int -> PutAnomalyDetectorResponse)
-> Either String Int -> Either String PutAnomalyDetectorResponse
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 PutAnomalyDetector
instance Prelude.NFData PutAnomalyDetector
instance Core.ToHeaders PutAnomalyDetector where
toHeaders :: PutAnomalyDetector -> ResponseHeaders
toHeaders = ResponseHeaders -> PutAnomalyDetector -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath PutAnomalyDetector where
toPath :: PutAnomalyDetector -> ByteString
toPath = ByteString -> PutAnomalyDetector -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutAnomalyDetector where
toQuery :: PutAnomalyDetector -> QueryString
toQuery PutAnomalyDetector' {Maybe [Dimension]
Maybe AnomalyDetectorConfiguration
Text
stat :: Text
metricName :: Text
namespace :: Text
dimensions :: Maybe [Dimension]
configuration :: Maybe AnomalyDetectorConfiguration
$sel:stat:PutAnomalyDetector' :: PutAnomalyDetector -> Text
$sel:metricName:PutAnomalyDetector' :: PutAnomalyDetector -> Text
$sel:namespace:PutAnomalyDetector' :: PutAnomalyDetector -> Text
$sel:dimensions:PutAnomalyDetector' :: PutAnomalyDetector -> Maybe [Dimension]
$sel:configuration:PutAnomalyDetector' :: PutAnomalyDetector -> Maybe AnomalyDetectorConfiguration
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"PutAnomalyDetector" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
ByteString
"Configuration" ByteString -> Maybe AnomalyDetectorConfiguration -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe AnomalyDetectorConfiguration
configuration,
ByteString
"Dimensions"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Dimension] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Dimension] -> QueryString)
-> Maybe [Dimension] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
dimensions),
ByteString
"Namespace" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
namespace,
ByteString
"MetricName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
metricName,
ByteString
"Stat" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
stat
]
data PutAnomalyDetectorResponse = PutAnomalyDetectorResponse'
{
PutAnomalyDetectorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutAnomalyDetectorResponse -> PutAnomalyDetectorResponse -> Bool
(PutAnomalyDetectorResponse -> PutAnomalyDetectorResponse -> Bool)
-> (PutAnomalyDetectorResponse
-> PutAnomalyDetectorResponse -> Bool)
-> Eq PutAnomalyDetectorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutAnomalyDetectorResponse -> PutAnomalyDetectorResponse -> Bool
$c/= :: PutAnomalyDetectorResponse -> PutAnomalyDetectorResponse -> Bool
== :: PutAnomalyDetectorResponse -> PutAnomalyDetectorResponse -> Bool
$c== :: PutAnomalyDetectorResponse -> PutAnomalyDetectorResponse -> Bool
Prelude.Eq, ReadPrec [PutAnomalyDetectorResponse]
ReadPrec PutAnomalyDetectorResponse
Int -> ReadS PutAnomalyDetectorResponse
ReadS [PutAnomalyDetectorResponse]
(Int -> ReadS PutAnomalyDetectorResponse)
-> ReadS [PutAnomalyDetectorResponse]
-> ReadPrec PutAnomalyDetectorResponse
-> ReadPrec [PutAnomalyDetectorResponse]
-> Read PutAnomalyDetectorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutAnomalyDetectorResponse]
$creadListPrec :: ReadPrec [PutAnomalyDetectorResponse]
readPrec :: ReadPrec PutAnomalyDetectorResponse
$creadPrec :: ReadPrec PutAnomalyDetectorResponse
readList :: ReadS [PutAnomalyDetectorResponse]
$creadList :: ReadS [PutAnomalyDetectorResponse]
readsPrec :: Int -> ReadS PutAnomalyDetectorResponse
$creadsPrec :: Int -> ReadS PutAnomalyDetectorResponse
Prelude.Read, Int -> PutAnomalyDetectorResponse -> ShowS
[PutAnomalyDetectorResponse] -> ShowS
PutAnomalyDetectorResponse -> String
(Int -> PutAnomalyDetectorResponse -> ShowS)
-> (PutAnomalyDetectorResponse -> String)
-> ([PutAnomalyDetectorResponse] -> ShowS)
-> Show PutAnomalyDetectorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutAnomalyDetectorResponse] -> ShowS
$cshowList :: [PutAnomalyDetectorResponse] -> ShowS
show :: PutAnomalyDetectorResponse -> String
$cshow :: PutAnomalyDetectorResponse -> String
showsPrec :: Int -> PutAnomalyDetectorResponse -> ShowS
$cshowsPrec :: Int -> PutAnomalyDetectorResponse -> ShowS
Prelude.Show, (forall x.
PutAnomalyDetectorResponse -> Rep PutAnomalyDetectorResponse x)
-> (forall x.
Rep PutAnomalyDetectorResponse x -> PutAnomalyDetectorResponse)
-> Generic PutAnomalyDetectorResponse
forall x.
Rep PutAnomalyDetectorResponse x -> PutAnomalyDetectorResponse
forall x.
PutAnomalyDetectorResponse -> Rep PutAnomalyDetectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutAnomalyDetectorResponse x -> PutAnomalyDetectorResponse
$cfrom :: forall x.
PutAnomalyDetectorResponse -> Rep PutAnomalyDetectorResponse x
Prelude.Generic)
newPutAnomalyDetectorResponse ::
Prelude.Int ->
PutAnomalyDetectorResponse
newPutAnomalyDetectorResponse :: Int -> PutAnomalyDetectorResponse
newPutAnomalyDetectorResponse Int
pHttpStatus_ =
PutAnomalyDetectorResponse' :: Int -> PutAnomalyDetectorResponse
PutAnomalyDetectorResponse'
{ $sel:httpStatus:PutAnomalyDetectorResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putAnomalyDetectorResponse_httpStatus :: Lens.Lens' PutAnomalyDetectorResponse Prelude.Int
putAnomalyDetectorResponse_httpStatus :: (Int -> f Int)
-> PutAnomalyDetectorResponse -> f PutAnomalyDetectorResponse
putAnomalyDetectorResponse_httpStatus = (PutAnomalyDetectorResponse -> Int)
-> (PutAnomalyDetectorResponse
-> Int -> PutAnomalyDetectorResponse)
-> Lens
PutAnomalyDetectorResponse PutAnomalyDetectorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutAnomalyDetectorResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutAnomalyDetectorResponse' :: PutAnomalyDetectorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutAnomalyDetectorResponse
s@PutAnomalyDetectorResponse' {} Int
a -> PutAnomalyDetectorResponse
s {$sel:httpStatus:PutAnomalyDetectorResponse' :: Int
httpStatus = Int
a} :: PutAnomalyDetectorResponse)
instance Prelude.NFData PutAnomalyDetectorResponse