{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeFleetCapacity
-- 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)
--
-- Retrieves the resource capacity settings for one or more fleets. The
-- data returned includes the current fleet capacity (number of EC2
-- instances), and settings that can control how capacity scaling. For
-- fleets with remote locations, this operation retrieves data for the
-- fleet\'s home Region only. See DescribeFleetLocationCapacity to get
-- capacity settings for a fleet\'s remote locations.
--
-- This operation can be used in the following ways:
--
-- -   To get capacity data for one or more specific fleets, provide a list
--     of fleet IDs or fleet ARNs.
--
-- -   To get capacity data for all fleets, do not provide a fleet
--     identifier.
--
-- When requesting multiple fleets, use the pagination parameters to
-- retrieve results as a set of sequential pages.
--
-- If successful, a FleetCapacity object is returned for each requested
-- fleet ID. Each FleetCapacity object includes a @Location@ property,
-- which is set to the fleet\'s home Region. When a list of fleet IDs is
-- provided, attribute objects are returned only for fleets that currently
-- exist.
--
-- Some API operations may limit the number of fleet IDs that are allowed
-- in one request. If a request exceeds this limit, the request fails and
-- the error message includes the maximum allowed.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-intro.html Setting up GameLift fleets>
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/monitoring-cloudwatch.html#gamelift-metrics-fleet GameLift metrics for fleets>
--
-- __Related actions__
--
-- ListFleets | DescribeEC2InstanceLimits | DescribeFleetAttributes |
-- DescribeFleetCapacity | DescribeFleetEvents |
-- DescribeFleetLocationAttributes | DescribeFleetPortSettings |
-- DescribeFleetUtilization | DescribeRuntimeConfiguration |
-- DescribeScalingPolicies |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
--
-- This operation returns paginated results.
module Amazonka.GameLift.DescribeFleetCapacity
  ( -- * Creating a Request
    DescribeFleetCapacity (..),
    newDescribeFleetCapacity,

    -- * Request Lenses
    describeFleetCapacity_nextToken,
    describeFleetCapacity_limit,
    describeFleetCapacity_fleetIds,

    -- * Destructuring the Response
    DescribeFleetCapacityResponse (..),
    newDescribeFleetCapacityResponse,

    -- * Response Lenses
    describeFleetCapacityResponse_nextToken,
    describeFleetCapacityResponse_fleetCapacity,
    describeFleetCapacityResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input for a request operation.
--
-- /See:/ 'newDescribeFleetCapacity' smart constructor.
data DescribeFleetCapacity = DescribeFleetCapacity'
  { -- | A token that indicates the start of the next sequential page of results.
    -- Use the token that is returned with a previous call to this operation.
    -- To start at the beginning of the result set, do not specify a value.
    -- This parameter is ignored when the request specifies one or a list of
    -- fleet IDs.
    DescribeFleetCapacity -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return. Use this parameter with
    -- @NextToken@ to get results as a set of sequential pages. This parameter
    -- is ignored when the request specifies one or a list of fleet IDs.
    DescribeFleetCapacity -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | A unique identifier for the fleet(s) to retrieve capacity information
    -- for. You can use either the fleet ID or ARN value. Leave this parameter
    -- empty to retrieve capacity information for all fleets.
    DescribeFleetCapacity -> Maybe (NonEmpty Text)
fleetIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (DescribeFleetCapacity -> DescribeFleetCapacity -> Bool
(DescribeFleetCapacity -> DescribeFleetCapacity -> Bool)
-> (DescribeFleetCapacity -> DescribeFleetCapacity -> Bool)
-> Eq DescribeFleetCapacity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFleetCapacity -> DescribeFleetCapacity -> Bool
$c/= :: DescribeFleetCapacity -> DescribeFleetCapacity -> Bool
== :: DescribeFleetCapacity -> DescribeFleetCapacity -> Bool
$c== :: DescribeFleetCapacity -> DescribeFleetCapacity -> Bool
Prelude.Eq, ReadPrec [DescribeFleetCapacity]
ReadPrec DescribeFleetCapacity
Int -> ReadS DescribeFleetCapacity
ReadS [DescribeFleetCapacity]
(Int -> ReadS DescribeFleetCapacity)
-> ReadS [DescribeFleetCapacity]
-> ReadPrec DescribeFleetCapacity
-> ReadPrec [DescribeFleetCapacity]
-> Read DescribeFleetCapacity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFleetCapacity]
$creadListPrec :: ReadPrec [DescribeFleetCapacity]
readPrec :: ReadPrec DescribeFleetCapacity
$creadPrec :: ReadPrec DescribeFleetCapacity
readList :: ReadS [DescribeFleetCapacity]
$creadList :: ReadS [DescribeFleetCapacity]
readsPrec :: Int -> ReadS DescribeFleetCapacity
$creadsPrec :: Int -> ReadS DescribeFleetCapacity
Prelude.Read, Int -> DescribeFleetCapacity -> ShowS
[DescribeFleetCapacity] -> ShowS
DescribeFleetCapacity -> String
(Int -> DescribeFleetCapacity -> ShowS)
-> (DescribeFleetCapacity -> String)
-> ([DescribeFleetCapacity] -> ShowS)
-> Show DescribeFleetCapacity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFleetCapacity] -> ShowS
$cshowList :: [DescribeFleetCapacity] -> ShowS
show :: DescribeFleetCapacity -> String
$cshow :: DescribeFleetCapacity -> String
showsPrec :: Int -> DescribeFleetCapacity -> ShowS
$cshowsPrec :: Int -> DescribeFleetCapacity -> ShowS
Prelude.Show, (forall x. DescribeFleetCapacity -> Rep DescribeFleetCapacity x)
-> (forall x. Rep DescribeFleetCapacity x -> DescribeFleetCapacity)
-> Generic DescribeFleetCapacity
forall x. Rep DescribeFleetCapacity x -> DescribeFleetCapacity
forall x. DescribeFleetCapacity -> Rep DescribeFleetCapacity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFleetCapacity x -> DescribeFleetCapacity
$cfrom :: forall x. DescribeFleetCapacity -> Rep DescribeFleetCapacity x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFleetCapacity' 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:
--
-- 'nextToken', 'describeFleetCapacity_nextToken' - A token that indicates the start of the next sequential page of results.
-- Use the token that is returned with a previous call to this operation.
-- To start at the beginning of the result set, do not specify a value.
-- This parameter is ignored when the request specifies one or a list of
-- fleet IDs.
--
-- 'limit', 'describeFleetCapacity_limit' - The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages. This parameter
-- is ignored when the request specifies one or a list of fleet IDs.
--
-- 'fleetIds', 'describeFleetCapacity_fleetIds' - A unique identifier for the fleet(s) to retrieve capacity information
-- for. You can use either the fleet ID or ARN value. Leave this parameter
-- empty to retrieve capacity information for all fleets.
newDescribeFleetCapacity ::
  DescribeFleetCapacity
newDescribeFleetCapacity :: DescribeFleetCapacity
newDescribeFleetCapacity =
  DescribeFleetCapacity' :: Maybe Text
-> Maybe Natural -> Maybe (NonEmpty Text) -> DescribeFleetCapacity
DescribeFleetCapacity'
    { $sel:nextToken:DescribeFleetCapacity' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeFleetCapacity' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetIds:DescribeFleetCapacity' :: Maybe (NonEmpty Text)
fleetIds = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | A token that indicates the start of the next sequential page of results.
-- Use the token that is returned with a previous call to this operation.
-- To start at the beginning of the result set, do not specify a value.
-- This parameter is ignored when the request specifies one or a list of
-- fleet IDs.
describeFleetCapacity_nextToken :: Lens.Lens' DescribeFleetCapacity (Prelude.Maybe Prelude.Text)
describeFleetCapacity_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeFleetCapacity -> f DescribeFleetCapacity
describeFleetCapacity_nextToken = (DescribeFleetCapacity -> Maybe Text)
-> (DescribeFleetCapacity -> Maybe Text -> DescribeFleetCapacity)
-> Lens
     DescribeFleetCapacity
     DescribeFleetCapacity
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetCapacity' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeFleetCapacity' :: DescribeFleetCapacity -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeFleetCapacity
s@DescribeFleetCapacity' {} Maybe Text
a -> DescribeFleetCapacity
s {$sel:nextToken:DescribeFleetCapacity' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeFleetCapacity)

-- | The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages. This parameter
-- is ignored when the request specifies one or a list of fleet IDs.
describeFleetCapacity_limit :: Lens.Lens' DescribeFleetCapacity (Prelude.Maybe Prelude.Natural)
describeFleetCapacity_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeFleetCapacity -> f DescribeFleetCapacity
describeFleetCapacity_limit = (DescribeFleetCapacity -> Maybe Natural)
-> (DescribeFleetCapacity
    -> Maybe Natural -> DescribeFleetCapacity)
-> Lens
     DescribeFleetCapacity
     DescribeFleetCapacity
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetCapacity' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeFleetCapacity' :: DescribeFleetCapacity -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeFleetCapacity
s@DescribeFleetCapacity' {} Maybe Natural
a -> DescribeFleetCapacity
s {$sel:limit:DescribeFleetCapacity' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeFleetCapacity)

-- | A unique identifier for the fleet(s) to retrieve capacity information
-- for. You can use either the fleet ID or ARN value. Leave this parameter
-- empty to retrieve capacity information for all fleets.
describeFleetCapacity_fleetIds :: Lens.Lens' DescribeFleetCapacity (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeFleetCapacity_fleetIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeFleetCapacity -> f DescribeFleetCapacity
describeFleetCapacity_fleetIds = (DescribeFleetCapacity -> Maybe (NonEmpty Text))
-> (DescribeFleetCapacity
    -> Maybe (NonEmpty Text) -> DescribeFleetCapacity)
-> Lens
     DescribeFleetCapacity
     DescribeFleetCapacity
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetCapacity' {Maybe (NonEmpty Text)
fleetIds :: Maybe (NonEmpty Text)
$sel:fleetIds:DescribeFleetCapacity' :: DescribeFleetCapacity -> Maybe (NonEmpty Text)
fleetIds} -> Maybe (NonEmpty Text)
fleetIds) (\s :: DescribeFleetCapacity
s@DescribeFleetCapacity' {} Maybe (NonEmpty Text)
a -> DescribeFleetCapacity
s {$sel:fleetIds:DescribeFleetCapacity' :: Maybe (NonEmpty Text)
fleetIds = Maybe (NonEmpty Text)
a} :: DescribeFleetCapacity) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeFleetCapacity -> f DescribeFleetCapacity)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeFleetCapacity
-> f DescribeFleetCapacity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSPager DescribeFleetCapacity where
  page :: DescribeFleetCapacity
-> AWSResponse DescribeFleetCapacity -> Maybe DescribeFleetCapacity
page DescribeFleetCapacity
rq AWSResponse DescribeFleetCapacity
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeFleetCapacity
DescribeFleetCapacityResponse
rs
            DescribeFleetCapacityResponse
-> Getting (First Text) DescribeFleetCapacityResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeFleetCapacityResponse
-> Const (First Text) DescribeFleetCapacityResponse
Lens' DescribeFleetCapacityResponse (Maybe Text)
describeFleetCapacityResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeFleetCapacityResponse
 -> Const (First Text) DescribeFleetCapacityResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeFleetCapacityResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeFleetCapacity
forall a. Maybe a
Prelude.Nothing
    | Maybe [FleetCapacity] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeFleetCapacity
DescribeFleetCapacityResponse
rs
            DescribeFleetCapacityResponse
-> Getting
     (First [FleetCapacity])
     DescribeFleetCapacityResponse
     [FleetCapacity]
-> Maybe [FleetCapacity]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [FleetCapacity]
 -> Const (First [FleetCapacity]) (Maybe [FleetCapacity]))
