{-# 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.GameLift.Types.EC2InstanceLimit
-- 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.GameLift.Types.EC2InstanceLimit where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GameLift.Types.EC2InstanceType
import qualified Amazonka.Prelude as Prelude

-- | The GameLift service limits for an Amazon EC2 instance type and current
-- utilization. GameLift allows Amazon Web Services accounts a maximum
-- number of instances, per instance type, per Amazon Web Services Region
-- or location, for use with GameLift. You can request an limit increase
-- for your account by using the __Service limits__ page in the GameLift
-- console.
--
-- /See:/ 'newEC2InstanceLimit' smart constructor.
data EC2InstanceLimit = EC2InstanceLimit'
  { -- | The number of instances for the specified type and location that are
    -- currently being used by the Amazon Web Services account.
    EC2InstanceLimit -> Maybe Natural
currentInstances :: Prelude.Maybe Prelude.Natural,
    -- | The name of an Amazon EC2 instance type. See
    -- <http://aws.amazon.com/ec2/instance-types/ Amazon Elastic Compute Cloud Instance Types>
    -- for detailed descriptions.
    EC2InstanceLimit -> Maybe EC2InstanceType
eC2InstanceType :: Prelude.Maybe EC2InstanceType,
    -- | The number of instances that is allowed for the specified instance type
    -- and location.
    EC2InstanceLimit -> Maybe Natural
instanceLimit :: Prelude.Maybe Prelude.Natural,
    -- | An Amazon Web Services Region code, such as @us-west-2@.
    EC2InstanceLimit -> Maybe Text
location :: Prelude.Maybe Prelude.Text
  }
  deriving (EC2InstanceLimit -> EC2InstanceLimit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2InstanceLimit -> EC2InstanceLimit -> Bool
$c/= :: EC2InstanceLimit -> EC2InstanceLimit -> Bool
== :: EC2InstanceLimit -> EC2InstanceLimit -> Bool
$c== :: EC2InstanceLimit -> EC2InstanceLimit -> Bool
Prelude.Eq, ReadPrec [EC2InstanceLimit]
ReadPrec EC2InstanceLimit
Int -> ReadS EC2InstanceLimit
ReadS [EC2InstanceLimit]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2InstanceLimit]
$creadListPrec :: ReadPrec [EC2InstanceLimit]
readPrec :: ReadPrec EC2InstanceLimit
$creadPrec :: ReadPrec EC2InstanceLimit
readList :: ReadS [EC2InstanceLimit]
$creadList :: ReadS [EC2InstanceLimit]
readsPrec :: Int -> ReadS EC2InstanceLimit
$creadsPrec :: Int -> ReadS EC2InstanceLimit
Prelude.Read, Int -> EC2InstanceLimit -> ShowS
[EC2InstanceLimit] -> ShowS
EC2InstanceLimit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2InstanceLimit] -> ShowS
$cshowList :: [EC2InstanceLimit] -> ShowS
show :: EC2InstanceLimit -> String
$cshow :: EC2InstanceLimit -> String
showsPrec :: Int -> EC2InstanceLimit -> ShowS
$cshowsPrec :: Int -> EC2InstanceLimit -> ShowS
Prelude.Show, forall x. Rep EC2InstanceLimit x -> EC2InstanceLimit
forall x. EC2InstanceLimit -> Rep EC2InstanceLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EC2InstanceLimit x -> EC2InstanceLimit
$cfrom :: forall x. EC2InstanceLimit -> Rep EC2InstanceLimit x
Prelude.Generic)

-- |
-- Create a value of 'EC2InstanceLimit' 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:
--
-- 'currentInstances', 'eC2InstanceLimit_currentInstances' - The number of instances for the specified type and location that are
-- currently being used by the Amazon Web Services account.
--
-- 'eC2InstanceType', 'eC2InstanceLimit_eC2InstanceType' - The name of an Amazon EC2 instance type. See
-- <http://aws.amazon.com/ec2/instance-types/ Amazon Elastic Compute Cloud Instance Types>
-- for detailed descriptions.
--
-- 'instanceLimit', 'eC2InstanceLimit_instanceLimit' - The number of instances that is allowed for the specified instance type
-- and location.
--
-- 'location', 'eC2InstanceLimit_location' - An Amazon Web Services Region code, such as @us-west-2@.
newEC2InstanceLimit ::
  EC2InstanceLimit
newEC2InstanceLimit :: EC2InstanceLimit
newEC2InstanceLimit =
  EC2InstanceLimit'
    { $sel:currentInstances:EC2InstanceLimit' :: Maybe Natural
currentInstances =
        forall a. Maybe a
Prelude.Nothing,
      $sel:eC2InstanceType:EC2InstanceLimit' :: Maybe EC2InstanceType
eC2InstanceType = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceLimit:EC2InstanceLimit' :: Maybe Natural
instanceLimit = forall a. Maybe a
Prelude.Nothing,
      $sel:location:EC2InstanceLimit' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of instances for the specified type and location that are
-- currently being used by the Amazon Web Services account.
eC2InstanceLimit_currentInstances :: Lens.Lens' EC2InstanceLimit (Prelude.Maybe Prelude.Natural)
eC2InstanceLimit_currentInstances :: Lens' EC2InstanceLimit (Maybe Natural)
eC2InstanceLimit_currentInstances = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceLimit' {Maybe Natural
currentInstances :: Maybe Natural
$sel:currentInstances:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Natural
currentInstances} -> Maybe Natural
currentInstances) (\s :: EC2InstanceLimit
s@EC2InstanceLimit' {} Maybe Natural
a -> EC2InstanceLimit
s {$sel:currentInstances:EC2InstanceLimit' :: Maybe Natural
currentInstances = Maybe Natural
a} :: EC2InstanceLimit)

