{-# 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.AppMesh.Types.VirtualGatewayHttp2ConnectionPool
-- 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.AppMesh.Types.VirtualGatewayHttp2ConnectionPool 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

-- | An object that represents a type of connection pool.
--
-- /See:/ 'newVirtualGatewayHttp2ConnectionPool' smart constructor.
data VirtualGatewayHttp2ConnectionPool = VirtualGatewayHttp2ConnectionPool'
  { -- | Maximum number of inflight requests Envoy can concurrently support
    -- across hosts in upstream cluster.
    VirtualGatewayHttp2ConnectionPool -> Natural
maxRequests :: Prelude.Natural
  }
  deriving (VirtualGatewayHttp2ConnectionPool
-> VirtualGatewayHttp2ConnectionPool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualGatewayHttp2ConnectionPool
-> VirtualGatewayHttp2ConnectionPool -> Bool
$c/= :: VirtualGatewayHttp2ConnectionPool
-> VirtualGatewayHttp2ConnectionPool -> Bool
== :: VirtualGatewayHttp2ConnectionPool
-> VirtualGatewayHttp2ConnectionPool -> Bool
$c== :: VirtualGatewayHttp2ConnectionPool
-> VirtualGatewayHttp2ConnectionPool -> Bool
Prelude.Eq, ReadPrec [VirtualGatewayHttp2ConnectionPool]
ReadPrec VirtualGatewayHttp2ConnectionPool
Int -> ReadS VirtualGatewayHttp2ConnectionPool
ReadS [VirtualGatewayHttp2ConnectionPool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualGatewayHttp2ConnectionPool]
$creadListPrec :: ReadPrec [VirtualGatewayHttp2ConnectionPool]
readPrec :: ReadPrec VirtualGatewayHttp2ConnectionPool
$creadPrec :: ReadPrec VirtualGatewayHttp2ConnectionPool
readList :: ReadS [VirtualGatewayHttp2ConnectionPool]
$creadList :: ReadS [VirtualGatewayHttp2ConnectionPool]
readsPrec :: Int -> ReadS VirtualGatewayHttp2ConnectionPool
$creadsPrec :: Int -> ReadS VirtualGatewayHttp2ConnectionPool
Prelude.Read, Int -> VirtualGatewayHttp2ConnectionPool -> ShowS
[VirtualGatewayHttp2ConnectionPool] -> ShowS
VirtualGatewayHttp2ConnectionPool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualGatewayHttp2ConnectionPool] -> ShowS
$cshowList :: [VirtualGatewayHttp2ConnectionPool] -> ShowS
show :: VirtualGatewayHttp2ConnectionPool -> String
$cshow :: VirtualGatewayHttp2ConnectionPool -> String
showsPrec :: Int -> VirtualGatewayHttp2ConnectionPool -> ShowS
$cshowsPrec :: Int -> VirtualGatewayHttp2ConnectionPool -> ShowS
Prelude.Show, forall x.
Rep VirtualGatewayHttp2ConnectionPool x
-> VirtualGatewayHttp2ConnectionPool
forall x.
VirtualGatewayHttp2ConnectionPool
-> Rep VirtualGatewayHttp2ConnectionPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualGatewayHttp2ConnectionPool x
-> VirtualGatewayHttp2ConnectionPool
$cfrom :: forall x.
VirtualGatewayHttp2ConnectionPool
-> Rep VirtualGatewayHttp2ConnectionPool x
Prelude.Generic)

-- |
-- Create a value of 'VirtualGatewayHttp2ConnectionPool' 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:
--
-- 'maxRequests', 'virtualGatewayHttp2ConnectionPool_maxRequests' - Maximum number of inflight requests Envoy can concurrently support
-- across hosts in upstream cluster.
newVirtualGatewayHttp2ConnectionPool ::
  -- | 'maxRequests'
  Prelude.Natural ->
  VirtualGatewayHttp2ConnectionPool
newVirtualGatewayHttp2ConnectionPool :: Natural -> VirtualGatewayHttp2ConnectionPool
newVirtualGatewayHttp2ConnectionPool Natural
pMaxRequests_ =
  VirtualGatewayHttp2ConnectionPool'
    { $sel:maxRequests:VirtualGatewayHttp2ConnectionPool' :: Natural
maxRequests =
        Natural
pMaxRequests_
    }

-- | Maximum number of inflight requests Envoy can concurrently support
-- across hosts in upstream cluster.
virtualGatewayHttp2ConnectionPool_maxRequests :: Lens.Lens' VirtualGatewayHttp2ConnectionPool Prelude.Natural
virtualGatewayHttp2ConnectionPool_maxRequests :: Lens' VirtualGatewayHttp2ConnectionPool Natural
virtualGatewayHttp2ConnectionPool_maxRequests = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VirtualGatewayHttp2ConnectionPool' {Natural
maxRequests :: Natural
$sel:maxRequests:VirtualGatewayHttp2ConnectionPool' :: VirtualGatewayHttp2ConnectionPool -> Natural
maxRequests} -> Natural
maxRequests) (\s :: VirtualGatewayHttp2ConnectionPool
s@VirtualGatewayHttp2ConnectionPool' {} Natural
a -> VirtualGatewayHttp2ConnectionPool
s {$sel:maxRequests:VirtualGatewayHttp2ConnectionPool' :: Natural
maxRequests = Natural
a} :: VirtualGatewayHttp2ConnectionPool)

instance
  Data.FromJSON
    VirtualGatewayHttp2ConnectionPool
  where
  parseJSON :: Value -> Parser VirtualGatewayHttp2ConnectionPool
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VirtualGatewayHttp2ConnectionPool"
      ( \Object
x ->
          Natural -> VirtualGatewayHttp2ConnectionPool
VirtualGatewayHttp2ConnectionPool'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"maxRequests")
      )

instance
  Prelude.Hashable
    VirtualGatewayHttp2ConnectionPool
  where
  hashWithSalt :: Int -> VirtualGatewayHttp2ConnectionPool -> Int
hashWithSalt
    Int
_salt
    VirtualGatewayHttp2ConnectionPool' {Natural
maxRequests :: Natural
$sel:maxRequests:VirtualGatewayHttp2ConnectionPool' :: VirtualGatewayHttp2ConnectionPool -> Natural
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxRequests

instance
  Prelude.NFData
    VirtualGatewayHttp2ConnectionPool
  where
  rnf :: VirtualGatewayHttp2ConnectionPool -> ()
rnf VirtualGatewayHttp2ConnectionPool' {Natural
maxRequests :: Natural
$sel:maxRequests:VirtualGatewayHttp2ConnectionPool' :: VirtualGatewayHttp2ConnectionPool -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
maxRequests

instance
  Data.ToJSON
    VirtualGatewayHttp2ConnectionPool
  where
  toJSON :: VirtualGatewayHttp2ConnectionPool -> Value
toJSON VirtualGatewayHttp2ConnectionPool' {Natural
maxRequests :: Natural
$sel:maxRequests:VirtualGatewayHttp2ConnectionPool' :: VirtualGatewayHttp2ConnectionPool -> Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"maxRequests" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
maxRequests)]
      )