{-# 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.OpenSearch.Types.InstanceCountLimits
-- 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.OpenSearch.Types.InstanceCountLimits where

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

-- | InstanceCountLimits represents the limits on the number of instances
-- that can be created in Amazon OpenSearch Service for a given
-- InstanceType.
--
-- /See:/ 'newInstanceCountLimits' smart constructor.
data InstanceCountLimits = InstanceCountLimits'
  { InstanceCountLimits -> Maybe Int
maximumInstanceCount :: Prelude.Maybe Prelude.Int,
    InstanceCountLimits -> Maybe Int
minimumInstanceCount :: Prelude.Maybe Prelude.Int
  }
  deriving (InstanceCountLimits -> InstanceCountLimits -> Bool
(InstanceCountLimits -> InstanceCountLimits -> Bool)
-> (InstanceCountLimits -> InstanceCountLimits -> Bool)
-> Eq InstanceCountLimits
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceCountLimits -> InstanceCountLimits -> Bool
$c/= :: InstanceCountLimits -> InstanceCountLimits -> Bool
== :: InstanceCountLimits -> InstanceCountLimits -> Bool
$c== :: InstanceCountLimits -> InstanceCountLimits -> Bool
Prelude.Eq, ReadPrec [InstanceCountLimits]
ReadPrec InstanceCountLimits
Int -> ReadS InstanceCountLimits
ReadS [InstanceCountLimits]
(Int -> ReadS InstanceCountLimits)
-> ReadS [InstanceCountLimits]
-> ReadPrec InstanceCountLimits
-> ReadPrec [InstanceCountLimits]
-> Read InstanceCountLimits
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceCountLimits]
$creadListPrec :: ReadPrec [InstanceCountLimits]
readPrec :: ReadPrec InstanceCountLimits
$creadPrec :: ReadPrec InstanceCountLimits
readList :: ReadS [InstanceCountLimits]
$creadList :: ReadS [InstanceCountLimits]
readsPrec :: Int -> ReadS InstanceCountLimits
$creadsPrec :: Int -> ReadS InstanceCountLimits
Prelude.Read, Int -> InstanceCountLimits -> ShowS
[InstanceCountLimits] -> ShowS
InstanceCountLimits -> String
(Int -> InstanceCountLimits -> ShowS)
-> (InstanceCountLimits -> String)
-> ([InstanceCountLimits] -> ShowS)
-> Show InstanceCountLimits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceCountLimits] -> ShowS
$cshowList :: [InstanceCountLimits] -> ShowS
show :: InstanceCountLimits -> String
$cshow :: InstanceCountLimits -> String
showsPrec :: Int -> InstanceCountLimits -> ShowS
$cshowsPrec :: Int -> InstanceCountLimits -> ShowS
Prelude.Show, (forall x. InstanceCountLimits -> Rep InstanceCountLimits x)
-> (forall x. Rep InstanceCountLimits x -> InstanceCountLimits)
-> Generic InstanceCountLimits
forall x. Rep InstanceCountLimits x -> InstanceCountLimits
forall x. InstanceCountLimits -> Rep InstanceCountLimits x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceCountLimits x -> InstanceCountLimits
$cfrom :: forall x. InstanceCountLimits -> Rep InstanceCountLimits x
Prelude.Generic)

-- |
-- Create a value of 'InstanceCountLimits' 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:
--
-- 'maximumInstanceCount', 'instanceCountLimits_maximumInstanceCount' - Undocumented member.
--
-- 'minimumInstanceCount', 'instanceCountLimits_minimumInstanceCount' - Undocumented member.
newInstanceCountLimits ::
  InstanceCountLimits
newInstanceCountLimits :: InstanceCountLimits
newInstanceCountLimits =
  InstanceCountLimits' :: Maybe Int -> Maybe Int -> InstanceCountLimits
InstanceCountLimits'
    { $sel:maximumInstanceCount:InstanceCountLimits' :: Maybe Int
maximumInstanceCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:minimumInstanceCount:InstanceCountLimits' :: Maybe Int
minimumInstanceCount = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
instanceCountLimits_maximumInstanceCount :: Lens.Lens' InstanceCountLimits (Prelude.Maybe Prelude.Int)
instanceCountLimits_maximumInstanceCount :: (Maybe Int -> f (Maybe Int))
-> InstanceCountLimits -> f InstanceCountLimits
instanceCountLimits_maximumInstanceCount = (InstanceCountLimits -> Maybe Int)
-> (InstanceCountLimits -> Maybe Int -> InstanceCountLimits)
-> Lens
     InstanceCountLimits InstanceCountLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceCountLimits' {Maybe Int
maximumInstanceCount :: Maybe Int
$sel:maximumInstanceCount:InstanceCountLimits' :: InstanceCountLimits -> Maybe Int
maximumInstanceCount} -> Maybe Int
maximumInstanceCount) (\s :: InstanceCountLimits
s@InstanceCountLimits' {} Maybe Int
a -> InstanceCountLimits
s {$sel:maximumInstanceCount:InstanceCountLimits' :: Maybe Int
maximumInstanceCount = Maybe Int
a} :: InstanceCountLimits)

-- | Undocumented member.
instanceCountLimits_minimumInstanceCount :: Lens.Lens' InstanceCountLimits (Prelude.Maybe Prelude.Int)
instanceCountLimits_minimumInstanceCount :: (Maybe Int -> f (Maybe Int))
-> InstanceCountLimits -> f InstanceCountLimits
instanceCountLimits_minimumInstanceCount = (InstanceCountLimits -> Maybe Int)
-> (InstanceCountLimits -> Maybe Int -> InstanceCountLimits)
-> Lens
     InstanceCountLimits InstanceCountLimits (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceCountLimits' {Maybe Int
minimumInstanceCount :: Maybe Int
$sel:minimumInstanceCount:InstanceCountLimits' :: InstanceCountLimits -> Maybe Int
minimumInstanceCount} -> Maybe Int
minimumInstanceCount) (\s :: InstanceCountLimits
s@InstanceCountLimits' {} Maybe Int
a -> InstanceCountLimits
s {$sel:minimumInstanceCount:InstanceCountLimits' :: Maybe Int
minimumInstanceCount = Maybe Int
a} :: InstanceCountLimits)

instance Core.FromJSON InstanceCountLimits where
  parseJSON :: Value -> Parser InstanceCountLimits
parseJSON =
    String
-> (Object -> Parser InstanceCountLimits)
-> Value
-> Parser InstanceCountLimits
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceCountLimits"
      ( \Object
x ->
          Maybe Int -> Maybe Int -> InstanceCountLimits
InstanceCountLimits'
            (Maybe Int -> Maybe Int -> InstanceCountLimits)
-> Parser (Maybe Int) -> Parser (Maybe Int -> InstanceCountLimits)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaximumInstanceCount")
            Parser (Maybe Int -> InstanceCountLimits)
-> Parser (Maybe Int) -> Parser InstanceCountLimits
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MinimumInstanceCount")
      )

instance Prelude.Hashable InstanceCountLimits

instance Prelude.NFData InstanceCountLimits