{-# 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.MacieV2.Types.UsageRecord where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.Types.UsageByAccount
import qualified Amazonka.Prelude as Prelude
data UsageRecord = UsageRecord'
{
UsageRecord -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
UsageRecord -> Maybe ISO8601
automatedDiscoveryFreeTrialStartDate :: Prelude.Maybe Data.ISO8601,
UsageRecord -> Maybe ISO8601
freeTrialStartDate :: Prelude.Maybe Data.ISO8601,
UsageRecord -> Maybe [UsageByAccount]
usage :: Prelude.Maybe [UsageByAccount]
}
deriving (UsageRecord -> UsageRecord -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageRecord -> UsageRecord -> Bool
$c/= :: UsageRecord -> UsageRecord -> Bool
== :: UsageRecord -> UsageRecord -> Bool
$c== :: UsageRecord -> UsageRecord -> Bool
Prelude.Eq, ReadPrec [UsageRecord]
ReadPrec UsageRecord
Int -> ReadS UsageRecord
ReadS [UsageRecord]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageRecord]
$creadListPrec :: ReadPrec [UsageRecord]
readPrec :: ReadPrec UsageRecord
$creadPrec :: ReadPrec UsageRecord
readList :: ReadS [UsageRecord]
$creadList :: ReadS [UsageRecord]
readsPrec :: Int -> ReadS UsageRecord
$creadsPrec :: Int -> ReadS UsageRecord
Prelude.Read, Int -> UsageRecord -> ShowS
[UsageRecord] -> ShowS
UsageRecord -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageRecord] -> ShowS
$cshowList :: [UsageRecord] -> ShowS
show :: UsageRecord -> String
$cshow :: UsageRecord -> String
showsPrec :: Int -> UsageRecord -> ShowS
$cshowsPrec :: Int -> UsageRecord -> ShowS
Prelude.Show, forall x. Rep UsageRecord x -> UsageRecord
forall x. UsageRecord -> Rep UsageRecord x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageRecord x -> UsageRecord
$cfrom :: forall x. UsageRecord -> Rep UsageRecord x
Prelude.Generic)
newUsageRecord ::
UsageRecord
newUsageRecord :: UsageRecord
newUsageRecord =
UsageRecord'
{ $sel:accountId:UsageRecord' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
$sel:automatedDiscoveryFreeTrialStartDate:UsageRecord' :: Maybe ISO8601
automatedDiscoveryFreeTrialStartDate =
forall a. Maybe a
Prelude.Nothing,
$sel:freeTrialStartDate:UsageRecord' :: Maybe ISO8601
freeTrialStartDate = forall a. Maybe a
Prelude.Nothing,
$sel:usage:UsageRecord' :: Maybe [UsageByAccount]
usage = forall a. Maybe a
Prelude.Nothing
}
usageRecord_accountId :: Lens.Lens' UsageRecord (Prelude.Maybe Prelude.Text)
usageRecord_accountId :: Lens' UsageRecord (Maybe Text)
usageRecord_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageRecord' {Maybe Text
accountId :: Maybe Text
$sel:accountId:UsageRecord' :: UsageRecord -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: UsageRecord
s@UsageRecord' {} Maybe Text
a -> UsageRecord
s {$sel:accountId:UsageRecord' :: Maybe Text
accountId = Maybe Text
a} :: UsageRecord)
usageRecord_automatedDiscoveryFreeTrialStartDate :: Lens.Lens' UsageRecord (Prelude.Maybe Prelude.UTCTime)
usageRecord_automatedDiscoveryFreeTrialStartDate :: Lens' UsageRecord (Maybe UTCTime)
usageRecord_automatedDiscoveryFreeTrialStartDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageRecord' {Maybe ISO8601
automatedDiscoveryFreeTrialStartDate :: Maybe ISO8601
$sel:automatedDiscoveryFreeTrialStartDate:UsageRecord' :: UsageRecord -> Maybe ISO8601
automatedDiscoveryFreeTrialStartDate} -> Maybe ISO8601
automatedDiscoveryFreeTrialStartDate) (\s :: UsageRecord
s@UsageRecord' {} Maybe ISO8601
a -> UsageRecord
s {$sel:automatedDiscoveryFreeTrialStartDate:UsageRecord' :: Maybe ISO8601
automatedDiscoveryFreeTrialStartDate = Maybe ISO8601
a} :: UsageRecord) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time
usageRecord_freeTrialStartDate :: Lens.Lens' UsageRecord (Prelude.Maybe Prelude.UTCTime)
usageRecord_freeTrialStartDate :: Lens' UsageRecord (Maybe UTCTime)
usageRecord_freeTrialStartDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageRecord' {Maybe ISO8601
freeTrialStartDate :: Maybe ISO8601
$sel:freeTrialStartDate:UsageRecord' :: UsageRecord -> Maybe ISO8601
freeTrialStartDate} -> Maybe ISO8601
freeTrialStartDate) (\s :: UsageRecord
s@UsageRecord' {} Maybe ISO8601
a -> UsageRecord
s {$sel:freeTrialStartDate:UsageRecord' :: Maybe ISO8601
freeTrialStartDate = Maybe ISO8601
a} :: UsageRecord) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time
usageRecord_usage :: Lens.Lens' UsageRecord (Prelude.Maybe [UsageByAccount])
usageRecord_usage :: Lens' UsageRecord (Maybe [UsageByAccount])
usageRecord_usage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageRecord' {Maybe [UsageByAccount]
usage :: Maybe [UsageByAccount]
$sel:usage:UsageRecord' :: UsageRecord -> Maybe [UsageByAccount]
usage} -> Maybe [UsageByAccount]
usage) (\s :: UsageRecord
s@UsageRecord' {} Maybe [UsageByAccount]
a -> UsageRecord
s {$sel:usage:UsageRecord' :: Maybe [UsageByAccount]
usage = Maybe [UsageByAccount]
a} :: UsageRecord) 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 UsageRecord where
parseJSON :: Value -> Parser UsageRecord
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"UsageRecord"
( \Object
x ->
Maybe Text
-> Maybe ISO8601
-> Maybe ISO8601
-> Maybe [UsageByAccount]
-> UsageRecord
UsageRecord'
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
"automatedDiscoveryFreeTrialStartDate")
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
"freeTrialStartDate")
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 UsageRecord where
hashWithSalt :: Int -> UsageRecord -> Int
hashWithSalt Int
_salt UsageRecord' {Maybe [UsageByAccount]
Maybe Text
Maybe ISO8601
usage :: Maybe [UsageByAccount]
freeTrialStartDate :: Maybe ISO8601
automatedDiscoveryFreeTrialStartDate :: Maybe ISO8601
accountId :: Maybe Text
$sel:usage:UsageRecord' :: UsageRecord -> Maybe [UsageByAccount]
$sel:freeTrialStartDate:UsageRecord' :: UsageRecord -> Maybe ISO8601
$sel:automatedDiscoveryFreeTrialStartDate:UsageRecord' :: UsageRecord -> Maybe ISO8601
$sel:accountId:UsageRecord' :: UsageRecord -> 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 ISO8601
automatedDiscoveryFreeTrialStartDate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
freeTrialStartDate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [UsageByAccount]
usage
instance Prelude.NFData UsageRecord where
rnf :: UsageRecord -> ()
rnf UsageRecord' {Maybe [UsageByAccount]
Maybe Text
Maybe ISO8601
usage :: Maybe [UsageByAccount]
freeTrialStartDate :: Maybe ISO8601
automatedDiscoveryFreeTrialStartDate :: Maybe ISO8601
accountId :: Maybe Text
$sel:usage:UsageRecord' :: UsageRecord -> Maybe [UsageByAccount]
$sel:freeTrialStartDate:UsageRecord' :: UsageRecord -> Maybe ISO8601
$sel:automatedDiscoveryFreeTrialStartDate:UsageRecord' :: UsageRecord -> Maybe ISO8601
$sel:accountId:UsageRecord' :: UsageRecord -> 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 ISO8601
automatedDiscoveryFreeTrialStartDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
freeTrialStartDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [UsageByAccount]
usage