{-# 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.DevOpsGuru.Types.ServiceResourceCost
-- 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.DevOpsGuru.Types.ServiceResourceCost where

import qualified Amazonka.Core as Core
import Amazonka.DevOpsGuru.Types.CostEstimationServiceResourceState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that contains information about the estimated monthly cost to
-- analyze an AWS resource. For more information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/cost-estimate.html Estimate your Amazon DevOps Guru costs>
-- and
-- <http://aws.amazon.com/devops-guru/pricing/ Amazon DevOps Guru pricing>.
--
-- /See:/ 'newServiceResourceCost' smart constructor.
data ServiceResourceCost = ServiceResourceCost'
  { -- | The state of the resource. The resource is @ACTIVE@ if it produces
    -- metrics, events, or logs within an hour, otherwise it is @INACTIVE@. You
    -- pay for the number of active AWS resource hours analyzed for each
    -- resource. Inactive resources are not charged.
    ServiceResourceCost -> Maybe CostEstimationServiceResourceState
state :: Prelude.Maybe CostEstimationServiceResourceState,
    -- | The price per hour to analyze the resources in the service. For more
    -- information, see
    -- <https://docs.aws.amazon.com/devops-guru/latest/userguide/cost-estimate.html Estimate your Amazon DevOps Guru costs>
    -- and
    -- <http://aws.amazon.com/devops-guru/pricing/ Amazon DevOps Guru pricing>.
    ServiceResourceCost -> Maybe Double
unitCost :: Prelude.Maybe Prelude.Double,
    -- | The number of active resources analyzed for this service to create a
    -- monthly cost estimate.
    ServiceResourceCost -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The total estimated monthly cost to analyze the active resources for
    -- this resource.
    ServiceResourceCost -> Maybe Double
cost :: Prelude.Maybe Prelude.Double,
    -- | The type of the AWS resource.
    ServiceResourceCost -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (ServiceResourceCost -> ServiceResourceCost -> Bool
(ServiceResourceCost -> ServiceResourceCost -> Bool)
-> (ServiceResourceCost -> ServiceResourceCost -> Bool)
-> Eq ServiceResourceCost
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceResourceCost -> ServiceResourceCost -> Bool
$c/= :: ServiceResourceCost -> ServiceResourceCost -> Bool
== :: ServiceResourceCost -> ServiceResourceCost -> Bool
$c== :: ServiceResourceCost -> ServiceResourceCost -> Bool
Prelude.Eq, ReadPrec [ServiceResourceCost]
ReadPrec ServiceResourceCost
Int -> ReadS ServiceResourceCost
ReadS [ServiceResourceCost]
(Int -> ReadS ServiceResourceCost)
-> ReadS [ServiceResourceCost]
-> ReadPrec ServiceResourceCost
-> ReadPrec [ServiceResourceCost]
-> Read ServiceResourceCost
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceResourceCost]
$creadListPrec :: ReadPrec [ServiceResourceCost]
readPrec :: ReadPrec ServiceResourceCost
$creadPrec :: ReadPrec ServiceResourceCost
readList :: ReadS [ServiceResourceCost]
$creadList :: ReadS [ServiceResourceCost]
readsPrec :: Int -> ReadS ServiceResourceCost
$creadsPrec :: Int -> ReadS ServiceResourceCost
Prelude.Read, Int -> ServiceResourceCost -> ShowS
[ServiceResourceCost] -> ShowS
ServiceResourceCost -> String
(Int -> ServiceResourceCost -> ShowS)
-> (ServiceResourceCost -> String)
-> ([ServiceResourceCost] -> ShowS)
-> Show ServiceResourceCost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceResourceCost] -> ShowS
$cshowList :: [ServiceResourceCost] -> ShowS
show :: ServiceResourceCost -> String
$cshow :: ServiceResourceCost -> String
showsPrec :: Int -> ServiceResourceCost -> ShowS
$cshowsPrec :: Int -> ServiceResourceCost -> ShowS
Prelude.Show, (forall x. ServiceResourceCost -> Rep ServiceResourceCost x)
-> (forall x. Rep ServiceResourceCost x -> ServiceResourceCost)
-> Generic ServiceResourceCost
forall x. Rep ServiceResourceCost x -> ServiceResourceCost
forall x. ServiceResourceCost -> Rep ServiceResourceCost x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceResourceCost x -> ServiceResourceCost
$cfrom :: forall x. ServiceResourceCost -> Rep ServiceResourceCost x
Prelude.Generic)

