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

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

-- | The EBS field that contains a list of EBS metrics that are associated
-- with the current instance.
--
-- /See:/ 'newEBSResourceUtilization' smart constructor.
data EBSResourceUtilization = EBSResourceUtilization'
  { -- | The maximum size of write operations per second.
    EBSResourceUtilization -> Maybe Text
ebsWriteBytesPerSecond :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of write operations per second.
    EBSResourceUtilization -> Maybe Text
ebsWriteOpsPerSecond :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of read operations per second.
    EBSResourceUtilization -> Maybe Text
ebsReadOpsPerSecond :: Prelude.Maybe Prelude.Text,
    -- | The maximum size of read operations per second
    EBSResourceUtilization -> Maybe Text
ebsReadBytesPerSecond :: Prelude.Maybe Prelude.Text
  }
  deriving (EBSResourceUtilization -> EBSResourceUtilization -> Bool
(EBSResourceUtilization -> EBSResourceUtilization -> Bool)
-> (EBSResourceUtilization -> EBSResourceUtilization -> Bool)
-> Eq EBSResourceUtilization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EBSResourceUtilization -> EBSResourceUtilization -> Bool
$c/= :: EBSResourceUtilization -> EBSResourceUtilization -> Bool
== :: EBSResourceUtilization -> EBSResourceUtilization -> Bool
$c== :: EBSResourceUtilization -> EBSResourceUtilization -> Bool
Prelude.Eq, ReadPrec [EBSResourceUtilization]
ReadPrec EBSResourceUtilization
Int -> ReadS EBSResourceUtilization
ReadS [EBSResourceUtilization]
(Int -> ReadS EBSResourceUtilization)
-> ReadS [EBSResourceUtilization]
-> ReadPrec EBSResourceUtilization
-> ReadPrec [EBSResourceUtilization]
-> Read EBSResourceUtilization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EBSResourceUtilization]
$creadListPrec :: ReadPrec [EBSResourceUtilization]
readPrec :: ReadPrec EBSResourceUtilization
$creadPrec :: ReadPrec EBSResourceUtilization
readList :: ReadS [EBSResourceUtilization]
$creadList :: ReadS [EBSResourceUtilization]
readsPrec :: Int -> ReadS EBSResourceUtilization
$creadsPrec :: Int -> ReadS EBSResourceUtilization
Prelude.Read, Int -> EBSResourceUtilization -> ShowS
[EBSResourceUtilization] -> ShowS
EBSResourceUtilization -> String
(Int -> EBSResourceUtilization -> ShowS)
-> (EBSResourceUtilization -> String)
-> ([EBSResourceUtilization] -> ShowS)
-> Show EBSResourceUtilization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EBSResourceUtilization] -> ShowS
$cshowList :: [EBSResourceUtilization] -> ShowS
show :: EBSResourceUtilization -> String
$cshow :: EBSResourceUtilization -> String
showsPrec :: Int -> EBSResourceUtilization -> ShowS
$cshowsPrec :: Int -> EBSResourceUtilization -> ShowS
Prelude.Show, (forall x. EBSResourceUtilization -> Rep EBSResourceUtilization x)
-> (forall x.
    Rep EBSResourceUtilization x -> EBSResourceUtilization)
-> Generic EBSResourceUtilization
forall x. Rep EBSResourceUtilization x -> EBSResourceUtilization
forall x. EBSResourceUtilization -> Rep EBSResourceUtilization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EBSResourceUtilization x -> EBSResourceUtilization
$cfrom :: forall x. EBSResourceUtilization -> Rep EBSResourceUtilization x
Prelude.Generic)

-- |
-- Create a value of 'EBSResourceUtilization' 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:
--
-- 'ebsWriteBytesPerSecond', 'eBSResourceUtilization_ebsWriteBytesPerSecond' - The maximum size of write operations per second.
--
-- 'ebsWriteOpsPerSecond', 'eBSResourceUtilization_ebsWriteOpsPerSecond' - The maximum number of write operations per second.
--
-- 'ebsReadOpsPerSecond', 'eBSResourceUtilization_ebsReadOpsPerSecond' - The maximum number of read operations per second.
--
-- 'ebsReadBytesPerSecond', 'eBSResourceUtilization_ebsReadBytesPerSecond' - The maximum size of read operations per second
newEBSResourceUtilization ::
  EBSResourceUtilization
newEBSResourceUtilization :: EBSResourceUtilization
newEBSResourceUtilization =
  EBSResourceUtilization' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> EBSResourceUtilization
