{-# 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.OpsWorks.Types.CloudWatchLogsConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpsWorks.Types.CloudWatchLogsLogStream
import qualified Amazonka.Prelude as Prelude
data CloudWatchLogsConfiguration = CloudWatchLogsConfiguration'
{
CloudWatchLogsConfiguration -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
CloudWatchLogsConfiguration -> Maybe [CloudWatchLogsLogStream]
logStreams :: Prelude.Maybe [CloudWatchLogsLogStream]
}
deriving (CloudWatchLogsConfiguration -> CloudWatchLogsConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLogsConfiguration -> CloudWatchLogsConfiguration -> Bool
$c/= :: CloudWatchLogsConfiguration -> CloudWatchLogsConfiguration -> Bool
== :: CloudWatchLogsConfiguration -> CloudWatchLogsConfiguration -> Bool
$c== :: CloudWatchLogsConfiguration -> CloudWatchLogsConfiguration -> Bool
Prelude.Eq, ReadPrec [CloudWatchLogsConfiguration]
ReadPrec CloudWatchLogsConfiguration
Int -> ReadS CloudWatchLogsConfiguration
ReadS [CloudWatchLogsConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLogsConfiguration]
$creadListPrec :: ReadPrec [CloudWatchLogsConfiguration]
readPrec :: ReadPrec CloudWatchLogsConfiguration
$creadPrec :: ReadPrec CloudWatchLogsConfiguration
readList :: ReadS [CloudWatchLogsConfiguration]
$creadList :: ReadS [CloudWatchLogsConfiguration]
readsPrec :: Int -> ReadS CloudWatchLogsConfiguration
$creadsPrec :: Int -> ReadS CloudWatchLogsConfiguration
Prelude.Read, Int -> CloudWatchLogsConfiguration -> ShowS
[CloudWatchLogsConfiguration] -> ShowS
CloudWatchLogsConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLogsConfiguration] -> ShowS
$cshowList :: [CloudWatchLogsConfiguration] -> ShowS
show :: CloudWatchLogsConfiguration -> String
$cshow :: CloudWatchLogsConfiguration -> String
showsPrec :: Int -> CloudWatchLogsConfiguration -> ShowS
$cshowsPrec :: Int -> CloudWatchLogsConfiguration -> ShowS
Prelude.Show, forall x.
Rep CloudWatchLogsConfiguration x -> CloudWatchLogsConfiguration
forall x.
CloudWatchLogsConfiguration -> Rep CloudWatchLogsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudWatchLogsConfiguration x -> CloudWatchLogsConfiguration
$cfrom :: forall x.
CloudWatchLogsConfiguration -> Rep CloudWatchLogsConfiguration x
Prelude.Generic)
newCloudWatchLogsConfiguration ::
CloudWatchLogsConfiguration
newCloudWatchLogsConfiguration :: CloudWatchLogsConfiguration
newCloudWatchLogsConfiguration =
CloudWatchLogsConfiguration'
{ $sel:enabled:CloudWatchLogsConfiguration' :: Maybe Bool
enabled =
forall a. Maybe a
Prelude.Nothing,
$sel:logStreams:CloudWatchLogsConfiguration' :: Maybe [CloudWatchLogsLogStream]
logStreams = forall a. Maybe a
Prelude.Nothing
}
cloudWatchLogsConfiguration_enabled :: Lens.Lens' CloudWatchLogsConfiguration (Prelude.Maybe Prelude.Bool)
cloudWatchLogsConfiguration_enabled :: Lens' CloudWatchLogsConfiguration (Maybe Bool)
cloudWatchLogsConfiguration_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogsConfiguration' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CloudWatchLogsConfiguration
s@CloudWatchLogsConfiguration' {} Maybe Bool
a -> CloudWatchLogsConfiguration
s {$sel:enabled:CloudWatchLogsConfiguration' :: Maybe Bool
enabled = Maybe Bool
a} :: CloudWatchLogsConfiguration)
cloudWatchLogsConfiguration_logStreams :: Lens.Lens' CloudWatchLogsConfiguration (Prelude.Maybe [CloudWatchLogsLogStream])
cloudWatchLogsConfiguration_logStreams :: Lens' CloudWatchLogsConfiguration (Maybe [CloudWatchLogsLogStream])
cloudWatchLogsConfiguration_logStreams = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogsConfiguration' {Maybe [CloudWatchLogsLogStream]
logStreams :: Maybe [CloudWatchLogsLogStream]
$sel:logStreams:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe [CloudWatchLogsLogStream]
logStreams} -> Maybe [CloudWatchLogsLogStream]
logStreams) (\s :: CloudWatchLogsConfiguration
s@CloudWatchLogsConfiguration' {} Maybe [CloudWatchLogsLogStream]
a -> CloudWatchLogsConfiguration
s {$sel:logStreams:CloudWatchLogsConfiguration' :: Maybe [CloudWatchLogsLogStream]
logStreams = Maybe [CloudWatchLogsLogStream]
a} :: CloudWatchLogsConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON CloudWatchLogsConfiguration where
parseJSON :: Value -> Parser CloudWatchLogsConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CloudWatchLogsConfiguration"
( \Object
x ->
Maybe Bool
-> Maybe [CloudWatchLogsLogStream] -> CloudWatchLogsConfiguration
CloudWatchLogsConfiguration'
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
"Enabled")
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
"LogStreams" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable CloudWatchLogsConfiguration where
hashWithSalt :: Int -> CloudWatchLogsConfiguration -> Int
hashWithSalt Int
_salt CloudWatchLogsConfiguration' {Maybe Bool
Maybe [CloudWatchLogsLogStream]
logStreams :: Maybe [CloudWatchLogsLogStream]
enabled :: Maybe Bool
$sel:logStreams:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe [CloudWatchLogsLogStream]
$sel:enabled:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CloudWatchLogsLogStream]
logStreams
instance Prelude.NFData CloudWatchLogsConfiguration where
rnf :: CloudWatchLogsConfiguration -> ()
rnf CloudWatchLogsConfiguration' {Maybe Bool
Maybe [CloudWatchLogsLogStream]
logStreams :: Maybe [CloudWatchLogsLogStream]
enabled :: Maybe Bool
$sel:logStreams:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe [CloudWatchLogsLogStream]
$sel:enabled:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CloudWatchLogsLogStream]
logStreams
instance Data.ToJSON CloudWatchLogsConfiguration where
toJSON :: CloudWatchLogsConfiguration -> Value
toJSON CloudWatchLogsConfiguration' {Maybe Bool
Maybe [CloudWatchLogsLogStream]
logStreams :: Maybe [CloudWatchLogsLogStream]
enabled :: Maybe Bool
$sel:logStreams:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe [CloudWatchLogsLogStream]
$sel:enabled:CloudWatchLogsConfiguration' :: CloudWatchLogsConfiguration -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Enabled" 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 Bool
enabled,
(Key
"LogStreams" 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 [CloudWatchLogsLogStream]
logStreams
]
)