{-# 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.ListFleets
-- 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 a collection of fleet resources in an AWS Region. You can call
-- this operation to get fleets in a previously selected default Region
-- (see
-- <https://docs.aws.amazon.com/credref/latest/refdocs/setting-global-region.html>or
-- specify a Region in your request. You can filter the result set to find
-- only those fleets that are deployed with a specific build or script. For
-- fleets that have multiple locations, this operation retrieves fleets
-- based on their home Region only.
--
-- This operation can be used in the following ways:
--
-- -   To get a list of all fleets in a Region, don\'t provide a build or
--     script identifier.
--
-- -   To get a list of all fleets where a specific custom game build is
--     deployed, provide the build ID.
--
-- -   To get a list of all Realtime Servers fleets with a specific
--     configuration script, provide the script ID.
--
-- Use the pagination parameters to retrieve results as a set of sequential
-- pages.
--
-- If successful, a list of fleet IDs that match the request parameters is
-- returned. A NextToken value is also returned if there are more result
-- pages to retrieve.
--
-- Fleet resources are not listed in a particular order.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-intro.html Setting up GameLift fleets>
--
-- __Related actions__
--
-- CreateFleet | UpdateFleetCapacity | PutScalingPolicy |
-- DescribeEC2InstanceLimits | DescribeFleetAttributes |
-- DescribeFleetLocationAttributes | UpdateFleetAttributes |
-- StopFleetActions | DeleteFleet |
-- <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.ListFleets
  ( -- * Creating a Request
    ListFleets (..),
    newListFleets,

    -- * Request Lenses
    listFleets_buildId,
    listFleets_nextToken,
    listFleets_scriptId,
    listFleets_limit,

    -- * Destructuring the Response
    ListFleetsResponse (..),
    newListFleetsResponse,

    -- * Response Lenses
    listFleetsResponse_nextToken,
    listFleetsResponse_fleetIds,
    listFleetsResponse_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:/ 'newListFleets' smart constructor.
data ListFleets = ListFleets'
  { -- | A unique identifier for the build to request fleets for. Use this
    -- parameter to return only fleets using a specified build. Use either the
    -- build ID or ARN value.
    ListFleets -> Maybe Text
buildId :: Prelude.Maybe Prelude.Text,
    -- | 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.
    ListFleets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the Realtime script to request fleets for. Use
    -- this parameter to return only fleets using a specified script. Use
    -- either the script ID or ARN value.
    ListFleets -> Maybe Text
scriptId :: 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.
    ListFleets -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListFleets -> ListFleets -> Bool
(ListFleets -> ListFleets -> Bool)
-> (ListFleets -> ListFleets -> Bool) -> Eq ListFleets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFleets -> ListFleets -> Bool
$c/= :: ListFleets -> ListFleets -> Bool
== :: ListFleets -> ListFleets -> Bool
$c== :: ListFleets -> ListFleets -> Bool
Prelude.Eq, ReadPrec [ListFleets]
ReadPrec ListFleets
Int -> ReadS ListFleets
ReadS [ListFleets]
(Int -> ReadS ListFleets)
-> ReadS [ListFleets]
-> ReadPrec ListFleets
-> ReadPrec [ListFleets]
-> Read ListFleets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFleets]
$creadListPrec :: ReadPrec [ListFleets]
readPrec :: ReadPrec ListFleets
$creadPrec :: ReadPrec ListFleets
readList :: ReadS [ListFleets]
$creadList :: ReadS [ListFleets]
readsPrec :: Int -> ReadS ListFleets
$creadsPrec :: Int -> ReadS ListFleets
Prelude.Read, Int -> ListFleets -> ShowS
[ListFleets] -> ShowS
ListFleets -> String
(Int -> ListFleets -> ShowS)
-> (ListFleets -> String)
-> ([ListFleets] -> ShowS)
-> Show ListFleets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFleets] -> ShowS
$cshowList :: [ListFleets] -> ShowS
show :: ListFleets -> String
$cshow :: ListFleets -> String
showsPrec :: Int -> ListFleets -> ShowS
$cshowsPrec :: Int -> ListFleets -> ShowS
Prelude.Show, (forall x. ListFleets -> Rep ListFleets x)
-> (forall x. Rep ListFleets x -> ListFleets) -> Generic ListFleets
forall x. Rep ListFleets x -> ListFleets
forall x. ListFleets -> Rep ListFleets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFleets x -> ListFleets
$cfrom :: forall x. ListFleets -> Rep ListFleets x
Prelude.Generic)

-- |
-- Create a value of 'ListFleets' 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:
--
-- 'buildId', 'listFleets_buildId' - A unique identifier for the build to request fleets for. Use this
-- parameter to return only fleets using a specified build. Use either the
-- build ID or ARN value.
--
-- 'nextToken', 'listFleets_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.
--
-- 'scriptId', 'listFleets_scriptId' - A unique identifier for the Realtime script to request fleets for. Use
-- this parameter to return only fleets using a specified script. Use
-- either the script ID or ARN value.
--
-- 'limit', 'listFleets_limit' - The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
newListFleets ::
  ListFleets
newListFleets :: ListFleets
newListFleets =
  ListFleets' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Natural -> ListFleets
ListFleets'
    { $sel:buildId:ListFleets' :: Maybe Text
buildId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFleets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scriptId:ListFleets' :: Maybe Text
scriptId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:ListFleets' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A unique identifier for the build to request fleets for. Use this
-- parameter to return only fleets using a specified build. Use either the
-- build ID or ARN value.
listFleets_buildId :: Lens.Lens' ListFleets (Prelude.Maybe Prelude.Text)
listFleets_buildId :: (Maybe Text -> f (Maybe Text)) -> ListFleets -> f ListFleets
listFleets_buildId = (ListFleets -> Maybe Text)
-> (ListFleets -> Maybe Text -> ListFleets)
-> Lens ListFleets ListFleets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleets' {Maybe Text
buildId :: Maybe Text
$sel:buildId:ListFleets' :: ListFleets -> Maybe Text
buildId} -> Maybe Text
buildId) (\s :: ListFleets
s@ListFleets' {} Maybe Text
a -> ListFleets
s {$sel:buildId:ListFleets' :: Maybe Text
buildId = Maybe Text
a} :: ListFleets)

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

