{-# 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.ElasticBeanstalk.Types.CPUUtilization
-- 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.ElasticBeanstalk.Types.CPUUtilization where

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

-- | CPU utilization metrics for an instance.
--
-- /See:/ 'newCPUUtilization' smart constructor.
data CPUUtilization = CPUUtilization'
  { -- | Available on Linux environments only.
    --
    -- Percentage of time that the CPU has spent in the @I\/O Wait@ state over
    -- the last 10 seconds.
    CPUUtilization -> Maybe Double
iOWait :: Prelude.Maybe Prelude.Double,
    -- | Available on Linux environments only.
    --
    -- Percentage of time that the CPU has spent in the @IRQ@ state over the
    -- last 10 seconds.
    CPUUtilization -> Maybe Double
irq :: Prelude.Maybe Prelude.Double,
    -- | Percentage of time that the CPU has spent in the @Idle@ state over the
    -- last 10 seconds.
    CPUUtilization -> Maybe Double
idle :: Prelude.Maybe Prelude.Double,
    -- | Available on Linux environments only.
    --
    -- Percentage of time that the CPU has spent in the @Nice@ state over the
    -- last 10 seconds.
    CPUUtilization -> Maybe Double
nice :: Prelude.Maybe Prelude.Double,
    -- | Available on Windows environments only.
    --
    -- Percentage of time that the CPU has spent in the @Privileged@ state over
    -- the last 10 seconds.
    CPUUtilization -> Maybe Double
privileged :: Prelude.Maybe Prelude.Double,
    -- | Available on Linux environments only.
    --
    -- Percentage of time that the CPU has spent in the @SoftIRQ@ state over
    -- the last 10 seconds.
    CPUUtilization -> Maybe Double
softIRQ :: Prelude.Maybe Prelude.Double,
    -- | Available on Linux environments only.
    --
    -- Percentage of time that the CPU has spent in the @System@ state over the
    -- last 10 seconds.
    CPUUtilization -> Maybe Double
system :: Prelude.Maybe Prelude.Double,
    -- | Percentage of time that the CPU has spent in the @User@ state over the
    -- last 10 seconds.
    CPUUtilization -> Maybe Double
user :: Prelude.Maybe Prelude.Double
  }
  deriving (CPUUtilization -> CPUUtilization -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CPUUtilization -> CPUUtilization -> Bool
$c/= :: CPUUtilization -> CPUUtilization -> Bool
== :: CPUUtilization -> CPUUtilization -> Bool
$c== :: CPUUtilization -> CPUUtilization -> Bool
Prelude.Eq, ReadPrec [CPUUtilization]
ReadPrec CPUUtilization
Int -> ReadS CPUUtilization
ReadS [CPUUtilization]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CPUUtilization]
$creadListPrec :: ReadPrec [CPUUtilization]
readPrec :: ReadPrec CPUUtilization
$creadPrec :: ReadPrec CPUUtilization
readList :: ReadS [CPUUtilization]
$creadList :: ReadS [CPUUtilization]
readsPrec :: Int -> ReadS CPUUtilization
$creadsPrec :: Int -> ReadS CPUUtilization
Prelude.Read, Int -> CPUUtilization -> ShowS
[CPUUtilization] -> ShowS
CPUUtilization -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CPUUtilization] -> ShowS
$cshowList :: [CPUUtilization] -> ShowS
show :: CPUUtilization -> String
$cshow :: CPUUtilization -> String
showsPrec :: Int -> CPUUtilization -> ShowS
$cshowsPrec :: Int -> CPUUtilization -> ShowS
Prelude.Show, forall x. Rep CPUUtilization x -> CPUUtilization
forall x. CPUUtilization -> Rep CPUUtilization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CPUUtilization x -> CPUUtilization
$cfrom :: forall x. CPUUtilization -> Rep CPUUtilization x
Prelude.Generic)

