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