{-# 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.EC2.Types.NetworkBandwidthGbps
-- 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.EC2.Types.NetworkBandwidthGbps where

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

-- | The minimum and maximum amount of network bandwidth, in gigabits per
-- second (Gbps).
--
-- Setting the minimum bandwidth does not guarantee that your instance will
-- achieve the minimum bandwidth. Amazon EC2 will identify instance types
-- that support the specified minimum bandwidth, but the actual bandwidth
-- of your instance might go below the specified minimum at times. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html#available-instance-bandwidth Available instance bandwidth>
-- in the /Amazon EC2 User Guide/.
--
-- /See:/ 'newNetworkBandwidthGbps' smart constructor.
data NetworkBandwidthGbps = NetworkBandwidthGbps'
  { -- | The maximum amount of network bandwidth, in Gbps. If this parameter is
    -- not specified, there is no maximum limit.
    NetworkBandwidthGbps -> Maybe Double
max :: Prelude.Maybe Prelude.Double,
    -- | The minimum amount of network bandwidth, in Gbps. If this parameter is
    -- not specified, there is no minimum limit.
    NetworkBandwidthGbps -> Maybe Double
min :: Prelude.Maybe Prelude.Double
  }
  deriving (NetworkBandwidthGbps -> NetworkBandwidthGbps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkBandwidthGbps -> NetworkBandwidthGbps -> Bool
$c/= :: NetworkBandwidthGbps -> NetworkBandwidthGbps -> Bool
== :: NetworkBandwidthGbps -> NetworkBandwidthGbps -> Bool
$c== :: NetworkBandwidthGbps -> NetworkBandwidthGbps -> Bool
Prelude.Eq, ReadPrec [NetworkBandwidthGbps]
ReadPrec NetworkBandwidthGbps
Int -> ReadS NetworkBandwidthGbps
ReadS [NetworkBandwidthGbps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkBandwidthGbps]
$creadListPrec :: ReadPrec [NetworkBandwidthGbps]
readPrec :: ReadPrec NetworkBandwidthGbps
$creadPrec :: ReadPrec NetworkBandwidthGbps
readList :: ReadS [NetworkBandwidthGbps]
$creadList :: ReadS [NetworkBandwidthGbps]
readsPrec :: Int -> ReadS NetworkBandwidthGbps
$creadsPrec :: Int -> ReadS NetworkBandwidthGbps
Prelude.Read, Int -> NetworkBandwidthGbps -> ShowS
[NetworkBandwidthGbps] -> ShowS
NetworkBandwidthGbps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkBandwidthGbps] -> ShowS
$cshowList :: [NetworkBandwidthGbps] -> ShowS
show :: NetworkBandwidthGbps -> String
$cshow :: NetworkBandwidthGbps -> String
showsPrec :: Int -> NetworkBandwidthGbps -> ShowS
$cshowsPrec :: Int -> NetworkBandwidthGbps -> ShowS
Prelude.Show, forall x. Rep NetworkBandwidthGbps x -> NetworkBandwidthGbps
forall x. NetworkBandwidthGbps -> Rep NetworkBandwidthGbps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkBandwidthGbps x -> NetworkBandwidthGbps
$cfrom :: forall x. NetworkBandwidthGbps -> Rep NetworkBandwidthGbps x
Prelude.Generic)

-- |
-- Create a value of 'NetworkBandwidthGbps' 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:
--
-- 'max', 'networkBandwidthGbps_max' - The maximum amount of network bandwidth, in Gbps. If this parameter is
-- not specified, there is no maximum limit.
--
-- 'min', 'networkBandwidthGbps_min' - The minimum amount of network bandwidth, in Gbps. If this parameter is
-- not specified, there is no minimum limit.
newNetworkBandwidthGbps ::
  NetworkBandwidthGbps
newNetworkBandwidthGbps :: NetworkBandwidthGbps
newNetworkBandwidthGbps =
  NetworkBandwidthGbps'
    { $sel:max:NetworkBandwidthGbps' :: Maybe Double
max = forall a. Maybe a
Prelude.Nothing,
      $sel:min:NetworkBandwidthGbps' :: Maybe Double
min = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum amount of network bandwidth, in Gbps. If this parameter is
-- not specified, there is no maximum limit.
networkBandwidthGbps_max :: Lens.Lens' NetworkBandwidthGbps (Prelude.Maybe Prelude.Double)
networkBandwidthGbps_max :: Lens' NetworkBandwidthGbps (Maybe Double)
networkBandwidthGbps_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkBandwidthGbps' {Maybe Double
max :: Maybe Double
$sel:max:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
max} -> Maybe Double
max) (\s :: NetworkBandwidthGbps
s@NetworkBandwidthGbps' {} Maybe Double
a -> NetworkBandwidthGbps
s {$sel:max:NetworkBandwidthGbps' :: Maybe Double
max = Maybe Double
a} :: NetworkBandwidthGbps)

-- | The minimum amount of network bandwidth, in Gbps. If this parameter is
-- not specified, there is no minimum limit.
networkBandwidthGbps_min :: Lens.Lens' NetworkBandwidthGbps (Prelude.Maybe Prelude.Double)
networkBandwidthGbps_min :: Lens' NetworkBandwidthGbps (Maybe Double)
networkBandwidthGbps_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkBandwidthGbps' {Maybe Double
min :: Maybe Double
$sel:min:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
min} -> Maybe Double
min) (\s :: NetworkBandwidthGbps
s@NetworkBandwidthGbps' {} Maybe Double
a -> NetworkBandwidthGbps
s {$sel:min:NetworkBandwidthGbps' :: Maybe Double
min = Maybe Double
a} :: NetworkBandwidthGbps)

instance Data.FromXML NetworkBandwidthGbps where
  parseXML :: [Node] -> Either String NetworkBandwidthGbps
parseXML [Node]
x =
    Maybe Double -> Maybe Double -> NetworkBandwidthGbps
NetworkBandwidthGbps'
      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
"max")
      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
"min")

instance Prelude.Hashable NetworkBandwidthGbps where
  hashWithSalt :: Int -> NetworkBandwidthGbps -> Int
hashWithSalt Int
_salt NetworkBandwidthGbps' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
$sel:max:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
max
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
min

instance Prelude.NFData NetworkBandwidthGbps where
  rnf :: NetworkBandwidthGbps -> ()
rnf NetworkBandwidthGbps' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
$sel:max:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
max seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
min

instance Data.ToQuery NetworkBandwidthGbps where
  toQuery :: NetworkBandwidthGbps -> QueryString
toQuery NetworkBandwidthGbps' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
$sel:max:NetworkBandwidthGbps' :: NetworkBandwidthGbps -> Maybe Double
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"Max" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Double
max, ByteString
"Min" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Double
min]