-> DescribeFleetCapacityResponse
-> Const (First [FleetCapacity]) DescribeFleetCapacityResponse
Lens' DescribeFleetCapacityResponse (Maybe [FleetCapacity])
describeFleetCapacityResponse_fleetCapacity
              ((Maybe [FleetCapacity]
  -> Const (First [FleetCapacity]) (Maybe [FleetCapacity]))
 -> DescribeFleetCapacityResponse
 -> Const (First [FleetCapacity]) DescribeFleetCapacityResponse)
-> (([FleetCapacity]
     -> Const (First [FleetCapacity]) [FleetCapacity])
    -> Maybe [FleetCapacity]
    -> Const (First [FleetCapacity]) (Maybe [FleetCapacity]))
-> Getting
     (First [FleetCapacity])
     DescribeFleetCapacityResponse
     [FleetCapacity]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([FleetCapacity] -> Const (First [FleetCapacity]) [FleetCapacity])
-> Maybe [FleetCapacity]
-> Const (First [FleetCapacity]) (Maybe [FleetCapacity])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeFleetCapacity
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeFleetCapacity -> Maybe DescribeFleetCapacity
forall a. a -> Maybe a
Prelude.Just (DescribeFleetCapacity -> Maybe DescribeFleetCapacity)
-> DescribeFleetCapacity -> Maybe DescribeFleetCapacity
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeFleetCapacity
rq
          DescribeFleetCapacity
