{-# 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.CloudWatchConfig 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.BackTestConfiguration
import qualified Amazonka.Prelude as Prelude
data CloudWatchConfig = CloudWatchConfig'
{
CloudWatchConfig -> Maybe BackTestConfiguration
backTestConfiguration :: Prelude.Maybe BackTestConfiguration,
CloudWatchConfig -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
}
deriving (CloudWatchConfig -> CloudWatchConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchConfig -> CloudWatchConfig -> Bool
$c/= :: CloudWatchConfig -> CloudWatchConfig -> Bool
== :: CloudWatchConfig -> CloudWatchConfig -> Bool
$c== :: CloudWatchConfig -> CloudWatchConfig -> Bool
Prelude.Eq, ReadPrec [CloudWatchConfig]
ReadPrec CloudWatchConfig
Int -> ReadS CloudWatchConfig
ReadS [CloudWatchConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchConfig]
$creadListPrec :: ReadPrec [CloudWatchConfig]
readPrec :: ReadPrec CloudWatchConfig
$creadPrec :: ReadPrec CloudWatchConfig
readList :: ReadS [CloudWatchConfig]
$creadList :: ReadS [CloudWatchConfig]
readsPrec :: Int -> ReadS CloudWatchConfig
$creadsPrec :: Int -> ReadS CloudWatchConfig
Prelude.Read, Int -> CloudWatchConfig -> ShowS
[CloudWatchConfig] -> ShowS
CloudWatchConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchConfig] -> ShowS
$cshowList :: [CloudWatchConfig] -> ShowS
show :: CloudWatchConfig -> String
$cshow :: CloudWatchConfig -> String
showsPrec :: Int -> CloudWatchConfig -> ShowS
$cshowsPrec :: Int -> CloudWatchConfig -> ShowS
Prelude.Show, forall x. Rep CloudWatchConfig x -> CloudWatchConfig
forall x. CloudWatchConfig -> Rep CloudWatchConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudWatchConfig x -> CloudWatchConfig
$cfrom :: forall x. CloudWatchConfig -> Rep CloudWatchConfig x
Prelude.Generic)
newCloudWatchConfig ::
CloudWatchConfig
newCloudWatchConfig :: CloudWatchConfig
newCloudWatchConfig =
CloudWatchConfig'
{ $sel:backTestConfiguration:CloudWatchConfig' :: Maybe BackTestConfiguration
backTestConfiguration =
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:CloudWatchConfig' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing
}
cloudWatchConfig_backTestConfiguration :: Lens.Lens' CloudWatchConfig (Prelude.Maybe BackTestConfiguration)
cloudWatchConfig_backTestConfiguration :: Lens' CloudWatchConfig (Maybe BackTestConfiguration)
cloudWatchConfig_backTestConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchConfig' {Maybe BackTestConfiguration
backTestConfiguration :: Maybe BackTestConfiguration
$sel:backTestConfiguration:CloudWatchConfig' :: CloudWatchConfig -> Maybe BackTestConfiguration
backTestConfiguration} -> Maybe BackTestConfiguration
backTestConfiguration) (\s :: CloudWatchConfig
s@CloudWatchConfig' {} Maybe BackTestConfiguration
a -> CloudWatchConfig
s {$sel:backTestConfiguration:CloudWatchConfig' :: Maybe BackTestConfiguration
backTestConfiguration = Maybe BackTestConfiguration
a} :: CloudWatchConfig)
cloudWatchConfig_roleArn :: Lens.Lens' CloudWatchConfig (Prelude.Maybe Prelude.Text)
cloudWatchConfig_roleArn :: Lens' CloudWatchConfig (Maybe Text)
cloudWatchConfig_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchConfig' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:CloudWatchConfig' :: CloudWatchConfig -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: CloudWatchConfig
s@CloudWatchConfig' {} Maybe Text
a -> CloudWatchConfig
s {$sel:roleArn:CloudWatchConfig' :: Maybe Text
roleArn = Maybe Text
a} :: CloudWatchConfig)
instance Data.FromJSON CloudWatchConfig where
parseJSON :: Value -> Parser CloudWatchConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CloudWatchConfig"
( \Object
x ->
Maybe BackTestConfiguration -> Maybe Text -> CloudWatchConfig
CloudWatchConfig'
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
"BackTestConfiguration")
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
"RoleArn")
)
instance Prelude.Hashable CloudWatchConfig where
hashWithSalt :: Int -> CloudWatchConfig -> Int
hashWithSalt Int
_salt CloudWatchConfig' {Maybe Text
Maybe BackTestConfiguration
roleArn :: Maybe Text
backTestConfiguration :: Maybe BackTestConfiguration
$sel:roleArn:CloudWatchConfig' :: CloudWatchConfig -> Maybe Text
$sel:backTestConfiguration:CloudWatchConfig' :: CloudWatchConfig -> Maybe BackTestConfiguration
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BackTestConfiguration
backTestConfiguration
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn
instance Prelude.NFData CloudWatchConfig where
rnf :: CloudWatchConfig -> ()
rnf CloudWatchConfig' {Maybe Text
Maybe BackTestConfiguration
roleArn :: Maybe Text
backTestConfiguration :: Maybe BackTestConfiguration
$sel:roleArn:CloudWatchConfig' :: CloudWatchConfig -> Maybe Text
$sel:backTestConfiguration:CloudWatchConfig' :: CloudWatchConfig -> Maybe BackTestConfiguration
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe BackTestConfiguration
backTestConfiguration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn
instance Data.ToJSON CloudWatchConfig where
toJSON :: CloudWatchConfig -> Value
toJSON CloudWatchConfig' {Maybe Text
Maybe BackTestConfiguration
roleArn :: Maybe Text
backTestConfiguration :: Maybe BackTestConfiguration
$sel:roleArn:CloudWatchConfig' :: CloudWatchConfig -> Maybe Text
$sel:backTestConfiguration:CloudWatchConfig' :: CloudWatchConfig -> Maybe BackTestConfiguration
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"BackTestConfiguration" 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 BackTestConfiguration
backTestConfiguration,
(Key
"RoleArn" 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 Text
roleArn
]
)