{-# 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.SecurityLake.Types.AccountSources
-- 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.SecurityLake.Types.AccountSources where

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
import Amazonka.SecurityLake.Types.LogsStatus
import Amazonka.SecurityLake.Types.OcsfEventClass

-- | Amazon Security Lake collects logs and events from supported Amazon Web
-- Services and custom sources. For the list of supported Amazon Web
-- Services, see the
-- <https://docs.aws.amazon.com/security-lake/latest/userguide/internal-sources.html Amazon Security Lake User Guide>.
--
-- /See:/ 'newAccountSources' smart constructor.
data AccountSources = AccountSources'
  { -- | Initializes a new instance of the Event class.
    AccountSources -> Maybe OcsfEventClass
eventClass :: Prelude.Maybe OcsfEventClass,
    -- | The log status for the Security Lake account.
    AccountSources -> Maybe [LogsStatus]
logsStatus :: Prelude.Maybe [LogsStatus],
    -- | The ID of the Security Lake account for which logs are collected.
    AccountSources -> Text
account :: Prelude.Text,
    -- | The supported Amazon Web Services from which logs and events are
    -- collected. Amazon Security Lake supports log and event collection for
    -- natively supported Amazon Web Services.
    AccountSources -> Text
sourceType :: Prelude.Text
  }
  deriving (AccountSources -> AccountSources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountSources -> AccountSources -> Bool
$c/= :: AccountSources -> AccountSources -> Bool
== :: AccountSources -> AccountSources -> Bool
$c== :: AccountSources -> AccountSources -> Bool
Prelude.Eq, ReadPrec [AccountSources]
ReadPrec AccountSources
Int -> ReadS AccountSources
ReadS [AccountSources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountSources]
$creadListPrec :: ReadPrec [AccountSources]
readPrec :: ReadPrec AccountSources
$creadPrec :: ReadPrec AccountSources
readList :: ReadS [AccountSources]
$creadList :: ReadS [AccountSources]
readsPrec :: Int -> ReadS AccountSources
$creadsPrec :: Int -> ReadS AccountSources
Prelude.Read, Int -> AccountSources -> ShowS
[AccountSources] -> ShowS
AccountSources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountSources] -> ShowS
$cshowList :: [AccountSources] -> ShowS
show :: AccountSources -> String
$cshow :: AccountSources -> String
showsPrec :: Int -> AccountSources -> ShowS
$cshowsPrec :: Int -> AccountSources -> ShowS
Prelude.Show, forall x. Rep AccountSources x -> AccountSources
forall x. AccountSources -> Rep AccountSources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountSources x -> AccountSources
$cfrom :: forall x. AccountSources -> Rep AccountSources x
Prelude.Generic)

-- |
-- Create a value of 'AccountSources' 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:
--
-- 'eventClass', 'accountSources_eventClass' - Initializes a new instance of the Event class.
--
-- 'logsStatus', 'accountSources_logsStatus' - The log status for the Security Lake account.
--
-- 'account', 'accountSources_account' - The ID of the Security Lake account for which logs are collected.
--
-- 'sourceType', 'accountSources_sourceType' - The supported Amazon Web Services from which logs and events are
-- collected. Amazon Security Lake supports log and event collection for
-- natively supported Amazon Web Services.
newAccountSources ::
  -- | 'account'
  Prelude.Text ->
  -- | 'sourceType'
  Prelude.Text ->
  AccountSources
newAccountSources :: Text -> Text -> AccountSources
newAccountSources Text
pAccount_ Text
pSourceType_ =
  AccountSources'
    { $sel:eventClass:AccountSources' :: Maybe OcsfEventClass
eventClass = forall a. Maybe a
Prelude.Nothing,
      $sel:logsStatus:AccountSources' :: Maybe [LogsStatus]
logsStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:account:AccountSources' :: Text
account = Text
pAccount_,
      $sel:sourceType:AccountSources' :: Text
sourceType = Text
pSourceType_
    }