-- | A unique identifier for the Realtime script to request fleets for. Use
-- this parameter to return only fleets using a specified script. Use
-- either the script ID or ARN value.
listFleets_scriptId :: Lens.Lens' ListFleets (Prelude.Maybe Prelude.Text)
listFleets_scriptId :: (Maybe Text -> f (Maybe Text)) -> ListFleets -> f ListFleets
listFleets_scriptId = (ListFleets -> Maybe Text)
-> (ListFleets -> Maybe Text -> ListFleets)
-> Lens ListFleets ListFleets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleets' {Maybe Text
scriptId :: Maybe Text
$sel:scriptId:ListFleets' :: ListFleets -> Maybe Text
scriptId} -> Maybe Text
scriptId) (\s :: ListFleets
s@ListFleets' {} Maybe Text
a -> ListFleets
s {$sel:scriptId:ListFleets' :: Maybe Text
scriptId = Maybe Text
a} :: ListFleets)

-- | The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
listFleets_limit :: Lens.Lens' ListFleets (Prelude.Maybe Prelude.Natural)
listFleets_limit :: (Maybe Natural -> f (Maybe Natural)) -> ListFleets -> f ListFleets
listFleets_limit = (ListFleets -> Maybe Natural)
-> (ListFleets -> Maybe Natural -> ListFleets)
-> Lens ListFleets ListFleets (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleets' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListFleets' :: ListFleets -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListFleets
s@ListFleets' {} Maybe Natural
a -> ListFleets
s {$sel:limit:ListFleets' :: Maybe Natural
limit = Maybe Natural
a} :: ListFleets)

instance Core.AWSPager ListFleets where
  page :: ListFleets -> AWSResponse ListFleets -> Maybe ListFleets
page ListFleets
rq AWSResponse ListFleets
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFleets
ListFleetsResponse
rs
            ListFleetsResponse
-> Getting (First Text) ListFleetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFleetsResponse -> Const (First Text) ListFleetsResponse
Lens' ListFleetsResponse (Maybe Text)
listFleetsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFleetsResponse -> Const (First Text) ListFleetsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFleetsResponse 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 ListFleets
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFleets
ListFleetsResponse
rs
            ListFleetsResponse
