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

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

-- | The network field that contains a list of network metrics that are
-- associated with the current instance.
--
-- /See:/ 'newNetworkResourceUtilization' smart constructor.
data NetworkResourceUtilization = NetworkResourceUtilization'
  { -- | The network outgress packets that are measured in packets per second.
    NetworkResourceUtilization -> Maybe Text
networkPacketsOutPerSecond :: Prelude.Maybe Prelude.Text,
    -- | The network inbound throughput utilization measured in Bytes per second.
    NetworkResourceUtilization -> Maybe Text
networkInBytesPerSecond :: Prelude.Maybe Prelude.Text,
    -- | The network ingress packets that are measured in packets per second.
    NetworkResourceUtilization -> Maybe Text
networkPacketsInPerSecond :: Prelude.Maybe Prelude.Text,
    -- | The network outbound throughput utilization measured in Bytes per
    -- second.
    NetworkResourceUtilization -> Maybe Text
networkOutBytesPerSecond :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkResourceUtilization -> NetworkResourceUtilization -> Bool
(NetworkResourceUtilization -> NetworkResourceUtilization -> Bool)
-> (NetworkResourceUtilization
    -> NetworkResourceUtilization -> Bool)
-> Eq NetworkResourceUtilization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkResourceUtilization -> NetworkResourceUtilization -> Bool
$c/= :: NetworkResourceUtilization -> NetworkResourceUtilization -> Bool
== :: NetworkResourceUtilization -> NetworkResourceUtilization -> Bool
$c== :: NetworkResourceUtilization -> NetworkResourceUtilization -> Bool
Prelude.Eq, ReadPrec [NetworkResourceUtilization]
ReadPrec NetworkResourceUtilization
Int -> ReadS NetworkResourceUtilization
ReadS [NetworkResourceUtilization]
(Int -> ReadS NetworkResourceUtilization)
-> ReadS [NetworkResourceUtilization]
-> ReadPrec NetworkResourceUtilization
-> ReadPrec [NetworkResourceUtilization]
-> Read NetworkResourceUtilization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkResourceUtilization]
$creadListPrec :: ReadPrec [NetworkResourceUtilization]
readPrec :: ReadPrec NetworkResourceUtilization
$creadPrec :: ReadPrec NetworkResourceUtilization
readList :: ReadS [NetworkResourceUtilization]
$creadList :: ReadS [NetworkResourceUtilization]
readsPrec :: Int -> ReadS NetworkResourceUtilization
$creadsPrec :: Int -> ReadS NetworkResourceUtilization
Prelude.Read, Int -> NetworkResourceUtilization -> ShowS
[NetworkResourceUtilization] -> ShowS
NetworkResourceUtilization -> String
(Int -> NetworkResourceUtilization -> ShowS)
-> (NetworkResourceUtilization -> String)
-> ([NetworkResourceUtilization] -> ShowS)
-> Show NetworkResourceUtilization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkResourceUtilization] -> ShowS
$cshowList :: [NetworkResourceUtilization] -> ShowS
show :: NetworkResourceUtilization -> String
$cshow :: NetworkResourceUtilization -> String
showsPrec :: Int -> NetworkResourceUtilization -> ShowS
$cshowsPrec :: Int -> NetworkResourceUtilization -> ShowS
Prelude.Show, (forall x.
 NetworkResourceUtilization -> Rep NetworkResourceUtilization x)
-> (forall x.
    Rep NetworkResourceUtilization x -> NetworkResourceUtilization)
-> Generic NetworkResourceUtilization
forall x.
Rep NetworkResourceUtilization x -> NetworkResourceUtilization
forall x.
NetworkResourceUtilization -> Rep NetworkResourceUtilization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkResourceUtilization x -> NetworkResourceUtilization
$cfrom :: forall x.
NetworkResourceUtilization -> Rep NetworkResourceUtilization x
Prelude.Generic)

-- |
-- Create a value of 'NetworkResourceUtilization' 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:
--
-- 'networkPacketsOutPerSecond', 'networkResourceUtilization_networkPacketsOutPerSecond' - The network outgress packets that are measured in packets per second.
--
-- 'networkInBytesPerSecond', 'networkResourceUtilization_networkInBytesPerSecond' - The network inbound throughput utilization measured in Bytes per second.
--
-- 'networkPacketsInPerSecond', 'networkResourceUtilization_networkPacketsInPerSecond' - The network ingress packets that are measured in packets per second.
--
-- 'networkOutBytesPerSecond', 'networkResourceUtilization_networkOutBytesPerSecond' - The network outbound throughput utilization measured in Bytes per
-- second.
newNetworkResourceUtilization ::
  NetworkResourceUtilization
newNetworkResourceUtilization :: NetworkResourceUtilization
newNetworkResourceUtilization =
  NetworkResourceUtilization' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> NetworkResourceUtilization
