{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MacieV2.Types.UsageTotal
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MacieV2.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.MacieV2.Types.Currency
import Amazonka.MacieV2.Types.UsageType
import qualified Amazonka.Prelude as Prelude

-- | Provides aggregated data for an Amazon Macie usage metric. The value for
-- the metric reports estimated usage data for an account for the preceding
-- 30 days or the current calendar month to date, depending on the time
-- period (timeRange) specified in the request.
--
-- /See:/ 'newUsageTotal' smart constructor.
data UsageTotal = UsageTotal'
  { -- | The type of currency that the value for the metric (estimatedCost) is
    -- reported in.
    UsageTotal -> Maybe Currency
currency :: Prelude.Maybe Currency,
    -- | The estimated value for the metric.
    UsageTotal -> Maybe Text
estimatedCost :: Prelude.Maybe Prelude.Text,
    -- | The name of the metric. Possible values are:
    -- AUTOMATED_OBJECT_MONITORING, to monitor S3 objects for automated
    -- sensitive data discovery; AUTOMATED_SENSITIVE_DATA_DISCOVERY, to analyze
    -- S3 objects for automated sensitive data discovery;
    -- DATA_INVENTORY_EVALUATION, to monitor S3 buckets; and,
    -- SENSITIVE_DATA_DISCOVERY, to run classification jobs.
    UsageTotal -> Maybe UsageType
type' :: Prelude.Maybe UsageType
  }
  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)

-- |
-- Create a value of 'UsageTotal' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'currency', 'usageTotal_currency' - The type of currency that the value for the metric (estimatedCost) is
-- reported in.
--
-- 'estimatedCost', 'usageTotal_estimatedCost' - The estimated value for the metric.
--
-- 'type'', 'usageTotal_type' - The name of the metric. Possible values are:
-- AUTOMATED_OBJECT_MONITORING, to monitor S3 objects for automated
-- sensitive data discovery; AUTOMATED_SENSITIVE_DATA_DISCOVERY, to analyze
-- S3 objects for automated sensitive data discovery;
-- DATA_INVENTORY_EVALUATION, to monitor S3 buckets; and,
-- SENSITIVE_DATA_DISCOVERY, to run classification jobs.
newUsageTotal ::
  UsageTotal
newUsageTotal :: UsageTotal
newUsageTotal =
  UsageTotal'
    { $sel:currency:UsageTotal' :: Maybe Currency
currency = forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedCost:UsageTotal' :: Maybe Text
estimatedCost = forall a. Maybe a
Prelude.Nothing,
      $sel:type':UsageTotal' :: Maybe UsageType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The type of currency that the value for the metric (estimatedCost) is
-- reported in.
usageTotal_currency :: Lens.Lens' UsageTotal (Prelude.Maybe Currency)
usageTotal_currency :: Lens' UsageTotal (Maybe Currency)
usageTotal_currency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageTotal' {Maybe Currency
currency :: Maybe Currency
$sel:currency:UsageTotal' :: UsageTotal -> Maybe Currency
currency} -> Maybe Currency
currency) (\s :: UsageTotal
s@UsageTotal' {} Maybe Currency
a -> UsageTotal
s {$sel:currency:UsageTotal' :: Maybe Currency
currency = Maybe Currency
a} :: UsageTotal)

-- | The estimated value for the metric.
usageTotal_estimatedCost :: Lens.Lens' UsageTotal (Prelude.Maybe Prelude.Text)
usageTotal_estimatedCost :: Lens' UsageTotal (Maybe Text)
usageTotal_estimatedCost = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageTotal' {Maybe Text
estimatedCost :: Maybe Text
$sel:estimatedCost:UsageTotal' :: UsageTotal -> Maybe Text
estimatedCost} -> Maybe Text
estimatedCost) (\s :: UsageTotal
s@UsageTotal' {} Maybe Text
a -> UsageTotal
s {$sel:estimatedCost:UsageTotal' :: Maybe Text
estimatedCost = Maybe Text
a} :: UsageTotal)

-- | The name of the metric. Possible values are:
-- AUTOMATED_OBJECT_MONITORING, to monitor S3 objects for automated
-- sensitive data discovery; AUTOMATED_SENSITIVE_DATA_DISCOVERY, to analyze
-- S3 objects for automated sensitive data discovery;
-- DATA_INVENTORY_EVALUATION, to monitor S3 buckets; and,
-- SENSITIVE_DATA_DISCOVERY, to run classification jobs.
usageTotal_type :: Lens.Lens' UsageTotal (Prelude.Maybe UsageType)
usageTotal_type :: Lens' UsageTotal (Maybe UsageType)
usageTotal_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageTotal' {Maybe UsageType
type' :: Maybe UsageType
$sel:type':UsageTotal' :: UsageTotal -> Maybe UsageType
type'} -> Maybe UsageType
type') (\s :: UsageTotal
s@UsageTotal' {} Maybe UsageType
a -> UsageTotal
s {$sel:type':UsageTotal' :: Maybe UsageType
type' = Maybe UsageType
a} :: UsageTotal)

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 Currency -> Maybe Text -> Maybe UsageType -> 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
"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
"estimatedCost")
            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 UsageTotal where
  hashWithSalt :: Int -> UsageTotal -> Int
hashWithSalt Int
_salt UsageTotal' {Maybe Text
Maybe Currency
Maybe UsageType
type' :: Maybe UsageType
estimatedCost :: Maybe Text
currency :: Maybe Currency
$sel:type':UsageTotal' :: UsageTotal -> Maybe UsageType
$sel:estimatedCost:UsageTotal' :: UsageTotal -> Maybe Text
$sel:currency:UsageTotal' :: UsageTotal -> 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 Text
estimatedCost
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UsageType
type'

instance Prelude.NFData UsageTotal where
  rnf :: UsageTotal -> ()
rnf UsageTotal' {Maybe Text
Maybe Currency
Maybe UsageType
type' :: Maybe UsageType
estimatedCost :: Maybe Text
currency :: Maybe Currency
$sel:type':UsageTotal' :: UsageTotal -> Maybe UsageType
$sel:estimatedCost:UsageTotal' :: UsageTotal -> Maybe Text
$sel:currency:UsageTotal' :: UsageTotal -> 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 Text
estimatedCost
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UsageType
type'