-- |
-- Create a value of 'ServiceResourceCost' 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:
--
-- 'state', 'serviceResourceCost_state' - The state of the resource. The resource is @ACTIVE@ if it produces
-- metrics, events, or logs within an hour, otherwise it is @INACTIVE@. You
-- pay for the number of active AWS resource hours analyzed for each
-- resource. Inactive resources are not charged.
--
-- 'unitCost', 'serviceResourceCost_unitCost' - The price per hour to analyze the resources in the service. For more
-- information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/cost-estimate.html Estimate your Amazon DevOps Guru costs>
-- and
-- <http://aws.amazon.com/devops-guru/pricing/ Amazon DevOps Guru pricing>.
--
-- 'count', 'serviceResourceCost_count' - The number of active resources analyzed for this service to create a
-- monthly cost estimate.
--
-- 'cost', 'serviceResourceCost_cost' - The total estimated monthly cost to analyze the active resources for
-- this resource.
--
-- 'type'', 'serviceResourceCost_type' - The type of the AWS resource.
newServiceResourceCost ::
  ServiceResourceCost
newServiceResourceCost :: ServiceResourceCost
newServiceResourceCost =
  ServiceResourceCost' :: Maybe CostEstimationServiceResourceState
-> Maybe Double
-> Maybe Int
-> Maybe Double
-> Maybe Text
-> ServiceResourceCost
ServiceResourceCost'
    { $sel:state:ServiceResourceCost' :: Maybe CostEstimationServiceResourceState
state = Maybe CostEstimationServiceResourceState
forall a. Maybe a
Prelude.Nothing,
      $sel:unitCost:ServiceResourceCost' :: Maybe Double
unitCost = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:count:ServiceResourceCost' :: Maybe Int
count = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:cost:ServiceResourceCost' :: Maybe Double
cost = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ServiceResourceCost' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the resource. The resource is @ACTIVE@ if it produces
-- metrics, events, or logs within an hour, otherwise it is @INACTIVE@. You
-- pay for the number of active AWS resource hours analyzed for each
-- resource. Inactive resources are not charged.
serviceResourceCost_state :: Lens.Lens' ServiceResourceCost (Prelude.Maybe CostEstimationServiceResourceState)
serviceResourceCost_state :: (Maybe CostEstimationServiceResourceState
 -> f (Maybe CostEstimationServiceResourceState))
-> ServiceResourceCost -> f ServiceResourceCost
serviceResourceCost_state = (ServiceResourceCost -> Maybe CostEstimationServiceResourceState)
-> (ServiceResourceCost
    -> Maybe CostEstimationServiceResourceState -> ServiceResourceCost)
-> Lens
     ServiceResourceCost
     ServiceResourceCost
     (Maybe CostEstimationServiceResourceState)
     (Maybe CostEstimationServiceResourceState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceResourceCost' {Maybe CostEstimationServiceResourceState
state :: Maybe CostEstimationServiceResourceState
$sel:state:ServiceResourceCost' :: ServiceResourceCost -> Maybe CostEstimationServiceResourceState
state} -> Maybe CostEstimationServiceResourceState
state) (\s :: ServiceResourceCost
s@ServiceResourceCost' {} Maybe CostEstimationServiceResourceState
a -> ServiceResourceCost
s {$sel:state:ServiceResourceCost' :: Maybe CostEstimationServiceResourceState
state = Maybe CostEstimationServiceResourceState
a} :: ServiceResourceCost)

-- | The price per hour to analyze the resources in the service. For more
-- information, see
-- <https://docs.aws.amazon.com/devops-guru/latest/userguide/cost-estimate.html Estimate your Amazon DevOps Guru costs>
-- and
-- <http://aws.amazon.com/devops-guru/pricing/ Amazon DevOps Guru pricing>.
serviceResourceCost_unitCost :: Lens.Lens' ServiceResourceCost (Prelude.Maybe Prelude.Double)
serviceResourceCost_unitCost :: (Maybe Double -> f (Maybe Double))
-> ServiceResourceCost -> f ServiceResourceCost
serviceResourceCost_unitCost = (ServiceResourceCost -> Maybe Double)
-> (ServiceResourceCost -> Maybe Double -> ServiceResourceCost)
-> Lens
     ServiceResourceCost
     ServiceResourceCost
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceResourceCost' {Maybe Double
unitCost :: Maybe Double
$sel:unitCost:ServiceResourceCost' :: ServiceResourceCost -> Maybe Double
unitCost} -> Maybe Double
unitCost) (\s :: ServiceResourceCost
s@ServiceResourceCost' {} Maybe Double
a -> ServiceResourceCost
s {$sel:unitCost:ServiceResourceCost' :: Maybe Double
unitCost = Maybe Double
a} :: ServiceResourceCost)

