{-# 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.UsageTotal 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.Usage
import qualified Amazonka.Prelude as Prelude
data UsageTotal = UsageTotal'
{
UsageTotal -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
UsageTotal -> Maybe [Usage]
usage :: Prelude.Maybe [Usage]
}
deriving (UsageTotal -> UsageTotal -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageTotal -> UsageTotal -> Bool
$c/= :: UsageTotal -> UsageTotal -> Bool
== :: UsageTotal -> UsageTotal -> Bool
$c== :: UsageTotal -> UsageTotal -> Bool
Prelude.Eq, ReadPrec [UsageTotal]
ReadPrec UsageTotal
Int -> ReadS UsageTotal
ReadS [UsageTotal]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageTotal]
$creadListPrec :: ReadPrec [UsageTotal]
readPrec :: ReadPrec UsageTotal
$creadPrec :: ReadPrec UsageTotal
readList :: ReadS [UsageTotal]
$creadList :: ReadS [UsageTotal]
readsPrec :: Int -> ReadS UsageTotal
$creadsPrec :: Int -> ReadS UsageTotal
Prelude.Read, Int -> UsageTotal -> ShowS
[UsageTotal] -> ShowS
UsageTotal -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageTotal] -> ShowS
$cshowList :: [UsageTotal] -> ShowS
show :: UsageTotal -> String
$cshow :: UsageTotal -> String
showsPrec :: Int -> UsageTotal -> ShowS
$cshowsPrec :: Int -> UsageTotal -> ShowS
Prelude.Show, forall x. Rep UsageTotal x -> UsageTotal
forall x. UsageTotal -> Rep UsageTotal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageTotal x -> UsageTotal
$cfrom :: forall x. UsageTotal -> Rep UsageTotal x
Prelude.Generic)
newUsageTotal ::
UsageTotal
newUsageTotal :: UsageTotal
newUsageTotal =
UsageTotal'
{ $sel:accountId:UsageTotal' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
$sel:usage:UsageTotal' :: Maybe [Usage]
usage = forall a. Maybe a
Prelude.Nothing
}
usageTotal_accountId :: Lens.Lens' UsageTotal (Prelude.Maybe Prelude.Text)
usageTotal_accountId :: Lens' UsageTotal (Maybe Text)
usageTotal_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageTotal' {Maybe Text
accountId :: Maybe Text
$sel:accountId:UsageTotal' :: UsageTotal -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: UsageTotal
s@UsageTotal' {} Maybe Text
a -> UsageTotal
s {$sel:accountId:UsageTotal' :: Maybe Text
accountId = Maybe Text
a} :: UsageTotal)
usageTotal_usage :: Lens.Lens' UsageTotal (Prelude.Maybe [Usage])
usageTotal_usage :: Lens' UsageTotal (Maybe [Usage])
usageTotal_usage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageTotal' {Maybe [Usage]
usage :: Maybe [Usage]
$sel:usage:UsageTotal' :: UsageTotal -> Maybe [Usage]
usage} -> Maybe [Usage]
usage) (\s :: UsageTotal
s@UsageTotal' {} Maybe [Usage]
a -> UsageTotal
s {$sel:usage:UsageTotal' :: Maybe [Usage]
usage = Maybe [Usage]
a} :: UsageTotal) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON UsageTotal where
parseJSON :: Value -> Parser UsageTotal
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"UsageTotal"
( \Object
x ->
Maybe Text -> Maybe [Usage] -> UsageTotal
UsageTotal'
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
"usage" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable UsageTotal where
hashWithSalt :: Int -> UsageTotal -> Int
hashWithSalt Int
_salt UsageTotal' {Maybe [Usage]
Maybe Text
usage :: Maybe [Usage]
accountId :: Maybe Text
$sel:usage:UsageTotal' :: UsageTotal -> Maybe [Usage]
$sel:accountId:UsageTotal' :: UsageTotal -> 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 [Usage]
usage
instance Prelude.NFData UsageTotal where
rnf :: UsageTotal -> ()
rnf UsageTotal' {Maybe [Usage]
Maybe Text
usage :: Maybe [Usage]
accountId :: Maybe Text
$sel:usage:UsageTotal' :: UsageTotal -> Maybe [Usage]
$sel:accountId:UsageTotal' :: UsageTotal -> 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 [Usage]
usage