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

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types.EC2InstanceCounts
import Amazonka.GameLift.Types.EC2InstanceType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Current resource capacity settings in a specified fleet or location. The
-- location value might refer to a fleet\'s remote location or its home
-- Region.
--
-- __Related actions__
--
-- DescribeFleetCapacity | DescribeFleetLocationCapacity |
-- UpdateFleetCapacity
--
-- /See:/ 'newFleetCapacity' smart constructor.
data FleetCapacity = FleetCapacity'
  { -- | The fleet location for the instance count information, expressed as an
    -- AWS Region code, such as @us-west-2@.
    FleetCapacity -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name
    -- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
    -- that is assigned to a GameLift fleet resource and uniquely identifies
    -- it. ARNs are unique across all Regions. Format is
    -- @arn:aws:gamelift:\<region>::fleet\/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
    FleetCapacity -> Maybe Text
fleetArn :: Prelude.Maybe Prelude.Text,
    -- | The EC2 instance type that is used for all instances in a fleet. The
    -- instance type determines the computing resources in use, including CPU,
    -- memory, storage, and networking capacity. See
    -- <http://aws.amazon.com/ec2/instance-types/ Amazon EC2 Instance Types>
    -- for detailed descriptions.
    FleetCapacity -> Maybe EC2InstanceType
instanceType :: Prelude.Maybe EC2InstanceType,
    -- | A unique identifier for the fleet associated with the location.
    FleetCapacity -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | The current instance count and capacity settings for the fleet location.
    FleetCapacity -> Maybe EC2InstanceCounts
instanceCounts :: Prelude.Maybe EC2InstanceCounts
  }
  deriving (FleetCapacity -> FleetCapacity -> Bool
(FleetCapacity -> FleetCapacity -> Bool)
-> (FleetCapacity -> FleetCapacity -> Bool) -> Eq FleetCapacity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FleetCapacity -> FleetCapacity -> Bool
$c/= :: FleetCapacity -> FleetCapacity -> Bool
== :: FleetCapacity -> FleetCapacity -> Bool
$c== :: FleetCapacity -> FleetCapacity -> Bool
Prelude.Eq, ReadPrec [FleetCapacity]
ReadPrec FleetCapacity
Int -> ReadS FleetCapacity
ReadS [FleetCapacity]
(Int -> ReadS FleetCapacity)
-> ReadS [FleetCapacity]
-> ReadPrec FleetCapacity
-> ReadPrec [FleetCapacity]
-> Read FleetCapacity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FleetCapacity]
$creadListPrec :: ReadPrec [FleetCapacity]
readPrec :: ReadPrec FleetCapacity
$creadPrec :: ReadPrec FleetCapacity
readList :: ReadS [FleetCapacity]
$creadList :: ReadS [FleetCapacity]
readsPrec :: Int -> ReadS FleetCapacity
$creadsPrec :: Int -> ReadS FleetCapacity
Prelude.Read, Int -> FleetCapacity -> ShowS
[FleetCapacity] -> ShowS
FleetCapacity -> String
(Int -> FleetCapacity -> ShowS)
-> (FleetCapacity -> String)
-> ([FleetCapacity] -> ShowS)
-> Show FleetCapacity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FleetCapacity] -> ShowS
$cshowList :: [FleetCapacity] -> ShowS
show :: FleetCapacity -> String
$cshow :: FleetCapacity -> String
showsPrec :: Int -> FleetCapacity -> ShowS
$cshowsPrec :: Int -> FleetCapacity -> ShowS
Prelude.Show, (forall x. FleetCapacity -> Rep FleetCapacity x)
-> (forall x. Rep FleetCapacity x -> FleetCapacity)
-> Generic FleetCapacity
forall x. Rep FleetCapacity x -> FleetCapacity
forall x. FleetCapacity -> Rep FleetCapacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FleetCapacity x -> FleetCapacity
$cfrom :: forall x. FleetCapacity -> Rep FleetCapacity x
Prelude.Generic)

-- |
-- Create a value of 'FleetCapacity' 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:
--
-- 'location', 'fleetCapacity_location' - The fleet location for the instance count information, expressed as an
-- AWS Region code, such as @us-west-2@.
--
-- 'fleetArn', 'fleetCapacity_fleetArn' - The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is assigned to a GameLift fleet resource and uniquely identifies
-- it. ARNs are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::fleet\/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
--
-- 'instanceType', 'fleetCapacity_instanceType' - The EC2 instance type that is used for all instances in a fleet. The
-- instance type determines the computing resources in use, including CPU,
-- memory, storage, and networking capacity. See
-- <http://aws.amazon.com/ec2/instance-types/ Amazon EC2 Instance Types>
-- for detailed descriptions.
--
-- 'fleetId', 'fleetCapacity_fleetId' - A unique identifier for the fleet associated with the location.
--
-- 'instanceCounts', 'fleetCapacity_instanceCounts' - The current instance count and capacity settings for the fleet location.
newFleetCapacity ::
  FleetCapacity
