{-# 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.AutoScaling.Types.NetworkBandwidthGbpsRequest
-- 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.AutoScaling.Types.NetworkBandwidthGbpsRequest 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

-- | Specifies the minimum and maximum for the @NetworkBandwidthGbps@ object
-- when you specify InstanceRequirements for an Auto Scaling group.
--
-- 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 for Linux Instances/.
--
-- /See:/ 'newNetworkBandwidthGbpsRequest' smart constructor.
data NetworkBandwidthGbpsRequest = NetworkBandwidthGbpsRequest'
  { -- | The maximum amount of network bandwidth, in gigabits per second (Gbps).
    NetworkBandwidthGbpsRequest -> Maybe Double
max :: Prelude.Maybe Prelude.Double,
    -- | The minimum amount of network bandwidth, in gigabits per second (Gbps).
    NetworkBandwidthGbpsRequest -> Maybe Double
min :: Prelude.Maybe Prelude.Double
  }
  deriving (NetworkBandwidthGbpsRequest -> NetworkBandwidthGbpsRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkBandwidthGbpsRequest -> NetworkBandwidthGbpsRequest -> Bool
$c/= :: NetworkBandwidthGbpsRequest -> NetworkBandwidthGbpsRequest -> Bool
== :: NetworkBandwidthGbpsRequest -> NetworkBandwidthGbpsRequest -> Bool
$c== :: NetworkBandwidthGbpsRequest -> NetworkBandwidthGbpsRequest -> Bool
Prelude.Eq, ReadPrec [NetworkBandwidthGbpsRequest]
ReadPrec NetworkBandwidthGbpsRequest
Int -> ReadS NetworkBandwidthGbpsRequest
ReadS [NetworkBandwidthGbpsRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkBandwidthGbpsRequest]
$creadListPrec :: ReadPrec [NetworkBandwidthGbpsRequest]
readPrec :: ReadPrec NetworkBandwidthGbpsRequest
$creadPrec :: ReadPrec NetworkBandwidthGbpsRequest
readList :: ReadS [NetworkBandwidthGbpsRequest]
$creadList :: ReadS [NetworkBandwidthGbpsRequest]
readsPrec :: Int -> ReadS NetworkBandwidthGbpsRequest
$creadsPrec :: Int -> ReadS NetworkBandwidthGbpsRequest
Prelude.Read, Int -> NetworkBandwidthGbpsRequest -> ShowS
[NetworkBandwidthGbpsRequest] -> ShowS
NetworkBandwidthGbpsRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkBandwidthGbpsRequest] -> ShowS
$cshowList :: [NetworkBandwidthGbpsRequest] -> ShowS
show :: NetworkBandwidthGbpsRequest -> String
$cshow :: NetworkBandwidthGbpsRequest -> String
showsPrec :: Int -> NetworkBandwidthGbpsRequest -> ShowS
$cshowsPrec :: Int -> NetworkBandwidthGbpsRequest -> ShowS
Prelude.Show, forall x.
Rep NetworkBandwidthGbpsRequest x -> NetworkBandwidthGbpsRequest
forall x.
NetworkBandwidthGbpsRequest -> Rep NetworkBandwidthGbpsRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkBandwidthGbpsRequest x -> NetworkBandwidthGbpsRequest
$cfrom :: forall x.
NetworkBandwidthGbpsRequest -> Rep NetworkBandwidthGbpsRequest x
Prelude.Generic)

-- |
-- Create a value of 'NetworkBandwidthGbpsRequest' 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', 'networkBandwidthGbpsRequest_max' - The maximum amount of network bandwidth, in gigabits per second (Gbps).
--
-- 'min', 'networkBandwidthGbpsRequest_min' - The minimum amount of network bandwidth, in gigabits per second (Gbps).
newNetworkBandwidthGbpsRequest ::
  NetworkBandwidthGbpsRequest
newNetworkBandwidthGbpsRequest :: NetworkBandwidthGbpsRequest
newNetworkBandwidthGbpsRequest =
  NetworkBandwidthGbpsRequest'
    { $sel:max:NetworkBandwidthGbpsRequest' :: Maybe Double
max = forall a. Maybe a
Prelude.Nothing,
      $sel:min:NetworkBandwidthGbpsRequest' :: Maybe Double
min = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum amount of network bandwidth, in gigabits per second (Gbps).
networkBandwidthGbpsRequest_max :: Lens.Lens' NetworkBandwidthGbpsRequest (Prelude.Maybe Prelude.Double)
networkBandwidthGbpsRequest_max :: Lens' NetworkBandwidthGbpsRequest (Maybe Double)
networkBandwidthGbpsRequest_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkBandwidthGbpsRequest' {Maybe Double
max :: Maybe Double
$sel:max:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> Maybe Double
max} -> Maybe Double
max) (\s :: NetworkBandwidthGbpsRequest
s@NetworkBandwidthGbpsRequest' {} Maybe Double
a -> NetworkBandwidthGbpsRequest
s {$sel:max:NetworkBandwidthGbpsRequest' :: Maybe Double
max = Maybe Double
a} :: NetworkBandwidthGbpsRequest)

-- | The minimum amount of network bandwidth, in gigabits per second (Gbps).
networkBandwidthGbpsRequest_min :: Lens.Lens' NetworkBandwidthGbpsRequest (Prelude.Maybe Prelude.Double)
networkBandwidthGbpsRequest_min :: Lens' NetworkBandwidthGbpsRequest (Maybe Double)
networkBandwidthGbpsRequest_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkBandwidthGbpsRequest' {Maybe Double
min :: Maybe Double
$sel:min:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> Maybe Double
min} -> Maybe Double
min) (\s :: NetworkBandwidthGbpsRequest
s@NetworkBandwidthGbpsRequest' {} Maybe Double
a -> NetworkBandwidthGbpsRequest
s {$sel:min:NetworkBandwidthGbpsRequest' :: Maybe Double
min = Maybe Double
a} :: NetworkBandwidthGbpsRequest)

instance Data.FromXML NetworkBandwidthGbpsRequest where
  parseXML :: [Node] -> Either String NetworkBandwidthGbpsRequest
parseXML [Node]
x =
    Maybe Double -> Maybe Double -> NetworkBandwidthGbpsRequest
NetworkBandwidthGbpsRequest'
      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 NetworkBandwidthGbpsRequest where
  hashWithSalt :: Int -> NetworkBandwidthGbpsRequest -> Int
hashWithSalt Int
_salt NetworkBandwidthGbpsRequest' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> Maybe Double
$sel:max:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> 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 NetworkBandwidthGbpsRequest where
  rnf :: NetworkBandwidthGbpsRequest -> ()
rnf NetworkBandwidthGbpsRequest' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> Maybe Double
$sel:max:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> 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 NetworkBandwidthGbpsRequest where
  toQuery :: NetworkBandwidthGbpsRequest -> QueryString
toQuery NetworkBandwidthGbpsRequest' {Maybe Double
min :: Maybe Double
max :: Maybe Double
$sel:min:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> Maybe Double
$sel:max:NetworkBandwidthGbpsRequest' :: NetworkBandwidthGbpsRequest -> 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]