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

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

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

-- |
-- Create a value of 'DiskResourceUtilization' 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:
--
-- 'diskWriteOpsPerSecond', 'diskResourceUtilization_diskWriteOpsPerSecond' - The maximum number of write operations per second.
--
-- 'diskReadOpsPerSecond', 'diskResourceUtilization_diskReadOpsPerSecond' - The maximum number of read operations per second.
--
-- 'diskWriteBytesPerSecond', 'diskResourceUtilization_diskWriteBytesPerSecond' - The maximum write throughput operations per second.
--
-- 'diskReadBytesPerSecond', 'diskResourceUtilization_diskReadBytesPerSecond' - The maximum read throughput operations per second.
newDiskResourceUtilization ::
  DiskResourceUtilization
newDiskResourceUtilization :: DiskResourceUtilization
newDiskResourceUtilization =
  DiskResourceUtilization' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DiskResourceUtilization
DiskResourceUtilization'
    { $sel:diskWriteOpsPerSecond:DiskResourceUtilization' :: Maybe Text
diskWriteOpsPerSecond =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskReadOpsPerSecond:DiskResourceUtilization' :: Maybe Text
diskReadOpsPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskWriteBytesPerSecond:DiskResourceUtilization' :: Maybe Text
diskWriteBytesPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:diskReadBytesPerSecond:DiskResourceUtilization' :: Maybe Text
diskReadBytesPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The maximum write throughput operations per second.
diskResourceUtilization_diskWriteBytesPerSecond :: Lens.Lens' DiskResourceUtilization (Prelude.Maybe Prelude.Text)
diskResourceUtilization_diskWriteBytesPerSecond :: (Maybe Text -> f (Maybe Text))
-> DiskResourceUtilization -> f DiskResourceUtilization
diskResourceUtilization_diskWriteBytesPerSecond = (DiskResourceUtilization -> Maybe Text)
-> (DiskResourceUtilization
    -> Maybe Text -> DiskResourceUtilization)
-> Lens
     DiskResourceUtilization
     DiskResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskResourceUtilization' {Maybe Text
diskWriteBytesPerSecond :: Maybe Text
$sel:diskWriteBytesPerSecond:DiskResourceUtilization' :: DiskResourceUtilization -> Maybe Text
diskWriteBytesPerSecond} -> Maybe Text
diskWriteBytesPerSecond) (\s :: DiskResourceUtilization
s@DiskResourceUtilization' {} Maybe Text
a -> DiskResourceUtilization
s {$sel:diskWriteBytesPerSecond:DiskResourceUtilization' :: Maybe Text
diskWriteBytesPerSecond = Maybe Text
a} :: DiskResourceUtilization)

-- | The maximum read throughput operations per second.
diskResourceUtilization_diskReadBytesPerSecond :: Lens.Lens' DiskResourceUtilization (Prelude.Maybe Prelude.Text)
diskResourceUtilization_diskReadBytesPerSecond :: (Maybe Text -> f (Maybe Text))
-> DiskResourceUtilization -> f DiskResourceUtilization
diskResourceUtilization_diskReadBytesPerSecond = (DiskResourceUtilization -> Maybe Text)
-> (DiskResourceUtilization
    -> Maybe Text -> DiskResourceUtilization)
-> Lens
     DiskResourceUtilization
     DiskResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskResourceUtilization' {Maybe Text
diskReadBytesPerSecond :: Maybe Text
$sel:diskReadBytesPerSecond:DiskResourceUtilization' :: DiskResourceUtilization -> Maybe Text
diskReadBytesPerSecond} -> Maybe Text
diskReadBytesPerSecond) (\s :: DiskResourceUtilization
s@DiskResourceUtilization' {} Maybe Text
a -> DiskResourceUtilization
s {$sel:diskReadBytesPerSecond:DiskResourceUtilization' :: Maybe Text
diskReadBytesPerSecond = Maybe Text
a} :: DiskResourceUtilization)

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

instance Prelude.Hashable DiskResourceUtilization

instance Prelude.NFData DiskResourceUtilization