{-# 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 #-}
module Amazonka.CodeGuruProfiler.Types.AgentConfiguration where
import Amazonka.CodeGuruProfiler.Types.AgentParameterField
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AgentConfiguration = AgentConfiguration'
{
AgentConfiguration -> Maybe (HashMap AgentParameterField Text)
agentParameters :: Prelude.Maybe (Prelude.HashMap AgentParameterField Prelude.Text),
AgentConfiguration -> Int
periodInSeconds :: Prelude.Int,
AgentConfiguration -> Bool
shouldProfile :: Prelude.Bool
}
deriving (AgentConfiguration -> AgentConfiguration -> Bool
(AgentConfiguration -> AgentConfiguration -> Bool)
-> (AgentConfiguration -> AgentConfiguration -> Bool)
-> Eq AgentConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AgentConfiguration -> AgentConfiguration -> Bool
$c/= :: AgentConfiguration -> AgentConfiguration -> Bool
== :: AgentConfiguration -> AgentConfiguration -> Bool
$c== :: AgentConfiguration -> AgentConfiguration -> Bool
Prelude.Eq, ReadPrec [AgentConfiguration]
ReadPrec AgentConfiguration
Int -> ReadS AgentConfiguration
ReadS [AgentConfiguration]
(Int -> ReadS AgentConfiguration)
-> ReadS [AgentConfiguration]
-> ReadPrec AgentConfiguration
-> ReadPrec [AgentConfiguration]
-> Read AgentConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AgentConfiguration]
$creadListPrec :: ReadPrec [AgentConfiguration]
readPrec :: ReadPrec AgentConfiguration
$creadPrec :: ReadPrec AgentConfiguration
readList :: ReadS [AgentConfiguration]
$creadList :: ReadS [AgentConfiguration]
readsPrec :: Int -> ReadS AgentConfiguration
$creadsPrec :: Int -> ReadS AgentConfiguration
Prelude.Read, Int -> AgentConfiguration -> ShowS
[AgentConfiguration] -> ShowS
AgentConfiguration -> String
(Int -> AgentConfiguration -> ShowS)
-> (AgentConfiguration -> String)
-> ([AgentConfiguration] -> ShowS)
-> Show AgentConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AgentConfiguration] -> ShowS
$cshowList :: [AgentConfiguration] -> ShowS
show :: AgentConfiguration -> String
$cshow :: AgentConfiguration -> String
showsPrec :: Int -> AgentConfiguration -> ShowS
$cshowsPrec :: Int -> AgentConfiguration -> ShowS
Prelude.Show, (forall x. AgentConfiguration -> Rep AgentConfiguration x)
-> (forall x. Rep AgentConfiguration x -> AgentConfiguration)
-> Generic AgentConfiguration
forall x. Rep AgentConfiguration x -> AgentConfiguration
forall x. AgentConfiguration -> Rep AgentConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AgentConfiguration x -> AgentConfiguration
$cfrom :: forall x. AgentConfiguration -> Rep AgentConfiguration x
Prelude.Generic)
newAgentConfiguration ::
Prelude.Int ->
Prelude.Bool ->
AgentConfiguration
newAgentConfiguration :: Int -> Bool -> AgentConfiguration
newAgentConfiguration
Int
pPeriodInSeconds_
Bool
pShouldProfile_ =
AgentConfiguration' :: Maybe (HashMap AgentParameterField Text)
-> Int -> Bool -> AgentConfiguration
AgentConfiguration'
{ $sel:agentParameters:AgentConfiguration' :: Maybe (HashMap AgentParameterField Text)
agentParameters =
Maybe (HashMap AgentParameterField Text)
forall a. Maybe a
Prelude.Nothing,
$sel:periodInSeconds:AgentConfiguration' :: Int
periodInSeconds = Int
pPeriodInSeconds_,
$sel:shouldProfile:AgentConfiguration' :: Bool
shouldProfile = Bool
pShouldProfile_
}
agentConfiguration_agentParameters :: Lens.Lens' AgentConfiguration (Prelude.Maybe (Prelude.HashMap AgentParameterField Prelude.Text))
agentConfiguration_agentParameters :: (Maybe (HashMap AgentParameterField Text)
-> f (Maybe (HashMap AgentParameterField Text)))
-> AgentConfiguration -> f AgentConfiguration
agentConfiguration_agentParameters = (AgentConfiguration -> Maybe (HashMap AgentParameterField Text))
-> (AgentConfiguration
-> Maybe (HashMap AgentParameterField Text) -> AgentConfiguration)
-> Lens
AgentConfiguration
AgentConfiguration
(Maybe (HashMap AgentParameterField Text))
(Maybe (HashMap AgentParameterField Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentConfiguration' {Maybe (HashMap AgentParameterField Text)
agentParameters :: Maybe (HashMap AgentParameterField Text)
$sel:agentParameters:AgentConfiguration' :: AgentConfiguration -> Maybe (HashMap AgentParameterField Text)
agentParameters} -> Maybe (HashMap AgentParameterField Text)
agentParameters) (\s :: AgentConfiguration
s@AgentConfiguration' {} Maybe (HashMap AgentParameterField Text)
a -> AgentConfiguration
s {$sel:agentParameters:AgentConfiguration' :: Maybe (HashMap AgentParameterField Text)
agentParameters = Maybe (HashMap AgentParameterField Text)
a} :: AgentConfiguration) ((Maybe (HashMap AgentParameterField Text)
-> f (Maybe (HashMap AgentParameterField Text)))
-> AgentConfiguration -> f AgentConfiguration)
-> ((Maybe (HashMap AgentParameterField Text)
-> f (Maybe (HashMap AgentParameterField Text)))
-> Maybe (HashMap AgentParameterField Text)
-> f (Maybe (HashMap AgentParameterField Text)))
-> (Maybe (HashMap AgentParameterField Text)
-> f (Maybe (HashMap AgentParameterField Text)))
-> AgentConfiguration
-> f AgentConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap AgentParameterField Text)
(HashMap AgentParameterField Text)
(HashMap AgentParameterField Text)
(HashMap AgentParameterField Text)
-> Iso
(Maybe (HashMap AgentParameterField Text))
(Maybe (HashMap AgentParameterField Text))
(Maybe (HashMap AgentParameterField Text))
(Maybe (HashMap AgentParameterField Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap AgentParameterField Text)
(HashMap AgentParameterField Text)
(HashMap AgentParameterField Text)
(HashMap AgentParameterField Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
agentConfiguration_periodInSeconds :: Lens.Lens' AgentConfiguration Prelude.Int
agentConfiguration_periodInSeconds :: (Int -> f Int) -> AgentConfiguration -> f AgentConfiguration
agentConfiguration_periodInSeconds = (AgentConfiguration -> Int)
-> (AgentConfiguration -> Int -> AgentConfiguration)
-> Lens AgentConfiguration AgentConfiguration Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentConfiguration' {Int
periodInSeconds :: Int
$sel:periodInSeconds:AgentConfiguration' :: AgentConfiguration -> Int
periodInSeconds} -> Int
periodInSeconds) (\s :: AgentConfiguration
s@AgentConfiguration' {} Int
a -> AgentConfiguration
s {$sel:periodInSeconds:AgentConfiguration' :: Int
periodInSeconds = Int
a} :: AgentConfiguration)
agentConfiguration_shouldProfile :: Lens.Lens' AgentConfiguration Prelude.Bool
agentConfiguration_shouldProfile :: (Bool -> f Bool) -> AgentConfiguration -> f AgentConfiguration
agentConfiguration_shouldProfile = (AgentConfiguration -> Bool)
-> (AgentConfiguration -> Bool -> AgentConfiguration)
-> Lens AgentConfiguration AgentConfiguration Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AgentConfiguration' {Bool
shouldProfile :: Bool
$sel:shouldProfile:AgentConfiguration' :: AgentConfiguration -> Bool
shouldProfile} -> Bool
shouldProfile) (\s :: AgentConfiguration
s@AgentConfiguration' {} Bool
a -> AgentConfiguration
s {$sel:shouldProfile:AgentConfiguration' :: Bool
shouldProfile = Bool
a} :: AgentConfiguration)
instance Core.FromJSON AgentConfiguration where
parseJSON :: Value -> Parser AgentConfiguration
parseJSON =
String
-> (Object -> Parser AgentConfiguration)
-> Value
-> Parser AgentConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AgentConfiguration"
( \Object
x ->
Maybe (HashMap AgentParameterField Text)
-> Int -> Bool -> AgentConfiguration
AgentConfiguration'
(Maybe (HashMap AgentParameterField Text)
-> Int -> Bool -> AgentConfiguration)
-> Parser (Maybe (HashMap AgentParameterField Text))
-> Parser (Int -> Bool -> AgentConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap AgentParameterField Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"agentParameters"
Parser (Maybe (Maybe (HashMap AgentParameterField Text)))
-> Maybe (HashMap AgentParameterField Text)
-> Parser (Maybe (HashMap AgentParameterField Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap AgentParameterField Text)
forall a. Monoid a => a
Prelude.mempty
)
Parser (Int -> Bool -> AgentConfiguration)
-> Parser Int -> Parser (Bool -> AgentConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"periodInSeconds")
Parser (Bool -> AgentConfiguration)
-> Parser Bool -> Parser AgentConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"shouldProfile")
)
instance Prelude.Hashable AgentConfiguration
instance Prelude.NFData AgentConfiguration