{-# 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.SecurityHub.Types.AwsElasticsearchDomainLogPublishingOptions
-- 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.SecurityHub.Types.AwsElasticsearchDomainLogPublishingOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsElasticsearchDomainLogPublishingOptionsLogConfig

-- | configures the CloudWatch Logs to publish for the Elasticsearch domain.
--
-- /See:/ 'newAwsElasticsearchDomainLogPublishingOptions' smart constructor.
data AwsElasticsearchDomainLogPublishingOptions = AwsElasticsearchDomainLogPublishingOptions'
  { -- | Configures the OpenSearch index logs publishing.
    AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs :: Prelude.Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig,
    -- | Configures the OpenSearch search slow log publishing.
    AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs :: Prelude.Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig,
    AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs :: Prelude.Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
  }
  deriving (AwsElasticsearchDomainLogPublishingOptions
-> AwsElasticsearchDomainLogPublishingOptions -> Bool
(AwsElasticsearchDomainLogPublishingOptions
 -> AwsElasticsearchDomainLogPublishingOptions -> Bool)
-> (AwsElasticsearchDomainLogPublishingOptions
    -> AwsElasticsearchDomainLogPublishingOptions -> Bool)
-> Eq AwsElasticsearchDomainLogPublishingOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsElasticsearchDomainLogPublishingOptions
-> AwsElasticsearchDomainLogPublishingOptions -> Bool
$c/= :: AwsElasticsearchDomainLogPublishingOptions
-> AwsElasticsearchDomainLogPublishingOptions -> Bool
== :: AwsElasticsearchDomainLogPublishingOptions
-> AwsElasticsearchDomainLogPublishingOptions -> Bool
$c== :: AwsElasticsearchDomainLogPublishingOptions
-> AwsElasticsearchDomainLogPublishingOptions -> Bool
Prelude.Eq, ReadPrec [AwsElasticsearchDomainLogPublishingOptions]
ReadPrec AwsElasticsearchDomainLogPublishingOptions
Int -> ReadS AwsElasticsearchDomainLogPublishingOptions
ReadS [AwsElasticsearchDomainLogPublishingOptions]
(Int -> ReadS AwsElasticsearchDomainLogPublishingOptions)
-> ReadS [AwsElasticsearchDomainLogPublishingOptions]
-> ReadPrec AwsElasticsearchDomainLogPublishingOptions
-> ReadPrec [AwsElasticsearchDomainLogPublishingOptions]
-> Read AwsElasticsearchDomainLogPublishingOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsElasticsearchDomainLogPublishingOptions]
$creadListPrec :: ReadPrec [AwsElasticsearchDomainLogPublishingOptions]
readPrec :: ReadPrec AwsElasticsearchDomainLogPublishingOptions
$creadPrec :: ReadPrec AwsElasticsearchDomainLogPublishingOptions
readList :: ReadS [AwsElasticsearchDomainLogPublishingOptions]
$creadList :: ReadS [AwsElasticsearchDomainLogPublishingOptions]
readsPrec :: Int -> ReadS AwsElasticsearchDomainLogPublishingOptions
$creadsPrec :: Int -> ReadS AwsElasticsearchDomainLogPublishingOptions
Prelude.Read, Int -> AwsElasticsearchDomainLogPublishingOptions -> ShowS
[AwsElasticsearchDomainLogPublishingOptions] -> ShowS
AwsElasticsearchDomainLogPublishingOptions -> String
(Int -> AwsElasticsearchDomainLogPublishingOptions -> ShowS)
-> (AwsElasticsearchDomainLogPublishingOptions -> String)
-> ([AwsElasticsearchDomainLogPublishingOptions] -> ShowS)
-> Show AwsElasticsearchDomainLogPublishingOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsElasticsearchDomainLogPublishingOptions] -> ShowS
$cshowList :: [AwsElasticsearchDomainLogPublishingOptions] -> ShowS
show :: AwsElasticsearchDomainLogPublishingOptions -> String
$cshow :: AwsElasticsearchDomainLogPublishingOptions -> String
showsPrec :: Int -> AwsElasticsearchDomainLogPublishingOptions -> ShowS
$cshowsPrec :: Int -> AwsElasticsearchDomainLogPublishingOptions -> ShowS
Prelude.Show, (forall x.
 AwsElasticsearchDomainLogPublishingOptions
 -> Rep AwsElasticsearchDomainLogPublishingOptions x)
