{-# 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.S3ClassificationScopeExclusionUpdate
-- 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.S3ClassificationScopeExclusionUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.Types.ClassificationScopeUpdateOperation
import qualified Amazonka.Prelude as Prelude

-- | Specifies S3 buckets to add or remove from the exclusion list defined by
-- the classification scope for an Amazon Macie account.
--
-- /See:/ 'newS3ClassificationScopeExclusionUpdate' smart constructor.
data S3ClassificationScopeExclusionUpdate = S3ClassificationScopeExclusionUpdate'
  { -- | Depending on the value specified for the update operation
    -- (ClassificationScopeUpdateOperation), an array of strings that: lists
    -- the names of buckets to add or remove from the list, or specifies a new
    -- set of bucket names that overwrites all existing names in the list. Each
    -- string must be the full name of an S3 bucket. Values are case sensitive.
    S3ClassificationScopeExclusionUpdate -> [Text]
bucketNames :: [Prelude.Text],
    -- | Specifies how to apply the changes to the exclusion list. Valid values
    -- are:
    --
    -- -   ADD - Append the specified bucket names to the current list.
    --
    -- -   REMOVE - Remove the specified bucket names from the current list.
    --
    -- -   REPLACE - Overwrite the current list with the specified list of
    --     bucket names. If you specify this value, Amazon Macie removes all
    --     existing names from the list and adds all the specified names to the
    --     list.
    S3ClassificationScopeExclusionUpdate
-> ClassificationScopeUpdateOperation
operation :: ClassificationScopeUpdateOperation
  }
  deriving (S3ClassificationScopeExclusionUpdate
-> S3ClassificationScopeExclusionUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ClassificationScopeExclusionUpdate
-> S3ClassificationScopeExclusionUpdate -> Bool
$c/= :: S3ClassificationScopeExclusionUpdate
-> S3ClassificationScopeExclusionUpdate -> Bool
== :: S3ClassificationScopeExclusionUpdate
-> S3ClassificationScopeExclusionUpdate -> Bool
$c== :: S3ClassificationScopeExclusionUpdate
-> S3ClassificationScopeExclusionUpdate -> Bool
Prelude.Eq, ReadPrec [S3ClassificationScopeExclusionUpdate]
ReadPrec S3ClassificationScopeExclusionUpdate
Int -> ReadS S3ClassificationScopeExclusionUpdate
ReadS [S3ClassificationScopeExclusionUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ClassificationScopeExclusionUpdate]
$creadListPrec :: ReadPrec [S3ClassificationScopeExclusionUpdate]
readPrec :: ReadPrec S3ClassificationScopeExclusionUpdate
$creadPrec :: ReadPrec S3ClassificationScopeExclusionUpdate
readList :: ReadS [S3ClassificationScopeExclusionUpdate]
$creadList :: ReadS [S3ClassificationScopeExclusionUpdate]
readsPrec :: Int -> ReadS S3ClassificationScopeExclusionUpdate
$creadsPrec :: Int -> ReadS S3ClassificationScopeExclusionUpdate
Prelude.Read, Int -> S3ClassificationScopeExclusionUpdate -> ShowS
[S3ClassificationScopeExclusionUpdate] -> ShowS
S3ClassificationScopeExclusionUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ClassificationScopeExclusionUpdate] -> ShowS
$cshowList :: [S3ClassificationScopeExclusionUpdate] -> ShowS
show :: S3ClassificationScopeExclusionUpdate -> String
$cshow :: S3ClassificationScopeExclusionUpdate -> String
showsPrec :: Int -> S3ClassificationScopeExclusionUpdate -> ShowS
$cshowsPrec :: Int -> S3ClassificationScopeExclusionUpdate -> ShowS
Prelude.Show, forall x.
Rep S3ClassificationScopeExclusionUpdate x
-> S3ClassificationScopeExclusionUpdate
forall x.
S3ClassificationScopeExclusionUpdate
-> Rep S3ClassificationScopeExclusionUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3ClassificationScopeExclusionUpdate x
-> S3ClassificationScopeExclusionUpdate
$cfrom :: forall x.
S3ClassificationScopeExclusionUpdate
-> Rep S3ClassificationScopeExclusionUpdate x
Prelude.Generic)

-- |
-- Create a value of 'S3ClassificationScopeExclusionUpdate' 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:
--
-- 'bucketNames', 's3ClassificationScopeExclusionUpdate_bucketNames' - Depending on the value specified for the update operation
-- (ClassificationScopeUpdateOperation), an array of strings that: lists
-- the names of buckets to add or remove from the list, or specifies a new
-- set of bucket names that overwrites all existing names in the list. Each
-- string must be the full name of an S3 bucket. Values are case sensitive.
--
-- 'operation', 's3ClassificationScopeExclusionUpdate_operation' - Specifies how to apply the changes to the exclusion list. Valid values
-- are:
--
-- -   ADD - Append the specified bucket names to the current list.
--
-- -   REMOVE - Remove the specified bucket names from the current list.
--
-- -   REPLACE - Overwrite the current list with the specified list of
--     bucket names. If you specify this value, Amazon Macie removes all
--     existing names from the list and adds all the specified names to the
--     list.
newS3ClassificationScopeExclusionUpdate ::
  -- | 'operation'
  ClassificationScopeUpdateOperation ->
  S3ClassificationScopeExclusionUpdate
