{-# 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.RobOMaker.Types.LoggingConfig
-- 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.RobOMaker.Types.LoggingConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The logging configuration.
--
-- /See:/ 'newLoggingConfig' smart constructor.
data LoggingConfig = LoggingConfig'
  { -- | A boolean indicating whether to record all ROS topics.
    LoggingConfig -> Bool
recordAllRosTopics :: Prelude.Bool
  }
  deriving (LoggingConfig -> LoggingConfig -> Bool
(LoggingConfig -> LoggingConfig -> Bool)
-> (LoggingConfig -> LoggingConfig -> Bool) -> Eq LoggingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingConfig -> LoggingConfig -> Bool
$c/= :: LoggingConfig -> LoggingConfig -> Bool
== :: LoggingConfig -> LoggingConfig -> Bool
$c== :: LoggingConfig -> LoggingConfig -> Bool
Prelude.Eq, ReadPrec [LoggingConfig]
ReadPrec LoggingConfig
Int -> ReadS LoggingConfig
ReadS [LoggingConfig]
(Int -> ReadS LoggingConfig)
-> ReadS [LoggingConfig]
-> ReadPrec LoggingConfig
-> ReadPrec [LoggingConfig]
-> Read LoggingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingConfig]
$creadListPrec :: ReadPrec [LoggingConfig]
readPrec :: ReadPrec LoggingConfig
$creadPrec :: ReadPrec LoggingConfig
readList :: ReadS [LoggingConfig]
$creadList :: ReadS [LoggingConfig]
readsPrec :: Int -> ReadS LoggingConfig
$creadsPrec :: Int -> ReadS LoggingConfig
Prelude.Read, Int -> LoggingConfig -> ShowS
[LoggingConfig] -> ShowS
LoggingConfig -> String
(Int -> LoggingConfig -> ShowS)
-> (LoggingConfig -> String)
-> ([LoggingConfig] -> ShowS)
-> Show LoggingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingConfig] -> ShowS
$cshowList :: [LoggingConfig] -> ShowS
show :: LoggingConfig -> String
$cshow :: LoggingConfig -> String
showsPrec :: Int -> LoggingConfig -> ShowS
$cshowsPrec :: Int -> LoggingConfig -> ShowS
Prelude.Show, (forall x. LoggingConfig -> Rep LoggingConfig x)
-> (forall x. Rep LoggingConfig x -> LoggingConfig)
-> Generic LoggingConfig
forall x. Rep LoggingConfig x -> LoggingConfig
forall x. LoggingConfig -> Rep LoggingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingConfig x -> LoggingConfig
$cfrom :: forall x. LoggingConfig -> Rep LoggingConfig x
Prelude.Generic)

-- |
-- Create a value of 'LoggingConfig' 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:
--
-- 'recordAllRosTopics', 'loggingConfig_recordAllRosTopics' - A boolean indicating whether to record all ROS topics.
newLoggingConfig ::
  -- | 'recordAllRosTopics'
  Prelude.Bool ->
  LoggingConfig
newLoggingConfig :: Bool -> LoggingConfig
newLoggingConfig Bool
pRecordAllRosTopics_ =
  LoggingConfig' :: Bool -> LoggingConfig
LoggingConfig'
    { $sel:recordAllRosTopics:LoggingConfig' :: Bool
recordAllRosTopics =
        Bool
pRecordAllRosTopics_
    }

-- | A boolean indicating whether to record all ROS topics.
loggingConfig_recordAllRosTopics :: Lens.Lens' LoggingConfig Prelude.Bool
loggingConfig_recordAllRosTopics :: (Bool -> f Bool) -> LoggingConfig -> f LoggingConfig
loggingConfig_recordAllRosTopics = (LoggingConfig -> Bool)
-> (LoggingConfig -> Bool -> LoggingConfig)
-> Lens LoggingConfig LoggingConfig Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingConfig' {Bool
recordAllRosTopics :: Bool
$sel:recordAllRosTopics:LoggingConfig' :: LoggingConfig -> Bool
recordAllRosTopics} -> Bool
recordAllRosTopics) (\s :: LoggingConfig
s@LoggingConfig' {} Bool
a -> LoggingConfig
s {$sel:recordAllRosTopics:LoggingConfig' :: Bool
recordAllRosTopics = Bool
a} :: LoggingConfig)

instance Core.FromJSON LoggingConfig where
  parseJSON :: Value -> Parser LoggingConfig
parseJSON =
    String
-> (Object -> Parser LoggingConfig)
-> Value
-> Parser LoggingConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoggingConfig"
      ( \Object
x ->
          Bool -> LoggingConfig
LoggingConfig'
            (Bool -> LoggingConfig) -> Parser Bool -> Parser LoggingConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"recordAllRosTopics")
      )

instance Prelude.Hashable LoggingConfig

instance Prelude.NFData LoggingConfig

instance Core.ToJSON LoggingConfig where
  toJSON :: LoggingConfig -> Value
toJSON LoggingConfig' {Bool
recordAllRosTopics :: Bool
$sel:recordAllRosTopics:LoggingConfig' :: LoggingConfig -> Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"recordAllRosTopics" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
recordAllRosTopics)
          ]
      )