{-# 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.UsageByAccount
-- 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.UsageByAccount where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.Currency
import Amazonka.MacieV2.Types.ServiceLimit
import Amazonka.MacieV2.Types.UsageType
import qualified Amazonka.Prelude as Prelude

-- | Provides data for a specific usage metric and the corresponding quota
-- for an Amazon Macie account.
--
-- /See:/ 'newUsageByAccount' smart constructor.
data UsageByAccount = UsageByAccount'
  { -- | The current value for the quota that corresponds to the metric specified
    -- by the type field.
    UsageByAccount -> Maybe ServiceLimit
serviceLimit :: Prelude.Maybe ServiceLimit,
    -- | The type of currency that the value for the metric (estimatedCost) is
    -- reported in.
    UsageByAccount -> 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.
    UsageByAccount -> Maybe UsageType
type' :: Prelude.Maybe UsageType,
    -- | The estimated value for the metric.
    UsageByAccount -> Maybe Text
estimatedCost :: Prelude.Maybe Prelude.Text
  }
  deriving (UsageByAccount -> UsageByAccount -> Bool
(UsageByAccount -> UsageByAccount -> Bool)
-> (UsageByAccount -> UsageByAccount -> Bool) -> Eq UsageByAccount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageByAccount -> UsageByAccount -> Bool
$c/= :: UsageByAccount -> UsageByAccount -> Bool
== :: UsageByAccount -> UsageByAccount -> Bool
$c== :: UsageByAccount -> UsageByAccount -> Bool
Prelude.Eq, ReadPrec [UsageByAccount]
ReadPrec UsageByAccount
Int -> ReadS UsageByAccount
ReadS [UsageByAccount]
(Int -> ReadS UsageByAccount)
-> ReadS [UsageByAccount]
-> ReadPrec UsageByAccount
-> ReadPrec [UsageByAccount]
-> Read UsageByAccount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageByAccount]
$creadListPrec :: ReadPrec [UsageByAccount]
readPrec :: ReadPrec UsageByAccount
$creadPrec :: ReadPrec UsageByAccount
readList :: ReadS [UsageByAccount]
$creadList :: ReadS [UsageByAccount]
readsPrec :: Int -> ReadS UsageByAccount
$creadsPrec :: Int -> ReadS UsageByAccount
Prelude.Read, Int -> UsageByAccount -> ShowS
[UsageByAccount] -> ShowS
UsageByAccount -> String
(Int -> UsageByAccount -> ShowS)
-> (UsageByAccount -> String)
-> ([UsageByAccount] -> ShowS)
-> Show UsageByAccount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageByAccount] -> ShowS
$cshowList :: [UsageByAccount] -> ShowS
show :: UsageByAccount -> String
$cshow :: UsageByAccount -> String
showsPrec :: Int -> UsageByAccount -> ShowS
$cshowsPrec :: Int -> UsageByAccount -> ShowS
Prelude.Show, (forall x. UsageByAccount -> Rep UsageByAccount x)
-> (forall x. Rep UsageByAccount x -> UsageByAccount)
-> Generic UsageByAccount
forall x. Rep UsageByAccount x -> UsageByAccount
forall x. UsageByAccount -> Rep UsageByAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageByAccount x -> UsageByAccount
$cfrom :: forall x. UsageByAccount -> Rep UsageByAccount x
Prelude.Generic)

-- |
-- Create a value of 'UsageByAccount' 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:
--
-- 'serviceLimit', 'usageByAccount_serviceLimit' - The current value for the quota that corresponds to the metric specified
-- by the type field.
--
-- 'currency', 'usageByAccount_currency' - The type of currency that the value for the metric (estimatedCost) is
-- reported in.
--
-- 'type'', 'usageByAccount_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', 'usageByAccount_estimatedCost' - The estimated value for the metric.
newUsageByAccount ::
  UsageByAccount
newUsageByAccount :: UsageByAccount
newUsageByAccount =
  UsageByAccount' :: Maybe ServiceLimit
