{-# 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.MacieV2.Types.S3WordsList
-- 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.MacieV2.Types.S3WordsList 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

-- | Provides information about an S3 object that lists specific text to
-- ignore.
--
-- /See:/ 'newS3WordsList' smart constructor.
data S3WordsList = S3WordsList'
  { -- | The full name of the S3 bucket that contains the object.
    S3WordsList -> Text
bucketName :: Prelude.Text,
    -- | The full name (key) of the object.
    S3WordsList -> Text
objectKey :: Prelude.Text
  }
  deriving (S3WordsList -> S3WordsList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3WordsList -> S3WordsList -> Bool
$c/= :: S3WordsList -> S3WordsList -> Bool
== :: S3WordsList -> S3WordsList -> Bool
$c== :: S3WordsList -> S3WordsList -> Bool
Prelude.Eq, ReadPrec [S3WordsList]
ReadPrec S3WordsList
Int -> ReadS S3WordsList
ReadS [S3WordsList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3WordsList]
$creadListPrec :: ReadPrec [S3WordsList]
readPrec :: ReadPrec S3WordsList
$creadPrec :: ReadPrec S3WordsList
readList :: ReadS [S3WordsList]
$creadList :: ReadS [S3WordsList]
readsPrec :: Int -> ReadS S3WordsList
$creadsPrec :: Int -> ReadS S3WordsList
Prelude.Read, Int -> S3WordsList -> ShowS
[S3WordsList] -> ShowS
S3WordsList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3WordsList] -> ShowS
$cshowList :: [S3WordsList] -> ShowS
show :: S3WordsList -> String
$cshow :: S3WordsList -> String
showsPrec :: Int -> S3WordsList -> ShowS
$cshowsPrec :: Int -> S3WordsList -> ShowS
Prelude.Show, forall x. Rep S3WordsList x -> S3WordsList
forall x. S3WordsList -> Rep S3WordsList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3WordsList x -> S3WordsList
$cfrom :: forall x. S3WordsList -> Rep S3WordsList x
Prelude.Generic)

-- |
-- Create a value of 'S3WordsList' 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:
--
-- 'bucketName', 's3WordsList_bucketName' - The full name of the S3 bucket that contains the object.
--
-- 'objectKey', 's3WordsList_objectKey' - The full name (key) of the object.
newS3WordsList ::
  -- | 'bucketName'
  Prelude.Text ->
  -- | 'objectKey'
  Prelude.Text ->
  S3WordsList
newS3WordsList :: Text -> Text -> S3WordsList
newS3WordsList Text
pBucketName_ Text
pObjectKey_ =
  S3WordsList'
    { $sel:bucketName:S3WordsList' :: Text
bucketName = Text
pBucketName_,
      $sel:objectKey:S3WordsList' :: Text
objectKey = Text
pObjectKey_
    }

-- | The full name of the S3 bucket that contains the object.
s3WordsList_bucketName :: Lens.Lens' S3WordsList Prelude.Text
s3WordsList_bucketName :: Lens' S3WordsList Text
s3WordsList_bucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3WordsList' {Text
bucketName :: Text
$sel:bucketName:S3WordsList' :: S3WordsList -> Text
bucketName} -> Text
bucketName) (\s :: S3WordsList
s@S3WordsList' {} Text
a -> S3WordsList
s {$sel:bucketName:S3WordsList' :: Text
bucketName = Text
a} :: S3WordsList)

-- | The full name (key) of the object.
s3WordsList_objectKey :: Lens.Lens' S3WordsList Prelude.Text
s3WordsList_objectKey :: Lens' S3WordsList Text
s3WordsList_objectKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3WordsList' {Text
objectKey :: Text
$sel:objectKey:S3WordsList' :: S3WordsList -> Text
objectKey} -> Text
objectKey) (\s :: S3WordsList
s@S3WordsList' {} Text
a -> S3WordsList
s {$sel:objectKey:S3WordsList' :: Text
objectKey = Text
a} :: S3WordsList)

instance Data.FromJSON S3WordsList where
  parseJSON :: Value -> Parser S3WordsList
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3WordsList"
      ( \Object
x ->
          Text -> Text -> S3WordsList
S3WordsList'
            forall (f :: * -> *) a b. Functor 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
"objectKey")
      )

instance Prelude.Hashable S3WordsList where
  hashWithSalt :: Int -> S3WordsList -> Int
hashWithSalt Int
_salt S3WordsList' {Text
objectKey :: Text
bucketName :: Text
$sel:objectKey:S3WordsList' :: S3WordsList -> Text
$sel:bucketName:S3WordsList' :: S3WordsList -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
objectKey

instance Prelude.NFData S3WordsList where
  rnf :: S3WordsList -> ()
rnf S3WordsList' {Text
objectKey :: Text
bucketName :: Text
$sel:objectKey:S3WordsList' :: S3WordsList -> Text
$sel:bucketName:S3WordsList' :: S3WordsList -> Text
..} =
    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 Text
objectKey

instance Data.ToJSON S3WordsList where
  toJSON :: S3WordsList -> Value
toJSON S3WordsList' {Text
objectKey :: Text
bucketName :: Text
$sel:objectKey:S3WordsList' :: S3WordsList -> Text
$sel:bucketName:S3WordsList' :: S3WordsList -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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
"objectKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
objectKey)
          ]
      )