{-# 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.ClassificationTypeUpdate
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Macie.Types.ClassificationTypeUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Macie.Types.S3ContinuousClassificationType
import Amazonka.Macie.Types.S3OneTimeClassificationType
import qualified Amazonka.Prelude as Prelude

-- | The classification type that Amazon Macie Classic applies to the
-- associated S3 resources. At least one of the classification types
-- (oneTime or continuous) must be specified.
--
-- /See:/ 'newClassificationTypeUpdate' smart constructor.
data ClassificationTypeUpdate = ClassificationTypeUpdate'
  { -- | A continuous classification of the objects that are added to a specified
    -- S3 bucket. Amazon Macie Classic begins performing continuous
    -- classification after a bucket is successfully associated with Macie
    -- Classic.
    ClassificationTypeUpdate -> Maybe S3ContinuousClassificationType
continuous :: Prelude.Maybe S3ContinuousClassificationType,
    -- | A one-time classification of all of the existing objects in a specified
    -- S3 bucket.
    ClassificationTypeUpdate -> Maybe S3OneTimeClassificationType
oneTime :: Prelude.Maybe S3OneTimeClassificationType
  }
  deriving (ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool
(ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool)
-> (ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool)
-> Eq ClassificationTypeUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool
$c/= :: ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool
== :: ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool
$c== :: ClassificationTypeUpdate -> ClassificationTypeUpdate -> Bool
Prelude.Eq, ReadPrec [ClassificationTypeUpdate]
ReadPrec ClassificationTypeUpdate
Int -> ReadS ClassificationTypeUpdate
ReadS [ClassificationTypeUpdate]
(Int -> ReadS ClassificationTypeUpdate)
-> ReadS [ClassificationTypeUpdate]
-> ReadPrec ClassificationTypeUpdate
-> ReadPrec [ClassificationTypeUpdate]
-> Read ClassificationTypeUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClassificationTypeUpdate]
$creadListPrec :: ReadPrec [ClassificationTypeUpdate]
readPrec :: ReadPrec ClassificationTypeUpdate
$creadPrec :: ReadPrec ClassificationTypeUpdate
readList :: ReadS [ClassificationTypeUpdate]
$creadList :: ReadS [ClassificationTypeUpdate]
readsPrec :: Int -> ReadS ClassificationTypeUpdate
$creadsPrec :: Int -> ReadS ClassificationTypeUpdate
Prelude.Read, Int -> ClassificationTypeUpdate -> ShowS
[ClassificationTypeUpdate] -> ShowS
ClassificationTypeUpdate -> String
(Int -> ClassificationTypeUpdate -> ShowS)
-> (ClassificationTypeUpdate -> String)
-> ([ClassificationTypeUpdate] -> ShowS)
-> Show ClassificationTypeUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClassificationTypeUpdate] -> ShowS
$cshowList :: [ClassificationTypeUpdate] -> ShowS
show :: ClassificationTypeUpdate -> String
$cshow :: ClassificationTypeUpdate -> String
showsPrec :: Int -> ClassificationTypeUpdate -> ShowS
$cshowsPrec :: Int -> ClassificationTypeUpdate -> ShowS
Prelude.Show, (forall x.
 ClassificationTypeUpdate -> Rep ClassificationTypeUpdate x)
-> (forall x.
    Rep ClassificationTypeUpdate x -> ClassificationTypeUpdate)
-> Generic ClassificationTypeUpdate
forall x.
Rep ClassificationTypeUpdate x -> ClassificationTypeUpdate
forall x.
ClassificationTypeUpdate -> Rep ClassificationTypeUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ClassificationTypeUpdate x -> ClassificationTypeUpdate
$cfrom :: forall x.
ClassificationTypeUpdate -> Rep ClassificationTypeUpdate x
Prelude.Generic)

-- |
-- Create a value of 'ClassificationTypeUpdate' 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:
--
-- 'continuous', 'classificationTypeUpdate_continuous' - A continuous classification of the objects that are added to a specified
-- S3 bucket. Amazon Macie Classic begins performing continuous
-- classification after a bucket is successfully associated with Macie
-- Classic.
--
-- 'oneTime', 'classificationTypeUpdate_oneTime' - A one-time classification of all of the existing objects in a specified
-- S3 bucket.
newClassificationTypeUpdate ::
  ClassificationTypeUpdate
newClassificationTypeUpdate :: ClassificationTypeUpdate
newClassificationTypeUpdate =
  ClassificationTypeUpdate' :: Maybe S3ContinuousClassificationType
