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

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

-- | Contains information on which data sources are enabled for a member
-- account.
--
-- /See:/ 'newMemberDataSourceConfiguration' smart constructor.
data MemberDataSourceConfiguration = MemberDataSourceConfiguration'
  { -- | The account ID for the member account.
    MemberDataSourceConfiguration -> Text
accountId :: Prelude.Text,
    -- | Contains information on the status of data sources for the account.
    MemberDataSourceConfiguration -> DataSourceConfigurationsResult
dataSources :: DataSourceConfigurationsResult
  }
  deriving (MemberDataSourceConfiguration
-> MemberDataSourceConfiguration -> Bool
(MemberDataSourceConfiguration
 -> MemberDataSourceConfiguration -> Bool)
-> (MemberDataSourceConfiguration
    -> MemberDataSourceConfiguration -> Bool)
-> Eq MemberDataSourceConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MemberDataSourceConfiguration
-> MemberDataSourceConfiguration -> Bool
$c/= :: MemberDataSourceConfiguration
-> MemberDataSourceConfiguration -> Bool
== :: MemberDataSourceConfiguration
-> MemberDataSourceConfiguration -> Bool
$c== :: MemberDataSourceConfiguration
-> MemberDataSourceConfiguration -> Bool
Prelude.Eq, ReadPrec [MemberDataSourceConfiguration]
ReadPrec MemberDataSourceConfiguration
Int -> ReadS MemberDataSourceConfiguration
ReadS [MemberDataSourceConfiguration]
(Int -> ReadS MemberDataSourceConfiguration)
-> ReadS [MemberDataSourceConfiguration]
-> ReadPrec MemberDataSourceConfiguration
-> ReadPrec [MemberDataSourceConfiguration]
-> Read MemberDataSourceConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MemberDataSourceConfiguration]
$creadListPrec :: ReadPrec [MemberDataSourceConfiguration]
readPrec :: ReadPrec MemberDataSourceConfiguration
$creadPrec :: ReadPrec MemberDataSourceConfiguration
readList :: ReadS [MemberDataSourceConfiguration]
$creadList :: ReadS [MemberDataSourceConfiguration]
readsPrec :: Int -> ReadS MemberDataSourceConfiguration
$creadsPrec :: Int -> ReadS MemberDataSourceConfiguration
Prelude.Read, Int -> MemberDataSourceConfiguration -> ShowS
[MemberDataSourceConfiguration] -> ShowS
MemberDataSourceConfiguration -> String
(Int -> MemberDataSourceConfiguration -> ShowS)
-> (MemberDataSourceConfiguration -> String)
-> ([MemberDataSourceConfiguration] -> ShowS)
-> Show MemberDataSourceConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MemberDataSourceConfiguration] -> ShowS
$cshowList :: [MemberDataSourceConfiguration] -> ShowS
show :: MemberDataSourceConfiguration -> String
$cshow :: MemberDataSourceConfiguration -> String
showsPrec :: Int -> MemberDataSourceConfiguration -> ShowS
$cshowsPrec :: Int -> MemberDataSourceConfiguration -> ShowS
Prelude.Show, (forall x.
 MemberDataSourceConfiguration
 -> Rep MemberDataSourceConfiguration x)
-> (forall x.
    Rep MemberDataSourceConfiguration x
    -> MemberDataSourceConfiguration)
-> Generic MemberDataSourceConfiguration
forall x.
Rep MemberDataSourceConfiguration x
-> MemberDataSourceConfiguration
forall x.
MemberDataSourceConfiguration
-> Rep MemberDataSourceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MemberDataSourceConfiguration x
-> MemberDataSourceConfiguration
$cfrom :: forall x.
MemberDataSourceConfiguration
-> Rep MemberDataSourceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'MemberDataSourceConfiguration' 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:
--
-- 'accountId', 'memberDataSourceConfiguration_accountId' - The account ID for the member account.
--
-- 'dataSources', 'memberDataSourceConfiguration_dataSources' - Contains information on the status of data sources for the account.
newMemberDataSourceConfiguration ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'dataSources'
  DataSourceConfigurationsResult ->
  MemberDataSourceConfiguration
newMemberDataSourceConfiguration :: Text
-> DataSourceConfigurationsResult -> MemberDataSourceConfiguration
newMemberDataSourceConfiguration
  Text