newS3ClassificationScopeExclusionUpdate :: ClassificationScopeUpdateOperation
-> S3ClassificationScopeExclusionUpdate
newS3ClassificationScopeExclusionUpdate ClassificationScopeUpdateOperation
pOperation_ =
  S3ClassificationScopeExclusionUpdate'
    { $sel:bucketNames:S3ClassificationScopeExclusionUpdate' :: [Text]
bucketNames =
        forall a. Monoid a => a
Prelude.mempty,
      $sel:operation:S3ClassificationScopeExclusionUpdate' :: ClassificationScopeUpdateOperation
operation = ClassificationScopeUpdateOperation
pOperation_
    }

-- | Depending on the value specified for the update operation
-- (ClassificationScopeUpdateOperation), an array of strings that: lists
-- the names of buckets to add or remove from the list, or specifies a new
-- set of bucket names that overwrites all existing names in the list. Each
-- string must be the full name of an S3 bucket. Values are case sensitive.
s3ClassificationScopeExclusionUpdate_bucketNames :: Lens.Lens' S3ClassificationScopeExclusionUpdate [Prelude.Text]
s3ClassificationScopeExclusionUpdate_bucketNames :: Lens' S3ClassificationScopeExclusionUpdate [Text]
s3ClassificationScopeExclusionUpdate_bucketNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ClassificationScopeExclusionUpdate' {[Text]
bucketNames :: [Text]
$sel:bucketNames:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate -> [Text]
bucketNames} -> [Text]
bucketNames) (\s :: S3ClassificationScopeExclusionUpdate
s@S3ClassificationScopeExclusionUpdate' {} [Text]
a -> S3ClassificationScopeExclusionUpdate
s {$sel:bucketNames:S3ClassificationScopeExclusionUpdate' :: [Text]
bucketNames = [Text]
a} :: S3ClassificationScopeExclusionUpdate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies how to apply the changes to the exclusion list. Valid values
-- are:
--
-- -   ADD - Append the specified bucket names to the current list.
--
-- -   REMOVE - Remove the specified bucket names from the current list.
--
-- -   REPLACE - Overwrite the current list with the specified list of
--     bucket names. If you specify this value, Amazon Macie removes all
--     existing names from the list and adds all the specified names to the
--     list.
s3ClassificationScopeExclusionUpdate_operation :: Lens.Lens' S3ClassificationScopeExclusionUpdate ClassificationScopeUpdateOperation
s3ClassificationScopeExclusionUpdate_operation :: Lens'
  S3ClassificationScopeExclusionUpdate
  ClassificationScopeUpdateOperation
s3ClassificationScopeExclusionUpdate_operation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ClassificationScopeExclusionUpdate' {ClassificationScopeUpdateOperation
operation :: ClassificationScopeUpdateOperation
$sel:operation:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate
-> ClassificationScopeUpdateOperation
operation} -> ClassificationScopeUpdateOperation
operation) (\s :: S3ClassificationScopeExclusionUpdate
s@S3ClassificationScopeExclusionUpdate' {} ClassificationScopeUpdateOperation
a -> S3ClassificationScopeExclusionUpdate
s {$sel:operation:S3ClassificationScopeExclusionUpdate' :: ClassificationScopeUpdateOperation
operation = ClassificationScopeUpdateOperation
a} :: S3ClassificationScopeExclusionUpdate)

instance
  Prelude.Hashable
    S3ClassificationScopeExclusionUpdate
  where
  hashWithSalt :: Int -> S3ClassificationScopeExclusionUpdate -> Int
hashWithSalt
    Int
_salt
    S3ClassificationScopeExclusionUpdate' {[Text]
ClassificationScopeUpdateOperation
operation :: ClassificationScopeUpdateOperation
bucketNames :: [Text]
$sel:operation:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate
-> ClassificationScopeUpdateOperation
$sel:bucketNames:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate -> [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
bucketNames
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ClassificationScopeUpdateOperation
operation

instance
  Prelude.NFData
    S3ClassificationScopeExclusionUpdate
  where
  rnf :: S3ClassificationScopeExclusionUpdate -> ()
rnf S3ClassificationScopeExclusionUpdate' {[Text]
ClassificationScopeUpdateOperation
operation :: ClassificationScopeUpdateOperation
bucketNames :: [Text]
$sel:operation:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate
-> ClassificationScopeUpdateOperation
$sel:bucketNames:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate -> [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Text]
bucketNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ClassificationScopeUpdateOperation
operation

instance
  Data.ToJSON
    S3ClassificationScopeExclusionUpdate
  where
  toJSON :: S3ClassificationScopeExclusionUpdate -> Value
toJSON S3ClassificationScopeExclusionUpdate' {[Text]
ClassificationScopeUpdateOperation
operation :: ClassificationScopeUpdateOperation
bucketNames :: [Text]
$sel:operation:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate
-> ClassificationScopeUpdateOperation
$sel:bucketNames:S3ClassificationScopeExclusionUpdate' :: S3ClassificationScopeExclusionUpdate -> [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"bucketNames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
bucketNames),
            forall a. a -> Maybe a
Prelude.Just (Key
"operation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ClassificationScopeUpdateOperation
operation)
          ]
      )