{-# 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.ElasticSearch.Types.LogPublishingOptionsStatus
-- 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.ElasticSearch.Types.LogPublishingOptionsStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.LogPublishingOption
import Amazonka.ElasticSearch.Types.LogType
import Amazonka.ElasticSearch.Types.OptionStatus
import qualified Amazonka.Prelude as Prelude

-- | The configured log publishing options for the domain and their current
-- status.
--
-- /See:/ 'newLogPublishingOptionsStatus' smart constructor.
data LogPublishingOptionsStatus = LogPublishingOptionsStatus'
  { -- | The log publishing options configured for the Elasticsearch domain.
    LogPublishingOptionsStatus
-> Maybe (HashMap LogType LogPublishingOption)
options :: Prelude.Maybe (Prelude.HashMap LogType LogPublishingOption),
    -- | The status of the log publishing options for the Elasticsearch domain.
    -- See @OptionStatus@ for the status information that\'s included.
    LogPublishingOptionsStatus -> Maybe OptionStatus
status :: Prelude.Maybe OptionStatus
  }
  deriving (LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool
$c/= :: LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool
== :: LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool
$c== :: LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool
Prelude.Eq, ReadPrec [LogPublishingOptionsStatus]
ReadPrec LogPublishingOptionsStatus
Int -> ReadS LogPublishingOptionsStatus
ReadS [LogPublishingOptionsStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogPublishingOptionsStatus]
$creadListPrec :: ReadPrec [LogPublishingOptionsStatus]
readPrec :: ReadPrec LogPublishingOptionsStatus
$creadPrec :: ReadPrec LogPublishingOptionsStatus
readList :: ReadS [LogPublishingOptionsStatus]
$creadList :: ReadS [LogPublishingOptionsStatus]
readsPrec :: Int -> ReadS LogPublishingOptionsStatus
$creadsPrec :: Int -> ReadS LogPublishingOptionsStatus
Prelude.Read, Int -> LogPublishingOptionsStatus -> ShowS
[LogPublishingOptionsStatus] -> ShowS
LogPublishingOptionsStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogPublishingOptionsStatus] -> ShowS
$cshowList :: [LogPublishingOptionsStatus] -> ShowS
show :: LogPublishingOptionsStatus -> String
$cshow :: LogPublishingOptionsStatus -> String
showsPrec :: Int -> LogPublishingOptionsStatus -> ShowS
$cshowsPrec :: Int -> LogPublishingOptionsStatus -> ShowS
Prelude.Show, forall x.
Rep LogPublishingOptionsStatus x -> LogPublishingOptionsStatus
forall x.
LogPublishingOptionsStatus -> Rep LogPublishingOptionsStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LogPublishingOptionsStatus x -> LogPublishingOptionsStatus
$cfrom :: forall x.
LogPublishingOptionsStatus -> Rep LogPublishingOptionsStatus x
Prelude.Generic)

-- |
-- Create a value of 'LogPublishingOptionsStatus' 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:
--
-- 'options', 'logPublishingOptionsStatus_options' - The log publishing options configured for the Elasticsearch domain.
--
-- 'status', 'logPublishingOptionsStatus_status' - The status of the log publishing options for the Elasticsearch domain.
-- See @OptionStatus@ for the status information that\'s included.
newLogPublishingOptionsStatus ::
  LogPublishingOptionsStatus
newLogPublishingOptionsStatus :: LogPublishingOptionsStatus
newLogPublishingOptionsStatus =
  LogPublishingOptionsStatus'
    { $sel:options:LogPublishingOptionsStatus' :: Maybe (HashMap LogType LogPublishingOption)
options =
        forall a. Maybe a
Prelude.Nothing,
      $sel:status:LogPublishingOptionsStatus' :: Maybe OptionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The log publishing options configured for the Elasticsearch domain.
logPublishingOptionsStatus_options :: Lens.Lens' LogPublishingOptionsStatus (Prelude.Maybe (Prelude.HashMap LogType LogPublishingOption))
logPublishingOptionsStatus_options :: Lens'
  LogPublishingOptionsStatus
  (Maybe (HashMap LogType LogPublishingOption))
logPublishingOptionsStatus_options = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogPublishingOptionsStatus' {Maybe (HashMap LogType LogPublishingOption)
options :: Maybe (HashMap LogType LogPublishingOption)
$sel:options:LogPublishingOptionsStatus' :: LogPublishingOptionsStatus
-> Maybe (HashMap LogType LogPublishingOption)
options} -> Maybe (HashMap LogType LogPublishingOption)
options) (\s :: LogPublishingOptionsStatus
s@LogPublishingOptionsStatus' {} Maybe (HashMap LogType LogPublishingOption)
a -> LogPublishingOptionsStatus
s {$sel:options:LogPublishingOptionsStatus' :: Maybe (HashMap LogType LogPublishingOption)
options = Maybe (HashMap LogType LogPublishingOption)
a} :: LogPublishingOptionsStatus) 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 status of the log publishing options for the Elasticsearch domain.
-- See @OptionStatus@ for the status information that\'s included.
logPublishingOptionsStatus_status :: Lens.Lens' LogPublishingOptionsStatus (Prelude.Maybe OptionStatus)
logPublishingOptionsStatus_status :: Lens' LogPublishingOptionsStatus (Maybe OptionStatus)
logPublishingOptionsStatus_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogPublishingOptionsStatus' {Maybe OptionStatus
status :: Maybe OptionStatus
$sel:status:LogPublishingOptionsStatus' :: LogPublishingOptionsStatus -> Maybe OptionStatus
status} -> Maybe OptionStatus
status) (\s :: LogPublishingOptionsStatus
s@LogPublishingOptionsStatus' {} Maybe OptionStatus
a -> LogPublishingOptionsStatus
s {$sel:status:LogPublishingOptionsStatus' :: Maybe OptionStatus
status = Maybe OptionStatus
a} :: LogPublishingOptionsStatus)

instance Data.FromJSON LogPublishingOptionsStatus where
  parseJSON :: Value -> Parser LogPublishingOptionsStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LogPublishingOptionsStatus"
      ( \Object
x ->
          Maybe (HashMap LogType LogPublishingOption)
-> Maybe OptionStatus -> LogPublishingOptionsStatus
LogPublishingOptionsStatus'
            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
"Options" 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 (Maybe a)
Data..:? Key
"Status")
      )

instance Prelude.Hashable LogPublishingOptionsStatus where
  hashWithSalt :: Int -> LogPublishingOptionsStatus -> Int
hashWithSalt Int
_salt LogPublishingOptionsStatus' {Maybe (HashMap LogType LogPublishingOption)
Maybe OptionStatus
status :: Maybe OptionStatus
options :: Maybe (HashMap LogType LogPublishingOption)
$sel:status:LogPublishingOptionsStatus' :: LogPublishingOptionsStatus -> Maybe OptionStatus
$sel:options:LogPublishingOptionsStatus' :: LogPublishingOptionsStatus
-> Maybe (HashMap LogType LogPublishingOption)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap LogType LogPublishingOption)
options
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OptionStatus
status

instance Prelude.NFData LogPublishingOptionsStatus where
  rnf :: LogPublishingOptionsStatus -> ()
rnf LogPublishingOptionsStatus' {Maybe (HashMap LogType LogPublishingOption)
Maybe OptionStatus
status :: Maybe OptionStatus
options :: Maybe (HashMap LogType LogPublishingOption)
$sel:status:LogPublishingOptionsStatus' :: LogPublishingOptionsStatus -> Maybe OptionStatus
$sel:options:LogPublishingOptionsStatus' :: LogPublishingOptionsStatus
-> Maybe (HashMap LogType LogPublishingOption)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap LogType LogPublishingOption)
options
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OptionStatus
status