{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppMesh.Types.VirtualGatewayHttp2ConnectionPool where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(VirtualGatewayHttp2ConnectionPool
 -> VirtualGatewayHttp2ConnectionPool -> Bool)
-> (VirtualGatewayHttp2ConnectionPool
    -> VirtualGatewayHttp2ConnectionPool -> Bool)
-> Eq VirtualGatewayHttp2ConnectionPool
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]
(Int -> ReadS VirtualGatewayHttp2ConnectionPool)
-> ReadS [VirtualGatewayHttp2ConnectionPool]
-> ReadPrec VirtualGatewayHttp2ConnectionPool
-> ReadPrec [VirtualGatewayHttp2ConnectionPool]
-> Read 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
(Int -> VirtualGatewayHttp2ConnectionPool -> ShowS)
-> (VirtualGatewayHttp2ConnectionPool -> String)
-> ([VirtualGatewayHttp2ConnectionPool] -> ShowS)
-> Show VirtualGatewayHttp2ConnectionPool
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.
 VirtualGatewayHttp2ConnectionPool
 -> Rep VirtualGatewayHttp2ConnectionPool x)
-> (forall x.
    Rep VirtualGatewayHttp2ConnectionPool x
    -> VirtualGatewayHttp2ConnectionPool)
-> Generic VirtualGatewayHttp2ConnectionPool
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' :: Natural -> VirtualGatewayHttp2ConnectionPool
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 :: (Natural -> f Natural)
-> VirtualGatewayHttp2ConnectionPool
-> f VirtualGatewayHttp2ConnectionPool
virtualGatewayHttp2ConnectionPool_maxRequests = (VirtualGatewayHttp2ConnectionPool -> Natural)
-> (VirtualGatewayHttp2ConnectionPool
    -> Natural -> VirtualGatewayHttp2ConnectionPool)
-> Lens
     VirtualGatewayHttp2ConnectionPool
     VirtualGatewayHttp2ConnectionPool
     Natural
     Natural
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
  Core.FromJSON
    VirtualGatewayHttp2ConnectionPool
  where
  parseJSON :: Value -> Parser VirtualGatewayHttp2ConnectionPool
parseJSON =
    String
-> (Object -> Parser VirtualGatewayHttp2ConnectionPool)
-> Value
-> Parser VirtualGatewayHttp2ConnectionPool
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualGatewayHttp2ConnectionPool"
      ( \Object
x ->
          Natural -> VirtualGatewayHttp2ConnectionPool
VirtualGatewayHttp2ConnectionPool'
            (Natural -> VirtualGatewayHttp2ConnectionPool)
-> Parser Natural -> Parser VirtualGatewayHttp2ConnectionPool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"maxRequests")
      )

instance
  Prelude.Hashable
    VirtualGatewayHttp2ConnectionPool

instance
  Prelude.NFData
    VirtualGatewayHttp2ConnectionPool

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