-- | The number of active resources analyzed for this service to create a
-- monthly cost estimate.
serviceResourceCost_count :: Lens.Lens' ServiceResourceCost (Prelude.Maybe Prelude.Int)
serviceResourceCost_count :: (Maybe Int -> f (Maybe Int))
-> ServiceResourceCost -> f ServiceResourceCost
serviceResourceCost_count = (ServiceResourceCost -> Maybe Int)
-> (ServiceResourceCost -> Maybe Int -> ServiceResourceCost)
-> Lens
     ServiceResourceCost ServiceResourceCost (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceResourceCost' {Maybe Int
count :: Maybe Int
$sel:count:ServiceResourceCost' :: ServiceResourceCost -> Maybe Int
count} -> Maybe Int
count) (\s :: ServiceResourceCost
s@ServiceResourceCost' {} Maybe Int
a -> ServiceResourceCost
s {$sel:count:ServiceResourceCost' :: Maybe Int
count = Maybe Int
a} :: ServiceResourceCost)

-- | The total estimated monthly cost to analyze the active resources for
-- this resource.
serviceResourceCost_cost :: Lens.Lens' ServiceResourceCost (Prelude.Maybe Prelude.Double)
serviceResourceCost_cost :: (Maybe Double -> f (Maybe Double))
-> ServiceResourceCost -> f ServiceResourceCost
serviceResourceCost_cost = (ServiceResourceCost -> Maybe Double)
-> (ServiceResourceCost -> Maybe Double -> ServiceResourceCost)
-> Lens
     ServiceResourceCost
     ServiceResourceCost
     (Maybe Double)
     (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceResourceCost' {Maybe Double
cost :: Maybe Double
$sel:cost:ServiceResourceCost' :: ServiceResourceCost -> Maybe Double
cost} -> Maybe Double
cost) (\s :: ServiceResourceCost
s@ServiceResourceCost' {} Maybe Double
a -> ServiceResourceCost
s {$sel:cost:ServiceResourceCost' :: Maybe Double
cost = Maybe Double
a} :: ServiceResourceCost)

-- | The type of the AWS resource.
serviceResourceCost_type :: Lens.Lens' ServiceResourceCost (Prelude.Maybe Prelude.Text)
serviceResourceCost_type :: (Maybe Text -> f (Maybe Text))
-> ServiceResourceCost -> f ServiceResourceCost
serviceResourceCost_type = (ServiceResourceCost -> Maybe Text)
-> (ServiceResourceCost -> Maybe Text -> ServiceResourceCost)
-> Lens
     ServiceResourceCost ServiceResourceCost (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceResourceCost' {Maybe Text
type' :: Maybe Text
$sel:type':ServiceResourceCost' :: ServiceResourceCost -> Maybe Text
type'} -> Maybe Text
type') (\s :: ServiceResourceCost
s@ServiceResourceCost' {} Maybe Text
a -> ServiceResourceCost
s {$sel:type':ServiceResourceCost' :: Maybe Text
type' = Maybe Text
a} :: ServiceResourceCost)

instance Core.FromJSON ServiceResourceCost where
  parseJSON :: Value -> Parser ServiceResourceCost
parseJSON =
    String
-> (Object -> Parser ServiceResourceCost)
-> Value
-> Parser ServiceResourceCost
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceResourceCost"
      ( \Object
x ->
          Maybe CostEstimationServiceResourceState
-> Maybe Double
-> Maybe Int
-> Maybe Double
-> Maybe Text
-> ServiceResourceCost
ServiceResourceCost'
            (Maybe CostEstimationServiceResourceState
 -> Maybe Double
 -> Maybe Int
 -> Maybe Double
 -> Maybe Text
 -> ServiceResourceCost)
-> Parser (Maybe CostEstimationServiceResourceState)
-> Parser
     (Maybe Double
      -> Maybe Int -> Maybe Double -> Maybe Text -> ServiceResourceCost)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CostEstimationServiceResourceState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe Double
   -> Maybe Int -> Maybe Double -> Maybe Text -> ServiceResourceCost)
-> Parser (Maybe Double)
-> Parser
     (Maybe Int -> Maybe Double -> Maybe Text -> ServiceResourceCost)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UnitCost")
            Parser
  (Maybe Int -> Maybe Double -> Maybe Text -> ServiceResourceCost)
-> Parser (Maybe Int)
-> Parser (Maybe Double -> Maybe Text -> ServiceResourceCost)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Count")
            Parser (Maybe Double -> Maybe Text -> ServiceResourceCost)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> ServiceResourceCost)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Cost")
            Parser (Maybe Text -> ServiceResourceCost)
-> Parser (Maybe Text) -> Parser ServiceResourceCost
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
"Type")
      )

instance Prelude.Hashable ServiceResourceCost

instance Prelude.NFData ServiceResourceCost