{-# 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 #-}
module Amazonka.CostExplorer.Types.AnomalySubscription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types.AnomalySubscriptionFrequency
import Amazonka.CostExplorer.Types.Expression
import Amazonka.CostExplorer.Types.Subscriber
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data AnomalySubscription = AnomalySubscription'
{
AnomalySubscription -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
AnomalySubscription -> Maybe Text
subscriptionArn :: Prelude.Maybe Prelude.Text,
AnomalySubscription -> Maybe Double
threshold :: Prelude.Maybe Prelude.Double,
AnomalySubscription -> Maybe Expression
thresholdExpression :: Prelude.Maybe Expression,
AnomalySubscription -> [Text]
monitorArnList :: [Prelude.Text],
AnomalySubscription -> [Subscriber]
subscribers :: [Subscriber],
AnomalySubscription -> AnomalySubscriptionFrequency
frequency :: AnomalySubscriptionFrequency,
AnomalySubscription -> Text
subscriptionName :: Prelude.Text
}
deriving (AnomalySubscription -> AnomalySubscription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnomalySubscription -> AnomalySubscription -> Bool
$c/= :: AnomalySubscription -> AnomalySubscription -> Bool
== :: AnomalySubscription -> AnomalySubscription -> Bool
$c== :: AnomalySubscription -> AnomalySubscription -> Bool
Prelude.Eq, ReadPrec [AnomalySubscription]
ReadPrec AnomalySubscription
Int -> ReadS AnomalySubscription
ReadS [AnomalySubscription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnomalySubscription]
$creadListPrec :: ReadPrec [AnomalySubscription]
readPrec :: ReadPrec AnomalySubscription
$creadPrec :: ReadPrec AnomalySubscription
readList :: ReadS [AnomalySubscription]
$creadList :: ReadS [AnomalySubscription]
readsPrec :: Int -> ReadS AnomalySubscription
$creadsPrec :: Int -> ReadS AnomalySubscription
Prelude.Read, Int -> AnomalySubscription -> ShowS
[AnomalySubscription] -> ShowS
AnomalySubscription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnomalySubscription] -> ShowS
$cshowList :: [AnomalySubscription] -> ShowS
show :: AnomalySubscription -> String
$cshow :: AnomalySubscription -> String
showsPrec :: Int -> AnomalySubscription -> ShowS
$cshowsPrec :: Int -> AnomalySubscription -> ShowS
Prelude.Show, forall x. Rep AnomalySubscription x -> AnomalySubscription
forall x. AnomalySubscription -> Rep AnomalySubscription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnomalySubscription x -> AnomalySubscription
$cfrom :: forall x. AnomalySubscription -> Rep AnomalySubscription x
Prelude.Generic)
newAnomalySubscription ::
AnomalySubscriptionFrequency ->
Prelude.Text ->
AnomalySubscription
newAnomalySubscription :: AnomalySubscriptionFrequency -> Text -> AnomalySubscription
newAnomalySubscription AnomalySubscriptionFrequency
pFrequency_ Text
pSubscriptionName_ =
AnomalySubscription'
{ $sel:accountId:AnomalySubscription' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
$sel:subscriptionArn:AnomalySubscription' :: Maybe Text
subscriptionArn = forall a. Maybe a
Prelude.Nothing,
$sel:threshold:AnomalySubscription' :: Maybe Double
threshold = forall a. Maybe a
Prelude.Nothing,
$sel:thresholdExpression:AnomalySubscription' :: Maybe Expression
thresholdExpression = forall a. Maybe a
Prelude.Nothing,
$sel:monitorArnList:AnomalySubscription' :: [Text]
monitorArnList = forall a. Monoid a => a
Prelude.mempty,
$sel:subscribers:AnomalySubscription' :: [Subscriber]
subscribers = forall a. Monoid a => a
Prelude.mempty,
$sel:frequency:AnomalySubscription' :: AnomalySubscriptionFrequency
frequency = AnomalySubscriptionFrequency
pFrequency_,
$sel:subscriptionName:AnomalySubscription' :: Text
subscriptionName = Text
pSubscriptionName_
}
anomalySubscription_accountId :: Lens.Lens' AnomalySubscription (Prelude.Maybe Prelude.Text)
anomalySubscription_accountId :: Lens' AnomalySubscription (Maybe Text)
anomalySubscription_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AnomalySubscription' :: AnomalySubscription -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AnomalySubscription
s@AnomalySubscription' {} Maybe Text
a -> AnomalySubscription
s {$sel:accountId:AnomalySubscription' :: Maybe Text
accountId = Maybe Text
a} :: AnomalySubscription)
anomalySubscription_subscriptionArn :: Lens.Lens' AnomalySubscription (Prelude.Maybe Prelude.Text)
anomalySubscription_subscriptionArn :: Lens' AnomalySubscription (Maybe Text)
anomalySubscription_subscriptionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {Maybe Text
subscriptionArn :: Maybe Text
$sel:subscriptionArn:AnomalySubscription' :: AnomalySubscription -> Maybe Text
subscriptionArn} -> Maybe Text
subscriptionArn) (\s :: AnomalySubscription
s@AnomalySubscription' {} Maybe Text
a -> AnomalySubscription
s {$sel:subscriptionArn:AnomalySubscription' :: Maybe Text
subscriptionArn = Maybe Text
a} :: AnomalySubscription)
anomalySubscription_threshold :: Lens.Lens' AnomalySubscription (Prelude.Maybe Prelude.Double)
anomalySubscription_threshold :: Lens' AnomalySubscription (Maybe Double)
anomalySubscription_threshold = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {Maybe Double
threshold :: Maybe Double
$sel:threshold:AnomalySubscription' :: AnomalySubscription -> Maybe Double
threshold} -> Maybe Double
threshold) (\s :: AnomalySubscription
s@AnomalySubscription' {} Maybe Double
a -> AnomalySubscription
s {$sel:threshold:AnomalySubscription' :: Maybe Double
threshold = Maybe Double
a} :: AnomalySubscription)
anomalySubscription_thresholdExpression :: Lens.Lens' AnomalySubscription (Prelude.Maybe Expression)
anomalySubscription_thresholdExpression :: Lens' AnomalySubscription (Maybe Expression)
anomalySubscription_thresholdExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {Maybe Expression
thresholdExpression :: Maybe Expression
$sel:thresholdExpression:AnomalySubscription' :: AnomalySubscription -> Maybe Expression
thresholdExpression} -> Maybe Expression
thresholdExpression) (\s :: AnomalySubscription
s@AnomalySubscription' {} Maybe Expression
a -> AnomalySubscription
s {$sel:thresholdExpression:AnomalySubscription' :: Maybe Expression
thresholdExpression = Maybe Expression
a} :: AnomalySubscription)
anomalySubscription_monitorArnList :: Lens.Lens' AnomalySubscription [Prelude.Text]
anomalySubscription_monitorArnList :: Lens' AnomalySubscription [Text]
anomalySubscription_monitorArnList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {[Text]
monitorArnList :: [Text]
$sel:monitorArnList:AnomalySubscription' :: AnomalySubscription -> [Text]
monitorArnList} -> [Text]
monitorArnList) (\s :: AnomalySubscription
s@AnomalySubscription' {} [Text]
a -> AnomalySubscription
s {$sel:monitorArnList:AnomalySubscription' :: [Text]
monitorArnList = [Text]
a} :: AnomalySubscription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
anomalySubscription_subscribers :: Lens.Lens' AnomalySubscription [Subscriber]
anomalySubscription_subscribers :: Lens' AnomalySubscription [Subscriber]
anomalySubscription_subscribers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {[Subscriber]
subscribers :: [Subscriber]
$sel:subscribers:AnomalySubscription' :: AnomalySubscription -> [Subscriber]
subscribers} -> [Subscriber]
subscribers) (\s :: AnomalySubscription
s@AnomalySubscription' {} [Subscriber]
a -> AnomalySubscription
s {$sel:subscribers:AnomalySubscription' :: [Subscriber]
subscribers = [Subscriber]
a} :: AnomalySubscription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
anomalySubscription_frequency :: Lens.Lens' AnomalySubscription AnomalySubscriptionFrequency
anomalySubscription_frequency :: Lens' AnomalySubscription AnomalySubscriptionFrequency
anomalySubscription_frequency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {AnomalySubscriptionFrequency
frequency :: AnomalySubscriptionFrequency
$sel:frequency:AnomalySubscription' :: AnomalySubscription -> AnomalySubscriptionFrequency
frequency} -> AnomalySubscriptionFrequency
frequency) (\s :: AnomalySubscription
s@AnomalySubscription' {} AnomalySubscriptionFrequency
a -> AnomalySubscription
s {$sel:frequency:AnomalySubscription' :: AnomalySubscriptionFrequency
frequency = AnomalySubscriptionFrequency
a} :: AnomalySubscription)
anomalySubscription_subscriptionName :: Lens.Lens' AnomalySubscription Prelude.Text
anomalySubscription_subscriptionName :: Lens' AnomalySubscription Text
anomalySubscription_subscriptionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnomalySubscription' {Text
subscriptionName :: Text
$sel:subscriptionName:AnomalySubscription' :: AnomalySubscription -> Text
subscriptionName} -> Text
subscriptionName) (\s :: AnomalySubscription
s@AnomalySubscription' {} Text
a -> AnomalySubscription
s {$sel:subscriptionName:AnomalySubscription' :: Text
subscriptionName = Text
a} :: AnomalySubscription)
instance Data.FromJSON AnomalySubscription where
parseJSON :: Value -> Parser AnomalySubscription
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AnomalySubscription"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Double
-> Maybe Expression
-> [Text]
-> [Subscriber]
-> AnomalySubscriptionFrequency
-> Text
-> AnomalySubscription
AnomalySubscription'
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
"AccountId")
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
"SubscriptionArn")
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
"Threshold")
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
"ThresholdExpression")
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
"MonitorArnList" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"Subscribers" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Frequency")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SubscriptionName")
)
instance Prelude.Hashable AnomalySubscription where
hashWithSalt :: Int -> AnomalySubscription -> Int
hashWithSalt Int
_salt AnomalySubscription' {[Text]
[Subscriber]
Maybe Double
Maybe Text
Maybe Expression
Text
AnomalySubscriptionFrequency
subscriptionName :: Text
frequency :: AnomalySubscriptionFrequency
subscribers :: [Subscriber]
monitorArnList :: [Text]
thresholdExpression :: Maybe Expression
threshold :: Maybe Double
subscriptionArn :: Maybe Text
accountId :: Maybe Text
$sel:subscriptionName:AnomalySubscription' :: AnomalySubscription -> Text
$sel:frequency:AnomalySubscription' :: AnomalySubscription -> AnomalySubscriptionFrequency
$sel:subscribers:AnomalySubscription' :: AnomalySubscription -> [Subscriber]
$sel:monitorArnList:AnomalySubscription' :: AnomalySubscription -> [Text]
$sel:thresholdExpression:AnomalySubscription' :: AnomalySubscription -> Maybe Expression
$sel:threshold:AnomalySubscription' :: AnomalySubscription -> Maybe Double
$sel:subscriptionArn:AnomalySubscription' :: AnomalySubscription -> Maybe Text
$sel:accountId:AnomalySubscription' :: AnomalySubscription -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subscriptionArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
threshold
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Expression
thresholdExpression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
monitorArnList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Subscriber]
subscribers
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AnomalySubscriptionFrequency
frequency
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
subscriptionName
instance Prelude.NFData AnomalySubscription where
rnf :: AnomalySubscription -> ()
rnf AnomalySubscription' {[Text]
[Subscriber]
Maybe Double
Maybe Text
Maybe Expression
Text
AnomalySubscriptionFrequency
subscriptionName :: Text
frequency :: AnomalySubscriptionFrequency
subscribers :: [Subscriber]
monitorArnList :: [Text]
thresholdExpression :: Maybe Expression
threshold :: Maybe Double
subscriptionArn :: Maybe Text
accountId :: Maybe Text
$sel:subscriptionName:AnomalySubscription' :: AnomalySubscription -> Text
$sel:frequency:AnomalySubscription' :: AnomalySubscription -> AnomalySubscriptionFrequency
$sel:subscribers:AnomalySubscription' :: AnomalySubscription -> [Subscriber]
$sel:monitorArnList:AnomalySubscription' :: AnomalySubscription -> [Text]
$sel:thresholdExpression:AnomalySubscription' :: AnomalySubscription -> Maybe Expression
$sel:threshold:AnomalySubscription' :: AnomalySubscription -> Maybe Double
$sel:subscriptionArn:AnomalySubscription' :: AnomalySubscription -> Maybe Text
$sel:accountId:AnomalySubscription' :: AnomalySubscription -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subscriptionArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
threshold
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Expression
thresholdExpression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
monitorArnList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Subscriber]
subscribers
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AnomalySubscriptionFrequency
frequency
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
subscriptionName
instance Data.ToJSON AnomalySubscription where
toJSON :: AnomalySubscription -> Value
toJSON AnomalySubscription' {[Text]
[Subscriber]
Maybe Double
Maybe Text
Maybe Expression
Text
AnomalySubscriptionFrequency
subscriptionName :: Text
frequency :: AnomalySubscriptionFrequency
subscribers :: [Subscriber]
monitorArnList :: [Text]
thresholdExpression :: Maybe Expression
threshold :: Maybe Double
subscriptionArn :: Maybe Text
accountId :: Maybe Text
$sel:subscriptionName:AnomalySubscription' :: AnomalySubscription -> Text
$sel:frequency:AnomalySubscription' :: AnomalySubscription -> AnomalySubscriptionFrequency
$sel:subscribers:AnomalySubscription' :: AnomalySubscription -> [Subscriber]
$sel:monitorArnList:AnomalySubscription' :: AnomalySubscription -> [Text]
$sel:thresholdExpression:AnomalySubscription' :: AnomalySubscription -> Maybe Expression
$sel:threshold:AnomalySubscription' :: AnomalySubscription -> Maybe Double
$sel:subscriptionArn:AnomalySubscription' :: AnomalySubscription -> Maybe Text
$sel:accountId:AnomalySubscription' :: AnomalySubscription -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"AccountId" 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 Text
accountId,
(Key
"SubscriptionArn" 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 Text
subscriptionArn,
(Key
"Threshold" 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 Double
threshold,
(Key
"ThresholdExpression" 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 Expression
thresholdExpression,
forall a. a -> Maybe a
Prelude.Just
(Key
"MonitorArnList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
monitorArnList),
forall a. a -> Maybe a
Prelude.Just (Key
"Subscribers" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Subscriber]
subscribers),
forall a. a -> Maybe a
Prelude.Just (Key
"Frequency" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AnomalySubscriptionFrequency
frequency),
forall a. a -> Maybe a
Prelude.Just
(Key
"SubscriptionName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
subscriptionName)
]
)