-> (forall x.
    Rep AwsElasticsearchDomainLogPublishingOptions x
    -> AwsElasticsearchDomainLogPublishingOptions)
-> Generic AwsElasticsearchDomainLogPublishingOptions
forall x.
Rep AwsElasticsearchDomainLogPublishingOptions x
-> AwsElasticsearchDomainLogPublishingOptions
forall x.
AwsElasticsearchDomainLogPublishingOptions
-> Rep AwsElasticsearchDomainLogPublishingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsElasticsearchDomainLogPublishingOptions x
-> AwsElasticsearchDomainLogPublishingOptions
$cfrom :: forall x.
AwsElasticsearchDomainLogPublishingOptions
-> Rep AwsElasticsearchDomainLogPublishingOptions x
Prelude.Generic)

-- |
-- Create a value of 'AwsElasticsearchDomainLogPublishingOptions' 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:
--
-- 'indexSlowLogs', 'awsElasticsearchDomainLogPublishingOptions_indexSlowLogs' - Configures the OpenSearch index logs publishing.
--
-- 'searchSlowLogs', 'awsElasticsearchDomainLogPublishingOptions_searchSlowLogs' - Configures the OpenSearch search slow log publishing.
--
-- 'auditLogs', 'awsElasticsearchDomainLogPublishingOptions_auditLogs' - Undocumented member.
newAwsElasticsearchDomainLogPublishingOptions ::
  AwsElasticsearchDomainLogPublishingOptions
newAwsElasticsearchDomainLogPublishingOptions :: AwsElasticsearchDomainLogPublishingOptions
newAwsElasticsearchDomainLogPublishingOptions =
  AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> AwsElasticsearchDomainLogPublishingOptions
AwsElasticsearchDomainLogPublishingOptions'
    { $sel:indexSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs =
        Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:searchSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs =
        Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:auditLogs:AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs = Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
forall a. Maybe a
Prelude.Nothing
    }

-- | Configures the OpenSearch index logs publishing.
awsElasticsearchDomainLogPublishingOptions_indexSlowLogs :: Lens.Lens' AwsElasticsearchDomainLogPublishingOptions (Prelude.Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
awsElasticsearchDomainLogPublishingOptions_indexSlowLogs :: (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
 -> f (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig))
-> AwsElasticsearchDomainLogPublishingOptions
-> f AwsElasticsearchDomainLogPublishingOptions
awsElasticsearchDomainLogPublishingOptions_indexSlowLogs = (AwsElasticsearchDomainLogPublishingOptions
 -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
-> (AwsElasticsearchDomainLogPublishingOptions
    -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
    -> AwsElasticsearchDomainLogPublishingOptions)
-> Lens
     AwsElasticsearchDomainLogPublishingOptions
     AwsElasticsearchDomainLogPublishingOptions
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticsearchDomainLogPublishingOptions' {Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
$sel:indexSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs} -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs) (\s :: AwsElasticsearchDomainLogPublishingOptions
s@AwsElasticsearchDomainLogPublishingOptions' {} Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
a -> AwsElasticsearchDomainLogPublishingOptions
s {$sel:indexSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs = Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
a} :: AwsElasticsearchDomainLogPublishingOptions)

-- | Configures the OpenSearch search slow log publishing.
awsElasticsearchDomainLogPublishingOptions_searchSlowLogs :: Lens.Lens' AwsElasticsearchDomainLogPublishingOptions (Prelude.Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
awsElasticsearchDomainLogPublishingOptions_searchSlowLogs :: (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
 -> f (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig))
-> AwsElasticsearchDomainLogPublishingOptions
-> f AwsElasticsearchDomainLogPublishingOptions
awsElasticsearchDomainLogPublishingOptions_searchSlowLogs = (AwsElasticsearchDomainLogPublishingOptions
 -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
-> (AwsElasticsearchDomainLogPublishingOptions
    -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
    -> AwsElasticsearchDomainLogPublishingOptions)
-> Lens
     AwsElasticsearchDomainLogPublishingOptions
     AwsElasticsearchDomainLogPublishingOptions
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticsearchDomainLogPublishingOptions' {Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
$sel:searchSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs} -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs) (\s :: AwsElasticsearchDomainLogPublishingOptions
s@AwsElasticsearchDomainLogPublishingOptions' {} Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
a -> AwsElasticsearchDomainLogPublishingOptions
s {$sel:searchSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs = Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
a} :: AwsElasticsearchDomainLogPublishingOptions)