newFleetCapacity :: FleetCapacity
newFleetCapacity =
  FleetCapacity' :: Maybe Text
-> Maybe Text
-> Maybe EC2InstanceType
-> Maybe Text
-> Maybe EC2InstanceCounts
-> FleetCapacity
FleetCapacity'
    { $sel:location:FleetCapacity' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:FleetCapacity' :: Maybe Text
fleetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:FleetCapacity' :: Maybe EC2InstanceType
instanceType = Maybe EC2InstanceType
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:FleetCapacity' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceCounts:FleetCapacity' :: Maybe EC2InstanceCounts
instanceCounts = Maybe EC2InstanceCounts
forall a. Maybe a
Prelude.Nothing
    }

-- | The fleet location for the instance count information, expressed as an
-- AWS Region code, such as @us-west-2@.
fleetCapacity_location :: Lens.Lens' FleetCapacity (Prelude.Maybe Prelude.Text)
fleetCapacity_location :: (Maybe Text -> f (Maybe Text)) -> FleetCapacity -> f FleetCapacity
fleetCapacity_location = (FleetCapacity -> Maybe Text)
-> (FleetCapacity -> Maybe Text -> FleetCapacity)
-> Lens FleetCapacity FleetCapacity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetCapacity' {Maybe Text
location :: Maybe Text
$sel:location:FleetCapacity' :: FleetCapacity -> Maybe Text
location} -> Maybe Text
location) (\s :: FleetCapacity
s@FleetCapacity' {} Maybe Text
a -> FleetCapacity
s {$sel:location:FleetCapacity' :: Maybe Text
location = Maybe Text
a} :: FleetCapacity)

-- | The Amazon Resource Name
-- (<https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html ARN>)
-- that is assigned to a GameLift fleet resource and uniquely identifies
-- it. ARNs are unique across all Regions. Format is
-- @arn:aws:gamelift:\<region>::fleet\/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912@.
fleetCapacity_fleetArn :: Lens.Lens' FleetCapacity (Prelude.Maybe Prelude.Text)
fleetCapacity_fleetArn :: (Maybe Text -> f (Maybe Text)) -> FleetCapacity -> f FleetCapacity
fleetCapacity_fleetArn = (FleetCapacity -> Maybe Text)
-> (FleetCapacity -> Maybe Text -> FleetCapacity)
-> Lens FleetCapacity FleetCapacity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetCapacity' {Maybe Text
fleetArn :: Maybe Text
$sel:fleetArn:FleetCapacity' :: FleetCapacity -> Maybe Text
fleetArn} -> Maybe Text
fleetArn) (\s :: FleetCapacity
s@FleetCapacity' {} Maybe Text
a -> FleetCapacity
s {$sel:fleetArn:FleetCapacity' :: Maybe Text
fleetArn = Maybe Text
a} :: FleetCapacity)

-- | The EC2 instance type that is used for all instances in a fleet. The
-- instance type determines the computing resources in use, including CPU,
-- memory, storage, and networking capacity. See
-- <http://aws.amazon.com/ec2/instance-types/ Amazon EC2 Instance Types>
-- for detailed descriptions.
fleetCapacity_instanceType :: Lens.Lens' FleetCapacity (Prelude.Maybe EC2InstanceType)
fleetCapacity_instanceType :: (Maybe EC2InstanceType -> f (Maybe EC2InstanceType))
-> FleetCapacity -> f FleetCapacity
fleetCapacity_instanceType = (FleetCapacity -> Maybe EC2InstanceType)
-> (FleetCapacity -> Maybe EC2InstanceType -> FleetCapacity)
-> Lens
     FleetCapacity
     FleetCapacity
     (Maybe EC2InstanceType)
     (Maybe EC2InstanceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetCapacity' {Maybe EC2InstanceType
instanceType :: Maybe EC2InstanceType
$sel:instanceType:FleetCapacity' :: FleetCapacity -> Maybe EC2InstanceType
instanceType} -> Maybe EC2InstanceType
instanceType) (\s :: FleetCapacity
s@FleetCapacity' {} Maybe EC2InstanceType
a -> FleetCapacity
s {$sel:instanceType:FleetCapacity' :: Maybe EC2InstanceType
instanceType = Maybe EC2InstanceType
a} :: FleetCapacity)

