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

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

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

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

instance Prelude.NFData VirtualNodeGrpcConnectionPool

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