-> Maybe Currency
-> Maybe UsageType
-> Maybe Text
-> UsageByAccount
UsageByAccount'
    { $sel:serviceLimit:UsageByAccount' :: Maybe ServiceLimit
serviceLimit = Maybe ServiceLimit
forall a. Maybe a
Prelude.Nothing,
      $sel:currency:UsageByAccount' :: Maybe Currency
currency = Maybe Currency
forall a. Maybe a
Prelude.Nothing,
      $sel:type':UsageByAccount' :: Maybe UsageType
type' = Maybe UsageType
forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedCost:UsageByAccount' :: Maybe Text
estimatedCost = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current value for the quota that corresponds to the metric specified
-- by the type field.
usageByAccount_serviceLimit :: Lens.Lens' UsageByAccount (Prelude.Maybe ServiceLimit)
usageByAccount_serviceLimit :: (Maybe ServiceLimit -> f (Maybe ServiceLimit))
-> UsageByAccount -> f UsageByAccount
usageByAccount_serviceLimit = (UsageByAccount -> Maybe ServiceLimit)
-> (UsageByAccount -> Maybe ServiceLimit -> UsageByAccount)
-> Lens
     UsageByAccount
     UsageByAccount
     (Maybe ServiceLimit)
     (Maybe ServiceLimit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageByAccount' {Maybe ServiceLimit
serviceLimit :: Maybe ServiceLimit
$sel:serviceLimit:UsageByAccount' :: UsageByAccount -> Maybe ServiceLimit
serviceLimit} -> Maybe ServiceLimit
serviceLimit) (\s :: UsageByAccount
s@UsageByAccount' {} Maybe ServiceLimit
a -> UsageByAccount
s {$sel:serviceLimit:UsageByAccount' :: Maybe ServiceLimit
serviceLimit = Maybe ServiceLimit
a} :: UsageByAccount)

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

-- | 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.
usageByAccount_type :: Lens.Lens' UsageByAccount (Prelude.Maybe UsageType)
usageByAccount_type :: (Maybe UsageType -> f (Maybe UsageType))
-> UsageByAccount -> f UsageByAccount
usageByAccount_type = (UsageByAccount -> Maybe UsageType)
-> (UsageByAccount -> Maybe UsageType -> UsageByAccount)
-> Lens
     UsageByAccount UsageByAccount (Maybe UsageType) (Maybe UsageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageByAccount' {Maybe UsageType
type' :: Maybe UsageType
$sel:type':UsageByAccount' :: UsageByAccount -> Maybe UsageType
type'} -> Maybe UsageType
type') (\s :: UsageByAccount
s@UsageByAccount' {} Maybe UsageType
a -> UsageByAccount
s {$sel:type':UsageByAccount' :: Maybe UsageType
type' = Maybe UsageType
a} :: UsageByAccount)

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

instance Core.FromJSON UsageByAccount where
  parseJSON :: Value -> Parser UsageByAccount
parseJSON =
    String
-> (Object -> Parser UsageByAccount)
-> Value
-> Parser UsageByAccount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UsageByAccount"
      ( \Object
x ->
          Maybe ServiceLimit
-> Maybe Currency
-> Maybe UsageType
-> Maybe Text
-> UsageByAccount
UsageByAccount'
            (Maybe ServiceLimit
 -> Maybe Currency
 -> Maybe UsageType
 -> Maybe Text
 -> UsageByAccount)
-> Parser (Maybe ServiceLimit)
-> Parser
     (Maybe Currency -> Maybe UsageType -> Maybe Text -> UsageByAccount)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ServiceLimit)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"serviceLimit")
            Parser
  (Maybe Currency -> Maybe UsageType -> Maybe Text -> UsageByAccount)
-> Parser (Maybe Currency)
-> Parser (Maybe UsageType -> Maybe Text -> UsageByAccount)
forall (f :: * -> *) a b. Applicative f => 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 -> UsageByAccount)
-> Parser (Maybe UsageType)
-> Parser (Maybe Text -> UsageByAccount)
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 -> UsageByAccount)
-> Parser (Maybe Text) -> Parser UsageByAccount
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 UsageByAccount

instance Prelude.NFData UsageByAccount