-- | A unique identifier for the fleet associated with the location.
fleetCapacity_fleetId :: Lens.Lens' FleetCapacity (Prelude.Maybe Prelude.Text)
fleetCapacity_fleetId :: (Maybe Text -> f (Maybe Text)) -> FleetCapacity -> f FleetCapacity
fleetCapacity_fleetId = (FleetCapacity -> Maybe Text)
-> (FleetCapacity -> Maybe Text -> FleetCapacity)
-> Lens FleetCapacity FleetCapacity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetCapacity' {Maybe Text
fleetId :: Maybe Text
$sel:fleetId:FleetCapacity' :: FleetCapacity -> Maybe Text
fleetId} -> Maybe Text
fleetId) (\s :: FleetCapacity
s@FleetCapacity' {} Maybe Text
a -> FleetCapacity
s {$sel:fleetId:FleetCapacity' :: Maybe Text
fleetId = Maybe Text
a} :: FleetCapacity)

-- | The current instance count and capacity settings for the fleet location.
fleetCapacity_instanceCounts :: Lens.Lens' FleetCapacity (Prelude.Maybe EC2InstanceCounts)
fleetCapacity_instanceCounts :: (Maybe EC2InstanceCounts -> f (Maybe EC2InstanceCounts))
-> FleetCapacity -> f FleetCapacity
fleetCapacity_instanceCounts = (FleetCapacity -> Maybe EC2InstanceCounts)
-> (FleetCapacity -> Maybe EC2InstanceCounts -> FleetCapacity)
-> Lens
     FleetCapacity
     FleetCapacity
     (Maybe EC2InstanceCounts)
     (Maybe EC2InstanceCounts)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetCapacity' {Maybe EC2InstanceCounts
instanceCounts :: Maybe EC2InstanceCounts
$sel:instanceCounts:FleetCapacity' :: FleetCapacity -> Maybe EC2InstanceCounts
instanceCounts} -> Maybe EC2InstanceCounts
instanceCounts) (\s :: FleetCapacity
s@FleetCapacity' {} Maybe EC2InstanceCounts
a -> FleetCapacity
s {$sel:instanceCounts:FleetCapacity' :: Maybe EC2InstanceCounts
instanceCounts = Maybe EC2InstanceCounts
a} :: FleetCapacity)

instance Core.FromJSON FleetCapacity where
  parseJSON :: Value -> Parser FleetCapacity
parseJSON =
    String
-> (Object -> Parser FleetCapacity)
-> Value
-> Parser FleetCapacity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FleetCapacity"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe EC2InstanceType
-> Maybe Text
-> Maybe EC2InstanceCounts
-> FleetCapacity
FleetCapacity'
            (Maybe Text
 -> Maybe Text
 -> Maybe EC2InstanceType
 -> Maybe Text
 -> Maybe EC2InstanceCounts
 -> FleetCapacity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe EC2InstanceType
      -> Maybe Text
      -> Maybe EC2InstanceCounts
      -> FleetCapacity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Location")
            Parser
  (Maybe Text
   -> Maybe EC2InstanceType
   -> Maybe Text
   -> Maybe EC2InstanceCounts
   -> FleetCapacity)
-> Parser (Maybe Text)
-> Parser
     (Maybe EC2InstanceType
      -> Maybe Text -> Maybe EC2InstanceCounts -> FleetCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FleetArn")
            Parser
  (Maybe EC2InstanceType
   -> Maybe Text -> Maybe EC2InstanceCounts -> FleetCapacity)
-> Parser (Maybe EC2InstanceType)
-> Parser (Maybe Text -> Maybe EC2InstanceCounts -> FleetCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EC2InstanceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstanceType")
            Parser (Maybe Text -> Maybe EC2InstanceCounts -> FleetCapacity)
-> Parser (Maybe Text)
-> Parser (Maybe EC2InstanceCounts -> FleetCapacity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FleetId")
            Parser (Maybe EC2InstanceCounts -> FleetCapacity)
-> Parser (Maybe EC2InstanceCounts) -> Parser FleetCapacity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EC2InstanceCounts)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InstanceCounts")
      )

instance Prelude.Hashable FleetCapacity

instance Prelude.NFData FleetCapacity