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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool)
-> (AgentOrchestrationConfig -> AgentOrchestrationConfig -> Bool)
-> Eq AgentOrchestrationConfig
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]
(Int -> ReadS AgentOrchestrationConfig)
-> ReadS [AgentOrchestrationConfig]
-> ReadPrec AgentOrchestrationConfig
-> ReadPrec [AgentOrchestrationConfig]
-> Read 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
(Int -> AgentOrchestrationConfig -> ShowS)
-> (AgentOrchestrationConfig -> String)
-> ([AgentOrchestrationConfig] -> ShowS)
-> Show AgentOrchestrationConfig
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.
 AgentOrchestrationConfig -> Rep AgentOrchestrationConfig x)
-> (forall x.
    Rep AgentOrchestrationConfig x -> AgentOrchestrationConfig)
-> Generic AgentOrchestrationConfig
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' :: Bool -> AgentOrchestrationConfig
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 :: (Bool -> f Bool)
-> AgentOrchestrationConfig -> f AgentOrchestrationConfig
agentOrchestrationConfig_profilingEnabled = (AgentOrchestrationConfig -> Bool)
-> (AgentOrchestrationConfig -> Bool -> AgentOrchestrationConfig)
-> Lens AgentOrchestrationConfig AgentOrchestrationConfig Bool Bool
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 Core.FromJSON AgentOrchestrationConfig where
  parseJSON :: Value -> Parser AgentOrchestrationConfig
parseJSON =
    String
-> (Object -> Parser AgentOrchestrationConfig)
-> Value
-> Parser AgentOrchestrationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AgentOrchestrationConfig"
      ( \Object
x ->
          Bool -> AgentOrchestrationConfig
AgentOrchestrationConfig'
            (Bool -> AgentOrchestrationConfig)
-> Parser Bool -> Parser AgentOrchestrationConfig
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
"profilingEnabled")
      )

instance Prelude.Hashable AgentOrchestrationConfig

instance Prelude.NFData AgentOrchestrationConfig

instance Core.ToJSON AgentOrchestrationConfig where
  toJSON :: AgentOrchestrationConfig -> Value
toJSON AgentOrchestrationConfig' {Bool
profilingEnabled :: Bool
$sel:profilingEnabled:AgentOrchestrationConfig' :: AgentOrchestrationConfig -> 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
"profilingEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
profilingEnabled)
          ]
      )