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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.LogPublishingOption
import Amazonka.OpenSearch.Types.LogType
import Amazonka.OpenSearch.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 status of the log publishing options for the domain. See
    -- @OptionStatus@ for the status information that\'s included.
    LogPublishingOptionsStatus -> Maybe OptionStatus
status :: Prelude.Maybe OptionStatus,
    -- | The log publishing options configured for the domain.
    LogPublishingOptionsStatus
-> Maybe (HashMap LogType LogPublishingOption)
options :: Prelude.Maybe (Prelude.HashMap LogType LogPublishingOption)
  }
  deriving (LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool
(LogPublishingOptionsStatus -> LogPublishingOptionsStatus -> Bool)
-> (LogPublishingOptionsStatus
    -> LogPublishingOptionsStatus -> Bool)
-> Eq LogPublishingOptionsStatus
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]
(Int -> ReadS LogPublishingOptionsStatus)
-> ReadS [LogPublishingOptionsStatus]
-> ReadPrec LogPublishingOptionsStatus
-> ReadPrec [LogPublishingOptionsStatus]
-> Read 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
(Int -> LogPublishingOptionsStatus -> ShowS)
-> (LogPublishingOptionsStatus -> String)
-> ([LogPublishingOptionsStatus] -> ShowS)
-> Show LogPublishingOptionsStatus
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.
 LogPublishingOptionsStatus -> Rep LogPublishingOptionsStatus x)
-> (forall x.
    Rep LogPublishingOptionsStatus x -> LogPublishingOptionsStatus)
-> Generic LogPublishingOptionsStatus
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:
--
-- 'status', 'logPublishingOptionsStatus_status' - The status of the log publishing options for the domain. See
-- @OptionStatus@ for the status information that\'s included.
--
-- 'options', 'logPublishingOptionsStatus_options' - The log publishing options configured for the domain.
newLogPublishingOptionsStatus ::
  LogPublishingOptionsStatus
newLogPublishingOptionsStatus :: LogPublishingOptionsStatus
newLogPublishingOptionsStatus =
  LogPublishingOptionsStatus' :: Maybe OptionStatus
-> Maybe (HashMap LogType LogPublishingOption)
-> LogPublishingOptionsStatus
LogPublishingOptionsStatus'
    { $sel:status:LogPublishingOptionsStatus' :: Maybe OptionStatus
status =
        Maybe OptionStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:options:LogPublishingOptionsStatus' :: Maybe (HashMap LogType LogPublishingOption)
options = Maybe (HashMap LogType LogPublishingOption)
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the log publishing options for the domain. See
-- @OptionStatus@ for the status information that\'s included.
logPublishingOptionsStatus_status :: Lens.Lens' LogPublishingOptionsStatus (Prelude.Maybe OptionStatus)
logPublishingOptionsStatus_status :: (Maybe OptionStatus -> f (Maybe OptionStatus))
-> LogPublishingOptionsStatus -> f LogPublishingOptionsStatus
logPublishingOptionsStatus_status = (LogPublishingOptionsStatus -> Maybe OptionStatus)
-> (LogPublishingOptionsStatus
    -> Maybe OptionStatus -> LogPublishingOptionsStatus)
-> Lens
     LogPublishingOptionsStatus
     LogPublishingOptionsStatus
     (Maybe OptionStatus)
     (Maybe OptionStatus)
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)

-- | The log publishing options configured for the domain.
logPublishingOptionsStatus_options :: Lens.Lens' LogPublishingOptionsStatus (Prelude.Maybe (Prelude.HashMap LogType LogPublishingOption))
logPublishingOptionsStatus_options :: (Maybe (HashMap LogType LogPublishingOption)
 -> f (Maybe (HashMap LogType LogPublishingOption)))
-> LogPublishingOptionsStatus -> f LogPublishingOptionsStatus
logPublishingOptionsStatus_options = (LogPublishingOptionsStatus
 -> Maybe (HashMap LogType LogPublishingOption))
-> (LogPublishingOptionsStatus
    -> Maybe (HashMap LogType LogPublishingOption)
    -> LogPublishingOptionsStatus)
-> Lens
     LogPublishingOptionsStatus
     LogPublishingOptionsStatus
     (Maybe (HashMap LogType LogPublishingOption))
     (Maybe (HashMap LogType LogPublishingOption))
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) ((Maybe (HashMap LogType LogPublishingOption)
  -> f (Maybe (HashMap LogType LogPublishingOption)))
 -> LogPublishingOptionsStatus -> f LogPublishingOptionsStatus)
-> ((Maybe (HashMap LogType LogPublishingOption)
     -> f (Maybe (HashMap LogType LogPublishingOption)))
    -> Maybe (HashMap LogType LogPublishingOption)
    -> f (Maybe (HashMap LogType LogPublishingOption)))
-> (Maybe (HashMap LogType LogPublishingOption)
    -> f (Maybe (HashMap LogType LogPublishingOption)))
-> LogPublishingOptionsStatus
-> f LogPublishingOptionsStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap LogType LogPublishingOption)
  (HashMap LogType LogPublishingOption)
  (HashMap LogType LogPublishingOption)
  (HashMap LogType LogPublishingOption)
-> Iso
     (Maybe (HashMap LogType LogPublishingOption))
     (Maybe (HashMap LogType LogPublishingOption))
     (Maybe (HashMap LogType LogPublishingOption))
     (Maybe (HashMap LogType LogPublishingOption))
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 AnIso
  (HashMap LogType LogPublishingOption)
  (HashMap LogType LogPublishingOption)
  (HashMap LogType LogPublishingOption)
  (HashMap LogType LogPublishingOption)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON LogPublishingOptionsStatus where
  parseJSON :: Value -> Parser LogPublishingOptionsStatus
parseJSON =
    String
-> (Object -> Parser LogPublishingOptionsStatus)
-> Value
-> Parser LogPublishingOptionsStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LogPublishingOptionsStatus"
      ( \Object
x ->
          Maybe OptionStatus
-> Maybe (HashMap LogType LogPublishingOption)
-> LogPublishingOptionsStatus
LogPublishingOptionsStatus'
            (Maybe OptionStatus
 -> Maybe (HashMap LogType LogPublishingOption)
 -> LogPublishingOptionsStatus)
-> Parser (Maybe OptionStatus)
-> Parser
     (Maybe (HashMap LogType LogPublishingOption)
      -> LogPublishingOptionsStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OptionStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe (HashMap LogType LogPublishingOption)
   -> LogPublishingOptionsStatus)
-> Parser (Maybe (HashMap LogType LogPublishingOption))
-> Parser LogPublishingOptionsStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap LogType LogPublishingOption)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Options" Parser (Maybe (Maybe (HashMap LogType LogPublishingOption)))
-> Maybe (HashMap LogType LogPublishingOption)
-> Parser (Maybe (HashMap LogType LogPublishingOption))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap LogType LogPublishingOption)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable LogPublishingOptionsStatus

instance Prelude.NFData LogPublishingOptionsStatus