{-# 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.CodeGuruProfiler.Types.AgentOrchestrationConfig
-- 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.CodeGuruProfiler.Types.AgentOrchestrationConfig where

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

-- | Specifies whether profiling is enabled or disabled for a profiling
-- group. It is used by
-- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_ConfigureAgent.html ConfigureAgent>
-- to enable or disable profiling for a profiling group.
--
-- /See:/ 'newAgentOrchestrationConfig' smart constructor.
data AgentOrchestrationConfig = AgentOrchestrationConfig'
  { -- | A @Boolean@ that specifies whether the profiling agent collects
    -- profiling data or not. Set to @true@ to enable profiling.
    AgentOrchestrationConfig -> Bool
profilingEnabled :: Prelude.Bool
  }
  deriving (AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool
$c/= :: AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool
== :: AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool
$c== :: AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool
Prelude.Eq, ReadPrec [AgentOrchestrationConfig]
ReadPrec AgentOrchestrationConfig
Int -> ReadS AgentOrchestrationConfig
ReadS [AgentOrchestrationConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AgentOrchestrationConfig]
$creadListPrec :: ReadPrec [AgentOrchestrationConfig]
readPrec :: ReadPrec AgentOrchestrationConfig
$creadPrec :: ReadPrec AgentOrchestrationConfig
readList :: ReadS [AgentOrchestrationConfig]
$creadList :: ReadS [AgentOrchestrationConfig]
readsPrec :: Int -> ReadS AgentOrchestrationConfig
$creadsPrec :: Int -> ReadS AgentOrchestrationConfig
Prelude.Read, Int -> AgentOrchestrationConfig -> ShowS
[AgentOrchestrationConfig] -> ShowS
AgentOrchestrationConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AgentOrchestrationConfig] -> ShowS
$cshowList :: [AgentOrchestrationConfig] -> ShowS
show :: AgentOrchestrationConfig -> String
$cshow :: AgentOrchestrationConfig -> String
showsPrec :: Int -> AgentOrchestrationConfig -> ShowS
$cshowsPrec :: Int -> AgentOrchestrationConfig -> ShowS
Prelude.Show, forall x.
Rep AgentOrchestrationConfig x -> AgentOrchestrationConfig
forall x.
AgentOrchestrationConfig -> Rep AgentOrchestrationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AgentOrchestrationConfig x -> AgentOrchestrationConfig
$cfrom :: forall x.
AgentOrchestrationConfig -> Rep AgentOrchestrationConfig x
Prelude.Generic)

-- |
-- Create a value of 'AgentOrchestrationConfig' 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:
--
-- 'profilingEnabled', 'agentOrchestrationConfig_profilingEnabled' - A @Boolean@ that specifies whether the profiling agent collects
-- profiling data or not. Set to @true@ to enable profiling.
newAgentOrchestrationConfig ::
  -- | 'profilingEnabled'
  Prelude.Bool ->
  AgentOrchestrationConfig
newAgentOrchestrationConfig :: Bool -> AgentOrchestrationConfig
newAgentOrchestrationConfig Bool
pProfilingEnabled_ =
  AgentOrchestrationConfig'
    { $sel:profilingEnabled:AgentOrchestrationConfig' :: Bool
profilingEnabled =
        Bool
pProfilingEnabled_
    }

-- | A @Boolean@ that specifies whether the profiling agent collects
-- profiling data or not. Set to @true@ to enable profiling.
agentOrchestrationConfig_profilingEnabled :: Lens.Lens' AgentOrchestrationConfig Prelude.Bool
agentOrchestrationConfig_profilingEnabled :: Lens' AgentOrchestrationConfig Bool
agentOrchestrationConfig_profilingEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentOrchestrationConfig' {Bool
profilingEnabled :: Bool
$sel:profilingEnabled:AgentOrchestrationConfig' :: AgentOrchestrationConfig -> Bool
profilingEnabled} -> Bool
profilingEnabled) (\s :: AgentOrchestrationConfig
s@AgentOrchestrationConfig' {} Bool
a -> AgentOrchestrationConfig
s {$sel:profilingEnabled:AgentOrchestrationConfig' :: Bool
profilingEnabled = Bool
a} :: AgentOrchestrationConfig)

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

instance Prelude.Hashable AgentOrchestrationConfig where
  hashWithSalt :: Int -> AgentOrchestrationConfig -> Int
hashWithSalt Int
_salt AgentOrchestrationConfig' {Bool
profilingEnabled :: Bool
$sel:profilingEnabled:AgentOrchestrationConfig' :: AgentOrchestrationConfig -> Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
profilingEnabled

instance Prelude.NFData AgentOrchestrationConfig where
  rnf :: AgentOrchestrationConfig -> ()
rnf AgentOrchestrationConfig' {Bool
profilingEnabled :: Bool
$sel:profilingEnabled:AgentOrchestrationConfig' :: AgentOrchestrationConfig -> Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Bool
profilingEnabled

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