{-# 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.SecurityHub.Types.AwsDynamoDbTableBillingModeSummary
-- 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.SecurityHub.Types.AwsDynamoDbTableBillingModeSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the billing for read\/write capacity on the
-- table.
--
-- /See:/ 'newAwsDynamoDbTableBillingModeSummary' smart constructor.
data AwsDynamoDbTableBillingModeSummary = AwsDynamoDbTableBillingModeSummary'
  { -- | If the billing mode is @PAY_PER_REQUEST@, indicates when the billing
    -- mode was set to that value.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsDynamoDbTableBillingModeSummary -> Maybe Text
lastUpdateToPayPerRequestDateTime :: Prelude.Maybe Prelude.Text,
    -- | The method used to charge for read and write throughput and to manage
    -- capacity.
    AwsDynamoDbTableBillingModeSummary -> Maybe Text
billingMode :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsDynamoDbTableBillingModeSummary
-> AwsDynamoDbTableBillingModeSummary -> Bool
(AwsDynamoDbTableBillingModeSummary
 -> AwsDynamoDbTableBillingModeSummary -> Bool)
-> (AwsDynamoDbTableBillingModeSummary
    -> AwsDynamoDbTableBillingModeSummary -> Bool)
-> Eq AwsDynamoDbTableBillingModeSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsDynamoDbTableBillingModeSummary
-> AwsDynamoDbTableBillingModeSummary -> Bool
$c/= :: AwsDynamoDbTableBillingModeSummary
-> AwsDynamoDbTableBillingModeSummary -> Bool
== :: AwsDynamoDbTableBillingModeSummary
-> AwsDynamoDbTableBillingModeSummary -> Bool
$c== :: AwsDynamoDbTableBillingModeSummary
-> AwsDynamoDbTableBillingModeSummary -> Bool
Prelude.Eq, ReadPrec [AwsDynamoDbTableBillingModeSummary]
ReadPrec AwsDynamoDbTableBillingModeSummary
Int -> ReadS AwsDynamoDbTableBillingModeSummary
ReadS [AwsDynamoDbTableBillingModeSummary]
(Int -> ReadS AwsDynamoDbTableBillingModeSummary)
-> ReadS [AwsDynamoDbTableBillingModeSummary]
-> ReadPrec AwsDynamoDbTableBillingModeSummary
-> ReadPrec [AwsDynamoDbTableBillingModeSummary]
-> Read AwsDynamoDbTableBillingModeSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsDynamoDbTableBillingModeSummary]
$creadListPrec :: ReadPrec [AwsDynamoDbTableBillingModeSummary]
readPrec :: ReadPrec AwsDynamoDbTableBillingModeSummary
$creadPrec :: ReadPrec AwsDynamoDbTableBillingModeSummary
readList :: ReadS [AwsDynamoDbTableBillingModeSummary]
$creadList :: ReadS [AwsDynamoDbTableBillingModeSummary]
readsPrec :: Int -> ReadS AwsDynamoDbTableBillingModeSummary
$creadsPrec :: Int -> ReadS AwsDynamoDbTableBillingModeSummary
Prelude.Read, Int -> AwsDynamoDbTableBillingModeSummary -> ShowS
[AwsDynamoDbTableBillingModeSummary] -> ShowS
AwsDynamoDbTableBillingModeSummary -> String
(Int -> AwsDynamoDbTableBillingModeSummary -> ShowS)
-> (AwsDynamoDbTableBillingModeSummary -> String)
-> ([AwsDynamoDbTableBillingModeSummary] -> ShowS)
-> Show AwsDynamoDbTableBillingModeSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsDynamoDbTableBillingModeSummary] -> ShowS
$cshowList :: [AwsDynamoDbTableBillingModeSummary] -> ShowS
show :: AwsDynamoDbTableBillingModeSummary -> String
$cshow :: AwsDynamoDbTableBillingModeSummary -> String
showsPrec :: Int -> AwsDynamoDbTableBillingModeSummary -> ShowS
$cshowsPrec :: Int -> AwsDynamoDbTableBillingModeSummary -> ShowS
Prelude.Show, (forall x.
 AwsDynamoDbTableBillingModeSummary
 -> Rep AwsDynamoDbTableBillingModeSummary x)
-> (forall x.
    Rep AwsDynamoDbTableBillingModeSummary x
    -> AwsDynamoDbTableBillingModeSummary)
-> Generic AwsDynamoDbTableBillingModeSummary
forall x.
Rep AwsDynamoDbTableBillingModeSummary x
-> AwsDynamoDbTableBillingModeSummary
forall x.
AwsDynamoDbTableBillingModeSummary
-> Rep AwsDynamoDbTableBillingModeSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsDynamoDbTableBillingModeSummary x
-> AwsDynamoDbTableBillingModeSummary
$cfrom :: forall x.
AwsDynamoDbTableBillingModeSummary
-> Rep AwsDynamoDbTableBillingModeSummary x
Prelude.Generic)

-- |
-- Create a value of 'AwsDynamoDbTableBillingModeSummary' 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:
--
-- 'lastUpdateToPayPerRequestDateTime', 'awsDynamoDbTableBillingModeSummary_lastUpdateToPayPerRequestDateTime' - If the billing mode is @PAY_PER_REQUEST@, indicates when the billing
-- mode was set to that value.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'billingMode', 'awsDynamoDbTableBillingModeSummary_billingMode' - The method used to charge for read and write throughput and to manage
-- capacity.
newAwsDynamoDbTableBillingModeSummary ::
  AwsDynamoDbTableBillingModeSummary
