{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DevOpsGuru.Types.ServiceResourceCost where

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

-- | An object that contains information about the estimated monthly cost to
-- analyze an Amazon Web Services 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 total estimated monthly cost to analyze the active resources for
    -- this resource.
    ServiceResourceCost -> Maybe Double
cost :: 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 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 Amazon Web Services resource hours analyzed
    -- for each resource. Inactive resources are not charged.
    ServiceResourceCost -> Maybe CostEstimationServiceResourceState
state :: Prelude.Maybe CostEstimationServiceResourceState,
    -- | The type of the Amazon Web Services resource.
    ServiceResourceCost -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (ServiceResourceCost -> ServiceResourceCost -> Bool
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]
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
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. 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:
--
-- 'cost', 'serviceResourceCost_cost' - The total estimated monthly cost to analyze the active resources for
-- this resource.
--
-- 'count', 'serviceResourceCost_count' - The number of active resources analyzed for this service to create a
-- monthly cost estimate.
--
-- '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 Amazon Web Services resource hours analyzed
-- for each resource. Inactive resources are not charged.
--
-- 'type'', 'serviceResourceCost_type' - The type of the Amazon Web Services resource.
--
-- '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>.
newServiceResourceCost ::
  ServiceResourceCost
newServiceResourceCost :: ServiceResourceCost
newServiceResourceCost =
  ServiceResourceCost'
    { $sel:cost:ServiceResourceCost' :: Maybe Double
cost = forall a. Maybe a
Prelude.Nothing,
      $sel:count:ServiceResourceCost' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ServiceResourceCost' :: Maybe CostEstimationServiceResourceState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ServiceResourceCost' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing,
      $sel:unitCost:ServiceResourceCost' :: Maybe Double
unitCost = forall a. Maybe a
Prelude.Nothing
    }

-- | The total estimated monthly cost to analyze the active resources for
-- this resource.
serviceResourceCost_cost :: Lens.Lens' ServiceResourceCost (Prelude.Maybe Prelude.Double)
serviceResourceCost_cost :: Lens' ServiceResourceCost (Maybe Double)
serviceResourceCost_cost = 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 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 :: Lens' ServiceResourceCost (Maybe Int)
serviceResourceCost_count = 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 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 Amazon Web Services resource hours analyzed
-- for each resource. Inactive resources are not charged.
serviceResourceCost_state :: Lens.Lens' ServiceResourceCost (Prelude.Maybe CostEstimationServiceResourceState)
serviceResourceCost_state :: Lens'
  ServiceResourceCost (Maybe CostEstimationServiceResourceState)
serviceResourceCost_state = 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 type of the Amazon Web Services resource.
serviceResourceCost_type :: Lens.Lens' ServiceResourceCost (Prelude.Maybe Prelude.Text)
serviceResourceCost_type :: Lens' ServiceResourceCost (Maybe Text)
serviceResourceCost_type = 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)

-- | 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 :: Lens' ServiceResourceCost (Maybe Double)
serviceResourceCost_unitCost = 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)

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

instance Prelude.Hashable ServiceResourceCost where
  hashWithSalt :: Int -> ServiceResourceCost -> Int
hashWithSalt Int
_salt ServiceResourceCost' {Maybe Double
Maybe Int
Maybe Text
Maybe CostEstimationServiceResourceState
unitCost :: Maybe Double
type' :: Maybe Text
state :: Maybe CostEstimationServiceResourceState
count :: Maybe Int
cost :: Maybe Double
$sel:unitCost:ServiceResourceCost' :: ServiceResourceCost -> Maybe Double
$sel:type':ServiceResourceCost' :: ServiceResourceCost -> Maybe Text
$sel:state:ServiceResourceCost' :: ServiceResourceCost -> Maybe CostEstimationServiceResourceState
$sel:count:ServiceResourceCost' :: ServiceResourceCost -> Maybe Int
$sel:cost:ServiceResourceCost' :: ServiceResourceCost -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
cost
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CostEstimationServiceResourceState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
unitCost

instance Prelude.NFData ServiceResourceCost where
  rnf :: ServiceResourceCost -> ()
rnf ServiceResourceCost' {Maybe Double
Maybe Int
Maybe Text
Maybe CostEstimationServiceResourceState
unitCost :: Maybe Double
type' :: Maybe Text
state :: Maybe CostEstimationServiceResourceState
count :: Maybe Int
cost :: Maybe Double
$sel:unitCost:ServiceResourceCost' :: ServiceResourceCost -> Maybe Double
$sel:type':ServiceResourceCost' :: ServiceResourceCost -> Maybe Text
$sel:state:ServiceResourceCost' :: ServiceResourceCost -> Maybe CostEstimationServiceResourceState
$sel:count:ServiceResourceCost' :: ServiceResourceCost -> Maybe Int
$sel:cost:ServiceResourceCost' :: ServiceResourceCost -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
cost
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CostEstimationServiceResourceState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
unitCost