-> (DescribeFleetCapacity -> DescribeFleetCapacity)
-> DescribeFleetCapacity
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeFleetCapacity -> Identity DescribeFleetCapacity
Lens
  DescribeFleetCapacity
  DescribeFleetCapacity
  (Maybe Text)
  (Maybe Text)
describeFleetCapacity_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeFleetCapacity -> Identity DescribeFleetCapacity)
-> Maybe Text -> DescribeFleetCapacity -> DescribeFleetCapacity
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeFleetCapacity
DescribeFleetCapacityResponse
rs
          DescribeFleetCapacityResponse
-> Getting (First Text) DescribeFleetCapacityResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeFleetCapacityResponse
-> Const (First Text) DescribeFleetCapacityResponse
Lens' DescribeFleetCapacityResponse (Maybe Text)
describeFleetCapacityResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeFleetCapacityResponse
 -> Const (First Text) DescribeFleetCapacityResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeFleetCapacityResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeFleetCapacity where
  type
    AWSResponse DescribeFleetCapacity =
      DescribeFleetCapacityResponse
  request :: DescribeFleetCapacity -> Request DescribeFleetCapacity
request = Service -> DescribeFleetCapacity -> Request DescribeFleetCapacity
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeFleetCapacity
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFleetCapacity)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeFleetCapacity))
-> Logger
-> Service
-> Proxy DescribeFleetCapacity
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFleetCapacity)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [FleetCapacity] -> Int -> DescribeFleetCapacityResponse
DescribeFleetCapacityResponse'
            (Maybe Text
 -> Maybe [FleetCapacity] -> Int -> DescribeFleetCapacityResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [FleetCapacity] -> Int -> DescribeFleetCapacityResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe [FleetCapacity] -> Int -> DescribeFleetCapacityResponse)
