{-# 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.FleetUtilization
-- 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.FleetUtilization where

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

-- | Current resource utilization statistics in a specified fleet or
-- location. The location value might refer to a fleet\'s remote location
-- or its home Region.
--
-- __Related actions__
--
-- DescribeFleetUtilization | DescribeFleetLocationUtilization
--
-- /See:/ 'newFleetUtilization' smart constructor.
data FleetUtilization = FleetUtilization'
  { -- | The number of active game sessions that are currently being hosted
    -- across all instances in the fleet location.
    FleetUtilization -> Maybe Natural
activeGameSessionCount :: Prelude.Maybe Prelude.Natural,
    -- | The fleet location for the fleet utilization information, expressed as
    -- an AWS Region code, such as @us-west-2@.
    FleetUtilization -> 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@.
    FleetUtilization -> Maybe Text
fleetArn :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of players allowed across all game sessions that are
    -- currently being hosted across all instances in the fleet location.
    FleetUtilization -> Maybe Natural
maximumPlayerSessionCount :: Prelude.Maybe Prelude.Natural,
    -- | The number of active player sessions that are currently being hosted
    -- across all instances in the fleet location.
    FleetUtilization -> Maybe Natural
currentPlayerSessionCount :: Prelude.Maybe Prelude.Natural,
    -- | A unique identifier for the fleet associated with the location.
    FleetUtilization -> Maybe Text
fleetId :: Prelude.Maybe Prelude.Text,
    -- | The number of server processes in @ACTIVE@ status that are currently
    -- running across all instances in the fleet location.
    FleetUtilization -> Maybe Natural
activeServerProcessCount :: Prelude.Maybe Prelude.Natural
  }
  deriving (FleetUtilization -> FleetUtilization -> Bool
(FleetUtilization -> FleetUtilization -> Bool)
-> (FleetUtilization -> FleetUtilization -> Bool)
-> Eq FleetUtilization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FleetUtilization -> FleetUtilization -> Bool
$c/= :: FleetUtilization -> FleetUtilization -> Bool
== :: FleetUtilization -> FleetUtilization -> Bool
$c== :: FleetUtilization -> FleetUtilization -> Bool
Prelude.Eq, ReadPrec [FleetUtilization]
ReadPrec FleetUtilization
Int -> ReadS FleetUtilization
ReadS [FleetUtilization]
(Int -> ReadS FleetUtilization)
-> ReadS [FleetUtilization]
-> ReadPrec FleetUtilization
-> ReadPrec [FleetUtilization]
-> Read FleetUtilization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FleetUtilization]
$creadListPrec :: ReadPrec [FleetUtilization]
readPrec :: ReadPrec FleetUtilization
$creadPrec :: ReadPrec FleetUtilization
readList :: ReadS [FleetUtilization]
$creadList :: ReadS [FleetUtilization]
readsPrec :: Int -> ReadS FleetUtilization
$creadsPrec :: Int -> ReadS FleetUtilization
Prelude.Read, Int -> FleetUtilization -> ShowS
[FleetUtilization] -> ShowS
FleetUtilization -> String
(Int -> FleetUtilization -> ShowS)
-> (FleetUtilization -> String)
-> ([FleetUtilization] -> ShowS)
-> Show FleetUtilization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FleetUtilization] -> ShowS
$cshowList :: [FleetUtilization] -> ShowS
show :: FleetUtilization -> String
$cshow :: FleetUtilization -> String
showsPrec :: Int -> FleetUtilization -> ShowS
$cshowsPrec :: Int -> FleetUtilization -> ShowS
Prelude.Show, (forall x. FleetUtilization -> Rep FleetUtilization x)
-> (forall x. Rep FleetUtilization x -> FleetUtilization)
-> Generic FleetUtilization
forall x. Rep FleetUtilization x -> FleetUtilization
forall x. FleetUtilization -> Rep FleetUtilization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FleetUtilization x -> FleetUtilization
$cfrom :: forall x. FleetUtilization -> Rep FleetUtilization x
Prelude.Generic)

