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