{-# 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.VirtualNodeHttp2ConnectionPool
-- 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.VirtualNodeHttp2ConnectionPool 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:/ 'newVirtualNodeHttp2ConnectionPool' smart constructor.
data VirtualNodeHttp2ConnectionPool = VirtualNodeHttp2ConnectionPool'
  { -- | Maximum number of inflight requests Envoy can concurrently support
    -- across hosts in upstream cluster.
    VirtualNodeHttp2ConnectionPool -> Natural
maxRequests :: Prelude.Natural
  }
  deriving (VirtualNodeHttp2ConnectionPool
-> VirtualNodeHttp2ConnectionPool -> Bool
(VirtualNodeHttp2ConnectionPool
 -> VirtualNodeHttp2ConnectionPool -> Bool)
-> (VirtualNodeHttp2ConnectionPool
    -> VirtualNodeHttp2ConnectionPool -> Bool)
-> Eq VirtualNodeHttp2ConnectionPool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VirtualNodeHttp2ConnectionPool
-> VirtualNodeHttp2ConnectionPool -> Bool
$c/= :: VirtualNodeHttp2ConnectionPool
-> VirtualNodeHttp2ConnectionPool -> Bool
== :: VirtualNodeHttp2ConnectionPool
-> VirtualNodeHttp2ConnectionPool -> Bool
$c== :: VirtualNodeHttp2ConnectionPool
-> VirtualNodeHttp2ConnectionPool -> Bool
Prelude.Eq, ReadPrec [VirtualNodeHttp2ConnectionPool]
ReadPrec VirtualNodeHttp2ConnectionPool
Int -> ReadS VirtualNodeHttp2ConnectionPool
ReadS [VirtualNodeHttp2ConnectionPool]
(Int -> ReadS VirtualNodeHttp2ConnectionPool)
-> ReadS [VirtualNodeHttp2ConnectionPool]
-> ReadPrec VirtualNodeHttp2ConnectionPool
-> ReadPrec [VirtualNodeHttp2ConnectionPool]
-> Read VirtualNodeHttp2ConnectionPool
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VirtualNodeHttp2ConnectionPool]
$creadListPrec :: ReadPrec [VirtualNodeHttp2ConnectionPool]
readPrec :: ReadPrec VirtualNodeHttp2ConnectionPool
$creadPrec :: ReadPrec VirtualNodeHttp2ConnectionPool
readList :: ReadS [VirtualNodeHttp2ConnectionPool]
$creadList :: ReadS [VirtualNodeHttp2ConnectionPool]
readsPrec :: Int -> ReadS VirtualNodeHttp2ConnectionPool
$creadsPrec :: Int -> ReadS VirtualNodeHttp2ConnectionPool
Prelude.Read, Int -> VirtualNodeHttp2ConnectionPool -> ShowS
[VirtualNodeHttp2ConnectionPool] -> ShowS
VirtualNodeHttp2ConnectionPool -> String
(Int -> VirtualNodeHttp2ConnectionPool -> ShowS)
-> (VirtualNodeHttp2ConnectionPool -> String)
-> ([VirtualNodeHttp2ConnectionPool] -> ShowS)
-> Show VirtualNodeHttp2ConnectionPool
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VirtualNodeHttp2ConnectionPool] -> ShowS
$cshowList :: [VirtualNodeHttp2ConnectionPool] -> ShowS
show :: VirtualNodeHttp2ConnectionPool -> String
$cshow :: VirtualNodeHttp2ConnectionPool -> String
showsPrec :: Int -> VirtualNodeHttp2ConnectionPool -> ShowS
$cshowsPrec :: Int -> VirtualNodeHttp2ConnectionPool -> ShowS
Prelude.Show, (forall x.
 VirtualNodeHttp2ConnectionPool
 -> Rep VirtualNodeHttp2ConnectionPool x)
-> (forall x.
    Rep VirtualNodeHttp2ConnectionPool x
    -> VirtualNodeHttp2ConnectionPool)
-> Generic VirtualNodeHttp2ConnectionPool
forall x.
Rep VirtualNodeHttp2ConnectionPool x
-> VirtualNodeHttp2ConnectionPool
forall x.
VirtualNodeHttp2ConnectionPool
-> Rep VirtualNodeHttp2ConnectionPool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep VirtualNodeHttp2ConnectionPool x
-> VirtualNodeHttp2ConnectionPool
$cfrom :: forall x.
VirtualNodeHttp2ConnectionPool
-> Rep VirtualNodeHttp2ConnectionPool x
Prelude.Generic)

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

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

instance Core.FromJSON VirtualNodeHttp2ConnectionPool where
  parseJSON :: Value -> Parser VirtualNodeHttp2ConnectionPool
parseJSON =
    String
-> (Object -> Parser VirtualNodeHttp2ConnectionPool)
-> Value
-> Parser VirtualNodeHttp2ConnectionPool
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualNodeHttp2ConnectionPool"
      ( \Object
x ->
          Natural -> VirtualNodeHttp2ConnectionPool
VirtualNodeHttp2ConnectionPool'
            (Natural -> VirtualNodeHttp2ConnectionPool)
-> Parser Natural -> Parser VirtualNodeHttp2ConnectionPool
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
    VirtualNodeHttp2ConnectionPool

instance
  Prelude.NFData
    VirtualNodeHttp2ConnectionPool

instance Core.ToJSON VirtualNodeHttp2ConnectionPool where
  toJSON :: VirtualNodeHttp2ConnectionPool -> Value
toJSON VirtualNodeHttp2ConnectionPool' {Natural
maxRequests :: Natural
$sel:maxRequests:VirtualNodeHttp2ConnectionPool' :: VirtualNodeHttp2ConnectionPool -> 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)]
      )