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