{-# 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.CostExplorer.Types.CoverageCost
-- 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.CostExplorer.Types.CoverageCost where

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

-- | How much it costs to run an instance.
--
-- /See:/ 'newCoverageCost' smart constructor.
data CoverageCost = CoverageCost'
  { -- | How much an On-Demand Instance costs.
    CoverageCost -> Maybe Text
onDemandCost :: Prelude.Maybe Prelude.Text
  }
  deriving (CoverageCost -> CoverageCost -> Bool
(CoverageCost -> CoverageCost -> Bool)
-> (CoverageCost -> CoverageCost -> Bool) -> Eq CoverageCost
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CoverageCost -> CoverageCost -> Bool
$c/= :: CoverageCost -> CoverageCost -> Bool
== :: CoverageCost -> CoverageCost -> Bool
$c== :: CoverageCost -> CoverageCost -> Bool
Prelude.Eq, ReadPrec [CoverageCost]
ReadPrec CoverageCost
Int -> ReadS CoverageCost
ReadS [CoverageCost]
(Int -> ReadS CoverageCost)
-> ReadS [CoverageCost]
-> ReadPrec CoverageCost
-> ReadPrec [CoverageCost]
-> Read CoverageCost
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CoverageCost]
$creadListPrec :: ReadPrec [CoverageCost]
readPrec :: ReadPrec CoverageCost
$creadPrec :: ReadPrec CoverageCost
readList :: ReadS [CoverageCost]
$creadList :: ReadS [CoverageCost]
readsPrec :: Int -> ReadS CoverageCost
$creadsPrec :: Int -> ReadS CoverageCost
Prelude.Read, Int -> CoverageCost -> ShowS
[CoverageCost] -> ShowS
CoverageCost -> String
(Int -> CoverageCost -> ShowS)
-> (CoverageCost -> String)
-> ([CoverageCost] -> ShowS)
-> Show CoverageCost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoverageCost] -> ShowS
$cshowList :: [CoverageCost] -> ShowS
show :: CoverageCost -> String
$cshow :: CoverageCost -> String
showsPrec :: Int -> CoverageCost -> ShowS
$cshowsPrec :: Int -> CoverageCost -> ShowS
Prelude.Show, (forall x. CoverageCost -> Rep CoverageCost x)
-> (forall x. Rep CoverageCost x -> CoverageCost)
-> Generic CoverageCost
forall x. Rep CoverageCost x -> CoverageCost
forall x. CoverageCost -> Rep CoverageCost x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoverageCost x -> CoverageCost
$cfrom :: forall x. CoverageCost -> Rep CoverageCost x
Prelude.Generic)

-- |
-- Create a value of 'CoverageCost' 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:
--
-- 'onDemandCost', 'coverageCost_onDemandCost' - How much an On-Demand Instance costs.
newCoverageCost ::
  CoverageCost
newCoverageCost :: CoverageCost
newCoverageCost =
  CoverageCost' :: Maybe Text -> CoverageCost
CoverageCost' {$sel:onDemandCost:CoverageCost' :: Maybe Text
onDemandCost = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | How much an On-Demand Instance costs.
coverageCost_onDemandCost :: Lens.Lens' CoverageCost (Prelude.Maybe Prelude.Text)
coverageCost_onDemandCost :: (Maybe Text -> f (Maybe Text)) -> CoverageCost -> f CoverageCost
coverageCost_onDemandCost = (CoverageCost -> Maybe Text)
-> (CoverageCost -> Maybe Text -> CoverageCost)
-> Lens CoverageCost CoverageCost (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CoverageCost' {Maybe Text
onDemandCost :: Maybe Text
$sel:onDemandCost:CoverageCost' :: CoverageCost -> Maybe Text
onDemandCost} -> Maybe Text
onDemandCost) (\s :: CoverageCost
s@CoverageCost' {} Maybe Text
a -> CoverageCost
s {$sel:onDemandCost:CoverageCost' :: Maybe Text
onDemandCost = Maybe Text
a} :: CoverageCost)

instance Core.FromJSON CoverageCost where
  parseJSON :: Value -> Parser CoverageCost
parseJSON =
    String
-> (Object -> Parser CoverageCost) -> Value -> Parser CoverageCost
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CoverageCost"
      ( \Object
x ->
          Maybe Text -> CoverageCost
CoverageCost'
            (Maybe Text -> CoverageCost)
-> Parser (Maybe Text) -> Parser CoverageCost
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
"OnDemandCost")
      )

instance Prelude.Hashable CoverageCost

instance Prelude.NFData CoverageCost