{-# 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.AppRunner.Types.TraceConfiguration
-- 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.AppRunner.Types.TraceConfiguration where

import Amazonka.AppRunner.Types.TracingVendor
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Describes the configuration of the tracing feature within an App Runner
-- observability configuration.
--
-- /See:/ 'newTraceConfiguration' smart constructor.
data TraceConfiguration = TraceConfiguration'
  { -- | The implementation provider chosen for tracing App Runner services.
    TraceConfiguration -> TracingVendor
vendor :: TracingVendor
  }
  deriving (TraceConfiguration -> TraceConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TraceConfiguration -> TraceConfiguration -> Bool
$c/= :: TraceConfiguration -> TraceConfiguration -> Bool
== :: TraceConfiguration -> TraceConfiguration -> Bool
$c== :: TraceConfiguration -> TraceConfiguration -> Bool
Prelude.Eq, ReadPrec [TraceConfiguration]
ReadPrec TraceConfiguration
Int -> ReadS TraceConfiguration
ReadS [TraceConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TraceConfiguration]
$creadListPrec :: ReadPrec [TraceConfiguration]
readPrec :: ReadPrec TraceConfiguration
$creadPrec :: ReadPrec TraceConfiguration
readList :: ReadS [TraceConfiguration]
$creadList :: ReadS [TraceConfiguration]
readsPrec :: Int -> ReadS TraceConfiguration
$creadsPrec :: Int -> ReadS TraceConfiguration
Prelude.Read, Int -> TraceConfiguration -> ShowS
[TraceConfiguration] -> ShowS
TraceConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TraceConfiguration] -> ShowS
$cshowList :: [TraceConfiguration] -> ShowS
show :: TraceConfiguration -> String
$cshow :: TraceConfiguration -> String
showsPrec :: Int -> TraceConfiguration -> ShowS
$cshowsPrec :: Int -> TraceConfiguration -> ShowS
Prelude.Show, forall x. Rep TraceConfiguration x -> TraceConfiguration
forall x. TraceConfiguration -> Rep TraceConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TraceConfiguration x -> TraceConfiguration
$cfrom :: forall x. TraceConfiguration -> Rep TraceConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TraceConfiguration' 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:
--
-- 'vendor', 'traceConfiguration_vendor' - The implementation provider chosen for tracing App Runner services.
newTraceConfiguration ::
  -- | 'vendor'
  TracingVendor ->
  TraceConfiguration
newTraceConfiguration :: TracingVendor -> TraceConfiguration
newTraceConfiguration TracingVendor
pVendor_ =
  TraceConfiguration' {$sel:vendor:TraceConfiguration' :: TracingVendor
vendor = TracingVendor
pVendor_}

-- | The implementation provider chosen for tracing App Runner services.
traceConfiguration_vendor :: Lens.Lens' TraceConfiguration TracingVendor
traceConfiguration_vendor :: Lens' TraceConfiguration TracingVendor
traceConfiguration_vendor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TraceConfiguration' {TracingVendor
vendor :: TracingVendor
$sel:vendor:TraceConfiguration' :: TraceConfiguration -> TracingVendor
vendor} -> TracingVendor
vendor) (\s :: TraceConfiguration
s@TraceConfiguration' {} TracingVendor
a -> TraceConfiguration
s {$sel:vendor:TraceConfiguration' :: TracingVendor
vendor = TracingVendor
a} :: TraceConfiguration)

instance Data.FromJSON TraceConfiguration where
  parseJSON :: Value -> Parser TraceConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TraceConfiguration"
      ( \Object
x ->
          TracingVendor -> TraceConfiguration
TraceConfiguration' 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
"Vendor")
      )

instance Prelude.Hashable TraceConfiguration where
  hashWithSalt :: Int -> TraceConfiguration -> Int
hashWithSalt Int
_salt TraceConfiguration' {TracingVendor
vendor :: TracingVendor
$sel:vendor:TraceConfiguration' :: TraceConfiguration -> TracingVendor
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TracingVendor
vendor

instance Prelude.NFData TraceConfiguration where
  rnf :: TraceConfiguration -> ()
rnf TraceConfiguration' {TracingVendor
vendor :: TracingVendor
$sel:vendor:TraceConfiguration' :: TraceConfiguration -> TracingVendor
..} = forall a. NFData a => a -> ()
Prelude.rnf TracingVendor
vendor

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