{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Macie.Types.S3ResourceClassification
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Macie.Types.S3ResourceClassification where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Macie.Types.ClassificationType
import qualified Amazonka.Prelude as Prelude

-- | (Discontinued) The S3 resources that you want to associate with Amazon
-- Macie Classic for monitoring and data classification. This data type is
-- used as a request parameter in the @AssociateS3Resources@ action and a
-- response parameter in the @ListS3Resources@ action.
--
-- /See:/ 'newS3ResourceClassification' smart constructor.
data S3ResourceClassification = S3ResourceClassification'
  { -- | (Discontinued) The prefix of the S3 bucket that you want to associate
    -- with Amazon Macie Classic.
    S3ResourceClassification -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | (Discontinued) The name of the S3 bucket that you want to associate with
    -- Amazon Macie Classic.
    S3ResourceClassification -> Text
bucketName :: Prelude.Text,
    -- | (Discontinued) The classification type that you want to specify for the
    -- resource associated with Amazon Macie Classic.
    S3ResourceClassification -> ClassificationType
classificationType :: ClassificationType
  }
  deriving (S3ResourceClassification -> S3ResourceClassification -> Bool
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]
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
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.
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)

-- |
-- Create a value of 'S3ResourceClassification' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'prefix', 's3ResourceClassification_prefix' - (Discontinued) The prefix of the S3 bucket that you want to associate
-- with Amazon Macie Classic.
--
-- 'bucketName', 's3ResourceClassification_bucketName' - (Discontinued) The name of the S3 bucket that you want to associate with
-- Amazon Macie Classic.
--
-- 'classificationType', 's3ResourceClassification_classificationType' - (Discontinued) The classification type that you want to specify for the
-- resource associated with Amazon Macie Classic.
newS3ResourceClassification ::
  -- | 'bucketName'
  Prelude.Text ->
  -- | 'classificationType'
  ClassificationType ->
  S3ResourceClassification
newS3ResourceClassification :: Text -> ClassificationType -> S3ResourceClassification
newS3ResourceClassification
  Text
pBucketName_
  ClassificationType
pClassificationType_ =
    S3ResourceClassification'
      { $sel:prefix:S3ResourceClassification' :: Maybe Text
prefix = forall a. Maybe a
Prelude.Nothing,
        $sel:bucketName:S3ResourceClassification' :: Text
bucketName = Text
pBucketName_,
        $sel:classificationType:S3ResourceClassification' :: ClassificationType
classificationType = ClassificationType
pClassificationType_
      }

-- | (Discontinued) The prefix of the S3 bucket that you want to associate
-- with Amazon Macie Classic.
s3ResourceClassification_prefix :: Lens.Lens' S3ResourceClassification (Prelude.Maybe Prelude.Text)
s3ResourceClassification_prefix :: Lens' S3ResourceClassification (Maybe Text)
s3ResourceClassification_prefix = 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)

-- | (Discontinued) The name of the S3 bucket that you want to associate with
-- Amazon Macie Classic.
s3ResourceClassification_bucketName :: Lens.Lens' S3ResourceClassification Prelude.Text
s3ResourceClassification_bucketName :: Lens' S3ResourceClassification Text
s3ResourceClassification_bucketName = 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)

-- | (Discontinued) The classification type that you want to specify for the
-- resource associated with Amazon Macie Classic.
s3ResourceClassification_classificationType :: Lens.Lens' S3ResourceClassification ClassificationType
s3ResourceClassification_classificationType :: Lens' S3ResourceClassification ClassificationType
s3ResourceClassification_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 Data.FromJSON S3ResourceClassification where
  parseJSON :: Value -> Parser S3ResourceClassification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3ResourceClassification"
      ( \Object
x ->
          Maybe Text
-> Text -> ClassificationType -> S3ResourceClassification
S3ResourceClassification'
            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
"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
"bucketName")
            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
"classificationType")
      )

instance Prelude.Hashable S3ResourceClassification where
  hashWithSalt :: Int -> S3ResourceClassification -> Int
hashWithSalt Int
_salt 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
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
prefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ClassificationType
classificationType

instance Prelude.NFData S3ResourceClassification where
  rnf :: S3ResourceClassification -> ()
rnf 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
..} =
    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 Text
bucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ClassificationType
classificationType

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"bucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucketName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"classificationType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ClassificationType
classificationType)
          ]
      )