{-# 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.IoT.Types.LogTargetConfiguration
-- 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.IoT.Types.LogTargetConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.LogLevel
import Amazonka.IoT.Types.LogTarget
import qualified Amazonka.Prelude as Prelude

-- | The target configuration.
--
-- /See:/ 'newLogTargetConfiguration' smart constructor.
data LogTargetConfiguration = LogTargetConfiguration'
  { -- | The logging level.
    LogTargetConfiguration -> Maybe LogLevel
logLevel :: Prelude.Maybe LogLevel,
    -- | A log target
    LogTargetConfiguration -> Maybe LogTarget
logTarget :: Prelude.Maybe LogTarget
  }
  deriving (LogTargetConfiguration -> LogTargetConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogTargetConfiguration -> LogTargetConfiguration -> Bool
$c/= :: LogTargetConfiguration -> LogTargetConfiguration -> Bool
== :: LogTargetConfiguration -> LogTargetConfiguration -> Bool
$c== :: LogTargetConfiguration -> LogTargetConfiguration -> Bool
Prelude.Eq, ReadPrec [LogTargetConfiguration]
ReadPrec LogTargetConfiguration
Int -> ReadS LogTargetConfiguration
ReadS [LogTargetConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogTargetConfiguration]
$creadListPrec :: ReadPrec [LogTargetConfiguration]
readPrec :: ReadPrec LogTargetConfiguration
$creadPrec :: ReadPrec LogTargetConfiguration
readList :: ReadS [LogTargetConfiguration]
$creadList :: ReadS [LogTargetConfiguration]
readsPrec :: Int -> ReadS LogTargetConfiguration
$creadsPrec :: Int -> ReadS LogTargetConfiguration
Prelude.Read, Int -> LogTargetConfiguration -> ShowS
[LogTargetConfiguration] -> ShowS
LogTargetConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogTargetConfiguration] -> ShowS
$cshowList :: [LogTargetConfiguration] -> ShowS
show :: LogTargetConfiguration -> String
$cshow :: LogTargetConfiguration -> String
showsPrec :: Int -> LogTargetConfiguration -> ShowS
$cshowsPrec :: Int -> LogTargetConfiguration -> ShowS
Prelude.Show, forall x. Rep LogTargetConfiguration x -> LogTargetConfiguration
forall x. LogTargetConfiguration -> Rep LogTargetConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogTargetConfiguration x -> LogTargetConfiguration
$cfrom :: forall x. LogTargetConfiguration -> Rep LogTargetConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LogTargetConfiguration' 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:
--
-- 'logLevel', 'logTargetConfiguration_logLevel' - The logging level.
--
-- 'logTarget', 'logTargetConfiguration_logTarget' - A log target
newLogTargetConfiguration ::
  LogTargetConfiguration
newLogTargetConfiguration :: LogTargetConfiguration
newLogTargetConfiguration =
  LogTargetConfiguration'
    { $sel:logLevel:LogTargetConfiguration' :: Maybe LogLevel
logLevel = forall a. Maybe a
Prelude.Nothing,
      $sel:logTarget:LogTargetConfiguration' :: Maybe LogTarget
logTarget = forall a. Maybe a
Prelude.Nothing
    }

-- | The logging level.
logTargetConfiguration_logLevel :: Lens.Lens' LogTargetConfiguration (Prelude.Maybe LogLevel)
logTargetConfiguration_logLevel :: Lens' LogTargetConfiguration (Maybe LogLevel)
logTargetConfiguration_logLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogTargetConfiguration' {Maybe LogLevel
logLevel :: Maybe LogLevel
$sel:logLevel:LogTargetConfiguration' :: LogTargetConfiguration -> Maybe LogLevel
logLevel} -> Maybe LogLevel
logLevel) (\s :: LogTargetConfiguration
s@LogTargetConfiguration' {} Maybe LogLevel
a -> LogTargetConfiguration
s {$sel:logLevel:LogTargetConfiguration' :: Maybe LogLevel
logLevel = Maybe LogLevel
a} :: LogTargetConfiguration)

-- | A log target
logTargetConfiguration_logTarget :: Lens.Lens' LogTargetConfiguration (Prelude.Maybe LogTarget)
logTargetConfiguration_logTarget :: Lens' LogTargetConfiguration (Maybe LogTarget)
logTargetConfiguration_logTarget = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogTargetConfiguration' {Maybe LogTarget
logTarget :: Maybe LogTarget
$sel:logTarget:LogTargetConfiguration' :: LogTargetConfiguration -> Maybe LogTarget
logTarget} -> Maybe LogTarget
logTarget) (\s :: LogTargetConfiguration
s@LogTargetConfiguration' {} Maybe LogTarget
a -> LogTargetConfiguration
s {$sel:logTarget:LogTargetConfiguration' :: Maybe LogTarget
logTarget = Maybe LogTarget
a} :: LogTargetConfiguration)

instance Data.FromJSON LogTargetConfiguration where
  parseJSON :: Value -> Parser LogTargetConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LogTargetConfiguration"
      ( \Object
x ->
          Maybe LogLevel -> Maybe LogTarget -> LogTargetConfiguration
LogTargetConfiguration'
            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
"logLevel")
            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
"logTarget")
      )

instance Prelude.Hashable LogTargetConfiguration where
  hashWithSalt :: Int -> LogTargetConfiguration -> Int
hashWithSalt Int
_salt LogTargetConfiguration' {Maybe LogLevel
Maybe LogTarget
logTarget :: Maybe LogTarget
logLevel :: Maybe LogLevel
$sel:logTarget:LogTargetConfiguration' :: LogTargetConfiguration -> Maybe LogTarget
$sel:logLevel:LogTargetConfiguration' :: LogTargetConfiguration -> Maybe LogLevel
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LogLevel
logLevel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LogTarget
logTarget

instance Prelude.NFData LogTargetConfiguration where
  rnf :: LogTargetConfiguration -> ()
rnf LogTargetConfiguration' {Maybe LogLevel
Maybe LogTarget
logTarget :: Maybe LogTarget
logLevel :: Maybe LogLevel
$sel:logTarget:LogTargetConfiguration' :: LogTargetConfiguration -> Maybe LogTarget
$sel:logLevel:LogTargetConfiguration' :: LogTargetConfiguration -> Maybe LogLevel
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LogLevel
logLevel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LogTarget
logTarget