{-# 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.SSM.Types.LoggingInfo where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LoggingInfo = LoggingInfo'
{
LoggingInfo -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
LoggingInfo -> Text
s3BucketName :: Prelude.Text,
LoggingInfo -> Text
s3Region :: Prelude.Text
}
deriving (LoggingInfo -> LoggingInfo -> Bool
(LoggingInfo -> LoggingInfo -> Bool)
-> (LoggingInfo -> LoggingInfo -> Bool) -> Eq LoggingInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingInfo -> LoggingInfo -> Bool
$c/= :: LoggingInfo -> LoggingInfo -> Bool
== :: LoggingInfo -> LoggingInfo -> Bool
$c== :: LoggingInfo -> LoggingInfo -> Bool
Prelude.Eq, ReadPrec [LoggingInfo]
ReadPrec LoggingInfo
Int -> ReadS LoggingInfo
ReadS [LoggingInfo]
(Int -> ReadS LoggingInfo)
-> ReadS [LoggingInfo]
-> ReadPrec LoggingInfo
-> ReadPrec [LoggingInfo]
-> Read LoggingInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingInfo]
$creadListPrec :: ReadPrec [LoggingInfo]
readPrec :: ReadPrec LoggingInfo
$creadPrec :: ReadPrec LoggingInfo
readList :: ReadS [LoggingInfo]
$creadList :: ReadS [LoggingInfo]
readsPrec :: Int -> ReadS LoggingInfo
$creadsPrec :: Int -> ReadS LoggingInfo
Prelude.Read, Int -> LoggingInfo -> ShowS
[LoggingInfo] -> ShowS
LoggingInfo -> String
(Int -> LoggingInfo -> ShowS)
-> (LoggingInfo -> String)
-> ([LoggingInfo] -> ShowS)
-> Show LoggingInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingInfo] -> ShowS
$cshowList :: [LoggingInfo] -> ShowS
show :: LoggingInfo -> String
$cshow :: LoggingInfo -> String
showsPrec :: Int -> LoggingInfo -> ShowS
$cshowsPrec :: Int -> LoggingInfo -> ShowS
Prelude.Show, (forall x. LoggingInfo -> Rep LoggingInfo x)
-> (forall x. Rep LoggingInfo x -> LoggingInfo)
-> Generic LoggingInfo
forall x. Rep LoggingInfo x -> LoggingInfo
forall x. LoggingInfo -> Rep LoggingInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingInfo x -> LoggingInfo
$cfrom :: forall x. LoggingInfo -> Rep LoggingInfo x
Prelude.Generic)
newLoggingInfo ::
Prelude.Text ->
Prelude.Text ->
LoggingInfo
newLoggingInfo :: Text -> Text -> LoggingInfo
newLoggingInfo Text
pS3BucketName_ Text
pS3Region_ =
LoggingInfo' :: Maybe Text -> Text -> Text -> LoggingInfo
LoggingInfo'
{ $sel:s3KeyPrefix:LoggingInfo' :: Maybe Text
s3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:s3BucketName:LoggingInfo' :: Text
s3BucketName = Text
pS3BucketName_,
$sel:s3Region:LoggingInfo' :: Text
s3Region = Text
pS3Region_
}
loggingInfo_s3KeyPrefix :: Lens.Lens' LoggingInfo (Prelude.Maybe Prelude.Text)
loggingInfo_s3KeyPrefix :: (Maybe Text -> f (Maybe Text)) -> LoggingInfo -> f LoggingInfo
loggingInfo_s3KeyPrefix = (LoggingInfo -> Maybe Text)
-> (LoggingInfo -> Maybe Text -> LoggingInfo)
-> Lens LoggingInfo LoggingInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingInfo' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:LoggingInfo' :: LoggingInfo -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: LoggingInfo
s@LoggingInfo' {} Maybe Text
a -> LoggingInfo
s {$sel:s3KeyPrefix:LoggingInfo' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: LoggingInfo)
loggingInfo_s3BucketName :: Lens.Lens' LoggingInfo Prelude.Text
loggingInfo_s3BucketName :: (Text -> f Text) -> LoggingInfo -> f LoggingInfo
loggingInfo_s3BucketName = (LoggingInfo -> Text)
-> (LoggingInfo -> Text -> LoggingInfo)
-> Lens LoggingInfo LoggingInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingInfo' {Text
s3BucketName :: Text
$sel:s3BucketName:LoggingInfo' :: LoggingInfo -> Text
s3BucketName} -> Text
s3BucketName) (\s :: LoggingInfo
s@LoggingInfo' {} Text
a -> LoggingInfo
s {$sel:s3BucketName:LoggingInfo' :: Text
s3BucketName = Text
a} :: LoggingInfo)
loggingInfo_s3Region :: Lens.Lens' LoggingInfo Prelude.Text
loggingInfo_s3Region :: (Text -> f Text) -> LoggingInfo -> f LoggingInfo
loggingInfo_s3Region = (LoggingInfo -> Text)
-> (LoggingInfo -> Text -> LoggingInfo)
-> Lens LoggingInfo LoggingInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingInfo' {Text
s3Region :: Text
$sel:s3Region:LoggingInfo' :: LoggingInfo -> Text
s3Region} -> Text
s3Region) (\s :: LoggingInfo
s@LoggingInfo' {} Text
a -> LoggingInfo
s {$sel:s3Region:LoggingInfo' :: Text
s3Region = Text
a} :: LoggingInfo)
instance Core.FromJSON LoggingInfo where
parseJSON :: Value -> Parser LoggingInfo
parseJSON =
String
-> (Object -> Parser LoggingInfo) -> Value -> Parser LoggingInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LoggingInfo"
( \Object
x ->
Maybe Text -> Text -> Text -> LoggingInfo
LoggingInfo'
(Maybe Text -> Text -> Text -> LoggingInfo)
-> Parser (Maybe Text) -> Parser (Text -> Text -> LoggingInfo)
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
"S3KeyPrefix")
Parser (Text -> Text -> LoggingInfo)
-> Parser Text -> Parser (Text -> LoggingInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3BucketName")
Parser (Text -> LoggingInfo) -> Parser Text -> Parser LoggingInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Region")
)
instance Prelude.Hashable LoggingInfo
instance Prelude.NFData LoggingInfo
instance Core.ToJSON LoggingInfo where
toJSON :: LoggingInfo -> Value
toJSON LoggingInfo' {Maybe Text
Text
s3Region :: Text
s3BucketName :: Text
s3KeyPrefix :: Maybe Text
$sel:s3Region:LoggingInfo' :: LoggingInfo -> Text
$sel:s3BucketName:LoggingInfo' :: LoggingInfo -> Text
$sel:s3KeyPrefix:LoggingInfo' :: LoggingInfo -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"S3KeyPrefix" 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
s3KeyPrefix,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3BucketName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3BucketName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Region" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Region)
]
)