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

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

-- | Contains information about which data sources are enabled.
--
-- /See:/ 'newDataSourceConfigurations' smart constructor.
data DataSourceConfigurations = DataSourceConfigurations'
  { -- | Describes whether S3 data event logs are enabled as a data source.
    DataSourceConfigurations -> Maybe S3LogsConfiguration
s3Logs :: Prelude.Maybe S3LogsConfiguration
  }
  deriving (DataSourceConfigurations -> DataSourceConfigurations -> Bool
(DataSourceConfigurations -> DataSourceConfigurations -> Bool)
-> (DataSourceConfigurations -> DataSourceConfigurations -> Bool)
-> Eq DataSourceConfigurations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSourceConfigurations -> DataSourceConfigurations -> Bool
$c/= :: DataSourceConfigurations -> DataSourceConfigurations -> Bool
== :: DataSourceConfigurations -> DataSourceConfigurations -> Bool
$c== :: DataSourceConfigurations -> DataSourceConfigurations -> Bool
Prelude.Eq, ReadPrec [DataSourceConfigurations]
ReadPrec DataSourceConfigurations
Int -> ReadS DataSourceConfigurations
ReadS [DataSourceConfigurations]
(Int -> ReadS DataSourceConfigurations)
-> ReadS [DataSourceConfigurations]
-> ReadPrec DataSourceConfigurations
-> ReadPrec [DataSourceConfigurations]
-> Read DataSourceConfigurations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSourceConfigurations]
$creadListPrec :: ReadPrec [DataSourceConfigurations]
readPrec :: ReadPrec DataSourceConfigurations
$creadPrec :: ReadPrec DataSourceConfigurations
readList :: ReadS [DataSourceConfigurations]
$creadList :: ReadS [DataSourceConfigurations]
readsPrec :: Int -> ReadS DataSourceConfigurations
$creadsPrec :: Int -> ReadS DataSourceConfigurations
Prelude.Read, Int -> DataSourceConfigurations -> ShowS
[DataSourceConfigurations] -> ShowS
DataSourceConfigurations -> String
(Int -> DataSourceConfigurations -> ShowS)
-> (DataSourceConfigurations -> String)
-> ([DataSourceConfigurations] -> ShowS)
-> Show DataSourceConfigurations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSourceConfigurations] -> ShowS
$cshowList :: [DataSourceConfigurations] -> ShowS
show :: DataSourceConfigurations -> String
$cshow :: DataSourceConfigurations -> String
showsPrec :: Int -> DataSourceConfigurations -> ShowS
$cshowsPrec :: Int -> DataSourceConfigurations -> ShowS
Prelude.Show, (forall x.
 DataSourceConfigurations -> Rep DataSourceConfigurations x)
-> (forall x.
    Rep DataSourceConfigurations x -> DataSourceConfigurations)
-> Generic DataSourceConfigurations
forall x.
Rep DataSourceConfigurations x -> DataSourceConfigurations
forall x.
DataSourceConfigurations -> Rep DataSourceConfigurations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DataSourceConfigurations x -> DataSourceConfigurations
$cfrom :: forall x.
DataSourceConfigurations -> Rep DataSourceConfigurations x
Prelude.Generic)

-- |
-- Create a value of 'DataSourceConfigurations' 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:
--
-- 's3Logs', 'dataSourceConfigurations_s3Logs' - Describes whether S3 data event logs are enabled as a data source.
newDataSourceConfigurations ::
  DataSourceConfigurations
newDataSourceConfigurations :: DataSourceConfigurations
newDataSourceConfigurations =
  DataSourceConfigurations' :: Maybe S3LogsConfiguration -> DataSourceConfigurations
DataSourceConfigurations' {$sel:s3Logs:DataSourceConfigurations' :: Maybe S3LogsConfiguration
s3Logs = Maybe S3LogsConfiguration
forall a. Maybe a
Prelude.Nothing}

-- | Describes whether S3 data event logs are enabled as a data source.
dataSourceConfigurations_s3Logs :: Lens.Lens' DataSourceConfigurations (Prelude.Maybe S3LogsConfiguration)
dataSourceConfigurations_s3Logs :: (Maybe S3LogsConfiguration -> f (Maybe S3LogsConfiguration))
-> DataSourceConfigurations -> f DataSourceConfigurations
dataSourceConfigurations_s3Logs = (DataSourceConfigurations -> Maybe S3LogsConfiguration)
-> (DataSourceConfigurations
    -> Maybe S3LogsConfiguration -> DataSourceConfigurations)
-> Lens
     DataSourceConfigurations
     DataSourceConfigurations
     (Maybe S3LogsConfiguration)
     (Maybe S3LogsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceConfigurations' {Maybe S3LogsConfiguration
s3Logs :: Maybe S3LogsConfiguration
$sel:s3Logs:DataSourceConfigurations' :: DataSourceConfigurations -> Maybe S3LogsConfiguration
s3Logs} -> Maybe S3LogsConfiguration
s3Logs) (\s :: DataSourceConfigurations
s@DataSourceConfigurations' {} Maybe S3LogsConfiguration
a -> DataSourceConfigurations
s {$sel:s3Logs:DataSourceConfigurations' :: Maybe S3LogsConfiguration
s3Logs = Maybe S3LogsConfiguration
a} :: DataSourceConfigurations)

instance Prelude.Hashable DataSourceConfigurations

instance Prelude.NFData DataSourceConfigurations

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