-- |
-- Create a value of 'FleetUtilization' 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:
--
-- 'activeGameSessionCount', 'fleetUtilization_activeGameSessionCount' - The number of active game sessions that are currently being hosted
-- across all instances in the fleet location.
--
-- 'location', 'fleetUtilization_location' - The fleet location for the fleet utilization information, expressed as
-- an AWS Region code, such as @us-west-2@.
--
-- 'fleetArn', 'fleetUtilization_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@.
--
-- 'maximumPlayerSessionCount', 'fleetUtilization_maximumPlayerSessionCount' - The maximum number of players allowed across all game sessions that are
-- currently being hosted across all instances in the fleet location.
--
-- 'currentPlayerSessionCount', 'fleetUtilization_currentPlayerSessionCount' - The number of active player sessions that are currently being hosted
-- across all instances in the fleet location.
--
-- 'fleetId', 'fleetUtilization_fleetId' - A unique identifier for the fleet associated with the location.
--
-- 'activeServerProcessCount', 'fleetUtilization_activeServerProcessCount' - The number of server processes in @ACTIVE@ status that are currently
-- running across all instances in the fleet location.
newFleetUtilization ::
  FleetUtilization
newFleetUtilization :: FleetUtilization
newFleetUtilization =
  FleetUtilization' :: Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Text
-> Maybe Natural
-> FleetUtilization
FleetUtilization'
    { $sel:activeGameSessionCount:FleetUtilization' :: Maybe Natural
activeGameSessionCount =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:location:FleetUtilization' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:FleetUtilization' :: Maybe Text
fleetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumPlayerSessionCount:FleetUtilization' :: Maybe Natural
maximumPlayerSessionCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:currentPlayerSessionCount:FleetUtilization' :: Maybe Natural
currentPlayerSessionCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetId:FleetUtilization' :: Maybe Text
fleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:activeServerProcessCount:FleetUtilization' :: Maybe Natural
activeServerProcessCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of active game sessions that are currently being hosted
-- across all instances in the fleet location.
fleetUtilization_activeGameSessionCount :: Lens.Lens' FleetUtilization (Prelude.Maybe Prelude.Natural)
fleetUtilization_activeGameSessionCount :: (Maybe Natural -> f (Maybe Natural))
-> FleetUtilization -> f FleetUtilization
fleetUtilization_activeGameSessionCount = (FleetUtilization -> Maybe Natural)
-> (FleetUtilization -> Maybe Natural -> FleetUtilization)
-> Lens
     FleetUtilization FleetUtilization (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetUtilization' {Maybe Natural
activeGameSessionCount :: Maybe Natural
$sel:activeGameSessionCount:FleetUtilization' :: FleetUtilization -> Maybe Natural
activeGameSessionCount} -> Maybe Natural
activeGameSessionCount) (\s :: FleetUtilization
s@FleetUtilization' {} Maybe Natural
a -> FleetUtilization
s {$sel:activeGameSessionCount:FleetUtilization' :: Maybe Natural
activeGameSessionCount = Maybe Natural
a} :: FleetUtilization)

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

-- | 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@.
fleetUtilization_fleetArn :: Lens.Lens' FleetUtilization (Prelude.Maybe Prelude.Text)
fleetUtilization_fleetArn :: (Maybe Text -> f (Maybe Text))
-> FleetUtilization -> f FleetUtilization
fleetUtilization_fleetArn = (FleetUtilization -> Maybe Text)
-> (FleetUtilization -> Maybe Text -> FleetUtilization)
-> Lens FleetUtilization FleetUtilization (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetUtilization' {Maybe Text
fleetArn :: Maybe Text
$sel:fleetArn:FleetUtilization' :: FleetUtilization -> Maybe Text
fleetArn} -> Maybe Text
fleetArn) (\s :: FleetUtilization
s@FleetUtilization' {} Maybe Text
a -> FleetUtilization
s {$sel:fleetArn:FleetUtilization' :: Maybe Text
fleetArn = Maybe Text
a} :: FleetUtilization)

-- | The maximum number of players allowed across all game sessions that are
-- currently being hosted across all instances in the fleet location.
fleetUtilization_maximumPlayerSessionCount :: Lens.Lens' FleetUtilization (Prelude.Maybe Prelude.Natural)
fleetUtilization_maximumPlayerSessionCount :: (Maybe Natural -> f (Maybe Natural))
-> FleetUtilization -> f FleetUtilization
fleetUtilization_maximumPlayerSessionCount = (FleetUtilization -> Maybe Natural)
-> (FleetUtilization -> Maybe Natural -> FleetUtilization)
-> Lens
     FleetUtilization FleetUtilization (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetUtilization' {Maybe Natural
maximumPlayerSessionCount :: Maybe Natural
$sel:maximumPlayerSessionCount:FleetUtilization' :: FleetUtilization -> Maybe Natural
maximumPlayerSessionCount} -> Maybe Natural
maximumPlayerSessionCount) (\s :: FleetUtilization
s@FleetUtilization' {} Maybe Natural
a -> FleetUtilization
s {$sel:maximumPlayerSessionCount:FleetUtilization' :: Maybe Natural
maximumPlayerSessionCount = Maybe Natural
a} :: FleetUtilization)

