{-# 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.StepFunctions.Types.BillingDetails
-- 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.StepFunctions.Types.BillingDetails where

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

-- | An object that describes workflow billing details.
--
-- /See:/ 'newBillingDetails' smart constructor.
data BillingDetails = BillingDetails'
  { -- | Billed memory consumption of your workflow, in MB.
    BillingDetails -> Maybe Natural
billedMemoryUsedInMB :: Prelude.Maybe Prelude.Natural,
    -- | Billed duration of your workflow, in milliseconds.
    BillingDetails -> Maybe Natural
billedDurationInMilliseconds :: Prelude.Maybe Prelude.Natural
  }
  deriving (BillingDetails -> BillingDetails -> Bool
(BillingDetails -> BillingDetails -> Bool)
-> (BillingDetails -> BillingDetails -> Bool) -> Eq BillingDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BillingDetails -> BillingDetails -> Bool
$c/= :: BillingDetails -> BillingDetails -> Bool
== :: BillingDetails -> BillingDetails -> Bool
$c== :: BillingDetails -> BillingDetails -> Bool
Prelude.Eq, ReadPrec [BillingDetails]
ReadPrec BillingDetails
Int -> ReadS BillingDetails
ReadS [BillingDetails]
(Int -> ReadS BillingDetails)
-> ReadS [BillingDetails]
-> ReadPrec BillingDetails
-> ReadPrec [BillingDetails]
-> Read BillingDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BillingDetails]
$creadListPrec :: ReadPrec [BillingDetails]
readPrec :: ReadPrec BillingDetails
$creadPrec :: ReadPrec BillingDetails
readList :: ReadS [BillingDetails]
$creadList :: ReadS [BillingDetails]
readsPrec :: Int -> ReadS BillingDetails
$creadsPrec :: Int -> ReadS BillingDetails
Prelude.Read, Int -> BillingDetails -> ShowS
[BillingDetails] -> ShowS
BillingDetails -> String
(Int -> BillingDetails -> ShowS)
-> (BillingDetails -> String)
-> ([BillingDetails] -> ShowS)
-> Show BillingDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BillingDetails] -> ShowS
$cshowList :: [BillingDetails] -> ShowS
show :: BillingDetails -> String
$cshow :: BillingDetails -> String
showsPrec :: Int -> BillingDetails -> ShowS
$cshowsPrec :: Int -> BillingDetails -> ShowS
Prelude.Show, (forall x. BillingDetails -> Rep BillingDetails x)
-> (forall x. Rep BillingDetails x -> BillingDetails)
-> Generic BillingDetails
forall x. Rep BillingDetails x -> BillingDetails
forall x. BillingDetails -> Rep BillingDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BillingDetails x -> BillingDetails
$cfrom :: forall x. BillingDetails -> Rep BillingDetails x
Prelude.Generic)

-- |
-- Create a value of 'BillingDetails' 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:
--
-- 'billedMemoryUsedInMB', 'billingDetails_billedMemoryUsedInMB' - Billed memory consumption of your workflow, in MB.
--
-- 'billedDurationInMilliseconds', 'billingDetails_billedDurationInMilliseconds' - Billed duration of your workflow, in milliseconds.
newBillingDetails ::
  BillingDetails
newBillingDetails :: BillingDetails
newBillingDetails =
  BillingDetails' :: Maybe Natural -> Maybe Natural -> BillingDetails
BillingDetails'
    { $sel:billedMemoryUsedInMB:BillingDetails' :: Maybe Natural
billedMemoryUsedInMB =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:billedDurationInMilliseconds:BillingDetails' :: Maybe Natural
billedDurationInMilliseconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Billed memory consumption of your workflow, in MB.
billingDetails_billedMemoryUsedInMB :: Lens.Lens' BillingDetails (Prelude.Maybe Prelude.Natural)
billingDetails_billedMemoryUsedInMB :: (Maybe Natural -> f (Maybe Natural))
-> BillingDetails -> f BillingDetails
billingDetails_billedMemoryUsedInMB = (BillingDetails -> Maybe Natural)
-> (BillingDetails -> Maybe Natural -> BillingDetails)
-> Lens
     BillingDetails BillingDetails (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingDetails' {Maybe Natural
billedMemoryUsedInMB :: Maybe Natural
$sel:billedMemoryUsedInMB:BillingDetails' :: BillingDetails -> Maybe Natural
billedMemoryUsedInMB} -> Maybe Natural
billedMemoryUsedInMB) (\s :: BillingDetails
s@BillingDetails' {} Maybe Natural
a -> BillingDetails
s {$sel:billedMemoryUsedInMB:BillingDetails' :: Maybe Natural
billedMemoryUsedInMB = Maybe Natural
a} :: BillingDetails)

-- | Billed duration of your workflow, in milliseconds.
billingDetails_billedDurationInMilliseconds :: Lens.Lens' BillingDetails (Prelude.Maybe Prelude.Natural)
billingDetails_billedDurationInMilliseconds :: (Maybe Natural -> f (Maybe Natural))
-> BillingDetails -> f BillingDetails
billingDetails_billedDurationInMilliseconds = (BillingDetails -> Maybe Natural)
-> (BillingDetails -> Maybe Natural -> BillingDetails)
-> Lens
     BillingDetails BillingDetails (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BillingDetails' {Maybe Natural
billedDurationInMilliseconds :: Maybe Natural
$sel:billedDurationInMilliseconds:BillingDetails' :: BillingDetails -> Maybe Natural
billedDurationInMilliseconds} -> Maybe Natural
billedDurationInMilliseconds) (\s :: BillingDetails
s@BillingDetails' {} Maybe Natural
a -> BillingDetails
s {$sel:billedDurationInMilliseconds:BillingDetails' :: Maybe Natural
billedDurationInMilliseconds = Maybe Natural
a} :: BillingDetails)

instance Core.FromJSON BillingDetails where
  parseJSON :: Value -> Parser BillingDetails
parseJSON =
    String
-> (Object -> Parser BillingDetails)
-> Value
-> Parser BillingDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"BillingDetails"
      ( \Object
x ->
          Maybe Natural -> Maybe Natural -> BillingDetails
BillingDetails'
            (Maybe Natural -> Maybe Natural -> BillingDetails)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> BillingDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"billedMemoryUsedInMB")
            Parser (Maybe Natural -> BillingDetails)
-> Parser (Maybe Natural) -> Parser BillingDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"billedDurationInMilliseconds")
      )

instance Prelude.Hashable BillingDetails

instance Prelude.NFData BillingDetails