{-# 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.BaselineEbsBandwidthMbps
-- 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.BaselineEbsBandwidthMbps 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 baseline bandwidth to Amazon EBS, in Mbps. For
-- more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html Amazon EBS–optimized instances>
-- in the /Amazon EC2 User Guide/.
--
-- /See:/ 'newBaselineEbsBandwidthMbps' smart constructor.
data BaselineEbsBandwidthMbps = BaselineEbsBandwidthMbps'
  { -- | The maximum baseline bandwidth, in Mbps. If this parameter is not
    -- specified, there is no maximum limit.
    BaselineEbsBandwidthMbps -> Maybe Int
max :: Prelude.Maybe Prelude.Int,
    -- | The minimum baseline bandwidth, in Mbps. If this parameter is not
    -- specified, there is no minimum limit.
    BaselineEbsBandwidthMbps -> Maybe Int
min :: Prelude.Maybe Prelude.Int
  }
  deriving (BaselineEbsBandwidthMbps -> BaselineEbsBandwidthMbps -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BaselineEbsBandwidthMbps -> BaselineEbsBandwidthMbps -> Bool
$c/= :: BaselineEbsBandwidthMbps -> BaselineEbsBandwidthMbps -> Bool
== :: BaselineEbsBandwidthMbps -> BaselineEbsBandwidthMbps -> Bool
$c== :: BaselineEbsBandwidthMbps -> BaselineEbsBandwidthMbps -> Bool
Prelude.Eq, ReadPrec [BaselineEbsBandwidthMbps]
ReadPrec BaselineEbsBandwidthMbps
Int -> ReadS BaselineEbsBandwidthMbps
ReadS [BaselineEbsBandwidthMbps]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BaselineEbsBandwidthMbps]
$creadListPrec :: ReadPrec [BaselineEbsBandwidthMbps]
readPrec :: ReadPrec BaselineEbsBandwidthMbps
$creadPrec :: ReadPrec BaselineEbsBandwidthMbps
readList :: ReadS [BaselineEbsBandwidthMbps]
$creadList :: ReadS [BaselineEbsBandwidthMbps]
readsPrec :: Int -> ReadS BaselineEbsBandwidthMbps
$creadsPrec :: Int -> ReadS BaselineEbsBandwidthMbps
Prelude.Read, Int -> BaselineEbsBandwidthMbps -> ShowS
[BaselineEbsBandwidthMbps] -> ShowS
BaselineEbsBandwidthMbps -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BaselineEbsBandwidthMbps] -> ShowS
$cshowList :: [BaselineEbsBandwidthMbps] -> ShowS
show :: BaselineEbsBandwidthMbps -> String
$cshow :: BaselineEbsBandwidthMbps -> String
showsPrec :: Int -> BaselineEbsBandwidthMbps -> ShowS
$cshowsPrec :: Int -> BaselineEbsBandwidthMbps -> ShowS
Prelude.Show, forall x.
Rep BaselineEbsBandwidthMbps x -> BaselineEbsBandwidthMbps
forall x.
BaselineEbsBandwidthMbps -> Rep BaselineEbsBandwidthMbps x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BaselineEbsBandwidthMbps x -> BaselineEbsBandwidthMbps
$cfrom :: forall x.
BaselineEbsBandwidthMbps -> Rep BaselineEbsBandwidthMbps x
Prelude.Generic)

-- |
-- Create a value of 'BaselineEbsBandwidthMbps' 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', 'baselineEbsBandwidthMbps_max' - The maximum baseline bandwidth, in Mbps. If this parameter is not
-- specified, there is no maximum limit.
--
-- 'min', 'baselineEbsBandwidthMbps_min' - The minimum baseline bandwidth, in Mbps. If this parameter is not
-- specified, there is no minimum limit.
newBaselineEbsBandwidthMbps ::
  BaselineEbsBandwidthMbps
newBaselineEbsBandwidthMbps :: BaselineEbsBandwidthMbps
newBaselineEbsBandwidthMbps =
  BaselineEbsBandwidthMbps'
    { $sel:max:BaselineEbsBandwidthMbps' :: Maybe Int
max = forall a. Maybe a
Prelude.Nothing,
      $sel:min:BaselineEbsBandwidthMbps' :: Maybe Int
min = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum baseline bandwidth, in Mbps. If this parameter is not
-- specified, there is no maximum limit.
baselineEbsBandwidthMbps_max :: Lens.Lens' BaselineEbsBandwidthMbps (Prelude.Maybe Prelude.Int)
baselineEbsBandwidthMbps_max :: Lens' BaselineEbsBandwidthMbps (Maybe Int)
baselineEbsBandwidthMbps_max = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BaselineEbsBandwidthMbps' {Maybe Int
max :: Maybe Int
$sel:max:BaselineEbsBandwidthMbps' :: BaselineEbsBandwidthMbps -> Maybe Int
max} -> Maybe Int
max) (\s :: BaselineEbsBandwidthMbps
s@BaselineEbsBandwidthMbps' {} Maybe Int
a -> BaselineEbsBandwidthMbps
s {$sel:max:BaselineEbsBandwidthMbps' :: Maybe Int
max = Maybe Int
a} :: BaselineEbsBandwidthMbps)

-- | The minimum baseline bandwidth, in Mbps. If this parameter is not
-- specified, there is no minimum limit.
baselineEbsBandwidthMbps_min :: Lens.Lens' BaselineEbsBandwidthMbps (Prelude.Maybe Prelude.Int)
baselineEbsBandwidthMbps_min :: Lens' BaselineEbsBandwidthMbps (Maybe Int)
baselineEbsBandwidthMbps_min = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BaselineEbsBandwidthMbps' {Maybe Int
min :: Maybe Int
$sel:min:BaselineEbsBandwidthMbps' :: BaselineEbsBandwidthMbps -> Maybe Int
min} -> Maybe Int
min) (\s :: BaselineEbsBandwidthMbps
s@BaselineEbsBandwidthMbps' {} Maybe Int
a -> BaselineEbsBandwidthMbps
s {$sel:min:BaselineEbsBandwidthMbps' :: Maybe Int
min = Maybe Int
a} :: BaselineEbsBandwidthMbps)

instance Data.FromXML BaselineEbsBandwidthMbps where
  parseXML :: [Node] -> Either String BaselineEbsBandwidthMbps
parseXML [Node]
x =
    Maybe Int -> Maybe Int -> BaselineEbsBandwidthMbps
BaselineEbsBandwidthMbps'
      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 BaselineEbsBandwidthMbps where
  hashWithSalt :: Int -> BaselineEbsBandwidthMbps -> Int
hashWithSalt Int
_salt BaselineEbsBandwidthMbps' {Maybe Int
min :: Maybe Int
max :: Maybe Int
$sel:min:BaselineEbsBandwidthMbps' :: BaselineEbsBandwidthMbps -> Maybe Int
$sel:max:BaselineEbsBandwidthMbps' :: BaselineEbsBandwidthMbps -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
max
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
min

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

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