-> Getting (First [Text]) ListFleetsResponse [Text] -> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> ListFleetsResponse -> Const (First [Text]) ListFleetsResponse
Lens' ListFleetsResponse (Maybe (NonEmpty Text))
listFleetsResponse_fleetIds ((Maybe (NonEmpty Text)
  -> Const (First [Text]) (Maybe (NonEmpty Text)))
 -> ListFleetsResponse -> Const (First [Text]) ListFleetsResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe (NonEmpty Text)
    -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> Getting (First [Text]) ListFleetsResponse [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
-> Maybe (NonEmpty Text)
-> Const (First [Text]) (Maybe (NonEmpty Text))
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
 -> Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> (([Text] -> Const (First [Text]) [Text])
    -> NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
-> ([Text] -> Const (First [Text]) [Text])
-> Maybe (NonEmpty Text)
-> Const (First [Text]) (Maybe (NonEmpty Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> [Text])
-> ([Text] -> Const (First [Text]) [Text])
-> NonEmpty Text
-> Const (First [Text]) (NonEmpty Text)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty Text -> [Text]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe ListFleets
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListFleets -> Maybe ListFleets
forall a. a -> Maybe a
Prelude.Just (ListFleets -> Maybe ListFleets) -> ListFleets -> Maybe ListFleets
forall a b. (a -> b) -> a -> b
Prelude.$
        ListFleets
rq
          ListFleets -> (ListFleets -> ListFleets) -> ListFleets
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListFleets -> Identity ListFleets
Lens ListFleets ListFleets (Maybe Text) (Maybe Text)
listFleets_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListFleets -> Identity ListFleets)
-> Maybe Text -> ListFleets -> ListFleets
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFleets
ListFleetsResponse
rs
          ListFleetsResponse
-> Getting (First Text) ListFleetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFleetsResponse -> Const (First Text) ListFleetsResponse
Lens' ListFleetsResponse (Maybe Text)
listFleetsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFleetsResponse -> Const (First Text) ListFleetsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFleetsResponse 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 ListFleets where
  type AWSResponse ListFleets = ListFleetsResponse
  request :: ListFleets -> Request ListFleets
request = Service -> ListFleets -> Request ListFleets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListFleets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFleets)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListFleets))
-> Logger
-> Service
-> Proxy ListFleets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFleets)))
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 (NonEmpty Text) -> Int -> ListFleetsResponse
ListFleetsResponse'
            (Maybe Text -> Maybe (NonEmpty Text) -> Int -> ListFleetsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe (NonEmpty Text) -> Int -> ListFleetsResponse)
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 (NonEmpty Text) -> Int -> ListFleetsResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either String (Int -> ListFleetsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FleetIds")
            Either String (Int -> ListFleetsResponse)
-> Either String Int -> Either String ListFleetsResponse
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 ListFleets

instance Prelude.NFData ListFleets

instance Core.ToHeaders ListFleets where
  toHeaders :: ListFleets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListFleets -> 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.ListFleets" :: 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 ListFleets where
  toJSON :: ListFleets -> Value
toJSON ListFleets' {Maybe Natural
Maybe Text
limit :: Maybe Natural
scriptId :: Maybe Text
nextToken :: Maybe Text
buildId :: Maybe Text
$sel:limit:ListFleets' :: ListFleets -> Maybe Natural
$sel:scriptId:ListFleets' :: ListFleets -> Maybe Text
$sel:nextToken:ListFleets' :: ListFleets -> Maybe Text
$sel:buildId:ListFleets' :: ListFleets -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BuildId" 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
buildId,
            (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
"ScriptId" 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
scriptId,
            (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
          ]
      )

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

instance Core.ToQuery ListFleets where
  toQuery :: ListFleets -> QueryString
toQuery = QueryString -> ListFleets -> 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:/ 'newListFleetsResponse' smart constructor.
data ListFleetsResponse = ListFleetsResponse'
  { -- | 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.
    ListFleetsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A set of fleet IDs that match the list request. You can retrieve
    -- additional information about all returned fleets by passing this result
    -- set to a DescribeFleetAttributes, DescribeFleetCapacity, or
    -- DescribeFleetUtilization call.
    ListFleetsResponse -> Maybe (NonEmpty Text)
fleetIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The response's http status code.
    ListFleetsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListFleetsResponse -> ListFleetsResponse -> Bool
(ListFleetsResponse -> ListFleetsResponse -> Bool)
-> (ListFleetsResponse -> ListFleetsResponse -> Bool)
-> Eq ListFleetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFleetsResponse -> ListFleetsResponse -> Bool
$c/= :: ListFleetsResponse -> ListFleetsResponse -> Bool
== :: ListFleetsResponse -> ListFleetsResponse -> Bool
$c== :: ListFleetsResponse -> ListFleetsResponse -> Bool
Prelude.Eq, ReadPrec [ListFleetsResponse]
ReadPrec ListFleetsResponse
Int -> ReadS ListFleetsResponse
ReadS [ListFleetsResponse]
(Int -> ReadS ListFleetsResponse)
-> ReadS [ListFleetsResponse]
-> ReadPrec ListFleetsResponse
-> ReadPrec [ListFleetsResponse]
-> Read ListFleetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFleetsResponse]
$creadListPrec :: ReadPrec [ListFleetsResponse]
readPrec :: ReadPrec ListFleetsResponse
$creadPrec :: ReadPrec ListFleetsResponse
readList :: ReadS [ListFleetsResponse]
$creadList :: ReadS [ListFleetsResponse]
readsPrec :: Int -> ReadS ListFleetsResponse
$creadsPrec :: Int -> ReadS ListFleetsResponse
Prelude.Read, Int -> ListFleetsResponse -> ShowS
[ListFleetsResponse] -> ShowS
ListFleetsResponse -> String
(Int -> ListFleetsResponse -> ShowS)
-> (ListFleetsResponse -> String)
-> ([ListFleetsResponse] -> ShowS)
-> Show ListFleetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFleetsResponse] -> ShowS
$cshowList :: [ListFleetsResponse] -> ShowS
show :: ListFleetsResponse -> String
$cshow :: ListFleetsResponse -> String
showsPrec :: Int -> ListFleetsResponse -> ShowS
$cshowsPrec :: Int -> ListFleetsResponse -> ShowS
Prelude.Show, (forall x. ListFleetsResponse -> Rep ListFleetsResponse x)
-> (forall x. Rep ListFleetsResponse x -> ListFleetsResponse)
-> Generic ListFleetsResponse
forall x. Rep ListFleetsResponse x -> ListFleetsResponse
forall x. ListFleetsResponse -> Rep ListFleetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFleetsResponse x -> ListFleetsResponse
$cfrom :: forall x. ListFleetsResponse -> Rep ListFleetsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListFleetsResponse' 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', 'listFleetsResponse_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.
--
-- 'fleetIds', 'listFleetsResponse_fleetIds' - A set of fleet IDs that match the list request. You can retrieve
-- additional information about all returned fleets by passing this result
-- set to a DescribeFleetAttributes, DescribeFleetCapacity, or
-- DescribeFleetUtilization call.
--
-- 'httpStatus', 'listFleetsResponse_httpStatus' - The response's http status code.
newListFleetsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListFleetsResponse
newListFleetsResponse :: Int -> ListFleetsResponse
newListFleetsResponse Int
pHttpStatus_ =
  ListFleetsResponse' :: Maybe Text -> Maybe (NonEmpty Text) -> Int -> ListFleetsResponse
