{-# 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.AuditManager.Types.Settings
-- 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.AuditManager.Types.Settings where

import Amazonka.AuditManager.Types.AssessmentReportsDestination
import Amazonka.AuditManager.Types.DeregistrationPolicy
import Amazonka.AuditManager.Types.EvidenceFinderEnablement
import Amazonka.AuditManager.Types.Role
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

-- | The settings object that holds all supported Audit Manager settings.
--
-- /See:/ 'newSettings' smart constructor.
data Settings = Settings'
  { -- | The default storage destination for assessment reports.
    Settings -> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination :: Prelude.Maybe AssessmentReportsDestination,
    -- | The designated default audit owners.
    Settings -> Maybe [Role]
defaultProcessOwners :: Prelude.Maybe [Role],
    -- | The deregistration policy for your Audit Manager data. You can use this
    -- attribute to determine how your data is handled when you deregister
    -- Audit Manager.
    Settings -> Maybe DeregistrationPolicy
deregistrationPolicy :: Prelude.Maybe DeregistrationPolicy,
    -- | The current evidence finder status and event data store details.
    Settings -> Maybe EvidenceFinderEnablement
evidenceFinderEnablement :: Prelude.Maybe EvidenceFinderEnablement,
    -- | Specifies whether Organizations is enabled.
    Settings -> Maybe Bool
isAwsOrgEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The KMS key details.
    Settings -> Maybe Text
kmsKey :: Prelude.Maybe Prelude.Text,
    -- | The designated Amazon Simple Notification Service (Amazon SNS) topic.
    Settings -> Maybe Text
snsTopic :: Prelude.Maybe Prelude.Text
  }
  deriving (Settings -> Settings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Settings -> Settings -> Bool
$c/= :: Settings -> Settings -> Bool
== :: Settings -> Settings -> Bool
$c== :: Settings -> Settings -> Bool
Prelude.Eq, ReadPrec [Settings]
ReadPrec Settings
Int -> ReadS Settings
ReadS [Settings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Settings]
$creadListPrec :: ReadPrec [Settings]
readPrec :: ReadPrec Settings
$creadPrec :: ReadPrec Settings
readList :: ReadS [Settings]
$creadList :: ReadS [Settings]
readsPrec :: Int -> ReadS Settings
$creadsPrec :: Int -> ReadS Settings
Prelude.Read, Int -> Settings -> ShowS
[Settings] -> ShowS
Settings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Settings] -> ShowS
$cshowList :: [Settings] -> ShowS
show :: Settings -> String
$cshow :: Settings -> String
showsPrec :: Int -> Settings -> ShowS
$cshowsPrec :: Int -> Settings -> ShowS
Prelude.Show, forall x. Rep Settings x -> Settings
forall x. Settings -> Rep Settings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Settings x -> Settings
$cfrom :: forall x. Settings -> Rep Settings x
Prelude.Generic)

-- |
-- Create a value of 'Settings' 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:
--
-- 'defaultAssessmentReportsDestination', 'settings_defaultAssessmentReportsDestination' - The default storage destination for assessment reports.
--
-- 'defaultProcessOwners', 'settings_defaultProcessOwners' - The designated default audit owners.
--
-- 'deregistrationPolicy', 'settings_deregistrationPolicy' - The deregistration policy for your Audit Manager data. You can use this
-- attribute to determine how your data is handled when you deregister
-- Audit Manager.
--
-- 'evidenceFinderEnablement', 'settings_evidenceFinderEnablement' - The current evidence finder status and event data store details.
--
-- 'isAwsOrgEnabled', 'settings_isAwsOrgEnabled' - Specifies whether Organizations is enabled.
--
-- 'kmsKey', 'settings_kmsKey' - The KMS key details.
--
-- 'snsTopic', 'settings_snsTopic' - The designated Amazon Simple Notification Service (Amazon SNS) topic.
newSettings ::
  Settings
newSettings :: Settings
newSettings =
  Settings'
    { $sel:defaultAssessmentReportsDestination:Settings' :: Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination =
        forall a. Maybe a
Prelude.Nothing,
      $sel:defaultProcessOwners:Settings' :: Maybe [Role]
defaultProcessOwners = forall a. Maybe a
Prelude.Nothing,
      $sel:deregistrationPolicy:Settings' :: Maybe DeregistrationPolicy
deregistrationPolicy = forall a. Maybe a
Prelude.Nothing,
      $sel:evidenceFinderEnablement:Settings' :: Maybe EvidenceFinderEnablement
evidenceFinderEnablement = forall a. Maybe a
Prelude.Nothing,
      $sel:isAwsOrgEnabled:Settings' :: Maybe Bool
isAwsOrgEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKey:Settings' :: Maybe Text
kmsKey = forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopic:Settings' :: Maybe Text
snsTopic = forall a. Maybe a
Prelude.Nothing
    }