-> Either String (Maybe [FleetCapacity])
-> Either String (Int -> DescribeFleetCapacityResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [FleetCapacity]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FleetCapacity" Either String (Maybe (Maybe [FleetCapacity]))
-> Maybe [FleetCapacity] -> Either String (Maybe [FleetCapacity])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FleetCapacity]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> DescribeFleetCapacityResponse)
-> Either String Int -> Either String DescribeFleetCapacityResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeFleetCapacity

instance Prelude.NFData DescribeFleetCapacity

instance Core.ToHeaders DescribeFleetCapacity where
  toHeaders :: DescribeFleetCapacity -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeFleetCapacity -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"GameLift.DescribeFleetCapacity" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeFleetCapacity where
  toJSON :: DescribeFleetCapacity -> Value
toJSON DescribeFleetCapacity' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
fleetIds :: Maybe (NonEmpty Text)
limit :: Maybe Natural
nextToken :: Maybe Text
$sel:fleetIds:DescribeFleetCapacity' :: DescribeFleetCapacity -> Maybe (NonEmpty Text)
$sel:limit:DescribeFleetCapacity' :: DescribeFleetCapacity -> Maybe Natural
$sel:nextToken:DescribeFleetCapacity' :: DescribeFleetCapacity -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            (Text
"FleetIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
fleetIds
          ]
      )

instance Core.ToPath DescribeFleetCapacity where
  toPath :: DescribeFleetCapacity -> ByteString
toPath = ByteString -> DescribeFleetCapacity -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeFleetCapacity where
  toQuery :: DescribeFleetCapacity -> QueryString