-- | Initializes a new instance of the Event class.
accountSources_eventClass :: Lens.Lens' AccountSources (Prelude.Maybe OcsfEventClass)
accountSources_eventClass :: Lens' AccountSources (Maybe OcsfEventClass)
accountSources_eventClass = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSources' {Maybe OcsfEventClass
eventClass :: Maybe OcsfEventClass
$sel:eventClass:AccountSources' :: AccountSources -> Maybe OcsfEventClass
eventClass} -> Maybe OcsfEventClass
eventClass) (\s :: AccountSources
s@AccountSources' {} Maybe OcsfEventClass
a -> AccountSources
s {$sel:eventClass:AccountSources' :: Maybe OcsfEventClass
eventClass = Maybe OcsfEventClass
a} :: AccountSources)

-- | The log status for the Security Lake account.
accountSources_logsStatus :: Lens.Lens' AccountSources (Prelude.Maybe [LogsStatus])
accountSources_logsStatus :: Lens' AccountSources (Maybe [LogsStatus])
accountSources_logsStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSources' {Maybe [LogsStatus]
logsStatus :: Maybe [LogsStatus]
$sel:logsStatus:AccountSources' :: AccountSources -> Maybe [LogsStatus]
logsStatus} -> Maybe [LogsStatus]
logsStatus) (\s :: AccountSources
s@AccountSources' {} Maybe [LogsStatus]
a -> AccountSources
s {$sel:logsStatus:AccountSources' :: Maybe [LogsStatus]
logsStatus = Maybe [LogsStatus]
a} :: AccountSources) 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 ID of the Security Lake account for which logs are collected.
accountSources_account :: Lens.Lens' AccountSources Prelude.Text
accountSources_account :: Lens' AccountSources Text
accountSources_account = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSources' {Text
account :: Text
$sel:account:AccountSources' :: AccountSources -> Text
account} -> Text
account) (\s :: AccountSources
s@AccountSources' {} Text
a -> AccountSources
s {$sel:account:AccountSources' :: Text
account = Text
a} :: AccountSources)

-- | The supported Amazon Web Services from which logs and events are
-- collected. Amazon Security Lake supports log and event collection for
-- natively supported Amazon Web Services.
accountSources_sourceType :: Lens.Lens' AccountSources Prelude.Text
accountSources_sourceType :: Lens' AccountSources Text
accountSources_sourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSources' {Text
sourceType :: Text
$sel:sourceType:AccountSources' :: AccountSources -> Text
sourceType} -> Text
sourceType) (\s :: AccountSources
s@AccountSources' {} Text
a -> AccountSources
s {$sel:sourceType:AccountSources' :: Text
sourceType = Text
a} :: AccountSources)

instance Data.FromJSON AccountSources where
  parseJSON :: Value -> Parser AccountSources
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountSources"
      ( \Object
x ->
          Maybe OcsfEventClass
-> Maybe [LogsStatus] -> Text -> Text -> AccountSources
AccountSources'
            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
"eventClass")
            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
"logsStatus" 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 a
Data..: Key
"account")
            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
"sourceType")
      )

instance Prelude.Hashable AccountSources where
  hashWithSalt :: Int -> AccountSources -> Int
hashWithSalt Int
_salt AccountSources' {Maybe [LogsStatus]
Maybe OcsfEventClass
Text
sourceType :: Text
account :: Text
logsStatus :: Maybe [LogsStatus]
eventClass :: Maybe OcsfEventClass
$sel:sourceType:AccountSources' :: AccountSources -> Text
$sel:account:AccountSources' :: AccountSources -> Text
$sel:logsStatus:AccountSources' :: AccountSources -> Maybe [LogsStatus]
$sel:eventClass:AccountSources' :: AccountSources -> Maybe OcsfEventClass
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OcsfEventClass
eventClass
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LogsStatus]
logsStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
account
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceType

instance Prelude.NFData AccountSources where
  rnf :: AccountSources -> ()
rnf AccountSources' {Maybe [LogsStatus]
Maybe OcsfEventClass
Text
sourceType :: Text
account :: Text
logsStatus :: Maybe [LogsStatus]
eventClass :: Maybe OcsfEventClass
$sel:sourceType:AccountSources' :: AccountSources -> Text
$sel:account:AccountSources' :: AccountSources -> Text
$sel:logsStatus:AccountSources' :: AccountSources -> Maybe [LogsStatus]
$sel:eventClass:AccountSources' :: AccountSources -> Maybe OcsfEventClass
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe OcsfEventClass
eventClass
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LogsStatus]
logsStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
account
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceType