{-# 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.CostExplorer.Types.AnomalyMonitor
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CostExplorer.Types.AnomalyMonitor where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.Expression
import Amazonka.CostExplorer.Types.MonitorDimension
import Amazonka.CostExplorer.Types.MonitorType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | This object continuously inspects your account\'s cost data for
-- anomalies. It\'s based on @MonitorType@ and @MonitorSpecification@. The
-- content consists of detailed metadata and the current status of the
-- monitor object.
--
-- /See:/ 'newAnomalyMonitor' smart constructor.
data AnomalyMonitor = AnomalyMonitor'
  { -- | The value for evaluated dimensions.
    AnomalyMonitor -> Maybe Natural
dimensionalValueCount :: Prelude.Maybe Prelude.Natural,
    AnomalyMonitor -> Maybe Expression
monitorSpecification :: Prelude.Maybe Expression,
    -- | The dimensions to evaluate.
    AnomalyMonitor -> Maybe MonitorDimension
monitorDimension :: Prelude.Maybe MonitorDimension,
    -- | The date when the monitor was created.
    AnomalyMonitor -> Maybe Text
creationDate :: Prelude.Maybe Prelude.Text,
    -- | The date when the monitor was last updated.
    AnomalyMonitor -> Maybe Text
lastUpdatedDate :: Prelude.Maybe Prelude.Text,
    -- | The date when the monitor last evaluated for anomalies.
    AnomalyMonitor -> Maybe Text
lastEvaluatedDate :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) value.
    AnomalyMonitor -> Maybe Text
monitorArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the monitor.
    AnomalyMonitor -> Text
monitorName :: Prelude.Text,
    -- | The possible type values.
    AnomalyMonitor -> MonitorType
monitorType :: MonitorType
  }
  deriving (AnomalyMonitor -> AnomalyMonitor -> Bool
(AnomalyMonitor -> AnomalyMonitor -> Bool)
-> (AnomalyMonitor -> AnomalyMonitor -> Bool) -> Eq AnomalyMonitor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalyMonitor -> AnomalyMonitor -> Bool
$c/= :: AnomalyMonitor -> AnomalyMonitor -> Bool
== :: AnomalyMonitor -> AnomalyMonitor -> Bool
$c== :: AnomalyMonitor -> AnomalyMonitor -> Bool
Prelude.Eq, ReadPrec [AnomalyMonitor]
ReadPrec AnomalyMonitor
Int -> ReadS AnomalyMonitor
ReadS [AnomalyMonitor]
(Int -> ReadS AnomalyMonitor)
-> ReadS [AnomalyMonitor]
-> ReadPrec AnomalyMonitor
-> ReadPrec [AnomalyMonitor]
-> Read AnomalyMonitor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalyMonitor]
$creadListPrec :: ReadPrec [AnomalyMonitor]
readPrec :: ReadPrec AnomalyMonitor
$creadPrec :: ReadPrec AnomalyMonitor
readList :: ReadS [AnomalyMonitor]
$creadList :: ReadS [AnomalyMonitor]
readsPrec :: Int -> ReadS AnomalyMonitor
$creadsPrec :: Int -> ReadS AnomalyMonitor
Prelude.Read, Int -> AnomalyMonitor -> ShowS
[AnomalyMonitor] -> ShowS
AnomalyMonitor -> String
(Int -> AnomalyMonitor -> ShowS)
-> (AnomalyMonitor -> String)
-> ([AnomalyMonitor] -> ShowS)
-> Show AnomalyMonitor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalyMonitor] -> ShowS
$cshowList :: [AnomalyMonitor] -> ShowS
show :: AnomalyMonitor -> String
$cshow :: AnomalyMonitor -> String
showsPrec :: Int -> AnomalyMonitor -> ShowS
$cshowsPrec :: Int -> AnomalyMonitor -> ShowS
Prelude.Show, (forall x. AnomalyMonitor -> Rep AnomalyMonitor x)
-> (forall x. Rep AnomalyMonitor x -> AnomalyMonitor)
-> Generic AnomalyMonitor
forall x. Rep AnomalyMonitor x -> AnomalyMonitor
forall x. AnomalyMonitor -> Rep AnomalyMonitor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalyMonitor x -> AnomalyMonitor
$cfrom :: forall x. AnomalyMonitor -> Rep AnomalyMonitor x
Prelude.Generic)

-- |
-- Create a value of 'AnomalyMonitor' 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:
--
-- 'dimensionalValueCount', 'anomalyMonitor_dimensionalValueCount' - The value for evaluated dimensions.
--
-- 'monitorSpecification', 'anomalyMonitor_monitorSpecification' - Undocumented member.
--
-- 'monitorDimension', 'anomalyMonitor_monitorDimension' - The dimensions to evaluate.
--
-- 'creationDate', 'anomalyMonitor_creationDate' - The date when the monitor was created.
--
-- 'lastUpdatedDate', 'anomalyMonitor_lastUpdatedDate' - The date when the monitor was last updated.
--
-- 'lastEvaluatedDate', 'anomalyMonitor_lastEvaluatedDate' - The date when the monitor last evaluated for anomalies.
--
-- 'monitorArn', 'anomalyMonitor_monitorArn' - The Amazon Resource Name (ARN) value.
--
-- 'monitorName', 'anomalyMonitor_monitorName' - The name of the monitor.
--
-- 'monitorType', 'anomalyMonitor_monitorType' - The possible type values.
newAnomalyMonitor ::
  -- | 'monitorName'
  Prelude.Text ->
  -- | 'monitorType'
  MonitorType ->
  AnomalyMonitor
newAnomalyMonitor :: Text -> MonitorType -> AnomalyMonitor
newAnomalyMonitor Text
pMonitorName_ MonitorType
pMonitorType_ =
  AnomalyMonitor' :: Maybe Natural
-> Maybe Expression
-> Maybe MonitorDimension
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> MonitorType
-> AnomalyMonitor
AnomalyMonitor'
    { $sel:dimensionalValueCount:AnomalyMonitor' :: Maybe Natural
dimensionalValueCount =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:monitorSpecification:AnomalyMonitor' :: Maybe Expression
monitorSpecification = Maybe Expression
forall a. Maybe a
Prelude.Nothing,
      $sel:monitorDimension:AnomalyMonitor' :: Maybe MonitorDimension
monitorDimension = Maybe MonitorDimension
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:AnomalyMonitor' :: Maybe Text
creationDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDate:AnomalyMonitor' :: Maybe Text
lastUpdatedDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastEvaluatedDate:AnomalyMonitor' :: Maybe Text
lastEvaluatedDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:monitorArn:AnomalyMonitor' :: Maybe Text
monitorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:monitorName:AnomalyMonitor' :: Text
monitorName = Text
pMonitorName_,
      $sel:monitorType:AnomalyMonitor' :: MonitorType
monitorType = MonitorType
pMonitorType_
    }

-- | The value for evaluated dimensions.
anomalyMonitor_dimensionalValueCount :: Lens.Lens' AnomalyMonitor (Prelude.Maybe Prelude.Natural)
anomalyMonitor_dimensionalValueCount :: (Maybe Natural -> f (Maybe Natural))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_dimensionalValueCount = (AnomalyMonitor -> Maybe Natural)
-> (AnomalyMonitor -> Maybe Natural -> AnomalyMonitor)
-> Lens
     AnomalyMonitor AnomalyMonitor (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe Natural
dimensionalValueCount :: Maybe Natural
$sel:dimensionalValueCount:AnomalyMonitor' :: AnomalyMonitor -> Maybe Natural
dimensionalValueCount} -> Maybe Natural
dimensionalValueCount) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe Natural
a -> AnomalyMonitor
s {$sel:dimensionalValueCount:AnomalyMonitor' :: Maybe Natural
dimensionalValueCount = Maybe Natural
a} :: AnomalyMonitor)

