{-# 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.CloudSearch.Types.Limits
-- 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.CloudSearch.Types.Limits where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newLimits' smart constructor.
data Limits = Limits'
  { Limits -> Natural
maximumReplicationCount :: Prelude.Natural,
    Limits -> Natural
maximumPartitionCount :: Prelude.Natural
  }
  deriving (Limits -> Limits -> Bool
(Limits -> Limits -> Bool)
-> (Limits -> Limits -> Bool) -> Eq Limits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Limits -> Limits -> Bool
$c/= :: Limits -> Limits -> Bool
== :: Limits -> Limits -> Bool
$c== :: Limits -> Limits -> Bool
Prelude.Eq, ReadPrec [Limits]
ReadPrec Limits
Int -> ReadS Limits
ReadS [Limits]
(Int -> ReadS Limits)
-> ReadS [Limits]
-> ReadPrec Limits
-> ReadPrec [Limits]
-> Read Limits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Limits]
$creadListPrec :: ReadPrec [Limits]
readPrec :: ReadPrec Limits
$creadPrec :: ReadPrec Limits
readList :: ReadS [Limits]
$creadList :: ReadS [Limits]
readsPrec :: Int -> ReadS Limits
$creadsPrec :: Int -> ReadS Limits
Prelude.Read, Int -> Limits -> ShowS
[Limits] -> ShowS
Limits -> String
(Int -> Limits -> ShowS)
-> (Limits -> String) -> ([Limits] -> ShowS) -> Show Limits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Limits] -> ShowS
$cshowList :: [Limits] -> ShowS
show :: Limits -> String
$cshow :: Limits -> String
showsPrec :: Int -> Limits -> ShowS
$cshowsPrec :: Int -> Limits -> ShowS
Prelude.Show, (forall x. Limits -> Rep Limits x)
-> (forall x. Rep Limits x -> Limits) -> Generic Limits
forall x. Rep Limits x -> Limits
forall x. Limits -> Rep Limits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Limits x -> Limits
$cfrom :: forall x. Limits -> Rep Limits x
Prelude.Generic)

-- |
-- Create a value of 'Limits' 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:
--
-- 'maximumReplicationCount', 'limits_maximumReplicationCount' - Undocumented member.
--
-- 'maximumPartitionCount', 'limits_maximumPartitionCount' - Undocumented member.
newLimits ::
  -- | 'maximumReplicationCount'
  Prelude.Natural ->
  -- | 'maximumPartitionCount'
  Prelude.Natural ->
  Limits
newLimits :: Natural -> Natural -> Limits
newLimits
  Natural
pMaximumReplicationCount_
  Natural
pMaximumPartitionCount_ =
    Limits' :: Natural -> Natural -> Limits
Limits'
      { $sel:maximumReplicationCount:Limits' :: Natural
maximumReplicationCount =
          Natural
pMaximumReplicationCount_,
        $sel:maximumPartitionCount:Limits' :: Natural
maximumPartitionCount = Natural
pMaximumPartitionCount_
      }

-- | Undocumented member.
limits_maximumReplicationCount :: Lens.Lens' Limits Prelude.Natural
limits_maximumReplicationCount :: (Natural -> f Natural) -> Limits -> f Limits
limits_maximumReplicationCount = (Limits -> Natural)
-> (Limits -> Natural -> Limits)
-> Lens Limits Limits Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Limits' {Natural
maximumReplicationCount :: Natural
$sel:maximumReplicationCount:Limits' :: Limits -> Natural
maximumReplicationCount} -> Natural
maximumReplicationCount) (\s :: Limits
s@Limits' {} Natural
a -> Limits
s {$sel:maximumReplicationCount:Limits' :: Natural
maximumReplicationCount = Natural
a} :: Limits)

-- | Undocumented member.
limits_maximumPartitionCount :: Lens.Lens' Limits Prelude.Natural
limits_maximumPartitionCount :: (Natural -> f Natural) -> Limits -> f Limits
limits_maximumPartitionCount = (Limits -> Natural)
-> (Limits -> Natural -> Limits)
-> Lens Limits Limits Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Limits' {Natural
maximumPartitionCount :: Natural
$sel:maximumPartitionCount:Limits' :: Limits -> Natural
maximumPartitionCount} -> Natural
maximumPartitionCount) (\s :: Limits
s@Limits' {} Natural
a -> Limits
s {$sel:maximumPartitionCount:Limits' :: Natural
maximumPartitionCount = Natural
a} :: Limits)

instance Core.FromXML Limits where
  parseXML :: [Node] -> Either String Limits
parseXML [Node]
x =
    Natural -> Natural -> Limits
Limits'
      (Natural -> Natural -> Limits)
-> Either String Natural -> Either String (Natural -> Limits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MaximumReplicationCount")
      Either String (Natural -> Limits)
-> Either String Natural -> Either String Limits
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MaximumPartitionCount")

instance Prelude.Hashable Limits

instance Prelude.NFData Limits