toQuery = QueryString -> DescribeFleetCapacity -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Represents the returned data in response to a request operation.
--
-- /See:/ 'newDescribeFleetCapacityResponse' smart constructor.
data DescribeFleetCapacityResponse = DescribeFleetCapacityResponse'
  { -- | A token that indicates where to resume retrieving results on the next
    -- call to this operation. If no token is returned, these results represent
    -- the end of the list.
    DescribeFleetCapacityResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A collection of objects that contains capacity information for each
    -- requested fleet ID. Capacity objects are returned only for fleets that
    -- currently exist.
    DescribeFleetCapacityResponse -> Maybe [FleetCapacity]
fleetCapacity :: Prelude.Maybe [FleetCapacity],
    -- | The response's http status code.
    DescribeFleetCapacityResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeFleetCapacityResponse
-> DescribeFleetCapacityResponse -> Bool
(DescribeFleetCapacityResponse
 -> DescribeFleetCapacityResponse -> Bool)
-> (DescribeFleetCapacityResponse
    -> DescribeFleetCapacityResponse -> Bool)
-> Eq DescribeFleetCapacityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFleetCapacityResponse
-> DescribeFleetCapacityResponse -> Bool
$c/= :: DescribeFleetCapacityResponse
-> DescribeFleetCapacityResponse -> Bool
== :: DescribeFleetCapacityResponse
-> DescribeFleetCapacityResponse -> Bool
$c== :: DescribeFleetCapacityResponse
-> DescribeFleetCapacityResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFleetCapacityResponse]
ReadPrec DescribeFleetCapacityResponse
Int -> ReadS DescribeFleetCapacityResponse
ReadS [DescribeFleetCapacityResponse]
(Int -> ReadS DescribeFleetCapacityResponse)
-> ReadS [DescribeFleetCapacityResponse]
-> ReadPrec DescribeFleetCapacityResponse
-> ReadPrec [DescribeFleetCapacityResponse]
-> Read DescribeFleetCapacityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFleetCapacityResponse]
$creadListPrec :: ReadPrec [DescribeFleetCapacityResponse]
readPrec :: ReadPrec DescribeFleetCapacityResponse
$creadPrec :: ReadPrec DescribeFleetCapacityResponse
readList :: ReadS [DescribeFleetCapacityResponse]
$creadList :: ReadS [DescribeFleetCapacityResponse]
readsPrec :: Int -> ReadS DescribeFleetCapacityResponse
$creadsPrec :: Int -> ReadS DescribeFleetCapacityResponse
Prelude.Read, Int -> DescribeFleetCapacityResponse -> ShowS
[DescribeFleetCapacityResponse] -> ShowS
DescribeFleetCapacityResponse -> String
(Int -> DescribeFleetCapacityResponse -> ShowS)
-> (DescribeFleetCapacityResponse -> String)
-> ([DescribeFleetCapacityResponse] -> ShowS)
-> Show DescribeFleetCapacityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFleetCapacityResponse] -> ShowS
$cshowList :: [DescribeFleetCapacityResponse] -> ShowS
show :: DescribeFleetCapacityResponse -> String
$cshow :: DescribeFleetCapacityResponse -> String
showsPrec :: Int -> DescribeFleetCapacityResponse -> ShowS
$cshowsPrec :: Int -> DescribeFleetCapacityResponse -> ShowS
Prelude.Show, (forall x.
 DescribeFleetCapacityResponse
 -> Rep DescribeFleetCapacityResponse x)
-> (forall x.
    Rep DescribeFleetCapacityResponse x
    -> DescribeFleetCapacityResponse)
-> Generic DescribeFleetCapacityResponse
forall x.
Rep DescribeFleetCapacityResponse x
-> DescribeFleetCapacityResponse
forall x.
DescribeFleetCapacityResponse
-> Rep DescribeFleetCapacityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFleetCapacityResponse x
-> DescribeFleetCapacityResponse
$cfrom :: forall x.
DescribeFleetCapacityResponse
-> Rep DescribeFleetCapacityResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFleetCapacityResponse' 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:
--
-- 'nextToken', 'describeFleetCapacityResponse_nextToken' - A token that indicates where to resume retrieving results on the next
-- call to this operation. If no token is returned, these results represent
-- the end of the list.
--
-- 'fleetCapacity', 'describeFleetCapacityResponse_fleetCapacity' - A collection of objects that contains capacity information for each
-- requested fleet ID. Capacity objects are returned only for fleets that
-- currently exist.
--
-- 'httpStatus', 'describeFleetCapacityResponse_httpStatus' - The response's http status code.
newDescribeFleetCapacityResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeFleetCapacityResponse
newDescribeFleetCapacityResponse :: Int -> DescribeFleetCapacityResponse
newDescribeFleetCapacityResponse Int
pHttpStatus_ =
  DescribeFleetCapacityResponse' :: Maybe Text