ListFleetsResponse'
    { $sel:nextToken:ListFleetsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetIds:ListFleetsResponse' :: Maybe (NonEmpty Text)
fleetIds = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListFleetsResponse' :: 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.
listFleetsResponse_nextToken :: Lens.Lens' ListFleetsResponse (Prelude.Maybe Prelude.Text)
listFleetsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFleetsResponse -> f ListFleetsResponse
listFleetsResponse_nextToken = (ListFleetsResponse -> Maybe Text)
-> (ListFleetsResponse -> Maybe Text -> ListFleetsResponse)
-> Lens' ListFleetsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFleetsResponse' :: ListFleetsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFleetsResponse
s@ListFleetsResponse' {} Maybe Text
a -> ListFleetsResponse
s {$sel:nextToken:ListFleetsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFleetsResponse)

-- | A set of fleet IDs that match the list request. You can retrieve
-- additional information about all returned fleets by passing this result
-- set to a DescribeFleetAttributes, DescribeFleetCapacity, or
-- DescribeFleetUtilization call.
listFleetsResponse_fleetIds :: Lens.Lens' ListFleetsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listFleetsResponse_fleetIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListFleetsResponse -> f ListFleetsResponse
listFleetsResponse_fleetIds = (ListFleetsResponse -> Maybe (NonEmpty Text))
-> (ListFleetsResponse
    -> Maybe (NonEmpty Text) -> ListFleetsResponse)
-> Lens' ListFleetsResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFleetsResponse' {Maybe (NonEmpty Text)
fleetIds :: Maybe (NonEmpty Text)
$sel:fleetIds:ListFleetsResponse' :: ListFleetsResponse -> Maybe (NonEmpty Text)
fleetIds} -> Maybe (NonEmpty Text)
fleetIds) (\s :: ListFleetsResponse
s@ListFleetsResponse' {} Maybe (NonEmpty Text)
a -> ListFleetsResponse
s {$sel:fleetIds:ListFleetsResponse' :: Maybe (NonEmpty Text)
fleetIds = Maybe (NonEmpty Text)
a} :: ListFleetsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListFleetsResponse -> f ListFleetsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListFleetsResponse
-> f ListFleetsResponse
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

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

instance Prelude.NFData ListFleetsResponse