-- | The name of an Amazon EC2 instance type. See
-- <http://aws.amazon.com/ec2/instance-types/ Amazon Elastic Compute Cloud Instance Types>
-- for detailed descriptions.
eC2InstanceLimit_eC2InstanceType :: Lens.Lens' EC2InstanceLimit (Prelude.Maybe EC2InstanceType)
eC2InstanceLimit_eC2InstanceType :: Lens' EC2InstanceLimit (Maybe EC2InstanceType)
eC2InstanceLimit_eC2InstanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceLimit' {Maybe EC2InstanceType
eC2InstanceType :: Maybe EC2InstanceType
$sel:eC2InstanceType:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe EC2InstanceType
eC2InstanceType} -> Maybe EC2InstanceType
eC2InstanceType) (\s :: EC2InstanceLimit
s@EC2InstanceLimit' {} Maybe EC2InstanceType
a -> EC2InstanceLimit
s {$sel:eC2InstanceType:EC2InstanceLimit' :: Maybe EC2InstanceType
eC2InstanceType = Maybe EC2InstanceType
a} :: EC2InstanceLimit)

-- | The number of instances that is allowed for the specified instance type
-- and location.
eC2InstanceLimit_instanceLimit :: Lens.Lens' EC2InstanceLimit (Prelude.Maybe Prelude.Natural)
eC2InstanceLimit_instanceLimit :: Lens' EC2InstanceLimit (Maybe Natural)
eC2InstanceLimit_instanceLimit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceLimit' {Maybe Natural
instanceLimit :: Maybe Natural
$sel:instanceLimit:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Natural
instanceLimit} -> Maybe Natural
instanceLimit) (\s :: EC2InstanceLimit
s@EC2InstanceLimit' {} Maybe Natural
a -> EC2InstanceLimit
s {$sel:instanceLimit:EC2InstanceLimit' :: Maybe Natural
instanceLimit = Maybe Natural
a} :: EC2InstanceLimit)

-- | An Amazon Web Services Region code, such as @us-west-2@.
eC2InstanceLimit_location :: Lens.Lens' EC2InstanceLimit (Prelude.Maybe Prelude.Text)
eC2InstanceLimit_location :: Lens' EC2InstanceLimit (Maybe Text)
eC2InstanceLimit_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2InstanceLimit' {Maybe Text
location :: Maybe Text
$sel:location:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Text
location} -> Maybe Text
location) (\s :: EC2InstanceLimit
s@EC2InstanceLimit' {} Maybe Text
a -> EC2InstanceLimit
s {$sel:location:EC2InstanceLimit' :: Maybe Text
location = Maybe Text
a} :: EC2InstanceLimit)

instance Data.FromJSON EC2InstanceLimit where
  parseJSON :: Value -> Parser EC2InstanceLimit
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EC2InstanceLimit"
      ( \Object
x ->
          Maybe Natural
-> Maybe EC2InstanceType
-> Maybe Natural
-> Maybe Text
-> EC2InstanceLimit
EC2InstanceLimit'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CurrentInstances")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EC2InstanceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InstanceLimit")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Location")
      )

instance Prelude.Hashable EC2InstanceLimit where
  hashWithSalt :: Int -> EC2InstanceLimit -> Int
hashWithSalt Int
_salt EC2InstanceLimit' {Maybe Natural
Maybe Text
Maybe EC2InstanceType
location :: Maybe Text
instanceLimit :: Maybe Natural
eC2InstanceType :: Maybe EC2InstanceType
currentInstances :: Maybe Natural
$sel:location:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Text
$sel:instanceLimit:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Natural
$sel:eC2InstanceType:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe EC2InstanceType
$sel:currentInstances:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
currentInstances
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EC2InstanceType
eC2InstanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
instanceLimit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
location

instance Prelude.NFData EC2InstanceLimit where
  rnf :: EC2InstanceLimit -> ()
rnf EC2InstanceLimit' {Maybe Natural
Maybe Text
Maybe EC2InstanceType
location :: Maybe Text
instanceLimit :: Maybe Natural
eC2InstanceType :: Maybe EC2InstanceType
currentInstances :: Maybe Natural
$sel:location:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Text
$sel:instanceLimit:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Natural
$sel:eC2InstanceType:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe EC2InstanceType
$sel:currentInstances:EC2InstanceLimit' :: EC2InstanceLimit -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
currentInstances
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EC2InstanceType
eC2InstanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
instanceLimit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location