-- | The default storage destination for assessment reports.
settings_defaultAssessmentReportsDestination :: Lens.Lens' Settings (Prelude.Maybe AssessmentReportsDestination)
settings_defaultAssessmentReportsDestination :: Lens' Settings (Maybe AssessmentReportsDestination)
settings_defaultAssessmentReportsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination :: Maybe AssessmentReportsDestination
$sel:defaultAssessmentReportsDestination:Settings' :: Settings -> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination} -> Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination) (\s :: Settings
s@Settings' {} Maybe AssessmentReportsDestination
a -> Settings
s {$sel:defaultAssessmentReportsDestination:Settings' :: Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination = Maybe AssessmentReportsDestination
a} :: Settings)

-- | The designated default audit owners.
settings_defaultProcessOwners :: Lens.Lens' Settings (Prelude.Maybe [Role])
settings_defaultProcessOwners :: Lens' Settings (Maybe [Role])
settings_defaultProcessOwners = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe [Role]
defaultProcessOwners :: Maybe [Role]
$sel:defaultProcessOwners:Settings' :: Settings -> Maybe [Role]
defaultProcessOwners} -> Maybe [Role]
defaultProcessOwners) (\s :: Settings
s@Settings' {} Maybe [Role]
a -> Settings
s {$sel:defaultProcessOwners:Settings' :: Maybe [Role]
defaultProcessOwners = Maybe [Role]
a} :: Settings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The deregistration policy for your Audit Manager data. You can use this
-- attribute to determine how your data is handled when you deregister
-- Audit Manager.
settings_deregistrationPolicy :: Lens.Lens' Settings (Prelude.Maybe DeregistrationPolicy)
settings_deregistrationPolicy :: Lens' Settings (Maybe DeregistrationPolicy)
settings_deregistrationPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe DeregistrationPolicy
deregistrationPolicy :: Maybe DeregistrationPolicy
$sel:deregistrationPolicy:Settings' :: Settings -> Maybe DeregistrationPolicy
deregistrationPolicy} -> Maybe DeregistrationPolicy
deregistrationPolicy) (\s :: Settings
s@Settings' {} Maybe DeregistrationPolicy
a -> Settings
s {$sel:deregistrationPolicy:Settings' :: Maybe DeregistrationPolicy
deregistrationPolicy = Maybe DeregistrationPolicy
a} :: Settings)

-- | The current evidence finder status and event data store details.
settings_evidenceFinderEnablement :: Lens.Lens' Settings (Prelude.Maybe EvidenceFinderEnablement)
settings_evidenceFinderEnablement :: Lens' Settings (Maybe EvidenceFinderEnablement)
settings_evidenceFinderEnablement = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe EvidenceFinderEnablement
evidenceFinderEnablement :: Maybe EvidenceFinderEnablement
$sel:evidenceFinderEnablement:Settings' :: Settings -> Maybe EvidenceFinderEnablement
evidenceFinderEnablement} -> Maybe EvidenceFinderEnablement
evidenceFinderEnablement) (\s :: Settings
s@Settings' {} Maybe EvidenceFinderEnablement
a -> Settings
s {$sel:evidenceFinderEnablement:Settings' :: Maybe EvidenceFinderEnablement
evidenceFinderEnablement = Maybe EvidenceFinderEnablement
a} :: Settings)

-- | Specifies whether Organizations is enabled.
settings_isAwsOrgEnabled :: Lens.Lens' Settings (Prelude.Maybe Prelude.Bool)
settings_isAwsOrgEnabled :: Lens' Settings (Maybe Bool)
settings_isAwsOrgEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe Bool
isAwsOrgEnabled :: Maybe Bool
$sel:isAwsOrgEnabled:Settings' :: Settings -> Maybe Bool
isAwsOrgEnabled} -> Maybe Bool
isAwsOrgEnabled) (\s :: Settings
s@Settings' {} Maybe Bool
a -> Settings
s {$sel:isAwsOrgEnabled:Settings' :: Maybe Bool
isAwsOrgEnabled = Maybe Bool
a} :: Settings)

-- | The KMS key details.
settings_kmsKey :: Lens.Lens' Settings (Prelude.Maybe Prelude.Text)
settings_kmsKey :: Lens' Settings (Maybe Text)
settings_kmsKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe Text
kmsKey :: Maybe Text
$sel:kmsKey:Settings' :: Settings -> Maybe Text
kmsKey} -> Maybe Text
kmsKey) (\s :: Settings
s@Settings' {} Maybe Text
a -> Settings
s {$sel:kmsKey:Settings' :: Maybe Text
kmsKey = Maybe Text
a} :: Settings)

-- | The designated Amazon Simple Notification Service (Amazon SNS) topic.
settings_snsTopic :: Lens.Lens' Settings (Prelude.Maybe Prelude.Text)
settings_snsTopic :: Lens' Settings (Maybe Text)
settings_snsTopic = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Settings' {Maybe Text
snsTopic :: Maybe Text
$sel:snsTopic:Settings' :: Settings -> Maybe Text
snsTopic} -> Maybe Text
snsTopic) (\s :: Settings
s@Settings' {} Maybe Text
a -> Settings
s {$sel:snsTopic:Settings' :: Maybe Text
snsTopic = Maybe Text
a} :: Settings)

instance Data.FromJSON Settings where
  parseJSON :: Value -> Parser Settings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Settings"
      ( \Object
x ->
          Maybe AssessmentReportsDestination
-> Maybe [Role]
-> Maybe DeregistrationPolicy
-> Maybe EvidenceFinderEnablement
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Settings
Settings'
            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
"defaultAssessmentReportsDestination")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"defaultProcessOwners"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"deregistrationPolicy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"evidenceFinderEnablement")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"isAwsOrgEnabled")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"kmsKey")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"snsTopic")
      )

instance Prelude.Hashable Settings where
  hashWithSalt :: Int -> Settings -> Int
hashWithSalt Int
_salt Settings' {Maybe Bool
Maybe [Role]
Maybe Text
Maybe AssessmentReportsDestination
Maybe DeregistrationPolicy
Maybe EvidenceFinderEnablement
snsTopic :: Maybe Text
kmsKey :: Maybe Text
isAwsOrgEnabled :: Maybe Bool
evidenceFinderEnablement :: Maybe EvidenceFinderEnablement
deregistrationPolicy :: Maybe DeregistrationPolicy
defaultProcessOwners :: Maybe [Role]
defaultAssessmentReportsDestination :: Maybe AssessmentReportsDestination
$sel:snsTopic:Settings' :: Settings -> Maybe Text
$sel:kmsKey:Settings' :: Settings -> Maybe Text
$sel:isAwsOrgEnabled:Settings' :: Settings -> Maybe Bool
$sel:evidenceFinderEnablement:Settings' :: Settings -> Maybe EvidenceFinderEnablement
$sel:deregistrationPolicy:Settings' :: Settings -> Maybe DeregistrationPolicy
$sel:defaultProcessOwners:Settings' :: Settings -> Maybe [Role]
$sel:defaultAssessmentReportsDestination:Settings' :: Settings -> Maybe AssessmentReportsDestination
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Role]
defaultProcessOwners
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DeregistrationPolicy
deregistrationPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EvidenceFinderEnablement
evidenceFinderEnablement
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isAwsOrgEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
snsTopic

instance Prelude.NFData Settings where
  rnf :: Settings -> ()
rnf Settings' {Maybe Bool
Maybe [Role]
Maybe Text
Maybe AssessmentReportsDestination
Maybe DeregistrationPolicy
Maybe EvidenceFinderEnablement
snsTopic :: Maybe Text
kmsKey :: Maybe Text
isAwsOrgEnabled :: Maybe Bool
evidenceFinderEnablement :: Maybe EvidenceFinderEnablement
deregistrationPolicy :: Maybe DeregistrationPolicy
defaultProcessOwners :: Maybe [Role]
defaultAssessmentReportsDestination :: Maybe AssessmentReportsDestination
$sel:snsTopic:Settings' :: Settings -> Maybe Text
$sel:kmsKey:Settings' :: Settings -> Maybe Text
$sel:isAwsOrgEnabled:Settings' :: Settings -> Maybe Bool
$sel:evidenceFinderEnablement:Settings' :: Settings -> Maybe EvidenceFinderEnablement
$sel:deregistrationPolicy:Settings' :: Settings -> Maybe DeregistrationPolicy
$sel:defaultProcessOwners:Settings' :: Settings -> Maybe [Role]
$sel:defaultAssessmentReportsDestination:Settings' :: Settings -> Maybe AssessmentReportsDestination
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AssessmentReportsDestination
defaultAssessmentReportsDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Role]
defaultProcessOwners
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DeregistrationPolicy
deregistrationPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EvidenceFinderEnablement
evidenceFinderEnablement
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isAwsOrgEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snsTopic