amazonka-gamelift-1.4.3: gen/Network/AWS/GameLift/DescribeFleetAttributes.hs
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.GameLift.DescribeFleetAttributes
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves fleet properties, including metadata, status, and configuration, for one or more fleets. You can request attributes for all fleets, or specify a list of one or more fleet IDs. When requesting all fleets, use the pagination parameters to retrieve results as a set of sequential pages. If successful, a < FleetAttributes> object is returned for each requested fleet ID. When specifying a list of fleet IDs, attribute objects are returned only for fleets that currently exist.
--
-- Some API actions may limit the number of fleet IDs allowed in one request. If a request exceeds this limit, the request fails and the error message includes the maximum allowed.
module Network.AWS.GameLift.DescribeFleetAttributes
(
-- * Creating a Request
describeFleetAttributes
, DescribeFleetAttributes
-- * Request Lenses
, dfaNextToken
, dfaLimit
, dfaFleetIds
-- * Destructuring the Response
, describeFleetAttributesResponse
, DescribeFleetAttributesResponse
-- * Response Lenses
, dfarsNextToken
, dfarsFleetAttributes
, dfarsResponseStatus
) where
import Network.AWS.GameLift.Types
import Network.AWS.GameLift.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
-- | Represents the input for a request action.
--
-- /See:/ 'describeFleetAttributes' smart constructor.
data DescribeFleetAttributes = DescribeFleetAttributes'
{ _dfaNextToken :: !(Maybe Text)
, _dfaLimit :: !(Maybe Nat)
, _dfaFleetIds :: !(Maybe (List1 Text))
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'DescribeFleetAttributes' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dfaNextToken'
--
-- * 'dfaLimit'
--
-- * 'dfaFleetIds'
describeFleetAttributes
:: DescribeFleetAttributes
describeFleetAttributes =
DescribeFleetAttributes'
{ _dfaNextToken = Nothing
, _dfaLimit = Nothing
, _dfaFleetIds = Nothing
}
-- | Token indicating the start of the next sequential page of results. Use the token that is returned with a previous call to this action. To specify the start of the result set, do not specify a value. This parameter is ignored when the request specifies one or a list of fleet IDs.
dfaNextToken :: Lens' DescribeFleetAttributes (Maybe Text)
dfaNextToken = lens _dfaNextToken (\ s a -> s{_dfaNextToken = a});
-- | Maximum number of results to return. You can 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.
dfaLimit :: Lens' DescribeFleetAttributes (Maybe Natural)
dfaLimit = lens _dfaLimit (\ s a -> s{_dfaLimit = a}) . mapping _Nat;
-- | Unique identifiers for the fleet(s) that you want to retrieve attributes for. Leave this parameter empty to retrieve attributes for all fleets.
dfaFleetIds :: Lens' DescribeFleetAttributes (Maybe (NonEmpty Text))
dfaFleetIds = lens _dfaFleetIds (\ s a -> s{_dfaFleetIds = a}) . mapping _List1;
instance AWSRequest DescribeFleetAttributes where
type Rs DescribeFleetAttributes =
DescribeFleetAttributesResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
DescribeFleetAttributesResponse' <$>
(x .?> "NextToken") <*>
(x .?> "FleetAttributes" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeFleetAttributes
instance NFData DescribeFleetAttributes
instance ToHeaders DescribeFleetAttributes where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.DescribeFleetAttributes" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeFleetAttributes where
toJSON DescribeFleetAttributes'{..}
= object
(catMaybes
[("NextToken" .=) <$> _dfaNextToken,
("Limit" .=) <$> _dfaLimit,
("FleetIds" .=) <$> _dfaFleetIds])
instance ToPath DescribeFleetAttributes where
toPath = const "/"
instance ToQuery DescribeFleetAttributes where
toQuery = const mempty
-- | Represents the returned data in response to a request action.
--
-- /See:/ 'describeFleetAttributesResponse' smart constructor.
data DescribeFleetAttributesResponse = DescribeFleetAttributesResponse'
{ _dfarsNextToken :: !(Maybe Text)
, _dfarsFleetAttributes :: !(Maybe [FleetAttributes])
, _dfarsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
-- | Creates a value of 'DescribeFleetAttributesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dfarsNextToken'
--
-- * 'dfarsFleetAttributes'
--
-- * 'dfarsResponseStatus'
describeFleetAttributesResponse
:: Int -- ^ 'dfarsResponseStatus'
-> DescribeFleetAttributesResponse
describeFleetAttributesResponse pResponseStatus_ =
DescribeFleetAttributesResponse'
{ _dfarsNextToken = Nothing
, _dfarsFleetAttributes = Nothing
, _dfarsResponseStatus = pResponseStatus_
}
-- | Token indicating where to resume retrieving results on the next call to this action. If no token is returned, these results represent the end of the list.
--
-- If a request has a limit that exactly matches the number of remaining results, a token is returned even though there are no more results to retrieve.
dfarsNextToken :: Lens' DescribeFleetAttributesResponse (Maybe Text)
dfarsNextToken = lens _dfarsNextToken (\ s a -> s{_dfarsNextToken = a});
-- | Collection of objects containing attribute metadata for each requested fleet ID.
dfarsFleetAttributes :: Lens' DescribeFleetAttributesResponse [FleetAttributes]
dfarsFleetAttributes = lens _dfarsFleetAttributes (\ s a -> s{_dfarsFleetAttributes = a}) . _Default . _Coerce;
-- | The response status code.
dfarsResponseStatus :: Lens' DescribeFleetAttributesResponse Int
dfarsResponseStatus = lens _dfarsResponseStatus (\ s a -> s{_dfarsResponseStatus = a});
instance NFData DescribeFleetAttributesResponse