-- | Undocumented member.
anomalyMonitor_monitorSpecification :: Lens.Lens' AnomalyMonitor (Prelude.Maybe Expression)
anomalyMonitor_monitorSpecification :: (Maybe Expression -> f (Maybe Expression))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_monitorSpecification = (AnomalyMonitor -> Maybe Expression)
-> (AnomalyMonitor -> Maybe Expression -> AnomalyMonitor)
-> Lens
     AnomalyMonitor AnomalyMonitor (Maybe Expression) (Maybe Expression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe Expression
monitorSpecification :: Maybe Expression
$sel:monitorSpecification:AnomalyMonitor' :: AnomalyMonitor -> Maybe Expression
monitorSpecification} -> Maybe Expression
monitorSpecification) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe Expression
a -> AnomalyMonitor
s {$sel:monitorSpecification:AnomalyMonitor' :: Maybe Expression
monitorSpecification = Maybe Expression
a} :: AnomalyMonitor)

-- | The dimensions to evaluate.
anomalyMonitor_monitorDimension :: Lens.Lens' AnomalyMonitor (Prelude.Maybe MonitorDimension)
anomalyMonitor_monitorDimension :: (Maybe MonitorDimension -> f (Maybe MonitorDimension))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_monitorDimension = (AnomalyMonitor -> Maybe MonitorDimension)
-> (AnomalyMonitor -> Maybe MonitorDimension -> AnomalyMonitor)
-> Lens
     AnomalyMonitor
     AnomalyMonitor
     (Maybe MonitorDimension)
     (Maybe MonitorDimension)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe MonitorDimension
monitorDimension :: Maybe MonitorDimension
$sel:monitorDimension:AnomalyMonitor' :: AnomalyMonitor -> Maybe MonitorDimension
monitorDimension} -> Maybe MonitorDimension
monitorDimension) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe MonitorDimension
a -> AnomalyMonitor
s {$sel:monitorDimension:AnomalyMonitor' :: Maybe MonitorDimension
monitorDimension = Maybe MonitorDimension
a} :: AnomalyMonitor)

-- | The date when the monitor was created.
anomalyMonitor_creationDate :: Lens.Lens' AnomalyMonitor (Prelude.Maybe Prelude.Text)
anomalyMonitor_creationDate :: (Maybe Text -> f (Maybe Text))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_creationDate = (AnomalyMonitor -> Maybe Text)
-> (AnomalyMonitor -> Maybe Text -> AnomalyMonitor)
-> Lens AnomalyMonitor AnomalyMonitor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe Text
creationDate :: Maybe Text
$sel:creationDate:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
creationDate} -> Maybe Text
creationDate) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe Text
a -> AnomalyMonitor
s {$sel:creationDate:AnomalyMonitor' :: Maybe Text
creationDate = Maybe Text
a} :: AnomalyMonitor)

-- | The date when the monitor was last updated.
anomalyMonitor_lastUpdatedDate :: Lens.Lens' AnomalyMonitor (Prelude.Maybe Prelude.Text)
anomalyMonitor_lastUpdatedDate :: (Maybe Text -> f (Maybe Text))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_lastUpdatedDate = (AnomalyMonitor -> Maybe Text)
-> (AnomalyMonitor -> Maybe Text -> AnomalyMonitor)
-> Lens AnomalyMonitor AnomalyMonitor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe Text
lastUpdatedDate :: Maybe Text
$sel:lastUpdatedDate:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
lastUpdatedDate} -> Maybe Text
lastUpdatedDate) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe Text
a -> AnomalyMonitor
s {$sel:lastUpdatedDate:AnomalyMonitor' :: Maybe Text
lastUpdatedDate = Maybe Text
a} :: AnomalyMonitor)

-- | The date when the monitor last evaluated for anomalies.
anomalyMonitor_lastEvaluatedDate :: Lens.Lens' AnomalyMonitor (Prelude.Maybe Prelude.Text)
anomalyMonitor_lastEvaluatedDate :: (Maybe Text -> f (Maybe Text))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_lastEvaluatedDate = (AnomalyMonitor -> Maybe Text)
-> (AnomalyMonitor -> Maybe Text -> AnomalyMonitor)
-> Lens AnomalyMonitor AnomalyMonitor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe Text
lastEvaluatedDate :: Maybe Text
$sel:lastEvaluatedDate:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
lastEvaluatedDate} -> Maybe Text
lastEvaluatedDate) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe Text
a -> AnomalyMonitor
s {$sel:lastEvaluatedDate:AnomalyMonitor' :: Maybe Text
lastEvaluatedDate = Maybe Text
a} :: AnomalyMonitor)

-- | The Amazon Resource Name (ARN) value.
anomalyMonitor_monitorArn :: Lens.Lens' AnomalyMonitor (Prelude.Maybe Prelude.Text)
anomalyMonitor_monitorArn :: (Maybe Text -> f (Maybe Text))
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_monitorArn = (AnomalyMonitor -> Maybe Text)
-> (AnomalyMonitor -> Maybe Text -> AnomalyMonitor)
-> Lens AnomalyMonitor AnomalyMonitor (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Maybe Text
monitorArn :: Maybe Text
$sel:monitorArn:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
monitorArn} -> Maybe Text
monitorArn) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Maybe Text
a -> AnomalyMonitor
s {$sel:monitorArn:AnomalyMonitor' :: Maybe Text
monitorArn = Maybe Text
a} :: AnomalyMonitor)

-- | The name of the monitor.
anomalyMonitor_monitorName :: Lens.Lens' AnomalyMonitor Prelude.Text
anomalyMonitor_monitorName :: (Text -> f Text) -> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_monitorName = (AnomalyMonitor -> Text)
-> (AnomalyMonitor -> Text -> AnomalyMonitor)
-> Lens AnomalyMonitor AnomalyMonitor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {Text
monitorName :: Text
$sel:monitorName:AnomalyMonitor' :: AnomalyMonitor -> Text
monitorName} -> Text
monitorName) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} Text
a -> AnomalyMonitor
s {$sel:monitorName:AnomalyMonitor' :: Text
monitorName = Text
a} :: AnomalyMonitor)

-- | The possible type values.
anomalyMonitor_monitorType :: Lens.Lens' AnomalyMonitor MonitorType
anomalyMonitor_monitorType :: (MonitorType -> f MonitorType)
-> AnomalyMonitor -> f AnomalyMonitor
anomalyMonitor_monitorType = (AnomalyMonitor -> MonitorType)
-> (AnomalyMonitor -> MonitorType -> AnomalyMonitor)
-> Lens AnomalyMonitor AnomalyMonitor MonitorType MonitorType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalyMonitor' {MonitorType
monitorType :: MonitorType
$sel:monitorType:AnomalyMonitor' :: AnomalyMonitor -> MonitorType
monitorType} -> MonitorType
monitorType) (\s :: AnomalyMonitor
s@AnomalyMonitor' {} MonitorType
a -> AnomalyMonitor
s {$sel:monitorType:AnomalyMonitor' :: MonitorType
monitorType = MonitorType
a} :: AnomalyMonitor)

instance Core.FromJSON AnomalyMonitor where
  parseJSON :: Value -> Parser AnomalyMonitor
parseJSON =
    String
