{-# 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.IoTSiteWise.Types.LoggingOptions
-- 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.IoTSiteWise.Types.LoggingOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.LoggingLevel
import qualified Amazonka.Prelude as Prelude

-- | Contains logging options.
--
-- /See:/ 'newLoggingOptions' smart constructor.
data LoggingOptions = LoggingOptions'
  { -- | The IoT SiteWise logging verbosity level.
    LoggingOptions -> LoggingLevel
level :: LoggingLevel
  }
  deriving (LoggingOptions -> LoggingOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingOptions -> LoggingOptions -> Bool
$c/= :: LoggingOptions -> LoggingOptions -> Bool
== :: LoggingOptions -> LoggingOptions -> Bool
$c== :: LoggingOptions -> LoggingOptions -> Bool
Prelude.Eq, ReadPrec [LoggingOptions]
ReadPrec LoggingOptions
Int -> ReadS LoggingOptions
ReadS [LoggingOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingOptions]
$creadListPrec :: ReadPrec [LoggingOptions]
readPrec :: ReadPrec LoggingOptions
$creadPrec :: ReadPrec LoggingOptions
readList :: ReadS [LoggingOptions]
$creadList :: ReadS [LoggingOptions]
readsPrec :: Int -> ReadS LoggingOptions
$creadsPrec :: Int -> ReadS LoggingOptions
Prelude.Read, Int -> LoggingOptions -> ShowS
[LoggingOptions] -> ShowS
LoggingOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingOptions] -> ShowS
$cshowList :: [LoggingOptions] -> ShowS
show :: LoggingOptions -> String
$cshow :: LoggingOptions -> String
showsPrec :: Int -> LoggingOptions -> ShowS
$cshowsPrec :: Int -> LoggingOptions -> ShowS
Prelude.Show, forall x. Rep LoggingOptions x -> LoggingOptions
forall x. LoggingOptions -> Rep LoggingOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingOptions x -> LoggingOptions
$cfrom :: forall x. LoggingOptions -> Rep LoggingOptions x
Prelude.Generic)

-- |
-- Create a value of 'LoggingOptions' 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:
--
-- 'level', 'loggingOptions_level' - The IoT SiteWise logging verbosity level.
newLoggingOptions ::
  -- | 'level'
  LoggingLevel ->
  LoggingOptions
newLoggingOptions :: LoggingLevel -> LoggingOptions
newLoggingOptions LoggingLevel
pLevel_ =
  LoggingOptions' {$sel:level:LoggingOptions' :: LoggingLevel
level = LoggingLevel
pLevel_}

-- | The IoT SiteWise logging verbosity level.
loggingOptions_level :: Lens.Lens' LoggingOptions LoggingLevel
loggingOptions_level :: Lens' LoggingOptions LoggingLevel
loggingOptions_level = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingOptions' {LoggingLevel
level :: LoggingLevel
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
level} -> LoggingLevel
level) (\s :: LoggingOptions
s@LoggingOptions' {} LoggingLevel
a -> LoggingOptions
s {$sel:level:LoggingOptions' :: LoggingLevel
level = LoggingLevel
a} :: LoggingOptions)

instance Data.FromJSON LoggingOptions where
  parseJSON :: Value -> Parser LoggingOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LoggingOptions"
      ( \Object
x ->
          LoggingLevel -> LoggingOptions
LoggingOptions' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"level")
      )

instance Prelude.Hashable LoggingOptions where
  hashWithSalt :: Int -> LoggingOptions -> Int
hashWithSalt Int
_salt LoggingOptions' {LoggingLevel
level :: LoggingLevel
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LoggingLevel
level

instance Prelude.NFData LoggingOptions where
  rnf :: LoggingOptions -> ()
rnf LoggingOptions' {LoggingLevel
level :: LoggingLevel
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
..} = forall a. NFData a => a -> ()
Prelude.rnf LoggingLevel
level

instance Data.ToJSON LoggingOptions where
  toJSON :: LoggingOptions -> Value
toJSON LoggingOptions' {LoggingLevel
level :: LoggingLevel
$sel:level:LoggingOptions' :: LoggingOptions -> LoggingLevel
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"level" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LoggingLevel
level)]
      )