{-# 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.ClassificationType
-- 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.ClassificationType 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.S3ContinuousClassificationType
import Amazonka.Macie.Types.S3OneTimeClassificationType
import qualified Amazonka.Prelude as Prelude

-- | (Discontinued) The classification type that Amazon Macie Classic applies
-- to the associated S3 resources.
--
-- /See:/ 'newClassificationType' smart constructor.
data ClassificationType = ClassificationType'
  { -- | (Discontinued) A one-time classification of all of the existing objects
    -- in a specified S3 bucket.
    ClassificationType -> S3OneTimeClassificationType
oneTime :: S3OneTimeClassificationType,
    -- | (Discontinued) 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.
    ClassificationType -> S3ContinuousClassificationType
continuous :: S3ContinuousClassificationType
  }
  deriving (ClassificationType -> ClassificationType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClassificationType -> ClassificationType -> Bool
$c/= :: ClassificationType -> ClassificationType -> Bool
== :: ClassificationType -> ClassificationType -> Bool
$c== :: ClassificationType -> ClassificationType -> Bool
Prelude.Eq, ReadPrec [ClassificationType]
ReadPrec ClassificationType
Int -> ReadS ClassificationType
ReadS [ClassificationType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClassificationType]
$creadListPrec :: ReadPrec [ClassificationType]
readPrec :: ReadPrec ClassificationType
$creadPrec :: ReadPrec ClassificationType
readList :: ReadS [ClassificationType]
$creadList :: ReadS [ClassificationType]
readsPrec :: Int -> ReadS ClassificationType
$creadsPrec :: Int -> ReadS ClassificationType
Prelude.Read, Int -> ClassificationType -> ShowS
[ClassificationType] -> ShowS
ClassificationType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClassificationType] -> ShowS
$cshowList :: [ClassificationType] -> ShowS
show :: ClassificationType -> String
$cshow :: ClassificationType -> String
showsPrec :: Int -> ClassificationType -> ShowS
$cshowsPrec :: Int -> ClassificationType -> ShowS
Prelude.Show, forall x. Rep ClassificationType x -> ClassificationType
forall x. ClassificationType -> Rep ClassificationType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClassificationType x -> ClassificationType
$cfrom :: forall x. ClassificationType -> Rep ClassificationType x
Prelude.Generic)

-- |
-- Create a value of 'ClassificationType' 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:
--
-- 'oneTime', 'classificationType_oneTime' - (Discontinued) A one-time classification of all of the existing objects
-- in a specified S3 bucket.
--
-- 'continuous', 'classificationType_continuous' - (Discontinued) 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.
newClassificationType ::
  -- | 'oneTime'
  S3OneTimeClassificationType ->
  -- | 'continuous'
  S3ContinuousClassificationType ->
  ClassificationType
newClassificationType :: S3OneTimeClassificationType
-> S3ContinuousClassificationType -> ClassificationType
newClassificationType S3OneTimeClassificationType
pOneTime_ S3ContinuousClassificationType
pContinuous_ =
  ClassificationType'
    { $sel:oneTime:ClassificationType' :: S3OneTimeClassificationType
oneTime = S3OneTimeClassificationType
pOneTime_,
      $sel:continuous:ClassificationType' :: S3ContinuousClassificationType
continuous = S3ContinuousClassificationType
pContinuous_
    }

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

-- | (Discontinued) 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.
classificationType_continuous :: Lens.Lens' ClassificationType S3ContinuousClassificationType
classificationType_continuous :: Lens' ClassificationType S3ContinuousClassificationType
classificationType_continuous = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClassificationType' {S3ContinuousClassificationType
continuous :: S3ContinuousClassificationType
$sel:continuous:ClassificationType' :: ClassificationType -> S3ContinuousClassificationType
continuous} -> S3ContinuousClassificationType
continuous) (\s :: ClassificationType
s@ClassificationType' {} S3ContinuousClassificationType
a -> ClassificationType
s {$sel:continuous:ClassificationType' :: S3ContinuousClassificationType
continuous = S3ContinuousClassificationType
a} :: ClassificationType)

instance Data.FromJSON ClassificationType where
  parseJSON :: Value -> Parser ClassificationType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ClassificationType"
      ( \Object
x ->
          S3OneTimeClassificationType
-> S3ContinuousClassificationType -> ClassificationType
ClassificationType'
            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
"oneTime")
            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
"continuous")
      )

instance Prelude.Hashable ClassificationType where
  hashWithSalt :: Int -> ClassificationType -> Int
hashWithSalt Int
_salt ClassificationType' {S3ContinuousClassificationType
S3OneTimeClassificationType
continuous :: S3ContinuousClassificationType
oneTime :: S3OneTimeClassificationType
$sel:continuous:ClassificationType' :: ClassificationType -> S3ContinuousClassificationType
$sel:oneTime:ClassificationType' :: ClassificationType -> S3OneTimeClassificationType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3OneTimeClassificationType
oneTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` S3ContinuousClassificationType
continuous

instance Prelude.NFData ClassificationType where
  rnf :: ClassificationType -> ()
rnf ClassificationType' {S3ContinuousClassificationType
S3OneTimeClassificationType
continuous :: S3ContinuousClassificationType
oneTime :: S3OneTimeClassificationType
$sel:continuous:ClassificationType' :: ClassificationType -> S3ContinuousClassificationType
$sel:oneTime:ClassificationType' :: ClassificationType -> S3OneTimeClassificationType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf S3OneTimeClassificationType
oneTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf S3ContinuousClassificationType
continuous

instance Data.ToJSON ClassificationType where
  toJSON :: ClassificationType -> Value
toJSON ClassificationType' {S3ContinuousClassificationType
S3OneTimeClassificationType
continuous :: S3ContinuousClassificationType
oneTime :: S3OneTimeClassificationType
$sel:continuous:ClassificationType' :: ClassificationType -> S3ContinuousClassificationType
$sel:oneTime:ClassificationType' :: ClassificationType -> S3OneTimeClassificationType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"oneTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3OneTimeClassificationType
oneTime),
            forall a. a -> Maybe a
Prelude.Just (Key
"continuous" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= S3ContinuousClassificationType
continuous)
          ]
      )