{-# 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-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.VirtualGatewayGrpcConnectionPool 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:/ '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
(VirtualGatewayGrpcConnectionPool
 -> VirtualGatewayGrpcConnectionPool -> Bool)
-> (VirtualGatewayGrpcConnectionPool
    -> VirtualGatewayGrpcConnectionPool -> Bool)
-> Eq VirtualGatewayGrpcConnectionPool
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]
(Int -> ReadS VirtualGatewayGrpcConnectionPool)
-> ReadS [VirtualGatewayGrpcConnectionPool]
-> ReadPrec VirtualGatewayGrpcConnectionPool
-> ReadPrec [VirtualGatewayGrpcConnectionPool]
-> Read 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
(Int -> VirtualGatewayGrpcConnectionPool -> ShowS)
-> (VirtualGatewayGrpcConnectionPool -> String)
-> ([VirtualGatewayGrpcConnectionPool] -> ShowS)
-> Show VirtualGatewayGrpcConnectionPool
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.
 VirtualGatewayGrpcConnectionPool
 -> Rep VirtualGatewayGrpcConnectionPool x)
-> (forall x.
    Rep VirtualGatewayGrpcConnectionPool x
    -> VirtualGatewayGrpcConnectionPool)
-> Generic VirtualGatewayGrpcConnectionPool
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' :: Natural -> VirtualGatewayGrpcConnectionPool
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 :: (Natural -> f Natural)
-> VirtualGatewayGrpcConnectionPool
-> f VirtualGatewayGrpcConnectionPool
virtualGatewayGrpcConnectionPool_maxRequests = (VirtualGatewayGrpcConnectionPool -> Natural)
-> (VirtualGatewayGrpcConnectionPool
    -> Natural -> VirtualGatewayGrpcConnectionPool)
-> Lens
     VirtualGatewayGrpcConnectionPool
     VirtualGatewayGrpcConnectionPool
     Natural
     Natural
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
  Core.FromJSON
    VirtualGatewayGrpcConnectionPool
  where
  parseJSON :: Value -> Parser VirtualGatewayGrpcConnectionPool
parseJSON =
    String
-> (Object -> Parser VirtualGatewayGrpcConnectionPool)
-> Value
-> Parser VirtualGatewayGrpcConnectionPool
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VirtualGatewayGrpcConnectionPool"
      ( \Object
x ->
          Natural -> VirtualGatewayGrpcConnectionPool
VirtualGatewayGrpcConnectionPool'
            (Natural -> VirtualGatewayGrpcConnectionPool)
-> Parser Natural -> Parser VirtualGatewayGrpcConnectionPool
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
    VirtualGatewayGrpcConnectionPool

instance
  Prelude.NFData
    VirtualGatewayGrpcConnectionPool

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