-- | The number of active player sessions that are currently being hosted
-- across all instances in the fleet location.
fleetUtilization_currentPlayerSessionCount :: Lens.Lens' FleetUtilization (Prelude.Maybe Prelude.Natural)
fleetUtilization_currentPlayerSessionCount :: (Maybe Natural -> f (Maybe Natural))
-> FleetUtilization -> f FleetUtilization
fleetUtilization_currentPlayerSessionCount = (FleetUtilization -> Maybe Natural)
-> (FleetUtilization -> Maybe Natural -> FleetUtilization)
-> Lens
     FleetUtilization FleetUtilization (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetUtilization' {Maybe Natural
currentPlayerSessionCount :: Maybe Natural
$sel:currentPlayerSessionCount:FleetUtilization' :: FleetUtilization -> Maybe Natural
currentPlayerSessionCount} -> Maybe Natural
currentPlayerSessionCount) (\s :: FleetUtilization
s@FleetUtilization' {} Maybe Natural
a -> FleetUtilization
s {$sel:currentPlayerSessionCount:FleetUtilization' :: Maybe Natural
currentPlayerSessionCount = Maybe Natural
a} :: FleetUtilization)

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

-- | The number of server processes in @ACTIVE@ status that are currently
-- running across all instances in the fleet location.
fleetUtilization_activeServerProcessCount :: Lens.Lens' FleetUtilization (Prelude.Maybe Prelude.Natural)
fleetUtilization_activeServerProcessCount :: (Maybe Natural -> f (Maybe Natural))
-> FleetUtilization -> f FleetUtilization
fleetUtilization_activeServerProcessCount = (FleetUtilization -> Maybe Natural)
-> (FleetUtilization -> Maybe Natural -> FleetUtilization)
-> Lens
     FleetUtilization FleetUtilization (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetUtilization' {Maybe Natural
activeServerProcessCount :: Maybe Natural
$sel:activeServerProcessCount:FleetUtilization' :: FleetUtilization -> Maybe Natural
activeServerProcessCount} -> Maybe Natural
activeServerProcessCount) (\s :: FleetUtilization
s@FleetUtilization' {} Maybe Natural
a -> FleetUtilization
s {$sel:activeServerProcessCount:FleetUtilization' :: Maybe Natural
activeServerProcessCount = Maybe Natural
a} :: FleetUtilization)

instance Core.FromJSON FleetUtilization where
  parseJSON :: Value -> Parser FleetUtilization
parseJSON =
    String
-> (Object -> Parser FleetUtilization)
-> Value
-> Parser FleetUtilization
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FleetUtilization"
      ( \Object
x ->
          Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Text
-> Maybe Natural
-> FleetUtilization
FleetUtilization'
            (Maybe Natural
 -> Maybe Text
 -> Maybe Text
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Text
 -> Maybe Natural
 -> FleetUtilization)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Text
      -> Maybe Natural
      -> FleetUtilization)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActiveGameSessionCount")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Text
   -> Maybe Natural
   -> FleetUtilization)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Text
      -> Maybe Natural
      -> FleetUtilization)
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
"Location")
            Parser
  (Maybe Text
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Text
   -> Maybe Natural
   -> FleetUtilization)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Text
      -> Maybe Natural
      -> FleetUtilization)
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 Natural
   -> Maybe Natural
   -> Maybe Text
   -> Maybe Natural
   -> FleetUtilization)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural -> Maybe Text -> Maybe Natural -> FleetUtilization)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaximumPlayerSessionCount")
            Parser
  (Maybe Natural -> Maybe Text -> Maybe Natural -> FleetUtilization)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> Maybe Natural -> FleetUtilization)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentPlayerSessionCount")
            Parser (Maybe Text -> Maybe Natural -> FleetUtilization)
-> Parser (Maybe Text)
-> Parser (Maybe Natural -> FleetUtilization)
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 Natural -> FleetUtilization)
-> Parser (Maybe Natural) -> Parser FleetUtilization
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActiveServerProcessCount")
      )

instance Prelude.Hashable FleetUtilization

instance Prelude.NFData FleetUtilization