-- | Undocumented member.
awsElasticsearchDomainLogPublishingOptions_auditLogs :: Lens.Lens' AwsElasticsearchDomainLogPublishingOptions (Prelude.Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
awsElasticsearchDomainLogPublishingOptions_auditLogs :: (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
 -> f (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig))
-> AwsElasticsearchDomainLogPublishingOptions
-> f AwsElasticsearchDomainLogPublishingOptions
awsElasticsearchDomainLogPublishingOptions_auditLogs = (AwsElasticsearchDomainLogPublishingOptions
 -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
-> (AwsElasticsearchDomainLogPublishingOptions
    -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
    -> AwsElasticsearchDomainLogPublishingOptions)
-> Lens
     AwsElasticsearchDomainLogPublishingOptions
     AwsElasticsearchDomainLogPublishingOptions
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticsearchDomainLogPublishingOptions' {Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
$sel:auditLogs:AwsElasticsearchDomainLogPublishingOptions' :: AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs} -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs) (\s :: AwsElasticsearchDomainLogPublishingOptions
s@AwsElasticsearchDomainLogPublishingOptions' {} Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
a -> AwsElasticsearchDomainLogPublishingOptions
s {$sel:auditLogs:AwsElasticsearchDomainLogPublishingOptions' :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs = Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
a} :: AwsElasticsearchDomainLogPublishingOptions)

instance
  Core.FromJSON
    AwsElasticsearchDomainLogPublishingOptions
  where
  parseJSON :: Value -> Parser AwsElasticsearchDomainLogPublishingOptions
parseJSON =
    String
-> (Object -> Parser AwsElasticsearchDomainLogPublishingOptions)
-> Value
-> Parser AwsElasticsearchDomainLogPublishingOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsElasticsearchDomainLogPublishingOptions"
      ( \Object
x ->
          Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> AwsElasticsearchDomainLogPublishingOptions
AwsElasticsearchDomainLogPublishingOptions'
            (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
 -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
 -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
 -> AwsElasticsearchDomainLogPublishingOptions)
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
      -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
      -> AwsElasticsearchDomainLogPublishingOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexSlowLogs")
              Parser
  (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
   -> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
   -> AwsElasticsearchDomainLogPublishingOptions)
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
      -> AwsElasticsearchDomainLogPublishingOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SearchSlowLogs")
              Parser
  (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
   -> AwsElasticsearchDomainLogPublishingOptions)
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
-> Parser AwsElasticsearchDomainLogPublishingOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser
     (Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AuditLogs")
      )

instance
  Prelude.Hashable
    AwsElasticsearchDomainLogPublishingOptions

instance
  Prelude.NFData
    AwsElasticsearchDomainLogPublishingOptions

instance
  Core.ToJSON
    AwsElasticsearchDomainLogPublishingOptions
  where
  toJSON :: AwsElasticsearchDomainLogPublishingOptions -> Value
toJSON
    AwsElasticsearchDomainLogPublishingOptions' {Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs :: Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
$sel:auditLogs:AwsElasticsearchDomainLogPublishingOptions' :: AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
$sel:searchSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
$sel:indexSlowLogs:AwsElasticsearchDomainLogPublishingOptions' :: AwsElasticsearchDomainLogPublishingOptions
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"IndexSlowLogs" Text -> AwsElasticsearchDomainLogPublishingOptionsLogConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsElasticsearchDomainLogPublishingOptionsLogConfig -> Pair)
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
indexSlowLogs,
              (Text
"SearchSlowLogs" Text -> AwsElasticsearchDomainLogPublishingOptionsLogConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
                (AwsElasticsearchDomainLogPublishingOptionsLogConfig -> Pair)
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
searchSlowLogs,
              (Text
"AuditLogs" Text -> AwsElasticsearchDomainLogPublishingOptionsLogConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsElasticsearchDomainLogPublishingOptionsLogConfig -> Pair)
-> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsElasticsearchDomainLogPublishingOptionsLogConfig
auditLogs
            ]
        )