-> Maybe [FleetCapacity] -> Int -> DescribeFleetCapacityResponse
DescribeFleetCapacityResponse'
    { $sel:nextToken:DescribeFleetCapacityResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetCapacity:DescribeFleetCapacityResponse' :: Maybe [FleetCapacity]
fleetCapacity = Maybe [FleetCapacity]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeFleetCapacityResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A token that indicates where to resume retrieving results on the next
-- call to this operation. If no token is returned, these results represent
-- the end of the list.
describeFleetCapacityResponse_nextToken :: Lens.Lens' DescribeFleetCapacityResponse (Prelude.Maybe Prelude.Text)
describeFleetCapacityResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeFleetCapacityResponse -> f DescribeFleetCapacityResponse
describeFleetCapacityResponse_nextToken = (DescribeFleetCapacityResponse -> Maybe Text)
-> (DescribeFleetCapacityResponse
    -> Maybe Text -> DescribeFleetCapacityResponse)
-> Lens' DescribeFleetCapacityResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetCapacityResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeFleetCapacityResponse' :: DescribeFleetCapacityResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeFleetCapacityResponse
s@DescribeFleetCapacityResponse' {} Maybe Text
a -> DescribeFleetCapacityResponse
s {$sel:nextToken:DescribeFleetCapacityResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeFleetCapacityResponse)

-- | A collection of objects that contains capacity information for each
-- requested fleet ID. Capacity objects are returned only for fleets that
-- currently exist.
describeFleetCapacityResponse_fleetCapacity :: Lens.Lens' DescribeFleetCapacityResponse (Prelude.Maybe [FleetCapacity])
describeFleetCapacityResponse_fleetCapacity :: (Maybe [FleetCapacity] -> f (Maybe [FleetCapacity]))
-> DescribeFleetCapacityResponse -> f DescribeFleetCapacityResponse
describeFleetCapacityResponse_fleetCapacity = (DescribeFleetCapacityResponse -> Maybe [FleetCapacity])
-> (DescribeFleetCapacityResponse
    -> Maybe [FleetCapacity] -> DescribeFleetCapacityResponse)
-> Lens' DescribeFleetCapacityResponse (Maybe [FleetCapacity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetCapacityResponse' {Maybe [FleetCapacity]
fleetCapacity :: Maybe [FleetCapacity]
$sel:fleetCapacity:DescribeFleetCapacityResponse' :: DescribeFleetCapacityResponse -> Maybe [FleetCapacity]
fleetCapacity} -> Maybe [FleetCapacity]
fleetCapacity) (\s :: DescribeFleetCapacityResponse
s@DescribeFleetCapacityResponse' {} Maybe [FleetCapacity]
a -> DescribeFleetCapacityResponse
s {$sel:fleetCapacity:DescribeFleetCapacityResponse' :: Maybe [FleetCapacity]
fleetCapacity = Maybe [FleetCapacity]
a} :: DescribeFleetCapacityResponse) ((Maybe [FleetCapacity] -> f (Maybe [FleetCapacity]))
 -> DescribeFleetCapacityResponse
 -> f DescribeFleetCapacityResponse)
-> ((Maybe [FleetCapacity] -> f (Maybe [FleetCapacity]))
    -> Maybe [FleetCapacity] -> f (Maybe [FleetCapacity]))
-> (Maybe [FleetCapacity] -> f (Maybe [FleetCapacity]))
-> DescribeFleetCapacityResponse
-> f DescribeFleetCapacityResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FleetCapacity] [FleetCapacity] [FleetCapacity] [FleetCapacity]
-> Iso
     (Maybe [FleetCapacity])
     (Maybe [FleetCapacity])
     (Maybe [FleetCapacity])
     (Maybe [FleetCapacity])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [FleetCapacity] [FleetCapacity] [FleetCapacity] [FleetCapacity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
describeFleetCapacityResponse_httpStatus :: Lens.Lens' DescribeFleetCapacityResponse Prelude.Int
describeFleetCapacityResponse_httpStatus :: (Int -> f Int)
-> DescribeFleetCapacityResponse -> f DescribeFleetCapacityResponse
describeFleetCapacityResponse_httpStatus = (DescribeFleetCapacityResponse -> Int)
-> (DescribeFleetCapacityResponse
    -> Int -> DescribeFleetCapacityResponse)
-> Lens
     DescribeFleetCapacityResponse DescribeFleetCapacityResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFleetCapacityResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeFleetCapacityResponse' :: DescribeFleetCapacityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeFleetCapacityResponse
s@DescribeFleetCapacityResponse' {} Int
a -> DescribeFleetCapacityResponse
s {$sel:httpStatus:DescribeFleetCapacityResponse' :: Int
httpStatus = Int
a} :: DescribeFleetCapacityResponse)

instance Prelude.NFData DescribeFleetCapacityResponse