-> (Object -> Parser AnomalyMonitor)
-> Value
-> Parser AnomalyMonitor
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AnomalyMonitor"
      ( \Object
x ->
          Maybe Natural
-> Maybe Expression
-> Maybe MonitorDimension
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> MonitorType
-> AnomalyMonitor
AnomalyMonitor'
            (Maybe Natural
 -> Maybe Expression
 -> Maybe MonitorDimension
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Text
 -> MonitorType
 -> AnomalyMonitor)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Expression
      -> Maybe MonitorDimension
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> MonitorType
      -> AnomalyMonitor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DimensionalValueCount")
            Parser
  (Maybe Expression
   -> Maybe MonitorDimension
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> MonitorType
   -> AnomalyMonitor)
-> Parser (Maybe Expression)
-> Parser
     (Maybe MonitorDimension
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> MonitorType
      -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Expression)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MonitorSpecification")
            Parser
  (Maybe MonitorDimension
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> MonitorType
   -> AnomalyMonitor)
-> Parser (Maybe MonitorDimension)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> MonitorType
      -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MonitorDimension)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MonitorDimension")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> MonitorType
   -> AnomalyMonitor)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Text
      -> MonitorType
      -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Text
   -> MonitorType
   -> AnomalyMonitor)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Text -> MonitorType -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastUpdatedDate")
            Parser
  (Maybe Text -> Maybe Text -> Text -> MonitorType -> AnomalyMonitor)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> MonitorType -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastEvaluatedDate")
            Parser (Maybe Text -> Text -> MonitorType -> AnomalyMonitor)
-> Parser (Maybe Text)
-> Parser (Text -> MonitorType -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MonitorArn")
            Parser (Text -> MonitorType -> AnomalyMonitor)
-> Parser Text -> Parser (MonitorType -> AnomalyMonitor)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MonitorName")
            Parser (MonitorType -> AnomalyMonitor)
-> Parser MonitorType -> Parser AnomalyMonitor
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser MonitorType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MonitorType")
      )

instance Prelude.Hashable AnomalyMonitor

instance Prelude.NFData AnomalyMonitor

instance Core.ToJSON AnomalyMonitor where
  toJSON :: AnomalyMonitor -> Value
toJSON AnomalyMonitor' {Maybe Natural
Maybe Text
Maybe MonitorDimension
Maybe Expression
Text
MonitorType
monitorType :: MonitorType
monitorName :: Text
monitorArn :: Maybe Text
lastEvaluatedDate :: Maybe Text
lastUpdatedDate :: Maybe Text
creationDate :: Maybe Text
monitorDimension :: Maybe MonitorDimension
monitorSpecification :: Maybe Expression
dimensionalValueCount :: Maybe Natural
$sel:monitorType:AnomalyMonitor' :: AnomalyMonitor -> MonitorType
$sel:monitorName:AnomalyMonitor' :: AnomalyMonitor -> Text
$sel:monitorArn:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
$sel:lastEvaluatedDate:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
$sel:lastUpdatedDate:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
$sel:creationDate:AnomalyMonitor' :: AnomalyMonitor -> Maybe Text
$sel:monitorDimension:AnomalyMonitor' :: AnomalyMonitor -> Maybe MonitorDimension
$sel:monitorSpecification:AnomalyMonitor' :: AnomalyMonitor -> Maybe Expression
$sel:dimensionalValueCount:AnomalyMonitor' :: AnomalyMonitor -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DimensionalValueCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
dimensionalValueCount,
            (Text
"MonitorSpecification" Text -> Expression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Expression -> Pair) -> Maybe Expression -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Expression
monitorSpecification,
            (Text
"MonitorDimension" Text -> MonitorDimension -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MonitorDimension -> Pair) -> Maybe MonitorDimension -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MonitorDimension
monitorDimension,
            (Text
"CreationDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
creationDate,
            (Text
"LastUpdatedDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lastUpdatedDate,
            (Text
"LastEvaluatedDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lastEvaluatedDate,
            (Text
"MonitorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
monitorArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MonitorName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
monitorName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MonitorType" Text -> MonitorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MonitorType
monitorType)
          ]
      )