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

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

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

instance
  Data.FromJSON
    VirtualGatewayGrpcConnectionPool
  where
  parseJSON :: Value -> Parser VirtualGatewayGrpcConnectionPool
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VirtualGatewayGrpcConnectionPool"
      ( \Object
x ->
          Natural -> VirtualGatewayGrpcConnectionPool
VirtualGatewayGrpcConnectionPool'
            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
    VirtualGatewayGrpcConnectionPool
  where
  hashWithSalt :: Int -> VirtualGatewayGrpcConnectionPool -> Int
hashWithSalt
    Int
_salt
    VirtualGatewayGrpcConnectionPool' {Natural
maxRequests :: Natural
$sel:maxRequests:VirtualGatewayGrpcConnectionPool' :: VirtualGatewayGrpcConnectionPool -> Natural
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
maxRequests

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

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