{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CostExplorer.Types.NetworkResourceUtilization 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

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

-- | The network inbound throughput utilization measured in Bytes per second
-- (Bps).
networkResourceUtilization_networkInBytesPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkInBytesPerSecond :: Lens' NetworkResourceUtilization (Maybe Text)
networkResourceUtilization_networkInBytesPerSecond = 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 outbound throughput utilization measured in Bytes per second
-- (Bps).
networkResourceUtilization_networkOutBytesPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkOutBytesPerSecond :: Lens' NetworkResourceUtilization (Maybe Text)
networkResourceUtilization_networkOutBytesPerSecond = 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)

-- | The network inbound packets that are measured in packets per second.
networkResourceUtilization_networkPacketsInPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkPacketsInPerSecond :: Lens' NetworkResourceUtilization (Maybe Text)
networkResourceUtilization_networkPacketsInPerSecond = 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 packets that are measured in packets per second.
networkResourceUtilization_networkPacketsOutPerSecond :: Lens.Lens' NetworkResourceUtilization (Prelude.Maybe Prelude.Text)
networkResourceUtilization_networkPacketsOutPerSecond :: Lens' NetworkResourceUtilization (Maybe Text)
networkResourceUtilization_networkPacketsOutPerSecond = 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)

instance Data.FromJSON NetworkResourceUtilization where
  parseJSON :: Value -> Parser NetworkResourceUtilization
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkResourceUtilization"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> NetworkResourceUtilization
NetworkResourceUtilization'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NetworkInBytesPerSecond")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NetworkOutBytesPerSecond")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NetworkPacketsInPerSecond")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NetworkPacketsOutPerSecond")
      )

instance Prelude.Hashable NetworkResourceUtilization where
  hashWithSalt :: Int -> NetworkResourceUtilization -> Int
hashWithSalt Int
_salt NetworkResourceUtilization' {Maybe Text
networkPacketsOutPerSecond :: Maybe Text
networkPacketsInPerSecond :: Maybe Text
networkOutBytesPerSecond :: Maybe Text
networkInBytesPerSecond :: Maybe Text
$sel:networkPacketsOutPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
$sel:networkPacketsInPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
$sel:networkOutBytesPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
$sel:networkInBytesPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkInBytesPerSecond
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkOutBytesPerSecond
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkPacketsInPerSecond
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
networkPacketsOutPerSecond

instance Prelude.NFData NetworkResourceUtilization where
  rnf :: NetworkResourceUtilization -> ()
rnf NetworkResourceUtilization' {Maybe Text
networkPacketsOutPerSecond :: Maybe Text
networkPacketsInPerSecond :: Maybe Text
networkOutBytesPerSecond :: Maybe Text
networkInBytesPerSecond :: Maybe Text
$sel:networkPacketsOutPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
$sel:networkPacketsInPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
$sel:networkOutBytesPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
$sel:networkInBytesPerSecond:NetworkResourceUtilization' :: NetworkResourceUtilization -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkInBytesPerSecond
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkOutBytesPerSecond
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkPacketsInPerSecond
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
networkPacketsOutPerSecond