{-# 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.Lightsail.Types.BucketAccessLogConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data BucketAccessLogConfig = BucketAccessLogConfig'
{
BucketAccessLogConfig -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
BucketAccessLogConfig -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
BucketAccessLogConfig -> Bool
enabled :: Prelude.Bool
}
deriving (BucketAccessLogConfig -> BucketAccessLogConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BucketAccessLogConfig -> BucketAccessLogConfig -> Bool
$c/= :: BucketAccessLogConfig -> BucketAccessLogConfig -> Bool
== :: BucketAccessLogConfig -> BucketAccessLogConfig -> Bool
$c== :: BucketAccessLogConfig -> BucketAccessLogConfig -> Bool
Prelude.Eq, ReadPrec [BucketAccessLogConfig]
ReadPrec BucketAccessLogConfig
Int -> ReadS BucketAccessLogConfig
ReadS [BucketAccessLogConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BucketAccessLogConfig]
$creadListPrec :: ReadPrec [BucketAccessLogConfig]
readPrec :: ReadPrec BucketAccessLogConfig
$creadPrec :: ReadPrec BucketAccessLogConfig
readList :: ReadS [BucketAccessLogConfig]
$creadList :: ReadS [BucketAccessLogConfig]
readsPrec :: Int -> ReadS BucketAccessLogConfig
$creadsPrec :: Int -> ReadS BucketAccessLogConfig
Prelude.Read, Int -> BucketAccessLogConfig -> ShowS
[BucketAccessLogConfig] -> ShowS
BucketAccessLogConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BucketAccessLogConfig] -> ShowS
$cshowList :: [BucketAccessLogConfig] -> ShowS
show :: BucketAccessLogConfig -> String
$cshow :: BucketAccessLogConfig -> String
showsPrec :: Int -> BucketAccessLogConfig -> ShowS
$cshowsPrec :: Int -> BucketAccessLogConfig -> ShowS
Prelude.Show, forall x. Rep BucketAccessLogConfig x -> BucketAccessLogConfig
forall x. BucketAccessLogConfig -> Rep BucketAccessLogConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BucketAccessLogConfig x -> BucketAccessLogConfig
$cfrom :: forall x. BucketAccessLogConfig -> Rep BucketAccessLogConfig x
Prelude.Generic)
newBucketAccessLogConfig ::
Prelude.Bool ->
BucketAccessLogConfig
newBucketAccessLogConfig :: Bool -> BucketAccessLogConfig
newBucketAccessLogConfig Bool
pEnabled_ =
BucketAccessLogConfig'
{ $sel:destination:BucketAccessLogConfig' :: Maybe Text
destination =
forall a. Maybe a
Prelude.Nothing,
$sel:prefix:BucketAccessLogConfig' :: Maybe Text
prefix = forall a. Maybe a
Prelude.Nothing,
$sel:enabled:BucketAccessLogConfig' :: Bool
enabled = Bool
pEnabled_
}
bucketAccessLogConfig_destination :: Lens.Lens' BucketAccessLogConfig (Prelude.Maybe Prelude.Text)
bucketAccessLogConfig_destination :: Lens' BucketAccessLogConfig (Maybe Text)
bucketAccessLogConfig_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketAccessLogConfig' {Maybe Text
destination :: Maybe Text
$sel:destination:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
destination} -> Maybe Text
destination) (\s :: BucketAccessLogConfig
s@BucketAccessLogConfig' {} Maybe Text
a -> BucketAccessLogConfig
s {$sel:destination:BucketAccessLogConfig' :: Maybe Text
destination = Maybe Text
a} :: BucketAccessLogConfig)
bucketAccessLogConfig_prefix :: Lens.Lens' BucketAccessLogConfig (Prelude.Maybe Prelude.Text)
bucketAccessLogConfig_prefix :: Lens' BucketAccessLogConfig (Maybe Text)
bucketAccessLogConfig_prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketAccessLogConfig' {Maybe Text
prefix :: Maybe Text
$sel:prefix:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: BucketAccessLogConfig
s@BucketAccessLogConfig' {} Maybe Text
a -> BucketAccessLogConfig
s {$sel:prefix:BucketAccessLogConfig' :: Maybe Text
prefix = Maybe Text
a} :: BucketAccessLogConfig)
bucketAccessLogConfig_enabled :: Lens.Lens' BucketAccessLogConfig Prelude.Bool
bucketAccessLogConfig_enabled :: Lens' BucketAccessLogConfig Bool
bucketAccessLogConfig_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BucketAccessLogConfig' {Bool
enabled :: Bool
$sel:enabled:BucketAccessLogConfig' :: BucketAccessLogConfig -> Bool
enabled} -> Bool
enabled) (\s :: BucketAccessLogConfig
s@BucketAccessLogConfig' {} Bool
a -> BucketAccessLogConfig
s {$sel:enabled:BucketAccessLogConfig' :: Bool
enabled = Bool
a} :: BucketAccessLogConfig)
instance Data.FromJSON BucketAccessLogConfig where
parseJSON :: Value -> Parser BucketAccessLogConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"BucketAccessLogConfig"
( \Object
x ->
Maybe Text -> Maybe Text -> Bool -> BucketAccessLogConfig
BucketAccessLogConfig'
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
"destination")
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
"prefix")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"enabled")
)
instance Prelude.Hashable BucketAccessLogConfig where
hashWithSalt :: Int -> BucketAccessLogConfig -> Int
hashWithSalt Int
_salt BucketAccessLogConfig' {Bool
Maybe Text
enabled :: Bool
prefix :: Maybe Text
destination :: Maybe Text
$sel:enabled:BucketAccessLogConfig' :: BucketAccessLogConfig -> Bool
$sel:prefix:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
$sel:destination:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destination
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefix
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
enabled
instance Prelude.NFData BucketAccessLogConfig where
rnf :: BucketAccessLogConfig -> ()
rnf BucketAccessLogConfig' {Bool
Maybe Text
enabled :: Bool
prefix :: Maybe Text
destination :: Maybe Text
$sel:enabled:BucketAccessLogConfig' :: BucketAccessLogConfig -> Bool
$sel:prefix:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
$sel:destination:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
prefix
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
enabled
instance Data.ToJSON BucketAccessLogConfig where
toJSON :: BucketAccessLogConfig -> Value
toJSON BucketAccessLogConfig' {Bool
Maybe Text
enabled :: Bool
prefix :: Maybe Text
destination :: Maybe Text
$sel:enabled:BucketAccessLogConfig' :: BucketAccessLogConfig -> Bool
$sel:prefix:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
$sel:destination:BucketAccessLogConfig' :: BucketAccessLogConfig -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"destination" 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
destination,
(Key
"prefix" 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
prefix,
forall a. a -> Maybe a
Prelude.Just (Key
"enabled" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
enabled)
]
)