-- |
-- Create a value of 'CPUUtilization' 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:
--
-- 'iOWait', 'cPUUtilization_iOWait' - Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @I\/O Wait@ state over
-- the last 10 seconds.
--
-- 'irq', 'cPUUtilization_irq' - Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @IRQ@ state over the
-- last 10 seconds.
--
-- 'idle', 'cPUUtilization_idle' - Percentage of time that the CPU has spent in the @Idle@ state over the
-- last 10 seconds.
--
-- 'nice', 'cPUUtilization_nice' - Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @Nice@ state over the
-- last 10 seconds.
--
-- 'privileged', 'cPUUtilization_privileged' - Available on Windows environments only.
--
-- Percentage of time that the CPU has spent in the @Privileged@ state over
-- the last 10 seconds.
--
-- 'softIRQ', 'cPUUtilization_softIRQ' - Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @SoftIRQ@ state over
-- the last 10 seconds.
--
-- 'system', 'cPUUtilization_system' - Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @System@ state over the
-- last 10 seconds.
--
-- 'user', 'cPUUtilization_user' - Percentage of time that the CPU has spent in the @User@ state over the
-- last 10 seconds.
newCPUUtilization ::
  CPUUtilization
newCPUUtilization :: CPUUtilization
newCPUUtilization =
  CPUUtilization'
    { $sel:iOWait:CPUUtilization' :: Maybe Double
iOWait = forall a. Maybe a
Prelude.Nothing,
      $sel:irq:CPUUtilization' :: Maybe Double
irq = forall a. Maybe a
Prelude.Nothing,
      $sel:idle:CPUUtilization' :: Maybe Double
idle = forall a. Maybe a
Prelude.Nothing,
      $sel:nice:CPUUtilization' :: Maybe Double
nice = forall a. Maybe a
Prelude.Nothing,
      $sel:privileged:CPUUtilization' :: Maybe Double
privileged = forall a. Maybe a
Prelude.Nothing,
      $sel:softIRQ:CPUUtilization' :: Maybe Double
softIRQ = forall a. Maybe a
Prelude.Nothing,
      $sel:system:CPUUtilization' :: Maybe Double
system = forall a. Maybe a
Prelude.Nothing,
      $sel:user:CPUUtilization' :: Maybe Double
user = forall a. Maybe a
Prelude.Nothing
    }

-- | Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @I\/O Wait@ state over
-- the last 10 seconds.
cPUUtilization_iOWait :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_iOWait :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_iOWait = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
iOWait :: Maybe Double
$sel:iOWait:CPUUtilization' :: CPUUtilization -> Maybe Double
iOWait} -> Maybe Double
iOWait) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:iOWait:CPUUtilization' :: Maybe Double
iOWait = Maybe Double
a} :: CPUUtilization)

-- | Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @IRQ@ state over the
-- last 10 seconds.
cPUUtilization_irq :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_irq :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_irq = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
irq :: Maybe Double
$sel:irq:CPUUtilization' :: CPUUtilization -> Maybe Double
irq} -> Maybe Double
irq) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:irq:CPUUtilization' :: Maybe Double
irq = Maybe Double
a} :: CPUUtilization)

-- | Percentage of time that the CPU has spent in the @Idle@ state over the
-- last 10 seconds.
cPUUtilization_idle :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_idle :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_idle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
idle :: Maybe Double
$sel:idle:CPUUtilization' :: CPUUtilization -> Maybe Double
idle} -> Maybe Double
idle) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:idle:CPUUtilization' :: Maybe Double
idle = Maybe Double
a} :: CPUUtilization)

-- | Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @Nice@ state over the
-- last 10 seconds.
cPUUtilization_nice :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_nice :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_nice = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
nice :: Maybe Double
$sel:nice:CPUUtilization' :: CPUUtilization -> Maybe Double
nice} -> Maybe Double
nice) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:nice:CPUUtilization' :: Maybe Double
nice = Maybe Double
a} :: CPUUtilization)

