{-# 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.LookoutMetrics.DetectMetricSetConfig
(
DetectMetricSetConfig (..),
newDetectMetricSetConfig,
detectMetricSetConfig_anomalyDetectorArn,
detectMetricSetConfig_autoDetectionMetricSource,
DetectMetricSetConfigResponse (..),
newDetectMetricSetConfigResponse,
detectMetricSetConfigResponse_detectedMetricSetConfig,
detectMetricSetConfigResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutMetrics.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DetectMetricSetConfig = DetectMetricSetConfig'
{
DetectMetricSetConfig -> Text
anomalyDetectorArn :: Prelude.Text,
DetectMetricSetConfig -> AutoDetectionMetricSource
autoDetectionMetricSource :: AutoDetectionMetricSource
}
deriving (DetectMetricSetConfig -> DetectMetricSetConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectMetricSetConfig -> DetectMetricSetConfig -> Bool
$c/= :: DetectMetricSetConfig -> DetectMetricSetConfig -> Bool
== :: DetectMetricSetConfig -> DetectMetricSetConfig -> Bool
$c== :: DetectMetricSetConfig -> DetectMetricSetConfig -> Bool
Prelude.Eq, ReadPrec [DetectMetricSetConfig]
ReadPrec DetectMetricSetConfig
Int -> ReadS DetectMetricSetConfig
ReadS [DetectMetricSetConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectMetricSetConfig]
$creadListPrec :: ReadPrec [DetectMetricSetConfig]
readPrec :: ReadPrec DetectMetricSetConfig
$creadPrec :: ReadPrec DetectMetricSetConfig
readList :: ReadS [DetectMetricSetConfig]
$creadList :: ReadS [DetectMetricSetConfig]
readsPrec :: Int -> ReadS DetectMetricSetConfig
$creadsPrec :: Int -> ReadS DetectMetricSetConfig
Prelude.Read, Int -> DetectMetricSetConfig -> ShowS
[DetectMetricSetConfig] -> ShowS
DetectMetricSetConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectMetricSetConfig] -> ShowS
$cshowList :: [DetectMetricSetConfig] -> ShowS
show :: DetectMetricSetConfig -> String
$cshow :: DetectMetricSetConfig -> String
showsPrec :: Int -> DetectMetricSetConfig -> ShowS
$cshowsPrec :: Int -> DetectMetricSetConfig -> ShowS
Prelude.Show, forall x. Rep DetectMetricSetConfig x -> DetectMetricSetConfig
forall x. DetectMetricSetConfig -> Rep DetectMetricSetConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetectMetricSetConfig x -> DetectMetricSetConfig
$cfrom :: forall x. DetectMetricSetConfig -> Rep DetectMetricSetConfig x
Prelude.Generic)
newDetectMetricSetConfig ::
Prelude.Text ->
AutoDetectionMetricSource ->
DetectMetricSetConfig
newDetectMetricSetConfig :: Text -> AutoDetectionMetricSource -> DetectMetricSetConfig
newDetectMetricSetConfig
Text
pAnomalyDetectorArn_
AutoDetectionMetricSource
pAutoDetectionMetricSource_ =
DetectMetricSetConfig'
{ $sel:anomalyDetectorArn:DetectMetricSetConfig' :: Text
anomalyDetectorArn =
Text
pAnomalyDetectorArn_,
$sel:autoDetectionMetricSource:DetectMetricSetConfig' :: AutoDetectionMetricSource
autoDetectionMetricSource =
AutoDetectionMetricSource
pAutoDetectionMetricSource_
}
detectMetricSetConfig_anomalyDetectorArn :: Lens.Lens' DetectMetricSetConfig Prelude.Text
detectMetricSetConfig_anomalyDetectorArn :: Lens' DetectMetricSetConfig Text
detectMetricSetConfig_anomalyDetectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectMetricSetConfig' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:DetectMetricSetConfig' :: DetectMetricSetConfig -> Text
anomalyDetectorArn} -> Text
anomalyDetectorArn) (\s :: DetectMetricSetConfig
s@DetectMetricSetConfig' {} Text
a -> DetectMetricSetConfig
s {$sel:anomalyDetectorArn:DetectMetricSetConfig' :: Text
anomalyDetectorArn = Text
a} :: DetectMetricSetConfig)
detectMetricSetConfig_autoDetectionMetricSource :: Lens.Lens' DetectMetricSetConfig AutoDetectionMetricSource
detectMetricSetConfig_autoDetectionMetricSource :: Lens' DetectMetricSetConfig AutoDetectionMetricSource
detectMetricSetConfig_autoDetectionMetricSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectMetricSetConfig' {AutoDetectionMetricSource
autoDetectionMetricSource :: AutoDetectionMetricSource
$sel:autoDetectionMetricSource:DetectMetricSetConfig' :: DetectMetricSetConfig -> AutoDetectionMetricSource
autoDetectionMetricSource} -> AutoDetectionMetricSource
autoDetectionMetricSource) (\s :: DetectMetricSetConfig
s@DetectMetricSetConfig' {} AutoDetectionMetricSource
a -> DetectMetricSetConfig
s {$sel:autoDetectionMetricSource:DetectMetricSetConfig' :: AutoDetectionMetricSource
autoDetectionMetricSource = AutoDetectionMetricSource
a} :: DetectMetricSetConfig)
instance Core.AWSRequest DetectMetricSetConfig where
type
AWSResponse DetectMetricSetConfig =
DetectMetricSetConfigResponse
request :: (Service -> Service)
-> DetectMetricSetConfig -> Request DetectMetricSetConfig
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DetectMetricSetConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DetectMetricSetConfig)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe DetectedMetricSetConfig
-> Int -> DetectMetricSetConfigResponse
DetectMetricSetConfigResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"DetectedMetricSetConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable DetectMetricSetConfig where
hashWithSalt :: Int -> DetectMetricSetConfig -> Int
hashWithSalt Int
_salt DetectMetricSetConfig' {Text
AutoDetectionMetricSource
autoDetectionMetricSource :: AutoDetectionMetricSource
anomalyDetectorArn :: Text
$sel:autoDetectionMetricSource:DetectMetricSetConfig' :: DetectMetricSetConfig -> AutoDetectionMetricSource
$sel:anomalyDetectorArn:DetectMetricSetConfig' :: DetectMetricSetConfig -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
anomalyDetectorArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AutoDetectionMetricSource
autoDetectionMetricSource
instance Prelude.NFData DetectMetricSetConfig where
rnf :: DetectMetricSetConfig -> ()
rnf DetectMetricSetConfig' {Text
AutoDetectionMetricSource
autoDetectionMetricSource :: AutoDetectionMetricSource
anomalyDetectorArn :: Text
$sel:autoDetectionMetricSource:DetectMetricSetConfig' :: DetectMetricSetConfig -> AutoDetectionMetricSource
$sel:anomalyDetectorArn:DetectMetricSetConfig' :: DetectMetricSetConfig -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
anomalyDetectorArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AutoDetectionMetricSource
autoDetectionMetricSource
instance Data.ToHeaders DetectMetricSetConfig where
toHeaders :: DetectMetricSetConfig -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON DetectMetricSetConfig where
toJSON :: DetectMetricSetConfig -> Value
toJSON DetectMetricSetConfig' {Text
AutoDetectionMetricSource
autoDetectionMetricSource :: AutoDetectionMetricSource
anomalyDetectorArn :: Text
$sel:autoDetectionMetricSource:DetectMetricSetConfig' :: DetectMetricSetConfig -> AutoDetectionMetricSource
$sel:anomalyDetectorArn:DetectMetricSetConfig' :: DetectMetricSetConfig -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"AnomalyDetectorArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
anomalyDetectorArn),
forall a. a -> Maybe a
Prelude.Just
( Key
"AutoDetectionMetricSource"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AutoDetectionMetricSource
autoDetectionMetricSource
)
]
)
instance Data.ToPath DetectMetricSetConfig where
toPath :: DetectMetricSetConfig -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/DetectMetricSetConfig"
instance Data.ToQuery DetectMetricSetConfig where
toQuery :: DetectMetricSetConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DetectMetricSetConfigResponse = DetectMetricSetConfigResponse'
{
DetectMetricSetConfigResponse -> Maybe DetectedMetricSetConfig
detectedMetricSetConfig :: Prelude.Maybe DetectedMetricSetConfig,
DetectMetricSetConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetectMetricSetConfigResponse
-> DetectMetricSetConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetectMetricSetConfigResponse
-> DetectMetricSetConfigResponse -> Bool
$c/= :: DetectMetricSetConfigResponse
-> DetectMetricSetConfigResponse -> Bool
== :: DetectMetricSetConfigResponse
-> DetectMetricSetConfigResponse -> Bool
$c== :: DetectMetricSetConfigResponse
-> DetectMetricSetConfigResponse -> Bool
Prelude.Eq, ReadPrec [DetectMetricSetConfigResponse]
ReadPrec DetectMetricSetConfigResponse
Int -> ReadS DetectMetricSetConfigResponse
ReadS [DetectMetricSetConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetectMetricSetConfigResponse]
$creadListPrec :: ReadPrec [DetectMetricSetConfigResponse]
readPrec :: ReadPrec DetectMetricSetConfigResponse
$creadPrec :: ReadPrec DetectMetricSetConfigResponse
readList :: ReadS [DetectMetricSetConfigResponse]
$creadList :: ReadS [DetectMetricSetConfigResponse]
readsPrec :: Int -> ReadS DetectMetricSetConfigResponse
$creadsPrec :: Int -> ReadS DetectMetricSetConfigResponse
Prelude.Read, Int -> DetectMetricSetConfigResponse -> ShowS
[DetectMetricSetConfigResponse] -> ShowS
DetectMetricSetConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetectMetricSetConfigResponse] -> ShowS
$cshowList :: [DetectMetricSetConfigResponse] -> ShowS
show :: DetectMetricSetConfigResponse -> String
$cshow :: DetectMetricSetConfigResponse -> String
showsPrec :: Int -> DetectMetricSetConfigResponse -> ShowS
$cshowsPrec :: Int -> DetectMetricSetConfigResponse -> ShowS
Prelude.Show, forall x.
Rep DetectMetricSetConfigResponse x
-> DetectMetricSetConfigResponse
forall x.
DetectMetricSetConfigResponse
-> Rep DetectMetricSetConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetectMetricSetConfigResponse x
-> DetectMetricSetConfigResponse
$cfrom :: forall x.
DetectMetricSetConfigResponse
-> Rep DetectMetricSetConfigResponse x
Prelude.Generic)
newDetectMetricSetConfigResponse ::
Prelude.Int ->
DetectMetricSetConfigResponse
newDetectMetricSetConfigResponse :: Int -> DetectMetricSetConfigResponse
newDetectMetricSetConfigResponse Int
pHttpStatus_ =
DetectMetricSetConfigResponse'
{ $sel:detectedMetricSetConfig:DetectMetricSetConfigResponse' :: Maybe DetectedMetricSetConfig
detectedMetricSetConfig =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DetectMetricSetConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
detectMetricSetConfigResponse_detectedMetricSetConfig :: Lens.Lens' DetectMetricSetConfigResponse (Prelude.Maybe DetectedMetricSetConfig)
detectMetricSetConfigResponse_detectedMetricSetConfig :: Lens' DetectMetricSetConfigResponse (Maybe DetectedMetricSetConfig)
detectMetricSetConfigResponse_detectedMetricSetConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectMetricSetConfigResponse' {Maybe DetectedMetricSetConfig
detectedMetricSetConfig :: Maybe DetectedMetricSetConfig
$sel:detectedMetricSetConfig:DetectMetricSetConfigResponse' :: DetectMetricSetConfigResponse -> Maybe DetectedMetricSetConfig
detectedMetricSetConfig} -> Maybe DetectedMetricSetConfig
detectedMetricSetConfig) (\s :: DetectMetricSetConfigResponse
s@DetectMetricSetConfigResponse' {} Maybe DetectedMetricSetConfig
a -> DetectMetricSetConfigResponse
s {$sel:detectedMetricSetConfig:DetectMetricSetConfigResponse' :: Maybe DetectedMetricSetConfig
detectedMetricSetConfig = Maybe DetectedMetricSetConfig
a} :: DetectMetricSetConfigResponse)
detectMetricSetConfigResponse_httpStatus :: Lens.Lens' DetectMetricSetConfigResponse Prelude.Int
detectMetricSetConfigResponse_httpStatus :: Lens' DetectMetricSetConfigResponse Int
detectMetricSetConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetectMetricSetConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetectMetricSetConfigResponse' :: DetectMetricSetConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetectMetricSetConfigResponse
s@DetectMetricSetConfigResponse' {} Int
a -> DetectMetricSetConfigResponse
s {$sel:httpStatus:DetectMetricSetConfigResponse' :: Int
httpStatus = Int
a} :: DetectMetricSetConfigResponse)
instance Prelude.NFData DetectMetricSetConfigResponse where
rnf :: DetectMetricSetConfigResponse -> ()
rnf DetectMetricSetConfigResponse' {Int
Maybe DetectedMetricSetConfig
httpStatus :: Int
detectedMetricSetConfig :: Maybe DetectedMetricSetConfig
$sel:httpStatus:DetectMetricSetConfigResponse' :: DetectMetricSetConfigResponse -> Int
$sel:detectedMetricSetConfig:DetectMetricSetConfigResponse' :: DetectMetricSetConfigResponse -> Maybe DetectedMetricSetConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DetectedMetricSetConfig
detectedMetricSetConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus