{-# 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.LookoutMetrics.Types.AnomalyDetectorSummary
-- 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.LookoutMetrics.Types.AnomalyDetectorSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LookoutMetrics.Types.AnomalyDetectorStatus
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an an anomaly detector.
--
-- /See:/ 'newAnomalyDetectorSummary' smart constructor.
data AnomalyDetectorSummary = AnomalyDetectorSummary'
  { -- | The ARN of the detector.
    AnomalyDetectorSummary -> Maybe Text
anomalyDetectorArn :: Prelude.Maybe Prelude.Text,
    -- | A description of the detector.
    AnomalyDetectorSummary -> Maybe Text
anomalyDetectorDescription :: Prelude.Maybe Prelude.Text,
    -- | The name of the detector.
    AnomalyDetectorSummary -> Maybe Text
anomalyDetectorName :: Prelude.Maybe Prelude.Text,
    -- | The time at which the detector was created.
    AnomalyDetectorSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The time at which the detector was last modified.
    AnomalyDetectorSummary -> Maybe POSIX
lastModificationTime :: Prelude.Maybe Data.POSIX,
    -- | The status of detector.
    AnomalyDetectorSummary -> Maybe AnomalyDetectorStatus
status :: Prelude.Maybe AnomalyDetectorStatus,
    -- | The detector\'s
    -- <https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html tags>.
    AnomalyDetectorSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (AnomalyDetectorSummary -> AnomalyDetectorSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyDetectorSummary -> AnomalyDetectorSummary -> Bool
$c/= :: AnomalyDetectorSummary -> AnomalyDetectorSummary -> Bool
== :: AnomalyDetectorSummary -> AnomalyDetectorSummary -> Bool
$c== :: AnomalyDetectorSummary -> AnomalyDetectorSummary -> Bool
Prelude.Eq, ReadPrec [AnomalyDetectorSummary]
ReadPrec AnomalyDetectorSummary
Int -> ReadS AnomalyDetectorSummary
ReadS [AnomalyDetectorSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyDetectorSummary]
$creadListPrec :: ReadPrec [AnomalyDetectorSummary]
readPrec :: ReadPrec AnomalyDetectorSummary
$creadPrec :: ReadPrec AnomalyDetectorSummary
readList :: ReadS [AnomalyDetectorSummary]
$creadList :: ReadS [AnomalyDetectorSummary]
readsPrec :: Int -> ReadS AnomalyDetectorSummary
$creadsPrec :: Int -> ReadS AnomalyDetectorSummary
Prelude.Read, Int -> AnomalyDetectorSummary -> ShowS
[AnomalyDetectorSummary] -> ShowS
AnomalyDetectorSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyDetectorSummary] -> ShowS
$cshowList :: [AnomalyDetectorSummary] -> ShowS
show :: AnomalyDetectorSummary -> String
$cshow :: AnomalyDetectorSummary -> String
showsPrec :: Int -> AnomalyDetectorSummary -> ShowS
$cshowsPrec :: Int -> AnomalyDetectorSummary -> ShowS
Prelude.Show, forall x. Rep AnomalyDetectorSummary x -> AnomalyDetectorSummary
forall x. AnomalyDetectorSummary -> Rep AnomalyDetectorSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyDetectorSummary x -> AnomalyDetectorSummary
$cfrom :: forall x. AnomalyDetectorSummary -> Rep AnomalyDetectorSummary x
Prelude.Generic)

-- |
-- Create a value of 'AnomalyDetectorSummary' 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:
--
-- 'anomalyDetectorArn', 'anomalyDetectorSummary_anomalyDetectorArn' - The ARN of the detector.
--
-- 'anomalyDetectorDescription', 'anomalyDetectorSummary_anomalyDetectorDescription' - A description of the detector.
--
-- 'anomalyDetectorName', 'anomalyDetectorSummary_anomalyDetectorName' - The name of the detector.
--
-- 'creationTime', 'anomalyDetectorSummary_creationTime' - The time at which the detector was created.
--
-- 'lastModificationTime', 'anomalyDetectorSummary_lastModificationTime' - The time at which the detector was last modified.
--
-- 'status', 'anomalyDetectorSummary_status' - The status of detector.
--
-- 'tags', 'anomalyDetectorSummary_tags' - The detector\'s
-- <https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html tags>.
newAnomalyDetectorSummary ::
  AnomalyDetectorSummary
newAnomalyDetectorSummary :: AnomalyDetectorSummary
newAnomalyDetectorSummary =
  AnomalyDetectorSummary'
    { $sel:anomalyDetectorArn:AnomalyDetectorSummary' :: Maybe Text
anomalyDetectorArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:anomalyDetectorDescription:AnomalyDetectorSummary' :: Maybe Text
anomalyDetectorDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:anomalyDetectorName:AnomalyDetectorSummary' :: Maybe Text
anomalyDetectorName = forall a. Maybe a
Prelude.Nothing,
      $sel:creationTime:AnomalyDetectorSummary' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModificationTime:AnomalyDetectorSummary' :: Maybe POSIX
lastModificationTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:AnomalyDetectorSummary' :: Maybe AnomalyDetectorStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:AnomalyDetectorSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the detector.
anomalyDetectorSummary_anomalyDetectorArn :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe Prelude.Text)
anomalyDetectorSummary_anomalyDetectorArn :: Lens' AnomalyDetectorSummary (Maybe Text)
anomalyDetectorSummary_anomalyDetectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:anomalyDetectorArn:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
anomalyDetectorArn} -> Maybe Text
anomalyDetectorArn) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe Text
a -> AnomalyDetectorSummary
s {$sel:anomalyDetectorArn:AnomalyDetectorSummary' :: Maybe Text
anomalyDetectorArn = Maybe Text
a} :: AnomalyDetectorSummary)

-- | A description of the detector.
anomalyDetectorSummary_anomalyDetectorDescription :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe Prelude.Text)
anomalyDetectorSummary_anomalyDetectorDescription :: Lens' AnomalyDetectorSummary (Maybe Text)
anomalyDetectorSummary_anomalyDetectorDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe Text
anomalyDetectorDescription :: Maybe Text
$sel:anomalyDetectorDescription:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
anomalyDetectorDescription} -> Maybe Text
anomalyDetectorDescription) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe Text
a -> AnomalyDetectorSummary
s {$sel:anomalyDetectorDescription:AnomalyDetectorSummary' :: Maybe Text
anomalyDetectorDescription = Maybe Text
a} :: AnomalyDetectorSummary)

-- | The name of the detector.
anomalyDetectorSummary_anomalyDetectorName :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe Prelude.Text)
anomalyDetectorSummary_anomalyDetectorName :: Lens' AnomalyDetectorSummary (Maybe Text)
anomalyDetectorSummary_anomalyDetectorName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe Text
anomalyDetectorName :: Maybe Text
$sel:anomalyDetectorName:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
anomalyDetectorName} -> Maybe Text
anomalyDetectorName) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe Text
a -> AnomalyDetectorSummary
s {$sel:anomalyDetectorName:AnomalyDetectorSummary' :: Maybe Text
anomalyDetectorName = Maybe Text
a} :: AnomalyDetectorSummary)

-- | The time at which the detector was created.
anomalyDetectorSummary_creationTime :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe Prelude.UTCTime)
anomalyDetectorSummary_creationTime :: Lens' AnomalyDetectorSummary (Maybe UTCTime)
anomalyDetectorSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe POSIX
a -> AnomalyDetectorSummary
s {$sel:creationTime:AnomalyDetectorSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: AnomalyDetectorSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time at which the detector was last modified.
anomalyDetectorSummary_lastModificationTime :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe Prelude.UTCTime)
anomalyDetectorSummary_lastModificationTime :: Lens' AnomalyDetectorSummary (Maybe UTCTime)
anomalyDetectorSummary_lastModificationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe POSIX
lastModificationTime :: Maybe POSIX
$sel:lastModificationTime:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe POSIX
lastModificationTime} -> Maybe POSIX
lastModificationTime) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe POSIX
a -> AnomalyDetectorSummary
s {$sel:lastModificationTime:AnomalyDetectorSummary' :: Maybe POSIX
lastModificationTime = Maybe POSIX
a} :: AnomalyDetectorSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of detector.
anomalyDetectorSummary_status :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe AnomalyDetectorStatus)
anomalyDetectorSummary_status :: Lens' AnomalyDetectorSummary (Maybe AnomalyDetectorStatus)
anomalyDetectorSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe AnomalyDetectorStatus
status :: Maybe AnomalyDetectorStatus
$sel:status:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe AnomalyDetectorStatus
status} -> Maybe AnomalyDetectorStatus
status) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe AnomalyDetectorStatus
a -> AnomalyDetectorSummary
s {$sel:status:AnomalyDetectorSummary' :: Maybe AnomalyDetectorStatus
status = Maybe AnomalyDetectorStatus
a} :: AnomalyDetectorSummary)

-- | The detector\'s
-- <https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html tags>.
anomalyDetectorSummary_tags :: Lens.Lens' AnomalyDetectorSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
anomalyDetectorSummary_tags :: Lens' AnomalyDetectorSummary (Maybe (HashMap Text Text))
anomalyDetectorSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyDetectorSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: AnomalyDetectorSummary
s@AnomalyDetectorSummary' {} Maybe (HashMap Text Text)
a -> AnomalyDetectorSummary
s {$sel:tags:AnomalyDetectorSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: AnomalyDetectorSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AnomalyDetectorSummary where
  parseJSON :: Value -> Parser AnomalyDetectorSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AnomalyDetectorSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe AnomalyDetectorStatus
-> Maybe (HashMap Text Text)
-> AnomalyDetectorSummary
AnomalyDetectorSummary'
            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
"AnomalyDetectorArn")
            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
"AnomalyDetectorDescription")
            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
"AnomalyDetectorName")
            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
"CreationTime")
            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
"LastModificationTime")
            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
"Status")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable AnomalyDetectorSummary where
  hashWithSalt :: Int -> AnomalyDetectorSummary -> Int
hashWithSalt Int
_salt AnomalyDetectorSummary' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe AnomalyDetectorStatus
tags :: Maybe (HashMap Text Text)
status :: Maybe AnomalyDetectorStatus
lastModificationTime :: Maybe POSIX
creationTime :: Maybe POSIX
anomalyDetectorName :: Maybe Text
anomalyDetectorDescription :: Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:tags:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe (HashMap Text Text)
$sel:status:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe AnomalyDetectorStatus
$sel:lastModificationTime:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe POSIX
$sel:creationTime:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe POSIX
$sel:anomalyDetectorName:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
$sel:anomalyDetectorDescription:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
$sel:anomalyDetectorArn:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
anomalyDetectorArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
anomalyDetectorDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
anomalyDetectorName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModificationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AnomalyDetectorStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData AnomalyDetectorSummary where
  rnf :: AnomalyDetectorSummary -> ()
rnf AnomalyDetectorSummary' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
Maybe AnomalyDetectorStatus
tags :: Maybe (HashMap Text Text)
status :: Maybe AnomalyDetectorStatus
lastModificationTime :: Maybe POSIX
creationTime :: Maybe POSIX
anomalyDetectorName :: Maybe Text
anomalyDetectorDescription :: Maybe Text
anomalyDetectorArn :: Maybe Text
$sel:tags:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe (HashMap Text Text)
$sel:status:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe AnomalyDetectorStatus
$sel:lastModificationTime:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe POSIX
$sel:creationTime:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe POSIX
$sel:anomalyDetectorName:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
$sel:anomalyDetectorDescription:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
$sel:anomalyDetectorArn:AnomalyDetectorSummary' :: AnomalyDetectorSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
anomalyDetectorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
anomalyDetectorDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
anomalyDetectorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModificationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AnomalyDetectorStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags