{-# 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.GuardDuty.Types.CloudTrailConfigurationResult
-- 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.GuardDuty.Types.CloudTrailConfigurationResult where

import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types.DataSourceStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information on the status of CloudTrail as a data source for
-- the detector.
--
-- /See:/ 'newCloudTrailConfigurationResult' smart constructor.
data CloudTrailConfigurationResult = CloudTrailConfigurationResult'
  { -- | Describes whether CloudTrail is enabled as a data source for the
    -- detector.
    CloudTrailConfigurationResult -> DataSourceStatus
status :: DataSourceStatus
  }
  deriving (CloudTrailConfigurationResult
-> CloudTrailConfigurationResult -> Bool
(CloudTrailConfigurationResult
 -> CloudTrailConfigurationResult -> Bool)
-> (CloudTrailConfigurationResult
    -> CloudTrailConfigurationResult -> Bool)
-> Eq CloudTrailConfigurationResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudTrailConfigurationResult
-> CloudTrailConfigurationResult -> Bool
$c/= :: CloudTrailConfigurationResult
-> CloudTrailConfigurationResult -> Bool
== :: CloudTrailConfigurationResult
-> CloudTrailConfigurationResult -> Bool
$c== :: CloudTrailConfigurationResult
-> CloudTrailConfigurationResult -> Bool
Prelude.Eq, ReadPrec [CloudTrailConfigurationResult]
ReadPrec CloudTrailConfigurationResult
Int -> ReadS CloudTrailConfigurationResult
ReadS [CloudTrailConfigurationResult]
(Int -> ReadS CloudTrailConfigurationResult)
-> ReadS [CloudTrailConfigurationResult]
-> ReadPrec CloudTrailConfigurationResult
-> ReadPrec [CloudTrailConfigurationResult]
-> Read CloudTrailConfigurationResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudTrailConfigurationResult]
$creadListPrec :: ReadPrec [CloudTrailConfigurationResult]
readPrec :: ReadPrec CloudTrailConfigurationResult
$creadPrec :: ReadPrec CloudTrailConfigurationResult
readList :: ReadS [CloudTrailConfigurationResult]
$creadList :: ReadS [CloudTrailConfigurationResult]
readsPrec :: Int -> ReadS CloudTrailConfigurationResult
$creadsPrec :: Int -> ReadS CloudTrailConfigurationResult
Prelude.Read, Int -> CloudTrailConfigurationResult -> ShowS
[CloudTrailConfigurationResult] -> ShowS
CloudTrailConfigurationResult -> String
(Int -> CloudTrailConfigurationResult -> ShowS)
-> (CloudTrailConfigurationResult -> String)
-> ([CloudTrailConfigurationResult] -> ShowS)
-> Show CloudTrailConfigurationResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudTrailConfigurationResult] -> ShowS
$cshowList :: [CloudTrailConfigurationResult] -> ShowS
show :: CloudTrailConfigurationResult -> String
$cshow :: CloudTrailConfigurationResult -> String
showsPrec :: Int -> CloudTrailConfigurationResult -> ShowS
$cshowsPrec :: Int -> CloudTrailConfigurationResult -> ShowS
Prelude.Show, (forall x.
 CloudTrailConfigurationResult
 -> Rep CloudTrailConfigurationResult x)
-> (forall x.
    Rep CloudTrailConfigurationResult x
    -> CloudTrailConfigurationResult)
-> Generic CloudTrailConfigurationResult
forall x.
Rep CloudTrailConfigurationResult x
-> CloudTrailConfigurationResult
forall x.
CloudTrailConfigurationResult
-> Rep CloudTrailConfigurationResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudTrailConfigurationResult x
-> CloudTrailConfigurationResult
$cfrom :: forall x.
CloudTrailConfigurationResult
-> Rep CloudTrailConfigurationResult x
Prelude.Generic)

-- |
-- Create a value of 'CloudTrailConfigurationResult' 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:
--
-- 'status', 'cloudTrailConfigurationResult_status' - Describes whether CloudTrail is enabled as a data source for the
-- detector.
newCloudTrailConfigurationResult ::
  -- | 'status'
  DataSourceStatus ->
  CloudTrailConfigurationResult
newCloudTrailConfigurationResult :: DataSourceStatus -> CloudTrailConfigurationResult
newCloudTrailConfigurationResult DataSourceStatus
pStatus_ =
  CloudTrailConfigurationResult' :: DataSourceStatus -> CloudTrailConfigurationResult
CloudTrailConfigurationResult' {$sel:status:CloudTrailConfigurationResult' :: DataSourceStatus
status = DataSourceStatus
pStatus_}

-- | Describes whether CloudTrail is enabled as a data source for the
-- detector.
cloudTrailConfigurationResult_status :: Lens.Lens' CloudTrailConfigurationResult DataSourceStatus
cloudTrailConfigurationResult_status :: (DataSourceStatus -> f DataSourceStatus)
-> CloudTrailConfigurationResult -> f CloudTrailConfigurationResult
cloudTrailConfigurationResult_status = (CloudTrailConfigurationResult -> DataSourceStatus)
-> (CloudTrailConfigurationResult
    -> DataSourceStatus -> CloudTrailConfigurationResult)
-> Lens
     CloudTrailConfigurationResult
     CloudTrailConfigurationResult
     DataSourceStatus
     DataSourceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudTrailConfigurationResult' {DataSourceStatus
status :: DataSourceStatus
$sel:status:CloudTrailConfigurationResult' :: CloudTrailConfigurationResult -> DataSourceStatus
status} -> DataSourceStatus
status) (\s :: CloudTrailConfigurationResult
s@CloudTrailConfigurationResult' {} DataSourceStatus
a -> CloudTrailConfigurationResult
s {$sel:status:CloudTrailConfigurationResult' :: DataSourceStatus
status = DataSourceStatus
a} :: CloudTrailConfigurationResult)

instance Core.FromJSON CloudTrailConfigurationResult where
  parseJSON :: Value -> Parser CloudTrailConfigurationResult
parseJSON =
    String
-> (Object -> Parser CloudTrailConfigurationResult)
-> Value
-> Parser CloudTrailConfigurationResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CloudTrailConfigurationResult"
      ( \Object
x ->
          DataSourceStatus -> CloudTrailConfigurationResult
CloudTrailConfigurationResult'
            (DataSourceStatus -> CloudTrailConfigurationResult)
-> Parser DataSourceStatus -> Parser CloudTrailConfigurationResult
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser DataSourceStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance
  Prelude.Hashable
    CloudTrailConfigurationResult

instance Prelude.NFData CloudTrailConfigurationResult