{-# 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.ServiceIntegrationConfig
-- 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.ServiceIntegrationConfig 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.LogsAnomalyDetectionIntegration
import Amazonka.DevOpsGuru.Types.OpsCenterIntegration
import qualified Amazonka.Prelude as Prelude

-- | Information about the integration of DevOps Guru with another Amazon Web
-- Services service, such as Amazon Web Services Systems Manager.
--
-- /See:/ 'newServiceIntegrationConfig' smart constructor.
data ServiceIntegrationConfig = ServiceIntegrationConfig'
  { -- | Information about whether DevOps Guru is configured to perform log
    -- anomaly detection on Amazon CloudWatch log groups.
    ServiceIntegrationConfig -> Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection :: Prelude.Maybe LogsAnomalyDetectionIntegration,
    -- | Information about whether DevOps Guru is configured to create an OpsItem
    -- in Amazon Web Services Systems Manager OpsCenter for each created
    -- insight.
    ServiceIntegrationConfig -> Maybe OpsCenterIntegration
opsCenter :: Prelude.Maybe OpsCenterIntegration
  }
  deriving (ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
$c/= :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
== :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
$c== :: ServiceIntegrationConfig -> ServiceIntegrationConfig -> Bool
Prelude.Eq, ReadPrec [ServiceIntegrationConfig]
ReadPrec ServiceIntegrationConfig
Int -> ReadS ServiceIntegrationConfig
ReadS [ServiceIntegrationConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceIntegrationConfig]
$creadListPrec :: ReadPrec [ServiceIntegrationConfig]
readPrec :: ReadPrec ServiceIntegrationConfig
$creadPrec :: ReadPrec ServiceIntegrationConfig
readList :: ReadS [ServiceIntegrationConfig]
$creadList :: ReadS [ServiceIntegrationConfig]
readsPrec :: Int -> ReadS ServiceIntegrationConfig
$creadsPrec :: Int -> ReadS ServiceIntegrationConfig
Prelude.Read, Int -> ServiceIntegrationConfig -> ShowS
[ServiceIntegrationConfig] -> ShowS
ServiceIntegrationConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceIntegrationConfig] -> ShowS
$cshowList :: [ServiceIntegrationConfig] -> ShowS
show :: ServiceIntegrationConfig -> String
$cshow :: ServiceIntegrationConfig -> String
showsPrec :: Int -> ServiceIntegrationConfig -> ShowS
$cshowsPrec :: Int -> ServiceIntegrationConfig -> ShowS
Prelude.Show, forall x.
Rep ServiceIntegrationConfig x -> ServiceIntegrationConfig
forall x.
ServiceIntegrationConfig -> Rep ServiceIntegrationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ServiceIntegrationConfig x -> ServiceIntegrationConfig
$cfrom :: forall x.
ServiceIntegrationConfig -> Rep ServiceIntegrationConfig x
Prelude.Generic)

-- |
-- Create a value of 'ServiceIntegrationConfig' 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:
--
-- 'logsAnomalyDetection', 'serviceIntegrationConfig_logsAnomalyDetection' - Information about whether DevOps Guru is configured to perform log
-- anomaly detection on Amazon CloudWatch log groups.
--
-- 'opsCenter', 'serviceIntegrationConfig_opsCenter' - Information about whether DevOps Guru is configured to create an OpsItem
-- in Amazon Web Services Systems Manager OpsCenter for each created
-- insight.
newServiceIntegrationConfig ::
  ServiceIntegrationConfig
