{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MacieV2.Types.UsageTotal where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 name of the metric. Possible values are: DATA_INVENTORY_EVALUATION,
    -- for monitoring S3 buckets; and, SENSITIVE_DATA_DISCOVERY, for analyzing
    -- S3 objects to detect sensitive data.
    UsageTotal -> Maybe UsageType
type' :: Prelude.Maybe UsageType,
    -- | The estimated value for the metric.
    UsageTotal -> Maybe Text
estimatedCost :: Prelude.Maybe Prelude.Text
  }
  deriving (UsageTotal -> UsageTotal -> Bool
(UsageTotal -> UsageTotal -> Bool)
-> (UsageTotal -> UsageTotal -> Bool) -> Eq UsageTotal
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]
(Int -> ReadS UsageTotal)
-> ReadS [UsageTotal]
-> ReadPrec UsageTotal
-> ReadPrec [UsageTotal]
-> Read 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
(Int -> UsageTotal -> ShowS)
-> (UsageTotal -> String)
-> ([UsageTotal] -> ShowS)
-> Show UsageTotal
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. UsageTotal -> Rep UsageTotal x)
-> (forall x. Rep UsageTotal x -> UsageTotal) -> Generic UsageTotal
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.
--
-- 'type'', 'usageTotal_type' - The name of the metric. Possible values are: DATA_INVENTORY_EVALUATION,
-- for monitoring S3 buckets; and, SENSITIVE_DATA_DISCOVERY, for analyzing
-- S3 objects to detect sensitive data.
--
-- 'estimatedCost', 'usageTotal_estimatedCost' - The estimated value for the metric.
newUsageTotal ::
  UsageTotal
newUsageTotal :: UsageTotal
newUsageTotal =
  UsageTotal' :: Maybe Currency -> Maybe UsageType -> Maybe Text -> UsageTotal
UsageTotal'
    { $sel:currency:UsageTotal' :: Maybe Currency
currency = Maybe Currency
forall a. Maybe a
Prelude.Nothing,
      $sel:type':UsageTotal' :: Maybe UsageType
type' = Maybe UsageType
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedCost:UsageTotal' :: Maybe Text
estimatedCost = Maybe Text
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 :: (Maybe Currency -> f (Maybe Currency))
-> UsageTotal -> f UsageTotal
usageTotal_currency = (UsageTotal -> Maybe Currency)
-> (UsageTotal -> Maybe Currency -> UsageTotal)
-> Lens UsageTotal UsageTotal (Maybe Currency) (Maybe 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 name of the metric. Possible values are: DATA_INVENTORY_EVALUATION,
-- for monitoring S3 buckets; and, SENSITIVE_DATA_DISCOVERY, for analyzing
-- S3 objects to detect sensitive data.
usageTotal_type :: Lens.Lens' UsageTotal (Prelude.Maybe UsageType)
usageTotal_type :: (Maybe UsageType -> f (Maybe UsageType))
-> UsageTotal -> f UsageTotal
usageTotal_type = (UsageTotal -> Maybe UsageType)
-> (UsageTotal -> Maybe UsageType -> UsageTotal)
-> Lens UsageTotal UsageTotal (Maybe UsageType) (Maybe UsageType)
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)

-- | The estimated value for the metric.
usageTotal_estimatedCost :: Lens.Lens' UsageTotal (Prelude.Maybe Prelude.Text)
usageTotal_estimatedCost :: (Maybe Text -> f (Maybe Text)) -> UsageTotal -> f UsageTotal
usageTotal_estimatedCost = (UsageTotal -> Maybe Text)
-> (UsageTotal -> Maybe Text -> UsageTotal)
-> Lens UsageTotal UsageTotal (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON UsageTotal where
  parseJSON :: Value -> Parser UsageTotal
parseJSON =
    String
-> (Object -> Parser UsageTotal) -> Value -> Parser UsageTotal
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UsageTotal"
      ( \Object
x ->
          Maybe Currency -> Maybe UsageType -> Maybe Text -> UsageTotal
UsageTotal'
            (Maybe Currency -> Maybe UsageType -> Maybe Text -> UsageTotal)
-> Parser (Maybe Currency)
-> Parser (Maybe UsageType -> Maybe Text -> UsageTotal)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Currency)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"currency")
            Parser (Maybe UsageType -> Maybe Text -> UsageTotal)
-> Parser (Maybe UsageType) -> Parser (Maybe Text -> UsageTotal)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UsageType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser (Maybe Text -> UsageTotal)
-> Parser (Maybe Text) -> Parser UsageTotal
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"estimatedCost")
      )

instance Prelude.Hashable UsageTotal

instance Prelude.NFData UsageTotal