pAccountId_
  DataSourceConfigurationsResult
pDataSources_ =
    MemberDataSourceConfiguration' :: Text
-> DataSourceConfigurationsResult -> MemberDataSourceConfiguration
MemberDataSourceConfiguration'
      { $sel:accountId:MemberDataSourceConfiguration' :: Text
accountId =
          Text
pAccountId_,
        $sel:dataSources:MemberDataSourceConfiguration' :: DataSourceConfigurationsResult
dataSources = DataSourceConfigurationsResult
pDataSources_
      }

-- | The account ID for the member account.
memberDataSourceConfiguration_accountId :: Lens.Lens' MemberDataSourceConfiguration Prelude.Text
memberDataSourceConfiguration_accountId :: (Text -> f Text)
-> MemberDataSourceConfiguration -> f MemberDataSourceConfiguration
memberDataSourceConfiguration_accountId = (MemberDataSourceConfiguration -> Text)
-> (MemberDataSourceConfiguration
    -> Text -> MemberDataSourceConfiguration)
-> Lens
     MemberDataSourceConfiguration
     MemberDataSourceConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberDataSourceConfiguration' {Text
accountId :: Text
$sel:accountId:MemberDataSourceConfiguration' :: MemberDataSourceConfiguration -> Text
accountId} -> Text
accountId) (\s :: MemberDataSourceConfiguration
s@MemberDataSourceConfiguration' {} Text
a -> MemberDataSourceConfiguration
s {$sel:accountId:MemberDataSourceConfiguration' :: Text
accountId = Text
a} :: MemberDataSourceConfiguration)

-- | Contains information on the status of data sources for the account.
memberDataSourceConfiguration_dataSources :: Lens.Lens' MemberDataSourceConfiguration DataSourceConfigurationsResult
memberDataSourceConfiguration_dataSources :: (DataSourceConfigurationsResult
 -> f DataSourceConfigurationsResult)
-> MemberDataSourceConfiguration -> f MemberDataSourceConfiguration
memberDataSourceConfiguration_dataSources = (MemberDataSourceConfiguration -> DataSourceConfigurationsResult)
-> (MemberDataSourceConfiguration
    -> DataSourceConfigurationsResult -> MemberDataSourceConfiguration)
-> Lens
     MemberDataSourceConfiguration
     MemberDataSourceConfiguration
     DataSourceConfigurationsResult
     DataSourceConfigurationsResult
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MemberDataSourceConfiguration' {DataSourceConfigurationsResult
dataSources :: DataSourceConfigurationsResult
$sel:dataSources:MemberDataSourceConfiguration' :: MemberDataSourceConfiguration -> DataSourceConfigurationsResult
dataSources} -> DataSourceConfigurationsResult
dataSources) (\s :: MemberDataSourceConfiguration
s@MemberDataSourceConfiguration' {} DataSourceConfigurationsResult
a -> MemberDataSourceConfiguration
s {$sel:dataSources:MemberDataSourceConfiguration' :: DataSourceConfigurationsResult
dataSources = DataSourceConfigurationsResult
a} :: MemberDataSourceConfiguration)

instance Core.FromJSON MemberDataSourceConfiguration where
  parseJSON :: Value -> Parser MemberDataSourceConfiguration
parseJSON =
    String
-> (Object -> Parser MemberDataSourceConfiguration)
-> Value
-> Parser MemberDataSourceConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MemberDataSourceConfiguration"
      ( \Object
x ->
          Text
-> DataSourceConfigurationsResult -> MemberDataSourceConfiguration
MemberDataSourceConfiguration'
            (Text
 -> DataSourceConfigurationsResult -> MemberDataSourceConfiguration)
-> Parser Text
-> Parser
     (DataSourceConfigurationsResult -> MemberDataSourceConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"accountId")
            Parser
  (DataSourceConfigurationsResult -> MemberDataSourceConfiguration)
-> Parser DataSourceConfigurationsResult
-> Parser MemberDataSourceConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DataSourceConfigurationsResult
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dataSources")
      )

instance
  Prelude.Hashable
    MemberDataSourceConfiguration

instance Prelude.NFData MemberDataSourceConfiguration