newAwsDynamoDbTableBillingModeSummary :: AwsDynamoDbTableBillingModeSummary
newAwsDynamoDbTableBillingModeSummary =
  AwsDynamoDbTableBillingModeSummary' :: Maybe Text -> Maybe Text -> AwsDynamoDbTableBillingModeSummary
AwsDynamoDbTableBillingModeSummary'
    { $sel:lastUpdateToPayPerRequestDateTime:AwsDynamoDbTableBillingModeSummary' :: Maybe Text
lastUpdateToPayPerRequestDateTime =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:billingMode:AwsDynamoDbTableBillingModeSummary' :: Maybe Text
billingMode = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If the billing mode is @PAY_PER_REQUEST@, indicates when the billing
-- mode was set to that value.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsDynamoDbTableBillingModeSummary_lastUpdateToPayPerRequestDateTime :: Lens.Lens' AwsDynamoDbTableBillingModeSummary (Prelude.Maybe Prelude.Text)
awsDynamoDbTableBillingModeSummary_lastUpdateToPayPerRequestDateTime :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableBillingModeSummary
-> f AwsDynamoDbTableBillingModeSummary
awsDynamoDbTableBillingModeSummary_lastUpdateToPayPerRequestDateTime = (AwsDynamoDbTableBillingModeSummary -> Maybe Text)
-> (AwsDynamoDbTableBillingModeSummary
    -> Maybe Text -> AwsDynamoDbTableBillingModeSummary)
-> Lens
     AwsDynamoDbTableBillingModeSummary
     AwsDynamoDbTableBillingModeSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableBillingModeSummary' {Maybe Text
lastUpdateToPayPerRequestDateTime :: Maybe Text
$sel:lastUpdateToPayPerRequestDateTime:AwsDynamoDbTableBillingModeSummary' :: AwsDynamoDbTableBillingModeSummary -> Maybe Text
lastUpdateToPayPerRequestDateTime} -> Maybe Text
lastUpdateToPayPerRequestDateTime) (\s :: AwsDynamoDbTableBillingModeSummary
s@AwsDynamoDbTableBillingModeSummary' {} Maybe Text
a -> AwsDynamoDbTableBillingModeSummary
s {$sel:lastUpdateToPayPerRequestDateTime:AwsDynamoDbTableBillingModeSummary' :: Maybe Text
lastUpdateToPayPerRequestDateTime = Maybe Text
a} :: AwsDynamoDbTableBillingModeSummary)

-- | The method used to charge for read and write throughput and to manage
-- capacity.
awsDynamoDbTableBillingModeSummary_billingMode :: Lens.Lens' AwsDynamoDbTableBillingModeSummary (Prelude.Maybe Prelude.Text)
awsDynamoDbTableBillingModeSummary_billingMode :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableBillingModeSummary
-> f AwsDynamoDbTableBillingModeSummary
awsDynamoDbTableBillingModeSummary_billingMode = (AwsDynamoDbTableBillingModeSummary -> Maybe Text)
-> (AwsDynamoDbTableBillingModeSummary
    -> Maybe Text -> AwsDynamoDbTableBillingModeSummary)
-> Lens
     AwsDynamoDbTableBillingModeSummary
     AwsDynamoDbTableBillingModeSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableBillingModeSummary' {Maybe Text
billingMode :: Maybe Text
$sel:billingMode:AwsDynamoDbTableBillingModeSummary' :: AwsDynamoDbTableBillingModeSummary -> Maybe Text
billingMode} -> Maybe Text
billingMode) (\s :: AwsDynamoDbTableBillingModeSummary
s@AwsDynamoDbTableBillingModeSummary' {} Maybe Text
a -> AwsDynamoDbTableBillingModeSummary
s {$sel:billingMode:AwsDynamoDbTableBillingModeSummary' :: Maybe Text
billingMode = Maybe Text
a} :: AwsDynamoDbTableBillingModeSummary)

instance
  Core.FromJSON
    AwsDynamoDbTableBillingModeSummary
  where
  parseJSON :: Value -> Parser AwsDynamoDbTableBillingModeSummary
parseJSON =
    String
-> (Object -> Parser AwsDynamoDbTableBillingModeSummary)
-> Value
-> Parser AwsDynamoDbTableBillingModeSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsDynamoDbTableBillingModeSummary"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsDynamoDbTableBillingModeSummary
AwsDynamoDbTableBillingModeSummary'
            (Maybe Text -> Maybe Text -> AwsDynamoDbTableBillingModeSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsDynamoDbTableBillingModeSummary)
forall (f :: * -> *) a b. Functor 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
"LastUpdateToPayPerRequestDateTime")
            Parser (Maybe Text -> AwsDynamoDbTableBillingModeSummary)
-> Parser (Maybe Text) -> Parser AwsDynamoDbTableBillingModeSummary
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
"BillingMode")
      )

instance
  Prelude.Hashable
    AwsDynamoDbTableBillingModeSummary

instance
  Prelude.NFData
    AwsDynamoDbTableBillingModeSummary

instance
  Core.ToJSON
    AwsDynamoDbTableBillingModeSummary
  where
  toJSON :: AwsDynamoDbTableBillingModeSummary -> Value
toJSON AwsDynamoDbTableBillingModeSummary' {Maybe Text
billingMode :: Maybe Text
lastUpdateToPayPerRequestDateTime :: Maybe Text
$sel:billingMode:AwsDynamoDbTableBillingModeSummary' :: AwsDynamoDbTableBillingModeSummary -> Maybe Text
$sel:lastUpdateToPayPerRequestDateTime:AwsDynamoDbTableBillingModeSummary' :: AwsDynamoDbTableBillingModeSummary -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"LastUpdateToPayPerRequestDateTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
lastUpdateToPayPerRequestDateTime,
            (Text
"BillingMode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
billingMode
          ]
      )