{-# 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.LookoutMetrics.Types.MetricSource 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.AppFlowConfig
import Amazonka.LookoutMetrics.Types.AthenaSourceConfig
import Amazonka.LookoutMetrics.Types.CloudWatchConfig
import Amazonka.LookoutMetrics.Types.RDSSourceConfig
import Amazonka.LookoutMetrics.Types.RedshiftSourceConfig
import Amazonka.LookoutMetrics.Types.S3SourceConfig
import qualified Amazonka.Prelude as Prelude
data MetricSource = MetricSource'
{
MetricSource -> Maybe AppFlowConfig
appFlowConfig :: Prelude.Maybe AppFlowConfig,
MetricSource -> Maybe AthenaSourceConfig
athenaSourceConfig :: Prelude.Maybe AthenaSourceConfig,
MetricSource -> Maybe CloudWatchConfig
cloudWatchConfig :: Prelude.Maybe CloudWatchConfig,
MetricSource -> Maybe RDSSourceConfig
rDSSourceConfig :: Prelude.Maybe RDSSourceConfig,
MetricSource -> Maybe RedshiftSourceConfig
redshiftSourceConfig :: Prelude.Maybe RedshiftSourceConfig,
MetricSource -> Maybe S3SourceConfig
s3SourceConfig :: Prelude.Maybe S3SourceConfig
}
deriving (MetricSource -> MetricSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricSource -> MetricSource -> Bool
$c/= :: MetricSource -> MetricSource -> Bool
== :: MetricSource -> MetricSource -> Bool
$c== :: MetricSource -> MetricSource -> Bool
Prelude.Eq, ReadPrec [MetricSource]
ReadPrec MetricSource
Int -> ReadS MetricSource
ReadS [MetricSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricSource]
$creadListPrec :: ReadPrec [MetricSource]
readPrec :: ReadPrec MetricSource
$creadPrec :: ReadPrec MetricSource
readList :: ReadS [MetricSource]
$creadList :: ReadS [MetricSource]
readsPrec :: Int -> ReadS MetricSource
$creadsPrec :: Int -> ReadS MetricSource
Prelude.Read, Int -> MetricSource -> ShowS
[MetricSource] -> ShowS
MetricSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricSource] -> ShowS
$cshowList :: [MetricSource] -> ShowS
show :: MetricSource -> String
$cshow :: MetricSource -> String
showsPrec :: Int -> MetricSource -> ShowS
$cshowsPrec :: Int -> MetricSource -> ShowS
Prelude.Show, forall x. Rep MetricSource x -> MetricSource
forall x. MetricSource -> Rep MetricSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricSource x -> MetricSource
$cfrom :: forall x. MetricSource -> Rep MetricSource x
Prelude.Generic)
newMetricSource ::
MetricSource
newMetricSource :: MetricSource
newMetricSource =
MetricSource'
{ $sel:appFlowConfig:MetricSource' :: Maybe AppFlowConfig
appFlowConfig = forall a. Maybe a
Prelude.Nothing,
$sel:athenaSourceConfig:MetricSource' :: Maybe AthenaSourceConfig
athenaSourceConfig = forall a. Maybe a
Prelude.Nothing,
$sel:cloudWatchConfig:MetricSource' :: Maybe CloudWatchConfig
cloudWatchConfig = forall a. Maybe a
Prelude.Nothing,
$sel:rDSSourceConfig:MetricSource' :: Maybe RDSSourceConfig
rDSSourceConfig = forall a. Maybe a
Prelude.Nothing,
$sel:redshiftSourceConfig:MetricSource' :: Maybe RedshiftSourceConfig
redshiftSourceConfig = forall a. Maybe a
Prelude.Nothing,
$sel:s3SourceConfig:MetricSource' :: Maybe S3SourceConfig
s3SourceConfig = forall a. Maybe a
Prelude.Nothing
}
metricSource_appFlowConfig :: Lens.Lens' MetricSource (Prelude.Maybe AppFlowConfig)
metricSource_appFlowConfig :: Lens' MetricSource (Maybe AppFlowConfig)
metricSource_appFlowConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricSource' {Maybe AppFlowConfig
appFlowConfig :: Maybe AppFlowConfig
$sel:appFlowConfig:MetricSource' :: MetricSource -> Maybe AppFlowConfig
appFlowConfig} -> Maybe AppFlowConfig
appFlowConfig) (\s :: MetricSource
s@MetricSource' {} Maybe AppFlowConfig
a -> MetricSource
s {$sel:appFlowConfig:MetricSource' :: Maybe AppFlowConfig
appFlowConfig = Maybe AppFlowConfig
a} :: MetricSource)
metricSource_athenaSourceConfig :: Lens.Lens' MetricSource (Prelude.Maybe AthenaSourceConfig)
metricSource_athenaSourceConfig :: Lens' MetricSource (Maybe AthenaSourceConfig)
metricSource_athenaSourceConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricSource' {Maybe AthenaSourceConfig
athenaSourceConfig :: Maybe AthenaSourceConfig
$sel:athenaSourceConfig:MetricSource' :: MetricSource -> Maybe AthenaSourceConfig
athenaSourceConfig} -> Maybe AthenaSourceConfig
athenaSourceConfig) (\s :: MetricSource
s@MetricSource' {} Maybe AthenaSourceConfig
a -> MetricSource
s {$sel:athenaSourceConfig:MetricSource' :: Maybe AthenaSourceConfig
athenaSourceConfig = Maybe AthenaSourceConfig
a} :: MetricSource)
metricSource_cloudWatchConfig :: Lens.Lens' MetricSource (Prelude.Maybe CloudWatchConfig)
metricSource_cloudWatchConfig :: Lens' MetricSource (Maybe CloudWatchConfig)
metricSource_cloudWatchConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricSource' {Maybe CloudWatchConfig
cloudWatchConfig :: Maybe CloudWatchConfig
$sel:cloudWatchConfig:MetricSource' :: MetricSource -> Maybe CloudWatchConfig
cloudWatchConfig} -> Maybe CloudWatchConfig
cloudWatchConfig) (\s :: MetricSource
s@MetricSource' {} Maybe CloudWatchConfig
a -> MetricSource
s {$sel:cloudWatchConfig:MetricSource' :: Maybe CloudWatchConfig
cloudWatchConfig = Maybe CloudWatchConfig
a} :: MetricSource)
metricSource_rDSSourceConfig :: Lens.Lens' MetricSource (Prelude.Maybe RDSSourceConfig)
metricSource_rDSSourceConfig :: Lens' MetricSource (Maybe RDSSourceConfig)
metricSource_rDSSourceConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricSource' {Maybe RDSSourceConfig
rDSSourceConfig :: Maybe RDSSourceConfig
$sel:rDSSourceConfig:MetricSource' :: MetricSource -> Maybe RDSSourceConfig
rDSSourceConfig} -> Maybe RDSSourceConfig
rDSSourceConfig) (\s :: MetricSource
s@MetricSource' {} Maybe RDSSourceConfig
a -> MetricSource
s {$sel:rDSSourceConfig:MetricSource' :: Maybe RDSSourceConfig
rDSSourceConfig = Maybe RDSSourceConfig
a} :: MetricSource)
metricSource_redshiftSourceConfig :: Lens.Lens' MetricSource (Prelude.Maybe RedshiftSourceConfig)
metricSource_redshiftSourceConfig :: Lens' MetricSource (Maybe RedshiftSourceConfig)
metricSource_redshiftSourceConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricSource' {Maybe RedshiftSourceConfig
redshiftSourceConfig :: Maybe RedshiftSourceConfig
$sel:redshiftSourceConfig:MetricSource' :: MetricSource -> Maybe RedshiftSourceConfig
redshiftSourceConfig} -> Maybe RedshiftSourceConfig
redshiftSourceConfig) (\s :: MetricSource
s@MetricSource' {} Maybe RedshiftSourceConfig
a -> MetricSource
s {$sel:redshiftSourceConfig:MetricSource' :: Maybe RedshiftSourceConfig
redshiftSourceConfig = Maybe RedshiftSourceConfig
a} :: MetricSource)
metricSource_s3SourceConfig :: Lens.Lens' MetricSource (Prelude.Maybe S3SourceConfig)
metricSource_s3SourceConfig :: Lens' MetricSource (Maybe S3SourceConfig)
metricSource_s3SourceConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricSource' {Maybe S3SourceConfig
s3SourceConfig :: Maybe S3SourceConfig
$sel:s3SourceConfig:MetricSource' :: MetricSource -> Maybe S3SourceConfig
s3SourceConfig} -> Maybe S3SourceConfig
s3SourceConfig) (\s :: MetricSource
s@MetricSource' {} Maybe S3SourceConfig
a -> MetricSource
s {$sel:s3SourceConfig:MetricSource' :: Maybe S3SourceConfig
s3SourceConfig = Maybe S3SourceConfig
a} :: MetricSource)
instance Data.FromJSON MetricSource where
parseJSON :: Value -> Parser MetricSource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"MetricSource"
( \Object
x ->
Maybe AppFlowConfig
-> Maybe AthenaSourceConfig
-> Maybe CloudWatchConfig
-> Maybe RDSSourceConfig
-> Maybe RedshiftSourceConfig
-> Maybe S3SourceConfig
-> MetricSource
MetricSource'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AppFlowConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AthenaSourceConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CloudWatchConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RDSSourceConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RedshiftSourceConfig")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3SourceConfig")
)
instance Prelude.Hashable MetricSource where
hashWithSalt :: Int -> MetricSource -> Int
hashWithSalt Int
_salt MetricSource' {Maybe AppFlowConfig
Maybe AthenaSourceConfig
Maybe CloudWatchConfig
Maybe S3SourceConfig
Maybe RedshiftSourceConfig
Maybe RDSSourceConfig
s3SourceConfig :: Maybe S3SourceConfig
redshiftSourceConfig :: Maybe RedshiftSourceConfig
rDSSourceConfig :: Maybe RDSSourceConfig
cloudWatchConfig :: Maybe CloudWatchConfig
athenaSourceConfig :: Maybe AthenaSourceConfig
appFlowConfig :: Maybe AppFlowConfig
$sel:s3SourceConfig:MetricSource' :: MetricSource -> Maybe S3SourceConfig
$sel:redshiftSourceConfig:MetricSource' :: MetricSource -> Maybe RedshiftSourceConfig
$sel:rDSSourceConfig:MetricSource' :: MetricSource -> Maybe RDSSourceConfig
$sel:cloudWatchConfig:MetricSource' :: MetricSource -> Maybe CloudWatchConfig
$sel:athenaSourceConfig:MetricSource' :: MetricSource -> Maybe AthenaSourceConfig
$sel:appFlowConfig:MetricSource' :: MetricSource -> Maybe AppFlowConfig
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AppFlowConfig
appFlowConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AthenaSourceConfig
athenaSourceConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchConfig
cloudWatchConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RDSSourceConfig
rDSSourceConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RedshiftSourceConfig
redshiftSourceConfig
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3SourceConfig
s3SourceConfig
instance Prelude.NFData MetricSource where
rnf :: MetricSource -> ()
rnf MetricSource' {Maybe AppFlowConfig
Maybe AthenaSourceConfig
Maybe CloudWatchConfig
Maybe S3SourceConfig
Maybe RedshiftSourceConfig
Maybe RDSSourceConfig
s3SourceConfig :: Maybe S3SourceConfig
redshiftSourceConfig :: Maybe RedshiftSourceConfig
rDSSourceConfig :: Maybe RDSSourceConfig
cloudWatchConfig :: Maybe CloudWatchConfig
athenaSourceConfig :: Maybe AthenaSourceConfig
appFlowConfig :: Maybe AppFlowConfig
$sel:s3SourceConfig:MetricSource' :: MetricSource -> Maybe S3SourceConfig
$sel:redshiftSourceConfig:MetricSource' :: MetricSource -> Maybe RedshiftSourceConfig
$sel:rDSSourceConfig:MetricSource' :: MetricSource -> Maybe RDSSourceConfig
$sel:cloudWatchConfig:MetricSource' :: MetricSource -> Maybe CloudWatchConfig
$sel:athenaSourceConfig:MetricSource' :: MetricSource -> Maybe AthenaSourceConfig
$sel:appFlowConfig:MetricSource' :: MetricSource -> Maybe AppFlowConfig
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe AppFlowConfig
appFlowConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AthenaSourceConfig
athenaSourceConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudWatchConfig
cloudWatchConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RDSSourceConfig
rDSSourceConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RedshiftSourceConfig
redshiftSourceConfig
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3SourceConfig
s3SourceConfig
instance Data.ToJSON MetricSource where
toJSON :: MetricSource -> Value
toJSON MetricSource' {Maybe AppFlowConfig
Maybe AthenaSourceConfig
Maybe CloudWatchConfig
Maybe S3SourceConfig
Maybe RedshiftSourceConfig
Maybe RDSSourceConfig
s3SourceConfig :: Maybe S3SourceConfig
redshiftSourceConfig :: Maybe RedshiftSourceConfig
rDSSourceConfig :: Maybe RDSSourceConfig
cloudWatchConfig :: Maybe CloudWatchConfig
athenaSourceConfig :: Maybe AthenaSourceConfig
appFlowConfig :: Maybe AppFlowConfig
$sel:s3SourceConfig:MetricSource' :: MetricSource -> Maybe S3SourceConfig
$sel:redshiftSourceConfig:MetricSource' :: MetricSource -> Maybe RedshiftSourceConfig
$sel:rDSSourceConfig:MetricSource' :: MetricSource -> Maybe RDSSourceConfig
$sel:cloudWatchConfig:MetricSource' :: MetricSource -> Maybe CloudWatchConfig
$sel:athenaSourceConfig:MetricSource' :: MetricSource -> Maybe AthenaSourceConfig
$sel:appFlowConfig:MetricSource' :: MetricSource -> Maybe AppFlowConfig
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AppFlowConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AppFlowConfig
appFlowConfig,
(Key
"AthenaSourceConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AthenaSourceConfig
athenaSourceConfig,
(Key
"CloudWatchConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CloudWatchConfig
cloudWatchConfig,
(Key
"RDSSourceConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RDSSourceConfig
rDSSourceConfig,
(Key
"RedshiftSourceConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RedshiftSourceConfig
redshiftSourceConfig,
(Key
"S3SourceConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3SourceConfig
s3SourceConfig
]
)