newServiceIntegrationConfig :: ServiceIntegrationConfig
newServiceIntegrationConfig =
  ServiceIntegrationConfig'
    { $sel:logsAnomalyDetection:ServiceIntegrationConfig' :: Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection =
        forall a. Maybe a
Prelude.Nothing,
      $sel:opsCenter:ServiceIntegrationConfig' :: Maybe OpsCenterIntegration
opsCenter = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about whether DevOps Guru is configured to perform log
-- anomaly detection on Amazon CloudWatch log groups.
serviceIntegrationConfig_logsAnomalyDetection :: Lens.Lens' ServiceIntegrationConfig (Prelude.Maybe LogsAnomalyDetectionIntegration)
serviceIntegrationConfig_logsAnomalyDetection :: Lens'
  ServiceIntegrationConfig (Maybe LogsAnomalyDetectionIntegration)
serviceIntegrationConfig_logsAnomalyDetection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceIntegrationConfig' {Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection :: Maybe LogsAnomalyDetectionIntegration
$sel:logsAnomalyDetection:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection} -> Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection) (\s :: ServiceIntegrationConfig
s@ServiceIntegrationConfig' {} Maybe LogsAnomalyDetectionIntegration
a -> ServiceIntegrationConfig
s {$sel:logsAnomalyDetection:ServiceIntegrationConfig' :: Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection = Maybe LogsAnomalyDetectionIntegration
a} :: ServiceIntegrationConfig)

-- | Information about whether DevOps Guru is configured to create an OpsItem
-- in Amazon Web Services Systems Manager OpsCenter for each created
-- insight.
serviceIntegrationConfig_opsCenter :: Lens.Lens' ServiceIntegrationConfig (Prelude.Maybe OpsCenterIntegration)
serviceIntegrationConfig_opsCenter :: Lens' ServiceIntegrationConfig (Maybe OpsCenterIntegration)
serviceIntegrationConfig_opsCenter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceIntegrationConfig' {Maybe OpsCenterIntegration
opsCenter :: Maybe OpsCenterIntegration
$sel:opsCenter:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe OpsCenterIntegration
opsCenter} -> Maybe OpsCenterIntegration
opsCenter) (\s :: ServiceIntegrationConfig
s@ServiceIntegrationConfig' {} Maybe OpsCenterIntegration
a -> ServiceIntegrationConfig
s {$sel:opsCenter:ServiceIntegrationConfig' :: Maybe OpsCenterIntegration
opsCenter = Maybe OpsCenterIntegration
a} :: ServiceIntegrationConfig)

instance Data.FromJSON ServiceIntegrationConfig where
  parseJSON :: Value -> Parser ServiceIntegrationConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ServiceIntegrationConfig"
      ( \Object
x ->
          Maybe LogsAnomalyDetectionIntegration
-> Maybe OpsCenterIntegration -> ServiceIntegrationConfig
ServiceIntegrationConfig'
            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
"LogsAnomalyDetection")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"OpsCenter")
      )

instance Prelude.Hashable ServiceIntegrationConfig where
  hashWithSalt :: Int -> ServiceIntegrationConfig -> Int
hashWithSalt Int
_salt ServiceIntegrationConfig' {Maybe OpsCenterIntegration
Maybe LogsAnomalyDetectionIntegration
opsCenter :: Maybe OpsCenterIntegration
logsAnomalyDetection :: Maybe LogsAnomalyDetectionIntegration
$sel:opsCenter:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe OpsCenterIntegration
$sel:logsAnomalyDetection:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe LogsAnomalyDetectionIntegration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OpsCenterIntegration
opsCenter

instance Prelude.NFData ServiceIntegrationConfig where
  rnf :: ServiceIntegrationConfig -> ()
rnf ServiceIntegrationConfig' {Maybe OpsCenterIntegration
Maybe LogsAnomalyDetectionIntegration
opsCenter :: Maybe OpsCenterIntegration
logsAnomalyDetection :: Maybe LogsAnomalyDetectionIntegration
$sel:opsCenter:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe OpsCenterIntegration
$sel:logsAnomalyDetection:ServiceIntegrationConfig' :: ServiceIntegrationConfig -> Maybe LogsAnomalyDetectionIntegration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LogsAnomalyDetectionIntegration
logsAnomalyDetection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OpsCenterIntegration
opsCenter