{-# 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.SecurityHub.Types.AwsLambdaFunctionTracingConfig
-- 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.SecurityHub.Types.AwsLambdaFunctionTracingConfig where

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

-- | The function\'s X-Ray tracing configuration.
--
-- /See:/ 'newAwsLambdaFunctionTracingConfig' smart constructor.
data AwsLambdaFunctionTracingConfig = AwsLambdaFunctionTracingConfig'
  { -- | The tracing mode.
    AwsLambdaFunctionTracingConfig -> Maybe Text
mode :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsLambdaFunctionTracingConfig
-> AwsLambdaFunctionTracingConfig -> Bool
(AwsLambdaFunctionTracingConfig
 -> AwsLambdaFunctionTracingConfig -> Bool)
-> (AwsLambdaFunctionTracingConfig
    -> AwsLambdaFunctionTracingConfig -> Bool)
-> Eq AwsLambdaFunctionTracingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsLambdaFunctionTracingConfig
-> AwsLambdaFunctionTracingConfig -> Bool
$c/= :: AwsLambdaFunctionTracingConfig
-> AwsLambdaFunctionTracingConfig -> Bool
== :: AwsLambdaFunctionTracingConfig
-> AwsLambdaFunctionTracingConfig -> Bool
$c== :: AwsLambdaFunctionTracingConfig
-> AwsLambdaFunctionTracingConfig -> Bool
Prelude.Eq, ReadPrec [AwsLambdaFunctionTracingConfig]
ReadPrec AwsLambdaFunctionTracingConfig
Int -> ReadS AwsLambdaFunctionTracingConfig
ReadS [AwsLambdaFunctionTracingConfig]
(Int -> ReadS AwsLambdaFunctionTracingConfig)
-> ReadS [AwsLambdaFunctionTracingConfig]
-> ReadPrec AwsLambdaFunctionTracingConfig
-> ReadPrec [AwsLambdaFunctionTracingConfig]
-> Read AwsLambdaFunctionTracingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsLambdaFunctionTracingConfig]
$creadListPrec :: ReadPrec [AwsLambdaFunctionTracingConfig]
readPrec :: ReadPrec AwsLambdaFunctionTracingConfig
$creadPrec :: ReadPrec AwsLambdaFunctionTracingConfig
readList :: ReadS [AwsLambdaFunctionTracingConfig]
$creadList :: ReadS [AwsLambdaFunctionTracingConfig]
readsPrec :: Int -> ReadS AwsLambdaFunctionTracingConfig
$creadsPrec :: Int -> ReadS AwsLambdaFunctionTracingConfig
Prelude.Read, Int -> AwsLambdaFunctionTracingConfig -> ShowS
[AwsLambdaFunctionTracingConfig] -> ShowS
AwsLambdaFunctionTracingConfig -> String
(Int -> AwsLambdaFunctionTracingConfig -> ShowS)
-> (AwsLambdaFunctionTracingConfig -> String)
-> ([AwsLambdaFunctionTracingConfig] -> ShowS)
-> Show AwsLambdaFunctionTracingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsLambdaFunctionTracingConfig] -> ShowS
$cshowList :: [AwsLambdaFunctionTracingConfig] -> ShowS
show :: AwsLambdaFunctionTracingConfig -> String
$cshow :: AwsLambdaFunctionTracingConfig -> String
showsPrec :: Int -> AwsLambdaFunctionTracingConfig -> ShowS
$cshowsPrec :: Int -> AwsLambdaFunctionTracingConfig -> ShowS
Prelude.Show, (forall x.
 AwsLambdaFunctionTracingConfig
 -> Rep AwsLambdaFunctionTracingConfig x)
-> (forall x.
    Rep AwsLambdaFunctionTracingConfig x
    -> AwsLambdaFunctionTracingConfig)
-> Generic AwsLambdaFunctionTracingConfig
forall x.
Rep AwsLambdaFunctionTracingConfig x
-> AwsLambdaFunctionTracingConfig
forall x.
AwsLambdaFunctionTracingConfig
-> Rep AwsLambdaFunctionTracingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsLambdaFunctionTracingConfig x
-> AwsLambdaFunctionTracingConfig
$cfrom :: forall x.
AwsLambdaFunctionTracingConfig
-> Rep AwsLambdaFunctionTracingConfig x
Prelude.Generic)

-- |
-- Create a value of 'AwsLambdaFunctionTracingConfig' 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:
--
-- 'mode', 'awsLambdaFunctionTracingConfig_mode' - The tracing mode.
newAwsLambdaFunctionTracingConfig ::
  AwsLambdaFunctionTracingConfig
newAwsLambdaFunctionTracingConfig :: AwsLambdaFunctionTracingConfig
newAwsLambdaFunctionTracingConfig =
  AwsLambdaFunctionTracingConfig' :: Maybe Text -> AwsLambdaFunctionTracingConfig
AwsLambdaFunctionTracingConfig'
    { $sel:mode:AwsLambdaFunctionTracingConfig' :: Maybe Text
mode =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The tracing mode.
awsLambdaFunctionTracingConfig_mode :: Lens.Lens' AwsLambdaFunctionTracingConfig (Prelude.Maybe Prelude.Text)
awsLambdaFunctionTracingConfig_mode :: (Maybe Text -> f (Maybe Text))
-> AwsLambdaFunctionTracingConfig
-> f AwsLambdaFunctionTracingConfig
awsLambdaFunctionTracingConfig_mode = (AwsLambdaFunctionTracingConfig -> Maybe Text)
-> (AwsLambdaFunctionTracingConfig
    -> Maybe Text -> AwsLambdaFunctionTracingConfig)
-> Lens
     AwsLambdaFunctionTracingConfig
     AwsLambdaFunctionTracingConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsLambdaFunctionTracingConfig' {Maybe Text
mode :: Maybe Text
$sel:mode:AwsLambdaFunctionTracingConfig' :: AwsLambdaFunctionTracingConfig -> Maybe Text
mode} -> Maybe Text
mode) (\s :: AwsLambdaFunctionTracingConfig
s@AwsLambdaFunctionTracingConfig' {} Maybe Text
a -> AwsLambdaFunctionTracingConfig
s {$sel:mode:AwsLambdaFunctionTracingConfig' :: Maybe Text
mode = Maybe Text
a} :: AwsLambdaFunctionTracingConfig)

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

instance
  Prelude.Hashable
    AwsLambdaFunctionTracingConfig

instance
  Prelude.NFData
    AwsLambdaFunctionTracingConfig

instance Core.ToJSON AwsLambdaFunctionTracingConfig where
  toJSON :: AwsLambdaFunctionTracingConfig -> Value
toJSON AwsLambdaFunctionTracingConfig' {Maybe Text
mode :: Maybe Text
$sel:mode:AwsLambdaFunctionTracingConfig' :: AwsLambdaFunctionTracingConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Mode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
mode]
      )