-> Maybe S3OneTimeClassificationType -> ClassificationTypeUpdate
ClassificationTypeUpdate'
    { $sel:continuous:ClassificationTypeUpdate' :: Maybe S3ContinuousClassificationType
continuous =
        Maybe S3ContinuousClassificationType
forall a. Maybe a
Prelude.Nothing,
      $sel:oneTime:ClassificationTypeUpdate' :: Maybe S3OneTimeClassificationType
oneTime = Maybe S3OneTimeClassificationType
forall a. Maybe a
Prelude.Nothing
    }

-- | A continuous classification of the objects that are added to a specified
-- S3 bucket. Amazon Macie Classic begins performing continuous
-- classification after a bucket is successfully associated with Macie
-- Classic.
classificationTypeUpdate_continuous :: Lens.Lens' ClassificationTypeUpdate (Prelude.Maybe S3ContinuousClassificationType)
classificationTypeUpdate_continuous :: (Maybe S3ContinuousClassificationType
 -> f (Maybe S3ContinuousClassificationType))
-> ClassificationTypeUpdate -> f ClassificationTypeUpdate
classificationTypeUpdate_continuous = (ClassificationTypeUpdate -> Maybe S3ContinuousClassificationType)
-> (ClassificationTypeUpdate
    -> Maybe S3ContinuousClassificationType
    -> ClassificationTypeUpdate)
-> Lens
     ClassificationTypeUpdate
     ClassificationTypeUpdate
     (Maybe S3ContinuousClassificationType)
     (Maybe S3ContinuousClassificationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationTypeUpdate' {Maybe S3ContinuousClassificationType
continuous :: Maybe S3ContinuousClassificationType
$sel:continuous:ClassificationTypeUpdate' :: ClassificationTypeUpdate -> Maybe S3ContinuousClassificationType
continuous} -> Maybe S3ContinuousClassificationType
continuous) (\s :: ClassificationTypeUpdate
s@ClassificationTypeUpdate' {} Maybe S3ContinuousClassificationType
a -> ClassificationTypeUpdate
s {$sel:continuous:ClassificationTypeUpdate' :: Maybe S3ContinuousClassificationType
continuous = Maybe S3ContinuousClassificationType
a} :: ClassificationTypeUpdate)

-- | A one-time classification of all of the existing objects in a specified
-- S3 bucket.
classificationTypeUpdate_oneTime :: Lens.Lens' ClassificationTypeUpdate (Prelude.Maybe S3OneTimeClassificationType)
classificationTypeUpdate_oneTime :: (Maybe S3OneTimeClassificationType
 -> f (Maybe S3OneTimeClassificationType))
-> ClassificationTypeUpdate -> f ClassificationTypeUpdate
classificationTypeUpdate_oneTime = (ClassificationTypeUpdate -> Maybe S3OneTimeClassificationType)
-> (ClassificationTypeUpdate
    -> Maybe S3OneTimeClassificationType -> ClassificationTypeUpdate)
-> Lens
     ClassificationTypeUpdate
     ClassificationTypeUpdate
     (Maybe S3OneTimeClassificationType)
     (Maybe S3OneTimeClassificationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationTypeUpdate' {Maybe S3OneTimeClassificationType
oneTime :: Maybe S3OneTimeClassificationType
$sel:oneTime:ClassificationTypeUpdate' :: ClassificationTypeUpdate -> Maybe S3OneTimeClassificationType
oneTime} -> Maybe S3OneTimeClassificationType
oneTime) (\s :: ClassificationTypeUpdate
s@ClassificationTypeUpdate' {} Maybe S3OneTimeClassificationType
a -> ClassificationTypeUpdate
s {$sel:oneTime:ClassificationTypeUpdate' :: Maybe S3OneTimeClassificationType
oneTime = Maybe S3OneTimeClassificationType
a} :: ClassificationTypeUpdate)

instance Prelude.Hashable ClassificationTypeUpdate

instance Prelude.NFData ClassificationTypeUpdate

instance Core.ToJSON ClassificationTypeUpdate where
  toJSON :: ClassificationTypeUpdate -> Value
toJSON ClassificationTypeUpdate' {Maybe S3ContinuousClassificationType
Maybe S3OneTimeClassificationType
oneTime :: Maybe S3OneTimeClassificationType
continuous :: Maybe S3ContinuousClassificationType
$sel:oneTime:ClassificationTypeUpdate' :: ClassificationTypeUpdate -> Maybe S3OneTimeClassificationType
$sel:continuous:ClassificationTypeUpdate' :: ClassificationTypeUpdate -> Maybe S3ContinuousClassificationType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"continuous" Text -> S3ContinuousClassificationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3ContinuousClassificationType -> Pair)
-> Maybe S3ContinuousClassificationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3ContinuousClassificationType
continuous,
            (Text
"oneTime" Text -> S3OneTimeClassificationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3OneTimeClassificationType -> Pair)
-> Maybe S3OneTimeClassificationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3OneTimeClassificationType
oneTime
          ]
      )