-- | Available on Windows environments only.
--
-- Percentage of time that the CPU has spent in the @Privileged@ state over
-- the last 10 seconds.
cPUUtilization_privileged :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_privileged :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_privileged = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
privileged :: Maybe Double
$sel:privileged:CPUUtilization' :: CPUUtilization -> Maybe Double
privileged} -> Maybe Double
privileged) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:privileged:CPUUtilization' :: Maybe Double
privileged = Maybe Double
a} :: CPUUtilization)

-- | Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @SoftIRQ@ state over
-- the last 10 seconds.
cPUUtilization_softIRQ :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_softIRQ :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_softIRQ = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
softIRQ :: Maybe Double
$sel:softIRQ:CPUUtilization' :: CPUUtilization -> Maybe Double
softIRQ} -> Maybe Double
softIRQ) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:softIRQ:CPUUtilization' :: Maybe Double
softIRQ = Maybe Double
a} :: CPUUtilization)

-- | Available on Linux environments only.
--
-- Percentage of time that the CPU has spent in the @System@ state over the
-- last 10 seconds.
cPUUtilization_system :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_system :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_system = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
system :: Maybe Double
$sel:system:CPUUtilization' :: CPUUtilization -> Maybe Double
system} -> Maybe Double
system) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:system:CPUUtilization' :: Maybe Double
system = Maybe Double
a} :: CPUUtilization)

-- | Percentage of time that the CPU has spent in the @User@ state over the
-- last 10 seconds.
cPUUtilization_user :: Lens.Lens' CPUUtilization (Prelude.Maybe Prelude.Double)
cPUUtilization_user :: Lens' CPUUtilization (Maybe Double)
cPUUtilization_user = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CPUUtilization' {Maybe Double
user :: Maybe Double
$sel:user:CPUUtilization' :: CPUUtilization -> Maybe Double
user} -> Maybe Double
user) (\s :: CPUUtilization
s@CPUUtilization' {} Maybe Double
a -> CPUUtilization
s {$sel:user:CPUUtilization' :: Maybe Double
user = Maybe Double
a} :: CPUUtilization)

instance Data.FromXML CPUUtilization where
  parseXML :: [Node] -> Either String CPUUtilization
parseXML [Node]
x =
    Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> CPUUtilization
CPUUtilization'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IOWait")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"IRQ")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Idle")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Nice")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Privileged")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"SoftIRQ")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"System")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"User")

instance Prelude.Hashable CPUUtilization where
  hashWithSalt :: Int -> CPUUtilization -> Int
hashWithSalt Int
_salt CPUUtilization' {Maybe Double
user :: Maybe Double
system :: Maybe Double
softIRQ :: Maybe Double
privileged :: Maybe Double
nice :: Maybe Double
idle :: Maybe Double
irq :: Maybe Double
iOWait :: Maybe Double
$sel:user:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:system:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:softIRQ:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:privileged:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:nice:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:idle:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:irq:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:iOWait:CPUUtilization' :: CPUUtilization -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
iOWait
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
irq
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
idle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
nice
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
privileged
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
softIRQ
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
system
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
user

instance Prelude.NFData CPUUtilization where
  rnf :: CPUUtilization -> ()
rnf CPUUtilization' {Maybe Double
user :: Maybe Double
system :: Maybe Double
softIRQ :: Maybe Double
privileged :: Maybe Double
nice :: Maybe Double
idle :: Maybe Double
irq :: Maybe Double
iOWait :: Maybe Double
$sel:user:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:system:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:softIRQ:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:privileged:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:nice:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:idle:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:irq:CPUUtilization' :: CPUUtilization -> Maybe Double
$sel:iOWait:CPUUtilization' :: CPUUtilization -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
iOWait
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
irq
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
idle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
nice
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
privileged
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
softIRQ
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
system
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
user