{-# 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.DevOpsGuru.Types.EventSourcesConfig
-- 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.DevOpsGuru.Types.EventSourcesConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types.AmazonCodeGuruProfilerIntegration
import qualified Amazonka.Prelude as Prelude

-- | Information about the integration of DevOps Guru as consumer with
-- another AWS service, such as AWS CodeGuru Profiler via EventBridge.
--
-- /See:/ 'newEventSourcesConfig' smart constructor.
data EventSourcesConfig = EventSourcesConfig'
  { -- | Information about whether DevOps Guru is configured to consume
    -- recommendations which are generated from AWS CodeGuru Profiler.
    EventSourcesConfig -> Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler :: Prelude.Maybe AmazonCodeGuruProfilerIntegration
  }
  deriving (EventSourcesConfig -> EventSourcesConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventSourcesConfig -> EventSourcesConfig -> Bool
$c/= :: EventSourcesConfig -> EventSourcesConfig -> Bool
== :: EventSourcesConfig -> EventSourcesConfig -> Bool
$c== :: EventSourcesConfig -> EventSourcesConfig -> Bool
Prelude.Eq, ReadPrec [EventSourcesConfig]
ReadPrec EventSourcesConfig
Int -> ReadS EventSourcesConfig
ReadS [EventSourcesConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventSourcesConfig]
$creadListPrec :: ReadPrec [EventSourcesConfig]
readPrec :: ReadPrec EventSourcesConfig
$creadPrec :: ReadPrec EventSourcesConfig
readList :: ReadS [EventSourcesConfig]
$creadList :: ReadS [EventSourcesConfig]
readsPrec :: Int -> ReadS EventSourcesConfig
$creadsPrec :: Int -> ReadS EventSourcesConfig
Prelude.Read, Int -> EventSourcesConfig -> ShowS
[EventSourcesConfig] -> ShowS
EventSourcesConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventSourcesConfig] -> ShowS
$cshowList :: [EventSourcesConfig] -> ShowS
show :: EventSourcesConfig -> String
$cshow :: EventSourcesConfig -> String
showsPrec :: Int -> EventSourcesConfig -> ShowS
$cshowsPrec :: Int -> EventSourcesConfig -> ShowS
Prelude.Show, forall x. Rep EventSourcesConfig x -> EventSourcesConfig
forall x. EventSourcesConfig -> Rep EventSourcesConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventSourcesConfig x -> EventSourcesConfig
$cfrom :: forall x. EventSourcesConfig -> Rep EventSourcesConfig x
Prelude.Generic)

-- |
-- Create a value of 'EventSourcesConfig' 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:
--
-- 'amazonCodeGuruProfiler', 'eventSourcesConfig_amazonCodeGuruProfiler' - Information about whether DevOps Guru is configured to consume
-- recommendations which are generated from AWS CodeGuru Profiler.
newEventSourcesConfig ::
  EventSourcesConfig
newEventSourcesConfig :: EventSourcesConfig
newEventSourcesConfig =
  EventSourcesConfig'
    { $sel:amazonCodeGuruProfiler:EventSourcesConfig' :: Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Information about whether DevOps Guru is configured to consume
-- recommendations which are generated from AWS CodeGuru Profiler.
eventSourcesConfig_amazonCodeGuruProfiler :: Lens.Lens' EventSourcesConfig (Prelude.Maybe AmazonCodeGuruProfilerIntegration)
eventSourcesConfig_amazonCodeGuruProfiler :: Lens' EventSourcesConfig (Maybe AmazonCodeGuruProfilerIntegration)
eventSourcesConfig_amazonCodeGuruProfiler = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventSourcesConfig' {Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler :: Maybe AmazonCodeGuruProfilerIntegration
$sel:amazonCodeGuruProfiler:EventSourcesConfig' :: EventSourcesConfig -> Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler} -> Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler) (\s :: EventSourcesConfig
s@EventSourcesConfig' {} Maybe AmazonCodeGuruProfilerIntegration
a -> EventSourcesConfig
s {$sel:amazonCodeGuruProfiler:EventSourcesConfig' :: Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler = Maybe AmazonCodeGuruProfilerIntegration
a} :: EventSourcesConfig)

instance Data.FromJSON EventSourcesConfig where
  parseJSON :: Value -> Parser EventSourcesConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventSourcesConfig"
      ( \Object
x ->
          Maybe AmazonCodeGuruProfilerIntegration -> EventSourcesConfig
EventSourcesConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AmazonCodeGuruProfiler")
      )

instance Prelude.Hashable EventSourcesConfig where
  hashWithSalt :: Int -> EventSourcesConfig -> Int
hashWithSalt Int
_salt EventSourcesConfig' {Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler :: Maybe AmazonCodeGuruProfilerIntegration
$sel:amazonCodeGuruProfiler:EventSourcesConfig' :: EventSourcesConfig -> Maybe AmazonCodeGuruProfilerIntegration
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler

instance Prelude.NFData EventSourcesConfig where
  rnf :: EventSourcesConfig -> ()
rnf EventSourcesConfig' {Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler :: Maybe AmazonCodeGuruProfilerIntegration
$sel:amazonCodeGuruProfiler:EventSourcesConfig' :: EventSourcesConfig -> Maybe AmazonCodeGuruProfilerIntegration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler

instance Data.ToJSON EventSourcesConfig where
  toJSON :: EventSourcesConfig -> Value
toJSON EventSourcesConfig' {Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler :: Maybe AmazonCodeGuruProfilerIntegration
$sel:amazonCodeGuruProfiler:EventSourcesConfig' :: EventSourcesConfig -> Maybe AmazonCodeGuruProfilerIntegration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AmazonCodeGuruProfiler" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AmazonCodeGuruProfilerIntegration
amazonCodeGuruProfiler
          ]
      )