NetworkResourceUtilization'
    { $sel:networkPacketsOutPerSecond:NetworkResourceUtilization' :: Maybe Text
networkPacketsOutPerSecond =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkInBytesPerSecond:NetworkResourceUtilization' :: Maybe Text
networkInBytesPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkPacketsInPerSecond:NetworkResourceUtilization' :: Maybe Text
networkPacketsInPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:networkOutBytesPerSecond:NetworkResourceUtilization' :: Maybe Text
networkOutBytesPerSecond = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The network outgress packets that are measured in packets per second.
networkResourceUtilization_networkPacketsOutPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkPacketsOutPerSecond :: (Maybe Text -> f (Maybe Text))
-> NetworkResourceUtilization -> f NetworkResourceUtilization
networkResourceUtilization_networkPacketsOutPerSecond = (NetworkResourceUtilization -> Maybe Text)
-> (NetworkResourceUtilization
    -> Maybe Text -> NetworkResourceUtilization)
-> Lens
     NetworkResourceUtilization
     NetworkResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkResourceUtilization' {Maybe Text
networkPacketsOutPerSecond :: Maybe Text
$sel:networkPacketsOutPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
networkPacketsOutPerSecond} -> Maybe Text
networkPacketsOutPerSecond) (\s :: NetworkResourceUtilization
s@NetworkResourceUtilization' {} Maybe Text
a -> NetworkResourceUtilization
s {$sel:networkPacketsOutPerSecond:NetworkResourceUtilization' :: Maybe Text
networkPacketsOutPerSecond = Maybe Text
a} :: NetworkResourceUtilization)

-- | The network inbound throughput utilization measured in Bytes per second.
networkResourceUtilization_networkInBytesPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkInBytesPerSecond :: (Maybe Text -> f (Maybe Text))
-> NetworkResourceUtilization -> f NetworkResourceUtilization
networkResourceUtilization_networkInBytesPerSecond = (NetworkResourceUtilization -> Maybe Text)
-> (NetworkResourceUtilization
    -> Maybe Text -> NetworkResourceUtilization)
-> Lens
     NetworkResourceUtilization
     NetworkResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkResourceUtilization' {Maybe Text
networkInBytesPerSecond :: Maybe Text
$sel:networkInBytesPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
networkInBytesPerSecond} -> Maybe Text
networkInBytesPerSecond) (\s :: NetworkResourceUtilization
s@NetworkResourceUtilization' {} Maybe Text
a -> NetworkResourceUtilization
s {$sel:networkInBytesPerSecond:NetworkResourceUtilization' :: Maybe Text
networkInBytesPerSecond = Maybe Text
a} :: NetworkResourceUtilization)

-- | The network ingress packets that are measured in packets per second.
networkResourceUtilization_networkPacketsInPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkPacketsInPerSecond :: (Maybe Text -> f (Maybe Text))
-> NetworkResourceUtilization -> f NetworkResourceUtilization
networkResourceUtilization_networkPacketsInPerSecond = (NetworkResourceUtilization -> Maybe Text)
-> (NetworkResourceUtilization
    -> Maybe Text -> NetworkResourceUtilization)
-> Lens
     NetworkResourceUtilization
     NetworkResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkResourceUtilization' {Maybe Text
networkPacketsInPerSecond :: Maybe Text
$sel:networkPacketsInPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
networkPacketsInPerSecond} -> Maybe Text
networkPacketsInPerSecond) (\s :: NetworkResourceUtilization
s@NetworkResourceUtilization' {} Maybe Text
a -> NetworkResourceUtilization
s {$sel:networkPacketsInPerSecond:NetworkResourceUtilization' :: Maybe Text
networkPacketsInPerSecond = Maybe Text
a} :: NetworkResourceUtilization)

-- | The network outbound throughput utilization measured in Bytes per
-- second.
networkResourceUtilization_networkOutBytesPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkOutBytesPerSecond :: (Maybe Text -> f (Maybe Text))
-> NetworkResourceUtilization -> f NetworkResourceUtilization
networkResourceUtilization_networkOutBytesPerSecond = (NetworkResourceUtilization -> Maybe Text)
-> (NetworkResourceUtilization
    -> Maybe Text -> NetworkResourceUtilization)
-> Lens
     NetworkResourceUtilization
     NetworkResourceUtilization
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkResourceUtilization' {Maybe Text
networkOutBytesPerSecond :: Maybe Text
$sel:networkOutBytesPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
networkOutBytesPerSecond} -> Maybe Text
networkOutBytesPerSecond) (\s :: NetworkResourceUtilization
s@NetworkResourceUtilization' {} Maybe Text
a -> NetworkResourceUtilization
s {$sel:networkOutBytesPerSecond:NetworkResourceUtilization' :: Maybe Text
networkOutBytesPerSecond = Maybe Text
a} :: NetworkResourceUtilization)

instance Core.FromJSON NetworkResourceUtilization where
  parseJSON :: Value -> Parser NetworkResourceUtilization
parseJSON =
    String
-> (Object -> Parser NetworkResourceUtilization)
-> Value
-> Parser NetworkResourceUtilization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NetworkResourceUtilization"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> NetworkResourceUtilization
NetworkResourceUtilization'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> NetworkResourceUtilization)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> NetworkResourceUtilization)
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
"NetworkPacketsOutPerSecond")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> NetworkResourceUtilization)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> NetworkResourceUtilization)
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
"NetworkInBytesPerSecond")
            Parser (Maybe Text -> Maybe Text -> NetworkResourceUtilization)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> NetworkResourceUtilization)
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
"NetworkPacketsInPerSecond")
            Parser (Maybe Text -> NetworkResourceUtilization)
-> Parser (Maybe Text) -> Parser NetworkResourceUtilization
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
"NetworkOutBytesPerSecond")
      )

instance Prelude.Hashable NetworkResourceUtilization

instance Prelude.NFData NetworkResourceUtilization