{-# 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.AnomalySourceMetadata
-- 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.AnomalySourceMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Metadata about the detection source that generates proactive anomalies.
-- The anomaly is detected using analysis of the metric data
 over a period
-- of time
--
-- /See:/ 'newAnomalySourceMetadata' smart constructor.
data AnomalySourceMetadata = AnomalySourceMetadata'
  { -- | The source of the anomaly.
    AnomalySourceMetadata -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
    -- | The name of the anomaly\'s resource.
    AnomalySourceMetadata -> Maybe Text
sourceResourceName :: Prelude.Maybe Prelude.Text,
    -- | The anomaly\'s resource type.
    AnomalySourceMetadata -> Maybe Text
sourceResourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (AnomalySourceMetadata -> AnomalySourceMetadata -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalySourceMetadata -> AnomalySourceMetadata -> Bool
$c/= :: AnomalySourceMetadata -> AnomalySourceMetadata -> Bool
== :: AnomalySourceMetadata -> AnomalySourceMetadata -> Bool
$c== :: AnomalySourceMetadata -> AnomalySourceMetadata -> Bool
Prelude.Eq, ReadPrec [AnomalySourceMetadata]
ReadPrec AnomalySourceMetadata
Int -> ReadS AnomalySourceMetadata
ReadS [AnomalySourceMetadata]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalySourceMetadata]
$creadListPrec :: ReadPrec [AnomalySourceMetadata]
readPrec :: ReadPrec AnomalySourceMetadata
$creadPrec :: ReadPrec AnomalySourceMetadata
readList :: ReadS [AnomalySourceMetadata]
$creadList :: ReadS [AnomalySourceMetadata]
readsPrec :: Int -> ReadS AnomalySourceMetadata
$creadsPrec :: Int -> ReadS AnomalySourceMetadata
Prelude.Read, Int -> AnomalySourceMetadata -> ShowS
[AnomalySourceMetadata] -> ShowS
AnomalySourceMetadata -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalySourceMetadata] -> ShowS
$cshowList :: [AnomalySourceMetadata] -> ShowS
show :: AnomalySourceMetadata -> String
$cshow :: AnomalySourceMetadata -> String
showsPrec :: Int -> AnomalySourceMetadata -> ShowS
$cshowsPrec :: Int -> AnomalySourceMetadata -> ShowS
Prelude.Show, forall x. Rep AnomalySourceMetadata x -> AnomalySourceMetadata
forall x. AnomalySourceMetadata -> Rep AnomalySourceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalySourceMetadata x -> AnomalySourceMetadata
$cfrom :: forall x. AnomalySourceMetadata -> Rep AnomalySourceMetadata x
Prelude.Generic)

-- |
-- Create a value of 'AnomalySourceMetadata' 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:
--
-- 'source', 'anomalySourceMetadata_source' - The source of the anomaly.
--
-- 'sourceResourceName', 'anomalySourceMetadata_sourceResourceName' - The name of the anomaly\'s resource.
--
-- 'sourceResourceType', 'anomalySourceMetadata_sourceResourceType' - The anomaly\'s resource type.
newAnomalySourceMetadata ::
  AnomalySourceMetadata
newAnomalySourceMetadata :: AnomalySourceMetadata
newAnomalySourceMetadata =
  AnomalySourceMetadata'
    { $sel:source:AnomalySourceMetadata' :: Maybe Text
source = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceResourceName:AnomalySourceMetadata' :: Maybe Text
sourceResourceName = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceResourceType:AnomalySourceMetadata' :: Maybe Text
sourceResourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The source of the anomaly.
anomalySourceMetadata_source :: Lens.Lens' AnomalySourceMetadata (Prelude.Maybe Prelude.Text)
anomalySourceMetadata_source :: Lens' AnomalySourceMetadata (Maybe Text)
anomalySourceMetadata_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySourceMetadata' {Maybe Text
source :: Maybe Text
$sel:source:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
source} -> Maybe Text
source) (\s :: AnomalySourceMetadata
s@AnomalySourceMetadata' {} Maybe Text
a -> AnomalySourceMetadata
s {$sel:source:AnomalySourceMetadata' :: Maybe Text
source = Maybe Text
a} :: AnomalySourceMetadata)

-- | The name of the anomaly\'s resource.
anomalySourceMetadata_sourceResourceName :: Lens.Lens' AnomalySourceMetadata (Prelude.Maybe Prelude.Text)
anomalySourceMetadata_sourceResourceName :: Lens' AnomalySourceMetadata (Maybe Text)
anomalySourceMetadata_sourceResourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySourceMetadata' {Maybe Text
sourceResourceName :: Maybe Text
$sel:sourceResourceName:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
sourceResourceName} -> Maybe Text
sourceResourceName) (\s :: AnomalySourceMetadata
s@AnomalySourceMetadata' {} Maybe Text
a -> AnomalySourceMetadata
s {$sel:sourceResourceName:AnomalySourceMetadata' :: Maybe Text
sourceResourceName = Maybe Text
a} :: AnomalySourceMetadata)

-- | The anomaly\'s resource type.
anomalySourceMetadata_sourceResourceType :: Lens.Lens' AnomalySourceMetadata (Prelude.Maybe Prelude.Text)
anomalySourceMetadata_sourceResourceType :: Lens' AnomalySourceMetadata (Maybe Text)
anomalySourceMetadata_sourceResourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySourceMetadata' {Maybe Text
sourceResourceType :: Maybe Text
$sel:sourceResourceType:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
sourceResourceType} -> Maybe Text
sourceResourceType) (\s :: AnomalySourceMetadata
s@AnomalySourceMetadata' {} Maybe Text
a -> AnomalySourceMetadata
s {$sel:sourceResourceType:AnomalySourceMetadata' :: Maybe Text
sourceResourceType = Maybe Text
a} :: AnomalySourceMetadata)

instance Data.FromJSON AnomalySourceMetadata where
  parseJSON :: Value -> Parser AnomalySourceMetadata
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnomalySourceMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> AnomalySourceMetadata
AnomalySourceMetadata'
            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
"Source")
            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
"SourceResourceName")
            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
"SourceResourceType")
      )

instance Prelude.Hashable AnomalySourceMetadata where
  hashWithSalt :: Int -> AnomalySourceMetadata -> Int
hashWithSalt Int
_salt AnomalySourceMetadata' {Maybe Text
sourceResourceType :: Maybe Text
sourceResourceName :: Maybe Text
source :: Maybe Text
$sel:sourceResourceType:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
$sel:sourceResourceName:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
$sel:source:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceResourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceResourceType

instance Prelude.NFData AnomalySourceMetadata where
  rnf :: AnomalySourceMetadata -> ()
rnf AnomalySourceMetadata' {Maybe Text
sourceResourceType :: Maybe Text
sourceResourceName :: Maybe Text
source :: Maybe Text
$sel:sourceResourceType:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
$sel:sourceResourceName:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
$sel:source:AnomalySourceMetadata' :: AnomalySourceMetadata -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceResourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceResourceType