{-# 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.ComputeOptimizer.Types.Summary where
import Amazonka.ComputeOptimizer.Types.Finding
import Amazonka.ComputeOptimizer.Types.ReasonCodeSummary
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Summary = Summary'
{
Summary -> Maybe [ReasonCodeSummary]
reasonCodeSummaries :: Prelude.Maybe [ReasonCodeSummary],
Summary -> Maybe Double
value :: Prelude.Maybe Prelude.Double,
Summary -> Maybe Finding
name :: Prelude.Maybe Finding
}
deriving (Summary -> Summary -> Bool
(Summary -> Summary -> Bool)
-> (Summary -> Summary -> Bool) -> Eq Summary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Summary -> Summary -> Bool
$c/= :: Summary -> Summary -> Bool
== :: Summary -> Summary -> Bool
$c== :: Summary -> Summary -> Bool
Prelude.Eq, ReadPrec [Summary]
ReadPrec Summary
Int -> ReadS Summary
ReadS [Summary]
(Int -> ReadS Summary)
-> ReadS [Summary]
-> ReadPrec Summary
-> ReadPrec [Summary]
-> Read Summary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Summary]
$creadListPrec :: ReadPrec [Summary]
readPrec :: ReadPrec Summary
$creadPrec :: ReadPrec Summary
readList :: ReadS [Summary]
$creadList :: ReadS [Summary]
readsPrec :: Int -> ReadS Summary
$creadsPrec :: Int -> ReadS Summary
Prelude.Read, Int -> Summary -> ShowS
[Summary] -> ShowS
Summary -> String
(Int -> Summary -> ShowS)
-> (Summary -> String) -> ([Summary] -> ShowS) -> Show Summary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Summary] -> ShowS
$cshowList :: [Summary] -> ShowS
show :: Summary -> String
$cshow :: Summary -> String
showsPrec :: Int -> Summary -> ShowS
$cshowsPrec :: Int -> Summary -> ShowS
Prelude.Show, (forall x. Summary -> Rep Summary x)
-> (forall x. Rep Summary x -> Summary) -> Generic Summary
forall x. Rep Summary x -> Summary
forall x. Summary -> Rep Summary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Summary x -> Summary
$cfrom :: forall x. Summary -> Rep Summary x
Prelude.Generic)
newSummary ::
Summary
newSummary :: Summary
newSummary =
Summary' :: Maybe [ReasonCodeSummary]
-> Maybe Double -> Maybe Finding -> Summary
Summary'
{ $sel:reasonCodeSummaries:Summary' :: Maybe [ReasonCodeSummary]
reasonCodeSummaries = Maybe [ReasonCodeSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:value:Summary' :: Maybe Double
value = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:name:Summary' :: Maybe Finding
name = Maybe Finding
forall a. Maybe a
Prelude.Nothing
}
summary_reasonCodeSummaries :: Lens.Lens' Summary (Prelude.Maybe [ReasonCodeSummary])
summary_reasonCodeSummaries :: (Maybe [ReasonCodeSummary] -> f (Maybe [ReasonCodeSummary]))
-> Summary -> f Summary
summary_reasonCodeSummaries = (Summary -> Maybe [ReasonCodeSummary])
-> (Summary -> Maybe [ReasonCodeSummary] -> Summary)
-> Lens
Summary
Summary
(Maybe [ReasonCodeSummary])
(Maybe [ReasonCodeSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe [ReasonCodeSummary]
reasonCodeSummaries :: Maybe [ReasonCodeSummary]
$sel:reasonCodeSummaries:Summary' :: Summary -> Maybe [ReasonCodeSummary]
reasonCodeSummaries} -> Maybe [ReasonCodeSummary]
reasonCodeSummaries) (\s :: Summary
s@Summary' {} Maybe [ReasonCodeSummary]
a -> Summary
s {$sel:reasonCodeSummaries:Summary' :: Maybe [ReasonCodeSummary]
reasonCodeSummaries = Maybe [ReasonCodeSummary]
a} :: Summary) ((Maybe [ReasonCodeSummary] -> f (Maybe [ReasonCodeSummary]))
-> Summary -> f Summary)
-> ((Maybe [ReasonCodeSummary] -> f (Maybe [ReasonCodeSummary]))
-> Maybe [ReasonCodeSummary] -> f (Maybe [ReasonCodeSummary]))
-> (Maybe [ReasonCodeSummary] -> f (Maybe [ReasonCodeSummary]))
-> Summary
-> f Summary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ReasonCodeSummary]
[ReasonCodeSummary]
[ReasonCodeSummary]
[ReasonCodeSummary]
-> Iso
(Maybe [ReasonCodeSummary])
(Maybe [ReasonCodeSummary])
(Maybe [ReasonCodeSummary])
(Maybe [ReasonCodeSummary])
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 AnIso
[ReasonCodeSummary]
[ReasonCodeSummary]
[ReasonCodeSummary]
[ReasonCodeSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
summary_value :: Lens.Lens' Summary (Prelude.Maybe Prelude.Double)
summary_value :: (Maybe Double -> f (Maybe Double)) -> Summary -> f Summary
summary_value = (Summary -> Maybe Double)
-> (Summary -> Maybe Double -> Summary)
-> Lens Summary Summary (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Double
value :: Maybe Double
$sel:value:Summary' :: Summary -> Maybe Double
value} -> Maybe Double
value) (\s :: Summary
s@Summary' {} Maybe Double
a -> Summary
s {$sel:value:Summary' :: Maybe Double
value = Maybe Double
a} :: Summary)
summary_name :: Lens.Lens' Summary (Prelude.Maybe Finding)
summary_name :: (Maybe Finding -> f (Maybe Finding)) -> Summary -> f Summary
summary_name = (Summary -> Maybe Finding)
-> (Summary -> Maybe Finding -> Summary)
-> Lens Summary Summary (Maybe Finding) (Maybe Finding)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Summary' {Maybe Finding
name :: Maybe Finding
$sel:name:Summary' :: Summary -> Maybe Finding
name} -> Maybe Finding
name) (\s :: Summary
s@Summary' {} Maybe Finding
a -> Summary
s {$sel:name:Summary' :: Maybe Finding
name = Maybe Finding
a} :: Summary)
instance Core.FromJSON Summary where
parseJSON :: Value -> Parser Summary
parseJSON =
String -> (Object -> Parser Summary) -> Value -> Parser Summary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Summary"
( \Object
x ->
Maybe [ReasonCodeSummary]
-> Maybe Double -> Maybe Finding -> Summary
Summary'
(Maybe [ReasonCodeSummary]
-> Maybe Double -> Maybe Finding -> Summary)
-> Parser (Maybe [ReasonCodeSummary])
-> Parser (Maybe Double -> Maybe Finding -> Summary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [ReasonCodeSummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"reasonCodeSummaries"
Parser (Maybe (Maybe [ReasonCodeSummary]))
-> Maybe [ReasonCodeSummary] -> Parser (Maybe [ReasonCodeSummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ReasonCodeSummary]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe Double -> Maybe Finding -> Summary)
-> Parser (Maybe Double) -> Parser (Maybe Finding -> Summary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"value")
Parser (Maybe Finding -> Summary)
-> Parser (Maybe Finding) -> Parser Summary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Finding)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
)
instance Prelude.Hashable Summary
instance Prelude.NFData Summary