{-# 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.Inspector2.Types.Usage where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.Currency
import Amazonka.Inspector2.Types.UsageType
import qualified Amazonka.Prelude as Prelude
data Usage = Usage'
{
Usage -> Maybe Currency
currency :: Prelude.Maybe Currency,
Usage -> Maybe Double
estimatedMonthlyCost :: Prelude.Maybe Prelude.Double,
Usage -> Maybe Double
total :: Prelude.Maybe Prelude.Double,
Usage -> Maybe UsageType
type' :: Prelude.Maybe UsageType
}
deriving (Usage -> Usage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Usage -> Usage -> Bool
$c/= :: Usage -> Usage -> Bool
== :: Usage -> Usage -> Bool
$c== :: Usage -> Usage -> Bool
Prelude.Eq, ReadPrec [Usage]
ReadPrec Usage
Int -> ReadS Usage
ReadS [Usage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Usage]
$creadListPrec :: ReadPrec [Usage]
readPrec :: ReadPrec Usage
$creadPrec :: ReadPrec Usage
readList :: ReadS [Usage]
$creadList :: ReadS [Usage]
readsPrec :: Int -> ReadS Usage
$creadsPrec :: Int -> ReadS Usage
Prelude.Read, Int -> Usage -> ShowS
[Usage] -> ShowS
Usage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Usage] -> ShowS
$cshowList :: [Usage] -> ShowS
show :: Usage -> String
$cshow :: Usage -> String
showsPrec :: Int -> Usage -> ShowS
$cshowsPrec :: Int -> Usage -> ShowS
Prelude.Show, forall x. Rep Usage x -> Usage
forall x. Usage -> Rep Usage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Usage x -> Usage
$cfrom :: forall x. Usage -> Rep Usage x
Prelude.Generic)
newUsage ::
Usage
newUsage :: Usage
newUsage =
Usage'
{ $sel:currency:Usage' :: Maybe Currency
currency = forall a. Maybe a
Prelude.Nothing,
$sel:estimatedMonthlyCost:Usage' :: Maybe Double
estimatedMonthlyCost = forall a. Maybe a
Prelude.Nothing,
$sel:total:Usage' :: Maybe Double
total = forall a. Maybe a
Prelude.Nothing,
$sel:type':Usage' :: Maybe UsageType
type' = forall a. Maybe a
Prelude.Nothing
}
usage_currency :: Lens.Lens' Usage (Prelude.Maybe Currency)
usage_currency :: Lens' Usage (Maybe Currency)
usage_currency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Currency
currency :: Maybe Currency
$sel:currency:Usage' :: Usage -> Maybe Currency
currency} -> Maybe Currency
currency) (\s :: Usage
s@Usage' {} Maybe Currency
a -> Usage
s {$sel:currency:Usage' :: Maybe Currency
currency = Maybe Currency
a} :: Usage)
usage_estimatedMonthlyCost :: Lens.Lens' Usage (Prelude.Maybe Prelude.Double)
usage_estimatedMonthlyCost :: Lens' Usage (Maybe Double)
usage_estimatedMonthlyCost = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Double
estimatedMonthlyCost :: Maybe Double
$sel:estimatedMonthlyCost:Usage' :: Usage -> Maybe Double
estimatedMonthlyCost} -> Maybe Double
estimatedMonthlyCost) (\s :: Usage
s@Usage' {} Maybe Double
a -> Usage
s {$sel:estimatedMonthlyCost:Usage' :: Maybe Double
estimatedMonthlyCost = Maybe Double
a} :: Usage)
usage_total :: Lens.Lens' Usage (Prelude.Maybe Prelude.Double)
usage_total :: Lens' Usage (Maybe Double)
usage_total = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe Double
total :: Maybe Double
$sel:total:Usage' :: Usage -> Maybe Double
total} -> Maybe Double
total) (\s :: Usage
s@Usage' {} Maybe Double
a -> Usage
s {$sel:total:Usage' :: Maybe Double
total = Maybe Double
a} :: Usage)
usage_type :: Lens.Lens' Usage (Prelude.Maybe UsageType)
usage_type :: Lens' Usage (Maybe UsageType)
usage_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Usage' {Maybe UsageType
type' :: Maybe UsageType
$sel:type':Usage' :: Usage -> Maybe UsageType
type'} -> Maybe UsageType
type') (\s :: Usage
s@Usage' {} Maybe UsageType
a -> Usage
s {$sel:type':Usage' :: Maybe UsageType
type' = Maybe UsageType
a} :: Usage)
instance Data.FromJSON Usage where
parseJSON :: Value -> Parser Usage
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Usage"
( \Object
x ->
Maybe Currency
-> Maybe Double -> Maybe Double -> Maybe UsageType -> Usage
Usage'
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
"currency")
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
"estimatedMonthlyCost")
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
"total")
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
"type")
)
instance Prelude.Hashable Usage where
hashWithSalt :: Int -> Usage -> Int
hashWithSalt Int
_salt Usage' {Maybe Double
Maybe Currency
Maybe UsageType
type' :: Maybe UsageType
total :: Maybe Double
estimatedMonthlyCost :: Maybe Double
currency :: Maybe Currency
$sel:type':Usage' :: Usage -> Maybe UsageType
$sel:total:Usage' :: Usage -> Maybe Double
$sel:estimatedMonthlyCost:Usage' :: Usage -> Maybe Double
$sel:currency:Usage' :: Usage -> Maybe Currency
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Currency
currency
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
estimatedMonthlyCost
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
total
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UsageType
type'
instance Prelude.NFData Usage where
rnf :: Usage -> ()
rnf Usage' {Maybe Double
Maybe Currency
Maybe UsageType
type' :: Maybe UsageType
total :: Maybe Double
estimatedMonthlyCost :: Maybe Double
currency :: Maybe Currency
$sel:type':Usage' :: Usage -> Maybe UsageType
$sel:total:Usage' :: Usage -> Maybe Double
$sel:estimatedMonthlyCost:Usage' :: Usage -> Maybe Double
$sel:currency:Usage' :: Usage -> Maybe Currency
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Currency
currency
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
estimatedMonthlyCost
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
total
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UsageType
type'