{-# 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.RootCause where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RootCause = RootCause'
{
RootCause -> Maybe Text
service :: Prelude.Maybe Prelude.Text,
RootCause -> Maybe Text
usageType :: Prelude.Maybe Prelude.Text,
RootCause -> Maybe Text
linkedAccount :: Prelude.Maybe Prelude.Text,
RootCause -> Maybe Text
region :: Prelude.Maybe Prelude.Text
}
deriving (RootCause -> RootCause -> Bool
(RootCause -> RootCause -> Bool)
-> (RootCause -> RootCause -> Bool) -> Eq RootCause
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RootCause -> RootCause -> Bool
$c/= :: RootCause -> RootCause -> Bool
== :: RootCause -> RootCause -> Bool
$c== :: RootCause -> RootCause -> Bool
Prelude.Eq, ReadPrec [RootCause]
ReadPrec RootCause
Int -> ReadS RootCause
ReadS [RootCause]
(Int -> ReadS RootCause)
-> ReadS [RootCause]
-> ReadPrec RootCause
-> ReadPrec [RootCause]
-> Read RootCause
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RootCause]
$creadListPrec :: ReadPrec [RootCause]
readPrec :: ReadPrec RootCause
$creadPrec :: ReadPrec RootCause
readList :: ReadS [RootCause]
$creadList :: ReadS [RootCause]
readsPrec :: Int -> ReadS RootCause
$creadsPrec :: Int -> ReadS RootCause
Prelude.Read, Int -> RootCause -> ShowS
[RootCause] -> ShowS
RootCause -> String
(Int -> RootCause -> ShowS)
-> (RootCause -> String)
-> ([RootCause] -> ShowS)
-> Show RootCause
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RootCause] -> ShowS
$cshowList :: [RootCause] -> ShowS
show :: RootCause -> String
$cshow :: RootCause -> String
showsPrec :: Int -> RootCause -> ShowS
$cshowsPrec :: Int -> RootCause -> ShowS
Prelude.Show, (forall x. RootCause -> Rep RootCause x)
-> (forall x. Rep RootCause x -> RootCause) -> Generic RootCause
forall x. Rep RootCause x -> RootCause
forall x. RootCause -> Rep RootCause x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RootCause x -> RootCause
$cfrom :: forall x. RootCause -> Rep RootCause x
Prelude.Generic)
newRootCause ::
RootCause
newRootCause :: RootCause
newRootCause =
RootCause' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> RootCause
RootCause'
{ $sel:service:RootCause' :: Maybe Text
service = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:usageType:RootCause' :: Maybe Text
usageType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:linkedAccount:RootCause' :: Maybe Text
linkedAccount = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:region:RootCause' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
rootCause_service :: Lens.Lens' RootCause (Prelude.Maybe Prelude.Text)
rootCause_service :: (Maybe Text -> f (Maybe Text)) -> RootCause -> f RootCause
rootCause_service = (RootCause -> Maybe Text)
-> (RootCause -> Maybe Text -> RootCause)
-> Lens RootCause RootCause (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RootCause' {Maybe Text
service :: Maybe Text
$sel:service:RootCause' :: RootCause -> Maybe Text
service} -> Maybe Text
service) (\s :: RootCause
s@RootCause' {} Maybe Text
a -> RootCause
s {$sel:service:RootCause' :: Maybe Text
service = Maybe Text
a} :: RootCause)
rootCause_usageType :: Lens.Lens' RootCause (Prelude.Maybe Prelude.Text)
rootCause_usageType :: (Maybe Text -> f (Maybe Text)) -> RootCause -> f RootCause
rootCause_usageType = (RootCause -> Maybe Text)
-> (RootCause -> Maybe Text -> RootCause)
-> Lens RootCause RootCause (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RootCause' {Maybe Text
usageType :: Maybe Text
$sel:usageType:RootCause' :: RootCause -> Maybe Text
usageType} -> Maybe Text
usageType) (\s :: RootCause
s@RootCause' {} Maybe Text
a -> RootCause
s {$sel:usageType:RootCause' :: Maybe Text
usageType = Maybe Text
a} :: RootCause)
rootCause_linkedAccount :: Lens.Lens' RootCause (Prelude.Maybe Prelude.Text)
rootCause_linkedAccount :: (Maybe Text -> f (Maybe Text)) -> RootCause -> f RootCause
rootCause_linkedAccount = (RootCause -> Maybe Text)
-> (RootCause -> Maybe Text -> RootCause)
-> Lens RootCause RootCause (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RootCause' {Maybe Text
linkedAccount :: Maybe Text
$sel:linkedAccount:RootCause' :: RootCause -> Maybe Text
linkedAccount} -> Maybe Text
linkedAccount) (\s :: RootCause
s@RootCause' {} Maybe Text
a -> RootCause
s {$sel:linkedAccount:RootCause' :: Maybe Text
linkedAccount = Maybe Text
a} :: RootCause)
rootCause_region :: Lens.Lens' RootCause (Prelude.Maybe Prelude.Text)
rootCause_region :: (Maybe Text -> f (Maybe Text)) -> RootCause -> f RootCause
rootCause_region = (RootCause -> Maybe Text)
-> (RootCause -> Maybe Text -> RootCause)
-> Lens RootCause RootCause (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RootCause' {Maybe Text
region :: Maybe Text
$sel:region:RootCause' :: RootCause -> Maybe Text
region} -> Maybe Text
region) (\s :: RootCause
s@RootCause' {} Maybe Text
a -> RootCause
s {$sel:region:RootCause' :: Maybe Text
region = Maybe Text
a} :: RootCause)
instance Core.FromJSON RootCause where
parseJSON :: Value -> Parser RootCause
parseJSON =
String -> (Object -> Parser RootCause) -> Value -> Parser RootCause
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RootCause"
( \Object
x ->
Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> RootCause
RootCause'
(Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> RootCause)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> RootCause)
forall (f :: * -> *) a b. Functor 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
"Service")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> RootCause)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> RootCause)
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
"UsageType")
Parser (Maybe Text -> Maybe Text -> RootCause)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RootCause)
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
"LinkedAccount")
Parser (Maybe Text -> RootCause)
-> Parser (Maybe Text) -> Parser RootCause
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
"Region")
)
instance Prelude.Hashable RootCause
instance Prelude.NFData RootCause