{-# 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.Config.Types.ConfigurationRecorder where
import Amazonka.Config.Types.RecordingGroup
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ConfigurationRecorder = ConfigurationRecorder'
{
ConfigurationRecorder -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
ConfigurationRecorder -> Maybe RecordingGroup
recordingGroup :: Prelude.Maybe RecordingGroup,
ConfigurationRecorder -> Maybe Text
roleARN :: Prelude.Maybe Prelude.Text
}
deriving (ConfigurationRecorder -> ConfigurationRecorder -> Bool
(ConfigurationRecorder -> ConfigurationRecorder -> Bool)
-> (ConfigurationRecorder -> ConfigurationRecorder -> Bool)
-> Eq ConfigurationRecorder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationRecorder -> ConfigurationRecorder -> Bool
$c/= :: ConfigurationRecorder -> ConfigurationRecorder -> Bool
== :: ConfigurationRecorder -> ConfigurationRecorder -> Bool
$c== :: ConfigurationRecorder -> ConfigurationRecorder -> Bool
Prelude.Eq, ReadPrec [ConfigurationRecorder]
ReadPrec ConfigurationRecorder
Int -> ReadS ConfigurationRecorder
ReadS [ConfigurationRecorder]
(Int -> ReadS ConfigurationRecorder)
-> ReadS [ConfigurationRecorder]
-> ReadPrec ConfigurationRecorder
-> ReadPrec [ConfigurationRecorder]
-> Read ConfigurationRecorder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationRecorder]
$creadListPrec :: ReadPrec [ConfigurationRecorder]
readPrec :: ReadPrec ConfigurationRecorder
$creadPrec :: ReadPrec ConfigurationRecorder
readList :: ReadS [ConfigurationRecorder]
$creadList :: ReadS [ConfigurationRecorder]
readsPrec :: Int -> ReadS ConfigurationRecorder
$creadsPrec :: Int -> ReadS ConfigurationRecorder
Prelude.Read, Int -> ConfigurationRecorder -> ShowS
[ConfigurationRecorder] -> ShowS
ConfigurationRecorder -> String
(Int -> ConfigurationRecorder -> ShowS)
-> (ConfigurationRecorder -> String)
-> ([ConfigurationRecorder] -> ShowS)
-> Show ConfigurationRecorder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationRecorder] -> ShowS
$cshowList :: [ConfigurationRecorder] -> ShowS
show :: ConfigurationRecorder -> String
$cshow :: ConfigurationRecorder -> String
showsPrec :: Int -> ConfigurationRecorder -> ShowS
$cshowsPrec :: Int -> ConfigurationRecorder -> ShowS
Prelude.Show, (forall x. ConfigurationRecorder -> Rep ConfigurationRecorder x)
-> (forall x. Rep ConfigurationRecorder x -> ConfigurationRecorder)
-> Generic ConfigurationRecorder
forall x. Rep ConfigurationRecorder x -> ConfigurationRecorder
forall x. ConfigurationRecorder -> Rep ConfigurationRecorder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationRecorder x -> ConfigurationRecorder
$cfrom :: forall x. ConfigurationRecorder -> Rep ConfigurationRecorder x
Prelude.Generic)
newConfigurationRecorder ::
ConfigurationRecorder
newConfigurationRecorder :: ConfigurationRecorder
newConfigurationRecorder =
ConfigurationRecorder' :: Maybe Text
-> Maybe RecordingGroup -> Maybe Text -> ConfigurationRecorder
ConfigurationRecorder'
{ $sel:name:ConfigurationRecorder' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:recordingGroup:ConfigurationRecorder' :: Maybe RecordingGroup
recordingGroup = Maybe RecordingGroup
forall a. Maybe a
Prelude.Nothing,
$sel:roleARN:ConfigurationRecorder' :: Maybe Text
roleARN = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
configurationRecorder_name :: Lens.Lens' ConfigurationRecorder (Prelude.Maybe Prelude.Text)
configurationRecorder_name :: (Maybe Text -> f (Maybe Text))
-> ConfigurationRecorder -> f ConfigurationRecorder
configurationRecorder_name = (ConfigurationRecorder -> Maybe Text)
-> (ConfigurationRecorder -> Maybe Text -> ConfigurationRecorder)
-> Lens
ConfigurationRecorder
ConfigurationRecorder
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationRecorder' {Maybe Text
name :: Maybe Text
$sel:name:ConfigurationRecorder' :: ConfigurationRecorder -> Maybe Text
name} -> Maybe Text
name) (\s :: ConfigurationRecorder
s@ConfigurationRecorder' {} Maybe Text
a -> ConfigurationRecorder
s {$sel:name:ConfigurationRecorder' :: Maybe Text
name = Maybe Text
a} :: ConfigurationRecorder)
configurationRecorder_recordingGroup :: Lens.Lens' ConfigurationRecorder (Prelude.Maybe RecordingGroup)
configurationRecorder_recordingGroup :: (Maybe RecordingGroup -> f (Maybe RecordingGroup))
-> ConfigurationRecorder -> f ConfigurationRecorder
configurationRecorder_recordingGroup = (ConfigurationRecorder -> Maybe RecordingGroup)
-> (ConfigurationRecorder
-> Maybe RecordingGroup -> ConfigurationRecorder)
-> Lens
ConfigurationRecorder
ConfigurationRecorder
(Maybe RecordingGroup)
(Maybe RecordingGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationRecorder' {Maybe RecordingGroup
recordingGroup :: Maybe RecordingGroup
$sel:recordingGroup:ConfigurationRecorder' :: ConfigurationRecorder -> Maybe RecordingGroup
recordingGroup} -> Maybe RecordingGroup
recordingGroup) (\s :: ConfigurationRecorder
s@ConfigurationRecorder' {} Maybe RecordingGroup
a -> ConfigurationRecorder
s {$sel:recordingGroup:ConfigurationRecorder' :: Maybe RecordingGroup
recordingGroup = Maybe RecordingGroup
a} :: ConfigurationRecorder)
configurationRecorder_roleARN :: Lens.Lens' ConfigurationRecorder (Prelude.Maybe Prelude.Text)
configurationRecorder_roleARN :: (Maybe Text -> f (Maybe Text))
-> ConfigurationRecorder -> f ConfigurationRecorder
configurationRecorder_roleARN = (ConfigurationRecorder -> Maybe Text)
-> (ConfigurationRecorder -> Maybe Text -> ConfigurationRecorder)
-> Lens
ConfigurationRecorder
ConfigurationRecorder
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationRecorder' {Maybe Text
roleARN :: Maybe Text
$sel:roleARN:ConfigurationRecorder' :: ConfigurationRecorder -> Maybe Text
roleARN} -> Maybe Text
roleARN) (\s :: ConfigurationRecorder
s@ConfigurationRecorder' {} Maybe Text
a -> ConfigurationRecorder
s {$sel:roleARN:ConfigurationRecorder' :: Maybe Text
roleARN = Maybe Text
a} :: ConfigurationRecorder)
instance Core.FromJSON ConfigurationRecorder where
parseJSON :: Value -> Parser ConfigurationRecorder
parseJSON =
String
-> (Object -> Parser ConfigurationRecorder)
-> Value
-> Parser ConfigurationRecorder
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConfigurationRecorder"
( \Object
x ->
Maybe Text
-> Maybe RecordingGroup -> Maybe Text -> ConfigurationRecorder
ConfigurationRecorder'
(Maybe Text
-> Maybe RecordingGroup -> Maybe Text -> ConfigurationRecorder)
-> Parser (Maybe Text)
-> Parser
(Maybe RecordingGroup -> Maybe Text -> ConfigurationRecorder)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
Parser
(Maybe RecordingGroup -> Maybe Text -> ConfigurationRecorder)
-> Parser (Maybe RecordingGroup)
-> Parser (Maybe Text -> ConfigurationRecorder)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RecordingGroup)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"recordingGroup")
Parser (Maybe Text -> ConfigurationRecorder)
-> Parser (Maybe Text) -> Parser ConfigurationRecorder
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"roleARN")
)
instance Prelude.Hashable ConfigurationRecorder
instance Prelude.NFData ConfigurationRecorder
instance Core.ToJSON ConfigurationRecorder where
toJSON :: ConfigurationRecorder -> Value
toJSON ConfigurationRecorder' {Maybe Text
Maybe RecordingGroup
roleARN :: Maybe Text
recordingGroup :: Maybe RecordingGroup
name :: Maybe Text
$sel:roleARN:ConfigurationRecorder' :: ConfigurationRecorder -> Maybe Text
$sel:recordingGroup:ConfigurationRecorder' :: ConfigurationRecorder -> Maybe RecordingGroup
$sel:name:ConfigurationRecorder' :: ConfigurationRecorder -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Text
"recordingGroup" Text -> RecordingGroup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(RecordingGroup -> Pair) -> Maybe RecordingGroup -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RecordingGroup
recordingGroup,
(Text
"roleARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleARN
]
)