{-# 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.ResourceUtilization
-- 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.ResourceUtilization where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.EC2ResourceUtilization
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Resource utilization of current resource.
--
-- /See:/ 'newResourceUtilization' smart constructor.
data ResourceUtilization = ResourceUtilization'
  { -- | The utilization of current Amazon EC2 instance.
    ResourceUtilization -> Maybe EC2ResourceUtilization
eC2ResourceUtilization :: Prelude.Maybe EC2ResourceUtilization
  }
  deriving (ResourceUtilization -> ResourceUtilization -> Bool
(ResourceUtilization -> ResourceUtilization -> Bool)
-> (ResourceUtilization -> ResourceUtilization -> Bool)
-> Eq ResourceUtilization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceUtilization -> ResourceUtilization -> Bool
$c/= :: ResourceUtilization -> ResourceUtilization -> Bool
== :: ResourceUtilization -> ResourceUtilization -> Bool
$c== :: ResourceUtilization -> ResourceUtilization -> Bool
Prelude.Eq, ReadPrec [ResourceUtilization]
ReadPrec ResourceUtilization
Int -> ReadS ResourceUtilization
ReadS [ResourceUtilization]
(Int -> ReadS ResourceUtilization)
-> ReadS [ResourceUtilization]
-> ReadPrec ResourceUtilization
-> ReadPrec [ResourceUtilization]
-> Read ResourceUtilization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceUtilization]
$creadListPrec :: ReadPrec [ResourceUtilization]
readPrec :: ReadPrec ResourceUtilization
$creadPrec :: ReadPrec ResourceUtilization
readList :: ReadS [ResourceUtilization]
$creadList :: ReadS [ResourceUtilization]
readsPrec :: Int -> ReadS ResourceUtilization
$creadsPrec :: Int -> ReadS ResourceUtilization
Prelude.Read, Int -> ResourceUtilization -> ShowS
[ResourceUtilization] -> ShowS
ResourceUtilization -> String
(Int -> ResourceUtilization -> ShowS)
-> (ResourceUtilization -> String)
-> ([ResourceUtilization] -> ShowS)
-> Show ResourceUtilization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceUtilization] -> ShowS
$cshowList :: [ResourceUtilization] -> ShowS
show :: ResourceUtilization -> String
$cshow :: ResourceUtilization -> String
showsPrec :: Int -> ResourceUtilization -> ShowS
$cshowsPrec :: Int -> ResourceUtilization -> ShowS
Prelude.Show, (forall x. ResourceUtilization -> Rep ResourceUtilization x)
-> (forall x. Rep ResourceUtilization x -> ResourceUtilization)
-> Generic ResourceUtilization
forall x. Rep ResourceUtilization x -> ResourceUtilization
forall x. ResourceUtilization -> Rep ResourceUtilization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceUtilization x -> ResourceUtilization
$cfrom :: forall x. ResourceUtilization -> Rep ResourceUtilization x
Prelude.Generic)

-- |
-- Create a value of 'ResourceUtilization' 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:
--
-- 'eC2ResourceUtilization', 'resourceUtilization_eC2ResourceUtilization' - The utilization of current Amazon EC2 instance.
newResourceUtilization ::
  ResourceUtilization
newResourceUtilization :: ResourceUtilization
newResourceUtilization =
  ResourceUtilization' :: Maybe EC2ResourceUtilization -> ResourceUtilization
ResourceUtilization'
    { $sel:eC2ResourceUtilization:ResourceUtilization' :: Maybe EC2ResourceUtilization
eC2ResourceUtilization =
        Maybe EC2ResourceUtilization
forall a. Maybe a
Prelude.Nothing
    }

-- | The utilization of current Amazon EC2 instance.
resourceUtilization_eC2ResourceUtilization :: Lens.Lens' ResourceUtilization (Prelude.Maybe EC2ResourceUtilization)
resourceUtilization_eC2ResourceUtilization :: (Maybe EC2ResourceUtilization -> f (Maybe EC2ResourceUtilization))
-> ResourceUtilization -> f ResourceUtilization
resourceUtilization_eC2ResourceUtilization = (ResourceUtilization -> Maybe EC2ResourceUtilization)
-> (ResourceUtilization
    -> Maybe EC2ResourceUtilization -> ResourceUtilization)
-> Lens
     ResourceUtilization
     ResourceUtilization
     (Maybe EC2ResourceUtilization)
     (Maybe EC2ResourceUtilization)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceUtilization' {Maybe EC2ResourceUtilization
eC2ResourceUtilization :: Maybe EC2ResourceUtilization
$sel:eC2ResourceUtilization:ResourceUtilization' :: ResourceUtilization -> Maybe EC2ResourceUtilization
eC2ResourceUtilization} -> Maybe EC2ResourceUtilization
eC2ResourceUtilization) (\s :: ResourceUtilization
s@ResourceUtilization' {} Maybe EC2ResourceUtilization
a -> ResourceUtilization
s {$sel:eC2ResourceUtilization:ResourceUtilization' :: Maybe EC2ResourceUtilization
eC2ResourceUtilization = Maybe EC2ResourceUtilization
a} :: ResourceUtilization)

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

instance Prelude.Hashable ResourceUtilization

instance Prelude.NFData ResourceUtilization