EBSResourceUtilization'
    { $sel:ebsWriteBytesPerSecond:EBSResourceUtilization' :: Maybe Text
ebsWriteBytesPerSecond =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ebsWriteOpsPerSecond:EBSResourceUtilization' :: Maybe Text
ebsWriteOpsPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ebsReadOpsPerSecond:EBSResourceUtilization' :: Maybe Text
ebsReadOpsPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ebsReadBytesPerSecond:EBSResourceUtilization' :: Maybe Text
ebsReadBytesPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum size of write operations per second.
eBSResourceUtilization_ebsWriteBytesPerSecond :: Lens.Lens' EBSResourceUtilization (Prelude.Maybe Prelude.Text)
eBSResourceUtilization_ebsWriteBytesPerSecond :: (Maybe Text -> f (Maybe Text))
-> EBSResourceUtilization -> f EBSResourceUtilization
eBSResourceUtilization_ebsWriteBytesPerSecond = (EBSResourceUtilization -> Maybe Text)
-> (EBSResourceUtilization -> Maybe Text -> EBSResourceUtilization)
-> Lens
     EBSResourceUtilization
     EBSResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSResourceUtilization' {Maybe Text
ebsWriteBytesPerSecond :: Maybe Text
$sel:ebsWriteBytesPerSecond:EBSResourceUtilization' :: EBSResourceUtilization -> Maybe Text
ebsWriteBytesPerSecond} -> Maybe Text
ebsWriteBytesPerSecond) (\s :: EBSResourceUtilization
s@EBSResourceUtilization' {} Maybe Text
a -> EBSResourceUtilization
s {$sel:ebsWriteBytesPerSecond:EBSResourceUtilization' :: Maybe Text
ebsWriteBytesPerSecond = Maybe Text
a} :: EBSResourceUtilization)

-- | The maximum number of write operations per second.
eBSResourceUtilization_ebsWriteOpsPerSecond :: Lens.Lens' EBSResourceUtilization (Prelude.Maybe Prelude.Text)
eBSResourceUtilization_ebsWriteOpsPerSecond :: (Maybe Text -> f (Maybe Text))
-> EBSResourceUtilization -> f EBSResourceUtilization
eBSResourceUtilization_ebsWriteOpsPerSecond = (EBSResourceUtilization -> Maybe Text)
-> (EBSResourceUtilization -> Maybe Text -> EBSResourceUtilization)
-> Lens
     EBSResourceUtilization
     EBSResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSResourceUtilization' {Maybe Text
ebsWriteOpsPerSecond :: Maybe Text
$sel:ebsWriteOpsPerSecond:EBSResourceUtilization' :: EBSResourceUtilization -> Maybe Text
ebsWriteOpsPerSecond} -> Maybe Text
ebsWriteOpsPerSecond) (\s :: EBSResourceUtilization
s@EBSResourceUtilization' {} Maybe Text
a -> EBSResourceUtilization
s {$sel:ebsWriteOpsPerSecond:EBSResourceUtilization' :: Maybe Text
ebsWriteOpsPerSecond = Maybe Text
a} :: EBSResourceUtilization)

-- | The maximum number of read operations per second.
eBSResourceUtilization_ebsReadOpsPerSecond :: Lens.Lens' EBSResourceUtilization (Prelude.Maybe Prelude.Text)
eBSResourceUtilization_ebsReadOpsPerSecond :: (Maybe Text -> f (Maybe Text))
-> EBSResourceUtilization -> f EBSResourceUtilization
eBSResourceUtilization_ebsReadOpsPerSecond = (EBSResourceUtilization -> Maybe Text)
-> (EBSResourceUtilization -> Maybe Text -> EBSResourceUtilization)
-> Lens
     EBSResourceUtilization
     EBSResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSResourceUtilization' {Maybe Text
ebsReadOpsPerSecond :: Maybe Text
$sel:ebsReadOpsPerSecond:EBSResourceUtilization' :: EBSResourceUtilization -> Maybe Text
ebsReadOpsPerSecond} -> Maybe Text
ebsReadOpsPerSecond) (\s :: EBSResourceUtilization
s@EBSResourceUtilization' {} Maybe Text
a -> EBSResourceUtilization
s {$sel:ebsReadOpsPerSecond:EBSResourceUtilization' :: Maybe Text
ebsReadOpsPerSecond = Maybe Text
a} :: EBSResourceUtilization)

-- | The maximum size of read operations per second
eBSResourceUtilization_ebsReadBytesPerSecond :: Lens.Lens' EBSResourceUtilization (Prelude.Maybe Prelude.Text)
eBSResourceUtilization_ebsReadBytesPerSecond :: (Maybe Text -> f (Maybe Text))
-> EBSResourceUtilization -> f EBSResourceUtilization
eBSResourceUtilization_ebsReadBytesPerSecond = (EBSResourceUtilization -> Maybe Text)
-> (EBSResourceUtilization -> Maybe Text -> EBSResourceUtilization)
-> Lens
     EBSResourceUtilization
     EBSResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EBSResourceUtilization' {Maybe Text
ebsReadBytesPerSecond :: Maybe Text
$sel:ebsReadBytesPerSecond:EBSResourceUtilization' :: EBSResourceUtilization -> Maybe Text
ebsReadBytesPerSecond} -> Maybe Text
ebsReadBytesPerSecond) (\s :: EBSResourceUtilization
s@EBSResourceUtilization' {} Maybe Text
a -> EBSResourceUtilization
s {$sel:ebsReadBytesPerSecond:EBSResourceUtilization' :: Maybe Text
ebsReadBytesPerSecond = Maybe Text
a} :: EBSResourceUtilization)

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

instance Prelude.Hashable EBSResourceUtilization

instance Prelude.NFData EBSResourceUtilization