{-# 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.LogsAnomalyDetectionIntegrationConfig
-- 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.LogsAnomalyDetectionIntegrationConfig 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.OptInStatus
import qualified Amazonka.Prelude as Prelude

-- | Information about the integration of DevOps Guru with CloudWatch log
-- groups for log anomaly detection. You can use this to update the
-- configuration.
--
-- /See:/ 'newLogsAnomalyDetectionIntegrationConfig' smart constructor.
data LogsAnomalyDetectionIntegrationConfig = LogsAnomalyDetectionIntegrationConfig'
  { -- | Specifies if DevOps Guru is configured to perform log anomaly detection
    -- on CloudWatch log groups.
    LogsAnomalyDetectionIntegrationConfig -> Maybe OptInStatus
optInStatus :: Prelude.Maybe OptInStatus
  }
  deriving (LogsAnomalyDetectionIntegrationConfig
-> LogsAnomalyDetectionIntegrationConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogsAnomalyDetectionIntegrationConfig
-> LogsAnomalyDetectionIntegrationConfig -> Bool
$c/= :: LogsAnomalyDetectionIntegrationConfig
-> LogsAnomalyDetectionIntegrationConfig -> Bool
== :: LogsAnomalyDetectionIntegrationConfig
-> LogsAnomalyDetectionIntegrationConfig -> Bool
$c== :: LogsAnomalyDetectionIntegrationConfig
-> LogsAnomalyDetectionIntegrationConfig -> Bool
Prelude.Eq, ReadPrec [LogsAnomalyDetectionIntegrationConfig]
ReadPrec LogsAnomalyDetectionIntegrationConfig
Int -> ReadS LogsAnomalyDetectionIntegrationConfig
ReadS [LogsAnomalyDetectionIntegrationConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogsAnomalyDetectionIntegrationConfig]
$creadListPrec :: ReadPrec [LogsAnomalyDetectionIntegrationConfig]
readPrec :: ReadPrec LogsAnomalyDetectionIntegrationConfig
$creadPrec :: ReadPrec LogsAnomalyDetectionIntegrationConfig
readList :: ReadS [LogsAnomalyDetectionIntegrationConfig]
$creadList :: ReadS [LogsAnomalyDetectionIntegrationConfig]
readsPrec :: Int -> ReadS LogsAnomalyDetectionIntegrationConfig
$creadsPrec :: Int -> ReadS LogsAnomalyDetectionIntegrationConfig
Prelude.Read, Int -> LogsAnomalyDetectionIntegrationConfig -> ShowS
[LogsAnomalyDetectionIntegrationConfig] -> ShowS
LogsAnomalyDetectionIntegrationConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogsAnomalyDetectionIntegrationConfig] -> ShowS
$cshowList :: [LogsAnomalyDetectionIntegrationConfig] -> ShowS
show :: LogsAnomalyDetectionIntegrationConfig -> String
$cshow :: LogsAnomalyDetectionIntegrationConfig -> String
showsPrec :: Int -> LogsAnomalyDetectionIntegrationConfig -> ShowS
$cshowsPrec :: Int -> LogsAnomalyDetectionIntegrationConfig -> ShowS
Prelude.Show, forall x.
Rep LogsAnomalyDetectionIntegrationConfig x
-> LogsAnomalyDetectionIntegrationConfig
forall x.
LogsAnomalyDetectionIntegrationConfig
-> Rep LogsAnomalyDetectionIntegrationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LogsAnomalyDetectionIntegrationConfig x
-> LogsAnomalyDetectionIntegrationConfig
$cfrom :: forall x.
LogsAnomalyDetectionIntegrationConfig
-> Rep LogsAnomalyDetectionIntegrationConfig x
Prelude.Generic)

-- |
-- Create a value of 'LogsAnomalyDetectionIntegrationConfig' 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:
--
-- 'optInStatus', 'logsAnomalyDetectionIntegrationConfig_optInStatus' - Specifies if DevOps Guru is configured to perform log anomaly detection
-- on CloudWatch log groups.
newLogsAnomalyDetectionIntegrationConfig ::
  LogsAnomalyDetectionIntegrationConfig
newLogsAnomalyDetectionIntegrationConfig :: LogsAnomalyDetectionIntegrationConfig
newLogsAnomalyDetectionIntegrationConfig =
  LogsAnomalyDetectionIntegrationConfig'
    { $sel:optInStatus:LogsAnomalyDetectionIntegrationConfig' :: Maybe OptInStatus
optInStatus =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies if DevOps Guru is configured to perform log anomaly detection
-- on CloudWatch log groups.
logsAnomalyDetectionIntegrationConfig_optInStatus :: Lens.Lens' LogsAnomalyDetectionIntegrationConfig (Prelude.Maybe OptInStatus)
logsAnomalyDetectionIntegrationConfig_optInStatus :: Lens' LogsAnomalyDetectionIntegrationConfig (Maybe OptInStatus)
logsAnomalyDetectionIntegrationConfig_optInStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogsAnomalyDetectionIntegrationConfig' {Maybe OptInStatus
optInStatus :: Maybe OptInStatus
$sel:optInStatus:LogsAnomalyDetectionIntegrationConfig' :: LogsAnomalyDetectionIntegrationConfig -> Maybe OptInStatus
optInStatus} -> Maybe OptInStatus
optInStatus) (\s :: LogsAnomalyDetectionIntegrationConfig
s@LogsAnomalyDetectionIntegrationConfig' {} Maybe OptInStatus
a -> LogsAnomalyDetectionIntegrationConfig
s {$sel:optInStatus:LogsAnomalyDetectionIntegrationConfig' :: Maybe OptInStatus
optInStatus = Maybe OptInStatus
a} :: LogsAnomalyDetectionIntegrationConfig)

instance
  Prelude.Hashable
    LogsAnomalyDetectionIntegrationConfig
  where
  hashWithSalt :: Int -> LogsAnomalyDetectionIntegrationConfig -> Int
hashWithSalt
    Int
_salt
    LogsAnomalyDetectionIntegrationConfig' {Maybe OptInStatus
optInStatus :: Maybe OptInStatus
$sel:optInStatus:LogsAnomalyDetectionIntegrationConfig' :: LogsAnomalyDetectionIntegrationConfig -> Maybe OptInStatus
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OptInStatus
optInStatus

instance
  Prelude.NFData
    LogsAnomalyDetectionIntegrationConfig
  where
  rnf :: LogsAnomalyDetectionIntegrationConfig -> ()
rnf LogsAnomalyDetectionIntegrationConfig' {Maybe OptInStatus
optInStatus :: Maybe OptInStatus
$sel:optInStatus:LogsAnomalyDetectionIntegrationConfig' :: LogsAnomalyDetectionIntegrationConfig -> Maybe OptInStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe OptInStatus
optInStatus

instance
  Data.ToJSON
    LogsAnomalyDetectionIntegrationConfig
  where
  toJSON :: LogsAnomalyDetectionIntegrationConfig -> Value
toJSON LogsAnomalyDetectionIntegrationConfig' {Maybe OptInStatus
optInStatus :: Maybe OptInStatus
$sel:optInStatus:LogsAnomalyDetectionIntegrationConfig' :: LogsAnomalyDetectionIntegrationConfig -> Maybe OptInStatus
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"OptInStatus" 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 OptInStatus
optInStatus]
      )